@xaui/native 0.2.7 → 0.9.1-alpha.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/dist/chunk-JDS6KGCM.cjs +791 -0
- package/dist/chunk-T3ZI2PZ6.js +791 -0
- package/dist/index.cjs +32 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +32 -0
- package/dist/theme/index.cjs +32 -0
- package/dist/theme/index.d.cts +669 -0
- package/dist/theme/index.d.ts +669 -0
- package/dist/theme/index.js +32 -0
- package/package.json +26 -249
- package/README.md +0 -178
- package/dist/alert/index.cjs +0 -356
- package/dist/alert/index.d.cts +0 -90
- package/dist/alert/index.d.ts +0 -90
- package/dist/alert/index.js +0 -356
- package/dist/app-bar/index.cjs +0 -148
- package/dist/app-bar/index.d.cts +0 -59
- package/dist/app-bar/index.d.ts +0 -59
- package/dist/app-bar/index.js +0 -148
- package/dist/autocomplete/index.cjs +0 -1122
- package/dist/autocomplete/index.d.cts +0 -88
- package/dist/autocomplete/index.d.ts +0 -88
- package/dist/autocomplete/index.js +0 -1122
- package/dist/avatar/index.cjs +0 -281
- package/dist/avatar/index.d.cts +0 -123
- package/dist/avatar/index.d.ts +0 -123
- package/dist/avatar/index.js +0 -281
- package/dist/badge/index.cjs +0 -197
- package/dist/badge/index.d.cts +0 -94
- package/dist/badge/index.d.ts +0 -94
- package/dist/badge/index.js +0 -197
- package/dist/bottom-sheet/index.cjs +0 -9
- package/dist/bottom-sheet/index.d.cts +0 -84
- package/dist/bottom-sheet/index.d.ts +0 -84
- package/dist/bottom-sheet/index.js +0 -9
- package/dist/bottom-tab-bar/index.cjs +0 -497
- package/dist/bottom-tab-bar/index.d.cts +0 -211
- package/dist/bottom-tab-bar/index.d.ts +0 -211
- package/dist/bottom-tab-bar/index.js +0 -497
- package/dist/button/index.cjs +0 -392
- package/dist/button/index.d.cts +0 -174
- package/dist/button/index.d.ts +0 -174
- package/dist/button/index.js +0 -392
- package/dist/button.type-j1ZdkkSl.d.cts +0 -4
- package/dist/button.type-j1ZdkkSl.d.ts +0 -4
- package/dist/card/index.cjs +0 -338
- package/dist/card/index.d.cts +0 -191
- package/dist/card/index.d.ts +0 -191
- package/dist/card/index.js +0 -338
- package/dist/carousel/index.cjs +0 -381
- package/dist/carousel/index.d.cts +0 -147
- package/dist/carousel/index.d.ts +0 -147
- package/dist/carousel/index.js +0 -381
- package/dist/chart/index.cjs +0 -1026
- package/dist/chart/index.d.cts +0 -218
- package/dist/chart/index.d.ts +0 -218
- package/dist/chart/index.js +0 -1026
- package/dist/checkbox/index.cjs +0 -443
- package/dist/checkbox/index.d.cts +0 -73
- package/dist/checkbox/index.d.ts +0 -73
- package/dist/checkbox/index.js +0 -443
- package/dist/chip/index.cjs +0 -503
- package/dist/chip/index.d.cts +0 -195
- package/dist/chip/index.d.ts +0 -195
- package/dist/chip/index.js +0 -503
- package/dist/chunk-4JFWQ5XT.js +0 -368
- package/dist/chunk-56RPWZD2.cjs +0 -9
- package/dist/chunk-7UFBLUMV.cjs +0 -136
- package/dist/chunk-A45TVXU5.js +0 -337
- package/dist/chunk-BYWUAPC4.cjs +0 -368
- package/dist/chunk-DECMUMCI.js +0 -0
- package/dist/chunk-DHSTKO3K.cjs +0 -19
- package/dist/chunk-DJ4Q37UT.cjs +0 -75
- package/dist/chunk-EUQDGTST.cjs +0 -1
- package/dist/chunk-GBHQCAKW.js +0 -19
- package/dist/chunk-RBSA4NH4.js +0 -136
- package/dist/chunk-SHBDANQN.js +0 -9
- package/dist/chunk-UGEINZM7.cjs +0 -290
- package/dist/chunk-UU4HHBDN.js +0 -290
- package/dist/chunk-VSZEXOUN.js +0 -384
- package/dist/chunk-YIEUN3G5.cjs +0 -384
- package/dist/chunk-ZH6ZSV2Q.cjs +0 -337
- package/dist/chunk-ZY7IUTAT.js +0 -75
- package/dist/color-picker/index.cjs +0 -457
- package/dist/color-picker/index.d.cts +0 -124
- package/dist/color-picker/index.d.ts +0 -124
- package/dist/color-picker/index.js +0 -457
- package/dist/core/index.cjs +0 -24
- package/dist/core/index.d.cts +0 -28
- package/dist/core/index.d.ts +0 -28
- package/dist/core/index.js +0 -24
- package/dist/datepicker/index.cjs +0 -1625
- package/dist/datepicker/index.d.cts +0 -45
- package/dist/datepicker/index.d.ts +0 -45
- package/dist/datepicker/index.js +0 -1625
- package/dist/dialog/index.cjs +0 -372
- package/dist/dialog/index.d.cts +0 -151
- package/dist/dialog/index.d.ts +0 -151
- package/dist/dialog/index.js +0 -372
- package/dist/divider/index.cjs +0 -8
- package/dist/divider/index.d.cts +0 -30
- package/dist/divider/index.d.ts +0 -30
- package/dist/divider/index.js +0 -8
- package/dist/drawer/index.cjs +0 -237
- package/dist/drawer/index.d.cts +0 -58
- package/dist/drawer/index.d.ts +0 -58
- package/dist/drawer/index.js +0 -237
- package/dist/expansion-panel/index.cjs +0 -441
- package/dist/expansion-panel/index.d.cts +0 -153
- package/dist/expansion-panel/index.d.ts +0 -153
- package/dist/expansion-panel/index.js +0 -441
- package/dist/fab/index.cjs +0 -9
- package/dist/fab/index.d.cts +0 -10
- package/dist/fab/index.d.ts +0 -10
- package/dist/fab/index.js +0 -9
- package/dist/fab-menu/index.cjs +0 -330
- package/dist/fab-menu/index.d.cts +0 -125
- package/dist/fab-menu/index.d.ts +0 -125
- package/dist/fab-menu/index.js +0 -330
- package/dist/fab.type-CkUHmXU_.d.ts +0 -86
- package/dist/fab.type-DN0vtAh6.d.cts +0 -86
- package/dist/feature-discovery/index.cjs +0 -464
- package/dist/feature-discovery/index.d.cts +0 -82
- package/dist/feature-discovery/index.d.ts +0 -82
- package/dist/feature-discovery/index.js +0 -464
- package/dist/indicator/index.cjs +0 -8
- package/dist/indicator/index.d.cts +0 -47
- package/dist/indicator/index.d.ts +0 -47
- package/dist/indicator/index.js +0 -8
- package/dist/input/index.cjs +0 -1462
- package/dist/input/index.d.cts +0 -522
- package/dist/input/index.d.ts +0 -522
- package/dist/input/index.js +0 -1462
- package/dist/input-trigger/index.cjs +0 -197
- package/dist/input-trigger/index.d.cts +0 -11
- package/dist/input-trigger/index.d.ts +0 -11
- package/dist/input-trigger/index.js +0 -197
- package/dist/input-trigger.type-Ba4bM3Qp.d.cts +0 -180
- package/dist/input-trigger.type-Ba4bM3Qp.d.ts +0 -180
- package/dist/list/index.cjs +0 -395
- package/dist/list/index.d.cts +0 -188
- package/dist/list/index.d.ts +0 -188
- package/dist/list/index.js +0 -395
- package/dist/menu/index.cjs +0 -316
- package/dist/menu/index.d.cts +0 -115
- package/dist/menu/index.d.ts +0 -115
- package/dist/menu/index.js +0 -316
- package/dist/menubox/index.cjs +0 -297
- package/dist/menubox/index.d.cts +0 -98
- package/dist/menubox/index.d.ts +0 -98
- package/dist/menubox/index.js +0 -297
- package/dist/pager/index.cjs +0 -205
- package/dist/pager/index.d.cts +0 -93
- package/dist/pager/index.d.ts +0 -93
- package/dist/pager/index.js +0 -205
- package/dist/picker/index.cjs +0 -244
- package/dist/picker/index.d.cts +0 -121
- package/dist/picker/index.d.ts +0 -121
- package/dist/picker/index.js +0 -244
- package/dist/progress/index.cjs +0 -219
- package/dist/progress/index.d.cts +0 -47
- package/dist/progress/index.d.ts +0 -47
- package/dist/progress/index.js +0 -219
- package/dist/radio/index.cjs +0 -465
- package/dist/radio/index.d.cts +0 -145
- package/dist/radio/index.d.ts +0 -145
- package/dist/radio/index.js +0 -465
- package/dist/refresh-control/index.cjs +0 -45
- package/dist/refresh-control/index.d.cts +0 -55
- package/dist/refresh-control/index.d.ts +0 -55
- package/dist/refresh-control/index.js +0 -45
- package/dist/segment-button/index.cjs +0 -405
- package/dist/segment-button/index.d.cts +0 -141
- package/dist/segment-button/index.d.ts +0 -141
- package/dist/segment-button/index.js +0 -405
- package/dist/select/index.cjs +0 -878
- package/dist/select/index.d.cts +0 -192
- package/dist/select/index.d.ts +0 -192
- package/dist/select/index.js +0 -878
- package/dist/skeleton/index.cjs +0 -89
- package/dist/skeleton/index.d.cts +0 -45
- package/dist/skeleton/index.d.ts +0 -45
- package/dist/skeleton/index.js +0 -89
- package/dist/slider/index.cjs +0 -576
- package/dist/slider/index.d.cts +0 -171
- package/dist/slider/index.d.ts +0 -171
- package/dist/slider/index.js +0 -576
- package/dist/snackbar/index.cjs +0 -436
- package/dist/snackbar/index.d.cts +0 -174
- package/dist/snackbar/index.d.ts +0 -174
- package/dist/snackbar/index.js +0 -436
- package/dist/snippet/index.cjs +0 -314
- package/dist/snippet/index.d.cts +0 -95
- package/dist/snippet/index.d.ts +0 -95
- package/dist/snippet/index.js +0 -314
- package/dist/stepper/index.cjs +0 -550
- package/dist/stepper/index.d.cts +0 -137
- package/dist/stepper/index.d.ts +0 -137
- package/dist/stepper/index.js +0 -550
- package/dist/switch/index.cjs +0 -358
- package/dist/switch/index.d.cts +0 -28
- package/dist/switch/index.d.ts +0 -28
- package/dist/switch/index.js +0 -358
- package/dist/tabs/index.cjs +0 -440
- package/dist/tabs/index.d.cts +0 -180
- package/dist/tabs/index.d.ts +0 -180
- package/dist/tabs/index.js +0 -440
- package/dist/timepicker/index.cjs +0 -823
- package/dist/timepicker/index.d.cts +0 -215
- package/dist/timepicker/index.d.ts +0 -215
- package/dist/timepicker/index.js +0 -823
- package/dist/toolbar/index.cjs +0 -333
- package/dist/toolbar/index.d.cts +0 -100
- package/dist/toolbar/index.d.ts +0 -100
- package/dist/toolbar/index.js +0 -333
- package/dist/typography/index.cjs +0 -238
- package/dist/typography/index.d.cts +0 -113
- package/dist/typography/index.d.ts +0 -113
- package/dist/typography/index.js +0 -238
- package/dist/view/index.cjs +0 -1361
- package/dist/view/index.d.cts +0 -833
- package/dist/view/index.d.ts +0 -833
- package/dist/view/index.js +0 -1361
package/dist/stepper/index.d.ts
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
3
|
-
import { ThemeColor, Size } from '@xaui/core/types';
|
|
4
|
-
|
|
5
|
-
type StepperDirection = 'horizontal' | 'vertical';
|
|
6
|
-
type StepperLineDisplayMode = 'progress' | 'all';
|
|
7
|
-
type StepperSize = Exclude<Size, 'xs'>;
|
|
8
|
-
type StepperItemIndicatorState = {
|
|
9
|
-
index: number;
|
|
10
|
-
isActive: boolean;
|
|
11
|
-
isCompleted: boolean;
|
|
12
|
-
isLocked: boolean;
|
|
13
|
-
isDisabled: boolean;
|
|
14
|
-
};
|
|
15
|
-
type StepperCustomAppearance = {
|
|
16
|
-
container?: StyleProp<ViewStyle>;
|
|
17
|
-
itemContainer?: StyleProp<ViewStyle>;
|
|
18
|
-
line?: StyleProp<ViewStyle>;
|
|
19
|
-
activeLine?: StyleProp<ViewStyle>;
|
|
20
|
-
};
|
|
21
|
-
type StepperItemCustomAppearance = {
|
|
22
|
-
container?: StyleProp<ViewStyle>;
|
|
23
|
-
indicator?: StyleProp<ViewStyle>;
|
|
24
|
-
activeIndicator?: StyleProp<ViewStyle>;
|
|
25
|
-
completedIndicator?: StyleProp<ViewStyle>;
|
|
26
|
-
lockedIndicator?: StyleProp<ViewStyle>;
|
|
27
|
-
title?: StyleProp<TextStyle>;
|
|
28
|
-
description?: StyleProp<TextStyle>;
|
|
29
|
-
};
|
|
30
|
-
type StepperProps = {
|
|
31
|
-
/**
|
|
32
|
-
* StepperItem children.
|
|
33
|
-
*/
|
|
34
|
-
children: ReactNode;
|
|
35
|
-
/**
|
|
36
|
-
* Direction of the stepper layout.
|
|
37
|
-
* @default 'horizontal'
|
|
38
|
-
*/
|
|
39
|
-
direction?: StepperDirection;
|
|
40
|
-
/**
|
|
41
|
-
* Whether connector lines between steps are shown.
|
|
42
|
-
* @default true
|
|
43
|
-
*/
|
|
44
|
-
showLines?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Controls connector line visibility.
|
|
47
|
-
* - `progress`: only progress to current step is shown.
|
|
48
|
-
* - `all`: all connectors are shown with progress highlight.
|
|
49
|
-
* @default 'progress'
|
|
50
|
-
*/
|
|
51
|
-
lineDisplayMode?: StepperLineDisplayMode;
|
|
52
|
-
/**
|
|
53
|
-
* Controlled active step key.
|
|
54
|
-
*/
|
|
55
|
-
activeKey?: string;
|
|
56
|
-
/**
|
|
57
|
-
* Uncontrolled default active step key.
|
|
58
|
-
*/
|
|
59
|
-
defaultActiveKey?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Callback fired when active step changes.
|
|
62
|
-
*/
|
|
63
|
-
onStepChange?: (key: string) => void;
|
|
64
|
-
/**
|
|
65
|
-
* Shared theme color.
|
|
66
|
-
* @default 'primary'
|
|
67
|
-
*/
|
|
68
|
-
themeColor?: ThemeColor;
|
|
69
|
-
/**
|
|
70
|
-
* Shared stepper size.
|
|
71
|
-
* @default 'md'
|
|
72
|
-
*/
|
|
73
|
-
size?: StepperSize;
|
|
74
|
-
/**
|
|
75
|
-
* Whether all steps are disabled.
|
|
76
|
-
* @default false
|
|
77
|
-
*/
|
|
78
|
-
isDisabled?: boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Stepper container style.
|
|
81
|
-
*/
|
|
82
|
-
style?: StyleProp<ViewStyle>;
|
|
83
|
-
/**
|
|
84
|
-
* Custom appearance styles.
|
|
85
|
-
*/
|
|
86
|
-
customAppearance?: StepperCustomAppearance;
|
|
87
|
-
};
|
|
88
|
-
type StepperItemProps = {
|
|
89
|
-
/**
|
|
90
|
-
* Unique key for this step.
|
|
91
|
-
*/
|
|
92
|
-
itemKey: string;
|
|
93
|
-
/**
|
|
94
|
-
* Main title/label.
|
|
95
|
-
*/
|
|
96
|
-
title?: ReactNode;
|
|
97
|
-
/**
|
|
98
|
-
* Optional secondary description.
|
|
99
|
-
*/
|
|
100
|
-
description?: ReactNode;
|
|
101
|
-
/**
|
|
102
|
-
* Custom indicator content or indicator render function.
|
|
103
|
-
*/
|
|
104
|
-
indicator?: ReactNode | ((state: StepperItemIndicatorState) => ReactNode);
|
|
105
|
-
/**
|
|
106
|
-
* Locks this step from interaction.
|
|
107
|
-
* @default false
|
|
108
|
-
*/
|
|
109
|
-
isLocked?: boolean;
|
|
110
|
-
/**
|
|
111
|
-
* Disables this step from interaction.
|
|
112
|
-
* @default false
|
|
113
|
-
*/
|
|
114
|
-
isDisabled?: boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Additional content rendered below title/description.
|
|
117
|
-
*/
|
|
118
|
-
children?: ReactNode;
|
|
119
|
-
/**
|
|
120
|
-
* Callback fired when this item is pressed.
|
|
121
|
-
*/
|
|
122
|
-
onPress?: (itemKey: string) => void;
|
|
123
|
-
/**
|
|
124
|
-
* Custom style for this item.
|
|
125
|
-
*/
|
|
126
|
-
style?: StyleProp<ViewStyle>;
|
|
127
|
-
/**
|
|
128
|
-
* Custom appearance styles.
|
|
129
|
-
*/
|
|
130
|
-
customAppearance?: StepperItemCustomAppearance;
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
declare const Stepper: React.FC<StepperProps>;
|
|
134
|
-
|
|
135
|
-
declare const StepperItem: React.FC<StepperItemProps>;
|
|
136
|
-
|
|
137
|
-
export { Stepper, type StepperDirection, StepperItem, type StepperItemIndicatorState, type StepperItemProps, type StepperLineDisplayMode, type StepperProps, type StepperSize };
|
package/dist/stepper/index.js
DELETED
|
@@ -1,550 +0,0 @@
|
|
|
1
|
-
import "../chunk-SHBDANQN.js";
|
|
2
|
-
import {
|
|
3
|
-
useXUITheme
|
|
4
|
-
} from "../chunk-RBSA4NH4.js";
|
|
5
|
-
|
|
6
|
-
// src/components/stepper/stepper.tsx
|
|
7
|
-
import React, { useMemo, useState } from "react";
|
|
8
|
-
import { View } from "react-native";
|
|
9
|
-
|
|
10
|
-
// src/components/stepper/stepper-context.ts
|
|
11
|
-
import { createContext, useContext } from "react";
|
|
12
|
-
var StepperContext = createContext(
|
|
13
|
-
void 0
|
|
14
|
-
);
|
|
15
|
-
var useStepperContext = () => useContext(StepperContext);
|
|
16
|
-
|
|
17
|
-
// src/components/stepper/stepper.style.ts
|
|
18
|
-
import { StyleSheet } from "react-native";
|
|
19
|
-
var styles = StyleSheet.create({
|
|
20
|
-
container: {
|
|
21
|
-
width: "100%"
|
|
22
|
-
},
|
|
23
|
-
horizontalContainer: {
|
|
24
|
-
flexDirection: "row",
|
|
25
|
-
alignItems: "flex-start"
|
|
26
|
-
},
|
|
27
|
-
verticalContainer: {
|
|
28
|
-
flexDirection: "column"
|
|
29
|
-
},
|
|
30
|
-
horizontalItem: {
|
|
31
|
-
flex: 1,
|
|
32
|
-
alignItems: "center",
|
|
33
|
-
minWidth: 0
|
|
34
|
-
},
|
|
35
|
-
verticalItem: {
|
|
36
|
-
width: "100%"
|
|
37
|
-
},
|
|
38
|
-
horizontalTopRow: {
|
|
39
|
-
flexDirection: "row",
|
|
40
|
-
alignItems: "center",
|
|
41
|
-
width: "100%"
|
|
42
|
-
},
|
|
43
|
-
verticalRow: {
|
|
44
|
-
flexDirection: "row",
|
|
45
|
-
alignItems: "flex-start",
|
|
46
|
-
width: "100%"
|
|
47
|
-
},
|
|
48
|
-
line: {
|
|
49
|
-
flex: 1,
|
|
50
|
-
borderRadius: 99,
|
|
51
|
-
overflow: "hidden"
|
|
52
|
-
},
|
|
53
|
-
lineProgressWrap: {
|
|
54
|
-
width: "100%",
|
|
55
|
-
height: "100%",
|
|
56
|
-
overflow: "hidden"
|
|
57
|
-
},
|
|
58
|
-
lineProgressHorizontal: {
|
|
59
|
-
alignItems: "flex-start"
|
|
60
|
-
},
|
|
61
|
-
lineProgressVertical: {
|
|
62
|
-
justifyContent: "flex-start"
|
|
63
|
-
},
|
|
64
|
-
lineProgress: {
|
|
65
|
-
width: "100%",
|
|
66
|
-
height: "100%",
|
|
67
|
-
borderRadius: 99
|
|
68
|
-
},
|
|
69
|
-
verticalLineWrap: {
|
|
70
|
-
alignItems: "center",
|
|
71
|
-
width: "100%",
|
|
72
|
-
flex: 1
|
|
73
|
-
},
|
|
74
|
-
indicator: {
|
|
75
|
-
alignItems: "center",
|
|
76
|
-
justifyContent: "center"
|
|
77
|
-
},
|
|
78
|
-
locked: {
|
|
79
|
-
opacity: 0.75
|
|
80
|
-
},
|
|
81
|
-
disabled: {
|
|
82
|
-
opacity: 0.5
|
|
83
|
-
},
|
|
84
|
-
horizontalContent: {
|
|
85
|
-
alignItems: "center",
|
|
86
|
-
width: "100%"
|
|
87
|
-
},
|
|
88
|
-
verticalContent: {
|
|
89
|
-
flex: 1
|
|
90
|
-
},
|
|
91
|
-
title: {
|
|
92
|
-
textAlign: "center",
|
|
93
|
-
fontWeight: "600"
|
|
94
|
-
},
|
|
95
|
-
titleVertical: {
|
|
96
|
-
textAlign: "left"
|
|
97
|
-
},
|
|
98
|
-
description: {
|
|
99
|
-
textAlign: "center",
|
|
100
|
-
fontWeight: "400"
|
|
101
|
-
},
|
|
102
|
-
descriptionVertical: {
|
|
103
|
-
textAlign: "left"
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
// src/components/stepper/stepper.tsx
|
|
108
|
-
var Stepper = ({
|
|
109
|
-
children,
|
|
110
|
-
direction = "horizontal",
|
|
111
|
-
showLines = true,
|
|
112
|
-
lineDisplayMode = "progress",
|
|
113
|
-
activeKey,
|
|
114
|
-
defaultActiveKey,
|
|
115
|
-
onStepChange,
|
|
116
|
-
themeColor = "primary",
|
|
117
|
-
size = "md",
|
|
118
|
-
isDisabled = false,
|
|
119
|
-
style,
|
|
120
|
-
customAppearance
|
|
121
|
-
}) => {
|
|
122
|
-
const items = React.Children.toArray(children);
|
|
123
|
-
const keys = useMemo(
|
|
124
|
-
() => items.map((child) => {
|
|
125
|
-
if (!React.isValidElement(child)) return void 0;
|
|
126
|
-
return child.props.itemKey;
|
|
127
|
-
}).filter((key) => typeof key === "string"),
|
|
128
|
-
[items]
|
|
129
|
-
);
|
|
130
|
-
const [internalActiveKey, setInternalActiveKey] = useState(
|
|
131
|
-
defaultActiveKey ?? keys[0]
|
|
132
|
-
);
|
|
133
|
-
const isControlled = typeof activeKey === "string";
|
|
134
|
-
const resolvedActiveKey = isControlled ? activeKey : internalActiveKey;
|
|
135
|
-
const activeIndex = resolvedActiveKey === void 0 ? -1 : keys.indexOf(resolvedActiveKey);
|
|
136
|
-
const handleStepChange = (key) => {
|
|
137
|
-
if (!isControlled) {
|
|
138
|
-
setInternalActiveKey(key);
|
|
139
|
-
}
|
|
140
|
-
onStepChange?.(key);
|
|
141
|
-
};
|
|
142
|
-
const contextValue = useMemo(
|
|
143
|
-
() => ({
|
|
144
|
-
activeKey: resolvedActiveKey,
|
|
145
|
-
activeIndex,
|
|
146
|
-
keys,
|
|
147
|
-
direction,
|
|
148
|
-
showLines,
|
|
149
|
-
lineDisplayMode,
|
|
150
|
-
isDisabled,
|
|
151
|
-
themeColor,
|
|
152
|
-
size,
|
|
153
|
-
customAppearance,
|
|
154
|
-
onStepChange: handleStepChange
|
|
155
|
-
}),
|
|
156
|
-
[
|
|
157
|
-
resolvedActiveKey,
|
|
158
|
-
activeIndex,
|
|
159
|
-
keys,
|
|
160
|
-
direction,
|
|
161
|
-
showLines,
|
|
162
|
-
lineDisplayMode,
|
|
163
|
-
isDisabled,
|
|
164
|
-
themeColor,
|
|
165
|
-
size,
|
|
166
|
-
customAppearance
|
|
167
|
-
]
|
|
168
|
-
);
|
|
169
|
-
return /* @__PURE__ */ React.createElement(StepperContext.Provider, { value: contextValue }, /* @__PURE__ */ React.createElement(
|
|
170
|
-
View,
|
|
171
|
-
{
|
|
172
|
-
style: [
|
|
173
|
-
styles.container,
|
|
174
|
-
direction === "horizontal" ? styles.horizontalContainer : styles.verticalContainer,
|
|
175
|
-
style,
|
|
176
|
-
customAppearance?.container
|
|
177
|
-
]
|
|
178
|
-
},
|
|
179
|
-
children
|
|
180
|
-
));
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
// src/components/stepper/stepper-item.tsx
|
|
184
|
-
import React2, { useEffect, useMemo as useMemo3, useRef } from "react";
|
|
185
|
-
import { Animated, Pressable, Text, View as View2 } from "react-native";
|
|
186
|
-
import { CheckmarkIcon, LockClosedIcon } from "@xaui/icons";
|
|
187
|
-
|
|
188
|
-
// src/components/stepper/stepper.hook.ts
|
|
189
|
-
import { useMemo as useMemo2 } from "react";
|
|
190
|
-
import { getSafeThemeColor, withOpacity } from "@xaui/core";
|
|
191
|
-
var sizeMap = {
|
|
192
|
-
sm: {
|
|
193
|
-
indicatorSize: 22,
|
|
194
|
-
indicatorBorderWidth: 1.5,
|
|
195
|
-
titleFontSize: 13,
|
|
196
|
-
descriptionFontSize: 11,
|
|
197
|
-
horizontalSpacing: 8,
|
|
198
|
-
verticalSpacing: 6,
|
|
199
|
-
verticalGap: 16,
|
|
200
|
-
lineThickness: 2
|
|
201
|
-
},
|
|
202
|
-
md: {
|
|
203
|
-
indicatorSize: 26,
|
|
204
|
-
indicatorBorderWidth: 2,
|
|
205
|
-
titleFontSize: 14,
|
|
206
|
-
descriptionFontSize: 12,
|
|
207
|
-
horizontalSpacing: 10,
|
|
208
|
-
verticalSpacing: 8,
|
|
209
|
-
verticalGap: 18,
|
|
210
|
-
lineThickness: 2
|
|
211
|
-
},
|
|
212
|
-
lg: {
|
|
213
|
-
indicatorSize: 30,
|
|
214
|
-
indicatorBorderWidth: 2,
|
|
215
|
-
titleFontSize: 15,
|
|
216
|
-
descriptionFontSize: 13,
|
|
217
|
-
horizontalSpacing: 12,
|
|
218
|
-
verticalSpacing: 10,
|
|
219
|
-
verticalGap: 20,
|
|
220
|
-
lineThickness: 3
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
var useStepperSizeStyles = (size) => {
|
|
224
|
-
return useMemo2(() => sizeMap[size], [size]);
|
|
225
|
-
};
|
|
226
|
-
var useStepperColors = (themeColor) => {
|
|
227
|
-
const theme = useXUITheme();
|
|
228
|
-
const scheme = theme.colors[getSafeThemeColor(themeColor)];
|
|
229
|
-
return useMemo2(
|
|
230
|
-
() => ({
|
|
231
|
-
activeIndicatorBackground: scheme.main,
|
|
232
|
-
activeIndicatorBorder: scheme.main,
|
|
233
|
-
activeIndicatorText: scheme.onMain,
|
|
234
|
-
completedIndicatorBackground: withOpacity(scheme.main, 0.2),
|
|
235
|
-
completedIndicatorBorder: scheme.main,
|
|
236
|
-
completedIndicatorText: scheme.main,
|
|
237
|
-
lockedIndicatorBackground: withOpacity(theme.colors.foreground, 0.08),
|
|
238
|
-
lockedIndicatorBorder: withOpacity(theme.colors.foreground, 0.22),
|
|
239
|
-
lockedIndicatorText: withOpacity(theme.colors.foreground, 0.42),
|
|
240
|
-
inactiveIndicatorBackground: theme.colors.background,
|
|
241
|
-
inactiveIndicatorBorder: withOpacity(theme.colors.foreground, 0.22),
|
|
242
|
-
inactiveIndicatorText: withOpacity(theme.colors.foreground, 0.72),
|
|
243
|
-
title: theme.colors.foreground,
|
|
244
|
-
description: withOpacity(theme.colors.foreground, 0.72),
|
|
245
|
-
line: withOpacity(theme.colors.foreground, 0.16),
|
|
246
|
-
activeLine: scheme.main
|
|
247
|
-
}),
|
|
248
|
-
[scheme, theme.colors.background, theme.colors.foreground]
|
|
249
|
-
);
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
// src/components/stepper/stepper-item.tsx
|
|
253
|
-
var isStringOrNumber = (value) => typeof value === "string" || typeof value === "number";
|
|
254
|
-
var StepperItem = ({
|
|
255
|
-
itemKey,
|
|
256
|
-
title,
|
|
257
|
-
description,
|
|
258
|
-
indicator,
|
|
259
|
-
isLocked = false,
|
|
260
|
-
isDisabled = false,
|
|
261
|
-
children,
|
|
262
|
-
onPress,
|
|
263
|
-
style,
|
|
264
|
-
customAppearance
|
|
265
|
-
}) => {
|
|
266
|
-
const context = useStepperContext();
|
|
267
|
-
const direction = context?.direction ?? "horizontal";
|
|
268
|
-
const showLines = context?.showLines ?? true;
|
|
269
|
-
const lineDisplayMode = context?.lineDisplayMode ?? "progress";
|
|
270
|
-
const groupDisabled = context?.isDisabled ?? false;
|
|
271
|
-
const size = context?.size ?? "md";
|
|
272
|
-
const themeColor = context?.themeColor ?? "primary";
|
|
273
|
-
const sizeStyles = useStepperSizeStyles(size);
|
|
274
|
-
const colors = useStepperColors(themeColor);
|
|
275
|
-
const index = context?.keys.indexOf(itemKey) ?? -1;
|
|
276
|
-
const isActive = context?.activeKey === itemKey;
|
|
277
|
-
const hasActiveStep = (context?.activeIndex ?? -1) >= 0;
|
|
278
|
-
const isCompleted = hasActiveStep && index >= 0 && index < (context?.activeIndex ?? -1);
|
|
279
|
-
const isLast = index === (context?.keys.length ?? 0) - 1;
|
|
280
|
-
const lineTargetProgress = isCompleted ? 1 : 0;
|
|
281
|
-
const lineProgress = useRef(new Animated.Value(lineTargetProgress)).current;
|
|
282
|
-
const disabled = groupDisabled || isDisabled;
|
|
283
|
-
const blocked = disabled || isLocked;
|
|
284
|
-
const indicatorState = {
|
|
285
|
-
index: Math.max(index, 0),
|
|
286
|
-
isActive,
|
|
287
|
-
isCompleted,
|
|
288
|
-
isLocked,
|
|
289
|
-
isDisabled: disabled
|
|
290
|
-
};
|
|
291
|
-
const indicatorNode = useMemo3(() => {
|
|
292
|
-
if (typeof indicator === "function") {
|
|
293
|
-
return indicator(indicatorState);
|
|
294
|
-
}
|
|
295
|
-
if (indicator !== void 0) {
|
|
296
|
-
return indicator;
|
|
297
|
-
}
|
|
298
|
-
const iconSize = Math.max(12, Math.floor(sizeStyles.indicatorSize * 0.54));
|
|
299
|
-
if (isLocked) {
|
|
300
|
-
return /* @__PURE__ */ React2.createElement(
|
|
301
|
-
LockClosedIcon,
|
|
302
|
-
{
|
|
303
|
-
key: `lock-${itemKey}-${isLocked ? "on" : "off"}`,
|
|
304
|
-
size: iconSize,
|
|
305
|
-
color: colors.lockedIndicatorText,
|
|
306
|
-
isAnimated: true
|
|
307
|
-
}
|
|
308
|
-
);
|
|
309
|
-
}
|
|
310
|
-
if (isCompleted) {
|
|
311
|
-
return /* @__PURE__ */ React2.createElement(
|
|
312
|
-
CheckmarkIcon,
|
|
313
|
-
{
|
|
314
|
-
key: `done-${itemKey}-${isCompleted ? "on" : "off"}`,
|
|
315
|
-
size: iconSize,
|
|
316
|
-
color: colors.completedIndicatorText,
|
|
317
|
-
isAnimated: true
|
|
318
|
-
}
|
|
319
|
-
);
|
|
320
|
-
}
|
|
321
|
-
return String(indicatorState.index + 1);
|
|
322
|
-
}, [
|
|
323
|
-
indicator,
|
|
324
|
-
indicatorState,
|
|
325
|
-
sizeStyles.indicatorSize,
|
|
326
|
-
isLocked,
|
|
327
|
-
isCompleted,
|
|
328
|
-
itemKey,
|
|
329
|
-
colors
|
|
330
|
-
]);
|
|
331
|
-
useEffect(() => {
|
|
332
|
-
Animated.timing(lineProgress, {
|
|
333
|
-
toValue: lineTargetProgress,
|
|
334
|
-
duration: 240,
|
|
335
|
-
useNativeDriver: true
|
|
336
|
-
}).start();
|
|
337
|
-
}, [lineProgress, lineTargetProgress]);
|
|
338
|
-
const indicatorText = isStringOrNumber(indicatorNode) ? /* @__PURE__ */ React2.createElement(
|
|
339
|
-
Text,
|
|
340
|
-
{
|
|
341
|
-
style: {
|
|
342
|
-
color: isLocked ? colors.lockedIndicatorText : isActive ? colors.activeIndicatorText : isCompleted ? colors.completedIndicatorText : colors.inactiveIndicatorText,
|
|
343
|
-
fontSize: sizeStyles.titleFontSize,
|
|
344
|
-
fontWeight: "700"
|
|
345
|
-
}
|
|
346
|
-
},
|
|
347
|
-
indicatorNode
|
|
348
|
-
) : indicatorNode;
|
|
349
|
-
const lineStyle = [
|
|
350
|
-
styles.line,
|
|
351
|
-
direction === "horizontal" ? {
|
|
352
|
-
height: sizeStyles.lineThickness,
|
|
353
|
-
marginHorizontal: sizeStyles.horizontalSpacing
|
|
354
|
-
} : {
|
|
355
|
-
width: sizeStyles.lineThickness,
|
|
356
|
-
marginVertical: sizeStyles.verticalSpacing,
|
|
357
|
-
minHeight: sizeStyles.verticalGap
|
|
358
|
-
},
|
|
359
|
-
{
|
|
360
|
-
backgroundColor: lineDisplayMode === "all" ? colors.line : "transparent"
|
|
361
|
-
},
|
|
362
|
-
context?.customAppearance?.line
|
|
363
|
-
];
|
|
364
|
-
return /* @__PURE__ */ React2.createElement(
|
|
365
|
-
Pressable,
|
|
366
|
-
{
|
|
367
|
-
onPress: () => {
|
|
368
|
-
if (blocked) return;
|
|
369
|
-
context?.onStepChange?.(itemKey);
|
|
370
|
-
onPress?.(itemKey);
|
|
371
|
-
},
|
|
372
|
-
disabled: blocked,
|
|
373
|
-
accessibilityRole: "tab",
|
|
374
|
-
accessibilityState: { selected: !!isActive, disabled: blocked },
|
|
375
|
-
style: [
|
|
376
|
-
direction === "horizontal" ? styles.horizontalItem : styles.verticalItem,
|
|
377
|
-
blocked && (isLocked ? styles.locked : styles.disabled),
|
|
378
|
-
style,
|
|
379
|
-
customAppearance?.container,
|
|
380
|
-
context?.customAppearance?.itemContainer
|
|
381
|
-
]
|
|
382
|
-
},
|
|
383
|
-
direction === "horizontal" ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(View2, { style: styles.horizontalTopRow }, /* @__PURE__ */ React2.createElement(
|
|
384
|
-
View2,
|
|
385
|
-
{
|
|
386
|
-
style: [
|
|
387
|
-
styles.indicator,
|
|
388
|
-
{
|
|
389
|
-
width: sizeStyles.indicatorSize,
|
|
390
|
-
height: sizeStyles.indicatorSize,
|
|
391
|
-
borderRadius: sizeStyles.indicatorSize / 2,
|
|
392
|
-
borderWidth: sizeStyles.indicatorBorderWidth,
|
|
393
|
-
borderColor: isLocked ? colors.lockedIndicatorBorder : isActive ? colors.activeIndicatorBorder : isCompleted ? colors.completedIndicatorBorder : colors.inactiveIndicatorBorder,
|
|
394
|
-
backgroundColor: isLocked ? colors.lockedIndicatorBackground : isActive ? colors.activeIndicatorBackground : isCompleted ? colors.completedIndicatorBackground : colors.inactiveIndicatorBackground
|
|
395
|
-
},
|
|
396
|
-
customAppearance?.indicator,
|
|
397
|
-
isActive && customAppearance?.activeIndicator,
|
|
398
|
-
isCompleted && customAppearance?.completedIndicator,
|
|
399
|
-
isLocked && customAppearance?.lockedIndicator
|
|
400
|
-
]
|
|
401
|
-
},
|
|
402
|
-
indicatorText
|
|
403
|
-
), showLines && !isLast ? /* @__PURE__ */ React2.createElement(View2, { style: lineStyle }, /* @__PURE__ */ React2.createElement(
|
|
404
|
-
View2,
|
|
405
|
-
{
|
|
406
|
-
style: [
|
|
407
|
-
styles.lineProgressWrap,
|
|
408
|
-
direction === "horizontal" ? styles.lineProgressHorizontal : styles.lineProgressVertical
|
|
409
|
-
]
|
|
410
|
-
},
|
|
411
|
-
/* @__PURE__ */ React2.createElement(
|
|
412
|
-
Animated.View,
|
|
413
|
-
{
|
|
414
|
-
style: [
|
|
415
|
-
styles.lineProgress,
|
|
416
|
-
{
|
|
417
|
-
backgroundColor: colors.activeLine,
|
|
418
|
-
transform: [
|
|
419
|
-
direction === "horizontal" ? { scaleX: lineProgress } : { scaleY: lineProgress }
|
|
420
|
-
]
|
|
421
|
-
},
|
|
422
|
-
context?.customAppearance?.activeLine
|
|
423
|
-
]
|
|
424
|
-
}
|
|
425
|
-
)
|
|
426
|
-
)) : null), /* @__PURE__ */ React2.createElement(
|
|
427
|
-
View2,
|
|
428
|
-
{
|
|
429
|
-
style: [
|
|
430
|
-
styles.horizontalContent,
|
|
431
|
-
{ marginTop: sizeStyles.verticalSpacing }
|
|
432
|
-
]
|
|
433
|
-
},
|
|
434
|
-
title ? /* @__PURE__ */ React2.createElement(
|
|
435
|
-
Text,
|
|
436
|
-
{
|
|
437
|
-
style: [
|
|
438
|
-
styles.title,
|
|
439
|
-
{
|
|
440
|
-
fontSize: sizeStyles.titleFontSize,
|
|
441
|
-
color: colors.title
|
|
442
|
-
},
|
|
443
|
-
customAppearance?.title
|
|
444
|
-
]
|
|
445
|
-
},
|
|
446
|
-
title
|
|
447
|
-
) : null,
|
|
448
|
-
description ? /* @__PURE__ */ React2.createElement(
|
|
449
|
-
Text,
|
|
450
|
-
{
|
|
451
|
-
style: [
|
|
452
|
-
styles.description,
|
|
453
|
-
{
|
|
454
|
-
fontSize: sizeStyles.descriptionFontSize,
|
|
455
|
-
color: colors.description,
|
|
456
|
-
marginTop: 2
|
|
457
|
-
},
|
|
458
|
-
customAppearance?.description
|
|
459
|
-
]
|
|
460
|
-
},
|
|
461
|
-
description
|
|
462
|
-
) : null,
|
|
463
|
-
children
|
|
464
|
-
)) : /* @__PURE__ */ React2.createElement(View2, { style: styles.verticalRow }, /* @__PURE__ */ React2.createElement(View2, { style: { alignItems: "center" } }, /* @__PURE__ */ React2.createElement(
|
|
465
|
-
View2,
|
|
466
|
-
{
|
|
467
|
-
style: [
|
|
468
|
-
styles.indicator,
|
|
469
|
-
{
|
|
470
|
-
width: sizeStyles.indicatorSize,
|
|
471
|
-
height: sizeStyles.indicatorSize,
|
|
472
|
-
borderRadius: sizeStyles.indicatorSize / 2,
|
|
473
|
-
borderWidth: sizeStyles.indicatorBorderWidth,
|
|
474
|
-
borderColor: isLocked ? colors.lockedIndicatorBorder : isActive ? colors.activeIndicatorBorder : isCompleted ? colors.completedIndicatorBorder : colors.inactiveIndicatorBorder,
|
|
475
|
-
backgroundColor: isLocked ? colors.lockedIndicatorBackground : isActive ? colors.activeIndicatorBackground : isCompleted ? colors.completedIndicatorBackground : colors.inactiveIndicatorBackground
|
|
476
|
-
},
|
|
477
|
-
customAppearance?.indicator,
|
|
478
|
-
isActive && customAppearance?.activeIndicator,
|
|
479
|
-
isCompleted && customAppearance?.completedIndicator,
|
|
480
|
-
isLocked && customAppearance?.lockedIndicator
|
|
481
|
-
]
|
|
482
|
-
},
|
|
483
|
-
indicatorText
|
|
484
|
-
), showLines && !isLast ? /* @__PURE__ */ React2.createElement(View2, { style: styles.verticalLineWrap }, /* @__PURE__ */ React2.createElement(View2, { style: lineStyle }, /* @__PURE__ */ React2.createElement(
|
|
485
|
-
View2,
|
|
486
|
-
{
|
|
487
|
-
style: [styles.lineProgressWrap, styles.lineProgressVertical]
|
|
488
|
-
},
|
|
489
|
-
/* @__PURE__ */ React2.createElement(
|
|
490
|
-
Animated.View,
|
|
491
|
-
{
|
|
492
|
-
style: [
|
|
493
|
-
styles.lineProgress,
|
|
494
|
-
{
|
|
495
|
-
backgroundColor: colors.activeLine,
|
|
496
|
-
transform: [{ scaleY: lineProgress }]
|
|
497
|
-
},
|
|
498
|
-
context?.customAppearance?.activeLine
|
|
499
|
-
]
|
|
500
|
-
}
|
|
501
|
-
)
|
|
502
|
-
))) : null), /* @__PURE__ */ React2.createElement(
|
|
503
|
-
View2,
|
|
504
|
-
{
|
|
505
|
-
style: [
|
|
506
|
-
styles.verticalContent,
|
|
507
|
-
{ paddingBottom: sizeStyles.verticalGap },
|
|
508
|
-
{ marginLeft: sizeStyles.horizontalSpacing }
|
|
509
|
-
]
|
|
510
|
-
},
|
|
511
|
-
title ? /* @__PURE__ */ React2.createElement(
|
|
512
|
-
Text,
|
|
513
|
-
{
|
|
514
|
-
style: [
|
|
515
|
-
styles.title,
|
|
516
|
-
styles.titleVertical,
|
|
517
|
-
{
|
|
518
|
-
fontSize: sizeStyles.titleFontSize,
|
|
519
|
-
color: colors.title
|
|
520
|
-
},
|
|
521
|
-
customAppearance?.title
|
|
522
|
-
]
|
|
523
|
-
},
|
|
524
|
-
title
|
|
525
|
-
) : null,
|
|
526
|
-
description ? /* @__PURE__ */ React2.createElement(
|
|
527
|
-
Text,
|
|
528
|
-
{
|
|
529
|
-
style: [
|
|
530
|
-
styles.description,
|
|
531
|
-
styles.descriptionVertical,
|
|
532
|
-
{
|
|
533
|
-
fontSize: sizeStyles.descriptionFontSize,
|
|
534
|
-
color: colors.description,
|
|
535
|
-
marginTop: 2
|
|
536
|
-
},
|
|
537
|
-
customAppearance?.description
|
|
538
|
-
]
|
|
539
|
-
},
|
|
540
|
-
description
|
|
541
|
-
) : null,
|
|
542
|
-
children
|
|
543
|
-
))
|
|
544
|
-
);
|
|
545
|
-
};
|
|
546
|
-
StepperItem.displayName = "StepperItem";
|
|
547
|
-
export {
|
|
548
|
-
Stepper,
|
|
549
|
-
StepperItem
|
|
550
|
-
};
|