@activecollab/components 1.0.93 → 1.0.94
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/dist/cjs/components/ToastMessage/ToastMessage.js +19 -9
- package/dist/cjs/components/ToastMessage/ToastMessage.js.map +1 -1
- package/dist/esm/components/ToastMessage/ToastMessage.d.ts +3 -6
- package/dist/esm/components/ToastMessage/ToastMessage.d.ts.map +1 -1
- package/dist/esm/components/ToastMessage/ToastMessage.js +15 -9
- package/dist/esm/components/ToastMessage/ToastMessage.js.map +1 -1
- package/dist/index.js +116 -112
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,20 +11,30 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _Styles = require("./Styles");
|
|
13
13
|
|
|
14
|
+
var _excluded = ["text", "type", "onClose", "dismissible", "dropShadow", "timeout"];
|
|
15
|
+
|
|
14
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
17
|
|
|
16
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
|
+
|
|
22
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
23
|
+
|
|
24
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
25
|
+
|
|
26
|
+
var ToastMessage = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
19
27
|
var text = _ref.text,
|
|
20
28
|
type = _ref.type,
|
|
21
29
|
onClose = _ref.onClose,
|
|
22
|
-
_ref$
|
|
23
|
-
|
|
30
|
+
_ref$dismissible = _ref.dismissible,
|
|
31
|
+
dismissible = _ref$dismissible === void 0 ? false : _ref$dismissible,
|
|
24
32
|
_ref$dropShadow = _ref.dropShadow,
|
|
25
33
|
dropShadow = _ref$dropShadow === void 0 ? false : _ref$dropShadow,
|
|
26
34
|
_ref$timeout = _ref.timeout,
|
|
27
|
-
timeout = _ref$timeout === void 0 ? 0 : _ref$timeout
|
|
35
|
+
timeout = _ref$timeout === void 0 ? 0 : _ref$timeout,
|
|
36
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
|
|
28
38
|
var handleOnClose = (0, _react.useCallback)(function () {
|
|
29
39
|
if (typeof onClose === "function") {
|
|
30
40
|
onClose();
|
|
@@ -37,15 +47,15 @@ var ToastMessage = function ToastMessage(_ref) {
|
|
|
37
47
|
return clearTimeout(timer);
|
|
38
48
|
};
|
|
39
49
|
}
|
|
40
|
-
}, [
|
|
41
|
-
return /*#__PURE__*/_react.default.createElement(_Styles.StyledToastMessage, {
|
|
50
|
+
}, [dismissible, timeout, handleOnClose]);
|
|
51
|
+
return /*#__PURE__*/_react.default.createElement(_Styles.StyledToastMessage, _extends({
|
|
52
|
+
ref: ref,
|
|
42
53
|
$type: type,
|
|
43
54
|
$dropShadow: dropShadow
|
|
44
|
-
}, /*#__PURE__*/_react.default.createElement(_Styles.StyledToastMessageText, null, text),
|
|
55
|
+
}, rest), /*#__PURE__*/_react.default.createElement(_Styles.StyledToastMessageText, null, text), dismissible ? /*#__PURE__*/_react.default.createElement(_Styles.StyledCloseSmallIcon, {
|
|
45
56
|
onClick: handleOnClose
|
|
46
57
|
}) : null);
|
|
47
|
-
};
|
|
48
|
-
|
|
58
|
+
});
|
|
49
59
|
exports.ToastMessage = ToastMessage;
|
|
50
60
|
ToastMessage.displayName = "ToastMessage";
|
|
51
61
|
//# sourceMappingURL=ToastMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/ToastMessage/ToastMessage.tsx"],"names":["ToastMessage","text","type","onClose","
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ToastMessage/ToastMessage.tsx"],"names":["ToastMessage","ref","text","type","onClose","dismissible","dropShadow","timeout","rest","handleOnClose","timer","setTimeout","clearTimeout","displayName"],"mappings":";;;;;;;;;AAAA;;AAOA;;;;;;;;;;;;;;AAeO,IAAMA,YAAY,gBAAG,uBAC1B,gBAUEC,GAVF,EAWK;AAAA,MATDC,IASC,QATDA,IASC;AAAA,MARDC,IAQC,QARDA,IAQC;AAAA,MAPDC,OAOC,QAPDA,OAOC;AAAA,8BANDC,WAMC;AAAA,MANDA,WAMC,iCANa,KAMb;AAAA,6BALDC,UAKC;AAAA,MALDA,UAKC,gCALY,KAKZ;AAAA,0BAJDC,OAIC;AAAA,MAJDA,OAIC,6BAJS,CAIT;AAAA,MAHEC,IAGF;;AACH,MAAMC,aAAa,GAAG,wBAAY,YAAM;AACtC,QAAI,OAAOL,OAAP,KAAmB,UAAvB,EAAmC;AACjCA,MAAAA,OAAO;AACR;AACF,GAJqB,EAInB,CAACA,OAAD,CAJmB,CAAtB;AAMA,wBAAU,YAAM;AACd,QAAIG,OAAO,GAAG,CAAd,EAAiB;AACf,UAAMG,KAAK,GAAGC,UAAU,CAACF,aAAD,EAAgBF,OAAhB,CAAxB;AAEA,aAAO;AAAA,eAAMK,YAAY,CAACF,KAAD,CAAlB;AAAA,OAAP;AACD;AACF,GAND,EAMG,CAACL,WAAD,EAAcE,OAAd,EAAuBE,aAAvB,CANH;AAQA,sBACE,6BAAC,0BAAD;AACE,IAAA,GAAG,EAAER,GADP;AAEE,IAAA,KAAK,EAAEE,IAFT;AAGE,IAAA,WAAW,EAAEG;AAHf,KAIME,IAJN,gBAME,6BAAC,8BAAD,QAAyBN,IAAzB,CANF,EAOGG,WAAW,gBAAG,6BAAC,4BAAD;AAAsB,IAAA,OAAO,EAAEI;AAA/B,IAAH,GAAsD,IAPpE,CADF;AAWD,CAtCyB,CAArB;;AAyCPT,YAAY,CAACa,WAAb,GAA2B,cAA3B","sourcesContent":["import React, {\n forwardRef,\n HTMLAttributes,\n Ref,\n useEffect,\n useCallback,\n} from \"react\";\nimport {\n StyledToastMessage,\n StyledToastMessageText,\n StyledCloseSmallIcon,\n} from \"./Styles\";\n\nexport interface ToastMessageProps {\n text: string;\n type: \"error\" | \"success\" | \"general\" | \"warning\";\n onClose?: () => void;\n dismissible?: boolean;\n dropShadow?: boolean;\n timeout?: number;\n}\n\nexport const ToastMessage = forwardRef(\n (\n {\n text,\n type,\n onClose,\n dismissible = false,\n dropShadow = false,\n timeout = 0,\n ...rest\n }: ToastMessageProps & HTMLAttributes<HTMLDivElement>,\n ref: Ref<HTMLDivElement> | null | undefined\n ) => {\n const handleOnClose = useCallback(() => {\n if (typeof onClose === \"function\") {\n onClose();\n }\n }, [onClose]);\n\n useEffect(() => {\n if (timeout > 0) {\n const timer = setTimeout(handleOnClose, timeout);\n\n return () => clearTimeout(timer);\n }\n }, [dismissible, timeout, handleOnClose]);\n\n return (\n <StyledToastMessage\n ref={ref}\n $type={type}\n $dropShadow={dropShadow}\n {...rest}\n >\n <StyledToastMessageText>{text}</StyledToastMessageText>\n {dismissible ? <StyledCloseSmallIcon onClick={handleOnClose} /> : null}\n </StyledToastMessage>\n );\n }\n);\n\nToastMessage.displayName = \"ToastMessage\";\n"],"file":"ToastMessage.js"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
export interface ToastMessageProps {
|
|
3
3
|
text: string;
|
|
4
4
|
type: "error" | "success" | "general" | "warning";
|
|
5
5
|
onClose?: () => void;
|
|
6
|
-
|
|
6
|
+
dismissible?: boolean;
|
|
7
7
|
dropShadow?: boolean;
|
|
8
8
|
timeout?: number;
|
|
9
9
|
}
|
|
10
|
-
export declare const ToastMessage:
|
|
11
|
-
({ text, type, onClose, dismissable, dropShadow, timeout, }: ToastMessageProps): JSX.Element;
|
|
12
|
-
displayName: string;
|
|
13
|
-
};
|
|
10
|
+
export declare const ToastMessage: React.ForwardRefExoticComponent<ToastMessageProps & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
14
11
|
//# sourceMappingURL=ToastMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/ToastMessage/ToastMessage.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ToastMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/ToastMessage/ToastMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAOf,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IAClD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,YAAY,iIAuCxB,CAAC"}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
var _excluded = ["text", "type", "onClose", "dismissible", "dropShadow", "timeout"];
|
|
4
|
+
import React, { forwardRef, useEffect, useCallback } from "react";
|
|
2
5
|
import { StyledToastMessage, StyledToastMessageText, StyledCloseSmallIcon } from "./Styles";
|
|
3
|
-
export var ToastMessage = function
|
|
6
|
+
export var ToastMessage = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
4
7
|
var text = _ref.text,
|
|
5
8
|
type = _ref.type,
|
|
6
9
|
onClose = _ref.onClose,
|
|
7
|
-
_ref$
|
|
8
|
-
|
|
10
|
+
_ref$dismissible = _ref.dismissible,
|
|
11
|
+
dismissible = _ref$dismissible === void 0 ? false : _ref$dismissible,
|
|
9
12
|
_ref$dropShadow = _ref.dropShadow,
|
|
10
13
|
dropShadow = _ref$dropShadow === void 0 ? false : _ref$dropShadow,
|
|
11
14
|
_ref$timeout = _ref.timeout,
|
|
12
|
-
timeout = _ref$timeout === void 0 ? 0 : _ref$timeout
|
|
15
|
+
timeout = _ref$timeout === void 0 ? 0 : _ref$timeout,
|
|
16
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
17
|
+
|
|
13
18
|
var handleOnClose = useCallback(function () {
|
|
14
19
|
if (typeof onClose === "function") {
|
|
15
20
|
onClose();
|
|
@@ -22,13 +27,14 @@ export var ToastMessage = function ToastMessage(_ref) {
|
|
|
22
27
|
return clearTimeout(timer);
|
|
23
28
|
};
|
|
24
29
|
}
|
|
25
|
-
}, [
|
|
26
|
-
return /*#__PURE__*/React.createElement(StyledToastMessage, {
|
|
30
|
+
}, [dismissible, timeout, handleOnClose]);
|
|
31
|
+
return /*#__PURE__*/React.createElement(StyledToastMessage, _extends({
|
|
32
|
+
ref: ref,
|
|
27
33
|
$type: type,
|
|
28
34
|
$dropShadow: dropShadow
|
|
29
|
-
}, /*#__PURE__*/React.createElement(StyledToastMessageText, null, text),
|
|
35
|
+
}, rest), /*#__PURE__*/React.createElement(StyledToastMessageText, null, text), dismissible ? /*#__PURE__*/React.createElement(StyledCloseSmallIcon, {
|
|
30
36
|
onClick: handleOnClose
|
|
31
37
|
}) : null);
|
|
32
|
-
};
|
|
38
|
+
});
|
|
33
39
|
ToastMessage.displayName = "ToastMessage";
|
|
34
40
|
//# sourceMappingURL=ToastMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/ToastMessage/ToastMessage.tsx"],"names":["React","useEffect","useCallback","StyledToastMessage","StyledToastMessageText","StyledCloseSmallIcon","ToastMessage","text","type","onClose","
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/ToastMessage/ToastMessage.tsx"],"names":["React","forwardRef","useEffect","useCallback","StyledToastMessage","StyledToastMessageText","StyledCloseSmallIcon","ToastMessage","ref","text","type","onClose","dismissible","dropShadow","timeout","rest","handleOnClose","timer","setTimeout","clearTimeout","displayName"],"mappings":";;;AAAA,OAAOA,KAAP,IACEC,UADF,EAIEC,SAJF,EAKEC,WALF,QAMO,OANP;AAOA,SACEC,kBADF,EAEEC,sBAFF,EAGEC,oBAHF,QAIO,UAJP;AAeA,OAAO,IAAMC,YAAY,gBAAGN,UAAU,CACpC,gBAUEO,GAVF,EAWK;AAAA,MATDC,IASC,QATDA,IASC;AAAA,MARDC,IAQC,QARDA,IAQC;AAAA,MAPDC,OAOC,QAPDA,OAOC;AAAA,8BANDC,WAMC;AAAA,MANDA,WAMC,iCANa,KAMb;AAAA,6BALDC,UAKC;AAAA,MALDA,UAKC,gCALY,KAKZ;AAAA,0BAJDC,OAIC;AAAA,MAJDA,OAIC,6BAJS,CAIT;AAAA,MAHEC,IAGF;;AACH,MAAMC,aAAa,GAAGb,WAAW,CAAC,YAAM;AACtC,QAAI,OAAOQ,OAAP,KAAmB,UAAvB,EAAmC;AACjCA,MAAAA,OAAO;AACR;AACF,GAJgC,EAI9B,CAACA,OAAD,CAJ8B,CAAjC;AAMAT,EAAAA,SAAS,CAAC,YAAM;AACd,QAAIY,OAAO,GAAG,CAAd,EAAiB;AACf,UAAMG,KAAK,GAAGC,UAAU,CAACF,aAAD,EAAgBF,OAAhB,CAAxB;AAEA,aAAO;AAAA,eAAMK,YAAY,CAACF,KAAD,CAAlB;AAAA,OAAP;AACD;AACF,GANQ,EAMN,CAACL,WAAD,EAAcE,OAAd,EAAuBE,aAAvB,CANM,CAAT;AAQA,sBACE,oBAAC,kBAAD;AACE,IAAA,GAAG,EAAER,GADP;AAEE,IAAA,KAAK,EAAEE,IAFT;AAGE,IAAA,WAAW,EAAEG;AAHf,KAIME,IAJN,gBAME,oBAAC,sBAAD,QAAyBN,IAAzB,CANF,EAOGG,WAAW,gBAAG,oBAAC,oBAAD;AAAsB,IAAA,OAAO,EAAEI;AAA/B,IAAH,GAAsD,IAPpE,CADF;AAWD,CAtCmC,CAA/B;AAyCPT,YAAY,CAACa,WAAb,GAA2B,cAA3B","sourcesContent":["import React, {\n forwardRef,\n HTMLAttributes,\n Ref,\n useEffect,\n useCallback,\n} from \"react\";\nimport {\n StyledToastMessage,\n StyledToastMessageText,\n StyledCloseSmallIcon,\n} from \"./Styles\";\n\nexport interface ToastMessageProps {\n text: string;\n type: \"error\" | \"success\" | \"general\" | \"warning\";\n onClose?: () => void;\n dismissible?: boolean;\n dropShadow?: boolean;\n timeout?: number;\n}\n\nexport const ToastMessage = forwardRef(\n (\n {\n text,\n type,\n onClose,\n dismissible = false,\n dropShadow = false,\n timeout = 0,\n ...rest\n }: ToastMessageProps & HTMLAttributes<HTMLDivElement>,\n ref: Ref<HTMLDivElement> | null | undefined\n ) => {\n const handleOnClose = useCallback(() => {\n if (typeof onClose === \"function\") {\n onClose();\n }\n }, [onClose]);\n\n useEffect(() => {\n if (timeout > 0) {\n const timer = setTimeout(handleOnClose, timeout);\n\n return () => clearTimeout(timer);\n }\n }, [dismissible, timeout, handleOnClose]);\n\n return (\n <StyledToastMessage\n ref={ref}\n $type={type}\n $dropShadow={dropShadow}\n {...rest}\n >\n <StyledToastMessageText>{text}</StyledToastMessageText>\n {dismissible ? <StyledCloseSmallIcon onClick={handleOnClose} /> : null}\n </StyledToastMessage>\n );\n }\n);\n\nToastMessage.displayName = \"ToastMessage\";\n"],"file":"ToastMessage.js"}
|