@npm_leadtech/legal-lib-components 5.63.1 → 5.63.2
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/src/components/atoms/RatafiaResultCard/RatafiaResultCard.d.ts +4 -0
- package/dist/src/components/atoms/RatafiaResultCard/RatafiaResultCard.js +6 -0
- package/dist/src/components/atoms/RatafiaResultCard/RatafiaResultCard.styled.d.ts +1 -0
- package/dist/src/components/atoms/RatafiaResultCard/RatafiaResultCard.styled.js +39 -0
- package/dist/src/components/atoms/RatafiaResultCard/RatafiaResultCard.styled.ts +40 -0
- package/dist/src/components/atoms/RatafiaResultCard/RatafiaResultCard.tsx +18 -0
- package/dist/src/components/atoms/RatafiaResultCard/RatafiaResultCardProps.types.d.ts +5 -0
- package/dist/src/components/atoms/RatafiaResultCard/RatafiaResultCardProps.types.ts +5 -0
- package/dist/src/components/atoms/RatafiaResultCard/index.d.ts +2 -0
- package/dist/src/components/atoms/RatafiaResultCard/index.js +1 -0
- package/dist/src/components/atoms/RatafiaResultCard/index.ts +2 -0
- package/dist/src/components/atoms/RatafiaResultTab/RatafiaResultTab.d.ts +4 -0
- package/dist/src/components/atoms/RatafiaResultTab/RatafiaResultTab.js +6 -0
- package/dist/src/components/atoms/RatafiaResultTab/RatafiaResultTab.styled.d.ts +1 -0
- package/dist/src/components/atoms/RatafiaResultTab/RatafiaResultTab.styled.js +38 -0
- package/dist/src/components/atoms/RatafiaResultTab/RatafiaResultTab.styled.ts +39 -0
- package/dist/src/components/atoms/RatafiaResultTab/RatafiaResultTab.tsx +23 -0
- package/dist/src/components/atoms/RatafiaResultTab/RatafiaResultTabProps.types.d.ts +9 -0
- package/dist/src/components/atoms/RatafiaResultTab/RatafiaResultTabProps.types.js +1 -0
- package/dist/src/components/atoms/RatafiaResultTab/RatafiaResultTabProps.types.ts +9 -0
- package/dist/src/components/atoms/RatafiaResultTab/index.d.ts +2 -0
- package/dist/src/components/atoms/RatafiaResultTab/index.js +1 -0
- package/dist/src/components/atoms/RatafiaResultTab/index.ts +2 -0
- package/dist/src/components/atoms/RatafiaReviewResult/RatafiaReviewResult.d.ts +4 -0
- package/dist/src/components/atoms/RatafiaReviewResult/RatafiaReviewResult.js +6 -0
- package/dist/src/components/atoms/RatafiaReviewResult/RatafiaReviewResult.styled.d.ts +1 -0
- package/dist/src/components/atoms/RatafiaReviewResult/RatafiaReviewResult.styled.js +55 -0
- package/dist/src/components/atoms/RatafiaReviewResult/RatafiaReviewResult.styled.ts +56 -0
- package/dist/src/components/atoms/RatafiaReviewResult/RatafiaReviewResult.tsx +56 -0
- package/dist/src/components/atoms/RatafiaReviewResult/RatafiaReviewResultProps.types.d.ts +14 -0
- package/dist/src/components/atoms/RatafiaReviewResult/RatafiaReviewResultProps.types.js +1 -0
- package/dist/src/components/atoms/RatafiaReviewResult/RatafiaReviewResultProps.types.ts +15 -0
- package/dist/src/components/atoms/RatafiaReviewResult/index.d.ts +2 -0
- package/dist/src/components/atoms/RatafiaReviewResult/index.js +1 -0
- package/dist/src/components/atoms/RatafiaReviewResult/index.ts +2 -0
- package/dist/src/components/atoms/index.d.ts +3 -0
- package/dist/src/components/atoms/index.js +3 -0
- package/dist/src/components/atoms/index.ts +3 -0
- package/dist/src/components/molecules/RatafiaResultCardList/RatafiaResultCardList.d.ts +4 -0
- package/dist/src/components/molecules/RatafiaResultCardList/RatafiaResultCardList.js +9 -0
- package/dist/src/components/molecules/RatafiaResultCardList/RatafiaResultCardList.styled.d.ts +1 -0
- package/dist/src/components/molecules/RatafiaResultCardList/RatafiaResultCardList.styled.js +24 -0
- package/dist/src/components/molecules/RatafiaResultCardList/RatafiaResultCardList.styled.ts +25 -0
- package/dist/src/components/molecules/RatafiaResultCardList/RatafiaResultCardList.tsx +21 -0
- package/dist/src/components/molecules/RatafiaResultCardList/RatafiaResultCardListProps.types.d.ts +4 -0
- package/dist/src/components/molecules/RatafiaResultCardList/RatafiaResultCardListProps.types.js +1 -0
- package/dist/src/components/molecules/RatafiaResultCardList/RatafiaResultCardListProps.types.ts +5 -0
- package/dist/src/components/molecules/RatafiaResultCardList/index.d.ts +2 -0
- package/dist/src/components/molecules/RatafiaResultCardList/index.js +1 -0
- package/dist/src/components/molecules/RatafiaResultCardList/index.ts +2 -0
- package/dist/src/components/molecules/RatafiaResultTabList/RatafiaResultTabList.d.ts +4 -0
- package/dist/src/components/molecules/RatafiaResultTabList/RatafiaResultTabList.js +9 -0
- package/dist/src/components/molecules/RatafiaResultTabList/RatafiaResultTabList.styled.d.ts +1 -0
- package/dist/src/components/molecules/RatafiaResultTabList/RatafiaResultTabList.styled.js +7 -0
- package/dist/src/components/molecules/RatafiaResultTabList/RatafiaResultTabList.styled.ts +8 -0
- package/dist/src/components/molecules/RatafiaResultTabList/RatafiaResultTabList.tsx +18 -0
- package/dist/src/components/molecules/RatafiaResultTabList/RatafiaResultTabListProps.types.d.ts +4 -0
- package/dist/src/components/molecules/RatafiaResultTabList/RatafiaResultTabListProps.types.js +1 -0
- package/dist/src/components/molecules/RatafiaResultTabList/RatafiaResultTabListProps.types.ts +5 -0
- package/dist/src/components/molecules/RatafiaResultTabList/index.d.ts +2 -0
- package/dist/src/components/molecules/RatafiaResultTabList/index.js +1 -0
- package/dist/src/components/molecules/RatafiaResultTabList/index.ts +2 -0
- package/dist/src/components/molecules/index.d.ts +2 -0
- package/dist/src/components/molecules/index.js +2 -0
- package/dist/src/components/molecules/index.ts +2 -0
- package/dist/src/components/organisms/RatafiaLoadingResultContent/RatafiaLoadingResultContent.d.ts +4 -0
- package/dist/src/components/organisms/RatafiaLoadingResultContent/RatafiaLoadingResultContent.js +6 -0
- package/dist/src/components/organisms/RatafiaLoadingResultContent/RatafiaLoadingResultContent.styled.d.ts +1 -0
- package/dist/src/components/organisms/RatafiaLoadingResultContent/RatafiaLoadingResultContent.styled.js +143 -0
- package/dist/src/components/organisms/RatafiaLoadingResultContent/RatafiaLoadingResultContent.styled.ts +144 -0
- package/dist/src/components/organisms/RatafiaLoadingResultContent/RatafiaLoadingResultContent.tsx +46 -0
- package/dist/src/components/organisms/RatafiaLoadingResultContent/RatafiaLoadingResultContentProps.types.d.ts +5 -0
- package/dist/src/components/organisms/RatafiaLoadingResultContent/RatafiaLoadingResultContentProps.types.js +1 -0
- package/dist/src/components/organisms/RatafiaLoadingResultContent/RatafiaLoadingResultContentProps.types.ts +5 -0
- package/dist/src/components/organisms/RatafiaLoadingResultContent/index.d.ts +2 -0
- package/dist/src/components/organisms/RatafiaLoadingResultContent/index.js +1 -0
- package/dist/src/components/organisms/RatafiaLoadingResultContent/index.ts +2 -0
- package/dist/src/components/organisms/RatafiaResultContent/RatafiaResultContent.d.ts +4 -0
- package/dist/src/components/organisms/RatafiaResultContent/RatafiaResultContent.js +9 -0
- package/dist/src/components/organisms/RatafiaResultContent/RatafiaResultContent.styled.d.ts +1 -0
- package/dist/src/components/organisms/RatafiaResultContent/RatafiaResultContent.styled.js +26 -0
- package/dist/src/components/organisms/RatafiaResultContent/RatafiaResultContent.styled.ts +27 -0
- package/dist/src/components/organisms/RatafiaResultContent/RatafiaResultContent.tsx +26 -0
- package/dist/src/components/organisms/RatafiaResultContent/RatafiaResultContentProps.types.d.ts +13 -0
- package/dist/src/components/organisms/RatafiaResultContent/RatafiaResultContentProps.types.js +1 -0
- package/dist/src/components/organisms/RatafiaResultContent/RatafiaResultContentProps.types.ts +16 -0
- package/dist/src/components/organisms/RatafiaResultContent/index.d.ts +3 -0
- package/dist/src/components/organisms/RatafiaResultContent/index.js +1 -0
- package/dist/src/components/organisms/RatafiaResultContent/index.ts +3 -0
- package/dist/src/components/organisms/index.d.ts +2 -1
- package/dist/src/components/organisms/index.js +2 -1
- package/dist/src/components/organisms/index.ts +2 -1
- package/dist/src/components/pages/RatafiaResultPage/RatafiaResultPage.d.ts +4 -0
- package/dist/src/components/pages/RatafiaResultPage/RatafiaResultPage.js +15 -0
- package/dist/src/components/pages/RatafiaResultPage/RatafiaResultPage.styled.d.ts +1 -0
- package/dist/src/components/pages/RatafiaResultPage/RatafiaResultPage.styled.js +23 -0
- package/dist/src/components/pages/RatafiaResultPage/RatafiaResultPage.styled.ts +24 -0
- package/dist/src/components/pages/RatafiaResultPage/RatafiaResultPage.tsx +76 -0
- package/dist/src/components/pages/RatafiaResultPage/RatafiaResultPageProps.types.d.ts +20 -0
- package/dist/src/components/pages/RatafiaResultPage/RatafiaResultPageProps.types.js +1 -0
- package/dist/src/components/pages/RatafiaResultPage/RatafiaResultPageProps.types.ts +22 -0
- package/dist/src/components/pages/RatafiaResultPage/index.d.ts +2 -0
- package/dist/src/components/pages/RatafiaResultPage/index.js +1 -0
- package/dist/src/components/pages/RatafiaResultPage/index.ts +2 -0
- package/dist/src/components/pages/index.d.ts +2 -1
- package/dist/src/components/pages/index.js +2 -1
- package/dist/src/components/pages/index.ts +2 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -3
- package/dist/src/components/organisms/Wizard/Wizard.d.ts +0 -3
- package/dist/src/components/organisms/Wizard/Wizard.js +0 -41
- package/dist/src/components/organisms/Wizard/Wizard.tsx +0 -64
- package/dist/src/components/organisms/Wizard/WizardProps.types.d.ts +0 -5
- package/dist/src/components/organisms/Wizard/WizardProps.types.ts +0 -5
- package/dist/src/components/organisms/Wizard/components/Footer.d.ts +0 -6
- package/dist/src/components/organisms/Wizard/components/Footer.js +0 -4
- package/dist/src/components/organisms/Wizard/components/Footer.tsx +0 -10
- package/dist/src/components/organisms/Wizard/components/Header.d.ts +0 -6
- package/dist/src/components/organisms/Wizard/components/Header.js +0 -4
- package/dist/src/components/organisms/Wizard/components/Header.tsx +0 -10
- package/dist/src/components/organisms/Wizard/components/index.d.ts +0 -2
- package/dist/src/components/organisms/Wizard/components/index.js +0 -2
- package/dist/src/components/organisms/Wizard/components/index.ts +0 -2
- package/dist/src/components/organisms/Wizard/constants/index.d.ts +0 -2
- package/dist/src/components/organisms/Wizard/constants/index.js +0 -2
- package/dist/src/components/organisms/Wizard/constants/index.ts +0 -2
- package/dist/src/components/organisms/Wizard/context/WizardContext.d.ts +0 -9
- package/dist/src/components/organisms/Wizard/context/WizardContext.js +0 -8
- package/dist/src/components/organisms/Wizard/context/WizardContext.tsx +0 -17
- package/dist/src/components/organisms/Wizard/context/index.d.ts +0 -1
- package/dist/src/components/organisms/Wizard/context/index.js +0 -1
- package/dist/src/components/organisms/Wizard/context/index.ts +0 -1
- package/dist/src/components/organisms/Wizard/controls/navigation.d.ts +0 -14
- package/dist/src/components/organisms/Wizard/controls/navigation.js +0 -27
- package/dist/src/components/organisms/Wizard/controls/navigation.ts +0 -50
- package/dist/src/components/organisms/Wizard/hooks/index.d.ts +0 -1
- package/dist/src/components/organisms/Wizard/hooks/index.js +0 -1
- package/dist/src/components/organisms/Wizard/hooks/index.ts +0 -1
- package/dist/src/components/organisms/Wizard/hooks/useHash.d.ts +0 -12
- package/dist/src/components/organisms/Wizard/hooks/useHash.js +0 -59
- package/dist/src/components/organisms/Wizard/hooks/useHash.tsx +0 -87
- package/dist/src/components/organisms/Wizard/index.d.ts +0 -4
- package/dist/src/components/organisms/Wizard/index.js +0 -3
- package/dist/src/components/organisms/Wizard/index.ts +0 -4
- /package/dist/src/components/{organisms/Wizard/WizardProps.types.js → atoms/RatafiaResultCard/RatafiaResultCardProps.types.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { WizardContext } from './WizardContext'
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
interface WizardNavigation {
|
|
2
|
-
lastStep: number;
|
|
3
|
-
updateHash: (step: number) => void;
|
|
4
|
-
isHashEnabled: boolean;
|
|
5
|
-
setStep: (step: number) => void;
|
|
6
|
-
step: number;
|
|
7
|
-
}
|
|
8
|
-
interface WizardControls {
|
|
9
|
-
nextStep: () => void;
|
|
10
|
-
previousStep: () => void;
|
|
11
|
-
goToStepByIndex: (step: number) => void;
|
|
12
|
-
}
|
|
13
|
-
export declare const wizardNavigationControls: ({ lastStep, updateHash, isHashEnabled, setStep, step }: WizardNavigation) => WizardControls;
|
|
14
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export const wizardNavigationControls = ({ lastStep, updateHash, isHashEnabled, setStep, step }) => {
|
|
2
|
-
const nextStep = () => {
|
|
3
|
-
const _step = step === lastStep ? lastStep : step + 1;
|
|
4
|
-
setStep(_step);
|
|
5
|
-
if (isHashEnabled) {
|
|
6
|
-
updateHash(_step);
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
const previousStep = () => {
|
|
10
|
-
const _step = step <= 0 ? 0 : step - 1;
|
|
11
|
-
setStep(_step);
|
|
12
|
-
if (isHashEnabled) {
|
|
13
|
-
updateHash(_step);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
const goToStepByIndex = (step) => {
|
|
17
|
-
setStep(step);
|
|
18
|
-
if (isHashEnabled) {
|
|
19
|
-
updateHash(step);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
return {
|
|
23
|
-
nextStep,
|
|
24
|
-
previousStep,
|
|
25
|
-
goToStepByIndex
|
|
26
|
-
};
|
|
27
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
interface WizardNavigation {
|
|
2
|
-
lastStep: number
|
|
3
|
-
updateHash: (step: number) => void
|
|
4
|
-
isHashEnabled: boolean
|
|
5
|
-
setStep: (step: number) => void
|
|
6
|
-
step: number
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface WizardControls {
|
|
10
|
-
nextStep: () => void
|
|
11
|
-
previousStep: () => void
|
|
12
|
-
goToStepByIndex: (step: number) => void
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const wizardNavigationControls = ({
|
|
16
|
-
lastStep,
|
|
17
|
-
updateHash,
|
|
18
|
-
isHashEnabled,
|
|
19
|
-
setStep,
|
|
20
|
-
step
|
|
21
|
-
}: WizardNavigation): WizardControls => {
|
|
22
|
-
const nextStep = (): void => {
|
|
23
|
-
const _step = step === lastStep ? lastStep : step + 1
|
|
24
|
-
setStep(_step)
|
|
25
|
-
if (isHashEnabled) {
|
|
26
|
-
updateHash(_step)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const previousStep = (): void => {
|
|
31
|
-
const _step = step <= 0 ? 0 : step - 1
|
|
32
|
-
setStep(_step)
|
|
33
|
-
if (isHashEnabled) {
|
|
34
|
-
updateHash(_step)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const goToStepByIndex = (step: number): void => {
|
|
39
|
-
setStep(step)
|
|
40
|
-
if (isHashEnabled) {
|
|
41
|
-
updateHash(step)
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
nextStep,
|
|
47
|
-
previousStep,
|
|
48
|
-
goToStepByIndex
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useHash } from './useHash';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useHash } from './useHash';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useHash } from './useHash'
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface UseHashProps {
|
|
3
|
-
children: React.ReactNode[];
|
|
4
|
-
isHashEnabled: boolean;
|
|
5
|
-
setStep: (step: number) => void;
|
|
6
|
-
}
|
|
7
|
-
interface UseHashReturn {
|
|
8
|
-
updateHash: (step: number) => void;
|
|
9
|
-
setStepByHash: (hash: string) => void;
|
|
10
|
-
}
|
|
11
|
-
export declare const useHash: ({ children, isHashEnabled, setStep }: UseHashProps) => UseHashReturn;
|
|
12
|
-
export {};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useRef } from 'react';
|
|
2
|
-
export const useHash = ({ children, isHashEnabled, setStep }) => {
|
|
3
|
-
const hasInitialized = useRef(false);
|
|
4
|
-
const getHash = () => typeof window === 'object' ? decodeURIComponent(window.location.hash.replace(/^#/, '')) : '';
|
|
5
|
-
const { hashKeys, hashKeysURL } = useMemo(() => {
|
|
6
|
-
const localHashKeys = {};
|
|
7
|
-
const localHashKeysURL = {};
|
|
8
|
-
children.forEach((child, index) => {
|
|
9
|
-
if (React.isValidElement(child)) {
|
|
10
|
-
const element = child;
|
|
11
|
-
const hashKey = element.props.hashKey ?? `step${index + 1}`;
|
|
12
|
-
localHashKeysURL[index] = hashKey;
|
|
13
|
-
localHashKeys[hashKey] = index;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return {
|
|
17
|
-
hashKeys: localHashKeys,
|
|
18
|
-
hashKeysURL: localHashKeysURL
|
|
19
|
-
};
|
|
20
|
-
}, [children]);
|
|
21
|
-
const updateHash = (step) => {
|
|
22
|
-
const newHash = hashKeysURL[step];
|
|
23
|
-
if (newHash && window.location.hash !== `#${newHash}`) {
|
|
24
|
-
window.location.hash = newHash;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
const setStepByHash = (hash) => {
|
|
28
|
-
if (hash in hashKeys) {
|
|
29
|
-
setStep(hashKeys[hash]);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (!isHashEnabled)
|
|
34
|
-
return;
|
|
35
|
-
const onHashChange = () => {
|
|
36
|
-
const hash = getHash();
|
|
37
|
-
if (hash in hashKeys) {
|
|
38
|
-
setStep(hashKeys[hash]);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
window.addEventListener('hashchange', onHashChange);
|
|
42
|
-
return () => {
|
|
43
|
-
window.removeEventListener('hashchange', onHashChange);
|
|
44
|
-
};
|
|
45
|
-
}, [isHashEnabled, hashKeys, setStep]);
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (!isHashEnabled || hasInitialized.current)
|
|
48
|
-
return;
|
|
49
|
-
const initialHash = getHash();
|
|
50
|
-
if (initialHash && hashKeys[initialHash] !== undefined) {
|
|
51
|
-
setStep(hashKeys[initialHash]);
|
|
52
|
-
hasInitialized.current = true;
|
|
53
|
-
}
|
|
54
|
-
}, [hashKeys, isHashEnabled, setStep]);
|
|
55
|
-
return {
|
|
56
|
-
updateHash,
|
|
57
|
-
setStepByHash
|
|
58
|
-
};
|
|
59
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useRef } from 'react'
|
|
2
|
-
|
|
3
|
-
interface UseHashProps {
|
|
4
|
-
children: React.ReactNode[]
|
|
5
|
-
isHashEnabled: boolean
|
|
6
|
-
setStep: (step: number) => void
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface UseHashReturn {
|
|
10
|
-
updateHash: (step: number) => void
|
|
11
|
-
setStepByHash: (hash: string) => void
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
type HashKeys = Record<string, number>
|
|
15
|
-
type HashKeysURL = Record<number, string>
|
|
16
|
-
|
|
17
|
-
export const useHash = ({ children, isHashEnabled, setStep }: UseHashProps): UseHashReturn => {
|
|
18
|
-
const hasInitialized = useRef(false)
|
|
19
|
-
|
|
20
|
-
const getHash = (): string =>
|
|
21
|
-
typeof window === 'object' ? decodeURIComponent(window.location.hash.replace(/^#/, '')) : ''
|
|
22
|
-
|
|
23
|
-
const { hashKeys, hashKeysURL } = useMemo(() => {
|
|
24
|
-
const localHashKeys: HashKeys = {}
|
|
25
|
-
const localHashKeysURL: HashKeysURL = {}
|
|
26
|
-
|
|
27
|
-
children.forEach((child, index) => {
|
|
28
|
-
if (React.isValidElement(child)) {
|
|
29
|
-
const element = child as React.ReactElement<{ hashKey?: string }>
|
|
30
|
-
const hashKey = element.props.hashKey ?? `step${index + 1}`
|
|
31
|
-
localHashKeysURL[index] = hashKey
|
|
32
|
-
localHashKeys[hashKey] = index
|
|
33
|
-
}
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
hashKeys: localHashKeys,
|
|
38
|
-
hashKeysURL: localHashKeysURL
|
|
39
|
-
}
|
|
40
|
-
}, [children])
|
|
41
|
-
|
|
42
|
-
const updateHash = (step: number): void => {
|
|
43
|
-
const newHash = hashKeysURL[step]
|
|
44
|
-
if (newHash && window.location.hash !== `#${newHash}`) {
|
|
45
|
-
window.location.hash = newHash
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const setStepByHash = (hash: string): void => {
|
|
50
|
-
if (hash in hashKeys) {
|
|
51
|
-
setStep(hashKeys[hash])
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
if (!isHashEnabled) return
|
|
57
|
-
|
|
58
|
-
const onHashChange = (): void => {
|
|
59
|
-
const hash = getHash()
|
|
60
|
-
if (hash in hashKeys) {
|
|
61
|
-
setStep(hashKeys[hash])
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
window.addEventListener('hashchange', onHashChange)
|
|
66
|
-
|
|
67
|
-
return () => {
|
|
68
|
-
window.removeEventListener('hashchange', onHashChange)
|
|
69
|
-
}
|
|
70
|
-
}, [isHashEnabled, hashKeys, setStep])
|
|
71
|
-
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
if (!isHashEnabled || hasInitialized.current) return
|
|
74
|
-
|
|
75
|
-
const initialHash = getHash()
|
|
76
|
-
|
|
77
|
-
if (initialHash && hashKeys[initialHash] !== undefined) {
|
|
78
|
-
setStep(hashKeys[initialHash])
|
|
79
|
-
hasInitialized.current = true
|
|
80
|
-
}
|
|
81
|
-
}, [hashKeys, isHashEnabled, setStep])
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
updateHash,
|
|
85
|
-
setStepByHash
|
|
86
|
-
}
|
|
87
|
-
}
|