oolib 2.215.3 → 2.216.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.
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import { BannerCTA, BannerProps } from "../types";
3
+ export declare const CTA: ({ cta }: {
4
+ cta: BannerCTA;
5
+ }) => React.JSX.Element;
6
+ /**
7
+ * @component Renders a banner component with customizable text, color and styling.
8
+ *
9
+ * - The object containing the following properties:
10
+ * @prop {IconColor} color: The color of the banner.
11
+ * @prop {BannerCTA} cta: The object containing the info about the cta button.
12
+ * @prop {string} msg: The text to be displayed in the banner.
13
+ * @prop {(e: React.MouseEvent | null, id: string) => void} handleRemove: The callback function to be called when the banner is removed.
14
+ * @prop {string} id: The id of the banner.
15
+ * @prop {number} timeOut: The time in milliseconds to wait before removing the banner. Defaults to 3000.
16
+ * @prop {boolean} showIcon: A boolean indicating whether to show the icon in the banner. Defaults to true.
17
+ * @prop {boolean} bottomStroke: A boolean indicating whether to show the bottom stroke in the banner. Defaults to true.
18
+ * @prop {boolean} hideCloseButton: A boolean indicating whether to hide the close button in the banner. Defaults to false.
19
+ * @return {ReactElement} The rendered banner component.
20
+ */
21
+ export declare const Banner: React.FunctionComponent<BannerProps>;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.Banner = exports.CTA = void 0;
48
+ var react_1 = __importStar(require("react"));
49
+ var styled_1 = require("../styled");
50
+ var react_router_dom_1 = require("react-router-dom");
51
+ var Buttons_1 = require("../../../v2/components/Buttons");
52
+ var Typo2_1 = require("../../../v2/components/Typo2");
53
+ var __1 = require("..");
54
+ var CTA = function (_a) {
55
+ var cta = _a.cta;
56
+ var LinkWrapper = cta.to ? react_router_dom_1.Link : react_1.Fragment;
57
+ return (react_1.default.createElement(LinkWrapper, __assign({}, (cta.to ? { to: cta.to } : {})),
58
+ react_1.default.createElement(Buttons_1.ButtonSecondaryCompact, { style: { marginTop: "0.5rem", marginBottom: "0.5rem" }, S: true, onClick: !cta.to && cta.action }, cta === null || cta === void 0 ? void 0 : cta.text)));
59
+ };
60
+ exports.CTA = CTA;
61
+ /**
62
+ * @component Renders a banner component with customizable text, color and styling.
63
+ *
64
+ * - The object containing the following properties:
65
+ * @prop {IconColor} color: The color of the banner.
66
+ * @prop {BannerCTA} cta: The object containing the info about the cta button.
67
+ * @prop {string} msg: The text to be displayed in the banner.
68
+ * @prop {(e: React.MouseEvent | null, id: string) => void} handleRemove: The callback function to be called when the banner is removed.
69
+ * @prop {string} id: The id of the banner.
70
+ * @prop {number} timeOut: The time in milliseconds to wait before removing the banner. Defaults to 3000.
71
+ * @prop {boolean} showIcon: A boolean indicating whether to show the icon in the banner. Defaults to true.
72
+ * @prop {boolean} bottomStroke: A boolean indicating whether to show the bottom stroke in the banner. Defaults to true.
73
+ * @prop {boolean} hideCloseButton: A boolean indicating whether to hide the close button in the banner. Defaults to false.
74
+ * @return {ReactElement} The rendered banner component.
75
+ */
76
+ var Banner = function (_a) {
77
+ var color = _a.color, cta = _a.cta, msg = _a.msg, handleRemove = _a.handleRemove, id = _a.id, timeOut = _a.timeOut, _b = _a.showIcon, showIcon = _b === void 0 ? true : _b, _c = _a.bottomStroke, bottomStroke = _c === void 0 ? true : _c, _d = _a.hideCloseButton, hideCloseButton = _d === void 0 ? false : _d;
78
+ var _e = (0, react_1.useState)(0), height = _e[0], setHeight = _e[1];
79
+ var ContainerRef = (0, react_1.useRef)(null);
80
+ (0, react_1.useEffect)(function () {
81
+ var timer;
82
+ if (ContainerRef.current) {
83
+ setHeight(ContainerRef.current.scrollHeight);
84
+ }
85
+ if (timeOut) {
86
+ timer = setTimeout(function () {
87
+ setHeight(0);
88
+ remove(null, id);
89
+ }, timeOut);
90
+ }
91
+ return function () {
92
+ if (timer)
93
+ clearTimeout(timer);
94
+ };
95
+ }, [cta, id, msg, timeOut]);
96
+ var remove = function (e, id) {
97
+ setHeight(0);
98
+ setTimeout(function () {
99
+ handleRemove(e, id);
100
+ }, 300);
101
+ };
102
+ return (react_1.default.createElement(styled_1.BannerAnimateStyled, { key: id, ref: ContainerRef, height: height },
103
+ react_1.default.createElement(styled_1.BannerWrapperStyled, { bottomStroke: bottomStroke, color: color },
104
+ react_1.default.createElement(styled_1.BannerStyled, null,
105
+ showIcon && react_1.default.createElement(__1.DisplayIcon, { color: color }),
106
+ react_1.default.createElement(Typo2_1.UI_BODY_SEMIBOLD_SM_DF, null, msg),
107
+ cta && react_1.default.createElement(exports.CTA, { cta: cta })),
108
+ hideCloseButton !== true &&
109
+ react_1.default.createElement(Buttons_1.ButtonGhost, { S: true, icon: "X", onClick: function (e) { return remove(e, id); } }))));
110
+ };
111
+ exports.Banner = Banner;
@@ -0,0 +1,19 @@
1
+ import { FunctionComponent } from "react";
2
+ import { BannerProps } from "../types";
3
+ export declare const StyledToastWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ /**
5
+ * A toast component that displays a message and an optional close button and/or CTA button.
6
+ *
7
+ * @param {BannerProps} props - The props object containing the following properties
8
+ * @param {IconColor} color - The color of the banner.
9
+ * @param {BannerCTA} cta - An object containing the info about the cta button.
10
+ * @param {string} msg - The text to be displayed in the banner.
11
+ * @param {(e: React.MouseEvent | null, id: string) => void} handleRemove - A callback function to be called when a banner is removed. The function takes the mouse event and the id of the banner as arguments.
12
+ * @param {string} id - The id of the banner.
13
+ * @param {boolean} showIcon - A boolean indicating whether to show the icon in the banner. Defaults to true.
14
+ * @param {boolean} hideCloseButton - A boolean indicating whether to hide the close button in the banner. Defaults to false.
15
+ * @param {string} actionText - The text to be displayed on the close button in the banner.
16
+ * @param {boolean} bottomStroke - A boolean indicating whether to add a bottom stroke to the banner. Defaults to true.
17
+ * @param {number} timeOut - The time in milliseconds to wait before removing the banner. Defaults to 3000.
18
+ */
19
+ export declare const Toast: FunctionComponent<BannerProps>;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.Toast = exports.StyledToastWrapper = void 0;
11
+ var react_1 = __importDefault(require("react"));
12
+ var styled_components_1 = __importDefault(require("styled-components"));
13
+ var framer_motion_1 = require("framer-motion");
14
+ var mixins_1 = require("../../../themes/mixins");
15
+ var Typo2_1 = require("../../../v2/components/Typo2");
16
+ var Buttons_1 = require("../../../v2/components/Buttons");
17
+ var __1 = require("..");
18
+ var Banner_1 = require("../Banner");
19
+ var StyledToast = (0, styled_components_1.default)(framer_motion_1.motion.div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 0.8rem 1.2rem;\n border-radius: 1.2rem;\n background: white;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 40rem;\n min-height: 5rem;\n\n ", " {\n width: 45rem;\n };\n\n box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.15);\n\n"], ["\n padding: 0.8rem 1.2rem;\n border-radius: 1.2rem;\n background: white;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 40rem;\n min-height: 5rem;\n\n ", " {\n width: 45rem;\n };\n\n box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.15);\n\n"])), (0, mixins_1.mediaQuery)("md"));
20
+ exports.StyledToastWrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: fixed;\n bottom: 2.5rem;\n right: 2.5rem;\n width: max-content;\n z-index: 1000000000;\n overflow: hidden;\n padding: 2rem;\n background: transparent;\n"], ["\n position: fixed;\n bottom: 2.5rem;\n right: 2.5rem;\n width: max-content;\n z-index: 1000000000;\n overflow: hidden;\n padding: 2rem;\n background: transparent;\n"
21
+ /**
22
+ * A toast component that displays a message and an optional close button and/or CTA button.
23
+ *
24
+ * @param {BannerProps} props - The props object containing the following properties
25
+ * @param {IconColor} color - The color of the banner.
26
+ * @param {BannerCTA} cta - An object containing the info about the cta button.
27
+ * @param {string} msg - The text to be displayed in the banner.
28
+ * @param {(e: React.MouseEvent | null, id: string) => void} handleRemove - A callback function to be called when a banner is removed. The function takes the mouse event and the id of the banner as arguments.
29
+ * @param {string} id - The id of the banner.
30
+ * @param {boolean} showIcon - A boolean indicating whether to show the icon in the banner. Defaults to true.
31
+ * @param {boolean} hideCloseButton - A boolean indicating whether to hide the close button in the banner. Defaults to false.
32
+ * @param {string} actionText - The text to be displayed on the close button in the banner.
33
+ * @param {boolean} bottomStroke - A boolean indicating whether to add a bottom stroke to the banner. Defaults to true.
34
+ * @param {number} timeOut - The time in milliseconds to wait before removing the banner. Defaults to 3000.
35
+ */
36
+ ])));
37
+ /**
38
+ * A toast component that displays a message and an optional close button and/or CTA button.
39
+ *
40
+ * @param {BannerProps} props - The props object containing the following properties
41
+ * @param {IconColor} color - The color of the banner.
42
+ * @param {BannerCTA} cta - An object containing the info about the cta button.
43
+ * @param {string} msg - The text to be displayed in the banner.
44
+ * @param {(e: React.MouseEvent | null, id: string) => void} handleRemove - A callback function to be called when a banner is removed. The function takes the mouse event and the id of the banner as arguments.
45
+ * @param {string} id - The id of the banner.
46
+ * @param {boolean} showIcon - A boolean indicating whether to show the icon in the banner. Defaults to true.
47
+ * @param {boolean} hideCloseButton - A boolean indicating whether to hide the close button in the banner. Defaults to false.
48
+ * @param {string} actionText - The text to be displayed on the close button in the banner.
49
+ * @param {boolean} bottomStroke - A boolean indicating whether to add a bottom stroke to the banner. Defaults to true.
50
+ * @param {number} timeOut - The time in milliseconds to wait before removing the banner. Defaults to 3000.
51
+ */
52
+ var Toast = function (_a) {
53
+ var color = _a.color, cta = _a.cta, msg = _a.msg, handleRemove = _a.handleRemove, id = _a.id, _b = _a.showIcon, showIcon = _b === void 0 ? true : _b, _c = _a.hideCloseButton, hideCloseButton = _c === void 0 ? false : _c, actionText = _a.actionText, actionIcon = _a.actionIcon, _d = _a.bottomStroke, bottomStroke = _d === void 0 ? true : _d, timeOut = _a.timeOut;
54
+ return (react_1.default.createElement(StyledToast, { initial: { x: "100%", opacity: 0 }, animate: { x: 0, opacity: 1 }, exit: { x: "100%", opacity: 0 }, transition: { type: "spring", damping: 25, stiffness: 300 } },
55
+ react_1.default.createElement("div", { style: { display: "flex" } },
56
+ showIcon && react_1.default.createElement(__1.DisplayIcon, { color: color }),
57
+ react_1.default.createElement(Typo2_1.UI_BODY_SEMIBOLD_SM_DF, null, msg),
58
+ cta && react_1.default.createElement(Banner_1.CTA, { cta: cta })),
59
+ hideCloseButton !== true &&
60
+ react_1.default.createElement(Buttons_1.ButtonSecondary, { S: true, style: { maxWidth: "10rem" }, icon: actionIcon, onClick: function (e) { return handleRemove(e, id); }, children: actionText })));
61
+ };
62
+ exports.Toast = Toast;
63
+ var templateObject_1, templateObject_2;
@@ -1,40 +1,6 @@
1
1
  import React from "react";
2
- import { To } from 'react-router-dom';
3
- export type IconColor = 'red' | 'green' | 'yellow' | 'dark' | 'grey';
4
- export interface DisplayIconProps {
5
- color: IconColor;
6
- }
7
- export interface BannerCTA {
8
- to?: To;
9
- action?: () => void;
10
- text: string;
11
- }
12
- export interface BannerProps {
13
- color: IconColor;
14
- cta?: BannerCTA;
15
- msg: string;
16
- handleRemove: (e: React.MouseEvent | null, id: string) => void;
17
- id: string;
18
- timeOut?: number;
19
- showIcon?: boolean;
20
- bottomStroke?: boolean;
21
- hideCloseButton?: boolean;
22
- }
23
- export interface BannerState {
24
- id: string;
25
- color: IconColor;
26
- msg: string;
27
- cta?: BannerCTA;
28
- timeOut?: number;
29
- showIcon?: boolean;
30
- hideCloseButton?: boolean;
31
- }
32
- export interface BannerAlertProps {
33
- BANNER_STATE: {
34
- alertState: BannerState[];
35
- };
36
- REMOVE_ALERT_BANNER: (e: React.MouseEvent | null, id: string) => void;
37
- }
2
+ import { BannerAlertProps, BannerInfoProps, DisplayIconProps } from "./types";
3
+ export declare const DisplayIcon: React.FunctionComponent<DisplayIconProps>;
38
4
  /**
39
5
  * @component Renders a list of alert banners with customizable text, color and styling.
40
6
  *
@@ -53,12 +19,6 @@ export interface BannerAlertProps {
53
19
  * @prop {boolean} hideCloseButton: A boolean indicating whether to hide the close button in the banner. Defaults to false.
54
20
  */
55
21
  export declare const BannerAlert: React.FunctionComponent<BannerAlertProps>;
56
- export interface BannerInfoProps {
57
- BANNER_STATE: {
58
- infoState: BannerState[];
59
- };
60
- REMOVE_INFO_BANNER: (e: React.MouseEvent | null, id: string) => void;
61
- }
62
22
  /**
63
23
  * @component Renders a list of info banners with customizable text, color and styling.
64
24
  *
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
3
  if (k2 === undefined) k2 = k;
15
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -44,79 +33,19 @@ var __importStar = (this && this.__importStar) || (function () {
44
33
  };
45
34
  })();
46
35
  Object.defineProperty(exports, "__esModule", { value: true });
47
- exports.BannerInfo = exports.BannerAlert = void 0;
36
+ exports.BannerInfo = exports.BannerAlert = exports.DisplayIcon = void 0;
48
37
  var react_1 = __importStar(require("react"));
49
38
  var styled_1 = require("./styled");
50
- var react_router_dom_1 = require("react-router-dom");
51
39
  var icons_1 = require("../../icons");
52
- var Buttons_1 = require("../../v2/components/Buttons");
53
- var Typo2_1 = require("../../v2/components/Typo2");
54
- var ICONS = {
55
- red: "XCircle",
56
- green: "CheckCircle",
57
- yellow: "WarningCircle",
58
- dark: "WarningCircle",
59
- grey: "WarningCircle",
60
- };
40
+ var Toast_1 = require("./Toast");
41
+ var types_1 = require("./types");
42
+ var Banner_1 = require("./Banner");
61
43
  var DisplayIcon = function (_a) {
62
44
  var color = _a.color;
63
- var IconComp = icons_1.icons[ICONS[color]];
45
+ var IconComp = icons_1.icons[types_1.ICONS[color]];
64
46
  return react_1.default.createElement(react_1.default.Fragment, null, IconComp && react_1.default.createElement(IconComp, { size: 20, weight: "bold" }));
65
47
  };
66
- /**
67
- * @component Renders a banner component with customizable text, color and styling.
68
- *
69
- * - The object containing the following properties:
70
- * @prop {IconColor} color: The color of the banner.
71
- * @prop {BannerCTA} cta: The object containing the info about the cta button.
72
- * @prop {string} msg: The text to be displayed in the banner.
73
- * @prop {(e: React.MouseEvent | null, id: string) => void} handleRemove: The callback function to be called when the banner is removed.
74
- * @prop {string} id: The id of the banner.
75
- * @prop {number} timeOut: The time in milliseconds to wait before removing the banner. Defaults to 3000.
76
- * @prop {boolean} showIcon: A boolean indicating whether to show the icon in the banner. Defaults to true.
77
- * @prop {boolean} bottomStroke: A boolean indicating whether to show the bottom stroke in the banner. Defaults to true.
78
- * @prop {boolean} hideCloseButton: A boolean indicating whether to hide the close button in the banner. Defaults to false.
79
- * @return {ReactElement} The rendered banner component.
80
- */
81
- var Banner = function (_a) {
82
- var color = _a.color, cta = _a.cta, msg = _a.msg, handleRemove = _a.handleRemove, id = _a.id, timeOut = _a.timeOut, _b = _a.showIcon, showIcon = _b === void 0 ? true : _b, _c = _a.bottomStroke, bottomStroke = _c === void 0 ? true : _c, _d = _a.hideCloseButton, hideCloseButton = _d === void 0 ? false : _d;
83
- var _e = (0, react_1.useState)(0), height = _e[0], setHeight = _e[1];
84
- var ContainerRef = (0, react_1.useRef)(null);
85
- (0, react_1.useEffect)(function () {
86
- var timer;
87
- if (ContainerRef.current) {
88
- setHeight(ContainerRef.current.scrollHeight);
89
- }
90
- if (timeOut) {
91
- timer = setTimeout(function () {
92
- setHeight(0);
93
- remove(null, id);
94
- }, timeOut);
95
- }
96
- return function () {
97
- if (timer)
98
- clearTimeout(timer);
99
- };
100
- }, [cta, id, msg, timeOut]);
101
- var remove = function (e, id) {
102
- setHeight(0);
103
- setTimeout(function () {
104
- handleRemove(e, id);
105
- }, 300);
106
- };
107
- var genCTA = function (cta) {
108
- var LinkWrapper = cta.to ? react_router_dom_1.Link : react_1.Fragment;
109
- return (react_1.default.createElement(LinkWrapper, __assign({}, (cta.to ? { to: cta.to } : {})),
110
- react_1.default.createElement(Buttons_1.ButtonSecondaryCompact, { style: { marginTop: "0.5rem", marginBottom: "0.5rem" }, S: true, onClick: !cta.to && cta.action }, cta === null || cta === void 0 ? void 0 : cta.text)));
111
- };
112
- return (react_1.default.createElement(styled_1.BannerAnimateStyled, { key: id, ref: ContainerRef, height: height },
113
- react_1.default.createElement(styled_1.BannerWrapperStyled, { bottomStroke: bottomStroke, color: color },
114
- react_1.default.createElement(styled_1.BannerStyled, null,
115
- showIcon && react_1.default.createElement(DisplayIcon, { color: color }),
116
- react_1.default.createElement(Typo2_1.UI_BODY_SEMIBOLD_SM_DF, null, msg),
117
- cta && genCTA(cta)),
118
- hideCloseButton !== true && react_1.default.createElement(Buttons_1.ButtonGhost, { S: true, icon: "X", onClick: function (e) { return remove(e, id); } }))));
119
- };
48
+ exports.DisplayIcon = DisplayIcon;
120
49
  /**
121
50
  * @component Renders a list of alert banners with customizable text, color and styling.
122
51
  *
@@ -135,9 +64,9 @@ var Banner = function (_a) {
135
64
  * @prop {boolean} hideCloseButton: A boolean indicating whether to hide the close button in the banner. Defaults to false.
136
65
  */
137
66
  var BannerAlert = function (_a) {
138
- var _b;
139
- var BANNER_STATE = _a.BANNER_STATE, REMOVE_ALERT_BANNER = _a.REMOVE_ALERT_BANNER;
140
- var _c = (0, react_1.useState)(0), top = _c[0], setTop = _c[1];
67
+ var _b, _c;
68
+ var BANNER_STATE = _a.BANNER_STATE, REMOVE_ALERT_BANNER = _a.REMOVE_ALERT_BANNER, variant = _a.variant;
69
+ var _d = (0, react_1.useState)(0), top = _d[0], setTop = _d[1];
141
70
  (0, react_1.useEffect)(function () {
142
71
  var timerId = setTimeout(function () {
143
72
  var ele = document.getElementById("bannerInfo");
@@ -149,7 +78,11 @@ var BannerAlert = function (_a) {
149
78
  clearTimeout(timerId);
150
79
  };
151
80
  }, []);
152
- return (react_1.default.createElement(styled_1.BannerAlertStyled, { top: top }, (_b = BANNER_STATE === null || BANNER_STATE === void 0 ? void 0 : BANNER_STATE.alertState) === null || _b === void 0 ? void 0 : _b.map(function (e) { return (react_1.default.createElement(Banner, { key: e.id, id: e.id, color: e.color, msg: e.msg, cta: e.cta, handleRemove: REMOVE_ALERT_BANNER, timeOut: e.timeOut, hideCloseButton: e.hideCloseButton })); })));
81
+ return variant === "toast"
82
+ ?
83
+ react_1.default.createElement(Toast_1.StyledToastWrapper, null, (_b = BANNER_STATE === null || BANNER_STATE === void 0 ? void 0 : BANNER_STATE.alertState) === null || _b === void 0 ? void 0 : _b.map(function (e) { return (react_1.default.createElement(Toast_1.Toast, { key: e.id, id: e.id, color: e.color, msg: e.msg, cta: e.cta, handleRemove: REMOVE_ALERT_BANNER, timeOut: e.timeOut, hideCloseButton: e.hideCloseButton, actionText: e.actionText, actionIcon: e.actionIcon })); }))
84
+ :
85
+ react_1.default.createElement(styled_1.BannerAlertStyled, { top: top }, (_c = BANNER_STATE === null || BANNER_STATE === void 0 ? void 0 : BANNER_STATE.alertState) === null || _c === void 0 ? void 0 : _c.map(function (e) { return (react_1.default.createElement(Banner_1.Banner, { key: e.id, id: e.id, color: e.color, msg: e.msg, cta: e.cta, handleRemove: REMOVE_ALERT_BANNER, timeOut: e.timeOut, hideCloseButton: e.hideCloseButton })); }));
153
86
  };
154
87
  exports.BannerAlert = BannerAlert;
155
88
  /**
@@ -170,8 +103,12 @@ exports.BannerAlert = BannerAlert;
170
103
  * @prop {boolean} hideCloseButton: A boolean indicating whether to hide the close button in the banner. Defaults to false.
171
104
  */
172
105
  var BannerInfo = function (_a) {
173
- var _b;
174
- var BANNER_STATE = _a.BANNER_STATE, REMOVE_INFO_BANNER = _a.REMOVE_INFO_BANNER;
175
- return (react_1.default.createElement(styled_1.BannerInfoStyled, { id: "bannerInfo" }, (_b = BANNER_STATE === null || BANNER_STATE === void 0 ? void 0 : BANNER_STATE.infoState) === null || _b === void 0 ? void 0 : _b.map(function (e) { return (react_1.default.createElement(Banner, { key: e.id, id: e.id, color: e.color, msg: e.msg, cta: e.cta, handleRemove: REMOVE_INFO_BANNER, timeOut: e.timeOut, bottomStroke: false, hideCloseButton: e.hideCloseButton })); })));
106
+ var _b, _c;
107
+ var BANNER_STATE = _a.BANNER_STATE, REMOVE_INFO_BANNER = _a.REMOVE_INFO_BANNER, variant = _a.variant;
108
+ return variant === "toast"
109
+ ?
110
+ react_1.default.createElement(Toast_1.StyledToastWrapper, null, (_b = BANNER_STATE === null || BANNER_STATE === void 0 ? void 0 : BANNER_STATE.infoState) === null || _b === void 0 ? void 0 : _b.map(function (e) { return (react_1.default.createElement(Toast_1.Toast, { key: e.id, id: e.id, color: e.color, msg: e.msg, cta: e.cta, handleRemove: REMOVE_INFO_BANNER, timeOut: e.timeOut, hideCloseButton: e.hideCloseButton, actionText: e.actionText, actionIcon: e.actionIcon })); }))
111
+ :
112
+ react_1.default.createElement(styled_1.BannerInfoStyled, { id: "bannerInfo" }, (_c = BANNER_STATE === null || BANNER_STATE === void 0 ? void 0 : BANNER_STATE.infoState) === null || _c === void 0 ? void 0 : _c.map(function (e) { return (react_1.default.createElement(Banner_1.Banner, { key: e.id, id: e.id, color: e.color, msg: e.msg, cta: e.cta, handleRemove: REMOVE_INFO_BANNER, timeOut: e.timeOut, bottomStroke: false, hideCloseButton: e.hideCloseButton, variant: variant })); }));
176
113
  };
177
114
  exports.BannerInfo = BannerInfo;
@@ -0,0 +1,50 @@
1
+ import { To } from "react-router-dom";
2
+ export type IconColor = 'red' | 'green' | 'yellow' | 'dark' | 'grey';
3
+ export declare const ICONS: Record<IconColor, string>;
4
+ export interface BannerProps {
5
+ color: IconColor;
6
+ cta?: BannerCTA;
7
+ msg: string;
8
+ handleRemove: (e: React.MouseEvent | null, id: string) => void;
9
+ id: string;
10
+ timeOut?: number;
11
+ showIcon?: boolean;
12
+ bottomStroke?: boolean;
13
+ hideCloseButton?: boolean;
14
+ variant?: "toast" | "default";
15
+ actionText?: string;
16
+ actionIcon?: string;
17
+ }
18
+ export interface DisplayIconProps {
19
+ color: IconColor;
20
+ }
21
+ export interface BannerCTA {
22
+ to?: To;
23
+ action?: () => void;
24
+ text: string;
25
+ }
26
+ export interface BannerState {
27
+ id: string;
28
+ color: IconColor;
29
+ msg: string;
30
+ cta?: BannerCTA;
31
+ timeOut?: number;
32
+ showIcon?: boolean;
33
+ hideCloseButton?: boolean;
34
+ actionText?: string;
35
+ actionIcon?: string;
36
+ }
37
+ export interface BannerAlertProps {
38
+ BANNER_STATE: {
39
+ alertState: BannerState[];
40
+ };
41
+ REMOVE_ALERT_BANNER: (e: React.MouseEvent | null, id: string) => void;
42
+ variant?: "toast" | "default";
43
+ }
44
+ export interface BannerInfoProps {
45
+ BANNER_STATE: {
46
+ infoState: BannerState[];
47
+ };
48
+ REMOVE_INFO_BANNER: (e: React.MouseEvent | null, id: string) => void;
49
+ variant?: "toast" | "default";
50
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ICONS = void 0;
4
+ exports.ICONS = {
5
+ red: "XCircle",
6
+ green: "CheckCircle",
7
+ yellow: "WarningCircle",
8
+ dark: "WarningCircle",
9
+ grey: "WarningCircle",
10
+ };
@@ -48,7 +48,7 @@ var EmptyStatesRenderer = function (_a) {
48
48
  searchListing: searchListing_svg_1.default,
49
49
  mailBoxImg: mailBoxImg_svg_1.default,
50
50
  searchDashBoardListing: searchDashBoardListing_svg_1.default,
51
- dashboardListing: dashboardListing_svg_1.default,
51
+ annoExplorerListing: dashboardListing_svg_1.default,
52
52
  };
53
53
  var localize = (0, utilsOolib_1.useLocale)();
54
54
  //basically image prop can be either the src string or an object with more properties
@@ -83,18 +83,18 @@ var getEmptyStatesConfig = function (_a) {
83
83
  title: "No Notifications Yet",
84
84
  subtitle: "All updates,notifications and alerts will be displayed here ",
85
85
  };
86
- case "dashboardListing":
86
+ case "annoExplorerListing":
87
87
  return {
88
88
  align: "center",
89
89
  image: {
90
- src: "dashboardListing",
90
+ src: "annoExplorerListing",
91
91
  style: {
92
92
  height: 80,
93
93
  opacity: 0.6,
94
94
  },
95
95
  },
96
- title: "No Data Added",
97
- subtitle: "Currently, no data is available. Start exploring insights once data is populated ",
96
+ title: "No Annotations Exist",
97
+ subtitle: "Start exploring Themes Explorer after you add at least a few annotations",
98
98
  };
99
99
  case "successFullyPublish":
100
100
  return {
@@ -25,6 +25,22 @@ declare namespace _default {
25
25
  let name_4: string;
26
26
  export { name_4 as name };
27
27
  }
28
+ namespace variant {
29
+ let name_5: string;
30
+ export { name_5 as name };
31
+ export let options: string[];
32
+ export namespace mapping {
33
+ let Default: string;
34
+ let Toast: string;
35
+ }
36
+ export namespace control_1 {
37
+ let type_1: string;
38
+ export { type_1 as type };
39
+ }
40
+ export { control_1 as control };
41
+ let defaultValue_1: string;
42
+ export { defaultValue_1 as defaultValue };
43
+ }
28
44
  }
29
45
  namespace args {
30
46
  export let color: string;
@@ -38,6 +54,9 @@ declare namespace _default {
38
54
  export { autoHide_1 as autoHide };
39
55
  let timeOut_1: number;
40
56
  export { timeOut_1 as timeOut };
57
+ let variant_1: string;
58
+ export { variant_1 as variant };
59
+ export let actionText: string;
41
60
  }
42
61
  }
43
62
  export default _default;
@@ -45,26 +64,28 @@ export function Banner_Alert(args: any): import("react").JSX.Element;
45
64
  export namespace Banner_Alert {
46
65
  export namespace argTypes_1 {
47
66
  export namespace color_1 {
48
- let name_5: string;
49
- export { name_5 as name };
50
- export let options: string[];
51
- export namespace mapping {
67
+ let name_6: string;
68
+ export { name_6 as name };
69
+ let options_1: string[];
70
+ export { options_1 as options };
71
+ export namespace mapping_1 {
52
72
  let Success: string;
53
73
  let Alert: string;
54
74
  let Wanring: string;
55
75
  }
56
- export namespace control_1 {
57
- let type_1: string;
58
- export { type_1 as type };
76
+ export { mapping_1 as mapping };
77
+ export namespace control_2 {
78
+ let type_2: string;
79
+ export { type_2 as type };
59
80
  }
60
- export { control_1 as control };
61
- let defaultValue_1: string;
62
- export { defaultValue_1 as defaultValue };
81
+ export { control_2 as control };
82
+ let defaultValue_2: string;
83
+ export { defaultValue_2 as defaultValue };
63
84
  }
64
85
  export { color_1 as color };
65
86
  export namespace buttonText {
66
- let name_6: string;
67
- export { name_6 as name };
87
+ let name_7: string;
88
+ export { name_7 as name };
68
89
  }
69
90
  }
70
91
  export { argTypes_1 as argTypes };
@@ -78,20 +99,21 @@ export function Banner_Info(args: any): import("react").JSX.Element;
78
99
  export namespace Banner_Info {
79
100
  export namespace argTypes_2 {
80
101
  export namespace color_2 {
81
- let name_7: string;
82
- export { name_7 as name };
83
- let options_1: string[];
84
- export { options_1 as options };
85
- export namespace control_2 {
86
- let type_2: string;
87
- export { type_2 as type };
102
+ let name_8: string;
103
+ export { name_8 as name };
104
+ let options_2: string[];
105
+ export { options_2 as options };
106
+ export namespace control_3 {
107
+ let type_3: string;
108
+ export { type_3 as type };
88
109
  }
89
- export { control_2 as control };
90
- let defaultValue_2: string;
91
- export { defaultValue_2 as defaultValue };
110
+ export { control_3 as control };
111
+ let defaultValue_3: string;
112
+ export { defaultValue_3 as defaultValue };
92
113
  }
93
114
  export { color_2 as color };
94
115
  }
95
116
  export { argTypes_2 as argTypes };
96
117
  }
118
+ export function Toast(args: any): import("react").JSX.Element;
97
119
  declare const availableIcons: string[];
@@ -9,7 +9,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
9
9
  return to.concat(ar || Array.prototype.slice.call(from));
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Banner_Info = exports.Banner_Alert = void 0;
12
+ exports.Toast = exports.Banner_Info = exports.Banner_Alert = void 0;
13
13
  var react_1 = require("react");
14
14
  var Banners_1 = require("../../../components/Banners");
15
15
  var icons_1 = require("../../../icons");
@@ -35,6 +35,16 @@ exports.default = {
35
35
  timeOut: {
36
36
  name: "Time Out",
37
37
  },
38
+ variant: {
39
+ name: "Variant",
40
+ options: ["Default", "Toast"],
41
+ mapping: {
42
+ Default: "default",
43
+ Toast: "toast",
44
+ },
45
+ control: { type: "select" },
46
+ defaultValue: "Default",
47
+ },
38
48
  },
39
49
  args: {
40
50
  color: "Success",
@@ -42,7 +52,9 @@ exports.default = {
42
52
  showIcon: "X",
43
53
  hideCloseButton: false,
44
54
  autoHide: false,
45
- timeOut: 5000,
55
+ timeOut: 50000000,
56
+ variant: "default",
57
+ actionText: ""
46
58
  },
47
59
  };
48
60
  var uid = 0;
@@ -72,7 +84,7 @@ var Banner_Alert = function (args) {
72
84
  alignItems: "center",
73
85
  gap: "1rem",
74
86
  } },
75
- React.createElement(Banners_1.BannerAlert, { BANNER_STATE: { alertState: state }, REMOVE_ALERT_BANNER: function (e, id) { return handleRemoveBanner({ id: id, setState: setState }); } }),
87
+ React.createElement(Banners_1.BannerAlert, { BANNER_STATE: { alertState: state }, REMOVE_ALERT_BANNER: function (e, id) { return handleRemoveBanner({ id: id, setState: setState }); }, variant: args.variant }),
76
88
  React.createElement("button", { onClick: function () { return handleAddMore({ args: args, state: state, setState: setState }); }, style: { padding: ".5rem", width: "fit-content" } }, "Add more"),
77
89
  React.createElement("h3", null,
78
90
  React.createElement("i", null, "Note: change props and click on add more button"))));
@@ -109,8 +121,10 @@ var Banner_Info = function (args) {
109
121
  flexDirection: "column",
110
122
  alignItems: "center",
111
123
  gap: "1rem",
124
+ // background:"skyblue",
125
+ height: "100svh"
112
126
  } },
113
- React.createElement(Banners_1.BannerInfo, { BANNER_STATE: { infoState: state }, REMOVE_INFO_BANNER: function (e, id) { return handleRemoveBanner({ id: id, setState: setState }); } }),
127
+ React.createElement(Banners_1.BannerInfo, { BANNER_STATE: { infoState: state }, variant: args.variant, REMOVE_INFO_BANNER: function (e, id) { return handleRemoveBanner({ id: id, setState: setState }); } }),
114
128
  React.createElement("button", { onClick: function () { return handleAddMore({ args: args, state: state, setState: setState }); }, style: { padding: ".5rem", width: "fit-content" } }, "Add More"),
115
129
  React.createElement("h3", null,
116
130
  React.createElement("i", null, "Note: change props and click on add more button"))));
@@ -124,3 +138,23 @@ exports.Banner_Info.argTypes = {
124
138
  defaultValue: "grey",
125
139
  },
126
140
  };
141
+ var Toast = function (args) {
142
+ var _a = (0, react_1.useState)([]), state = _a[0], setState = _a[1];
143
+ args.id = uid;
144
+ if (!args.autoHide) {
145
+ delete args.timeOut;
146
+ }
147
+ return (React.createElement("div", { style: {
148
+ display: "flex",
149
+ flexDirection: "column",
150
+ alignItems: "center",
151
+ gap: "1rem",
152
+ // background:"skyblue",
153
+ height: "100svh"
154
+ } },
155
+ React.createElement(Banners_1.BannerInfo, { BANNER_STATE: { infoState: state }, variant: "toast", REMOVE_INFO_BANNER: function (e, id) { return handleRemoveBanner({ id: id, setState: setState }); } }),
156
+ React.createElement("button", { onClick: function () { return handleAddMore({ args: args, state: state, setState: setState }); }, style: { padding: ".5rem", width: "fit-content" } }, "Add More"),
157
+ React.createElement("h3", null,
158
+ React.createElement("i", null, "Note: change props and click on add more button"))));
159
+ };
160
+ exports.Toast = Toast;
@@ -9,7 +9,7 @@ var emptyStatesConfig = [
9
9
  "singleCollectionsListing",
10
10
  "profileListing",
11
11
  "notificationEmpty",
12
- "dashboardListing",
12
+ "annoExplorerListing",
13
13
  "successFullyPublish",
14
14
  "draftsListing",
15
15
  "publishedListing",
@@ -27,7 +27,6 @@ var SelectDropdown = function (_a) {
27
27
  value: value,
28
28
  isTagsStyle: false,
29
29
  });
30
- console.log({ selectConfig: selectConfig, value: value });
31
30
  var showElem = function (elem) {
32
31
  if (selectConfig === "all")
33
32
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.215.3",
3
+ "version": "2.216.0",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",