react-native-onboarding-steps 1.0.0
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/LICENSE +21 -0
- package/README.md +195 -0
- package/lib/commonjs/Button.js +62 -0
- package/lib/commonjs/Button.js.map +1 -0
- package/lib/commonjs/Onboarding.js +137 -0
- package/lib/commonjs/Onboarding.js.map +1 -0
- package/lib/commonjs/Step.js +45 -0
- package/lib/commonjs/Step.js.map +1 -0
- package/lib/commonjs/Steps.js +66 -0
- package/lib/commonjs/Steps.js.map +1 -0
- package/lib/commonjs/index.js +54 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/theme.js +42 -0
- package/lib/commonjs/theme.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/Button.js +58 -0
- package/lib/module/Button.js.map +1 -0
- package/lib/module/Onboarding.js +131 -0
- package/lib/module/Onboarding.js.map +1 -0
- package/lib/module/Step.js +40 -0
- package/lib/module/Step.js.map +1 -0
- package/lib/module/Steps.js +60 -0
- package/lib/module/Steps.js.map +1 -0
- package/lib/module/index.js +8 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/theme.js +36 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/Button.d.ts +15 -0
- package/lib/typescript/commonjs/src/Button.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Onboarding.d.ts +4 -0
- package/lib/typescript/commonjs/src/Onboarding.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Step.d.ts +11 -0
- package/lib/typescript/commonjs/src/Step.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/Steps.d.ts +9 -0
- package/lib/typescript/commonjs/src/Steps.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +7 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/theme.d.ts +14 -0
- package/lib/typescript/commonjs/src/theme.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types.d.ts +90 -0
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/Button.d.ts +15 -0
- package/lib/typescript/module/src/Button.d.ts.map +1 -0
- package/lib/typescript/module/src/Onboarding.d.ts +4 -0
- package/lib/typescript/module/src/Onboarding.d.ts.map +1 -0
- package/lib/typescript/module/src/Step.d.ts +11 -0
- package/lib/typescript/module/src/Step.d.ts.map +1 -0
- package/lib/typescript/module/src/Steps.d.ts +9 -0
- package/lib/typescript/module/src/Steps.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +7 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/theme.d.ts +14 -0
- package/lib/typescript/module/src/theme.d.ts.map +1 -0
- package/lib/typescript/module/src/types.d.ts +90 -0
- package/lib/typescript/module/src/types.d.ts.map +1 -0
- package/package.json +100 -0
- package/src/Button.tsx +72 -0
- package/src/Onboarding.tsx +147 -0
- package/src/Step.tsx +38 -0
- package/src/Steps.tsx +62 -0
- package/src/index.ts +15 -0
- package/src/theme.ts +34 -0
- package/src/types.ts +99 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.trackWidth = exports.resolveStepsTheme = exports.defaultStepsTheme = void 0;
|
|
7
|
+
/** The look the indicator falls back to when a field is not overridden. */
|
|
8
|
+
const defaultStepsTheme = exports.defaultStepsTheme = {
|
|
9
|
+
stepSize: 26,
|
|
10
|
+
dotSize: 11,
|
|
11
|
+
stepGap: 9,
|
|
12
|
+
trackColor: '#7ADAA5',
|
|
13
|
+
activeDotColor: '#fff',
|
|
14
|
+
inactiveDotColor: '#696969',
|
|
15
|
+
spring: {
|
|
16
|
+
damping: 22,
|
|
17
|
+
stiffness: 180,
|
|
18
|
+
mass: 1
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** Fills a partial theme with the defaults, leaving a fully resolved object. */
|
|
23
|
+
const resolveStepsTheme = input => ({
|
|
24
|
+
...defaultStepsTheme,
|
|
25
|
+
...input
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Width of the track once it has swept `progress` steps past the first one.
|
|
30
|
+
*
|
|
31
|
+
* At `progress === 0` this is exactly one slot, so the track reads as a circle
|
|
32
|
+
* behind the first dot; at `progress === 1` it spans two slots plus the gap
|
|
33
|
+
* between them, visually connecting the two steps.
|
|
34
|
+
*/
|
|
35
|
+
exports.resolveStepsTheme = resolveStepsTheme;
|
|
36
|
+
const trackWidth = (progress, stepSize, stepGap) => {
|
|
37
|
+
'worklet';
|
|
38
|
+
|
|
39
|
+
return (progress + 1) * stepSize + progress * stepGap;
|
|
40
|
+
};
|
|
41
|
+
exports.trackWidth = trackWidth;
|
|
42
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["defaultStepsTheme","exports","stepSize","dotSize","stepGap","trackColor","activeDotColor","inactiveDotColor","spring","damping","stiffness","mass","resolveStepsTheme","input","trackWidth","progress"],"sourceRoot":"../../src","sources":["theme.ts"],"mappings":";;;;;;AAEA;AACO,MAAMA,iBAA6B,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAC3CE,QAAQ,EAAE,EAAE;EACZC,OAAO,EAAE,EAAE;EACXC,OAAO,EAAE,CAAC;EACVC,UAAU,EAAE,SAAS;EACrBC,cAAc,EAAE,MAAM;EACtBC,gBAAgB,EAAE,SAAS;EAC3BC,MAAM,EAAE;IACNC,OAAO,EAAE,EAAE;IACXC,SAAS,EAAE,GAAG;IACdC,IAAI,EAAE;EACR;AACF,CAAC;;AAED;AACO,MAAMC,iBAAiB,GAAIC,KAAuB,KAAkB;EACzE,GAAGb,iBAAiB;EACpB,GAAGa;AACL,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AANAZ,OAAA,CAAAW,iBAAA,GAAAA,iBAAA;AAOO,MAAME,UAAU,GAAGA,CAACC,QAAgB,EAAEb,QAAgB,EAAEE,OAAe,KAAK;EACjF,SAAS;;EACT,OAAO,CAACW,QAAQ,GAAG,CAAC,IAAIb,QAAQ,GAAGa,QAAQ,GAAGX,OAAO;AACvD,CAAC;AAACH,OAAA,CAAAa,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Text, Pressable, StyleSheet } from 'react-native';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const Button = ({
|
|
6
|
+
label,
|
|
7
|
+
onPress,
|
|
8
|
+
variant = 'primary',
|
|
9
|
+
backgroundColor,
|
|
10
|
+
labelColor,
|
|
11
|
+
style
|
|
12
|
+
}) => {
|
|
13
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
14
|
+
onPress: onPress,
|
|
15
|
+
style: ({
|
|
16
|
+
pressed
|
|
17
|
+
}) => [styles.container, styles[variant], backgroundColor ? {
|
|
18
|
+
backgroundColor
|
|
19
|
+
} : null, style, pressed && styles.pressed],
|
|
20
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
21
|
+
style: [styles.text, styles[`${variant}Text`], labelColor ? {
|
|
22
|
+
color: labelColor
|
|
23
|
+
} : null],
|
|
24
|
+
children: label
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const styles = StyleSheet.create({
|
|
29
|
+
container: {
|
|
30
|
+
flexDirection: 'row',
|
|
31
|
+
justifyContent: 'center',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
height: 45,
|
|
34
|
+
borderRadius: 100,
|
|
35
|
+
paddingHorizontal: 28
|
|
36
|
+
},
|
|
37
|
+
pressed: {
|
|
38
|
+
opacity: 0.7
|
|
39
|
+
},
|
|
40
|
+
primary: {
|
|
41
|
+
backgroundColor: '#4382DF'
|
|
42
|
+
},
|
|
43
|
+
secondary: {
|
|
44
|
+
backgroundColor: '#F1F1F1'
|
|
45
|
+
},
|
|
46
|
+
text: {
|
|
47
|
+
fontSize: 18,
|
|
48
|
+
fontWeight: '700'
|
|
49
|
+
},
|
|
50
|
+
primaryText: {
|
|
51
|
+
color: '#F7F4ED'
|
|
52
|
+
},
|
|
53
|
+
secondaryText: {
|
|
54
|
+
color: '#1C1C1E'
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
export default Button;
|
|
58
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Text","Pressable","StyleSheet","jsx","_jsx","Button","label","onPress","variant","backgroundColor","labelColor","style","pressed","styles","container","children","text","color","create","flexDirection","justifyContent","alignItems","height","borderRadius","paddingHorizontal","opacity","primary","secondary","fontSize","fontWeight","primaryText","secondaryText"],"sourceRoot":"../../src","sources":["Button.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,SAAS,EAAEC,UAAU,QAAwC,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAe3F,MAAMC,MAAM,GAAGA,CAAC;EACdC,KAAK;EACLC,OAAO;EACPC,OAAO,GAAG,SAAS;EACnBC,eAAe;EACfC,UAAU;EACVC;AACW,CAAC,KAAK;EACjB,oBACEP,IAAA,CAACH,SAAS;IACRM,OAAO,EAAEA,OAAQ;IACjBI,KAAK,EAAEA,CAAC;MAAEC;IAAQ,CAAC,KAAK,CACtBC,MAAM,CAACC,SAAS,EAChBD,MAAM,CAACL,OAAO,CAAC,EACfC,eAAe,GAAG;MAAEA;IAAgB,CAAC,GAAG,IAAI,EAC5CE,KAAK,EACLC,OAAO,IAAIC,MAAM,CAACD,OAAO,CACzB;IAAAG,QAAA,eAEFX,IAAA,CAACJ,IAAI;MAACW,KAAK,EAAE,CAACE,MAAM,CAACG,IAAI,EAAEH,MAAM,CAAC,GAAGL,OAAO,MAAM,CAAC,EAAEE,UAAU,GAAG;QAAEO,KAAK,EAAEP;MAAW,CAAC,GAAG,IAAI,CAAE;MAAAK,QAAA,EAC7FT;IAAK,CACF;EAAC,CACE,CAAC;AAEhB,CAAC;AAED,MAAMO,MAAM,GAAGX,UAAU,CAACgB,MAAM,CAAC;EAC/BJ,SAAS,EAAE;IACTK,aAAa,EAAE,KAAK;IACpBC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,MAAM,EAAE,EAAE;IACVC,YAAY,EAAE,GAAG;IACjBC,iBAAiB,EAAE;EACrB,CAAC;EACDZ,OAAO,EAAE;IACPa,OAAO,EAAE;EACX,CAAC;EACDC,OAAO,EAAE;IACPjB,eAAe,EAAE;EACnB,CAAC;EACDkB,SAAS,EAAE;IACTlB,eAAe,EAAE;EACnB,CAAC;EACDO,IAAI,EAAE;IACJY,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDC,WAAW,EAAE;IACXb,KAAK,EAAE;EACT,CAAC;EACDc,aAAa,EAAE;IACbd,KAAK,EAAE;EACT;AACF,CAAC,CAAC;AAEF,eAAeZ,MAAM","ignoreList":[]}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemo, useState } from 'react';
|
|
4
|
+
import { View, StyleSheet } from 'react-native';
|
|
5
|
+
import Animated, { FadeIn, FadeOut, LinearTransition } from 'react-native-reanimated';
|
|
6
|
+
import Button from "./Button.js";
|
|
7
|
+
import Steps from "./Steps.js";
|
|
8
|
+
import { resolveStepsTheme } from "./theme.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const DEFAULT_BACK_LABEL = 'Back';
|
|
11
|
+
const DEFAULT_CONTINUE_LABEL = 'Continue';
|
|
12
|
+
const DEFAULT_FINISH_LABEL = 'Finish';
|
|
13
|
+
const clamp = (value, max) => Math.min(Math.max(value, 0), max);
|
|
14
|
+
const Onboarding = ({
|
|
15
|
+
steps,
|
|
16
|
+
initialStep = 0,
|
|
17
|
+
onComplete,
|
|
18
|
+
onStepChange,
|
|
19
|
+
onBack,
|
|
20
|
+
stepsTheme,
|
|
21
|
+
backButtonColor,
|
|
22
|
+
backButtonLabelColor,
|
|
23
|
+
backButton,
|
|
24
|
+
continueButtonColor,
|
|
25
|
+
continueButtonLabelColor,
|
|
26
|
+
continueButton,
|
|
27
|
+
style,
|
|
28
|
+
contentStyle
|
|
29
|
+
}) => {
|
|
30
|
+
const lastIndex = Math.max(steps.length - 1, 0);
|
|
31
|
+
const [currentStep, setCurrentStep] = useState(() => clamp(initialStep, lastIndex));
|
|
32
|
+
const theme = useMemo(() => resolveStepsTheme(stepsTheme), [stepsTheme]);
|
|
33
|
+
|
|
34
|
+
// Guard after the hooks so the hook order stays stable for every render.
|
|
35
|
+
if (steps.length === 0) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const index = clamp(currentStep, lastIndex);
|
|
39
|
+
const step = steps[index];
|
|
40
|
+
const isFirstStep = index === 0;
|
|
41
|
+
const isLastStep = index === lastIndex;
|
|
42
|
+
const goToStep = next => {
|
|
43
|
+
setCurrentStep(next);
|
|
44
|
+
onStepChange?.(next, steps[next]);
|
|
45
|
+
};
|
|
46
|
+
const onPressContinue = () => {
|
|
47
|
+
// The flow deliberately stays on the last step; where to go next is the
|
|
48
|
+
// consumer's decision, made inside onComplete.
|
|
49
|
+
if (isLastStep) {
|
|
50
|
+
onComplete?.();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
goToStep(index + 1);
|
|
54
|
+
};
|
|
55
|
+
const onPressBack = () => {
|
|
56
|
+
if (isFirstStep) return;
|
|
57
|
+
const previous = index - 1;
|
|
58
|
+
onBack?.(previous, steps[previous]);
|
|
59
|
+
goToStep(previous);
|
|
60
|
+
};
|
|
61
|
+
const continueLabel = isLastStep ? step.finishButtonLabel ?? DEFAULT_FINISH_LABEL : step.continueButtonLabel ?? DEFAULT_CONTINUE_LABEL;
|
|
62
|
+
const sharedButtonProps = {
|
|
63
|
+
currentStep: index,
|
|
64
|
+
totalSteps: steps.length
|
|
65
|
+
};
|
|
66
|
+
const backProps = {
|
|
67
|
+
...sharedButtonProps,
|
|
68
|
+
label: step.backButtonLabel ?? DEFAULT_BACK_LABEL,
|
|
69
|
+
onPress: onPressBack
|
|
70
|
+
};
|
|
71
|
+
const continueProps = {
|
|
72
|
+
...sharedButtonProps,
|
|
73
|
+
label: continueLabel,
|
|
74
|
+
onPress: onPressContinue
|
|
75
|
+
};
|
|
76
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
77
|
+
style: [styles.container, style],
|
|
78
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
79
|
+
style: [styles.content, contentStyle],
|
|
80
|
+
children: step.content
|
|
81
|
+
}), /*#__PURE__*/_jsx(Steps, {
|
|
82
|
+
steps: steps,
|
|
83
|
+
currentStep: index,
|
|
84
|
+
theme: theme
|
|
85
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
86
|
+
style: styles.footer,
|
|
87
|
+
children: [!isFirstStep && /*#__PURE__*/_jsx(Animated.View, {
|
|
88
|
+
entering: FadeIn.duration(200),
|
|
89
|
+
exiting: FadeOut.duration(150),
|
|
90
|
+
children: backButton ? backButton(backProps) : /*#__PURE__*/_jsx(Button, {
|
|
91
|
+
label: backProps.label,
|
|
92
|
+
onPress: backProps.onPress,
|
|
93
|
+
variant: "secondary",
|
|
94
|
+
backgroundColor: backButtonColor,
|
|
95
|
+
labelColor: backButtonLabelColor
|
|
96
|
+
})
|
|
97
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
98
|
+
style: styles.primaryAction,
|
|
99
|
+
layout: LinearTransition.duration(250),
|
|
100
|
+
children: continueButton ? continueButton(continueProps) : /*#__PURE__*/_jsx(Button, {
|
|
101
|
+
label: continueProps.label,
|
|
102
|
+
onPress: continueProps.onPress,
|
|
103
|
+
backgroundColor: continueButtonColor,
|
|
104
|
+
labelColor: continueButtonLabelColor
|
|
105
|
+
})
|
|
106
|
+
})]
|
|
107
|
+
})]
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
const styles = StyleSheet.create({
|
|
111
|
+
container: {
|
|
112
|
+
flex: 1,
|
|
113
|
+
alignItems: 'center'
|
|
114
|
+
},
|
|
115
|
+
content: {
|
|
116
|
+
flex: 1,
|
|
117
|
+
alignSelf: 'stretch'
|
|
118
|
+
},
|
|
119
|
+
footer: {
|
|
120
|
+
flexDirection: 'row',
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
gap: 10,
|
|
123
|
+
width: '85%',
|
|
124
|
+
marginTop: 20
|
|
125
|
+
},
|
|
126
|
+
primaryAction: {
|
|
127
|
+
flex: 1
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
export default Onboarding;
|
|
131
|
+
//# sourceMappingURL=Onboarding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useMemo","useState","View","StyleSheet","Animated","FadeIn","FadeOut","LinearTransition","Button","Steps","resolveStepsTheme","jsx","_jsx","jsxs","_jsxs","DEFAULT_BACK_LABEL","DEFAULT_CONTINUE_LABEL","DEFAULT_FINISH_LABEL","clamp","value","max","Math","min","Onboarding","steps","initialStep","onComplete","onStepChange","onBack","stepsTheme","backButtonColor","backButtonLabelColor","backButton","continueButtonColor","continueButtonLabelColor","continueButton","style","contentStyle","lastIndex","length","currentStep","setCurrentStep","theme","index","step","isFirstStep","isLastStep","goToStep","next","onPressContinue","onPressBack","previous","continueLabel","finishButtonLabel","continueButtonLabel","sharedButtonProps","totalSteps","backProps","label","backButtonLabel","onPress","continueProps","styles","container","children","content","footer","entering","duration","exiting","variant","backgroundColor","labelColor","primaryAction","layout","create","flex","alignItems","alignSelf","flexDirection","gap","width","marginTop"],"sourceRoot":"../../src","sources":["Onboarding.tsx"],"mappings":";;AAAA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACzC,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAC/C,OAAOC,QAAQ,IAAIC,MAAM,EAAEC,OAAO,EAAEC,gBAAgB,QAAQ,yBAAyB;AACrF,OAAOC,MAAM,MAAM,aAAU;AAC7B,OAAOC,KAAK,MAAM,YAAS;AAC3B,SAASC,iBAAiB,QAAQ,YAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG5C,MAAMC,kBAAkB,GAAG,MAAM;AACjC,MAAMC,sBAAsB,GAAG,UAAU;AACzC,MAAMC,oBAAoB,GAAG,QAAQ;AAErC,MAAMC,KAAK,GAAGA,CAACC,KAAa,EAAEC,GAAW,KAAKC,IAAI,CAACC,GAAG,CAACD,IAAI,CAACD,GAAG,CAACD,KAAK,EAAE,CAAC,CAAC,EAAEC,GAAG,CAAC;AAE/E,MAAMG,UAAU,GAAGA,CAAC;EAClBC,KAAK;EACLC,WAAW,GAAG,CAAC;EACfC,UAAU;EACVC,YAAY;EACZC,MAAM;EACNC,UAAU;EACVC,eAAe;EACfC,oBAAoB;EACpBC,UAAU;EACVC,mBAAmB;EACnBC,wBAAwB;EACxBC,cAAc;EACdC,KAAK;EACLC;AACe,CAAC,KAAK;EACrB,MAAMC,SAAS,GAAGjB,IAAI,CAACD,GAAG,CAACI,KAAK,CAACe,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC;EAC/C,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGxC,QAAQ,CAAC,MAAMiB,KAAK,CAACO,WAAW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6D,QAAQ,CAAC,GAAG,CAAE;QAAAJ,QAAA,EAChF7B,cAAc,GACbA,cAAc,CAAC0B,aAAa,CAAC,gBAE7BjD,IAAA,CAACJ,MAAM;UACLkD,KAAK,EAAEG,aAAa,CAACH,KAAM;UAC3BE,OAAO,EAAEC,aAAa,CAACD,OAAQ;UAC/BW,eAAe,EAAEtC,mBAAoB;UACrCuC,UAAU,EAAEtC;QAAyB,CACtC;MACF,CACY,CAAC;IAAA,CACZ,CAAC;EAAA,CACH,CAAC;AAEX,CAAC;AAED,MAAM4B,MAAM,GAAG3D,UAAU,CAACwE,MAAM,CAAC;EAC/BZ,SAAS,EAAE;IACTa,IAAI,EAAE,CAAC;IACPC,UAAU,EAAE;EACd,CAAC;EACDZ,OAAO,EAAE;IACPW,IAAI,EAAE,CAAC;IACPE,SAAS,EAAE;EACb,CAAC;EACDZ,MAAM,EAAE;IACNa,aAAa,EAAE,KAAK;IACpBF,UAAU,EAAE,QAAQ;IACpBG,GAAG,EAAE,EAAE;IACPC,KAAK,EAAE,KAAK;IACZC,SAAS,EAAE;EACb,CAAC;EACDT,aAAa,EAAE;IACbG,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAEF,eAAerD,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import Animated, { interpolateColor, useAnimatedStyle } from 'react-native-reanimated';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const Step = ({
|
|
7
|
+
index,
|
|
8
|
+
progress,
|
|
9
|
+
theme
|
|
10
|
+
}) => {
|
|
11
|
+
const {
|
|
12
|
+
stepSize,
|
|
13
|
+
dotSize,
|
|
14
|
+
activeDotColor,
|
|
15
|
+
inactiveDotColor
|
|
16
|
+
} = theme;
|
|
17
|
+
|
|
18
|
+
// The dot flips colour across the short window where the track's edge is
|
|
19
|
+
// sweeping over it, so the two always look like one movement.
|
|
20
|
+
const dotStyle = useAnimatedStyle(() => ({
|
|
21
|
+
backgroundColor: interpolateColor(progress.value, [index - 0.65, index - 0.25], [inactiveDotColor, activeDotColor])
|
|
22
|
+
}));
|
|
23
|
+
return /*#__PURE__*/_jsx(View, {
|
|
24
|
+
style: {
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
width: stepSize,
|
|
28
|
+
height: stepSize
|
|
29
|
+
},
|
|
30
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
31
|
+
style: [{
|
|
32
|
+
width: dotSize,
|
|
33
|
+
height: dotSize,
|
|
34
|
+
borderRadius: dotSize / 2
|
|
35
|
+
}, dotStyle]
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
export default Step;
|
|
40
|
+
//# sourceMappingURL=Step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["View","Animated","interpolateColor","useAnimatedStyle","jsx","_jsx","Step","index","progress","theme","stepSize","dotSize","activeDotColor","inactiveDotColor","dotStyle","backgroundColor","value","style","alignItems","justifyContent","width","height","children","borderRadius"],"sourceRoot":"../../src","sources":["Step.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,cAAc;AACnC,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,gBAAgB,QAEX,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAUjC,MAAMC,IAAI,GAAGA,CAAC;EAAEC,KAAK;EAAEC,QAAQ;EAAEC;AAAiB,CAAC,KAAK;EACtD,MAAM;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,cAAc;IAAEC;EAAiB,CAAC,GAAGJ,KAAK;;EAErE;EACA;EACA,MAAMK,QAAQ,GAAGX,gBAAgB,CAAC,OAAO;IACvCY,eAAe,EAAEb,gBAAgB,CAC/BM,QAAQ,CAACQ,KAAK,EACd,CAACT,KAAK,GAAG,IAAI,EAAEA,KAAK,GAAG,IAAI,CAAC,EAC5B,CAACM,gBAAgB,EAAED,cAAc,CACnC;EACF,CAAC,CAAC,CAAC;EAEH,oBACEP,IAAA,CAACL,IAAI;IAACiB,KAAK,EAAE;MAAEC,UAAU,EAAE,QAAQ;MAAEC,cAAc,EAAE,QAAQ;MAAEC,KAAK,EAAEV,QAAQ;MAAEW,MAAM,EAAEX;IAAS,CAAE;IAAAY,QAAA,eACjGjB,IAAA,CAACJ,QAAQ,CAACD,IAAI;MACZiB,KAAK,EAAE,CAAC;QAAEG,KAAK,EAAET,OAAO;QAAEU,MAAM,EAAEV,OAAO;QAAEY,YAAY,EAAEZ,OAAO,GAAG;MAAE,CAAC,EAAEG,QAAQ;IAAE,CACnF;EAAC,CACE,CAAC;AAEX,CAAC;AAED,eAAeR,IAAI","ignoreList":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import Animated, { useAnimatedStyle, useSharedValue, withSpring } from 'react-native-reanimated';
|
|
6
|
+
import Step from "./Step.js";
|
|
7
|
+
import { trackWidth } from "./theme.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const Steps = ({
|
|
10
|
+
steps,
|
|
11
|
+
currentStep,
|
|
12
|
+
theme
|
|
13
|
+
}) => {
|
|
14
|
+
const {
|
|
15
|
+
stepSize,
|
|
16
|
+
stepGap,
|
|
17
|
+
trackColor,
|
|
18
|
+
spring
|
|
19
|
+
} = theme;
|
|
20
|
+
|
|
21
|
+
// Leading edge of the track, in step units. Every visual change — the
|
|
22
|
+
// track's width and each dot's colour — is derived from this one value so
|
|
23
|
+
// the sweep and the dots stay in sync, including on the way back.
|
|
24
|
+
const progress = useSharedValue(currentStep);
|
|
25
|
+
|
|
26
|
+
// Held in a ref so an inline `stepsTheme={{ ... }}` — which hands us a new
|
|
27
|
+
// spring object on every render — cannot restart an in-flight animation.
|
|
28
|
+
// The step change is the only thing that should kick the spring off, and the
|
|
29
|
+
// ref is always current by the time it does.
|
|
30
|
+
const springRef = useRef(spring);
|
|
31
|
+
springRef.current = spring;
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
progress.value = withSpring(currentStep, springRef.current);
|
|
34
|
+
}, [currentStep]);
|
|
35
|
+
const trackStyle = useAnimatedStyle(() => ({
|
|
36
|
+
width: trackWidth(progress.value, stepSize, stepGap)
|
|
37
|
+
}));
|
|
38
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
39
|
+
style: {
|
|
40
|
+
flexDirection: 'row',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
gap: stepGap
|
|
43
|
+
},
|
|
44
|
+
children: [/*#__PURE__*/_jsx(Animated.View, {
|
|
45
|
+
style: [{
|
|
46
|
+
position: 'absolute',
|
|
47
|
+
left: 0,
|
|
48
|
+
height: stepSize,
|
|
49
|
+
borderRadius: stepSize / 2,
|
|
50
|
+
backgroundColor: trackColor
|
|
51
|
+
}, trackStyle]
|
|
52
|
+
}), steps.map((item, index) => /*#__PURE__*/_jsx(Step, {
|
|
53
|
+
index: index,
|
|
54
|
+
progress: progress,
|
|
55
|
+
theme: theme
|
|
56
|
+
}, item.id))]
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
export default Steps;
|
|
60
|
+
//# sourceMappingURL=Steps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","View","Animated","useAnimatedStyle","useSharedValue","withSpring","Step","trackWidth","jsx","_jsx","jsxs","_jsxs","Steps","steps","currentStep","theme","stepSize","stepGap","trackColor","spring","progress","springRef","current","value","trackStyle","width","style","flexDirection","alignItems","gap","children","position","left","height","borderRadius","backgroundColor","map","item","index","id"],"sourceRoot":"../../src","sources":["Steps.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,IAAI,QAAQ,cA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C,EACDM,UAAU;IACV,CACH,CAAC,EACDX,KAAK,CAACuB,GAAG,CAAC,CAACC,IAAI,EAAEC,KAAK,kBACrB7B,IAAA,CAACH,IAAI;MAAegC,KAAK,EAAEA,KAAM;MAAClB,QAAQ,EAAEA,QAAS;MAACL,KAAK,EAAEA;IAAM,GAAxDsB,IAAI,CAACE,EAAqD,CACtE,CAAC;EAAA,CACE,CAAC;AAEX,CAAC;AAED,eAAe3B,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export { default as Onboarding } from "./Onboarding.js";
|
|
4
|
+
export { default as Steps } from "./Steps.js";
|
|
5
|
+
export { default as Step } from "./Step.js";
|
|
6
|
+
export { default as Button } from "./Button.js";
|
|
7
|
+
export { defaultStepsTheme, resolveStepsTheme, trackWidth } from "./theme.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default","Onboarding","Steps","Step","Button","defaultStepsTheme","resolveStepsTheme","trackWidth"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,UAAU,QAAQ,iBAAc;AACpD,SAASD,OAAO,IAAIE,KAAK,QAAQ,YAAS;AAC1C,SAASF,OAAO,IAAIG,IAAI,QAAQ,WAAQ;AACxC,SAASH,OAAO,IAAII,MAAM,QAAQ,aAAU;AAE5C,SAASC,iBAAiB,EAAEC,iBAAiB,EAAEC,UAAU,QAAQ,YAAS","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/** The look the indicator falls back to when a field is not overridden. */
|
|
4
|
+
export const defaultStepsTheme = {
|
|
5
|
+
stepSize: 26,
|
|
6
|
+
dotSize: 11,
|
|
7
|
+
stepGap: 9,
|
|
8
|
+
trackColor: '#7ADAA5',
|
|
9
|
+
activeDotColor: '#fff',
|
|
10
|
+
inactiveDotColor: '#696969',
|
|
11
|
+
spring: {
|
|
12
|
+
damping: 22,
|
|
13
|
+
stiffness: 180,
|
|
14
|
+
mass: 1
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** Fills a partial theme with the defaults, leaving a fully resolved object. */
|
|
19
|
+
export const resolveStepsTheme = input => ({
|
|
20
|
+
...defaultStepsTheme,
|
|
21
|
+
...input
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Width of the track once it has swept `progress` steps past the first one.
|
|
26
|
+
*
|
|
27
|
+
* At `progress === 0` this is exactly one slot, so the track reads as a circle
|
|
28
|
+
* behind the first dot; at `progress === 1` it spans two slots plus the gap
|
|
29
|
+
* between them, visually connecting the two steps.
|
|
30
|
+
*/
|
|
31
|
+
export const trackWidth = (progress, stepSize, stepGap) => {
|
|
32
|
+
'worklet';
|
|
33
|
+
|
|
34
|
+
return (progress + 1) * stepSize + progress * stepGap;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["defaultStepsTheme","stepSize","dotSize","stepGap","trackColor","activeDotColor","inactiveDotColor","spring","damping","stiffness","mass","resolveStepsTheme","input","trackWidth","progress"],"sourceRoot":"../../src","sources":["theme.ts"],"mappings":";;AAEA;AACA,OAAO,MAAMA,iBAA6B,GAAG;EAC3CC,QAAQ,EAAE,EAAE;EACZC,OAAO,EAAE,EAAE;EACXC,OAAO,EAAE,CAAC;EACVC,UAAU,EAAE,SAAS;EACrBC,cAAc,EAAE,MAAM;EACtBC,gBAAgB,EAAE,SAAS;EAC3BC,MAAM,EAAE;IACNC,OAAO,EAAE,EAAE;IACXC,SAAS,EAAE,GAAG;IACdC,IAAI,EAAE;EACR;AACF,CAAC;;AAED;AACA,OAAO,MAAMC,iBAAiB,GAAIC,KAAuB,KAAkB;EACzE,GAAGZ,iBAAiB;EACpB,GAAGY;AACL,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAGA,CAACC,QAAgB,EAAEb,QAAgB,EAAEE,OAAe,KAAK;EACjF,SAAS;;EACT,OAAO,CAACW,QAAQ,GAAG,CAAC,IAAIb,QAAQ,GAAGa,QAAQ,GAAGX,OAAO;AACvD,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
type ButtonVariant = 'primary' | 'secondary';
|
|
3
|
+
type ButtonProps = {
|
|
4
|
+
label?: string;
|
|
5
|
+
onPress: () => void;
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
/** Overrides the variant's background. */
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
/** Overrides the variant's label colour. */
|
|
10
|
+
labelColor?: string;
|
|
11
|
+
style?: StyleProp<ViewStyle>;
|
|
12
|
+
};
|
|
13
|
+
declare const Button: ({ label, onPress, variant, backgroundColor, labelColor, style, }: ButtonProps) => import("react").JSX.Element;
|
|
14
|
+
export default Button;
|
|
15
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE3F,KAAK,aAAa,GAAG,SAAS,GAAG,WAAW,CAAC;AAE7C,KAAK,WAAW,GAAG;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,0CAA0C;IAC1C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEF,QAAA,MAAM,MAAM,GAAI,kEAOb,WAAW,gCAiBb,CAAC;AAgCF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { OnboardingProps } from './types';
|
|
2
|
+
declare const Onboarding: ({ steps, initialStep, onComplete, onStepChange, onBack, stepsTheme, backButtonColor, backButtonLabelColor, backButton, continueButtonColor, continueButtonLabelColor, continueButton, style, contentStyle, }: OnboardingProps) => import("react").JSX.Element | null;
|
|
3
|
+
export default Onboarding;
|
|
4
|
+
//# sourceMappingURL=Onboarding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Onboarding.d.ts","sourceRoot":"","sources":["../../../../src/Onboarding.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAyB,eAAe,EAAE,MAAM,SAAS,CAAC;AAQtE,QAAA,MAAM,UAAU,GAAI,8MAejB,eAAe,uCA8FjB,CAAC;AAuBF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type SharedValue } from 'react-native-reanimated';
|
|
2
|
+
import type { StepsTheme } from './types';
|
|
3
|
+
type StepProps = {
|
|
4
|
+
index: number;
|
|
5
|
+
/** Animated position of the track's leading edge, in step units. */
|
|
6
|
+
progress: SharedValue<number>;
|
|
7
|
+
theme: StepsTheme;
|
|
8
|
+
};
|
|
9
|
+
declare const Step: ({ index, progress, theme }: StepProps) => import("react").JSX.Element;
|
|
10
|
+
export default Step;
|
|
11
|
+
//# sourceMappingURL=Step.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Step.d.ts","sourceRoot":"","sources":["../../../../src/Step.tsx"],"names":[],"mappings":"AACA,OAAiB,EAGf,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,KAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,QAAA,MAAM,IAAI,GAAI,4BAA4B,SAAS,gCAoBlD,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { OnboardingStep, StepsTheme } from './types';
|
|
2
|
+
type StepsProps = {
|
|
3
|
+
steps: OnboardingStep[];
|
|
4
|
+
currentStep: number;
|
|
5
|
+
theme: StepsTheme;
|
|
6
|
+
};
|
|
7
|
+
declare const Steps: ({ steps, currentStep, theme }: StepsProps) => import("react").JSX.Element;
|
|
8
|
+
export default Steps;
|
|
9
|
+
//# sourceMappingURL=Steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Steps.d.ts","sourceRoot":"","sources":["../../../../src/Steps.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1D,KAAK,UAAU,GAAG;IAChB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF,QAAA,MAAM,KAAK,GAAI,+BAA+B,UAAU,gCA0CvD,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as Onboarding } from './Onboarding';
|
|
2
|
+
export { default as Steps } from './Steps';
|
|
3
|
+
export { default as Step } from './Step';
|
|
4
|
+
export { default as Button } from './Button';
|
|
5
|
+
export { defaultStepsTheme, resolveStepsTheme, trackWidth } from './theme';
|
|
6
|
+
export type { OnboardingProps, OnboardingStep, OnboardingButtonProps, OnboardingButtonRenderer, StepsTheme, StepsThemeInput, } from './types';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE3E,YAAY,EACV,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,UAAU,EACV,eAAe,GAChB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { StepsTheme, StepsThemeInput } from './types';
|
|
2
|
+
/** The look the indicator falls back to when a field is not overridden. */
|
|
3
|
+
export declare const defaultStepsTheme: StepsTheme;
|
|
4
|
+
/** Fills a partial theme with the defaults, leaving a fully resolved object. */
|
|
5
|
+
export declare const resolveStepsTheme: (input?: StepsThemeInput) => StepsTheme;
|
|
6
|
+
/**
|
|
7
|
+
* Width of the track once it has swept `progress` steps past the first one.
|
|
8
|
+
*
|
|
9
|
+
* At `progress === 0` this is exactly one slot, so the track reads as a circle
|
|
10
|
+
* behind the first dot; at `progress === 1` it spans two slots plus the gap
|
|
11
|
+
* between them, visually connecting the two steps.
|
|
12
|
+
*/
|
|
13
|
+
export declare const trackWidth: (progress: number, stepSize: number, stepGap: number) => number;
|
|
14
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE3D,2EAA2E;AAC3E,eAAO,MAAM,iBAAiB,EAAE,UAY/B,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,iBAAiB,GAAI,QAAQ,eAAe,KAAG,UAG1D,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,UAAU,MAAM,EAAE,UAAU,MAAM,EAAE,SAAS,MAAM,WAG7E,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import type { WithSpringConfig } from 'react-native-reanimated';
|
|
4
|
+
/**
|
|
5
|
+
* A single step of the onboarding flow.
|
|
6
|
+
*
|
|
7
|
+
* Everything except `id` is optional so a flow can be as thin as
|
|
8
|
+
* `[{ id: 0 }, { id: 1 }]` and still render.
|
|
9
|
+
*/
|
|
10
|
+
export type OnboardingStep = {
|
|
11
|
+
/** Stable identity for this step. Used as the React key. */
|
|
12
|
+
id: string | number;
|
|
13
|
+
/** What fills the area above the step indicator while this step is active. */
|
|
14
|
+
content?: ReactNode;
|
|
15
|
+
/** Overrides the default "Back" label while this step is active. */
|
|
16
|
+
backButtonLabel?: string;
|
|
17
|
+
/** Overrides the default "Continue" label while this step is active. */
|
|
18
|
+
continueButtonLabel?: string;
|
|
19
|
+
/** Overrides the default "Finish" label. Only used on the last step. */
|
|
20
|
+
finishButtonLabel?: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Fully resolved look of the animated step indicator. Every field is required
|
|
24
|
+
* here; consumers supply a `StepsThemeInput` and the gaps are filled from
|
|
25
|
+
* `defaultStepsTheme`.
|
|
26
|
+
*/
|
|
27
|
+
export type StepsTheme = {
|
|
28
|
+
/** Diameter of a step's slot — also the height of the track. */
|
|
29
|
+
stepSize: number;
|
|
30
|
+
/** Diameter of the dot drawn inside each slot. */
|
|
31
|
+
dotSize: number;
|
|
32
|
+
/** Horizontal space between two step slots. */
|
|
33
|
+
stepGap: number;
|
|
34
|
+
/** Colour of the pill that connects completed steps. */
|
|
35
|
+
trackColor: string;
|
|
36
|
+
/** Dot colour once the track has swept over it. */
|
|
37
|
+
activeDotColor: string;
|
|
38
|
+
/** Dot colour before the track reaches it. */
|
|
39
|
+
inactiveDotColor: string;
|
|
40
|
+
/** Spring driving the track's sweep and the dot colour crossfade. */
|
|
41
|
+
spring: WithSpringConfig;
|
|
42
|
+
};
|
|
43
|
+
/** Partial theme accepted from consumers; merged over `defaultStepsTheme`. */
|
|
44
|
+
export type StepsThemeInput = Partial<StepsTheme>;
|
|
45
|
+
/** Everything a custom button renderer needs to draw itself and act. */
|
|
46
|
+
export type OnboardingButtonProps = {
|
|
47
|
+
/** Label resolved from the step, falling back to the built-in default. */
|
|
48
|
+
label: string;
|
|
49
|
+
/** Advances or rewinds the flow. Call this from your own component. */
|
|
50
|
+
onPress: () => void;
|
|
51
|
+
/** Zero-based index of the active step. */
|
|
52
|
+
currentStep: number;
|
|
53
|
+
/** Total number of steps in the flow. */
|
|
54
|
+
totalSteps: number;
|
|
55
|
+
};
|
|
56
|
+
/** A function returning the React element to use in place of a stock button. */
|
|
57
|
+
export type OnboardingButtonRenderer = (props: OnboardingButtonProps) => ReactNode;
|
|
58
|
+
export type OnboardingProps = {
|
|
59
|
+
/** The flow. Rendering is skipped entirely when this is empty. */
|
|
60
|
+
steps: OnboardingStep[];
|
|
61
|
+
/** Step to open on. Clamped into range. Defaults to 0. */
|
|
62
|
+
initialStep?: number;
|
|
63
|
+
/** Called when the primary button is pressed on the last step. The flow
|
|
64
|
+
* stays on that step — navigating away is the consumer's call. */
|
|
65
|
+
onComplete?: () => void;
|
|
66
|
+
/** Called on every step change, forwards and backwards. */
|
|
67
|
+
onStepChange?: (index: number, step: OnboardingStep) => void;
|
|
68
|
+
/** Called when the back button moves the flow to a previous step.
|
|
69
|
+
* `onStepChange` fires as well. */
|
|
70
|
+
onBack?: (index: number, step: OnboardingStep) => void;
|
|
71
|
+
/** Partial override of the step indicator's look. */
|
|
72
|
+
stepsTheme?: StepsThemeInput;
|
|
73
|
+
/** Background of the stock back button. */
|
|
74
|
+
backButtonColor?: string;
|
|
75
|
+
/** Label colour of the stock back button. */
|
|
76
|
+
backButtonLabelColor?: string;
|
|
77
|
+
/** Replaces the stock back button. Still fades in/out with the flow. */
|
|
78
|
+
backButton?: OnboardingButtonRenderer;
|
|
79
|
+
/** Background of the stock continue/finish button. */
|
|
80
|
+
continueButtonColor?: string;
|
|
81
|
+
/** Label colour of the stock continue/finish button. */
|
|
82
|
+
continueButtonLabelColor?: string;
|
|
83
|
+
/** Replaces the stock continue/finish button. */
|
|
84
|
+
continueButton?: OnboardingButtonRenderer;
|
|
85
|
+
/** Style for the outermost container. */
|
|
86
|
+
style?: StyleProp<ViewStyle>;
|
|
87
|
+
/** Style for the region that hosts the active step's `content`. */
|
|
88
|
+
contentStyle?: StyleProp<ViewStyle>;
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,4DAA4D;IAC5D,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC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