@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.
@@ -0,0 +1,118 @@
1
+ import { jsxs as w, jsx as l } from "react/jsx-runtime";
2
+ import { useEffect as A } from "react";
3
+ import x, { keyframes as I, css as T } from "styled-components";
4
+ import W from "../../assets/line-icons/icons/cross2.js";
5
+ import k from "../ui/text/text.js";
6
+ const C = ({ position: r, verticalDist: o }) => I`
7
+ ${(r === "top-right" || r === "top-left") && `
8
+ 0% {
9
+ top: 0;
10
+ }
11
+ 100% {
12
+ top: ${o}px;
13
+ }
14
+ `};
15
+ ${(r === "bottom-left" || r === "bottom-right") && `
16
+ 0% {
17
+ bottom: 0;
18
+ }
19
+ 100% {
20
+ bottom: ${o}px;
21
+ }
22
+ `};
23
+ `, E = ({ position: r, verticalDist: o, horizontalDist: t }) => T`
24
+ ${r === "top-right" && `
25
+ top: ${o}px;
26
+ right: ${t}px;
27
+ `};
28
+ ${r === "top-left" && `
29
+ top: ${o}px;
30
+ left: ${t}px;
31
+ `};
32
+ ${r === "bottom-left" && `
33
+ bottom: ${o}px;
34
+ left: ${t}px;
35
+ `};
36
+ ${r === "bottom-right" && `
37
+ bottom: ${o}px;
38
+ right: ${t}px;
39
+ `};
40
+ `, e = x.div`
41
+ position: fixed;
42
+ width: 310px;
43
+ padding: ${({ gap: r, gutter: o }) => `${r}px ${o}px`};
44
+ box-shadow: 0px 4px 8px 4px rgba(0, 0, 0, 0.05);
45
+ border-radius: 16px;
46
+ ${E};
47
+ animation: ${C} 0.5s ease-in;
48
+ z-index: 105;
49
+ background: ${({ notificationTheme: r, theme: o }) => {
50
+ var t, p;
51
+ return r === "white" ? (t = o == null ? void 0 : o.colors) == null ? void 0 : t.WHITE : (p = o == null ? void 0 : o.colors) == null ? void 0 : p.BLACK;
52
+ }};
53
+ color: ${({ notificationTheme: r, theme: o }) => {
54
+ var t, p;
55
+ return r === "white" ? (t = o == null ? void 0 : o.colors) == null ? void 0 : t.BLACK : (p = o == null ? void 0 : o.colors) == null ? void 0 : p.WHITE;
56
+ }};
57
+ `, y = x.div`
58
+ width: 48px;
59
+ height: 48px;
60
+ background: ${({ src: r }) => `url(${r})`};
61
+ border-radius: 50%;
62
+ border: 2px solid #ffffff;
63
+ position: absolute;
64
+ bottom: 88%;
65
+ `, B = x.div`
66
+ position: absolute;
67
+ top: -40px;
68
+ right: 12px;
69
+ cursor: pointer;
70
+ `, H = x(k)`
71
+ white-space: pre-wrap;
72
+ `, K = ({
73
+ avatarUrl: r = null,
74
+ Component: o = null,
75
+ componentProps: t = {},
76
+ duration: p = null,
77
+ gap: n = 24,
78
+ gutter: d = 16,
79
+ hideNotification: s = () => null,
80
+ horizontalDist: u = 50,
81
+ notificationTheme: $ = "black",
82
+ position: b = "bottom-right",
83
+ showCloseIcon: g = !1,
84
+ text: f = null,
85
+ verticalDist: i = 60,
86
+ visible: c = !1
87
+ }) => (A(() => {
88
+ if (p && c) {
89
+ const a = setTimeout(() => {
90
+ s();
91
+ }, p * 1e3);
92
+ return () => {
93
+ clearTimeout(a);
94
+ };
95
+ }
96
+ return () => {
97
+ };
98
+ }, [p, s, c]), c ? /* @__PURE__ */ w(
99
+ e,
100
+ {
101
+ gap: n,
102
+ gutter: d,
103
+ horizontalDist: u,
104
+ notificationTheme: $,
105
+ position: b,
106
+ verticalDist: i,
107
+ children: [
108
+ g && /* @__PURE__ */ l(B, { onClick: () => s(), children: /* @__PURE__ */ l(W, { color: $ === "white" ? "WHITE" : "BLACK" }) }),
109
+ r && /* @__PURE__ */ l(y, { src: r }),
110
+ f && /* @__PURE__ */ l(H, { $renderAs: "ub3", $color: $ === "white" ? "BLACK" : "WHITE", children: f }),
111
+ o && /* @__PURE__ */ l(o, { ...t })
112
+ ]
113
+ }
114
+ ) : null), q = K;
115
+ export {
116
+ q as default
117
+ };
118
+ //# sourceMappingURL=notification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.js","sources":["../../../src/features/notification/notification.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport styled, { keyframes, css } from 'styled-components';\n\nimport Cross2Icon from '../../assets/line-icons/icons/cross2';\nimport Text from '../ui/text/text';\n\ntype Position = 'top-right' | 'top-left' | 'bottom-left' | 'bottom-right';\ntype NotificationTheme = 'white' | 'black';\n\ninterface SlideProps {\n position: Position;\n verticalDist: number;\n}\n\ninterface PositionProps {\n position: Position;\n verticalDist: number;\n horizontalDist: number;\n}\n\ninterface WrapperProps extends PositionProps {\n gap: number;\n gutter: number;\n notificationTheme: NotificationTheme;\n}\n\ninterface AvatarWrapperProps {\n src: string;\n}\n\ninterface NotificationProps {\n avatarUrl?: string | null;\n Component?: React.ComponentType<Record<string, unknown>> | null;\n componentProps?: Record<string, unknown>;\n duration?: number | null;\n gap?: number;\n gutter?: number;\n hideNotification?: () => void;\n horizontalDist?: number;\n notificationTheme?: NotificationTheme;\n position?: Position;\n showCloseIcon?: boolean;\n text?: string | null;\n verticalDist?: number;\n visible?: boolean;\n}\n\nconst slide = ({ position, verticalDist }: SlideProps) => 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 }: PositionProps) => 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 Wrapper = styled.div<WrapperProps>`\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;\n background: ${({ notificationTheme, theme }) =>\n notificationTheme === 'white' ? theme?.colors?.WHITE : theme?.colors?.BLACK};\n color: ${({ notificationTheme, theme }) =>\n notificationTheme === 'white' ? theme?.colors?.BLACK : theme?.colors?.WHITE};\n`;\n\nconst AvatarWrapper = styled.div<AvatarWrapperProps>`\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: React.FC<NotificationProps> = ({\n avatarUrl = null,\n Component = null,\n componentProps = {},\n duration = null,\n gap = 24,\n gutter = 16,\n hideNotification = () => null,\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 && (\n <StyledText $renderAs=\"ub3\" $color={notificationTheme === 'white' ? 'BLACK' : 'WHITE'}>\n {text}\n </StyledText>\n )}\n {Component && <Component {...componentProps} />}\n </Wrapper>\n );\n};\n\nexport default Notification;\n"],"names":["slide","position","verticalDist","keyframes","notificationPostion","horizontalDist","css","Wrapper","styled","gap","gutter","notificationTheme","theme","_a","_b","AvatarWrapper","src","StyledIcon","StyledText","Text","Notification","avatarUrl","Component","componentProps","duration","hideNotification","showCloseIcon","text","visible","useEffect","countdown","jsxs","jsx","Cross2Icon","Notification$1"],"mappings":";;;;;AA+CA,MAAMA,IAAQ,CAAC,EAAE,UAAAC,GAAU,cAAAC,QAA+BC;AAAA,KAErDF,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,QAAoCC;AAAA,IACvFL,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,IAAUC,EAAO;AAAA;AAAA;AAAA,aAGV,CAAC,EAAE,KAAAC,GAAK,QAAAC,QAAa,GAAGD,CAAG,MAAMC,CAAM,IAAI;AAAA;AAAA;AAAA,IAGpDN,CAAmB;AAAA,eACRJ,CAAK;AAAA;AAAA,gBAEJ,CAAC,EAAE,mBAAAW,GAAmB,OAAAC,EAAA,MAClC;;AAAA,SAAAD,MAAsB,WAAUE,IAAAD,KAAA,gBAAAA,EAAO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,KAAAE;AAAA,IACA,QAAAC;AAAA,IACA,gBAAAL;AAAA,IACA,mBAAAM;AAAA,IACA,UAAAV;AAAA,IACA,cAAAC;AAAA,IAEC,UAAA;AAAA,MAAAwB,KACE,gBAAAM,EAAAf,GAAA,EAAW,SAAS,MAAMQ,EAAiB,GAC1C,UAAC,gBAAAO,EAAAC,GAAA,EAAW,OAAOtB,MAAsB,UAAU,UAAU,QAAS,CAAA,GACxE;AAAA,MAEDU,KAAa,gBAAAW,EAACjB,GAAc,EAAA,KAAKM,EAAW,CAAA;AAAA,MAC5CM,KACE,gBAAAK,EAAAd,GAAA,EAAW,WAAU,OAAM,QAAQP,MAAsB,UAAU,UAAU,SAC3E,UACHgB,EAAA,CAAA;AAAA,MAEDL,KAAa,gBAAAU,EAACV,GAAW,EAAA,GAAGC,EAAgB,CAAA;AAAA,IAAA;AAAA,EAAA;AAAA,IAtB5B,OA2BvBW,IAAed;"}
package/dist/index.d.ts CHANGED
@@ -4539,24 +4539,28 @@ export declare enum NODE_TYPES {
4539
4539
  'PUZZLE_CARD' = "PUZZLE_CARD"
4540
4540
  }
4541
4541
 
4542
- declare function Notification_2({ avatarUrl, Component, componentProps, duration, gap, gutter, hideNotification, horizontalDist, notificationTheme, position, showCloseIcon, text, verticalDist, visible, }: {
4543
- avatarUrl?: null | undefined;
4544
- Component?: null | undefined;
4545
- componentProps?: {} | undefined;
4546
- duration?: null | undefined;
4547
- gap?: number | undefined;
4548
- gutter?: number | undefined;
4549
- hideNotification: any;
4550
- horizontalDist?: number | undefined;
4551
- notificationTheme?: string | undefined;
4552
- position?: string | undefined;
4553
- showCloseIcon?: boolean | undefined;
4554
- text?: null | undefined;
4555
- verticalDist?: number | undefined;
4556
- visible?: boolean | undefined;
4557
- }): JSX.Element | null;
4542
+ declare const Notification_2: React.FC<NotificationProps>;
4558
4543
  export { Notification_2 as Notification }
4559
4544
 
4545
+ declare interface NotificationProps {
4546
+ avatarUrl?: string | null;
4547
+ Component?: React.ComponentType<Record<string, unknown>> | null;
4548
+ componentProps?: Record<string, unknown>;
4549
+ duration?: number | null;
4550
+ gap?: number;
4551
+ gutter?: number;
4552
+ hideNotification?: () => void;
4553
+ horizontalDist?: number;
4554
+ notificationTheme?: NotificationTheme;
4555
+ position?: Position;
4556
+ showCloseIcon?: boolean;
4557
+ text?: string | null;
4558
+ verticalDist?: number;
4559
+ visible?: boolean;
4560
+ }
4561
+
4562
+ declare type NotificationTheme = 'white' | 'black';
4563
+
4560
4564
  export declare const Nudge: React_2.NamedExoticComponent<INudgeProps>;
4561
4565
 
4562
4566
  export declare const NumRangeInput: React.FC<NumRangeInputProps>;
@@ -4635,6 +4639,8 @@ export declare const PlusIcon: React.FC<React.SVGProps<SVGSVGElement>>;
4635
4639
 
4636
4640
  export declare const PointerIcon: React.FC<React.SVGProps<SVGSVGElement>>;
4637
4641
 
4642
+ declare type Position = 'top-right' | 'top-left' | 'bottom-left' | 'bottom-right';
4643
+
4638
4644
  export declare const PostGameStats: NamedExoticComponent<IPostGameStatsProps & RefAttributes<IPostGameStatsRef>>;
4639
4645
 
4640
4646
  export declare const PracticeIcon: React.FC<React.SVGProps<SVGSVGElement>>;