@cuemath/leap 3.3.19 → 3.3.20
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/trial-session/comps/school-goals/school-goals.js +25 -24
- package/dist/features/trial-session/comps/school-goals/school-goals.js.map +1 -1
- 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/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 +15 -48
- package/dist/features/ui/modals/modal-styled.js.map +1 -1
- package/dist/features/ui/modals/modal.js +38 -46
- 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} +30 -30
- 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/ui/stickers/stickers-effects.js +64 -0
- package/dist/features/ui/stickers/stickers-effects.js.map +1 -0
- package/dist/features/ui/stickers/stickers-styled.js +29 -0
- 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/index.d.ts +35 -87
- package/dist/index.js +425 -427
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/features/stickers/sticker-data.js +0 -235
- package/dist/features/stickers/sticker-data.js.map +0 -1
- package/dist/features/stickers/sticker-selector/sticker-selector-grid.js +0 -27
- package/dist/features/stickers/sticker-selector/sticker-selector-grid.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 -88
- package/dist/features/stickers/sticker-selector/sticker-selector.js.map +0 -1
- package/dist/features/stickers/sticker-selector/sticker.js +0 -54
- package/dist/features/stickers/sticker-selector/sticker.js.map +0 -1
- package/dist/features/stickers/stickers-effects/effects.js +0 -82
- 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 -105
- package/dist/features/stickers/stickers-effects/stickers-effects-helper.js.map +0 -1
- package/dist/features/stickers/stickers-effects/stickers-effects-styled.js +0 -37
- package/dist/features/stickers/stickers-effects/stickers-effects-styled.js.map +0 -1
- package/dist/features/stickers/stickers-effects/stickers-effects.js +0 -67
- package/dist/features/stickers/stickers-effects/stickers-effects.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { memo as
|
|
1
|
+
import { jsx as w } from "react/jsx-runtime";
|
|
2
|
+
import { memo as B, useMemo as C, useCallback as m, useEffect as S } from "react";
|
|
3
3
|
import { GOAL_CATEGORY as s } from "../../../milestone/constants.js";
|
|
4
|
-
import { getCategorizedCurriculumStandards as
|
|
5
|
-
import { getGradesFromConfig as
|
|
4
|
+
import { getCategorizedCurriculumStandards as R } from "../../../milestone/create/comps/class-details-step/class-details-utils.js";
|
|
5
|
+
import { getGradesFromConfig as Y, getGoalsFromConfig as j } from "../../../milestone/create/milestone-create-helpers.js";
|
|
6
6
|
import { epochTimestampAfterOneYear as G } from "../../../utils/utils.js";
|
|
7
|
-
import { useTrialSessionContext as
|
|
7
|
+
import { useTrialSessionContext as q } from "../../context/use-trial-session-context.js";
|
|
8
8
|
import { updateGoalInFormData as O } from "../../helper.js";
|
|
9
|
-
import
|
|
10
|
-
const Z =
|
|
9
|
+
import v from "./school-goals-view.js";
|
|
10
|
+
const Z = B(() => {
|
|
11
11
|
const {
|
|
12
12
|
milestoneConfig: n,
|
|
13
13
|
formData: E,
|
|
@@ -15,17 +15,18 @@ const Z = Y(() => {
|
|
|
15
15
|
updateButtonState: f,
|
|
16
16
|
onRemoveOptionalSlides: g,
|
|
17
17
|
trialHomeData: L
|
|
18
|
-
} =
|
|
19
|
-
() =>
|
|
18
|
+
} = q(), { name: p, grade: e, goals: t, curriculum: i, numberInNameError: N } = E || {}, { demo_info: I } = L, { stream: u, region_data: T } = I || {}, { opportunity_country: c = "US" } = T || {}, U = Y(n), b = C(
|
|
19
|
+
() => R(n, {
|
|
20
20
|
countryCode: c,
|
|
21
21
|
grade: e ?? "",
|
|
22
22
|
goalCategory: s.SCHOOL_SUCCESS,
|
|
23
23
|
courseStream: u,
|
|
24
|
-
enrollmentType: "ONLINE"
|
|
24
|
+
enrollmentType: "ONLINE",
|
|
25
|
+
flow: "CREATE"
|
|
25
26
|
}),
|
|
26
27
|
[n, c, e, u]
|
|
27
28
|
), d = C(
|
|
28
|
-
() =>
|
|
29
|
+
() => j(n, {
|
|
29
30
|
countryCode: c,
|
|
30
31
|
grade: e ?? "",
|
|
31
32
|
goalCategory: s.SCHOOL_SUCCESS,
|
|
@@ -45,25 +46,25 @@ const Z = Y(() => {
|
|
|
45
46
|
});
|
|
46
47
|
},
|
|
47
48
|
[a]
|
|
48
|
-
),
|
|
49
|
+
), y = m(
|
|
49
50
|
(o) => {
|
|
50
51
|
a({ numberInNameError: !1 }), r("name", o.target.value);
|
|
51
52
|
},
|
|
52
53
|
[a, r]
|
|
53
|
-
),
|
|
54
|
+
), H = m(
|
|
54
55
|
(o, l) => {
|
|
55
|
-
const { label:
|
|
56
|
+
const { label: F } = l, x = O(t, s.SCHOOL_SUCCESS, {
|
|
56
57
|
goal_code: o,
|
|
57
|
-
milestone_name:
|
|
58
|
+
milestone_name: F,
|
|
58
59
|
milestone_date_ts: G()
|
|
59
60
|
});
|
|
60
|
-
a({ goals:
|
|
61
|
+
a({ goals: x });
|
|
61
62
|
},
|
|
62
63
|
[t, a]
|
|
63
64
|
), D = m(
|
|
64
65
|
(o) => r("curriculum", o),
|
|
65
66
|
[r]
|
|
66
|
-
),
|
|
67
|
+
), A = m(
|
|
67
68
|
(o) => {
|
|
68
69
|
r("grade", o), r("curriculum", "");
|
|
69
70
|
},
|
|
@@ -83,20 +84,20 @@ const Z = Y(() => {
|
|
|
83
84
|
});
|
|
84
85
|
a({ goals: l });
|
|
85
86
|
}
|
|
86
|
-
}, [d]), /* @__PURE__ */
|
|
87
|
-
|
|
87
|
+
}, [d]), /* @__PURE__ */ w(
|
|
88
|
+
v,
|
|
88
89
|
{
|
|
89
90
|
name: p,
|
|
90
91
|
grade: e,
|
|
91
|
-
grades:
|
|
92
|
+
grades: U,
|
|
92
93
|
goalsList: d,
|
|
93
94
|
curriculum: i,
|
|
94
95
|
selectedGoal: _,
|
|
95
96
|
numberInNameError: N,
|
|
96
|
-
curriculumStandards:
|
|
97
|
-
onNameChange:
|
|
98
|
-
onGoalChange:
|
|
99
|
-
onGradeChange:
|
|
97
|
+
curriculumStandards: b,
|
|
98
|
+
onNameChange: y,
|
|
99
|
+
onGoalChange: H,
|
|
100
|
+
onGradeChange: A,
|
|
100
101
|
onCurriculumChange: D
|
|
101
102
|
}
|
|
102
103
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"school-goals.js","sources":["../../../../../src/features/trial-session/comps/school-goals/school-goals.tsx"],"sourcesContent":["import type { ISelectOption } from '../../../ui/inputs/base-select-input/base-select-input-types';\n\nimport { memo, useCallback, useEffect, useMemo } from 'react';\n\nimport { GOAL_CATEGORY } from '../../../milestone/constants';\nimport { getCategorizedCurriculumStandards } from '../../../milestone/create/comps/class-details-step/class-details-utils';\nimport {\n getGoalsFromConfig,\n getGradesFromConfig,\n} from '../../../milestone/create/milestone-create-helpers';\nimport { epochTimestampAfterOneYear } from '../../../utils/utils';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { updateGoalInFormData } from '../../helper';\nimport SchoolGoalsView from './school-goals-view';\n\nconst SchoolGoals = memo(() => {\n const {\n milestoneConfig,\n formData,\n updateSlideConfig,\n updateButtonState,\n onRemoveOptionalSlides,\n trialHomeData,\n } = useTrialSessionContext();\n const { name, grade, goals, curriculum, numberInNameError } = formData || {};\n\n const { demo_info: demoInfo } = trialHomeData;\n const { stream, region_data: regionData } = demoInfo || {};\n const { opportunity_country: countryCode = 'US' } = regionData || {};\n const grades = getGradesFromConfig(milestoneConfig);\n\n const curriculumStandards = useMemo(\n () =>\n getCategorizedCurriculumStandards(milestoneConfig, {\n countryCode,\n grade: grade ?? '',\n goalCategory: GOAL_CATEGORY.SCHOOL_SUCCESS,\n courseStream: stream,\n enrollmentType: 'ONLINE',\n }),\n [milestoneConfig, countryCode, grade, stream],\n );\n\n const goalsList = useMemo(\n () =>\n getGoalsFromConfig(milestoneConfig, {\n countryCode,\n grade: grade ?? '',\n goalCategory: GOAL_CATEGORY.SCHOOL_SUCCESS,\n courseStream: stream,\n curriculumStandard: curriculum,\n enrollmentType: 'ONLINE',\n }),\n [milestoneConfig, countryCode, grade, stream, curriculum],\n );\n\n const { goal_code: selectedGoal } = useMemo(\n () => goals?.find(goal => goal.goal_category === GOAL_CATEGORY.SCHOOL_SUCCESS) ?? {},\n [goals],\n );\n\n const hasRequiredFields = Boolean(name && grade && curriculum && selectedGoal);\n\n const updateStudentInformation = useCallback(\n (key: string, value: string) => {\n updateSlideConfig({\n [key]: value,\n ...(key === 'grade' || key === 'curriculum' ? { goals: [] } : {}),\n });\n },\n [updateSlideConfig],\n );\n\n const handleNameChange = useCallback<\n NonNullable<React.InputHTMLAttributes<HTMLInputElement>['onChange']>\n >(\n event => {\n updateSlideConfig({ numberInNameError: false });\n updateStudentInformation('name', event.target.value);\n },\n [updateSlideConfig, updateStudentInformation],\n );\n\n const handleGoalChange = useCallback(\n (value: string, option: ISelectOption<string | number>) => {\n const { label } = option;\n\n const updatedGoals = updateGoalInFormData(goals, GOAL_CATEGORY.SCHOOL_SUCCESS, {\n goal_code: value,\n milestone_name: label,\n milestone_date_ts: epochTimestampAfterOneYear(),\n });\n\n updateSlideConfig({ goals: updatedGoals });\n },\n [goals, updateSlideConfig],\n );\n\n const handleCurriculumChange = useCallback(\n (value: string) => updateStudentInformation('curriculum', value),\n [updateStudentInformation],\n );\n\n const handleGradeChange = useCallback(\n (value: string) => {\n updateStudentInformation('grade', value);\n updateStudentInformation('curriculum', '');\n },\n [updateStudentInformation],\n );\n\n useEffect(() => {\n updateButtonState('right', { isDisabled: !hasRequiredFields, isLoading: false });\n }, [hasRequiredFields, updateButtonState]);\n\n useEffect(() => {\n if (grade) {\n onRemoveOptionalSlides?.(grade);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [grade]);\n\n useEffect(() => {\n // If there is only one goal in the list, set it as the selected goal\n // and update the form data with the goal code, milestone name, and date\n const defaultGoal = goalsList.length === 1 ? goalsList[0] : undefined;\n\n if (defaultGoal) {\n const goalToUpdate = updateGoalInFormData(goals, GOAL_CATEGORY.SCHOOL_SUCCESS, {\n goal_code: defaultGoal.id ?? '',\n milestone_name: defaultGoal.label ?? '',\n milestone_date_ts: epochTimestampAfterOneYear(),\n });\n\n updateSlideConfig({ goals: goalToUpdate });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [goalsList]);\n\n return (\n <SchoolGoalsView\n name={name}\n grade={grade}\n grades={grades}\n goalsList={goalsList}\n curriculum={curriculum}\n selectedGoal={selectedGoal}\n numberInNameError={numberInNameError}\n curriculumStandards={curriculumStandards}\n onNameChange={handleNameChange}\n onGoalChange={handleGoalChange}\n onGradeChange={handleGradeChange}\n onCurriculumChange={handleCurriculumChange}\n />\n );\n});\n\nexport default SchoolGoals;\n"],"names":["SchoolGoals","memo","milestoneConfig","formData","updateSlideConfig","updateButtonState","onRemoveOptionalSlides","trialHomeData","useTrialSessionContext","name","grade","goals","curriculum","numberInNameError","demoInfo","stream","regionData","countryCode","grades","getGradesFromConfig","curriculumStandards","useMemo","getCategorizedCurriculumStandards","GOAL_CATEGORY","goalsList","getGoalsFromConfig","selectedGoal","goal","hasRequiredFields","updateStudentInformation","useCallback","key","value","handleNameChange","event","handleGoalChange","option","label","updatedGoals","updateGoalInFormData","epochTimestampAfterOneYear","handleCurriculumChange","handleGradeChange","useEffect","defaultGoal","goalToUpdate","jsx","SchoolGoalsView"],"mappings":";;;;;;;;;AAeM,MAAAA,IAAcC,EAAK,MAAM;AACvB,QAAA;AAAA,IACJ,iBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,eAAAC;AAAA,MACEC,EAAuB,GACrB,EAAE,MAAAC,GAAM,OAAAC,GAAO,OAAAC,GAAO,YAAAC,GAAY,mBAAAC,EAAkB,IAAIV,KAAY,IAEpE,EAAE,WAAWW,EAAa,IAAAP,GAC1B,EAAE,QAAAQ,GAAQ,aAAaC,EAAW,IAAIF,KAAY,CAAA,GAClD,EAAE,qBAAqBG,IAAc,KAAK,IAAID,KAAc,CAAA,GAC5DE,IAASC,EAAoBjB,CAAe,GAE5CkB,IAAsBC;AAAA,IAC1B,MACEC,EAAkCpB,GAAiB;AAAA,MACjD,aAAAe;AAAA,MACA,OAAOP,KAAS;AAAA,MAChB,cAAca,EAAc;AAAA,MAC5B,cAAcR;AAAA,MACd,gBAAgB;AAAA,IAAA,
|
|
1
|
+
{"version":3,"file":"school-goals.js","sources":["../../../../../src/features/trial-session/comps/school-goals/school-goals.tsx"],"sourcesContent":["import type { ISelectOption } from '../../../ui/inputs/base-select-input/base-select-input-types';\n\nimport { memo, useCallback, useEffect, useMemo } from 'react';\n\nimport { GOAL_CATEGORY } from '../../../milestone/constants';\nimport { getCategorizedCurriculumStandards } from '../../../milestone/create/comps/class-details-step/class-details-utils';\nimport {\n getGoalsFromConfig,\n getGradesFromConfig,\n} from '../../../milestone/create/milestone-create-helpers';\nimport { epochTimestampAfterOneYear } from '../../../utils/utils';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { updateGoalInFormData } from '../../helper';\nimport SchoolGoalsView from './school-goals-view';\n\nconst SchoolGoals = memo(() => {\n const {\n milestoneConfig,\n formData,\n updateSlideConfig,\n updateButtonState,\n onRemoveOptionalSlides,\n trialHomeData,\n } = useTrialSessionContext();\n const { name, grade, goals, curriculum, numberInNameError } = formData || {};\n\n const { demo_info: demoInfo } = trialHomeData;\n const { stream, region_data: regionData } = demoInfo || {};\n const { opportunity_country: countryCode = 'US' } = regionData || {};\n const grades = getGradesFromConfig(milestoneConfig);\n\n const curriculumStandards = useMemo(\n () =>\n getCategorizedCurriculumStandards(milestoneConfig, {\n countryCode,\n grade: grade ?? '',\n goalCategory: GOAL_CATEGORY.SCHOOL_SUCCESS,\n courseStream: stream,\n enrollmentType: 'ONLINE',\n flow: 'CREATE',\n }),\n [milestoneConfig, countryCode, grade, stream],\n );\n\n const goalsList = useMemo(\n () =>\n getGoalsFromConfig(milestoneConfig, {\n countryCode,\n grade: grade ?? '',\n goalCategory: GOAL_CATEGORY.SCHOOL_SUCCESS,\n courseStream: stream,\n curriculumStandard: curriculum,\n enrollmentType: 'ONLINE',\n }),\n [milestoneConfig, countryCode, grade, stream, curriculum],\n );\n\n const { goal_code: selectedGoal } = useMemo(\n () => goals?.find(goal => goal.goal_category === GOAL_CATEGORY.SCHOOL_SUCCESS) ?? {},\n [goals],\n );\n\n const hasRequiredFields = Boolean(name && grade && curriculum && selectedGoal);\n\n const updateStudentInformation = useCallback(\n (key: string, value: string) => {\n updateSlideConfig({\n [key]: value,\n ...(key === 'grade' || key === 'curriculum' ? { goals: [] } : {}),\n });\n },\n [updateSlideConfig],\n );\n\n const handleNameChange = useCallback<\n NonNullable<React.InputHTMLAttributes<HTMLInputElement>['onChange']>\n >(\n event => {\n updateSlideConfig({ numberInNameError: false });\n updateStudentInformation('name', event.target.value);\n },\n [updateSlideConfig, updateStudentInformation],\n );\n\n const handleGoalChange = useCallback(\n (value: string, option: ISelectOption<string | number>) => {\n const { label } = option;\n\n const updatedGoals = updateGoalInFormData(goals, GOAL_CATEGORY.SCHOOL_SUCCESS, {\n goal_code: value,\n milestone_name: label,\n milestone_date_ts: epochTimestampAfterOneYear(),\n });\n\n updateSlideConfig({ goals: updatedGoals });\n },\n [goals, updateSlideConfig],\n );\n\n const handleCurriculumChange = useCallback(\n (value: string) => updateStudentInformation('curriculum', value),\n [updateStudentInformation],\n );\n\n const handleGradeChange = useCallback(\n (value: string) => {\n updateStudentInformation('grade', value);\n updateStudentInformation('curriculum', '');\n },\n [updateStudentInformation],\n );\n\n useEffect(() => {\n updateButtonState('right', { isDisabled: !hasRequiredFields, isLoading: false });\n }, [hasRequiredFields, updateButtonState]);\n\n useEffect(() => {\n if (grade) {\n onRemoveOptionalSlides?.(grade);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [grade]);\n\n useEffect(() => {\n // If there is only one goal in the list, set it as the selected goal\n // and update the form data with the goal code, milestone name, and date\n const defaultGoal = goalsList.length === 1 ? goalsList[0] : undefined;\n\n if (defaultGoal) {\n const goalToUpdate = updateGoalInFormData(goals, GOAL_CATEGORY.SCHOOL_SUCCESS, {\n goal_code: defaultGoal.id ?? '',\n milestone_name: defaultGoal.label ?? '',\n milestone_date_ts: epochTimestampAfterOneYear(),\n });\n\n updateSlideConfig({ goals: goalToUpdate });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [goalsList]);\n\n return (\n <SchoolGoalsView\n name={name}\n grade={grade}\n grades={grades}\n goalsList={goalsList}\n curriculum={curriculum}\n selectedGoal={selectedGoal}\n numberInNameError={numberInNameError}\n curriculumStandards={curriculumStandards}\n onNameChange={handleNameChange}\n onGoalChange={handleGoalChange}\n onGradeChange={handleGradeChange}\n onCurriculumChange={handleCurriculumChange}\n />\n );\n});\n\nexport default SchoolGoals;\n"],"names":["SchoolGoals","memo","milestoneConfig","formData","updateSlideConfig","updateButtonState","onRemoveOptionalSlides","trialHomeData","useTrialSessionContext","name","grade","goals","curriculum","numberInNameError","demoInfo","stream","regionData","countryCode","grades","getGradesFromConfig","curriculumStandards","useMemo","getCategorizedCurriculumStandards","GOAL_CATEGORY","goalsList","getGoalsFromConfig","selectedGoal","goal","hasRequiredFields","updateStudentInformation","useCallback","key","value","handleNameChange","event","handleGoalChange","option","label","updatedGoals","updateGoalInFormData","epochTimestampAfterOneYear","handleCurriculumChange","handleGradeChange","useEffect","defaultGoal","goalToUpdate","jsx","SchoolGoalsView"],"mappings":";;;;;;;;;AAeM,MAAAA,IAAcC,EAAK,MAAM;AACvB,QAAA;AAAA,IACJ,iBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,eAAAC;AAAA,MACEC,EAAuB,GACrB,EAAE,MAAAC,GAAM,OAAAC,GAAO,OAAAC,GAAO,YAAAC,GAAY,mBAAAC,EAAkB,IAAIV,KAAY,IAEpE,EAAE,WAAWW,EAAa,IAAAP,GAC1B,EAAE,QAAAQ,GAAQ,aAAaC,EAAW,IAAIF,KAAY,CAAA,GAClD,EAAE,qBAAqBG,IAAc,KAAK,IAAID,KAAc,CAAA,GAC5DE,IAASC,EAAoBjB,CAAe,GAE5CkB,IAAsBC;AAAA,IAC1B,MACEC,EAAkCpB,GAAiB;AAAA,MACjD,aAAAe;AAAA,MACA,OAAOP,KAAS;AAAA,MAChB,cAAca,EAAc;AAAA,MAC5B,cAAcR;AAAA,MACd,gBAAgB;AAAA,MAChB,MAAM;AAAA,IAAA,CACP;AAAA,IACH,CAACb,GAAiBe,GAAaP,GAAOK,CAAM;AAAA,EAAA,GAGxCS,IAAYH;AAAA,IAChB,MACEI,EAAmB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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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IAAAC,EAAK3B,CAAkB;"}
|
|
@@ -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:
|
|
11
|
+
settings: l,
|
|
12
|
+
eventListener: n,
|
|
13
13
|
onRender: i,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
h,
|
|
14
|
+
animateOnIntersect: c
|
|
15
|
+
} = v, a = u(null), r = u(null), s = u(null);
|
|
16
|
+
return b(
|
|
17
|
+
L,
|
|
19
18
|
() => ({
|
|
20
|
-
playSegments: (e,
|
|
19
|
+
playSegments: (e, o) => {
|
|
21
20
|
var t;
|
|
22
|
-
return (t = r.current) == null ? void 0 : t.playSegments(e,
|
|
21
|
+
return (t = r.current) == null ? void 0 : t.playSegments(e, o);
|
|
23
22
|
},
|
|
24
|
-
addEventListener: (e,
|
|
23
|
+
addEventListener: (e, o) => {
|
|
25
24
|
var t;
|
|
26
|
-
return (t = r.current) == null ? void 0 : t.addEventListener(e,
|
|
25
|
+
return (t = r.current) == null ? void 0 : t.addEventListener(e, o);
|
|
27
26
|
},
|
|
28
|
-
removeEventListener: (e,
|
|
27
|
+
removeEventListener: (e, o) => {
|
|
29
28
|
var t;
|
|
30
|
-
return (t = r.current) == null ? void 0 : t.removeEventListener(e,
|
|
29
|
+
return (t = r.current) == null ? void 0 : t.removeEventListener(e, o);
|
|
31
30
|
},
|
|
32
31
|
play: () => {
|
|
33
32
|
var e;
|
|
@@ -39,41 +38,37 @@ const O = b((L, h) => {
|
|
|
39
38
|
},
|
|
40
39
|
setLoop: (e) => {
|
|
41
40
|
r.current && (r.current.loop = e);
|
|
42
|
-
},
|
|
43
|
-
goToAndStop: (e, n) => {
|
|
44
|
-
var t;
|
|
45
|
-
return (t = r.current) == null ? void 0 : t.goToAndStop(e, n);
|
|
46
41
|
}
|
|
47
42
|
}),
|
|
48
43
|
[]
|
|
49
|
-
),
|
|
44
|
+
), I(() => {
|
|
50
45
|
let e = !1;
|
|
51
46
|
return (async () => {
|
|
52
47
|
try {
|
|
53
|
-
const t = await x(
|
|
48
|
+
const t = await x(m);
|
|
54
49
|
requestAnimationFrame(() => {
|
|
55
|
-
!
|
|
56
|
-
container:
|
|
50
|
+
!a.current || e || (r.current = g.loadAnimation({
|
|
51
|
+
container: a.current,
|
|
57
52
|
animationData: t,
|
|
58
53
|
loop: !0,
|
|
59
54
|
autoplay: !0,
|
|
60
|
-
...
|
|
61
|
-
}),
|
|
62
|
-
([
|
|
63
|
-
var
|
|
64
|
-
|
|
55
|
+
...l
|
|
56
|
+
}), c && (s.current = new IntersectionObserver(
|
|
57
|
+
([f]) => {
|
|
58
|
+
var d, p;
|
|
59
|
+
f && f.isIntersecting ? (d = r.current) == null || d.play() : (p = r.current) == null || p.pause();
|
|
65
60
|
},
|
|
66
61
|
{ threshold: 0 }
|
|
67
|
-
),
|
|
62
|
+
), s.current.observe(a.current)), i == null || i(), n && r.current.addEventListener(n.name, n.callback));
|
|
68
63
|
});
|
|
69
64
|
} catch (t) {
|
|
70
|
-
throw
|
|
65
|
+
throw Error(`Error loading Lottie animation: ${t}`);
|
|
71
66
|
}
|
|
72
67
|
})(), () => {
|
|
73
68
|
var t;
|
|
74
|
-
e = !0, r.current && (
|
|
69
|
+
e = !0, r.current && (n && r.current.removeEventListener(n.name, n.callback), c && ((t = s.current) == null || t.disconnect()), r.current.destroy());
|
|
75
70
|
};
|
|
76
|
-
}, [
|
|
71
|
+
}, [m, n, i, c, l]), /* @__PURE__ */ E($, { ref: a, $width: h, $height: y });
|
|
77
72
|
}), D = w(O);
|
|
78
73
|
export {
|
|
79
74
|
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 setLoop: (loop: boolean) => {\n if (animationInstance.current) {\n animationInstance.current.loop = loop;\n }\n },\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","loop","useEffect","destroyed","animationData","fetchLottie","lottie","entry","_b","error","FlexView","LottieAnimation$1","memo"],"mappings":";;;;;AASA,MAAMA,IA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,YACA,MAAM;AAAA,YACN,UAAU;AAAA,YACV,GAAGjB;AAAA,UAAA,CACJ,GAEGG,MACFI,EAAqB,UAAU,IAAI;AAAA,YACjC,CAAC,CAACa,CAAK,MAAM;;AACP,cAAAA,KAASA,EAAM,kBACjBT,IAAAL,EAAkB,YAAlB,QAAAK,EAA2B,UAE3BU,IAAAf,EAAkB,YAAlB,QAAAe,EAA2B;AAAA,YAE/B;AAAA,YACA,EAAE,WAAW,EAAE;AAAA,UAAA,GAGId,EAAA,QAAQ,QAAQH,EAAU,OAAO,IAG7CF,KAAA,QAAAA,KACPD,KACFK,EAAkB,QAAQ,iBAAiBL,EAAc,MAAMA,EAAc,QAAQ;AAAA,QACvF,CACD;AAAA,eACMqB,GAAO;AACR,cAAA,MAAM,mCAAmCA,CAAK,EAAE;AAAA,MACxD;AAAA,IAAA,MAKK,MAAM;;AACC,MAAAN,IAAA,IACRV,EAAkB,YAChBL,KACFK,EAAkB,QAAQ,oBAAoBL,EAAc,MAAMA,EAAc,QAAQ,GAGtFE,OACFQ,IAAAJ,EAAqB,YAArB,QAAAI,EAA8B,eAEhCL,EAAkB,QAAQ;IAC5B;AAAA,EACF,GACC,CAACT,GAAKI,GAAeC,GAAUC,GAAoBH,CAAQ,CAAC,qBAEvDuB,GAAS,EAAA,KAAKnB,GAAW,QAAQN,GAAO,SAASC,EAAQ,CAAA;AACnE,CAAC,GAEcyB,IAAAC,EAAKhC,CAAe;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import a from "styled-components";
|
|
2
|
-
const
|
|
3
|
-
({ theme: { colors: t, zIndex: o }, $isClosing: e
|
|
2
|
+
const p = a.div(
|
|
3
|
+
({ theme: { colors: t, zIndex: o }, $isClosing: e }) => `
|
|
4
4
|
position: fixed;
|
|
5
5
|
top: 0;
|
|
6
6
|
left: 0;
|
|
@@ -10,7 +10,6 @@ const l = a.div(
|
|
|
10
10
|
backdrop-filter: blur(40px);
|
|
11
11
|
display: flex;
|
|
12
12
|
animation: ${e ? "backdropFadeOut" : "backdropFadeIn"} 0.2s ease-out forwards;
|
|
13
|
-
pointer-events: ${i ? "auto" : "none"};
|
|
14
13
|
z-index: ${o.MODAL};
|
|
15
14
|
|
|
16
15
|
@keyframes backdropFadeIn {
|
|
@@ -31,7 +30,7 @@ const l = a.div(
|
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
`
|
|
34
|
-
),
|
|
33
|
+
), l = a.div(
|
|
35
34
|
({ theme: { colors: t }, $isClosing: o, $width: e }) => `
|
|
36
35
|
position: relative;
|
|
37
36
|
align-self: center;
|
|
@@ -101,19 +100,19 @@ const l = a.div(
|
|
|
101
100
|
color: ${t.BLACK_1};
|
|
102
101
|
}
|
|
103
102
|
`
|
|
104
|
-
),
|
|
103
|
+
), d = a.div`
|
|
105
104
|
display: flex;
|
|
106
105
|
align-items: center;
|
|
107
106
|
justify-content: center;
|
|
108
107
|
height: 100vh;
|
|
109
108
|
width: 100%;
|
|
110
|
-
`,
|
|
109
|
+
`, i = 720, r = 800, n = 500, f = a.div(
|
|
111
110
|
({ $isClosing: t }) => `
|
|
112
111
|
position: absolute;
|
|
113
|
-
width: ${
|
|
112
|
+
width: ${i}px;
|
|
114
113
|
height: 100%;
|
|
115
114
|
left: 50%;
|
|
116
|
-
margin-left: ${-(
|
|
115
|
+
margin-left: ${-(i / 2)}px;
|
|
117
116
|
clip-path: polygon(calc(50% - 100px) 0, calc(50% + 100px) 0, 100% 100%, 0 100%);
|
|
118
117
|
background: linear-gradient(
|
|
119
118
|
180deg,
|
|
@@ -121,13 +120,13 @@ const l = a.div(
|
|
|
121
120
|
rgba(0, 0, 0, 0) 100%
|
|
122
121
|
);
|
|
123
122
|
animation: openSpotlight;
|
|
124
|
-
animation-duration: ${
|
|
123
|
+
animation-duration: ${r}ms;
|
|
125
124
|
animation-timing-function: linear;
|
|
126
125
|
animation-fill-mode: forwards;
|
|
127
126
|
opacity: 0;
|
|
128
127
|
${t ? `
|
|
129
128
|
animation: closeSpotlight;
|
|
130
|
-
animation-duration: ${
|
|
129
|
+
animation-duration: ${n}ms;
|
|
131
130
|
animation-timing-function: linear;
|
|
132
131
|
animation-fill-mode: forwards;
|
|
133
132
|
opacity: 1;
|
|
@@ -151,38 +150,7 @@ const l = a.div(
|
|
|
151
150
|
}
|
|
152
151
|
}
|
|
153
152
|
`
|
|
154
|
-
),
|
|
155
|
-
({ theme: { colors: t, zIndex: o }, $isClosing: e, $blocking: i }) => `
|
|
156
|
-
position: fixed;
|
|
157
|
-
top: 0;
|
|
158
|
-
left: 0;
|
|
159
|
-
right: 0;
|
|
160
|
-
bottom: 0;
|
|
161
|
-
background-color: ${t.TRANSPARENT};
|
|
162
|
-
display: flex;
|
|
163
|
-
pointer-events: ${i ? "auto" : "none"};
|
|
164
|
-
animation: ${e ? "backdropFadeOut" : "backdropFadeIn"} 0.2s ease-out forwards;
|
|
165
|
-
z-index: ${o.MODAL};
|
|
166
|
-
|
|
167
|
-
@keyframes backdropFadeIn {
|
|
168
|
-
from {
|
|
169
|
-
opacity: 0;
|
|
170
|
-
}
|
|
171
|
-
to {
|
|
172
|
-
opacity: 1;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
@keyframes backdropFadeOut {
|
|
177
|
-
from {
|
|
178
|
-
opacity: 1;
|
|
179
|
-
}
|
|
180
|
-
to {
|
|
181
|
-
opacity: 0;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
`
|
|
185
|
-
), g = a.div(
|
|
153
|
+
), h = a.div(
|
|
186
154
|
({ $isClosing: t }) => `
|
|
187
155
|
width: 100%;
|
|
188
156
|
height: max-content;
|
|
@@ -217,13 +185,12 @@ const l = a.div(
|
|
|
217
185
|
`
|
|
218
186
|
);
|
|
219
187
|
export {
|
|
220
|
-
|
|
188
|
+
l as BaseModal,
|
|
221
189
|
c as BaseModalContent,
|
|
222
|
-
|
|
190
|
+
h as BottomSheetModal,
|
|
223
191
|
m as CloseButtonContainer,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
x as TransparentModalContainer
|
|
192
|
+
p as ModalContainer,
|
|
193
|
+
d as ModalLoaderWrapper,
|
|
194
|
+
f as SpotlightModal
|
|
228
195
|
};
|
|
229
196
|
//# sourceMappingURL=modal-styled.js.map
|