@cuemath/leap 3.2.25-mb → 3.2.25
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/analytics-events/whitelist-events.js +17 -15
- package/dist/features/analytics-events/whitelist-events.js.map +1 -1
- package/dist/features/auth/comps/pill-button/pill-button.js +41 -38
- package/dist/features/auth/comps/pill-button/pill-button.js.map +1 -1
- package/dist/features/auth/comps/resend-otp/resend-otp.js +18 -14
- package/dist/features/auth/comps/resend-otp/resend-otp.js.map +1 -1
- package/dist/features/auth/comps/selectable-info-card/selectable-info-card.js +32 -26
- package/dist/features/auth/comps/selectable-info-card/selectable-info-card.js.map +1 -1
- package/dist/features/auth/pla-signup/pla-analytics-events.js +23 -0
- package/dist/features/auth/pla-signup/pla-analytics-events.js.map +1 -0
- package/dist/features/auth/pla-signup/signup-options/signup-options.js +42 -35
- package/dist/features/auth/pla-signup/signup-options/signup-options.js.map +1 -1
- package/dist/features/milestone/create/comps/chapters-selection-step/chapter-selection-step-v2/chapters-list.js +68 -53
- package/dist/features/milestone/create/comps/chapters-selection-step/chapter-selection-step-v2/chapters-list.js.map +1 -1
- package/dist/features/notification/notification.js +129 -0
- package/dist/features/notification/notification.js.map +1 -0
- package/dist/features/ui/carousal/carousal-styles.js +45 -0
- package/dist/features/ui/carousal/carousal-styles.js.map +1 -0
- package/dist/features/ui/carousal/carousal.js +76 -0
- package/dist/features/ui/carousal/carousal.js.map +1 -0
- package/dist/features/ui/dot-lottie-animations/dot-lottie-animation.js +75 -88
- package/dist/features/ui/dot-lottie-animations/dot-lottie-animation.js.map +1 -1
- package/dist/features/ui/inputs/base-select-input/base-select-input.js +77 -67
- package/dist/features/ui/inputs/base-select-input/base-select-input.js.map +1 -1
- package/dist/features/ui/lottie-animation/lottie-animation.js +31 -36
- package/dist/features/ui/lottie-animation/lottie-animation.js.map +1 -1
- package/dist/features/ui/modals/modal-styled.js +8 -39
- package/dist/features/ui/modals/modal-styled.js.map +1 -1
- package/dist/features/ui/modals/modal.js +31 -31
- package/dist/features/ui/modals/modal.js.map +1 -1
- package/dist/features/{stickers/sticker-selector/sticker-selector-styles.js → ui/sticker-grid/sticker-grid-styles.js} +31 -21
- package/dist/features/ui/sticker-grid/sticker-grid-styles.js.map +1 -0
- package/dist/features/ui/sticker-grid/sticker-grid.js +24 -0
- package/dist/features/ui/sticker-grid/sticker-grid.js.map +1 -0
- package/dist/features/ui/sticker-grid/sticker.js +57 -0
- package/dist/features/ui/sticker-grid/sticker.js.map +1 -0
- package/dist/features/ui/stickers/constants.js +6 -0
- package/dist/features/ui/stickers/constants.js.map +1 -0
- package/dist/features/{stickers/stickers-effects/effects.js → ui/stickers/stickers-effects.js} +6 -6
- package/dist/features/ui/stickers/stickers-effects.js.map +1 -0
- package/dist/features/{stickers/stickers-effects/stickers-effects-styled.js → ui/stickers/stickers-styled.js} +2 -2
- package/dist/features/ui/stickers/stickers-styled.js.map +1 -0
- package/dist/features/ui/stickers/stickers-utils.js +91 -0
- package/dist/features/ui/stickers/stickers-utils.js.map +1 -0
- package/dist/features/ui/stickers/stickers.js +40 -0
- package/dist/features/ui/stickers/stickers.js.map +1 -0
- package/dist/features/ui/theme/layout.js +3 -3
- package/dist/features/ui/theme/layout.js.map +1 -1
- package/dist/index.d.ts +110 -79
- package/dist/index.js +452 -448
- package/dist/index.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/native.js +7 -0
- package/dist/node_modules/uuid/dist/esm-browser/native.js.map +1 -0
- package/dist/node_modules/uuid/dist/esm-browser/rng.js +3 -2
- package/dist/node_modules/uuid/dist/esm-browser/rng.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js +6 -10
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/v4.js +12 -9
- package/dist/node_modules/uuid/dist/esm-browser/v4.js.map +1 -1
- package/package.json +1 -1
- package/dist/features/stickers/sticker-data.js +0 -234
- package/dist/features/stickers/sticker-data.js.map +0 -1
- package/dist/features/stickers/sticker-selector/sticker-selector-styles.js.map +0 -1
- package/dist/features/stickers/sticker-selector/sticker-selector.js +0 -27
- package/dist/features/stickers/sticker-selector/sticker-selector.js.map +0 -1
- package/dist/features/stickers/sticker-selector/sticker.js +0 -57
- package/dist/features/stickers/sticker-selector/sticker.js.map +0 -1
- package/dist/features/stickers/stickers-effects/effects.js.map +0 -1
- package/dist/features/stickers/stickers-effects/stickers-cache.js +0 -19
- package/dist/features/stickers/stickers-effects/stickers-cache.js.map +0 -1
- package/dist/features/stickers/stickers-effects/stickers-effects-helper.js +0 -86
- package/dist/features/stickers/stickers-effects/stickers-effects-helper.js.map +0 -1
- package/dist/features/stickers/stickers-effects/stickers-effects-styled.js.map +0 -1
- package/dist/features/stickers/stickers-effects/stickers-effects.js +0 -54
- package/dist/features/stickers/stickers-effects/stickers-effects.js.map +0 -1
- package/dist/node_modules/uuid/dist/esm-browser/regex.js +0 -5
- package/dist/node_modules/uuid/dist/esm-browser/regex.js.map +0 -1
- package/dist/node_modules/uuid/dist/esm-browser/validate.js +0 -8
- package/dist/node_modules/uuid/dist/esm-browser/validate.js.map +0 -1
|
@@ -1,93 +1,80 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { DotLottieWorker as v } from "../../../node_modules/@lottiefiles/dotlottie-web/dist/index.js";
|
|
3
|
-
import { memo as w, forwardRef as x, useRef as p, useImperativeHandle as
|
|
4
|
-
import
|
|
5
|
-
import { Canvas as
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var e;
|
|
27
|
-
(e = t.current) == null || e.pause();
|
|
28
|
-
},
|
|
29
|
-
playSegments: (e) => {
|
|
30
|
-
var r, n;
|
|
31
|
-
(r = t.current) == null || r.setSegment(e[0], e[1]), (n = t.current) == null || n.play();
|
|
32
|
-
},
|
|
33
|
-
setFrame: (e) => {
|
|
34
|
-
var r;
|
|
35
|
-
(r = t.current) == null || r.setFrame(e);
|
|
36
|
-
}
|
|
37
|
-
}),
|
|
38
|
-
[]
|
|
39
|
-
), h(() => {
|
|
40
|
-
if (!m.current) return;
|
|
41
|
-
let e = !1;
|
|
42
|
-
return (() => {
|
|
43
|
-
try {
|
|
44
|
-
t.current = new v({
|
|
45
|
-
src: s,
|
|
46
|
-
data: f,
|
|
47
|
-
canvas: m.current,
|
|
48
|
-
autoplay: !0,
|
|
49
|
-
loop: !1,
|
|
50
|
-
renderConfig: {
|
|
51
|
-
autoResize: !0,
|
|
52
|
-
devicePixelRatio: window.devicePixelRatio,
|
|
53
|
-
freezeOnOffscreen: !0
|
|
54
|
-
},
|
|
55
|
-
...l
|
|
56
|
-
}), requestAnimationFrame(() => {
|
|
57
|
-
e || u == null || u();
|
|
58
|
-
});
|
|
59
|
-
} catch (n) {
|
|
60
|
-
console.log(n), c == null || c();
|
|
61
|
-
}
|
|
62
|
-
})(), () => {
|
|
63
|
-
e = !0, t.current && (t.current.destroy(), t.current = null);
|
|
64
|
-
};
|
|
65
|
-
}, [s, l, u, c, f]), h(() => (o == null || o.forEach(
|
|
66
|
-
({ name: e, callback: r }) => {
|
|
67
|
-
var n;
|
|
68
|
-
return (n = t.current) == null ? void 0 : n.addEventListener(e, r);
|
|
69
|
-
}
|
|
70
|
-
), () => {
|
|
71
|
-
o == null || o.forEach(
|
|
72
|
-
({ name: e, callback: r }) => {
|
|
73
|
-
var n;
|
|
74
|
-
return (n = t.current) == null ? void 0 : n.removeEventListener(e, r);
|
|
75
|
-
}
|
|
76
|
-
);
|
|
77
|
-
}), [o]), /* @__PURE__ */ d(R, { $width: i, $height: a, children: /* @__PURE__ */ d(
|
|
78
|
-
$,
|
|
79
|
-
{
|
|
80
|
-
ref: m,
|
|
81
|
-
$renderWidth: i,
|
|
82
|
-
$renderHeight: a,
|
|
83
|
-
width: typeof i == "number" ? i : void 0,
|
|
84
|
-
height: typeof a == "number" ? a : void 0
|
|
3
|
+
import { memo as w, forwardRef as x, useRef as p, useImperativeHandle as R, useEffect as h } from "react";
|
|
4
|
+
import E from "../layout/flex-view.js";
|
|
5
|
+
import { Canvas as H } from "./dot-lottie-animation-styled.js";
|
|
6
|
+
const N = x((y, g) => {
|
|
7
|
+
const {
|
|
8
|
+
src: m,
|
|
9
|
+
width: i = "100%",
|
|
10
|
+
height: a = "100%",
|
|
11
|
+
settings: f,
|
|
12
|
+
eventListeners: r,
|
|
13
|
+
onRender: u,
|
|
14
|
+
onError: c
|
|
15
|
+
} = y, s = p(null), t = p(null);
|
|
16
|
+
return R(
|
|
17
|
+
g,
|
|
18
|
+
() => ({
|
|
19
|
+
playSegments: (e) => {
|
|
20
|
+
var n, o;
|
|
21
|
+
(n = t.current) == null || n.setSegment(e[0], e[1]), (o = t.current) == null || o.play();
|
|
22
|
+
},
|
|
23
|
+
play: () => {
|
|
24
|
+
var e;
|
|
25
|
+
(e = t.current) == null || e.play();
|
|
85
26
|
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
27
|
+
pause: () => {
|
|
28
|
+
var e;
|
|
29
|
+
(e = t.current) == null || e.pause();
|
|
30
|
+
}
|
|
31
|
+
}),
|
|
32
|
+
[]
|
|
33
|
+
), h(() => {
|
|
34
|
+
if (s.current)
|
|
35
|
+
try {
|
|
36
|
+
t.current = new v({
|
|
37
|
+
src: m,
|
|
38
|
+
canvas: s.current,
|
|
39
|
+
autoplay: !0,
|
|
40
|
+
loop: !1,
|
|
41
|
+
renderConfig: {
|
|
42
|
+
autoResize: !0,
|
|
43
|
+
devicePixelRatio: window.devicePixelRatio,
|
|
44
|
+
freezeOnOffscreen: !0
|
|
45
|
+
},
|
|
46
|
+
...f
|
|
47
|
+
}), requestAnimationFrame(() => {
|
|
48
|
+
u == null || u();
|
|
49
|
+
});
|
|
50
|
+
} catch (e) {
|
|
51
|
+
console.log(e), c == null || c();
|
|
52
|
+
}
|
|
53
|
+
}, [m, f, u, c]), h(() => (r == null || r.forEach(
|
|
54
|
+
({ name: e, callback: n }) => {
|
|
55
|
+
var o;
|
|
56
|
+
return (o = t.current) == null ? void 0 : o.addEventListener(e, n);
|
|
57
|
+
}
|
|
58
|
+
), () => {
|
|
59
|
+
var e;
|
|
60
|
+
r == null || r.forEach(
|
|
61
|
+
({ name: n, callback: o }) => {
|
|
62
|
+
var d;
|
|
63
|
+
return (d = t.current) == null ? void 0 : d.removeEventListener(n, o);
|
|
64
|
+
}
|
|
65
|
+
), (e = t.current) == null || e.destroy();
|
|
66
|
+
}), [r]), /* @__PURE__ */ l(E, { $width: i, $height: a, children: /* @__PURE__ */ l(
|
|
67
|
+
H,
|
|
68
|
+
{
|
|
69
|
+
ref: s,
|
|
70
|
+
$renderWidth: i,
|
|
71
|
+
$renderHeight: a,
|
|
72
|
+
width: typeof i == "number" ? i : void 0,
|
|
73
|
+
height: typeof a == "number" ? a : void 0
|
|
74
|
+
}
|
|
75
|
+
) });
|
|
76
|
+
}), F = w(N);
|
|
90
77
|
export {
|
|
91
|
-
|
|
78
|
+
F as default
|
|
92
79
|
};
|
|
93
80
|
//# sourceMappingURL=dot-lottie-animation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dot-lottie-animation.js","sources":["../../../../src/features/ui/dot-lottie-animations/dot-lottie-animation.tsx"],"sourcesContent":["import type {\n AnimationSegment,\n
|
|
1
|
+
{"version":3,"file":"dot-lottie-animation.js","sources":["../../../../src/features/ui/dot-lottie-animations/dot-lottie-animation.tsx"],"sourcesContent":["import type {\n AnimationSegment,\n ILottieAnimationProps,\n ILottieAnimationRef,\n} from './dot-lottie-types';\n\nimport { DotLottieWorker } from '@lottiefiles/dotlottie-web';\nimport { forwardRef, memo, useEffect, useImperativeHandle, useRef } from 'react';\n\nimport FlexView from '../layout/flex-view';\nimport * as Styled from './dot-lottie-animation-styled';\n\nconst DotLottieAnimation = forwardRef<ILottieAnimationRef, ILottieAnimationProps>((props, ref) => {\n const {\n src,\n width = '100%',\n height = '100%',\n settings,\n eventListeners,\n onRender,\n onError,\n } = props;\n\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const animationInstance = useRef<DotLottieWorker | null>(null);\n\n useImperativeHandle(\n ref,\n () => ({\n playSegments: (segments: AnimationSegment) => {\n animationInstance.current?.setSegment(segments[0], segments[1]);\n animationInstance.current?.play();\n },\n play: () => {\n animationInstance.current?.play();\n },\n pause: () => {\n animationInstance.current?.pause();\n },\n }),\n [],\n );\n\n useEffect(() => {\n if (!canvasRef.current) return;\n\n try {\n animationInstance.current = new DotLottieWorker({\n src,\n canvas: canvasRef.current,\n autoplay: true,\n loop: false,\n renderConfig: {\n autoResize: true,\n devicePixelRatio: window.devicePixelRatio,\n freezeOnOffscreen: true,\n },\n ...settings,\n });\n\n requestAnimationFrame(() => {\n onRender?.();\n });\n } catch (err) {\n // eslint-disable-next-line no-console\n console.log(err);\n onError?.();\n }\n }, [src, settings, onRender, onError]);\n\n useEffect(() => {\n eventListeners?.forEach(\n ({ name, callback }) => animationInstance.current?.addEventListener(name, callback),\n );\n\n return () => {\n eventListeners?.forEach(\n ({ name, callback }) => animationInstance.current?.removeEventListener(name, callback),\n );\n animationInstance.current?.destroy();\n };\n }, [eventListeners]);\n\n const isNumW = typeof width === 'number';\n const isNumH = typeof height === 'number';\n\n return (\n <FlexView $width={width} $height={height}>\n <Styled.Canvas\n ref={canvasRef}\n $renderWidth={width}\n $renderHeight={height}\n width={isNumW ? width : undefined}\n height={isNumH ? height : undefined}\n />\n </FlexView>\n );\n});\n\nexport default memo(DotLottieAnimation);\n"],"names":["DotLottieAnimation","forwardRef","props","ref","src","width","height","settings","eventListeners","onRender","onError","canvasRef","useRef","animationInstance","useImperativeHandle","segments","_a","_b","useEffect","DotLottieWorker","err","name","callback","jsx","FlexView","Styled.Canvas","dotLottieAnimation","memo"],"mappings":";;;;;AAYA,MAAMA,IAAqBC,EAAuD,CAACC,GAAOC,MAAQ;AAC1F,QAAA;AAAA,IACJ,KAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,QAAAC,IAAS;AAAA,IACT,UAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,EACE,IAAAR,GAEES,IAAYC,EAA0B,IAAI,GAC1CC,IAAoBD,EAA+B,IAAI;AAE7D,SAAAE;AAAA,IACEX;AAAA,IACA,OAAO;AAAA,MACL,cAAc,CAACY,MAA+B;;AAC5C,SAAAC,IAAAH,EAAkB,YAAlB,QAAAG,EAA2B,WAAWD,EAAS,CAAC,GAAGA,EAAS,CAAC,KAC7DE,IAAAJ,EAAkB,YAAlB,QAAAI,EAA2B;AAAA,MAC7B;AAAA,MACA,MAAM,MAAM;;AACV,SAAAD,IAAAH,EAAkB,YAAlB,QAAAG,EAA2B;AAAA,MAC7B;AAAA,MACA,OAAO,MAAM;;AACX,SAAAA,IAAAH,EAAkB,YAAlB,QAAAG,EAA2B;AAAA,MAC7B;AAAA,IAAA;AAAA,IAEF,CAAC;AAAA,EAAA,GAGHE,EAAU,MAAM;AACV,QAACP,EAAU;AAEX,UAAA;AACgB,QAAAE,EAAA,UAAU,IAAIM,EAAgB;AAAA,UAC9C,KAAAf;AAAA,UACA,QAAQO,EAAU;AAAA,UAClB,UAAU;AAAA,UACV,MAAM;AAAA,UACN,cAAc;AAAA,YACZ,YAAY;AAAA,YACZ,kBAAkB,OAAO;AAAA,YACzB,mBAAmB;AAAA,UACrB;AAAA,UACA,GAAGJ;AAAA,QAAA,CACJ,GAED,sBAAsB,MAAM;AACf,UAAAE,KAAA,QAAAA;AAAA,QAAA,CACZ;AAAA,eACMW,GAAK;AAEZ,gBAAQ,IAAIA,CAAG,GACLV,KAAA,QAAAA;AAAA,MACZ;AAAA,KACC,CAACN,GAAKG,GAAUE,GAAUC,CAAO,CAAC,GAErCQ,EAAU,OACQV,KAAA,QAAAA,EAAA;AAAA,IACd,CAAC,EAAE,MAAAa,GAAM,UAAAC,QAAe;;AAAA,cAAAN,IAAAH,EAAkB,YAAlB,gBAAAG,EAA2B,iBAAiBK,GAAMC;AAAA;AAAA,KAGrE,MAAM;;AACK,IAAAd,KAAA,QAAAA,EAAA;AAAA,MACd,CAAC,EAAE,MAAAa,GAAM,UAAAC,QAAe;;AAAA,gBAAAN,IAAAH,EAAkB,YAAlB,gBAAAG,EAA2B,oBAAoBK,GAAMC;AAAA;AAAA,QAE/EN,IAAAH,EAAkB,YAAlB,QAAAG,EAA2B;AAAA,EAAQ,IAEpC,CAACR,CAAc,CAAC,GAMhB,gBAAAe,EAAAC,GAAA,EAAS,QAAQnB,GAAO,SAASC,GAChC,UAAA,gBAAAiB;AAAA,IAACE;AAAAA,IAAA;AAAA,MACC,KAAKd;AAAA,MACL,cAAcN;AAAA,MACd,eAAeC;AAAA,MACf,OATS,OAAOD,KAAU,WASVA,IAAQ;AAAA,MACxB,QATS,OAAOC,KAAW,WASVA,IAAS;AAAA,IAAA;AAAA,EAE9B,EAAA,CAAA;AAEJ,CAAC,GAEcoB,IAAAC,EAAK3B,CAAkB;"}
|
|
@@ -1,114 +1,124 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { Input as
|
|
7
|
-
import { Container as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
const
|
|
1
|
+
import { jsxs as V, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as G, useRef as A, useCallback as d } from "react";
|
|
3
|
+
import J from "../../../../assets/line-icons/icons/cross.js";
|
|
4
|
+
import K from "../../hooks/use-context-menu-click-handler.js";
|
|
5
|
+
import N from "../base-input/base-input.js";
|
|
6
|
+
import { Input as P } from "../text-input/text-input-styled.js";
|
|
7
|
+
import { Container as Q, OptionsContainer as U, OptionsWrapper as Y, StyledChevronDownIcon as Z, StyledDownIcon as _ } from "./base-select-input-styled.js";
|
|
8
|
+
import ee from "./select-option/select-option.js";
|
|
9
|
+
import ne from "./select-section/select-section.js";
|
|
10
|
+
const he = (E) => {
|
|
11
11
|
const {
|
|
12
|
-
label:
|
|
13
|
-
value:
|
|
12
|
+
label: b,
|
|
13
|
+
value: i,
|
|
14
14
|
options: u,
|
|
15
15
|
searchable: n = !1,
|
|
16
16
|
searchText: g,
|
|
17
|
-
onCloseWithoutSelection:
|
|
18
|
-
onSearchTextChange:
|
|
19
|
-
onChange:
|
|
17
|
+
onCloseWithoutSelection: L,
|
|
18
|
+
onSearchTextChange: r,
|
|
19
|
+
onChange: v,
|
|
20
20
|
renderAs: h,
|
|
21
|
-
width:
|
|
22
|
-
widthX:
|
|
21
|
+
width: R,
|
|
22
|
+
widthX: j,
|
|
23
23
|
disabled: p,
|
|
24
|
-
willShowMessage:
|
|
25
|
-
mandatory:
|
|
26
|
-
size:
|
|
24
|
+
willShowMessage: z,
|
|
25
|
+
mandatory: B,
|
|
26
|
+
size: w = "regular",
|
|
27
27
|
shape: m,
|
|
28
28
|
theme: f = "light",
|
|
29
|
-
isTransparent:
|
|
29
|
+
isTransparent: S = !1,
|
|
30
30
|
renderOptionsAs: $ = "list",
|
|
31
|
-
errorMessage:
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
errorMessage: D,
|
|
32
|
+
inputLabelOverrides: C
|
|
33
|
+
} = E, s = $ === "section-list" && u, l = $ === "list" && u, I = G(() => {
|
|
34
|
+
var e;
|
|
34
35
|
if (n) return g;
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
if (s) {
|
|
37
|
+
let o, a;
|
|
38
|
+
for (const T of s) {
|
|
39
|
+
const y = T.data.find(({ id: q }) => q === i);
|
|
40
|
+
if (y) {
|
|
41
|
+
o = T, a = y;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return o && C ? C(o, a) : (a == null ? void 0 : a.label) || "";
|
|
46
|
+
}
|
|
47
|
+
if (l) return (e = l.find((o) => o.id === i)) == null ? void 0 : e.label;
|
|
48
|
+
}, [n, g, s, l, C, i]), k = A(null), x = A(null), { menuVisible: c, onMenuClick: F, hideMenu: O } = K(
|
|
49
|
+
k,
|
|
40
50
|
void 0,
|
|
41
51
|
!n,
|
|
42
|
-
|
|
52
|
+
L,
|
|
43
53
|
p
|
|
44
|
-
),
|
|
54
|
+
), W = d(
|
|
45
55
|
(e) => {
|
|
46
|
-
n &&
|
|
56
|
+
n && r && r(e.target.value);
|
|
47
57
|
},
|
|
48
|
-
[
|
|
49
|
-
),
|
|
50
|
-
(e,
|
|
51
|
-
|
|
58
|
+
[r, n]
|
|
59
|
+
), M = d(
|
|
60
|
+
(e, o) => {
|
|
61
|
+
O(), v(e, o);
|
|
52
62
|
},
|
|
53
|
-
[
|
|
54
|
-
),
|
|
63
|
+
[O, v]
|
|
64
|
+
), X = d((e) => {
|
|
55
65
|
e.target.select(), setTimeout(() => {
|
|
56
66
|
e.target.scrollIntoView({
|
|
57
67
|
behavior: "smooth"
|
|
58
68
|
});
|
|
59
69
|
}, 300);
|
|
60
|
-
}, []),
|
|
70
|
+
}, []), H = d(() => {
|
|
61
71
|
var e;
|
|
62
|
-
|
|
63
|
-
}, [
|
|
64
|
-
return /* @__PURE__ */
|
|
72
|
+
r && (r(""), (e = x.current) == null || e.focus());
|
|
73
|
+
}, [r]);
|
|
74
|
+
return /* @__PURE__ */ V(Q, { ref: k, $width: R, $widthX: j, onClick: F, children: [
|
|
65
75
|
/* @__PURE__ */ t(
|
|
66
|
-
|
|
76
|
+
N,
|
|
67
77
|
{
|
|
68
78
|
renderAs: h,
|
|
69
|
-
label:
|
|
79
|
+
label: b,
|
|
70
80
|
stickyLabel: !0,
|
|
71
81
|
disabled: p,
|
|
72
|
-
willShowMessage:
|
|
73
|
-
size:
|
|
74
|
-
mandatory:
|
|
82
|
+
willShowMessage: z,
|
|
83
|
+
size: w,
|
|
84
|
+
mandatory: B,
|
|
75
85
|
shape: m,
|
|
76
|
-
isTransparent:
|
|
86
|
+
isTransparent: S,
|
|
77
87
|
inputElement: /* @__PURE__ */ t(
|
|
78
|
-
|
|
88
|
+
P,
|
|
79
89
|
{
|
|
80
90
|
ref: x,
|
|
81
91
|
$renderAs: h,
|
|
82
|
-
$size:
|
|
83
|
-
placeholder: I ? "" :
|
|
92
|
+
$size: w,
|
|
93
|
+
placeholder: I ? "" : b,
|
|
84
94
|
disabled: p,
|
|
85
95
|
readOnly: !n,
|
|
86
96
|
value: I ?? "",
|
|
87
|
-
onFocus: n ?
|
|
88
|
-
onChange: n ?
|
|
89
|
-
$isTransparent:
|
|
97
|
+
onFocus: n ? X : void 0,
|
|
98
|
+
onChange: n ? W : void 0,
|
|
99
|
+
$isTransparent: S
|
|
90
100
|
}
|
|
91
101
|
),
|
|
92
|
-
siblingElement: n &&
|
|
93
|
-
errorMessage:
|
|
102
|
+
siblingElement: n && c ? /* @__PURE__ */ t(J, { onClick: H }) : m === "curved" || m === "borderLess" ? /* @__PURE__ */ t(Z, { $menuVisible: c, pointerEvents: "none" }) : /* @__PURE__ */ t(_, { $menuVisible: c, pointerEvents: "none" }),
|
|
103
|
+
errorMessage: D
|
|
94
104
|
}
|
|
95
105
|
),
|
|
96
|
-
u.length > 0 && /* @__PURE__ */ t(
|
|
97
|
-
|
|
98
|
-
|
|
106
|
+
u.length > 0 && /* @__PURE__ */ t(U, { $visible: c, children: /* @__PURE__ */ V(Y, { $renderAs: h, $theme: f, children: [
|
|
107
|
+
s && /* @__PURE__ */ t(
|
|
108
|
+
ne,
|
|
99
109
|
{
|
|
100
|
-
sectionOptions:
|
|
110
|
+
sectionOptions: s,
|
|
101
111
|
theme: f,
|
|
102
|
-
value:
|
|
103
|
-
onChange:
|
|
112
|
+
value: i,
|
|
113
|
+
onChange: M
|
|
104
114
|
}
|
|
105
115
|
),
|
|
106
|
-
|
|
107
|
-
|
|
116
|
+
l && l.map((e) => /* @__PURE__ */ t(
|
|
117
|
+
ee,
|
|
108
118
|
{
|
|
109
119
|
option: e,
|
|
110
|
-
selected: e.id ===
|
|
111
|
-
onChange:
|
|
120
|
+
selected: e.id === i,
|
|
121
|
+
onChange: M,
|
|
112
122
|
theme: f
|
|
113
123
|
},
|
|
114
124
|
e.id
|
|
@@ -117,6 +127,6 @@ const ae = (y) => {
|
|
|
117
127
|
] });
|
|
118
128
|
};
|
|
119
129
|
export {
|
|
120
|
-
|
|
130
|
+
he as default
|
|
121
131
|
};
|
|
122
132
|
//# sourceMappingURL=base-select-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-select-input.js","sources":["../../../../../src/features/ui/inputs/base-select-input/base-select-input.tsx"],"sourcesContent":["import type { ISectionOption } from '../../section-list/section-list-types';\nimport type { IBaseSelectInputProps, ISelectOption } from './base-select-input-types';\nimport type { ChangeEvent, FocusEvent, ReactElement } from 'react';\n\nimport { useCallback, useMemo, useRef } from 'react';\n\nimport CrossIcon from '../../../../assets/line-icons/icons/cross';\nimport useContextMenuClickHandler from '../../hooks/use-context-menu-click-handler';\nimport BaseInput from '../base-input/base-input';\nimport { Input } from '../text-input/text-input-styled';\nimport * as Styled from './base-select-input-styled';\nimport SelectOption from './select-option/select-option';\nimport SelectSection from './select-section/select-section';\n\nconst BaseSelectInput = <IDType extends string | number>(\n props: IBaseSelectInputProps<IDType>,\n): ReactElement => {\n const {\n label,\n value,\n options,\n searchable = false,\n searchText,\n onCloseWithoutSelection,\n onSearchTextChange,\n onChange,\n renderAs,\n width,\n widthX,\n disabled,\n willShowMessage,\n mandatory,\n size = 'regular',\n shape,\n theme = 'light',\n isTransparent = false,\n renderOptionsAs = 'list',\n errorMessage,\n } = props;\n\n const sectionOptions =\n renderOptionsAs === 'section-list' && (options as ISectionOption<ISelectOption<IDType>>[]);\n const selectOptions = renderOptionsAs === 'list' && (options as ISelectOption<IDType>[]);\n\n const inputValue = useMemo(() => {\n if (searchable) return searchText;\n\n if (sectionOptions) {\n
|
|
1
|
+
{"version":3,"file":"base-select-input.js","sources":["../../../../../src/features/ui/inputs/base-select-input/base-select-input.tsx"],"sourcesContent":["import type { ISectionOption } from '../../section-list/section-list-types';\nimport type { IBaseSelectInputProps, ISelectOption } from './base-select-input-types';\nimport type { ChangeEvent, FocusEvent, ReactElement } from 'react';\n\nimport { useCallback, useMemo, useRef } from 'react';\n\nimport CrossIcon from '../../../../assets/line-icons/icons/cross';\nimport useContextMenuClickHandler from '../../hooks/use-context-menu-click-handler';\nimport BaseInput from '../base-input/base-input';\nimport { Input } from '../text-input/text-input-styled';\nimport * as Styled from './base-select-input-styled';\nimport SelectOption from './select-option/select-option';\nimport SelectSection from './select-section/select-section';\n\nconst BaseSelectInput = <IDType extends string | number>(\n props: IBaseSelectInputProps<IDType>,\n): ReactElement => {\n const {\n label,\n value,\n options,\n searchable = false,\n searchText,\n onCloseWithoutSelection,\n onSearchTextChange,\n onChange,\n renderAs,\n width,\n widthX,\n disabled,\n willShowMessage,\n mandatory,\n size = 'regular',\n shape,\n theme = 'light',\n isTransparent = false,\n renderOptionsAs = 'list',\n errorMessage,\n inputLabelOverrides,\n } = props;\n\n const sectionOptions =\n renderOptionsAs === 'section-list' && (options as ISectionOption<ISelectOption<IDType>>[]);\n const selectOptions = renderOptionsAs === 'list' && (options as ISelectOption<IDType>[]);\n\n const inputValue = useMemo(() => {\n if (searchable) return searchText;\n\n if (sectionOptions) {\n let foundSection, foundOption;\n\n for (const section of sectionOptions) {\n const option = section.data.find(({ id }) => id === value);\n\n if (option) {\n foundSection = section;\n foundOption = option;\n\n break;\n }\n }\n\n if (foundSection && inputLabelOverrides)\n return inputLabelOverrides(foundSection, foundOption);\n\n return foundOption?.label || '';\n }\n\n if (selectOptions) return selectOptions.find(option => option.id === value)?.label;\n }, [searchable, searchText, sectionOptions, selectOptions, inputLabelOverrides, value]);\n\n const containerRef = useRef<HTMLDivElement>(null) as React.RefObject<HTMLDivElement>;\n const inputRef = useRef<HTMLInputElement>(null) as React.RefObject<HTMLInputElement>;\n const { menuVisible, onMenuClick, hideMenu } = useContextMenuClickHandler(\n containerRef,\n undefined,\n !searchable,\n onCloseWithoutSelection,\n disabled,\n );\n\n const handleTextChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n if (searchable && onSearchTextChange) {\n onSearchTextChange(e.target.value);\n }\n },\n [onSearchTextChange, searchable],\n );\n\n const handleChange = useCallback<IBaseSelectInputProps<IDType>['onChange']>(\n (id, option) => {\n hideMenu();\n onChange(id, option);\n },\n [hideMenu, onChange],\n );\n\n const handleFocus = useCallback((e: FocusEvent<HTMLInputElement>) => {\n e.target.select();\n setTimeout(() => {\n e.target.scrollIntoView({\n behavior: 'smooth',\n });\n }, 300);\n }, []);\n\n const handleClear = useCallback(() => {\n if (onSearchTextChange) {\n onSearchTextChange('');\n inputRef.current?.focus();\n }\n }, [onSearchTextChange]);\n\n const downIcon =\n shape === 'curved' || shape === 'borderLess' ? (\n <Styled.StyledChevronDownIcon $menuVisible={menuVisible} pointerEvents=\"none\" />\n ) : (\n <Styled.StyledDownIcon $menuVisible={menuVisible} pointerEvents=\"none\" />\n );\n\n return (\n <Styled.Container ref={containerRef} $width={width} $widthX={widthX} onClick={onMenuClick}>\n <BaseInput\n renderAs={renderAs}\n label={label}\n stickyLabel={true}\n disabled={disabled}\n willShowMessage={willShowMessage}\n size={size}\n mandatory={mandatory}\n shape={shape}\n isTransparent={isTransparent}\n inputElement={\n <Input\n ref={inputRef}\n $renderAs={renderAs}\n $size={size}\n placeholder={inputValue ? '' : label}\n disabled={disabled}\n readOnly={!searchable}\n value={inputValue ?? ''}\n onFocus={searchable ? handleFocus : undefined}\n onChange={searchable ? handleTextChange : undefined}\n $isTransparent={isTransparent}\n />\n }\n siblingElement={searchable && menuVisible ? <CrossIcon onClick={handleClear} /> : downIcon}\n errorMessage={errorMessage}\n />\n\n {options.length > 0 && (\n <Styled.OptionsContainer $visible={menuVisible}>\n <Styled.OptionsWrapper $renderAs={renderAs} $theme={theme}>\n {sectionOptions && (\n <SelectSection<IDType>\n sectionOptions={sectionOptions}\n theme={theme}\n value={value}\n onChange={handleChange}\n />\n )}\n\n {selectOptions &&\n selectOptions.map(option => (\n <SelectOption<IDType>\n key={option.id}\n option={option}\n selected={option.id === value}\n onChange={handleChange}\n theme={theme}\n />\n ))}\n </Styled.OptionsWrapper>\n </Styled.OptionsContainer>\n )}\n </Styled.Container>\n );\n};\n\nexport default BaseSelectInput;\n"],"names":["BaseSelectInput","props","label","value","options","searchable","searchText","onCloseWithoutSelection","onSearchTextChange","onChange","renderAs","width","widthX","disabled","willShowMessage","mandatory","size","shape","theme","isTransparent","renderOptionsAs","errorMessage","inputLabelOverrides","sectionOptions","selectOptions","inputValue","useMemo","foundSection","foundOption","section","option","id","_a","containerRef","useRef","inputRef","menuVisible","onMenuClick","hideMenu","useContextMenuClickHandler","handleTextChange","useCallback","handleChange","handleFocus","handleClear","jsxs","Styled.Container","jsx","BaseInput","Input","CrossIcon","Styled.StyledChevronDownIcon","Styled.StyledDownIcon","Styled.OptionsContainer","Styled.OptionsWrapper","SelectSection","SelectOption"],"mappings":";;;;;;;;;AAcM,MAAAA,KAAkB,CACtBC,MACiB;AACX,QAAA;AAAA,IACJ,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,SAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,YAAAC;AAAA,IACA,yBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,OAAAC;AAAA,IACA,OAAA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;AAAA,IACF;AAAA,IAECjB,EAAQ,SAAS,KACf,gBAAA2C,EAAAM,GAAA,EAAwB,UAAUjB,GACjC,UAAA,gBAAAS,EAACS,GAAA,EAAsB,WAAW5C,GAAU,QAAQQ,GACjD,UAAA;AAAA,MACCK,KAAA,gBAAAwB;AAAA,QAACQ;AAAA,QAAA;AAAA,UACC,gBAAAhC;AAAA,UACA,OAAAL;AAAA,UACA,OAAAf;AAAA,UACA,UAAUuC;AAAA,QAAA;AAAA,MACZ;AAAA,MAGDlB,KACCA,EAAc,IAAI,CAChBM,MAAA,gBAAAiB;AAAA,QAACS;AAAA,QAAA;AAAA,UAEC,QAAA1B;AAAA,UACA,UAAUA,EAAO,OAAO3B;AAAA,UACxB,UAAUuC;AAAA,UACV,OAAAxB;AAAA,QAAA;AAAA,QAJKY,EAAO;AAAA,MAAA,CAMf;AAAA,IAAA,EAAA,CACL,EACF,CAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
|
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { memo as w, forwardRef as
|
|
1
|
+
import { jsx as E } from "react/jsx-runtime";
|
|
2
|
+
import g from "lottie-web";
|
|
3
|
+
import { memo as w, forwardRef as A, useRef as u, useImperativeHandle as b, useEffect as I } from "react";
|
|
4
4
|
import $ from "../layout/flex-view.js";
|
|
5
5
|
import { fetchLottie as x } from "./helper.js";
|
|
6
|
-
const O =
|
|
6
|
+
const O = A((v, L) => {
|
|
7
7
|
const {
|
|
8
|
-
src:
|
|
9
|
-
width:
|
|
8
|
+
src: m,
|
|
9
|
+
width: h = "100%",
|
|
10
10
|
height: y = "100%",
|
|
11
|
-
settings:
|
|
12
|
-
eventListener:
|
|
13
|
-
onRender:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
h,
|
|
11
|
+
settings: l,
|
|
12
|
+
eventListener: n,
|
|
13
|
+
onRender: o,
|
|
14
|
+
animateOnIntersect: c
|
|
15
|
+
} = v, a = u(null), r = u(null), s = u(null);
|
|
16
|
+
return b(
|
|
17
|
+
L,
|
|
19
18
|
() => ({
|
|
20
|
-
playSegments: (t,
|
|
19
|
+
playSegments: (t, i) => {
|
|
21
20
|
var e;
|
|
22
|
-
return (e = r.current) == null ? void 0 : e.playSegments(t,
|
|
21
|
+
return (e = r.current) == null ? void 0 : e.playSegments(t, i);
|
|
23
22
|
},
|
|
24
|
-
addEventListener: (t,
|
|
23
|
+
addEventListener: (t, i) => {
|
|
25
24
|
var e;
|
|
26
|
-
return (e = r.current) == null ? void 0 : e.addEventListener(t,
|
|
25
|
+
return (e = r.current) == null ? void 0 : e.addEventListener(t, i);
|
|
27
26
|
},
|
|
28
|
-
removeEventListener: (t,
|
|
27
|
+
removeEventListener: (t, i) => {
|
|
29
28
|
var e;
|
|
30
|
-
return (e = r.current) == null ? void 0 : e.removeEventListener(t,
|
|
29
|
+
return (e = r.current) == null ? void 0 : e.removeEventListener(t, i);
|
|
31
30
|
},
|
|
32
31
|
play: () => {
|
|
33
32
|
var t;
|
|
@@ -36,41 +35,37 @@ const O = b((L, h) => {
|
|
|
36
35
|
stop: () => {
|
|
37
36
|
var t;
|
|
38
37
|
return (t = r.current) == null ? void 0 : t.stop();
|
|
39
|
-
},
|
|
40
|
-
goToAndStop: (t, n) => {
|
|
41
|
-
var e;
|
|
42
|
-
return (e = r.current) == null ? void 0 : e.goToAndStop(t, n);
|
|
43
38
|
}
|
|
44
39
|
}),
|
|
45
40
|
[]
|
|
46
|
-
),
|
|
41
|
+
), I(() => {
|
|
47
42
|
let t = !1;
|
|
48
43
|
return (async () => {
|
|
49
44
|
try {
|
|
50
|
-
const e = await x(
|
|
45
|
+
const e = await x(m);
|
|
51
46
|
requestAnimationFrame(() => {
|
|
52
|
-
!
|
|
53
|
-
container:
|
|
47
|
+
!a.current || t || (r.current = g.loadAnimation({
|
|
48
|
+
container: a.current,
|
|
54
49
|
animationData: e,
|
|
55
50
|
loop: !0,
|
|
56
51
|
autoplay: !0,
|
|
57
|
-
...
|
|
58
|
-
}),
|
|
52
|
+
...l
|
|
53
|
+
}), c && (s.current = new IntersectionObserver(
|
|
59
54
|
([f]) => {
|
|
60
|
-
var
|
|
61
|
-
f && f.isIntersecting ? (
|
|
55
|
+
var d, p;
|
|
56
|
+
f && f.isIntersecting ? (d = r.current) == null || d.play() : (p = r.current) == null || p.pause();
|
|
62
57
|
},
|
|
63
58
|
{ threshold: 0 }
|
|
64
|
-
),
|
|
59
|
+
), s.current.observe(a.current)), o == null || o(), n && r.current.addEventListener(n.name, n.callback));
|
|
65
60
|
});
|
|
66
61
|
} catch (e) {
|
|
67
|
-
throw
|
|
62
|
+
throw Error(`Error loading Lottie animation: ${e}`);
|
|
68
63
|
}
|
|
69
64
|
})(), () => {
|
|
70
65
|
var e;
|
|
71
|
-
t = !0, r.current && (
|
|
66
|
+
t = !0, r.current && (n && r.current.removeEventListener(n.name, n.callback), c && ((e = s.current) == null || e.disconnect()), r.current.destroy());
|
|
72
67
|
};
|
|
73
|
-
}, [
|
|
68
|
+
}, [m, n, o, c, l]), /* @__PURE__ */ E($, { ref: a, $width: h, $height: y });
|
|
74
69
|
}), D = w(O);
|
|
75
70
|
export {
|
|
76
71
|
D as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lottie-animation.js","sources":["../../../../src/features/ui/lottie-animation/lottie-animation.tsx"],"sourcesContent":["import type { ILottieAnimationProps, ILottieAnimationRef } from './types';\nimport type { AnimationEventName, AnimationItem, AnimationSegment } from 'lottie-web';\n\nimport lottie from 'lottie-web';\nimport { forwardRef, memo, useEffect, useImperativeHandle, useRef } from 'react';\n\nimport FlexView from '../layout/flex-view';\nimport { fetchLottie } from './helper';\n\nconst LottieAnimation = forwardRef<ILottieAnimationRef, ILottieAnimationProps>((props, ref) => {\n const {\n src,\n width = '100%',\n height = '100%',\n settings,\n eventListener,\n onRender,\n
|
|
1
|
+
{"version":3,"file":"lottie-animation.js","sources":["../../../../src/features/ui/lottie-animation/lottie-animation.tsx"],"sourcesContent":["import type { ILottieAnimationProps, ILottieAnimationRef } from './types';\nimport type { AnimationEventName, AnimationItem, AnimationSegment } from 'lottie-web';\n\nimport lottie from 'lottie-web';\nimport { forwardRef, memo, useEffect, useImperativeHandle, useRef } from 'react';\n\nimport FlexView from '../layout/flex-view';\nimport { fetchLottie } from './helper';\n\nconst LottieAnimation = forwardRef<ILottieAnimationRef, ILottieAnimationProps>((props, ref) => {\n const {\n src,\n width = '100%',\n height = '100%',\n settings,\n eventListener,\n onRender,\n animateOnIntersect,\n } = props;\n\n const container = useRef<HTMLDivElement>(null);\n const animationInstance = useRef<AnimationItem | null>(null);\n const intersectionObserver = useRef<IntersectionObserver | null>(null);\n\n useImperativeHandle(\n ref,\n () => ({\n playSegments: (segments: AnimationSegment, forceFlag?: boolean) =>\n animationInstance.current?.playSegments(segments, forceFlag),\n addEventListener: (eventName: string, callback: () => void) =>\n animationInstance.current?.addEventListener(eventName as AnimationEventName, callback),\n removeEventListener: (eventName: string, callback: () => void) =>\n animationInstance.current?.removeEventListener(eventName as AnimationEventName, callback),\n play: () => animationInstance.current?.play(),\n stop: () => animationInstance.current?.stop(),\n }),\n [],\n );\n\n useEffect(() => {\n let destroyed = false;\n\n const loadAnimation = async () => {\n try {\n const animationData = await fetchLottie(src);\n\n // Wait for layout\n // NOTE: Do not remove this as this is needed to fix canvas rendering on first layout.\n requestAnimationFrame(() => {\n if (!container.current || destroyed) return;\n\n animationInstance.current = lottie.loadAnimation({\n container: container.current,\n animationData,\n loop: true,\n autoplay: true,\n ...settings,\n });\n\n if (animateOnIntersect) {\n intersectionObserver.current = new IntersectionObserver(\n ([entry]) => {\n if (entry && entry.isIntersecting) {\n animationInstance.current?.play();\n } else {\n animationInstance.current?.pause();\n }\n },\n { threshold: 0 },\n );\n\n intersectionObserver.current.observe(container.current);\n }\n\n onRender?.();\n if (eventListener) {\n animationInstance.current.addEventListener(eventListener.name, eventListener.callback);\n }\n });\n } catch (error) {\n throw Error(`Error loading Lottie animation: ${error}`);\n }\n };\n\n loadAnimation();\n\n return () => {\n destroyed = true;\n if (animationInstance.current) {\n if (eventListener) {\n animationInstance.current.removeEventListener(eventListener.name, eventListener.callback);\n }\n\n if (animateOnIntersect) {\n intersectionObserver.current?.disconnect();\n }\n animationInstance.current.destroy();\n }\n };\n }, [src, eventListener, onRender, animateOnIntersect, settings]);\n\n return <FlexView ref={container} $width={width} $height={height} />;\n});\n\nexport default memo(LottieAnimation);\n"],"names":["LottieAnimation","forwardRef","props","ref","src","width","height","settings","eventListener","onRender","animateOnIntersect","container","useRef","animationInstance","intersectionObserver","useImperativeHandle","segments","forceFlag","_a","eventName","callback","useEffect","destroyed","animationData","fetchLottie","lottie","entry","_b","error","FlexView","LottieAnimation$1","memo"],"mappings":";;;;;AASA,MAAMA,IAAkBC,EAAuD,CAACC,GAAOC,MAAQ;AACvF,QAAA;AAAA,IACJ,KAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,QAAAC,IAAS;AAAA,IACT,UAAAC;AAAA,IACA,eAAAC;AAAA,IACA,UAAAC;AAAA,IACA,oBAAAC;AAAA,EACE,IAAAR,GAEES,IAAYC,EAAuB,IAAI,GACvCC,IAAoBD,EAA6B,IAAI,GACrDE,IAAuBF,EAAoC,IAAI;AAErE,SAAAG;AAAA,IACEZ;AAAA,IACA,OAAO;AAAA,MACL,cAAc,CAACa,GAA4BC,MACzC;;AAAA,gBAAAC,IAAAL,EAAkB,YAAlB,gBAAAK,EAA2B,aAAaF,GAAUC;AAAA;AAAA,MACpD,kBAAkB,CAACE,GAAmBC,MACpC;;AAAA,gBAAAF,IAAAL,EAAkB,YAAlB,gBAAAK,EAA2B,iBAAiBC,GAAiCC;AAAA;AAAA,MAC/E,qBAAqB,CAACD,GAAmBC,MACvC;;AAAA,gBAAAF,IAAAL,EAAkB,YAAlB,gBAAAK,EAA2B,oBAAoBC,GAAiCC;AAAA;AAAA,MAClF,MAA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