@rocket.chat/fuselage 0.32.0-dev.407 → 0.32.0-dev.409
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { ReactNode, AllHTMLAttributes } from 'react';
|
|
2
2
|
export type ToastBarProps = {
|
|
3
3
|
variant?: 'info' | 'success' | 'error';
|
|
4
4
|
className?: string;
|
|
@@ -6,6 +6,7 @@ export type ToastBarProps = {
|
|
|
6
6
|
time?: number;
|
|
7
7
|
id?: string;
|
|
8
8
|
onClose?: (id: string) => void;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
buttonLabel?: string;
|
|
10
|
+
} & Omit<AllHTMLAttributes<HTMLElement>, 'is'>;
|
|
11
|
+
export declare function ToastBar({ children, className, variant, time, id, onClose, buttonLabel, ...props }: ToastBarProps): JSX.Element;
|
|
11
12
|
//# sourceMappingURL=ToastBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastBar.d.ts","sourceRoot":"","sources":["../../../src/components/ToastBar/ToastBar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ToastBar.d.ts","sourceRoot":"","sources":["../../../src/components/ToastBar/ToastBar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAO1D,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,CAAC;AAE/C,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,SAAc,EACd,OAAgB,EAChB,IAAQ,EACR,EAAE,EACF,OAAO,EACP,WAAqB,EACrB,GAAG,KAAK,EACT,EAAE,aAAa,eAyEf"}
|
|
@@ -123,10 +123,46 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
123
123
|
|
|
124
124
|
/***/ }),
|
|
125
125
|
|
|
126
|
-
/***/ "../../node_modules/react-
|
|
127
|
-
|
|
128
|
-
!*** ../../node_modules/react-
|
|
129
|
-
|
|
126
|
+
/***/ "../../node_modules/react-keyed-flatten-children/index.js":
|
|
127
|
+
/*!****************************************************************!*\
|
|
128
|
+
!*** ../../node_modules/react-keyed-flatten-children/index.js ***!
|
|
129
|
+
\****************************************************************/
|
|
130
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
134
|
+
/* Returns React children into an array, flattening fragments. */
|
|
135
|
+
var react_1 = __webpack_require__(/*! react */ "react");
|
|
136
|
+
var react_is_1 = __webpack_require__(/*! react-is */ "../../node_modules/react-keyed-flatten-children/node_modules/react-is/index.js");
|
|
137
|
+
function flattenChildren(children, depth, keys) {
|
|
138
|
+
if (depth === void 0) { depth = 0; }
|
|
139
|
+
if (keys === void 0) { keys = []; }
|
|
140
|
+
return react_1.Children.toArray(children).reduce(function (acc, node, nodeIndex) {
|
|
141
|
+
if (react_is_1.isFragment(node)) {
|
|
142
|
+
acc.push.apply(acc, flattenChildren(node.props.children, depth + 1, keys.concat(node.key || nodeIndex)));
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
if (react_1.isValidElement(node)) {
|
|
146
|
+
acc.push(react_1.cloneElement(node, {
|
|
147
|
+
key: keys.concat(String(node.key)).join('.')
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
else if (typeof node === "string" || typeof node === "number") {
|
|
151
|
+
acc.push(node);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return acc;
|
|
155
|
+
}, []);
|
|
156
|
+
}
|
|
157
|
+
exports["default"] = flattenChildren;
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
/***/ }),
|
|
161
|
+
|
|
162
|
+
/***/ "../../node_modules/react-keyed-flatten-children/node_modules/react-is/cjs/react-is.development.js":
|
|
163
|
+
/*!*********************************************************************************************************!*\
|
|
164
|
+
!*** ../../node_modules/react-keyed-flatten-children/node_modules/react-is/cjs/react-is.development.js ***!
|
|
165
|
+
\*********************************************************************************************************/
|
|
130
166
|
/***/ (function(__unused_webpack_module, exports) {
|
|
131
167
|
|
|
132
168
|
/** @license React v16.13.1
|
|
@@ -314,53 +350,17 @@ exports.typeOf = typeOf;
|
|
|
314
350
|
|
|
315
351
|
/***/ }),
|
|
316
352
|
|
|
317
|
-
/***/ "../../node_modules/react-is/index.js":
|
|
318
|
-
|
|
319
|
-
!*** ../../node_modules/react-is/index.js ***!
|
|
320
|
-
|
|
353
|
+
/***/ "../../node_modules/react-keyed-flatten-children/node_modules/react-is/index.js":
|
|
354
|
+
/*!**************************************************************************************!*\
|
|
355
|
+
!*** ../../node_modules/react-keyed-flatten-children/node_modules/react-is/index.js ***!
|
|
356
|
+
\**************************************************************************************/
|
|
321
357
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
322
358
|
|
|
323
359
|
|
|
324
360
|
|
|
325
361
|
if (false) {} else {
|
|
326
|
-
module.exports = __webpack_require__(/*! ./cjs/react-is.development.js */ "../../node_modules/react-is/cjs/react-is.development.js");
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
/***/ }),
|
|
331
|
-
|
|
332
|
-
/***/ "../../node_modules/react-keyed-flatten-children/index.js":
|
|
333
|
-
/*!****************************************************************!*\
|
|
334
|
-
!*** ../../node_modules/react-keyed-flatten-children/index.js ***!
|
|
335
|
-
\****************************************************************/
|
|
336
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
340
|
-
/* Returns React children into an array, flattening fragments. */
|
|
341
|
-
var react_1 = __webpack_require__(/*! react */ "react");
|
|
342
|
-
var react_is_1 = __webpack_require__(/*! react-is */ "../../node_modules/react-is/index.js");
|
|
343
|
-
function flattenChildren(children, depth, keys) {
|
|
344
|
-
if (depth === void 0) { depth = 0; }
|
|
345
|
-
if (keys === void 0) { keys = []; }
|
|
346
|
-
return react_1.Children.toArray(children).reduce(function (acc, node, nodeIndex) {
|
|
347
|
-
if (react_is_1.isFragment(node)) {
|
|
348
|
-
acc.push.apply(acc, flattenChildren(node.props.children, depth + 1, keys.concat(node.key || nodeIndex)));
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
if (react_1.isValidElement(node)) {
|
|
352
|
-
acc.push(react_1.cloneElement(node, {
|
|
353
|
-
key: keys.concat(String(node.key)).join('.')
|
|
354
|
-
}));
|
|
355
|
-
}
|
|
356
|
-
else if (typeof node === "string" || typeof node === "number") {
|
|
357
|
-
acc.push(node);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
return acc;
|
|
361
|
-
}, []);
|
|
362
|
+
module.exports = __webpack_require__(/*! ./cjs/react-is.development.js */ "../../node_modules/react-keyed-flatten-children/node_modules/react-is/cjs/react-is.development.js");
|
|
362
363
|
}
|
|
363
|
-
exports["default"] = flattenChildren;
|
|
364
364
|
|
|
365
365
|
|
|
366
366
|
/***/ }),
|
|
@@ -15848,6 +15848,28 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
15848
15848
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
15849
15849
|
return cooked;
|
|
15850
15850
|
};
|
|
15851
|
+
var __assign = (this && this.__assign) || function () {
|
|
15852
|
+
__assign = Object.assign || function(t) {
|
|
15853
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
15854
|
+
s = arguments[i];
|
|
15855
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
15856
|
+
t[p] = s[p];
|
|
15857
|
+
}
|
|
15858
|
+
return t;
|
|
15859
|
+
};
|
|
15860
|
+
return __assign.apply(this, arguments);
|
|
15861
|
+
};
|
|
15862
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
15863
|
+
var t = {};
|
|
15864
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15865
|
+
t[p] = s[p];
|
|
15866
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15867
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
15868
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
15869
|
+
t[p[i]] = s[p[i]];
|
|
15870
|
+
}
|
|
15871
|
+
return t;
|
|
15872
|
+
};
|
|
15851
15873
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15852
15874
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15853
15875
|
};
|
|
@@ -15860,7 +15882,7 @@ var Box_1 = __importDefault(__webpack_require__(/*! ../Box */ "./src/components/
|
|
|
15860
15882
|
var Button_1 = __webpack_require__(/*! ../Button */ "./src/components/Button/index.ts");
|
|
15861
15883
|
var Icon_1 = __webpack_require__(/*! ../Icon */ "./src/components/Icon/index.ts");
|
|
15862
15884
|
function ToastBar(_a) {
|
|
15863
|
-
var children = _a.children, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.variant, variant = _c === void 0 ? 'info' : _c, _d = _a.time, time = _d === void 0 ? 5 : _d, id = _a.id, onClose = _a.onClose;
|
|
15885
|
+
var children = _a.children, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.variant, variant = _c === void 0 ? 'info' : _c, _d = _a.time, time = _d === void 0 ? 5 : _d, id = _a.id, onClose = _a.onClose, _e = _a.buttonLabel, buttonLabel = _e === void 0 ? 'Close' : _e, props = __rest(_a, ["children", "className", "variant", "time", "id", "onClose", "buttonLabel"]);
|
|
15864
15886
|
var iconName = (variant === 'success' && 'circle-check') ||
|
|
15865
15887
|
(variant === 'error' && 'ban') ||
|
|
15866
15888
|
'info';
|
|
@@ -15870,14 +15892,16 @@ function ToastBar(_a) {
|
|
|
15870
15892
|
var progressBarAnimation = (0, css_in_js_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n &::after {\n width: 0%;\n animation: ", " ", "s;\n }\n "], ["\n &::after {\n width: 0%;\n animation: ", " ", "s;\n }\n "])), progressBar, time);
|
|
15871
15893
|
var uniqueId = (0, fuselage_hooks_1.useUniqueId)();
|
|
15872
15894
|
var toastId = id || uniqueId;
|
|
15873
|
-
return (react_1.default.createElement(Box_1.default, { className: [
|
|
15874
|
-
|
|
15875
|
-
|
|
15876
|
-
|
|
15877
|
-
|
|
15878
|
-
|
|
15879
|
-
|
|
15880
|
-
react_1.default.createElement(
|
|
15895
|
+
return (react_1.default.createElement(Box_1.default, __assign({ className: [
|
|
15896
|
+
"rcx-toastbar rcx-toastbar--".concat(variant, " ").concat(className),
|
|
15897
|
+
toastBarAnimation,
|
|
15898
|
+
], elevation: '2nb', borderRadius: 'x4', role: 'alert' }, props),
|
|
15899
|
+
react_1.default.createElement("div", { className: 'rcx-toastbar_inner' },
|
|
15900
|
+
react_1.default.createElement(Icon_1.Icon, { className: "rcx-toastbar_icon--".concat(variant), size: 'x20', name: iconName }),
|
|
15901
|
+
react_1.default.createElement("div", { className: 'rcx-toastbar_content', id: toastId }, children),
|
|
15902
|
+
onClose && (react_1.default.createElement("div", { className: 'rcx-toastbar-close' },
|
|
15903
|
+
react_1.default.createElement(Button_1.IconButton, { tiny: true, onClick: function () { return onClose(toastId); }, icon: 'cross', "aria-label": buttonLabel })))),
|
|
15904
|
+
react_1.default.createElement(Box_1.default, { className: [progressBarAnimation, 'rcx-toastbar_progressbar'] })));
|
|
15881
15905
|
}
|
|
15882
15906
|
exports.ToastBar = ToastBar;
|
|
15883
15907
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|