@0610studio/zs-ui 0.0.1
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/.eslintrc.js +5 -0
- package/README.md +3 -0
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.9/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +43 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/kr/co/studio0610/zsui/ZsUiModule.kt +47 -0
- package/android/src/main/java/kr/co/studio0610/zsui/ZsUiView.kt +7 -0
- package/build/ZsUi.types.d.ts +7 -0
- package/build/ZsUi.types.d.ts.map +1 -0
- package/build/ZsUi.types.js +2 -0
- package/build/ZsUi.types.js.map +1 -0
- package/build/ZsUiModule.d.ts +3 -0
- package/build/ZsUiModule.d.ts.map +1 -0
- package/build/ZsUiModule.js +5 -0
- package/build/ZsUiModule.js.map +1 -0
- package/build/ZsUiModule.web.d.ts +7 -0
- package/build/ZsUiModule.web.d.ts.map +1 -0
- package/build/ZsUiModule.web.js +12 -0
- package/build/ZsUiModule.web.js.map +1 -0
- package/build/ZsUiView.d.ts +4 -0
- package/build/ZsUiView.d.ts.map +1 -0
- package/build/ZsUiView.js +7 -0
- package/build/ZsUiView.js.map +1 -0
- package/build/ZsUiView.web.d.ts +4 -0
- package/build/ZsUiView.web.d.ts.map +1 -0
- package/build/ZsUiView.web.js +7 -0
- package/build/ZsUiView.web.js.map +1 -0
- package/build/assets/SvgCheck.d.ts +7 -0
- package/build/assets/SvgCheck.d.ts.map +1 -0
- package/build/assets/SvgCheck.js +8 -0
- package/build/assets/SvgCheck.js.map +1 -0
- package/build/assets/SvgX.d.ts +6 -0
- package/build/assets/SvgX.d.ts.map +1 -0
- package/build/assets/SvgX.js +14 -0
- package/build/assets/SvgX.js.map +1 -0
- package/build/index.d.ts +5 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +10 -0
- package/build/index.js.map +1 -0
- package/build/model/types.d.ts +84 -0
- package/build/model/types.d.ts.map +1 -0
- package/build/model/types.js +11 -0
- package/build/model/types.js.map +1 -0
- package/build/model/useNotify.d.ts +5 -0
- package/build/model/useNotify.d.ts.map +1 -0
- package/build/model/useNotify.js +11 -0
- package/build/model/useNotify.js.map +1 -0
- package/build/model/useNotifyProvider.d.ts +3 -0
- package/build/model/useNotifyProvider.d.ts.map +1 -0
- package/build/model/useNotifyProvider.js +165 -0
- package/build/model/useNotifyProvider.js.map +1 -0
- package/build/model/useThemeProvider.d.ts +19 -0
- package/build/model/useThemeProvider.d.ts.map +1 -0
- package/build/model/useThemeProvider.js +73 -0
- package/build/model/useThemeProvider.js.map +1 -0
- package/build/model/utils.d.ts +12 -0
- package/build/model/utils.d.ts.map +1 -0
- package/build/model/utils.js +26 -0
- package/build/model/utils.js.map +1 -0
- package/build/notify/AlertNotify/index.d.ts +5 -0
- package/build/notify/AlertNotify/index.d.ts.map +1 -0
- package/build/notify/AlertNotify/index.js +109 -0
- package/build/notify/AlertNotify/index.js.map +1 -0
- package/build/notify/BottomSheetNotify/index.d.ts +19 -0
- package/build/notify/BottomSheetNotify/index.d.ts.map +1 -0
- package/build/notify/BottomSheetNotify/index.js +90 -0
- package/build/notify/BottomSheetNotify/index.js.map +1 -0
- package/build/notify/BottomSheetNotify/model/useBottomSheetNotify.d.ts +43 -0
- package/build/notify/BottomSheetNotify/model/useBottomSheetNotify.d.ts.map +1 -0
- package/build/notify/BottomSheetNotify/model/useBottomSheetNotify.js +222 -0
- package/build/notify/BottomSheetNotify/model/useBottomSheetNotify.js.map +1 -0
- package/build/notify/BottomSheetNotify/types/index.d.ts +4 -0
- package/build/notify/BottomSheetNotify/types/index.d.ts.map +1 -0
- package/build/notify/BottomSheetNotify/types/index.js +2 -0
- package/build/notify/BottomSheetNotify/types/index.js.map +1 -0
- package/build/notify/BottomSheetNotify/ui/BSTextInput/index.d.ts +4 -0
- package/build/notify/BottomSheetNotify/ui/BSTextInput/index.d.ts.map +1 -0
- package/build/notify/BottomSheetNotify/ui/BSTextInput/index.js +14 -0
- package/build/notify/BottomSheetNotify/ui/BSTextInput/index.js.map +1 -0
- package/build/notify/BottomSheetNotify/ui/ContentsComponent/index.d.ts +19 -0
- package/build/notify/BottomSheetNotify/ui/ContentsComponent/index.d.ts.map +1 -0
- package/build/notify/BottomSheetNotify/ui/ContentsComponent/index.js +33 -0
- package/build/notify/BottomSheetNotify/ui/ContentsComponent/index.js.map +1 -0
- package/build/notify/LoadingNotify/index.d.ts +6 -0
- package/build/notify/LoadingNotify/index.d.ts.map +1 -0
- package/build/notify/LoadingNotify/index.js +28 -0
- package/build/notify/LoadingNotify/index.js.map +1 -0
- package/build/notify/PopOver/PopOverButton.d.ts +11 -0
- package/build/notify/PopOver/PopOverButton.d.ts.map +1 -0
- package/build/notify/PopOver/PopOverButton.js +31 -0
- package/build/notify/PopOver/PopOverButton.js.map +1 -0
- package/build/notify/PopOver/PopOverMenu.d.ts +4 -0
- package/build/notify/PopOver/PopOverMenu.d.ts.map +1 -0
- package/build/notify/PopOver/PopOverMenu.js +69 -0
- package/build/notify/PopOver/PopOverMenu.js.map +1 -0
- package/build/notify/SnackbarNotify/index.d.ts +7 -0
- package/build/notify/SnackbarNotify/index.d.ts.map +1 -0
- package/build/notify/SnackbarNotify/index.js +24 -0
- package/build/notify/SnackbarNotify/index.js.map +1 -0
- package/build/notify/SnackbarNotify/ui/SnackbarItem.d.ts +9 -0
- package/build/notify/SnackbarNotify/ui/SnackbarItem.d.ts.map +1 -0
- package/build/notify/SnackbarNotify/ui/SnackbarItem.js +72 -0
- package/build/notify/SnackbarNotify/ui/SnackbarItem.js.map +1 -0
- package/build/notify/index.d.ts +11 -0
- package/build/notify/index.d.ts.map +1 -0
- package/build/notify/index.js +11 -0
- package/build/notify/index.js.map +1 -0
- package/build/notify/ui/ModalBackground.d.ts +9 -0
- package/build/notify/ui/ModalBackground.d.ts.map +1 -0
- package/build/notify/ui/ModalBackground.js +27 -0
- package/build/notify/ui/ModalBackground.js.map +1 -0
- package/build/theme/index.d.ts +4 -0
- package/build/theme/index.d.ts.map +1 -0
- package/build/theme/index.js +4 -0
- package/build/theme/index.js.map +1 -0
- package/build/theme/palette.d.ts +62 -0
- package/build/theme/palette.d.ts.map +1 -0
- package/build/theme/palette.js +353 -0
- package/build/theme/palette.js.map +1 -0
- package/build/theme/types.d.ts +101 -0
- package/build/theme/types.d.ts.map +1 -0
- package/build/theme/types.js +5 -0
- package/build/theme/types.js.map +1 -0
- package/build/theme/typography.d.ts +5 -0
- package/build/theme/typography.d.ts.map +1 -0
- package/build/theme/typography.js +198 -0
- package/build/theme/typography.js.map +1 -0
- package/build/ui/ThrottleButton/index.d.ts +15 -0
- package/build/ui/ThrottleButton/index.d.ts.map +1 -0
- package/build/ui/ThrottleButton/index.js +74 -0
- package/build/ui/ThrottleButton/index.js.map +1 -0
- package/build/ui/ZSBottomButton/index.d.ts +16 -0
- package/build/ui/ZSBottomButton/index.d.ts.map +1 -0
- package/build/ui/ZSBottomButton/index.js +89 -0
- package/build/ui/ZSBottomButton/index.js.map +1 -0
- package/build/ui/ZSContainer/index.d.ts +19 -0
- package/build/ui/ZSContainer/index.d.ts.map +1 -0
- package/build/ui/ZSContainer/index.js +37 -0
- package/build/ui/ZSContainer/index.js.map +1 -0
- package/build/ui/ZSPressable/index.d.ts +17 -0
- package/build/ui/ZSPressable/index.d.ts.map +1 -0
- package/build/ui/ZSPressable/index.js +35 -0
- package/build/ui/ZSPressable/index.js.map +1 -0
- package/build/ui/ZSRadioGroup/index.d.ts +18 -0
- package/build/ui/ZSRadioGroup/index.d.ts.map +1 -0
- package/build/ui/ZSRadioGroup/index.js +82 -0
- package/build/ui/ZSRadioGroup/index.js.map +1 -0
- package/build/ui/ZSText/index.d.ts +11 -0
- package/build/ui/ZSText/index.d.ts.map +1 -0
- package/build/ui/ZSText/index.js +10 -0
- package/build/ui/ZSText/index.js.map +1 -0
- package/build/ui/ZSTextField/index.d.ts +31 -0
- package/build/ui/ZSTextField/index.d.ts.map +1 -0
- package/build/ui/ZSTextField/index.js +102 -0
- package/build/ui/ZSTextField/index.js.map +1 -0
- package/build/ui/ZSTextField/ui/ButtonClose.d.ts +6 -0
- package/build/ui/ZSTextField/ui/ButtonClose.d.ts.map +1 -0
- package/build/ui/ZSTextField/ui/ButtonClose.js +9 -0
- package/build/ui/ZSTextField/ui/ButtonClose.js.map +1 -0
- package/build/ui/ZSTextField/ui/ErrorComponent.d.ts +7 -0
- package/build/ui/ZSTextField/ui/ErrorComponent.d.ts.map +1 -0
- package/build/ui/ZSTextField/ui/ErrorComponent.js +16 -0
- package/build/ui/ZSTextField/ui/ErrorComponent.js.map +1 -0
- package/build/ui/ZSView/index.d.ts +8 -0
- package/build/ui/ZSView/index.d.ts.map +1 -0
- package/build/ui/ZSView/index.js +17 -0
- package/build/ui/ZSView/index.js.map +1 -0
- package/build/ui/atoms/AnimatedWrapper.d.ts +12 -0
- package/build/ui/atoms/AnimatedWrapper.d.ts.map +1 -0
- package/build/ui/atoms/AnimatedWrapper.js +61 -0
- package/build/ui/atoms/AnimatedWrapper.js.map +1 -0
- package/build/ui/atoms/ScrollViewAtom.d.ts +5 -0
- package/build/ui/atoms/ScrollViewAtom.d.ts.map +1 -0
- package/build/ui/atoms/ScrollViewAtom.js +10 -0
- package/build/ui/atoms/ScrollViewAtom.js.map +1 -0
- package/build/ui/atoms/TextAtom.d.ts +6 -0
- package/build/ui/atoms/TextAtom.d.ts.map +1 -0
- package/build/ui/atoms/TextAtom.js +9 -0
- package/build/ui/atoms/TextAtom.js.map +1 -0
- package/build/ui/atoms/ViewAtom.d.ts +6 -0
- package/build/ui/atoms/ViewAtom.d.ts.map +1 -0
- package/build/ui/atoms/ViewAtom.js +9 -0
- package/build/ui/atoms/ViewAtom.js.map +1 -0
- package/build/ui/index.d.ts +14 -0
- package/build/ui/index.d.ts.map +1 -0
- package/build/ui/index.js +14 -0
- package/build/ui/index.js.map +1 -0
- package/build/ui/types.d.ts +14 -0
- package/build/ui/types.d.ts.map +1 -0
- package/build/ui/types.js +2 -0
- package/build/ui/types.js.map +1 -0
- package/expo-module.config.json +9 -0
- package/ios/ZsUi.podspec +27 -0
- package/ios/ZsUiModule.swift +44 -0
- package/ios/ZsUiView.swift +7 -0
- package/package.json +54 -0
- package/src/ZsUi.types.ts +7 -0
- package/src/ZsUiModule.ts +5 -0
- package/src/ZsUiModule.web.ts +13 -0
- package/src/ZsUiView.tsx +11 -0
- package/src/ZsUiView.web.tsx +11 -0
- package/src/assets/SvgCheck.tsx +16 -0
- package/src/assets/SvgX.tsx +22 -0
- package/src/index.ts +52 -0
- package/src/model/types.ts +102 -0
- package/src/model/useNotify.ts +14 -0
- package/src/model/useNotifyProvider.tsx +251 -0
- package/src/model/useThemeProvider.tsx +99 -0
- package/src/model/utils.ts +31 -0
- package/src/notify/AlertNotify/index.tsx +177 -0
- package/src/notify/BottomSheetNotify/index.tsx +177 -0
- package/src/notify/BottomSheetNotify/model/useBottomSheetNotify.tsx +270 -0
- package/src/notify/BottomSheetNotify/types/index.ts +3 -0
- package/src/notify/BottomSheetNotify/ui/BSTextInput/index.tsx +28 -0
- package/src/notify/BottomSheetNotify/ui/ContentsComponent/index.tsx +76 -0
- package/src/notify/LoadingNotify/index.tsx +46 -0
- package/src/notify/PopOver/PopOverButton.tsx +56 -0
- package/src/notify/PopOver/PopOverMenu.tsx +95 -0
- package/src/notify/SnackbarNotify/index.tsx +43 -0
- package/src/notify/SnackbarNotify/ui/SnackbarItem.tsx +103 -0
- package/src/notify/index.ts +21 -0
- package/src/notify/ui/ModalBackground.tsx +46 -0
- package/src/theme/index.ts +3 -0
- package/src/theme/palette.ts +374 -0
- package/src/theme/types.ts +150 -0
- package/src/theme/typography.ts +199 -0
- package/src/ui/ThrottleButton/index.tsx +119 -0
- package/src/ui/ZSBottomButton/index.tsx +151 -0
- package/src/ui/ZSContainer/index.tsx +92 -0
- package/src/ui/ZSPressable/index.tsx +82 -0
- package/src/ui/ZSRadioGroup/index.tsx +141 -0
- package/src/ui/ZSText/index.tsx +22 -0
- package/src/ui/ZSTextField/index.tsx +200 -0
- package/src/ui/ZSTextField/ui/ButtonClose.tsx +20 -0
- package/src/ui/ZSTextField/ui/ErrorComponent.tsx +25 -0
- package/src/ui/ZSView/index.tsx +30 -0
- package/src/ui/atoms/AnimatedWrapper.tsx +89 -0
- package/src/ui/atoms/ScrollViewAtom.tsx +17 -0
- package/src/ui/atoms/TextAtom.tsx +15 -0
- package/src/ui/atoms/ViewAtom.tsx +15 -0
- package/src/ui/index.ts +27 -0
- package/src/ui/types.ts +12 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
export default function typography({ themeFonts }) {
|
|
2
|
+
return {
|
|
3
|
+
themeFonts: themeFonts,
|
|
4
|
+
heading: {
|
|
5
|
+
1: {
|
|
6
|
+
fontSize: 64,
|
|
7
|
+
fontFamily: themeFonts?.[700],
|
|
8
|
+
letterSpacing: 1
|
|
9
|
+
},
|
|
10
|
+
2: {
|
|
11
|
+
fontSize: 48,
|
|
12
|
+
fontFamily: themeFonts?.[700],
|
|
13
|
+
letterSpacing: 1
|
|
14
|
+
},
|
|
15
|
+
3: {
|
|
16
|
+
fontSize: 32,
|
|
17
|
+
fontFamily: themeFonts?.[700],
|
|
18
|
+
letterSpacing: 1
|
|
19
|
+
},
|
|
20
|
+
4: {
|
|
21
|
+
fontSize: 24,
|
|
22
|
+
fontFamily: themeFonts?.[700],
|
|
23
|
+
letterSpacing: 1
|
|
24
|
+
},
|
|
25
|
+
5: {
|
|
26
|
+
fontSize: 20,
|
|
27
|
+
fontFamily: themeFonts?.[700],
|
|
28
|
+
letterSpacing: 1
|
|
29
|
+
},
|
|
30
|
+
6: {
|
|
31
|
+
fontSize: 18,
|
|
32
|
+
fontFamily: themeFonts?.[700],
|
|
33
|
+
letterSpacing: 1
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
title: {
|
|
37
|
+
1: {
|
|
38
|
+
fontSize: 16,
|
|
39
|
+
fontFamily: themeFonts?.[800],
|
|
40
|
+
letterSpacing: 1
|
|
41
|
+
},
|
|
42
|
+
2: {
|
|
43
|
+
fontSize: 14,
|
|
44
|
+
fontFamily: themeFonts?.[800],
|
|
45
|
+
letterSpacing: 1
|
|
46
|
+
},
|
|
47
|
+
3: {
|
|
48
|
+
fontSize: 12,
|
|
49
|
+
fontFamily: themeFonts?.[800],
|
|
50
|
+
letterSpacing: 1
|
|
51
|
+
},
|
|
52
|
+
4: {
|
|
53
|
+
fontSize: 10,
|
|
54
|
+
fontFamily: themeFonts?.[800],
|
|
55
|
+
letterSpacing: 1
|
|
56
|
+
},
|
|
57
|
+
5: {
|
|
58
|
+
fontSize: 9,
|
|
59
|
+
fontFamily: themeFonts?.[800],
|
|
60
|
+
letterSpacing: 1
|
|
61
|
+
},
|
|
62
|
+
6: {
|
|
63
|
+
fontSize: 8,
|
|
64
|
+
fontFamily: themeFonts?.[800],
|
|
65
|
+
letterSpacing: 1
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
subTitle: {
|
|
69
|
+
1: {
|
|
70
|
+
fontSize: 16,
|
|
71
|
+
fontFamily: themeFonts?.[700],
|
|
72
|
+
letterSpacing: 1
|
|
73
|
+
},
|
|
74
|
+
2: {
|
|
75
|
+
fontSize: 14,
|
|
76
|
+
fontFamily: themeFonts?.[700],
|
|
77
|
+
letterSpacing: 1
|
|
78
|
+
},
|
|
79
|
+
3: {
|
|
80
|
+
fontSize: 12,
|
|
81
|
+
fontFamily: themeFonts?.[700],
|
|
82
|
+
letterSpacing: 1
|
|
83
|
+
},
|
|
84
|
+
4: {
|
|
85
|
+
fontSize: 10,
|
|
86
|
+
fontFamily: themeFonts?.[700],
|
|
87
|
+
letterSpacing: 1
|
|
88
|
+
},
|
|
89
|
+
5: {
|
|
90
|
+
fontSize: 9,
|
|
91
|
+
fontFamily: themeFonts?.[700],
|
|
92
|
+
letterSpacing: 1
|
|
93
|
+
},
|
|
94
|
+
6: {
|
|
95
|
+
fontSize: 8,
|
|
96
|
+
fontFamily: themeFonts?.[700],
|
|
97
|
+
letterSpacing: 1
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
label: {
|
|
101
|
+
1: {
|
|
102
|
+
fontSize: 16,
|
|
103
|
+
fontFamily: themeFonts?.[600],
|
|
104
|
+
letterSpacing: 1
|
|
105
|
+
},
|
|
106
|
+
2: {
|
|
107
|
+
fontSize: 14,
|
|
108
|
+
fontFamily: themeFonts?.[600],
|
|
109
|
+
letterSpacing: 1
|
|
110
|
+
},
|
|
111
|
+
3: {
|
|
112
|
+
fontSize: 13,
|
|
113
|
+
fontFamily: themeFonts?.[600],
|
|
114
|
+
letterSpacing: 1
|
|
115
|
+
},
|
|
116
|
+
4: {
|
|
117
|
+
fontSize: 12,
|
|
118
|
+
fontFamily: themeFonts?.[600],
|
|
119
|
+
letterSpacing: 1
|
|
120
|
+
},
|
|
121
|
+
5: {
|
|
122
|
+
fontSize: 11,
|
|
123
|
+
fontFamily: themeFonts?.[600],
|
|
124
|
+
letterSpacing: 1
|
|
125
|
+
},
|
|
126
|
+
6: {
|
|
127
|
+
fontSize: 10,
|
|
128
|
+
fontFamily: themeFonts?.[600],
|
|
129
|
+
letterSpacing: 1
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
body: {
|
|
133
|
+
1: {
|
|
134
|
+
fontSize: 16,
|
|
135
|
+
fontFamily: themeFonts?.[400],
|
|
136
|
+
letterSpacing: 1
|
|
137
|
+
},
|
|
138
|
+
2: {
|
|
139
|
+
fontSize: 14,
|
|
140
|
+
fontFamily: themeFonts?.[400],
|
|
141
|
+
letterSpacing: 1
|
|
142
|
+
},
|
|
143
|
+
3: {
|
|
144
|
+
fontSize: 13,
|
|
145
|
+
fontFamily: themeFonts?.[400],
|
|
146
|
+
letterSpacing: 1
|
|
147
|
+
},
|
|
148
|
+
4: {
|
|
149
|
+
fontSize: 12,
|
|
150
|
+
fontFamily: themeFonts?.[400],
|
|
151
|
+
letterSpacing: 1
|
|
152
|
+
},
|
|
153
|
+
5: {
|
|
154
|
+
fontSize: 11,
|
|
155
|
+
fontFamily: themeFonts?.[400],
|
|
156
|
+
letterSpacing: 1
|
|
157
|
+
},
|
|
158
|
+
6: {
|
|
159
|
+
fontSize: 10,
|
|
160
|
+
fontFamily: themeFonts?.[400],
|
|
161
|
+
letterSpacing: 1
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
caption: {
|
|
165
|
+
1: {
|
|
166
|
+
fontSize: 12,
|
|
167
|
+
fontFamily: themeFonts?.[400],
|
|
168
|
+
letterSpacing: 1
|
|
169
|
+
},
|
|
170
|
+
2: {
|
|
171
|
+
fontSize: 11,
|
|
172
|
+
fontFamily: themeFonts?.[400],
|
|
173
|
+
letterSpacing: 1
|
|
174
|
+
},
|
|
175
|
+
3: {
|
|
176
|
+
fontSize: 10,
|
|
177
|
+
fontFamily: themeFonts?.[400],
|
|
178
|
+
letterSpacing: 1
|
|
179
|
+
},
|
|
180
|
+
4: {
|
|
181
|
+
fontSize: 9,
|
|
182
|
+
fontFamily: themeFonts?.[400],
|
|
183
|
+
letterSpacing: 1
|
|
184
|
+
},
|
|
185
|
+
5: {
|
|
186
|
+
fontSize: 8,
|
|
187
|
+
fontFamily: themeFonts?.[400],
|
|
188
|
+
letterSpacing: 1
|
|
189
|
+
},
|
|
190
|
+
6: {
|
|
191
|
+
fontSize: 7,
|
|
192
|
+
fontFamily: themeFonts?.[400],
|
|
193
|
+
letterSpacing: 1
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=typography.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.js","sourceRoot":"","sources":["../../src/theme/typography.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,UAAU,EAA+B;IAC1E,OAAO;QACH,UAAU,EAAE,UAAU;QACtB,OAAO,EAAE;YACL,CAAC,EAAE;gBACC,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;YACD,CAAC,EAAE;gBACC,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;YACD,CAAC,EAAE;gBACC,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;YACD,CAAC,EAAE;gBACC,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;YACD,CAAC,EAAE;gBACC,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;YACD,CAAC,EAAE;gBACC,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;SACJ;QACD,KAAK,EAAE;YACH,CAAC,EAAE;gBACC,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;YACD,CAAC,EAAE;gBACC,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,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Q,EAAE,EAAE;gBACZ,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;YACD,CAAC,EAAE;gBACC,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;YACD,CAAC,EAAE;gBACC,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;SACJ;QACD,OAAO,EAAE;YACL,CAAC,EAAE;gBACC,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;YACD,CAAC,EAAE;gBACC,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;YACD,CAAC,EAAE;gBACC,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;YACD,CAAC,EAAE;gBACC,QAAQ,EAAE,CAAC;gBACX,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;YACD,CAAC,EAAE;gBACC,QAAQ,EAAE,CAAC;gBACX,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;YACD,CAAC,EAAE;gBACC,QAAQ,EAAE,CAAC;gBACX,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC;gBAC7B,aAAa,EAAE,CAAC;aACnB;SACJ;KACJ,CAAA;AACL,CAAC","sourcesContent":["import { ThemeFonts, TypographyVariantsProps } from \"./types\";\n\nexport default function typography({ themeFonts }: { themeFonts?: ThemeFonts }): TypographyVariantsProps {\n return {\n themeFonts: themeFonts,\n heading: {\n 1: {\n fontSize: 64,\n fontFamily: themeFonts?.[700],\n letterSpacing: 1\n },\n 2: {\n fontSize: 48,\n fontFamily: themeFonts?.[700],\n letterSpacing: 1\n },\n 3: {\n fontSize: 32,\n fontFamily: themeFonts?.[700],\n letterSpacing: 1\n },\n 4: {\n fontSize: 24,\n fontFamily: themeFonts?.[700],\n letterSpacing: 1\n },\n 5: {\n fontSize: 20,\n fontFamily: themeFonts?.[700],\n letterSpacing: 1\n },\n 6: {\n fontSize: 18,\n fontFamily: themeFonts?.[700],\n letterSpacing: 1\n }\n },\n title: {\n 1: {\n fontSize: 16,\n fontFamily: themeFonts?.[800],\n letterSpacing: 1\n },\n 2: {\n fontSize: 14,\n fontFamily: themeFonts?.[800],\n letterSpacing: 1\n },\n 3: {\n fontSize: 12,\n fontFamily: themeFonts?.[800],\n letterSpacing: 1\n },\n 4: {\n fontSize: 10,\n fontFamily: themeFonts?.[800],\n letterSpacing: 1\n },\n 5: {\n fontSize: 9,\n fontFamily: themeFonts?.[800],\n letterSpacing: 1\n },\n 6: {\n fontSize: 8,\n fontFamily: themeFonts?.[800],\n letterSpacing: 1\n }\n },\n subTitle: {\n 1: {\n fontSize: 16,\n fontFamily: themeFonts?.[700],\n letterSpacing: 1\n },\n 2: {\n fontSize: 14,\n fontFamily: themeFonts?.[700],\n letterSpacing: 1\n },\n 3: {\n fontSize: 12,\n fontFamily: themeFonts?.[700],\n letterSpacing: 1\n },\n 4: {\n fontSize: 10,\n fontFamily: themeFonts?.[700],\n letterSpacing: 1\n },\n 5: {\n fontSize: 9,\n fontFamily: themeFonts?.[700],\n letterSpacing: 1\n },\n 6: {\n fontSize: 8,\n fontFamily: themeFonts?.[700],\n letterSpacing: 1\n }\n },\n label: {\n 1: {\n fontSize: 16,\n fontFamily: themeFonts?.[600],\n letterSpacing: 1\n },\n 2: {\n fontSize: 14,\n fontFamily: themeFonts?.[600],\n letterSpacing: 1\n },\n 3: {\n fontSize: 13,\n fontFamily: themeFonts?.[600],\n letterSpacing: 1\n },\n 4: {\n fontSize: 12,\n fontFamily: themeFonts?.[600],\n letterSpacing: 1\n },\n 5: {\n fontSize: 11,\n fontFamily: themeFonts?.[600],\n letterSpacing: 1\n },\n 6: {\n fontSize: 10,\n fontFamily: themeFonts?.[600],\n letterSpacing: 1\n }\n },\n body: {\n 1: {\n fontSize: 16,\n fontFamily: themeFonts?.[400],\n letterSpacing: 1\n },\n 2: {\n fontSize: 14,\n fontFamily: themeFonts?.[400],\n letterSpacing: 1\n },\n 3: {\n fontSize: 13,\n fontFamily: themeFonts?.[400],\n letterSpacing: 1\n },\n 4: {\n fontSize: 12,\n fontFamily: themeFonts?.[400],\n letterSpacing: 1\n },\n 5: {\n fontSize: 11,\n fontFamily: themeFonts?.[400],\n letterSpacing: 1\n },\n 6: {\n fontSize: 10,\n fontFamily: themeFonts?.[400],\n letterSpacing: 1\n }\n },\n caption: {\n 1: {\n fontSize: 12,\n fontFamily: themeFonts?.[400],\n letterSpacing: 1\n },\n 2: {\n fontSize: 11,\n fontFamily: themeFonts?.[400],\n letterSpacing: 1\n },\n 3: {\n fontSize: 10,\n fontFamily: themeFonts?.[400],\n letterSpacing: 1\n },\n 4: {\n fontSize: 9,\n fontFamily: themeFonts?.[400],\n letterSpacing: 1\n },\n 5: {\n fontSize: 8,\n fontFamily: themeFonts?.[400],\n letterSpacing: 1\n },\n 6: {\n fontSize: 7,\n fontFamily: themeFonts?.[400],\n letterSpacing: 1\n }\n },\n }\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TouchableOpacityProps } from 'react-native';
|
|
3
|
+
interface ThrottleButtonProps extends TouchableOpacityProps {
|
|
4
|
+
loadingComponent?: React.ReactNode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
primaryOnPress: () => Promise<void>;
|
|
7
|
+
primaryLabelComponent: React.ReactNode;
|
|
8
|
+
primaryButtonStyle?: TouchableOpacityProps['style'];
|
|
9
|
+
marginHorizontal?: number;
|
|
10
|
+
marginBottom?: number;
|
|
11
|
+
onError?: (error: Error) => void;
|
|
12
|
+
}
|
|
13
|
+
declare function ThrottleButton({ loadingComponent, disabled, primaryOnPress, primaryLabelComponent, primaryButtonStyle, marginHorizontal, marginBottom, onError, ...touchableProps }: ThrottleButtonProps): React.JSX.Element;
|
|
14
|
+
export default ThrottleButton;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ThrottleButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAAmD,qBAAqB,EAAQ,MAAM,cAAc,CAAC;AAY5G,UAAU,mBAAoB,SAAQ,qBAAqB;IACvD,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,qBAAqB,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,kBAAkB,CAAC,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACpD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACpC;AAkDD,iBAAS,cAAc,CAAC,EACpB,gBAAwC,EACxC,QAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,kBAAuB,EACvB,gBAAgB,EAChB,YAAoC,EACpC,OAAO,EACP,GAAG,cAAc,EACpB,EAAE,mBAAmB,qBAgBrB;AAoBD,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { ActivityIndicator, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
|
+
const DEFAULT_MARGIN_X = 20;
|
|
4
|
+
const DEFAULT_MARGIN_TOP = 0;
|
|
5
|
+
const DEFAULT_MARGIN_BOTTOM = 20;
|
|
6
|
+
const DEFAULT_BORDER_RADIUS = 8;
|
|
7
|
+
const TIME_CONSTANTS = {
|
|
8
|
+
debounce: 300,
|
|
9
|
+
throttle: 2000,
|
|
10
|
+
};
|
|
11
|
+
const useAsyncButton = (onPress, onError) => {
|
|
12
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
13
|
+
const lastClickTime = useRef(0);
|
|
14
|
+
const isMounted = useRef(true);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
return () => {
|
|
17
|
+
isMounted.current = false;
|
|
18
|
+
};
|
|
19
|
+
}, []);
|
|
20
|
+
const handlePress = useCallback(async () => {
|
|
21
|
+
const now = Date.now();
|
|
22
|
+
if (now - lastClickTime.current < TIME_CONSTANTS.debounce) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (isLoading) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
lastClickTime.current = now;
|
|
29
|
+
try {
|
|
30
|
+
setIsLoading(true);
|
|
31
|
+
await onPress();
|
|
32
|
+
await new Promise(resolve => setTimeout(resolve, TIME_CONSTANTS.throttle));
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
if (error instanceof Error && onError) {
|
|
36
|
+
onError(error);
|
|
37
|
+
}
|
|
38
|
+
console.error('ThrottleButton error:', error);
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
if (isMounted.current) {
|
|
42
|
+
setIsLoading(false);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, [onPress, onError, isLoading]);
|
|
46
|
+
return { isLoading, handlePress };
|
|
47
|
+
};
|
|
48
|
+
function ThrottleButton({ loadingComponent = <ActivityIndicator />, disabled = false, primaryOnPress, primaryLabelComponent, primaryButtonStyle = {}, marginHorizontal, marginBottom = DEFAULT_MARGIN_BOTTOM, onError, ...touchableProps }) {
|
|
49
|
+
const { isLoading, handlePress } = useAsyncButton(primaryOnPress, onError);
|
|
50
|
+
return (<View style={[styles.container, { marginHorizontal: marginHorizontal ?? DEFAULT_MARGIN_X, marginBottom }]}>
|
|
51
|
+
<TouchableOpacity activeOpacity={0.7} style={[primaryButtonStyle, styles.touchContainer, { opacity: isLoading ? 0.4 : 1 }]} onPress={handlePress} disabled={disabled || isLoading} {...touchableProps}>
|
|
52
|
+
{isLoading ? loadingComponent : primaryLabelComponent}
|
|
53
|
+
</TouchableOpacity>
|
|
54
|
+
</View>);
|
|
55
|
+
}
|
|
56
|
+
const styles = StyleSheet.create({
|
|
57
|
+
touchContainer: {
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
alignItems: 'center',
|
|
60
|
+
flex: 1
|
|
61
|
+
},
|
|
62
|
+
container: {
|
|
63
|
+
justifyContent: 'center',
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
borderRadius: DEFAULT_BORDER_RADIUS,
|
|
66
|
+
marginTop: DEFAULT_MARGIN_TOP,
|
|
67
|
+
marginBottom: DEFAULT_MARGIN_BOTTOM,
|
|
68
|
+
overflow: 'hidden',
|
|
69
|
+
flexDirection: 'row',
|
|
70
|
+
flex: 1
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
export default ThrottleButton;
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ThrottleButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,gBAAgB,EAAyB,IAAI,EAAE,MAAM,cAAc,CAAC;AAE5G,MAAM,gBAAg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AAC,CAAC,qBAAqB,CACzD;YAAA,EAAE,gBAAgB,CACtB;QAAA,EAAE,IAAI,CAAC,CACV,CAAC;AACN,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC7B,cAAc,EAAE;QACZ,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,IAAI,EAAE,CAAC;KACV;IACD,SAAS,EAAE;QACP,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,YAAY,EAAE,qBAAqB;QACnC,SAAS,EAAE,kBAAkB;QAC7B,YAAY,EAAE,qBAAqB;QACnC,QAAQ,EAAE,QAAQ;QAClB,aAAa,EAAE,KAAK;QACpB,IAAI,EAAE,CAAC;KACV;CACJ,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC","sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { ActivityIndicator, StyleSheet, TouchableOpacity, TouchableOpacityProps, View } from 'react-native';\n\nconst DEFAULT_MARGIN_X = 20;\nconst DEFAULT_MARGIN_TOP = 0;\nconst DEFAULT_MARGIN_BOTTOM = 20;\nconst DEFAULT_BORDER_RADIUS = 8;\n\nconst TIME_CONSTANTS = {\n debounce: 300,\n throttle: 2000,\n} as const;\n\ninterface ThrottleButtonProps extends TouchableOpacityProps {\n loadingComponent?: React.ReactNode;\n disabled?: boolean;\n primaryOnPress: () => Promise<void>;\n primaryLabelComponent: React.ReactNode;\n primaryButtonStyle?: TouchableOpacityProps['style'];\n marginHorizontal?: number;\n marginBottom?: number;\n onError?: (error: Error) => void;\n}\n\nconst useAsyncButton = (\n onPress: () => Promise<void>,\n onError?: (error: Error) => void\n) => {\n const [isLoading, setIsLoading] = useState(false);\n const lastClickTime = useRef<number>(0);\n const isMounted = useRef<boolean>(true);\n\n useEffect(() => {\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n const handlePress = useCallback(async () => {\n const now = Date.now();\n\n if (now - lastClickTime.current < TIME_CONSTANTS.debounce) {\n return;\n }\n\n if (isLoading) {\n return;\n }\n\n lastClickTime.current = now;\n\n try {\n setIsLoading(true);\n await onPress();\n await new Promise(resolve =>\n setTimeout(resolve, TIME_CONSTANTS.throttle)\n );\n } catch (error: unknown) {\n if (error instanceof Error && onError) {\n onError(error);\n }\n console.error('ThrottleButton error:', error);\n } finally {\n if (isMounted.current) {\n setIsLoading(false);\n }\n }\n }, [onPress, onError, isLoading]);\n\n return { isLoading, handlePress };\n};\n\nfunction ThrottleButton({\n loadingComponent = <ActivityIndicator />,\n disabled = false,\n primaryOnPress,\n primaryLabelComponent,\n primaryButtonStyle = {},\n marginHorizontal,\n marginBottom = DEFAULT_MARGIN_BOTTOM,\n onError,\n ...touchableProps\n}: ThrottleButtonProps) {\n const { isLoading, handlePress } = useAsyncButton(primaryOnPress, onError);\n\n return (\n <View style={[styles.container, { marginHorizontal: marginHorizontal ?? DEFAULT_MARGIN_X, marginBottom }]}>\n <TouchableOpacity\n activeOpacity={0.7}\n style={[primaryButtonStyle, styles.touchContainer, { opacity: isLoading ? 0.4 : 1 }]}\n onPress={handlePress}\n disabled={disabled || isLoading}\n {...touchableProps}\n >\n {isLoading ? loadingComponent : primaryLabelComponent}\n </TouchableOpacity>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n touchContainer: {\n justifyContent: 'center',\n alignItems: 'center',\n flex: 1\n },\n container: {\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: DEFAULT_BORDER_RADIUS,\n marginTop: DEFAULT_MARGIN_TOP,\n marginBottom: DEFAULT_MARGIN_BOTTOM,\n overflow: 'hidden',\n flexDirection: 'row',\n flex: 1\n },\n});\n\nexport default ThrottleButton;\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TouchableOpacityProps } from "react-native";
|
|
3
|
+
interface Props {
|
|
4
|
+
loadingComponent?: React.ReactNode;
|
|
5
|
+
height?: number;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
primaryOnPress: () => Promise<any>;
|
|
8
|
+
primaryLabelComponent: React.ReactNode;
|
|
9
|
+
primaryButtonStyle?: TouchableOpacityProps['style'];
|
|
10
|
+
secondaryOnPress?: () => void;
|
|
11
|
+
secondaryLabelComponent?: React.ReactNode;
|
|
12
|
+
secondaryButtonStyle?: TouchableOpacityProps['style'];
|
|
13
|
+
}
|
|
14
|
+
declare function ZSBottomButton({ loadingComponent, height, disabled, primaryLabelComponent, primaryOnPress, primaryButtonStyle, secondaryOnPress, secondaryLabelComponent, secondaryButtonStyle }: Props): React.JSX.Element;
|
|
15
|
+
export default ZSBottomButton;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ZSBottomButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAAuE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAU1H,UAAU,KAAK;IACb,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,qBAAqB,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,kBAAkB,CAAC,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACpD,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,uBAAuB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1C,oBAAoB,CAAC,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC;CACvD;AAED,iBAAS,cAAc,CAAC,EACtB,gBAAwC,EACxC,MAAW,EACX,QAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,kBAAuB,EACvB,gBAAgB,EAChB,uBAAuB,EACvB,oBAAyB,EAC1B,EAAE,KAAK,qBA2FP;AA0BD,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { ActivityIndicator, Keyboard, Platform, StyleSheet, TouchableOpacity } from "react-native";
|
|
3
|
+
import Animated, { interpolate, useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
4
|
+
import { withPromise } from "../../model/utils";
|
|
5
|
+
const DEFAULT_MARGIN_X = 20;
|
|
6
|
+
const DEFAULT_MARGIN_TOP = 0;
|
|
7
|
+
const DEFAULT_MARGIN_BOTTOM = 20;
|
|
8
|
+
const DEFAULT_BORDER_RADIUS = 14;
|
|
9
|
+
const DURATION = { duration: 250 };
|
|
10
|
+
function ZSBottomButton({ loadingComponent = <ActivityIndicator />, height = 55, disabled = false, primaryLabelComponent, primaryOnPress, primaryButtonStyle = {}, secondaryOnPress, secondaryLabelComponent, secondaryButtonStyle = {} }) {
|
|
11
|
+
const isKeyboardVisible = useSharedValue(0);
|
|
12
|
+
const keyboardHeight = useSharedValue(0);
|
|
13
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
14
|
+
const handlePress = async () => {
|
|
15
|
+
setIsLoading(true);
|
|
16
|
+
try {
|
|
17
|
+
await withPromise(primaryOnPress);
|
|
18
|
+
}
|
|
19
|
+
finally {
|
|
20
|
+
setIsLoading(false);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
// ** 소프트 키보드 핸들링
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
|
|
26
|
+
const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';
|
|
27
|
+
const keyboardDidShowListener = Keyboard.addListener(showEvent, (event) => {
|
|
28
|
+
requestAnimationFrame(() => {
|
|
29
|
+
keyboardHeight.value = event.endCoordinates.height; // 키보드 높이 설정
|
|
30
|
+
isKeyboardVisible.value = 1; // 키보드가 보임
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
const keyboardDidHideListener = Keyboard.addListener(hideEvent, () => {
|
|
34
|
+
requestAnimationFrame(() => {
|
|
35
|
+
isKeyboardVisible.value = 0; // 키보드가 숨김
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
return () => {
|
|
39
|
+
keyboardDidShowListener.remove();
|
|
40
|
+
keyboardDidHideListener.remove();
|
|
41
|
+
};
|
|
42
|
+
}, [isKeyboardVisible, keyboardHeight]);
|
|
43
|
+
// ** 애니메이션 스타일을 useAnimatedStyle로 최적화
|
|
44
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
45
|
+
const getBottom = interpolate(isKeyboardVisible.value, [0, 1], [DEFAULT_MARGIN_BOTTOM, 0], 'clamp');
|
|
46
|
+
const getMargin = interpolate(isKeyboardVisible.value, [0, 1], [DEFAULT_MARGIN_X, 0], 'clamp');
|
|
47
|
+
const getRadius = interpolate(isKeyboardVisible.value, [0, 1], [DEFAULT_BORDER_RADIUS, 0], 'clamp');
|
|
48
|
+
return {
|
|
49
|
+
marginBottom: withTiming(getBottom, DURATION),
|
|
50
|
+
marginLeft: withTiming(getMargin, DURATION),
|
|
51
|
+
marginRight: withTiming(getMargin, DURATION),
|
|
52
|
+
borderRadius: withTiming(getRadius, DURATION),
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
return (<Animated.View style={[styles.container, animatedStyle]}>
|
|
56
|
+
{secondaryLabelComponent && (<TouchableOpacity activeOpacity={0.7} style={[secondaryButtonStyle, { height }, styles.touchSecondaryContainer]} onPress={secondaryOnPress}>
|
|
57
|
+
{secondaryLabelComponent}
|
|
58
|
+
</TouchableOpacity>)}
|
|
59
|
+
|
|
60
|
+
<TouchableOpacity activeOpacity={0.7} style={[primaryButtonStyle, { height }, styles.touchContainer]} onPress={handlePress} disabled={disabled || isLoading}>
|
|
61
|
+
{isLoading ? loadingComponent : primaryLabelComponent}
|
|
62
|
+
</TouchableOpacity>
|
|
63
|
+
</Animated.View>);
|
|
64
|
+
}
|
|
65
|
+
const styles = StyleSheet.create({
|
|
66
|
+
touchContainer: {
|
|
67
|
+
justifyContent: 'center',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
flex: 2,
|
|
70
|
+
},
|
|
71
|
+
touchSecondaryContainer: {
|
|
72
|
+
justifyContent: 'center',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
flex: 1,
|
|
75
|
+
},
|
|
76
|
+
container: {
|
|
77
|
+
justifyContent: 'center',
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
borderRadius: DEFAULT_BORDER_RADIUS,
|
|
80
|
+
marginTop: DEFAULT_MARGIN_TOP,
|
|
81
|
+
marginBottom: DEFAULT_MARGIN_BOTTOM,
|
|
82
|
+
marginLeft: DEFAULT_MARGIN_X,
|
|
83
|
+
marginRight: DEFAULT_MARGIN_X,
|
|
84
|
+
overflow: 'hidden',
|
|
85
|
+
flexDirection: 'row',
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
export default ZSBottomButton;
|
|
89
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSBottomButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAyB,MAAM,cAAc,CAAC;AAC1H,OAAO,QAAQ,EAAE,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC9G,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,kBAAkB,GAAG,CAAC,CAA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,UAAU,EAAE,QAAQ;QACpB,YAAY,EAAE,qBAAqB;QACnC,SAAS,EAAE,kBAAkB;QAC7B,YAAY,EAAE,qBAAqB;QACnC,UAAU,EAAE,gBAAgB;QAC5B,WAAW,EAAE,gBAAgB;QAC7B,QAAQ,EAAE,QAAQ;QAClB,aAAa,EAAE,KAAK;KACrB;CACF,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC","sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport { ActivityIndicator, Keyboard, Platform, StyleSheet, TouchableOpacity, TouchableOpacityProps } from \"react-native\";\nimport Animated, { interpolate, useAnimatedStyle, useSharedValue, withTiming } from \"react-native-reanimated\";\nimport { withPromise } from \"../../model/utils\";\n\nconst DEFAULT_MARGIN_X = 20;\nconst DEFAULT_MARGIN_TOP = 0;\nconst DEFAULT_MARGIN_BOTTOM = 20;\nconst DEFAULT_BORDER_RADIUS = 14;\nconst DURATION = { duration: 250 };\n\ninterface Props {\n loadingComponent?: React.ReactNode;\n height?: number;\n disabled?: boolean;\n primaryOnPress: () => Promise<any>;\n primaryLabelComponent: React.ReactNode;\n primaryButtonStyle?: TouchableOpacityProps['style'];\n secondaryOnPress?: () => void;\n secondaryLabelComponent?: React.ReactNode;\n secondaryButtonStyle?: TouchableOpacityProps['style'];\n}\n\nfunction ZSBottomButton({\n loadingComponent = <ActivityIndicator />,\n height = 55,\n disabled = false,\n primaryLabelComponent,\n primaryOnPress,\n primaryButtonStyle = {},\n secondaryOnPress,\n secondaryLabelComponent,\n secondaryButtonStyle = {}\n}: Props) {\n const isKeyboardVisible = useSharedValue(0);\n const keyboardHeight = useSharedValue(0);\n const [isLoading, setIsLoading] = useState<boolean>(false);\n\n const handlePress = async () => {\n setIsLoading(true);\n try {\n await withPromise(primaryOnPress);\n } finally {\n setIsLoading(false);\n }\n };\n\n // ** 소프트 키보드 핸들링\n useEffect(() => {\n const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';\n const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';\n\n const keyboardDidShowListener = Keyboard.addListener(showEvent, (event) => {\n requestAnimationFrame(() => {\n keyboardHeight.value = event.endCoordinates.height; // 키보드 높이 설정\n isKeyboardVisible.value = 1; // 키보드가 보임\n });\n });\n\n const keyboardDidHideListener = Keyboard.addListener(hideEvent, () => {\n requestAnimationFrame(() => {\n isKeyboardVisible.value = 0; // 키보드가 숨김\n });\n });\n\n return () => {\n keyboardDidShowListener.remove();\n keyboardDidHideListener.remove();\n };\n }, [isKeyboardVisible, keyboardHeight]);\n\n // ** 애니메이션 스타일을 useAnimatedStyle로 최적화\n const animatedStyle = useAnimatedStyle(() => {\n const getBottom = interpolate(\n isKeyboardVisible.value,\n [0, 1],\n [DEFAULT_MARGIN_BOTTOM, 0],\n 'clamp',\n );\n\n const getMargin = interpolate(\n isKeyboardVisible.value,\n [0, 1],\n [DEFAULT_MARGIN_X, 0],\n 'clamp',\n );\n\n const getRadius = interpolate(\n isKeyboardVisible.value,\n [0, 1],\n [DEFAULT_BORDER_RADIUS, 0],\n 'clamp',\n );\n\n return {\n marginBottom: withTiming(getBottom, DURATION),\n marginLeft: withTiming(getMargin, DURATION),\n marginRight: withTiming(getMargin, DURATION),\n borderRadius: withTiming(getRadius, DURATION),\n };\n });\n\n return (\n <Animated.View style={[styles.container, animatedStyle]}>\n {secondaryLabelComponent && (\n <TouchableOpacity\n activeOpacity={0.7}\n style={[secondaryButtonStyle, { height }, styles.touchSecondaryContainer]}\n onPress={secondaryOnPress}\n >\n {secondaryLabelComponent}\n </TouchableOpacity>\n )}\n\n <TouchableOpacity\n activeOpacity={0.7}\n style={[primaryButtonStyle, { height }, styles.touchContainer]}\n onPress={handlePress}\n disabled={disabled || isLoading}\n >\n {isLoading ? loadingComponent : primaryLabelComponent}\n </TouchableOpacity>\n </Animated.View>\n );\n}\n\nconst styles = StyleSheet.create({\n touchContainer: {\n justifyContent: 'center',\n alignItems: 'center',\n flex: 2,\n },\n touchSecondaryContainer: {\n justifyContent: 'center',\n alignItems: 'center',\n flex: 1,\n },\n container: {\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: DEFAULT_BORDER_RADIUS,\n marginTop: DEFAULT_MARGIN_TOP,\n marginBottom: DEFAULT_MARGIN_BOTTOM,\n marginLeft: DEFAULT_MARGIN_X,\n marginRight: DEFAULT_MARGIN_X,\n overflow: 'hidden',\n flexDirection: 'row',\n },\n});\n\nexport default ZSBottomButton;\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ViewProps, ScrollView } from 'react-native';
|
|
3
|
+
type ZSContainerProps = ViewProps & {
|
|
4
|
+
backgroundColor?: string;
|
|
5
|
+
isLoader?: boolean;
|
|
6
|
+
statusBarColor?: string;
|
|
7
|
+
barStyle?: 'light-content' | 'dark-content';
|
|
8
|
+
edges?: Array<'top' | 'right' | 'bottom' | 'left'>;
|
|
9
|
+
isScrollView?: boolean;
|
|
10
|
+
scrollViewRef?: React.RefObject<ScrollView>;
|
|
11
|
+
topComponent?: ReactNode;
|
|
12
|
+
bottomComponent?: ReactNode;
|
|
13
|
+
showsVerticalScrollIndicator?: boolean;
|
|
14
|
+
loadingComponent?: React.ReactNode;
|
|
15
|
+
keyboardVerticalOffset?: number;
|
|
16
|
+
};
|
|
17
|
+
declare function ZSContainer({ backgroundColor, isLoader, statusBarColor, barStyle, edges, isScrollView, scrollViewRef, topComponent, bottomComponent, showsVerticalScrollIndicator, loadingComponent, keyboardVerticalOffset, ...props }: ZSContainerProps): React.JSX.Element;
|
|
18
|
+
export default ZSContainer;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ZSContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAwF,UAAU,EAAE,MAAM,cAAc,CAAC;AAM3I,KAAK,gBAAgB,GAAG,SAAS,GAAG;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,eAAe,GAAG,cAAc,CAAC;IAC5C,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC,CAAC;IACnD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC5C,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,iBAAS,WAAW,CAAC,EACnB,eAAe,EACf,QAAgB,EAChB,cAAc,EACd,QAAyB,EACzB,KAAyB,EACzB,YAAmB,EACnB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,4BAAmC,EACnC,gBAAwC,EACxC,sBAAsB,EACtB,GAAG,KAAK,EACT,EAAE,gBAAgB,qBAgDlB;AAOD,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { KeyboardAvoidingView, StatusBar, StyleSheet, Dimensions, ActivityIndicator, Platform } from 'react-native';
|
|
3
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
4
|
+
import ViewAtom from '../atoms/ViewAtom';
|
|
5
|
+
import ScrollViewAtom from '../atoms/ScrollViewAtom';
|
|
6
|
+
import { useTheme } from '../../model/useThemeProvider';
|
|
7
|
+
function ZSContainer({ backgroundColor, isLoader = false, statusBarColor, barStyle = 'dark-content', edges = ['top', 'bottom'], isScrollView = true, scrollViewRef, topComponent, bottomComponent, showsVerticalScrollIndicator = true, loadingComponent = <ActivityIndicator />, keyboardVerticalOffset, ...props }) {
|
|
8
|
+
const { palette } = useTheme(); // 테마 사용
|
|
9
|
+
const [isDelayed, setIsDelayed] = useState(true);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const timer = setTimeout(() => {
|
|
12
|
+
setIsDelayed(false);
|
|
13
|
+
}, 200);
|
|
14
|
+
return () => clearTimeout(timer);
|
|
15
|
+
}, []);
|
|
16
|
+
return (<SafeAreaView style={[{ backgroundColor: backgroundColor || palette.background.base }, styles.flex1]} edges={edges}>
|
|
17
|
+
<StatusBar barStyle={barStyle} backgroundColor={statusBarColor || palette.background.base}/>
|
|
18
|
+
|
|
19
|
+
{!isDelayed && (<KeyboardAvoidingView style={styles.flex1} behavior={Platform.OS === 'ios' ? 'padding' : undefined} keyboardVerticalOffset={keyboardVerticalOffset} enabled>
|
|
20
|
+
{topComponent && topComponent}
|
|
21
|
+
|
|
22
|
+
{isLoader ? (loadingComponent) : isScrollView ? (<ScrollViewAtom ref={scrollViewRef} style={styles.flex1} bounces={false} contentContainerStyle={styles.scrollContainerStyle} showsVerticalScrollIndicator={showsVerticalScrollIndicator} keyboardShouldPersistTaps="handled">
|
|
23
|
+
<ViewAtom style={[styles.flex1, props.style]}>
|
|
24
|
+
{props.children}
|
|
25
|
+
</ViewAtom>
|
|
26
|
+
</ScrollViewAtom>) : (<ViewAtom style={[styles.flex1, props.style]}>{props.children}</ViewAtom>)}
|
|
27
|
+
|
|
28
|
+
{!isLoader && bottomComponent && bottomComponent}
|
|
29
|
+
</KeyboardAvoidingView>)}
|
|
30
|
+
</SafeAreaView>);
|
|
31
|
+
}
|
|
32
|
+
const styles = StyleSheet.create({
|
|
33
|
+
flex1: { flex: 1, width: Dimensions.get('window').width },
|
|
34
|
+
scrollContainerStyle: { flexGrow: 1, alignItems: 'center' },
|
|
35
|
+
});
|
|
36
|
+
export default ZSContainer;
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAa,oBAAoB,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,QAAQ,EAAc,MAAM,cAAc,CAAC;AAC3I,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,cAAc,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAiBxD,SAAS,WAAW,CAAC,EACnB,eAAe,EACf,QAAQ,GAAG,KAAK,EAChB,cAAc,EACd,QAAQ,GAAG,cAAc,EACzB,KAAK,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,EACzB,YAAY,GAAG,IAAI,EACnB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,4BAA4B,GAAG,IAAI,EACnC,gBAAgB,GAAG,CAAC,iBAAiB,CAAC,AAAD,EAAG,EACxC,sBAAsB,EACtB,GAAG,KAAK,EACS;IACjB,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC,QAAQ;IACxC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEjD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,EAAE,GAAG,CAAC,CAAC;QACR,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,KAA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Z;YAAA,EAAE,cAAc,CAAC,CAClB,CAAC,CAAC,CAAC,CACF,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAC1E,CAED;;UAAA,CAAC,CAAC,QAAQ,IAAI,eAAe,IAAI,eAAe,CAClD;QAAA,EAAE,oBAAoB,CAAC,CACxB,CACH;IAAA,EAAE,YAAY,CAAC,CAChB,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE;IACzD,oBAAoB,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE;CAC5D,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC","sourcesContent":["import React, { ReactNode, useState, useEffect } from 'react';\nimport { ViewProps, KeyboardAvoidingView, StatusBar, StyleSheet, Dimensions, ActivityIndicator, Platform, ScrollView } from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\nimport ViewAtom from '../atoms/ViewAtom';\nimport ScrollViewAtom from '../atoms/ScrollViewAtom';\nimport { useTheme } from '../../model/useThemeProvider';\n\ntype ZSContainerProps = ViewProps & {\n backgroundColor?: string;\n isLoader?: boolean;\n statusBarColor?: string;\n barStyle?: 'light-content' | 'dark-content';\n edges?: Array<'top' | 'right' | 'bottom' | 'left'>;\n isScrollView?: boolean;\n scrollViewRef?: React.RefObject<ScrollView>;\n topComponent?: ReactNode;\n bottomComponent?: ReactNode;\n showsVerticalScrollIndicator?: boolean;\n loadingComponent?: React.ReactNode;\n keyboardVerticalOffset?: number;\n};\n\nfunction ZSContainer({\n backgroundColor,\n isLoader = false,\n statusBarColor,\n barStyle = 'dark-content',\n edges = ['top', 'bottom'],\n isScrollView = true,\n scrollViewRef,\n topComponent,\n bottomComponent,\n showsVerticalScrollIndicator = true,\n loadingComponent = <ActivityIndicator />,\n keyboardVerticalOffset,\n ...props\n}: ZSContainerProps) {\n const { palette } = useTheme(); // 테마 사용\n const [isDelayed, setIsDelayed] = useState(true);\n\n useEffect(() => {\n const timer = setTimeout(() => {\n setIsDelayed(false);\n }, 200);\n return () => clearTimeout(timer);\n }, []);\n\n return (\n <SafeAreaView style={[{ backgroundColor: backgroundColor || palette.background.base }, styles.flex1]} edges={edges}>\n <StatusBar barStyle={barStyle} backgroundColor={statusBarColor || palette.background.base} />\n\n {!isDelayed && (\n <KeyboardAvoidingView\n style={styles.flex1}\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={keyboardVerticalOffset}\n enabled\n >\n {topComponent && topComponent}\n\n {isLoader ? (\n loadingComponent\n ) : isScrollView ? (\n <ScrollViewAtom\n ref={scrollViewRef} \n style={styles.flex1}\n bounces={false}\n contentContainerStyle={styles.scrollContainerStyle}\n showsVerticalScrollIndicator={showsVerticalScrollIndicator}\n keyboardShouldPersistTaps=\"handled\"\n >\n <ViewAtom style={[styles.flex1, props.style]}>\n {props.children}\n </ViewAtom>\n </ScrollViewAtom>\n ) : (\n <ViewAtom style={[styles.flex1, props.style]}>{props.children}</ViewAtom>\n )}\n\n {!isLoader && bottomComponent && bottomComponent}\n </KeyboardAvoidingView>\n )}\n </SafeAreaView>\n );\n}\n\nconst styles = StyleSheet.create({\n flex1: { flex: 1, width: Dimensions.get('window').width },\n scrollContainerStyle: { flexGrow: 1, alignItems: 'center' },\n});\n\nexport default ZSContainer;\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ViewProps } from "react-native";
|
|
3
|
+
import type { ShadowLevel } from "../types";
|
|
4
|
+
interface ZSPressableProps extends ViewProps {
|
|
5
|
+
onPress: (value?: any) => void;
|
|
6
|
+
onLongPress?: (value?: any) => void;
|
|
7
|
+
pressedBackgroundColor?: string;
|
|
8
|
+
pressedBackgroundBorderRadius?: number;
|
|
9
|
+
flex?: number;
|
|
10
|
+
minWidth?: number;
|
|
11
|
+
isAnimation?: boolean;
|
|
12
|
+
elevationLevel?: ShadowLevel;
|
|
13
|
+
fullWidth?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare function ZSPressable({ onPress, onLongPress, isAnimation, pressedBackgroundColor, pressedBackgroundBorderRadius, flex, minWidth, elevationLevel, fullWidth, ...props }: ZSPressableProps): React.JSX.Element;
|
|
16
|
+
export default ZSPressable;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ZSPressable/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAA4B,SAAS,EAAE,MAAM,cAAc,CAAC;AAGnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C,UAAU,gBAAiB,SAAQ,SAAS;IAC1C,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACpC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,iBAAS,WAAW,CAAC,EACnB,OAAO,EACP,WAAW,EACX,WAAkB,EAClB,sBAAmD,EACnD,6BAAkC,EAClC,IAAI,EACJ,QAAQ,EACR,cAAkB,EAClB,SAAiB,EACjB,GAAG,KAAK,EACT,EAAE,gBAAgB,qBAgDlB;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
|
+
import { Pressable } from "react-native";
|
|
3
|
+
import Animated, { interpolate, useAnimatedStyle, useSharedValue, withTiming, runOnJS } from "react-native-reanimated";
|
|
4
|
+
import AnimatedWrapper from "../atoms/AnimatedWrapper";
|
|
5
|
+
const DEFAULT_DURATION = { duration: 100 };
|
|
6
|
+
function ZSPressable({ onPress, onLongPress, isAnimation = true, pressedBackgroundColor = 'rgba(180, 180, 180, 0.1)', pressedBackgroundBorderRadius = 16, flex, minWidth, elevationLevel = 0, fullWidth = false, ...props }) {
|
|
7
|
+
const isButtonPress = useSharedValue(0);
|
|
8
|
+
const boxAnimation = useAnimatedStyle(() => {
|
|
9
|
+
const scale = interpolate(isButtonPress.value, [0, 1], [1, 0.96], 'clamp');
|
|
10
|
+
return {
|
|
11
|
+
transform: [{ scale: withTiming(scale, DEFAULT_DURATION) }],
|
|
12
|
+
};
|
|
13
|
+
}, []);
|
|
14
|
+
const handlePressStyle = useCallback((pressed) => {
|
|
15
|
+
runOnJS(() => {
|
|
16
|
+
isButtonPress.value = pressed ? 1 : 0;
|
|
17
|
+
})();
|
|
18
|
+
return {
|
|
19
|
+
backgroundColor: pressed ? pressedBackgroundColor : 'transparent',
|
|
20
|
+
borderRadius: pressedBackgroundBorderRadius,
|
|
21
|
+
flex: fullWidth ? 1 : flex,
|
|
22
|
+
minWidth: minWidth,
|
|
23
|
+
alignSelf: fullWidth ? 'stretch' : 'flex-start',
|
|
24
|
+
};
|
|
25
|
+
}, [pressedBackgroundColor, pressedBackgroundBorderRadius, flex, minWidth, fullWidth]);
|
|
26
|
+
return (<Pressable onPress={onPress} onLongPress={onLongPress} style={({ pressed }) => handlePressStyle(pressed)}>
|
|
27
|
+
<Animated.View style={boxAnimation}>
|
|
28
|
+
<AnimatedWrapper isAnimation={isAnimation} elevationLevel={elevationLevel} style={props.style}>
|
|
29
|
+
{props.children}
|
|
30
|
+
</AnimatedWrapper>
|
|
31
|
+
</Animated.View>
|
|
32
|
+
</Pressable>);
|
|
33
|
+
}
|
|
34
|
+
export default ZSPressable;
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSPressable/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAiB,SAAS,EAAa,MAAM,cAAc,CAAC;AACnE,OAAO,QAAQ,EAAE,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvH,OAAO,eAAe,MAAM,0BAA0B,CAAC;AAGvD,MAAM,gBAAgB,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;AAc3C,SAAS,WAAW,CAAC,EACnB,OAAO,EACP,WAAW,EACX,WAAW,GAAG,IAAI,EAClB,sBAAsB,GAAG,0BAA0B,EACnD,6BAA6B,GAAG,EAAE,EAClC,IAAI,EACJ,QAAQ,EACR,cAAc,GAAG,CAAC,EAClB,SAAS,GAAG,KAAK,EACjB,GAAG,KAAK,EACS;IACjB,MAAM,aAAa,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IAExC,MAAM,YAAY,GAAG,gBAAgB,CAAC,GAAG,EAAE;QACzC,MAAM,KAAK,GAAG,WAAW,CACvB,aAAa,CAAC,KAAK,EACnB,CAAC,CAAC,EAAE,CAAC,CAAC,EACN,CAAC,CAAC,EAAE,IAAI,CAAC,EACT,OAAO,CACR,CAAC;QACF,OAAO;YACL,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAA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AAED,eAAe,WAAW,CAAC","sourcesContent":["import React, { useCallback } from \"react\";\nimport { FlexAlignType, Pressable, ViewProps } from \"react-native\";\nimport Animated, { interpolate, useAnimatedStyle, useSharedValue, withTiming, runOnJS } from \"react-native-reanimated\";\nimport AnimatedWrapper from \"../atoms/AnimatedWrapper\";\nimport type { ShadowLevel } from \"../types\";\n\nconst DEFAULT_DURATION = { duration: 100 };\n\ninterface ZSPressableProps extends ViewProps {\n onPress: (value?: any) => void;\n onLongPress?: (value?: any) => void;\n pressedBackgroundColor?: string;\n pressedBackgroundBorderRadius?: number;\n flex?: number;\n minWidth?: number;\n isAnimation?: boolean;\n elevationLevel?: ShadowLevel;\n fullWidth?: boolean;\n}\n\nfunction ZSPressable({\n onPress,\n onLongPress,\n isAnimation = true,\n pressedBackgroundColor = 'rgba(180, 180, 180, 0.1)',\n pressedBackgroundBorderRadius = 16,\n flex,\n minWidth,\n elevationLevel = 0,\n fullWidth = false,\n ...props\n}: ZSPressableProps) {\n const isButtonPress = useSharedValue(0);\n\n const boxAnimation = useAnimatedStyle(() => {\n const scale = interpolate(\n isButtonPress.value,\n [0, 1],\n [1, 0.96],\n 'clamp'\n );\n return {\n transform: [{ scale: withTiming(scale, DEFAULT_DURATION) }],\n };\n }, []);\n\n const handlePressStyle = useCallback(\n (pressed: boolean) => {\n runOnJS(() => {\n isButtonPress.value = pressed ? 1 : 0;\n })();\n return {\n backgroundColor: pressed ? pressedBackgroundColor : 'transparent',\n borderRadius: pressedBackgroundBorderRadius,\n flex: fullWidth ? 1 : flex,\n minWidth: minWidth,\n alignSelf: fullWidth ? 'stretch' : 'flex-start' as FlexAlignType,\n };\n },\n [pressedBackgroundColor, pressedBackgroundBorderRadius, flex, minWidth, fullWidth]\n );\n\n return (\n <Pressable\n onPress={onPress}\n onLongPress={onLongPress}\n style={({ pressed }) => handlePressStyle(pressed)}\n >\n <Animated.View style={boxAnimation}>\n <AnimatedWrapper\n isAnimation={isAnimation}\n elevationLevel={elevationLevel}\n style={props.style}\n >\n {props.children}\n </AnimatedWrapper>\n </Animated.View>\n </Pressable>\n );\n}\n\nexport default ZSPressable;\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewProps } from 'react-native';
|
|
3
|
+
import { RadioOption } from '../types';
|
|
4
|
+
import { ZSTextProps } from '../ZSText';
|
|
5
|
+
declare function ZSRadioGroup({ options, value, onSelect, containerStyle, valueStyle, minWidth, disabled, fullWidth, selectStyle, }: {
|
|
6
|
+
options: RadioOption[];
|
|
7
|
+
value?: RadioOption;
|
|
8
|
+
onSelect: (value: RadioOption) => void;
|
|
9
|
+
containerStyle?: ViewProps;
|
|
10
|
+
valueStyle?: ZSTextProps;
|
|
11
|
+
selectStyle?: ZSTextProps;
|
|
12
|
+
minWidth?: number;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
declare const _default: React.MemoExoticComponent<typeof ZSRadioGroup>;
|
|
17
|
+
export default _default;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ZSRadioGroup/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAKhD,iBAAS,YAAY,CAAC,EACpB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,cAAc,EACd,UAAU,EACV,QAAQ,EACR,QAAgB,EAChB,SAAiB,EACjB,WAAW,GACZ,EAAE;IACD,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,qBA6GA;;AAED,wBAAkC"}
|