@unbxd-ui/unbxd-react-components 0.2.220 → 0.3.0
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 +4 -4
- package/components/Button/Button.stories.js +168 -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 +56 -41
- 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/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 +20 -1
- package/components/index.js +66 -3
- package/components/theme.css +2 -3
- 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
|
@@ -3,25 +3,177 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports["default"] = exports.
|
|
6
|
+
exports["default"] = exports.WithHTMLContent = exports.WithCloseButton = exports.Warning = exports.Success = exports.MultipleNotifications = exports.LongContent = exports.Info = exports.Error = exports.CustomFadeOut = exports.AutoUpdating = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _NotificationComponent = _interopRequireDefault(require("./NotificationComponent"));
|
|
9
|
-
function _interopRequireDefault(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
appearance:
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
11
|
+
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."); }
|
|
12
|
+
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; } }
|
|
13
|
+
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; }
|
|
14
|
+
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; } }
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
16
|
+
var meta = {
|
|
17
|
+
title: 'Components/NotificationComponent',
|
|
18
|
+
component: _NotificationComponent["default"],
|
|
19
|
+
parameters: {
|
|
20
|
+
layout: 'centered'
|
|
21
|
+
},
|
|
22
|
+
tags: ['autodocs'],
|
|
23
|
+
argTypes: {
|
|
24
|
+
appearance: {
|
|
25
|
+
control: 'select',
|
|
26
|
+
options: ['success', 'error', 'warning', 'info'],
|
|
27
|
+
description: 'The appearance/type of the notification'
|
|
28
|
+
},
|
|
29
|
+
className: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'Additional CSS classes for the notification'
|
|
32
|
+
},
|
|
33
|
+
messageId: {
|
|
34
|
+
control: 'number',
|
|
35
|
+
description: 'Unique ID to represent this particular message'
|
|
36
|
+
},
|
|
37
|
+
fadeOut: {
|
|
38
|
+
control: 'boolean',
|
|
39
|
+
description: 'Whether the message should fade out automatically'
|
|
40
|
+
},
|
|
41
|
+
fadeOutTime: {
|
|
42
|
+
control: 'number',
|
|
43
|
+
description: 'Time in milliseconds before the notification fades out'
|
|
44
|
+
},
|
|
45
|
+
showClose: {
|
|
46
|
+
control: 'boolean',
|
|
47
|
+
description: 'Whether to show a close button on the notification'
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var _default = exports["default"] = meta; // Basic notifications for different appearances
|
|
52
|
+
var Success = exports.Success = {
|
|
53
|
+
args: {
|
|
54
|
+
children: 'Operation completed successfully!',
|
|
55
|
+
appearance: 'success'
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var Error = exports.Error = {
|
|
59
|
+
args: {
|
|
60
|
+
children: 'An error occurred while processing your request.',
|
|
61
|
+
appearance: 'error',
|
|
62
|
+
fadeOut: false
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var Warning = exports.Warning = {
|
|
66
|
+
args: {
|
|
67
|
+
children: 'Please review your changes before proceeding.',
|
|
68
|
+
appearance: 'warning',
|
|
69
|
+
fadeOut: false
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
var Info = exports.Info = {
|
|
73
|
+
args: {
|
|
74
|
+
children: 'Your session will expire in 5 minutes.',
|
|
75
|
+
appearance: 'info',
|
|
76
|
+
fadeOut: false
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// Notification with custom fadeout time
|
|
81
|
+
var CustomFadeOut = exports.CustomFadeOut = {
|
|
82
|
+
args: {
|
|
83
|
+
children: 'This message will fade out in 5 seconds',
|
|
84
|
+
appearance: 'success',
|
|
85
|
+
fadeOut: true,
|
|
86
|
+
fadeOutTime: 5000
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// Notification with close button
|
|
91
|
+
var WithCloseButton = exports.WithCloseButton = {
|
|
92
|
+
args: {
|
|
93
|
+
children: 'Click the X button to close this notification',
|
|
94
|
+
appearance: 'error',
|
|
95
|
+
showClose: true,
|
|
96
|
+
fadeOut: false
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// Long content notification
|
|
101
|
+
var LongContent = exports.LongContent = {
|
|
102
|
+
args: {
|
|
103
|
+
children: 'This is a notification with a longer content that might wrap to multiple lines. It demonstrates how the component handles larger amounts of text while maintaining its appearance and readability.',
|
|
104
|
+
appearance: 'info',
|
|
105
|
+
showClose: true,
|
|
106
|
+
fadeOut: false
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// Notification with HTML content
|
|
111
|
+
var WithHTMLContent = exports.WithHTMLContent = {
|
|
112
|
+
args: {
|
|
113
|
+
children: /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("strong", null, "Important Update"), /*#__PURE__*/_react["default"].createElement("p", null, "This notification contains ", /*#__PURE__*/_react["default"].createElement("em", null, "formatted"), " text and ", /*#__PURE__*/_react["default"].createElement("a", {
|
|
114
|
+
href: "#",
|
|
115
|
+
style: {
|
|
116
|
+
color: 'inherit',
|
|
117
|
+
textDecoration: 'underline'
|
|
118
|
+
}
|
|
119
|
+
}, "links"), ".")),
|
|
120
|
+
appearance: 'info',
|
|
121
|
+
showClose: true,
|
|
122
|
+
fadeOut: false
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// Multiple notifications demo
|
|
127
|
+
var MultipleNotifications = exports.MultipleNotifications = {
|
|
128
|
+
render: function render() {
|
|
129
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
130
|
+
style: {
|
|
131
|
+
display: 'flex',
|
|
132
|
+
flexDirection: 'column',
|
|
133
|
+
gap: '10px'
|
|
134
|
+
}
|
|
135
|
+
}, /*#__PURE__*/_react["default"].createElement(_NotificationComponent["default"], {
|
|
136
|
+
appearance: "success"
|
|
137
|
+
}, "Success Message"), /*#__PURE__*/_react["default"].createElement(_NotificationComponent["default"], {
|
|
138
|
+
appearance: "error"
|
|
139
|
+
}, "Error Message"), /*#__PURE__*/_react["default"].createElement(_NotificationComponent["default"], {
|
|
140
|
+
appearance: "warning"
|
|
141
|
+
}, "Warning Message"), /*#__PURE__*/_react["default"].createElement(_NotificationComponent["default"], {
|
|
142
|
+
appearance: "info"
|
|
143
|
+
}, "Info Message"));
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// Auto-updating notification demo
|
|
148
|
+
var AutoUpdating = exports.AutoUpdating = {
|
|
149
|
+
render: function render() {
|
|
150
|
+
var _React$useState = _react["default"].useState(0),
|
|
151
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
152
|
+
count = _React$useState2[0],
|
|
153
|
+
setCount = _React$useState2[1];
|
|
154
|
+
var _React$useState3 = _react["default"].useState(1),
|
|
155
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
156
|
+
messageId = _React$useState4[0],
|
|
157
|
+
setMessageId = _React$useState4[1];
|
|
158
|
+
_react["default"].useEffect(function () {
|
|
159
|
+
var timer = setInterval(function () {
|
|
160
|
+
setCount(function (prev) {
|
|
161
|
+
return prev + 1;
|
|
162
|
+
});
|
|
163
|
+
setMessageId(function (prev) {
|
|
164
|
+
return prev + 1;
|
|
165
|
+
});
|
|
166
|
+
}, 3000);
|
|
167
|
+
return function () {
|
|
168
|
+
return clearInterval(timer);
|
|
169
|
+
};
|
|
170
|
+
}, []);
|
|
171
|
+
return /*#__PURE__*/_react["default"].createElement(_NotificationComponent["default"], {
|
|
172
|
+
appearance: "info",
|
|
173
|
+
messageId: messageId,
|
|
174
|
+
fadeOut: true,
|
|
175
|
+
showClose: true,
|
|
176
|
+
fadeOutTime: 2500
|
|
177
|
+
}, "This message has updated ", count, " times");
|
|
178
|
+
}
|
|
27
179
|
};
|
|
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _NotificationComponent = _interopRequireDefault(require("./NotificationComponent"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
9
|
var _default = exports["default"] = _NotificationComponent["default"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.RCB-notif{padding:10px;border-radius:3px}.RCB-notif-success{color:#
|
|
1
|
+
.RCB-notif{padding:10px;border-radius:3px}.RCB-notif-success{color:#6DB886;border:solid 1px #6DB886;background-color:#DEF9E7}.RCB-notif-error{color:#CA4646;border:solid 1px #CA4646;background-color:#FFE4E4}.RCB-notif-warning{color:#D5A555;border:solid 1px #D5A555;background-color:#FFF8EC}.RCB-notif-info{color:#3E71F2;border:solid 1px #3E71F2;background-color:#E7EDFF}.notif-wrapper{flex:1;display:flex;align-items:center;justify-content:space-between}
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _excluded = ["className", "header", "messages", "showLoader", "messageInterval"];
|
|
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 _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); }
|
|
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
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
var PageLoader = function PageLoader(_ref) {
|
|
23
|
+
var _ref$className = _ref.className,
|
|
24
|
+
className = _ref$className === void 0 ? "" : _ref$className,
|
|
25
|
+
header = _ref.header,
|
|
26
|
+
_ref$messages = _ref.messages,
|
|
27
|
+
messages = _ref$messages === void 0 ? [] : _ref$messages,
|
|
28
|
+
_ref$showLoader = _ref.showLoader,
|
|
29
|
+
showLoader = _ref$showLoader === void 0 ? true : _ref$showLoader,
|
|
30
|
+
_ref$messageInterval = _ref.messageInterval,
|
|
31
|
+
messageInterval = _ref$messageInterval === void 0 ? 2500 : _ref$messageInterval,
|
|
32
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
33
|
+
var _useState = (0, _react.useState)(0),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
currentMessageIndex = _useState2[0],
|
|
36
|
+
setCurrentMessageIndex = _useState2[1];
|
|
37
|
+
var _useState3 = (0, _react.useState)(true),
|
|
38
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
39
|
+
fade = _useState4[0],
|
|
40
|
+
setFade = _useState4[1];
|
|
41
|
+
(0, _react.useEffect)(function () {
|
|
42
|
+
if (messages.length > 1) {
|
|
43
|
+
var interval = setInterval(function () {
|
|
44
|
+
setFade(false); // Start fade-out
|
|
45
|
+
setTimeout(function () {
|
|
46
|
+
setCurrentMessageIndex(function (prev) {
|
|
47
|
+
return (prev + 1) % messages.length;
|
|
48
|
+
});
|
|
49
|
+
setFade(true); // Start fade-in
|
|
50
|
+
}, 250); // Adjust for smoother transition (half of fade duration)
|
|
51
|
+
}, messageInterval); // Change message every messageInterval
|
|
52
|
+
return function () {
|
|
53
|
+
return clearInterval(interval);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}, [messages, messageInterval]); // Add messageInterval to dependency array
|
|
57
|
+
|
|
58
|
+
if (!showLoader) return null;
|
|
59
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
60
|
+
className: "loader-wrapper"
|
|
61
|
+
}, /*#__PURE__*/_react["default"].createElement("div", _extends({
|
|
62
|
+
className: "page-loader ".concat(className)
|
|
63
|
+
}, restProps), /*#__PURE__*/_react["default"].createElement("img", {
|
|
64
|
+
src: "https://d3t0v15wul5tya.cloudfront.net/selfserve-ui/prod/assets/images/blueLoader.svg",
|
|
65
|
+
alt: "Loading..."
|
|
66
|
+
})), header && /*#__PURE__*/_react["default"].createElement("div", {
|
|
67
|
+
className: "loader-header"
|
|
68
|
+
}, header), messages.length > 0 && /*#__PURE__*/_react["default"].createElement("div", {
|
|
69
|
+
className: "loader-messages ".concat(fade ? "fade-in" : "fade-out")
|
|
70
|
+
}, messages[currentMessageIndex]));
|
|
71
|
+
};
|
|
72
|
+
PageLoader.propTypes = {
|
|
73
|
+
/** Additional CSS classes for the loader */
|
|
74
|
+
className: _propTypes["default"].string,
|
|
75
|
+
/** Header text to display above the loader */
|
|
76
|
+
header: _propTypes["default"].string,
|
|
77
|
+
/** Array of messages that cycle automatically */
|
|
78
|
+
messages: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
79
|
+
/** Whether to show the loader */
|
|
80
|
+
showLoader: _propTypes["default"].bool,
|
|
81
|
+
/** Interval in milliseconds for message changes (default: 2500ms) */
|
|
82
|
+
messageInterval: _propTypes["default"].number
|
|
83
|
+
};
|
|
84
|
+
var _default = exports["default"] = PageLoader;
|
|
@@ -0,0 +1,276 @@
|
|
|
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.WithSingleMessage = exports.WithHeader = exports.WithCyclingMessages = exports.SlowCyclingMessages = exports.MinimalLoader = exports.LongLoadingExample = exports.Interactive = exports.FastCyclingMessages = exports.Default = exports.DataLoadingSimulation = exports.CustomizableInterval = exports.CustomStyling = exports.AccessibilityFeatures = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _PageLoader = _interopRequireDefault(require("./PageLoader"));
|
|
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 _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); }
|
|
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/PageLoader',
|
|
22
|
+
component: _PageLoader["default"],
|
|
23
|
+
parameters: {
|
|
24
|
+
layout: 'fullscreen',
|
|
25
|
+
docs: {
|
|
26
|
+
description: {
|
|
27
|
+
component: 'A full-screen page loader with animated dots and cycling messages. Shows a wave-scanning animation with optional header and rotating status messages.'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
tags: ['autodocs'],
|
|
32
|
+
argTypes: {
|
|
33
|
+
className: {
|
|
34
|
+
control: 'text',
|
|
35
|
+
description: 'Additional CSS classes for the loader'
|
|
36
|
+
},
|
|
37
|
+
header: {
|
|
38
|
+
control: 'text',
|
|
39
|
+
description: 'Header text to display above the loader'
|
|
40
|
+
},
|
|
41
|
+
messages: {
|
|
42
|
+
control: 'object',
|
|
43
|
+
description: 'Array of messages that cycle automatically'
|
|
44
|
+
},
|
|
45
|
+
showLoader: {
|
|
46
|
+
control: 'boolean',
|
|
47
|
+
description: 'Whether to show the loader'
|
|
48
|
+
},
|
|
49
|
+
messageInterval: {
|
|
50
|
+
control: {
|
|
51
|
+
type: 'range',
|
|
52
|
+
min: 500,
|
|
53
|
+
max: 10000,
|
|
54
|
+
step: 500
|
|
55
|
+
},
|
|
56
|
+
description: 'Interval in milliseconds for message changes (default: 2500ms)'
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var _default = exports["default"] = meta; // Default story
|
|
61
|
+
var Default = exports.Default = {
|
|
62
|
+
args: {
|
|
63
|
+
showLoader: true
|
|
64
|
+
},
|
|
65
|
+
render: function render(args) {
|
|
66
|
+
return /*#__PURE__*/_react["default"].createElement(_PageLoader["default"], args);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// With header only
|
|
71
|
+
var WithHeader = exports.WithHeader = {
|
|
72
|
+
args: {
|
|
73
|
+
showLoader: true,
|
|
74
|
+
header: "Loading Application"
|
|
75
|
+
},
|
|
76
|
+
render: function render(args) {
|
|
77
|
+
return /*#__PURE__*/_react["default"].createElement(_PageLoader["default"], args);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// With header and single message
|
|
82
|
+
var WithSingleMessage = exports.WithSingleMessage = {
|
|
83
|
+
args: {
|
|
84
|
+
showLoader: true,
|
|
85
|
+
header: "Processing Request",
|
|
86
|
+
messages: ["Please wait while we process your request..."]
|
|
87
|
+
},
|
|
88
|
+
render: function render(args) {
|
|
89
|
+
return /*#__PURE__*/_react["default"].createElement(_PageLoader["default"], args);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// With cycling messages
|
|
94
|
+
var WithCyclingMessages = exports.WithCyclingMessages = {
|
|
95
|
+
args: {
|
|
96
|
+
showLoader: true,
|
|
97
|
+
header: "Loading Dashboard",
|
|
98
|
+
messages: ["Initializing application...", "Loading user preferences...", "Fetching latest data...", "Almost ready..."],
|
|
99
|
+
messageInterval: 2000 // Slightly faster than default
|
|
100
|
+
},
|
|
101
|
+
render: function render(args) {
|
|
102
|
+
return /*#__PURE__*/_react["default"].createElement(_PageLoader["default"], args);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// Fast cycling messages
|
|
107
|
+
var FastCyclingMessages = exports.FastCyclingMessages = {
|
|
108
|
+
args: {
|
|
109
|
+
showLoader: true,
|
|
110
|
+
header: "Fast Message Cycling",
|
|
111
|
+
messages: ["Message 1", "Message 2", "Message 3", "Message 4"],
|
|
112
|
+
messageInterval: 1000 // 1 second interval
|
|
113
|
+
},
|
|
114
|
+
render: function render(args) {
|
|
115
|
+
return /*#__PURE__*/_react["default"].createElement(_PageLoader["default"], args);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// Slow cycling messages
|
|
120
|
+
var SlowCyclingMessages = exports.SlowCyclingMessages = {
|
|
121
|
+
args: {
|
|
122
|
+
showLoader: true,
|
|
123
|
+
header: "Slow Message Cycling",
|
|
124
|
+
messages: ["Taking time to process...", "This might take a while...", "Please be patient...", "Still working on it..."],
|
|
125
|
+
messageInterval: 5000 // 5 second interval
|
|
126
|
+
},
|
|
127
|
+
render: function render(args) {
|
|
128
|
+
return /*#__PURE__*/_react["default"].createElement(_PageLoader["default"], args);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// Customizable interval demo
|
|
133
|
+
var CustomizableInterval = exports.CustomizableInterval = {
|
|
134
|
+
args: {
|
|
135
|
+
showLoader: true,
|
|
136
|
+
header: "Customizable Message Speed",
|
|
137
|
+
messages: ["Adjust the controls to change speed", "Use the messageInterval prop", "Perfect for different use cases", "From fast alerts to slow processes"],
|
|
138
|
+
messageInterval: 2500 // Default interval
|
|
139
|
+
},
|
|
140
|
+
render: function render(args) {
|
|
141
|
+
return /*#__PURE__*/_react["default"].createElement(_PageLoader["default"], args);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// Long loading simulation
|
|
146
|
+
var LongLoadingExample = exports.LongLoadingExample = {
|
|
147
|
+
args: {
|
|
148
|
+
showLoader: true,
|
|
149
|
+
header: "Setting up your workspace",
|
|
150
|
+
messages: ["Connecting to servers...", "Downloading configuration...", "Installing dependencies...", "Optimizing performance...", "Finalizing setup...", "Almost there..."]
|
|
151
|
+
},
|
|
152
|
+
render: function render(args) {
|
|
153
|
+
return /*#__PURE__*/_react["default"].createElement(_PageLoader["default"], args);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// Interactive demo with toggle
|
|
158
|
+
var Interactive = exports.Interactive = {
|
|
159
|
+
args: {
|
|
160
|
+
header: "Interactive Demo",
|
|
161
|
+
messages: ["Click the button to toggle the loader", "Watch the messages cycle", "Notice the smooth animations"]
|
|
162
|
+
},
|
|
163
|
+
render: function render(args) {
|
|
164
|
+
var _useState = (0, _react.useState)(false),
|
|
165
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
166
|
+
isLoading = _useState2[0],
|
|
167
|
+
setIsLoading = _useState2[1];
|
|
168
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
169
|
+
style: {
|
|
170
|
+
padding: '2rem',
|
|
171
|
+
textAlign: 'center'
|
|
172
|
+
}
|
|
173
|
+
}, /*#__PURE__*/_react["default"].createElement("h2", null, "PageLoader Interactive Demo"), /*#__PURE__*/_react["default"].createElement("p", null, "Click the button below to show/hide the page loader:"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
174
|
+
onClick: function onClick() {
|
|
175
|
+
return setIsLoading(!isLoading);
|
|
176
|
+
},
|
|
177
|
+
appearance: "primary"
|
|
178
|
+
}, isLoading ? 'Hide Loader' : 'Show Loader'), /*#__PURE__*/_react["default"].createElement(_PageLoader["default"], _extends({}, args, {
|
|
179
|
+
showLoader: isLoading
|
|
180
|
+
})));
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// Minimal loader (just animation)
|
|
185
|
+
var MinimalLoader = exports.MinimalLoader = {
|
|
186
|
+
args: {
|
|
187
|
+
showLoader: true
|
|
188
|
+
},
|
|
189
|
+
render: function render(args) {
|
|
190
|
+
return /*#__PURE__*/_react["default"].createElement(_PageLoader["default"], args);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// Custom styling example
|
|
195
|
+
var CustomStyling = exports.CustomStyling = {
|
|
196
|
+
args: {
|
|
197
|
+
showLoader: true,
|
|
198
|
+
className: "custom-loader",
|
|
199
|
+
header: "Custom Styled Loader",
|
|
200
|
+
messages: ["This loader has custom styling applied"]
|
|
201
|
+
},
|
|
202
|
+
render: function render(args) {
|
|
203
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("style", null, "\n .custom-loader .RCB-page-loader-backdrop {\n background: rgba(0, 0, 0, 0.8);\n }\n .custom-loader .RCB-page-loader-title {\n color: #fff;\n }\n .custom-loader .RCB-page-loader-message {\n color: #ccc;\n }\n "), /*#__PURE__*/_react["default"].createElement(_PageLoader["default"], args));
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// Accessibility demo
|
|
208
|
+
var AccessibilityFeatures = exports.AccessibilityFeatures = {
|
|
209
|
+
args: {
|
|
210
|
+
showLoader: true,
|
|
211
|
+
header: "Accessibility Demo",
|
|
212
|
+
messages: ["This loader includes ARIA attributes", "Supports reduced motion preferences", "Screen reader friendly", "High contrast mode compatible"]
|
|
213
|
+
},
|
|
214
|
+
render: function render(args) {
|
|
215
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
216
|
+
style: {
|
|
217
|
+
padding: '2rem',
|
|
218
|
+
marginBottom: '1rem',
|
|
219
|
+
background: '#f5f5f5'
|
|
220
|
+
}
|
|
221
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Accessibility Features:"), /*#__PURE__*/_react["default"].createElement("ul", {
|
|
222
|
+
style: {
|
|
223
|
+
textAlign: 'left',
|
|
224
|
+
maxWidth: '600px',
|
|
225
|
+
margin: '0 auto'
|
|
226
|
+
}
|
|
227
|
+
}, /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("strong", null, "ARIA Labels:"), " Proper role, aria-modal, aria-label, aria-live attributes"), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("strong", null, "Reduced Motion:"), " Respects prefers-reduced-motion setting"), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("strong", null, "High Contrast:"), " Adapts to high contrast mode"), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("strong", null, "Screen Readers:"), " Announces loading state and updates"), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("strong", null, "Keyboard Navigation:"), " Properly manages focus"))), /*#__PURE__*/_react["default"].createElement(_PageLoader["default"], args));
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
// Data loading simulation
|
|
232
|
+
var DataLoadingSimulation = exports.DataLoadingSimulation = {
|
|
233
|
+
args: {
|
|
234
|
+
header: "Data Loading Simulation"
|
|
235
|
+
},
|
|
236
|
+
render: function render(args) {
|
|
237
|
+
var _useState3 = (0, _react.useState)(0),
|
|
238
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
239
|
+
currentStep = _useState4[0],
|
|
240
|
+
setCurrentStep = _useState4[1];
|
|
241
|
+
var _useState5 = (0, _react.useState)(false),
|
|
242
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
243
|
+
isLoading = _useState6[0],
|
|
244
|
+
setIsLoading = _useState6[1];
|
|
245
|
+
var loadingSteps = ["Connecting to database...", "Authenticating user...", "Fetching user data...", "Loading preferences...", "Preparing dashboard...", "Complete!"];
|
|
246
|
+
var startLoading = function startLoading() {
|
|
247
|
+
setIsLoading(true);
|
|
248
|
+
setCurrentStep(0);
|
|
249
|
+
var interval = setInterval(function () {
|
|
250
|
+
setCurrentStep(function (prev) {
|
|
251
|
+
if (prev >= loadingSteps.length - 1) {
|
|
252
|
+
clearInterval(interval);
|
|
253
|
+
setTimeout(function () {
|
|
254
|
+
return setIsLoading(false);
|
|
255
|
+
}, 1000);
|
|
256
|
+
return prev;
|
|
257
|
+
}
|
|
258
|
+
return prev + 1;
|
|
259
|
+
});
|
|
260
|
+
}, 1500);
|
|
261
|
+
};
|
|
262
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
263
|
+
style: {
|
|
264
|
+
padding: '2rem',
|
|
265
|
+
textAlign: 'center'
|
|
266
|
+
}
|
|
267
|
+
}, /*#__PURE__*/_react["default"].createElement("h2", null, "Simulated Data Loading Process"), /*#__PURE__*/_react["default"].createElement("p", null, "This demo simulates a real loading sequence with step-by-step updates:"), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
268
|
+
onClick: startLoading,
|
|
269
|
+
disabled: isLoading,
|
|
270
|
+
appearance: "primary"
|
|
271
|
+
}, "Start Loading Simulation"), /*#__PURE__*/_react["default"].createElement(_PageLoader["default"], _extends({}, args, {
|
|
272
|
+
showLoader: isLoading,
|
|
273
|
+
messages: [loadingSteps[currentStep]]
|
|
274
|
+
})));
|
|
275
|
+
}
|
|
276
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _PageLoader = _interopRequireDefault(require("./PageLoader"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
+
var _default = exports["default"] = _PageLoader["default"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.page-loader{width:100%;height:fit-content;display:flex;justify-content:center;align-items:center}.loader-wrapper{text-align:center}.loader-header{color:#17173A;font-weight:600;font-size:16px;margin-top:15px}.loader-messages{color:#6F6F8D;margin-top:5px;font-weight:400;font-size:14px;transition:opacity 0.4s ease-in-out}.loader-messages.fade-in{opacity:1}.loader-messages.fade-out{opacity:0}
|
|
File without changes
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
function _interopRequireDefault(
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
10
|
var ProgressBar = function ProgressBar(props) {
|
|
11
11
|
var progress = props.progress,
|
|
12
12
|
height = props.height,
|