@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
|
@@ -0,0 +1,554 @@
|
|
|
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.RealWorldExamples = exports.Positions = exports.PerformanceTest = exports.MultipleToasts = exports.Interactive = exports.Default = exports.AutoCloseTiming = exports.AllPositions = exports.AccessibilityDemo = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _ToastNotificationWrapper = _interopRequireWildcard(require("./ToastNotificationWrapper"));
|
|
10
|
+
var _Button = _interopRequireDefault(require("../Button/Button"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
|
+
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); }
|
|
13
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
14
|
+
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."); }
|
|
15
|
+
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; } }
|
|
16
|
+
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; }
|
|
17
|
+
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; } }
|
|
18
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
19
|
+
var meta = {
|
|
20
|
+
title: 'Components/ToastNotification',
|
|
21
|
+
component: _ToastNotificationWrapper["default"],
|
|
22
|
+
parameters: {
|
|
23
|
+
layout: 'fullscreen',
|
|
24
|
+
docs: {
|
|
25
|
+
description: {
|
|
26
|
+
component: 'A flexible toast notification system with support for different types, auto-close functionality, progress indicators, and positioning. Position is controlled through function arguments, not component props.'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
tags: ['autodocs'],
|
|
31
|
+
argTypes: {
|
|
32
|
+
// No position prop since it's handled through function arguments
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var _default = exports["default"] = meta; // Wrapper component to demonstrate functionality
|
|
36
|
+
var ToastDemo = function ToastDemo(_ref) {
|
|
37
|
+
var children = _ref.children;
|
|
38
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
39
|
+
style: {
|
|
40
|
+
padding: '2rem'
|
|
41
|
+
}
|
|
42
|
+
}, /*#__PURE__*/_react["default"].createElement(_ToastNotificationWrapper["default"], null), children);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Basic usage
|
|
46
|
+
var Default = exports.Default = {
|
|
47
|
+
render: function render() {
|
|
48
|
+
return /*#__PURE__*/_react["default"].createElement(ToastDemo, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
49
|
+
style: {
|
|
50
|
+
display: 'flex',
|
|
51
|
+
gap: '1rem',
|
|
52
|
+
flexWrap: 'wrap'
|
|
53
|
+
}
|
|
54
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
55
|
+
onClick: function onClick() {
|
|
56
|
+
return (0, _ToastNotificationWrapper.successToast)('Operation completed successfully!');
|
|
57
|
+
}
|
|
58
|
+
}, "Success Toast"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
59
|
+
onClick: function onClick() {
|
|
60
|
+
return (0, _ToastNotificationWrapper.errorToast)('Something went wrong!');
|
|
61
|
+
}
|
|
62
|
+
}, "Error Toast"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
63
|
+
onClick: function onClick() {
|
|
64
|
+
return (0, _ToastNotificationWrapper.warningToast)('Please check your input');
|
|
65
|
+
}
|
|
66
|
+
}, "Warning Toast"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
67
|
+
onClick: function onClick() {
|
|
68
|
+
return (0, _ToastNotificationWrapper.infoToast)('Here is some useful information');
|
|
69
|
+
}
|
|
70
|
+
}, "Info Toast")));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// Position demonstrations
|
|
75
|
+
var Positions = exports.Positions = {
|
|
76
|
+
render: function render() {
|
|
77
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
78
|
+
style: {
|
|
79
|
+
padding: '2rem'
|
|
80
|
+
}
|
|
81
|
+
}, /*#__PURE__*/_react["default"].createElement(_ToastNotificationWrapper["default"], null), /*#__PURE__*/_react["default"].createElement("div", {
|
|
82
|
+
style: {
|
|
83
|
+
marginBottom: '2rem'
|
|
84
|
+
}
|
|
85
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Toast Positions"), /*#__PURE__*/_react["default"].createElement("p", null, "Click buttons to see toasts appear in different corners using toastPosition option:"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
86
|
+
onClick: function onClick() {
|
|
87
|
+
return (0, _ToastNotificationWrapper.resetToast)();
|
|
88
|
+
},
|
|
89
|
+
style: {
|
|
90
|
+
marginBottom: '1rem'
|
|
91
|
+
}
|
|
92
|
+
}, "Clear All")), /*#__PURE__*/_react["default"].createElement("div", {
|
|
93
|
+
style: {
|
|
94
|
+
display: 'grid',
|
|
95
|
+
gridTemplateColumns: '1fr 1fr',
|
|
96
|
+
gap: '2rem'
|
|
97
|
+
}
|
|
98
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("h4", null, "Top Positions"), /*#__PURE__*/_react["default"].createElement("div", {
|
|
99
|
+
style: {
|
|
100
|
+
display: 'flex',
|
|
101
|
+
gap: '1rem',
|
|
102
|
+
flexWrap: 'wrap',
|
|
103
|
+
marginBottom: '1rem'
|
|
104
|
+
}
|
|
105
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
106
|
+
onClick: function onClick() {
|
|
107
|
+
return (0, _ToastNotificationWrapper.successToast)('Top-left success!', {
|
|
108
|
+
toastPosition: 'top-left'
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}, "Top Left"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
112
|
+
onClick: function onClick() {
|
|
113
|
+
return (0, _ToastNotificationWrapper.errorToast)('Top-right error!', {
|
|
114
|
+
toastPosition: 'top-right'
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}, "Top Right"))), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("h4", null, "Bottom Positions"), /*#__PURE__*/_react["default"].createElement("div", {
|
|
118
|
+
style: {
|
|
119
|
+
display: 'flex',
|
|
120
|
+
gap: '1rem',
|
|
121
|
+
flexWrap: 'wrap'
|
|
122
|
+
}
|
|
123
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
124
|
+
onClick: function onClick() {
|
|
125
|
+
return (0, _ToastNotificationWrapper.warningToast)('Bottom-left warning!', {
|
|
126
|
+
toastPosition: 'bottom-left'
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}, "Bottom Left"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
130
|
+
onClick: function onClick() {
|
|
131
|
+
return (0, _ToastNotificationWrapper.infoToast)('Bottom-right info!', {
|
|
132
|
+
toastPosition: 'bottom-right'
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}, "Bottom Right")))));
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// All four positions at once
|
|
140
|
+
var AllPositions = exports.AllPositions = {
|
|
141
|
+
render: function render() {
|
|
142
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
143
|
+
style: {
|
|
144
|
+
padding: '2rem'
|
|
145
|
+
}
|
|
146
|
+
}, /*#__PURE__*/_react["default"].createElement(_ToastNotificationWrapper["default"], null), /*#__PURE__*/_react["default"].createElement("div", {
|
|
147
|
+
style: {
|
|
148
|
+
marginBottom: '2rem'
|
|
149
|
+
}
|
|
150
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "All Positions Demo"), /*#__PURE__*/_react["default"].createElement("p", null, "Click the buttons below to see toasts appear in all four corners simultaneously:")), /*#__PURE__*/_react["default"].createElement("div", {
|
|
151
|
+
style: {
|
|
152
|
+
display: 'flex',
|
|
153
|
+
gap: '1rem',
|
|
154
|
+
flexWrap: 'wrap'
|
|
155
|
+
}
|
|
156
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
157
|
+
onClick: function onClick() {
|
|
158
|
+
(0, _ToastNotificationWrapper.successToast)('Top-left success!', {
|
|
159
|
+
toastPosition: 'top-left'
|
|
160
|
+
});
|
|
161
|
+
(0, _ToastNotificationWrapper.successToast)('Top-right success!', {
|
|
162
|
+
toastPosition: 'top-right'
|
|
163
|
+
});
|
|
164
|
+
(0, _ToastNotificationWrapper.successToast)('Bottom-left success!', {
|
|
165
|
+
toastPosition: 'bottom-left'
|
|
166
|
+
});
|
|
167
|
+
(0, _ToastNotificationWrapper.successToast)('Bottom-right success!', {
|
|
168
|
+
toastPosition: 'bottom-right'
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}, "Success in All Corners"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
172
|
+
onClick: function onClick() {
|
|
173
|
+
(0, _ToastNotificationWrapper.errorToast)('Top-left error!', {
|
|
174
|
+
toastPosition: 'top-left'
|
|
175
|
+
});
|
|
176
|
+
(0, _ToastNotificationWrapper.warningToast)('Top-right warning!', {
|
|
177
|
+
toastPosition: 'top-right'
|
|
178
|
+
});
|
|
179
|
+
(0, _ToastNotificationWrapper.infoToast)('Bottom-left info!', {
|
|
180
|
+
toastPosition: 'bottom-left'
|
|
181
|
+
});
|
|
182
|
+
(0, _ToastNotificationWrapper.errorToast)('Bottom-right error!', {
|
|
183
|
+
toastPosition: 'bottom-right'
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}, "Mixed Types All Corners"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
187
|
+
onClick: function onClick() {
|
|
188
|
+
return (0, _ToastNotificationWrapper.resetToast)();
|
|
189
|
+
}
|
|
190
|
+
}, "Clear All Toasts")));
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// Different auto-close times
|
|
195
|
+
var AutoCloseTiming = exports.AutoCloseTiming = {
|
|
196
|
+
render: function render() {
|
|
197
|
+
return /*#__PURE__*/_react["default"].createElement(ToastDemo, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
198
|
+
style: {
|
|
199
|
+
display: 'flex',
|
|
200
|
+
gap: '1rem',
|
|
201
|
+
flexWrap: 'wrap'
|
|
202
|
+
}
|
|
203
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
204
|
+
onClick: function onClick() {
|
|
205
|
+
return (0, _ToastNotificationWrapper.successToast)('Quick toast (2 seconds)', {
|
|
206
|
+
fadeOutTime: 2000
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}, "2 Second Toast"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
210
|
+
onClick: function onClick() {
|
|
211
|
+
return (0, _ToastNotificationWrapper.infoToast)('Standard toast (6 seconds)', {
|
|
212
|
+
fadeOutTime: 6000
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}, "6 Second Toast"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
216
|
+
onClick: function onClick() {
|
|
217
|
+
return (0, _ToastNotificationWrapper.warningToast)('Long toast (10 seconds)', {
|
|
218
|
+
fadeOutTime: 10000
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}, "10 Second Toast"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
222
|
+
onClick: function onClick() {
|
|
223
|
+
return (0, _ToastNotificationWrapper.errorToast)('Manual close required', {
|
|
224
|
+
autoClose: false
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}, "No Auto-Close")));
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
// Multiple toasts
|
|
232
|
+
var MultipleToasts = exports.MultipleToasts = {
|
|
233
|
+
render: function render() {
|
|
234
|
+
return /*#__PURE__*/_react["default"].createElement(ToastDemo, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
235
|
+
style: {
|
|
236
|
+
display: 'flex',
|
|
237
|
+
gap: '1rem',
|
|
238
|
+
flexWrap: 'wrap'
|
|
239
|
+
}
|
|
240
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
241
|
+
onClick: function onClick() {
|
|
242
|
+
(0, _ToastNotificationWrapper.successToast)('First toast message');
|
|
243
|
+
setTimeout(function () {
|
|
244
|
+
return (0, _ToastNotificationWrapper.infoToast)('Second toast message');
|
|
245
|
+
}, 500);
|
|
246
|
+
setTimeout(function () {
|
|
247
|
+
return (0, _ToastNotificationWrapper.warningToast)('Third toast message');
|
|
248
|
+
}, 1000);
|
|
249
|
+
}
|
|
250
|
+
}, "Show Multiple Toasts"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
251
|
+
onClick: function onClick() {
|
|
252
|
+
return (0, _ToastNotificationWrapper.resetToast)();
|
|
253
|
+
}
|
|
254
|
+
}, "Clear All Toasts")));
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// Interactive demo
|
|
259
|
+
var Interactive = exports.Interactive = {
|
|
260
|
+
render: function render() {
|
|
261
|
+
var _useState = (0, _react.useState)(''),
|
|
262
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
263
|
+
message = _useState2[0],
|
|
264
|
+
setMessage = _useState2[1];
|
|
265
|
+
var _useState3 = (0, _react.useState)('info'),
|
|
266
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
267
|
+
toastType = _useState4[0],
|
|
268
|
+
setToastType = _useState4[1];
|
|
269
|
+
var _useState5 = (0, _react.useState)(6000),
|
|
270
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
271
|
+
fadeOutTime = _useState6[0],
|
|
272
|
+
setFadeOutTime = _useState6[1];
|
|
273
|
+
var _useState7 = (0, _react.useState)(true),
|
|
274
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
275
|
+
autoClose = _useState8[0],
|
|
276
|
+
setAutoClose = _useState8[1];
|
|
277
|
+
var _useState9 = (0, _react.useState)('bottom-left'),
|
|
278
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
279
|
+
position = _useState0[0],
|
|
280
|
+
setPosition = _useState0[1];
|
|
281
|
+
var showCustomToast = function showCustomToast() {
|
|
282
|
+
if (!message.trim()) {
|
|
283
|
+
(0, _ToastNotificationWrapper.errorToast)('Please enter a message');
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
var options = {
|
|
287
|
+
fadeOutTime: fadeOutTime,
|
|
288
|
+
autoClose: autoClose,
|
|
289
|
+
toastPosition: position
|
|
290
|
+
};
|
|
291
|
+
switch (toastType) {
|
|
292
|
+
case 'success':
|
|
293
|
+
(0, _ToastNotificationWrapper.successToast)(message, options);
|
|
294
|
+
break;
|
|
295
|
+
case 'error':
|
|
296
|
+
(0, _ToastNotificationWrapper.errorToast)(message, options);
|
|
297
|
+
break;
|
|
298
|
+
case 'warning':
|
|
299
|
+
(0, _ToastNotificationWrapper.warningToast)(message, options);
|
|
300
|
+
break;
|
|
301
|
+
case 'info':
|
|
302
|
+
(0, _ToastNotificationWrapper.infoToast)(message, options);
|
|
303
|
+
break;
|
|
304
|
+
default:
|
|
305
|
+
(0, _ToastNotificationWrapper.infoToast)(message, options);
|
|
306
|
+
}
|
|
307
|
+
setMessage('');
|
|
308
|
+
};
|
|
309
|
+
return /*#__PURE__*/_react["default"].createElement(ToastDemo, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
310
|
+
style: {
|
|
311
|
+
maxWidth: '500px',
|
|
312
|
+
marginBottom: '2rem'
|
|
313
|
+
}
|
|
314
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Custom Toast Generator"), /*#__PURE__*/_react["default"].createElement("div", {
|
|
315
|
+
style: {
|
|
316
|
+
marginBottom: '1rem'
|
|
317
|
+
}
|
|
318
|
+
}, /*#__PURE__*/_react["default"].createElement("label", {
|
|
319
|
+
style: {
|
|
320
|
+
display: 'block',
|
|
321
|
+
marginBottom: '0.5rem'
|
|
322
|
+
}
|
|
323
|
+
}, "Message:"), /*#__PURE__*/_react["default"].createElement("input", {
|
|
324
|
+
type: "text",
|
|
325
|
+
value: message,
|
|
326
|
+
onChange: function onChange(e) {
|
|
327
|
+
return setMessage(e.target.value);
|
|
328
|
+
},
|
|
329
|
+
placeholder: "Enter toast message...",
|
|
330
|
+
style: {
|
|
331
|
+
width: '100%',
|
|
332
|
+
padding: '0.5rem',
|
|
333
|
+
border: '1px solid #ccc',
|
|
334
|
+
borderRadius: '4px'
|
|
335
|
+
},
|
|
336
|
+
onKeyPress: function onKeyPress(e) {
|
|
337
|
+
return e.key === 'Enter' && showCustomToast();
|
|
338
|
+
}
|
|
339
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
340
|
+
style: {
|
|
341
|
+
display: 'grid',
|
|
342
|
+
gridTemplateColumns: '1fr 1fr',
|
|
343
|
+
gap: '1rem',
|
|
344
|
+
marginBottom: '1rem'
|
|
345
|
+
}
|
|
346
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("label", {
|
|
347
|
+
style: {
|
|
348
|
+
display: 'block',
|
|
349
|
+
marginBottom: '0.5rem'
|
|
350
|
+
}
|
|
351
|
+
}, "Type:"), /*#__PURE__*/_react["default"].createElement("select", {
|
|
352
|
+
value: toastType,
|
|
353
|
+
onChange: function onChange(e) {
|
|
354
|
+
return setToastType(e.target.value);
|
|
355
|
+
},
|
|
356
|
+
style: {
|
|
357
|
+
width: '100%',
|
|
358
|
+
padding: '0.5rem'
|
|
359
|
+
}
|
|
360
|
+
}, /*#__PURE__*/_react["default"].createElement("option", {
|
|
361
|
+
value: "success"
|
|
362
|
+
}, "Success"), /*#__PURE__*/_react["default"].createElement("option", {
|
|
363
|
+
value: "error"
|
|
364
|
+
}, "Error"), /*#__PURE__*/_react["default"].createElement("option", {
|
|
365
|
+
value: "warning"
|
|
366
|
+
}, "Warning"), /*#__PURE__*/_react["default"].createElement("option", {
|
|
367
|
+
value: "info"
|
|
368
|
+
}, "Info"))), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("label", {
|
|
369
|
+
style: {
|
|
370
|
+
display: 'block',
|
|
371
|
+
marginBottom: '0.5rem'
|
|
372
|
+
}
|
|
373
|
+
}, "Position:"), /*#__PURE__*/_react["default"].createElement("select", {
|
|
374
|
+
value: position,
|
|
375
|
+
onChange: function onChange(e) {
|
|
376
|
+
return setPosition(e.target.value);
|
|
377
|
+
},
|
|
378
|
+
style: {
|
|
379
|
+
width: '100%',
|
|
380
|
+
padding: '0.5rem'
|
|
381
|
+
}
|
|
382
|
+
}, /*#__PURE__*/_react["default"].createElement("option", {
|
|
383
|
+
value: "bottom-left"
|
|
384
|
+
}, "Bottom Left"), /*#__PURE__*/_react["default"].createElement("option", {
|
|
385
|
+
value: "bottom-right"
|
|
386
|
+
}, "Bottom Right"), /*#__PURE__*/_react["default"].createElement("option", {
|
|
387
|
+
value: "top-left"
|
|
388
|
+
}, "Top Left"), /*#__PURE__*/_react["default"].createElement("option", {
|
|
389
|
+
value: "top-right"
|
|
390
|
+
}, "Top Right")))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
391
|
+
style: {
|
|
392
|
+
display: 'grid',
|
|
393
|
+
gridTemplateColumns: '1fr 1fr',
|
|
394
|
+
gap: '1rem',
|
|
395
|
+
marginBottom: '1rem'
|
|
396
|
+
}
|
|
397
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("label", {
|
|
398
|
+
style: {
|
|
399
|
+
display: 'block',
|
|
400
|
+
marginBottom: '0.5rem'
|
|
401
|
+
}
|
|
402
|
+
}, "Duration (ms):"), /*#__PURE__*/_react["default"].createElement("input", {
|
|
403
|
+
type: "number",
|
|
404
|
+
value: fadeOutTime,
|
|
405
|
+
onChange: function onChange(e) {
|
|
406
|
+
return setFadeOutTime(Number(e.target.value));
|
|
407
|
+
},
|
|
408
|
+
min: "1000",
|
|
409
|
+
max: "30000",
|
|
410
|
+
step: "1000",
|
|
411
|
+
style: {
|
|
412
|
+
width: '100%',
|
|
413
|
+
padding: '0.5rem'
|
|
414
|
+
}
|
|
415
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
416
|
+
style: {
|
|
417
|
+
display: 'flex',
|
|
418
|
+
alignItems: 'center',
|
|
419
|
+
marginTop: '1.5rem'
|
|
420
|
+
}
|
|
421
|
+
}, /*#__PURE__*/_react["default"].createElement("label", {
|
|
422
|
+
style: {
|
|
423
|
+
display: 'flex',
|
|
424
|
+
alignItems: 'center',
|
|
425
|
+
gap: '0.5rem'
|
|
426
|
+
}
|
|
427
|
+
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
428
|
+
type: "checkbox",
|
|
429
|
+
checked: autoClose,
|
|
430
|
+
onChange: function onChange(e) {
|
|
431
|
+
return setAutoClose(e.target.checked);
|
|
432
|
+
}
|
|
433
|
+
}), "Auto-close"))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
434
|
+
style: {
|
|
435
|
+
display: 'flex',
|
|
436
|
+
gap: '1rem'
|
|
437
|
+
}
|
|
438
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
439
|
+
onClick: showCustomToast,
|
|
440
|
+
appearance: "primary"
|
|
441
|
+
}, "Show Toast"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
442
|
+
onClick: function onClick() {
|
|
443
|
+
return (0, _ToastNotificationWrapper.resetToast)();
|
|
444
|
+
}
|
|
445
|
+
}, "Clear All"))));
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
// Real-world examples
|
|
450
|
+
var RealWorldExamples = exports.RealWorldExamples = {
|
|
451
|
+
render: function render() {
|
|
452
|
+
return /*#__PURE__*/_react["default"].createElement(ToastDemo, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
453
|
+
style: {
|
|
454
|
+
display: 'flex',
|
|
455
|
+
gap: '1rem',
|
|
456
|
+
flexWrap: 'wrap'
|
|
457
|
+
}
|
|
458
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
459
|
+
onClick: function onClick() {
|
|
460
|
+
return (0, _ToastNotificationWrapper.successToast)('Profile updated successfully!');
|
|
461
|
+
}
|
|
462
|
+
}, "Save Profile"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
463
|
+
onClick: function onClick() {
|
|
464
|
+
return (0, _ToastNotificationWrapper.successToast)('File uploaded successfully!');
|
|
465
|
+
}
|
|
466
|
+
}, "Upload File"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
467
|
+
onClick: function onClick() {
|
|
468
|
+
return (0, _ToastNotificationWrapper.errorToast)('Failed to connect to server. Please try again.');
|
|
469
|
+
}
|
|
470
|
+
}, "Network Error"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
471
|
+
onClick: function onClick() {
|
|
472
|
+
return (0, _ToastNotificationWrapper.errorToast)('Invalid email format. Please check and try again.');
|
|
473
|
+
}
|
|
474
|
+
}, "Validation Error"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
475
|
+
onClick: function onClick() {
|
|
476
|
+
return (0, _ToastNotificationWrapper.warningToast)('You have unsaved changes. Save before leaving?');
|
|
477
|
+
}
|
|
478
|
+
}, "Unsaved Changes"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
479
|
+
onClick: function onClick() {
|
|
480
|
+
return (0, _ToastNotificationWrapper.warningToast)('Your session will expire in 5 minutes.');
|
|
481
|
+
}
|
|
482
|
+
}, "Session Warning"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
483
|
+
onClick: function onClick() {
|
|
484
|
+
return (0, _ToastNotificationWrapper.infoToast)('New features available! Check out the updates.');
|
|
485
|
+
}
|
|
486
|
+
}, "Feature Update"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
487
|
+
onClick: function onClick() {
|
|
488
|
+
return (0, _ToastNotificationWrapper.infoToast)('Maintenance scheduled for tonight at 2 AM EST.');
|
|
489
|
+
}
|
|
490
|
+
}, "Maintenance Notice")));
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
// Accessibility features
|
|
495
|
+
var AccessibilityDemo = exports.AccessibilityDemo = {
|
|
496
|
+
render: function render() {
|
|
497
|
+
return /*#__PURE__*/_react["default"].createElement(ToastDemo, null, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("h3", null, "Accessibility Features"), /*#__PURE__*/_react["default"].createElement("ul", {
|
|
498
|
+
style: {
|
|
499
|
+
marginBottom: '2rem',
|
|
500
|
+
lineHeight: '1.6'
|
|
501
|
+
}
|
|
502
|
+
}, /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("strong", null, "Keyboard Navigation:"), " Close button is focusable"), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("strong", null, "Screen Reader:"), " Toast messages are announced"), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("strong", null, "High Contrast:"), " Enhanced borders in high contrast mode"), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("strong", null, "Reduced Motion:"), " Respects motion preferences"), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("strong", null, "Color & Icons:"), " Uses both color and icons to convey meaning"), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("strong", null, "Positioning:"), " Toasts can appear in all four corners via function options")), /*#__PURE__*/_react["default"].createElement("div", {
|
|
503
|
+
style: {
|
|
504
|
+
display: 'flex',
|
|
505
|
+
gap: '1rem',
|
|
506
|
+
flexWrap: 'wrap'
|
|
507
|
+
}
|
|
508
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
509
|
+
onClick: function onClick() {
|
|
510
|
+
return (0, _ToastNotificationWrapper.successToast)('Accessible success message with checkmark icon');
|
|
511
|
+
}
|
|
512
|
+
}, "Test Success"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
513
|
+
onClick: function onClick() {
|
|
514
|
+
return (0, _ToastNotificationWrapper.errorToast)('Accessible error message with X icon');
|
|
515
|
+
}
|
|
516
|
+
}, "Test Error"))));
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
// Performance test
|
|
521
|
+
var PerformanceTest = exports.PerformanceTest = {
|
|
522
|
+
render: function render() {
|
|
523
|
+
return /*#__PURE__*/_react["default"].createElement(ToastDemo, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
524
|
+
style: {
|
|
525
|
+
display: 'flex',
|
|
526
|
+
gap: '1rem',
|
|
527
|
+
flexWrap: 'wrap'
|
|
528
|
+
}
|
|
529
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
530
|
+
onClick: function onClick() {
|
|
531
|
+
// Test duplicate filtering
|
|
532
|
+
for (var i = 0; i < 5; i++) {
|
|
533
|
+
(0, _ToastNotificationWrapper.successToast)('Duplicate message test');
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}, "Test Duplicate Filtering"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
537
|
+
onClick: function onClick() {
|
|
538
|
+
var _loop = function _loop(i) {
|
|
539
|
+
setTimeout(function () {
|
|
540
|
+
(0, _ToastNotificationWrapper.infoToast)("Rapid fire message ".concat(i + 1));
|
|
541
|
+
}, i * 200);
|
|
542
|
+
};
|
|
543
|
+
// Test rapid fire
|
|
544
|
+
for (var i = 0; i < 10; i++) {
|
|
545
|
+
_loop(i);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}, "Rapid Fire Test"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
549
|
+
onClick: function onClick() {
|
|
550
|
+
return (0, _ToastNotificationWrapper.resetToast)();
|
|
551
|
+
}
|
|
552
|
+
}, "Clear All")));
|
|
553
|
+
}
|
|
554
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
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"] = void 0;
|
|
8
|
+
Object.defineProperty(exports, "errorToast", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _ToastNotificationWrapper.errorToast;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "infoToast", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _ToastNotificationWrapper.infoToast;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "resetToast", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _ToastNotificationWrapper.resetToast;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "successToast", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function get() {
|
|
29
|
+
return _ToastNotificationWrapper.successToast;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "warningToast", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _ToastNotificationWrapper.warningToast;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
var _ToastNotificationWrapper = _interopRequireWildcard(require("./ToastNotificationWrapper"));
|
|
39
|
+
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); }
|
|
40
|
+
var _default = exports["default"] = _ToastNotificationWrapper["default"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.notification-outer-wrapper{position:fixed;z-index:200;display:flex;flex-direction:column;gap:10px;max-width:400px;width:100%}.notification-outer-wrapper.bottom-left{bottom:20px;left:30px}@media (max-width: 768px){.notification-outer-wrapper.bottom-left{bottom:10px;left:10px;right:10px;max-width:none}}.notification-outer-wrapper.top-left{top:20px;left:30px}@media (max-width: 768px){.notification-outer-wrapper.top-left{top:10px;left:10px;right:10px;max-width:none}}.notification-outer-wrapper.top-right{top:20px;right:30px}@media (max-width: 768px){.notification-outer-wrapper.top-right{top:10px;left:10px;right:10px;max-width:none}}.notification-outer-wrapper.bottom-right{bottom:20px;right:30px}@media (max-width: 768px){.notification-outer-wrapper.bottom-right{bottom:10px;left:10px;right:10px;max-width:none}}.notification-outer-wrapper.top-left,.notification-outer-wrapper.top-right{flex-direction:column-reverse}.notification-outer-wrapper.top-left .toast,.notification-outer-wrapper.bottom-left .toast{animation:slideInFromLeft 0.3s ease-out}.notification-outer-wrapper.top-right .toast,.notification-outer-wrapper.bottom-right .toast{animation:slideInFromRight 0.3s ease-out}.toast{position:relative;display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,0.15);background:#fff;margin-bottom:8px;min-height:56px;overflow:hidden}.toast.success{background-color:#E7EFE7}.toast.success .toast-success{color:#10b981}.toast.success .toast-success::before{content:"✓";font-weight:bold}.toast.error{background-color:#FFE7E7}.toast.error .toast-error{color:#ef4444}.toast.error .toast-error::before{content:"✕";font-weight:bold}.toast.warning{background-color:#FFF8E7}.toast.warning .toast-warn{color:#f59e0b}.toast.warning .toast-warn::before{content:"⚠";font-weight:bold}.toast.info{background-color:#E7EDFF}.toast.info .toast-info{color:#3b82f6}.toast.info .toast-info::before{content:"ℹ";font-weight:bold}.message-icon-box{display:flex;align-items:center;gap:12px;flex:1}.message-icon-box .message{color:#17173A;font-size:14px;font-weight:600;line-height:1.4;word-break:break-word;flex:1}.toast-close{background:none;border:none;color:#17173A;cursor:pointer;font-size:18px;padding:4px;margin-left:12px;border-radius:4px;display:flex;align-items:center;justify-content:center;min-width:24px;height:24px}.toast-close:hover{color:#6b7280}.toast-progress{position:absolute;bottom:0;left:0;height:3px;transition:width 0.1s linear}.toast-progress.success{background:#00C48C}.toast-progress.error{background:#F05C5C}.toast-progress.warning{background:#D5A555}.toast-progress.info{background:#3E71F2}@keyframes slideInFromLeft{from{transform:translateX(-100%);opacity:0}to{transform:translateX(0);opacity:1}}@keyframes slideInFromRight{from{transform:translateX(100%);opacity:0}to{transform:translateX(0);opacity:1}}@keyframes slideOutToLeft{from{transform:translateX(0);opacity:1}to{transform:translateX(-100%);opacity:0}}@keyframes slideOutToRight{from{transform:translateX(0);opacity:1}to{transform:translateX(100%);opacity:0}}@media (prefers-contrast: high){.toast{border-width:2px;box-shadow:0 2px 8px rgba(0,0,0,0.3)}}@media (prefers-reduced-motion: reduce){.notification-outer-wrapper .toast{animation:none !important}.toast-progress{transition:none}}
|