@cuemath/leap 3.2.17-as2 → 3.2.17-as3
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/features/notification/notification.js +118 -0
- package/dist/features/notification/notification.js.map +1 -0
- package/dist/index.d.ts +22 -16
- package/dist/index.js +402 -402
- package/package.json +1 -1
- package/dist/legacy-comps/notification/notification.js +0 -120
- package/dist/legacy-comps/notification/notification.js.map +0 -1
package/package.json
CHANGED
@@ -1,120 +0,0 @@
|
|
1
|
-
import { jsxs as h, jsx as e } from "react/jsx-runtime";
|
2
|
-
import { useEffect as g } from "react";
|
3
|
-
import p, { keyframes as w, css as l } from "styled-components";
|
4
|
-
import k from "../../assets/line-icons/icons/cross2.js";
|
5
|
-
import T from "../../features/ui/text/text.js";
|
6
|
-
const A = ({ position: o, verticalDist: t }) => w`
|
7
|
-
${(o === "top-right" || o === "top-left") && `
|
8
|
-
0% {
|
9
|
-
top: 0;
|
10
|
-
}
|
11
|
-
100% {
|
12
|
-
top: ${t}px;
|
13
|
-
}
|
14
|
-
`};
|
15
|
-
${(o === "bottom-left" || o === "bottom-right") && `
|
16
|
-
0% {
|
17
|
-
bottom: 0;
|
18
|
-
}
|
19
|
-
100% {
|
20
|
-
bottom: ${t}px;
|
21
|
-
}
|
22
|
-
`};
|
23
|
-
`, I = ({ position: o, verticalDist: t, horizontalDist: r }) => l`
|
24
|
-
${o === "top-right" && `
|
25
|
-
top: ${t}px;
|
26
|
-
right: ${r}px;
|
27
|
-
`};
|
28
|
-
${o === "top-left" && `
|
29
|
-
top: ${t}px;
|
30
|
-
left: ${r}px;
|
31
|
-
`};
|
32
|
-
${o === "bottom-left" && `
|
33
|
-
bottom: ${t}px;
|
34
|
-
left: ${r}px;
|
35
|
-
`};
|
36
|
-
${o === "bottom-right" && `
|
37
|
-
bottom: ${t}px;
|
38
|
-
right: ${r}px;
|
39
|
-
`};
|
40
|
-
`, W = ({ notificationTheme: o, theme: { COLORS: t } }) => l`
|
41
|
-
${o === "white" && `
|
42
|
-
background: ${t.WHITE};
|
43
|
-
color: ${t.COLA};
|
44
|
-
`};
|
45
|
-
${o === "black" && `
|
46
|
-
background: ${t.COLA};
|
47
|
-
color: ${t.WHITE};
|
48
|
-
`};
|
49
|
-
`, y = p.div`
|
50
|
-
${W};
|
51
|
-
position: fixed;
|
52
|
-
width: 310px;
|
53
|
-
padding: ${({ gap: o, gutter: t }) => `${o}px ${t}px`};
|
54
|
-
box-shadow: 0px 4px 8px 4px rgba(0, 0, 0, 0.05);
|
55
|
-
border-radius: 16px;
|
56
|
-
${I};
|
57
|
-
animation: ${A} 0.5s ease-in;
|
58
|
-
z-index: 105; // To keep the notification above the chat window
|
59
|
-
`, E = p.div`
|
60
|
-
width: 48px;
|
61
|
-
height: 48px;
|
62
|
-
background: ${({ src: o }) => `url(${o})`};
|
63
|
-
border-radius: 50%;
|
64
|
-
border: 2px solid #ffffff;
|
65
|
-
position: absolute;
|
66
|
-
bottom: 88%;
|
67
|
-
`, H = p.div`
|
68
|
-
position: absolute;
|
69
|
-
top: -40px;
|
70
|
-
right: 12px;
|
71
|
-
cursor: pointer;
|
72
|
-
`, j = p(T)`
|
73
|
-
white-space: pre-wrap;
|
74
|
-
`, P = ({
|
75
|
-
avatarUrl: o = null,
|
76
|
-
Component: t = null,
|
77
|
-
componentProps: r = {},
|
78
|
-
duration: $ = null,
|
79
|
-
gap: s = 24,
|
80
|
-
gutter: d = 16,
|
81
|
-
hideNotification: n,
|
82
|
-
horizontalDist: m = 50,
|
83
|
-
notificationTheme: c = "black",
|
84
|
-
position: b = "bottom-right",
|
85
|
-
showCloseIcon: u = !1,
|
86
|
-
text: f = null,
|
87
|
-
verticalDist: a = 60,
|
88
|
-
visible: x = !1
|
89
|
-
}) => (g(() => {
|
90
|
-
if ($ && x) {
|
91
|
-
const i = setTimeout(() => {
|
92
|
-
n();
|
93
|
-
}, $ * 1e3);
|
94
|
-
return () => {
|
95
|
-
clearTimeout(i);
|
96
|
-
};
|
97
|
-
}
|
98
|
-
return () => {
|
99
|
-
};
|
100
|
-
}, [$, n, x]), x ? /* @__PURE__ */ h(
|
101
|
-
y,
|
102
|
-
{
|
103
|
-
gap: s,
|
104
|
-
gutter: d,
|
105
|
-
horizontalDist: m,
|
106
|
-
notificationTheme: c,
|
107
|
-
position: b,
|
108
|
-
verticalDist: a,
|
109
|
-
children: [
|
110
|
-
u && /* @__PURE__ */ e(H, { onClick: () => n(), children: /* @__PURE__ */ e(k, { color: c === "white" ? "WHITE" : "BLACK" }) }),
|
111
|
-
o && /* @__PURE__ */ e(E, { src: o }),
|
112
|
-
f && /* @__PURE__ */ e(j, { $renderAs: "ub3", children: f }),
|
113
|
-
t && /* @__PURE__ */ e(t, { ...r })
|
114
|
-
]
|
115
|
-
}
|
116
|
-
) : null), G = P;
|
117
|
-
export {
|
118
|
-
G as default
|
119
|
-
};
|
120
|
-
//# sourceMappingURL=notification.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"notification.js","sources":["../../../src/legacy-comps/notification/notification.jsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport styled, { keyframes, css } from 'styled-components';\n\nimport Cross2Icon from '../../assets/line-icons/icons/cross2';\nimport Text from '../../features/ui/text/text';\n\nconst slide = ({ position, verticalDist }) => keyframes`\n ${\n (position === 'top-right' || position === 'top-left') &&\n `\n 0% {\n top: 0;\n }\n 100% {\n top: ${verticalDist}px;\n }\n `\n };\n ${\n (position === 'bottom-left' || position === 'bottom-right') &&\n `\n 0% {\n bottom: 0;\n }\n 100% {\n bottom: ${verticalDist}px;\n }\n `\n };\n`;\n\nconst notificationPostion = ({ position, verticalDist, horizontalDist }) => css`\n ${position === 'top-right' &&\n `\n top: ${verticalDist}px;\n right: ${horizontalDist}px;\n `};\n ${position === 'top-left' &&\n `\n\ttop: ${verticalDist}px;\n left: ${horizontalDist}px;\n `};\n ${position === 'bottom-left' &&\n `\n bottom: ${verticalDist}px;\n left: ${horizontalDist}px;\n `};\n ${position === 'bottom-right' &&\n `\n bottom: ${verticalDist}px;\n right: ${horizontalDist}px;\n `};\n`;\n\nconst notificationThemeProps = ({ notificationTheme, theme: { COLORS } }) => css`\n ${notificationTheme === 'white' &&\n `\n background: ${COLORS.WHITE};\n color: ${COLORS.COLA};\n `};\n ${notificationTheme === 'black' &&\n `\n background: ${COLORS.COLA};\n color: ${COLORS.WHITE};\n `};\n`;\n\nconst Wrapper = styled.div`\n ${notificationThemeProps};\n position: fixed;\n width: 310px;\n padding: ${({ gap, gutter }) => `${gap}px ${gutter}px`};\n box-shadow: 0px 4px 8px 4px rgba(0, 0, 0, 0.05);\n border-radius: 16px;\n ${notificationPostion};\n animation: ${slide} 0.5s ease-in;\n z-index: 105; // To keep the notification above the chat window\n`;\n\nconst AvatarWrapper = styled.div`\n width: 48px;\n height: 48px;\n background: ${({ src }) => `url(${src})`};\n border-radius: 50%;\n border: 2px solid #ffffff;\n position: absolute;\n bottom: 88%;\n`;\n\nconst StyledIcon = styled.div`\n position: absolute;\n top: -40px;\n right: 12px;\n cursor: pointer;\n`;\n\nconst StyledText = styled(Text)`\n white-space: pre-wrap;\n`;\n\nconst Notification = ({\n avatarUrl = null,\n Component = null,\n componentProps = {},\n duration = null,\n gap = 24,\n gutter = 16,\n hideNotification,\n horizontalDist = 50,\n notificationTheme = 'black',\n position = 'bottom-right',\n showCloseIcon = false,\n text = null,\n verticalDist = 60,\n visible = false,\n}) => {\n useEffect(() => {\n if (duration && visible) {\n const countdown = setTimeout(() => {\n hideNotification();\n }, duration * 1000);\n\n return () => {\n clearTimeout(countdown);\n };\n }\n\n return () => {};\n }, [duration, hideNotification, visible]);\n\n if (!visible) return null;\n\n return (\n <Wrapper\n gap={gap}\n gutter={gutter}\n horizontalDist={horizontalDist}\n notificationTheme={notificationTheme}\n position={position}\n verticalDist={verticalDist}\n >\n {showCloseIcon && (\n <StyledIcon onClick={() => hideNotification()}>\n <Cross2Icon color={notificationTheme === 'white' ? 'WHITE' : 'BLACK'} />\n </StyledIcon>\n )}\n {avatarUrl && <AvatarWrapper src={avatarUrl} />}\n {text && <StyledText $renderAs=\"ub3\">{text}</StyledText>}\n {Component && <Component {...componentProps} />}\n </Wrapper>\n );\n};\n\nexport default Notification;\n"],"names":["slide","position","verticalDist","keyframes","notificationPostion","horizontalDist","css","notificationThemeProps","notificationTheme","COLORS","Wrapper","styled","gap","gutter","AvatarWrapper","src","StyledIcon","StyledText","Text","Notification","avatarUrl","Component","componentProps","duration","hideNotification","showCloseIcon","text","visible","useEffect","countdown","jsxs","jsx","Cross2Icon","Notification$1"],"mappings":";;;;;AAMA,MAAMA,IAAQ,CAAC,EAAE,UAAAC,GAAU,cAAAC,QAAmBC;AAAA,KAEzCF,MAAa,eAAeA,MAAa,eAC1C;AAAA;AAAA;AAAA;AAAA;AAAA,eAKWC,CAAY;AAAA;AAAA,GAGzB;AAAA,KAEGD,MAAa,iBAAiBA,MAAa,mBAC5C;AAAA;AAAA;AAAA;AAAA;AAAA,kBAKcC,CAAY;AAAA;AAAA,GAG5B;AAAA,GAGIE,IAAsB,CAAC,EAAE,UAAAH,GAAU,cAAAC,GAAc,gBAAAG,QAAqBC;AAAA,IACxEL,MAAa,eACf;AAAA,WACSC,CAAY;AAAA,aACVG,CAAc;AAAA,GACxB;AAAA,IACCJ,MAAa,cACf;AAAA,QACMC,CAAY;AAAA,YACRG,CAAc;AAAA,GACvB;AAAA,IACCJ,MAAa,iBACf;AAAA,cACYC,CAAY;AAAA,YACdG,CAAc;AAAA,GACvB;AAAA,IACCJ,MAAa,kBACf;AAAA,cACYC,CAAY;AAAA,aACbG,CAAc;AAAA,GACxB;AAAA,GAGGE,IAAyB,CAAC,EAAE,mBAAAC,GAAmB,OAAO,EAAE,QAAAC,EAAA,EAAe,MAAAH;AAAA,IACzEE,MAAsB,WACxB;AAAA,kBACgBC,EAAO,KAAK;AAAA,aACjBA,EAAO,IAAI;AAAA,GACrB;AAAA,IACCD,MAAsB,WACxB;AAAA,kB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