@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,82 @@
|
|
|
1
|
+
import React, { useCallback, memo } from 'react';
|
|
2
|
+
import ViewAtom from '../atoms/ViewAtom';
|
|
3
|
+
import ZSText from '../ZSText';
|
|
4
|
+
import ZSPressable from '../ZSPressable';
|
|
5
|
+
import { useTheme } from '../../model/useThemeProvider';
|
|
6
|
+
import { SvgCheck } from '../../assets/SvgCheck';
|
|
7
|
+
function ZSRadioGroup({ options, value, onSelect, containerStyle, valueStyle, minWidth, disabled = false, fullWidth = false, selectStyle, }) {
|
|
8
|
+
const { palette } = useTheme();
|
|
9
|
+
const handleSelect = useCallback((option) => {
|
|
10
|
+
if (!disabled) {
|
|
11
|
+
onSelect(option);
|
|
12
|
+
}
|
|
13
|
+
}, [disabled, onSelect]);
|
|
14
|
+
return (<ViewAtom style={{
|
|
15
|
+
flexDirection: fullWidth ? 'column' : 'row',
|
|
16
|
+
gap: 10,
|
|
17
|
+
flexWrap: fullWidth ? 'nowrap' : 'wrap',
|
|
18
|
+
width: '100%',
|
|
19
|
+
}} {...containerStyle}>
|
|
20
|
+
{options.map((option) => {
|
|
21
|
+
const isSelected = value?.index === option.index;
|
|
22
|
+
const setColor = isSelected ? palette.primary.light : palette.background.neutral;
|
|
23
|
+
return (<ZSPressable key={option.index} onPress={() => handleSelect(option)} pressedBackgroundColor="transparent" flex={!minWidth ? 1 : undefined} minWidth={minWidth} fullWidth>
|
|
24
|
+
<ViewAtom style={{
|
|
25
|
+
flexDirection: 'row',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
paddingVertical: 12,
|
|
28
|
+
borderWidth: 1,
|
|
29
|
+
paddingLeft: 10,
|
|
30
|
+
paddingRight: 15,
|
|
31
|
+
borderRadius: 26,
|
|
32
|
+
borderColor: setColor,
|
|
33
|
+
backgroundColor: isSelected ? palette.background.layer1 : 'transparent',
|
|
34
|
+
flex: 1,
|
|
35
|
+
}}>
|
|
36
|
+
{/* fullWidth가 false일 때 동그라미 체크박스 표시 */}
|
|
37
|
+
{!fullWidth && (<ViewAtom style={{
|
|
38
|
+
width: 20,
|
|
39
|
+
height: 20,
|
|
40
|
+
borderWidth: 1,
|
|
41
|
+
borderRadius: 10,
|
|
42
|
+
borderColor: setColor,
|
|
43
|
+
justifyContent: 'center',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
}}>
|
|
46
|
+
<ViewAtom style={{
|
|
47
|
+
width: 12,
|
|
48
|
+
height: 12,
|
|
49
|
+
borderRadius: 6,
|
|
50
|
+
backgroundColor: setColor,
|
|
51
|
+
}}/>
|
|
52
|
+
</ViewAtom>)}
|
|
53
|
+
{/* 옵션 텍스트 표시 */}
|
|
54
|
+
<ZSText style={{ marginLeft: 10 }} {...valueStyle}>
|
|
55
|
+
{option.value}
|
|
56
|
+
</ZSText>
|
|
57
|
+
|
|
58
|
+
{/* fullWidth가 true일 때 우측에 선택 버튼 표시 */}
|
|
59
|
+
{fullWidth && (<ViewAtom style={{ flex: 1, flexDirection: 'row', justifyContent: 'flex-end' }}>
|
|
60
|
+
<ViewAtom style={{
|
|
61
|
+
backgroundColor: isSelected
|
|
62
|
+
? palette.primary.main
|
|
63
|
+
: palette.background.layer2,
|
|
64
|
+
paddingHorizontal: 10,
|
|
65
|
+
borderRadius: 50,
|
|
66
|
+
minWidth: 42,
|
|
67
|
+
minHeight: 24,
|
|
68
|
+
justifyContent: 'center',
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
}}>
|
|
71
|
+
{isSelected ? (<SvgCheck size={18}/>) : (<ZSText typo="body.5" {...selectStyle}>
|
|
72
|
+
선택
|
|
73
|
+
</ZSText>)}
|
|
74
|
+
</ViewAtom>
|
|
75
|
+
</ViewAtom>)}
|
|
76
|
+
</ViewAtom>
|
|
77
|
+
</ZSPressable>);
|
|
78
|
+
})}
|
|
79
|
+
</ViewAtom>);
|
|
80
|
+
}
|
|
81
|
+
export default memo(ZSRadioGroup);
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSRadioGroup/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAGjD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,MAAuB,MAAM,WAAW,CAAC;AAChD,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,SAAS,YAAY,CAAC,EACpB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,cAAc,EACd,UAAU,EACV,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,SAAS,GAAG,KAAK,EACjB,WAAW,GAWZ;IACC,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,CAAC;IAE/B,MAAM,YAAY,GAAG,WAAW,CAC9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AAM;wBAC7B,iBAAiB,EAAE,EAAE;wBACrB,YAAY,EAAE,EAAE;wBAChB,QAAQ,EAAE,EAAE;wBACZ,SAAS,EAAE,EAAE;wBACb,cAAc,EAAE,QAAQ;wBACxB,UAAU,EAAE,QAAQ;qBACrB,CAAC,CAEF;oBAAA,CAAC,UAAU,CAAC,CAAC,CAAC,CACZ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAG,CACvB,CAAC,CAAC,CAAC,CACF,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,WAAW,CAAC,CACpC;;sBACF,EAAE,MAAM,CAAC,CACV,CACH;kBAAA,EAAE,QAAQ,CACZ;gBAAA,EAAE,QAAQ,CAAC,CACZ,CACH;YAAA,EAAE,QAAQ,CACZ;UAAA,EAAE,WAAW,CAAC,CACf,CAAC;QACJ,CAAC,CAAC,CACJ;IAAA,EAAE,QAAQ,CAAC,CACZ,CAAC;AACJ,CAAC;AAED,eAAe,IAAI,CAAC,YAAY,CAAC,CAAC","sourcesContent":["import React, { useCallback, memo } from 'react';\nimport { ViewProps } from 'react-native';\nimport { RadioOption } from '../types';\nimport ViewAtom from '../atoms/ViewAtom';\nimport ZSText, { ZSTextProps } from '../ZSText';\nimport ZSPressable from '../ZSPressable';\nimport { useTheme } from '../../model/useThemeProvider';\nimport { SvgCheck } from '../../assets/SvgCheck';\n\nfunction ZSRadioGroup({\n options,\n value,\n onSelect,\n containerStyle,\n valueStyle,\n minWidth,\n disabled = false,\n fullWidth = false,\n selectStyle,\n}: {\n options: RadioOption[];\n value?: RadioOption;\n onSelect: (value: RadioOption) => void;\n containerStyle?: ViewProps;\n valueStyle?: ZSTextProps;\n selectStyle?: ZSTextProps;\n minWidth?: number;\n disabled?: boolean;\n fullWidth?: boolean;\n}) {\n const { palette } = useTheme();\n\n const handleSelect = useCallback(\n (option: RadioOption) => {\n if (!disabled) {\n onSelect(option);\n }\n },\n [disabled, onSelect]\n );\n\n return (\n <ViewAtom\n style={{\n flexDirection: fullWidth ? 'column' : 'row',\n gap: 10,\n flexWrap: fullWidth ? 'nowrap' : 'wrap',\n width: '100%',\n }}\n {...containerStyle}\n >\n {options.map((option) => {\n const isSelected = value?.index === option.index;\n const setColor = isSelected ? palette.primary.light : palette.background.neutral;\n\n return (\n <ZSPressable\n key={option.index}\n onPress={() => handleSelect(option)}\n pressedBackgroundColor=\"transparent\"\n flex={!minWidth ? 1 : undefined}\n minWidth={minWidth}\n fullWidth\n >\n <ViewAtom\n style={{\n flexDirection: 'row',\n alignItems: 'center',\n paddingVertical: 12,\n borderWidth: 1,\n paddingLeft: 10,\n paddingRight: 15,\n borderRadius: 26,\n borderColor: setColor,\n backgroundColor: isSelected ? palette.background.layer1 : 'transparent',\n flex: 1,\n }}\n >\n {/* fullWidth가 false일 때 동그라미 체크박스 표시 */}\n {!fullWidth && (\n <ViewAtom\n style={{\n width: 20,\n height: 20,\n borderWidth: 1,\n borderRadius: 10,\n borderColor: setColor,\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <ViewAtom\n style={{\n width: 12,\n height: 12,\n borderRadius: 6,\n backgroundColor: setColor,\n }}\n />\n </ViewAtom>\n )}\n {/* 옵션 텍스트 표시 */}\n <ZSText style={{ marginLeft: 10 }} {...valueStyle}>\n {option.value}\n </ZSText>\n\n {/* fullWidth가 true일 때 우측에 선택 버튼 표시 */}\n {fullWidth && (\n <ViewAtom style={{ flex: 1, flexDirection: 'row', justifyContent: 'flex-end' }}>\n <ViewAtom\n style={{\n backgroundColor: isSelected\n ? palette.primary.main\n : palette.background.layer2,\n paddingHorizontal: 10,\n borderRadius: 50,\n minWidth: 42,\n minHeight: 24,\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n {isSelected ? (\n <SvgCheck size={18} />\n ) : (\n <ZSText typo=\"body.5\" {...selectStyle}>\n 선택\n </ZSText>\n )}\n </ViewAtom>\n </ViewAtom>\n )}\n </ViewAtom>\n </ZSPressable>\n );\n })}\n </ViewAtom>\n );\n}\n\nexport default memo(ZSRadioGroup);\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextProps } from "react-native/types";
|
|
3
|
+
import { TypoOptions, TextColorOptions } from "../../theme/types";
|
|
4
|
+
export interface ZSTextProps extends TextProps {
|
|
5
|
+
typo?: TypoOptions;
|
|
6
|
+
color?: TextColorOptions;
|
|
7
|
+
}
|
|
8
|
+
declare function ZSText({ typo, color, ...props }: ZSTextProps): React.JSX.Element;
|
|
9
|
+
declare const _default: React.MemoExoticComponent<typeof ZSText>;
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ZSText/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAa,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AAG3F,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC1C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED,iBAAS,MAAM,CAAC,EACd,IAAe,EACf,KAAiB,EACjB,GAAG,KAAK,EACT,EAAE,WAAW,qBAIb;;AAED,wBAA4B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { useTheme } from "../../model/useThemeProvider";
|
|
3
|
+
import TextAtom from "../atoms/TextAtom";
|
|
4
|
+
function ZSText({ typo = 'body.2', color = 'primary', ...props }) {
|
|
5
|
+
const { palette, typography } = useTheme();
|
|
6
|
+
const [s01, s02] = typo.split('.');
|
|
7
|
+
return <TextAtom {...props} style={[typography[s01][s02], { color: palette.text[color] }, props.style]}>{props.children}</TextAtom>;
|
|
8
|
+
}
|
|
9
|
+
export default memo(ZSText);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSText/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,QAAQ,MAAM,mBAAmB,CAAA;AAOxC,SAAS,MAAM,CAAC,EACd,IAAI,GAAG,QAAQ,EACf,KAAK,GAAG,SAAS,EACjB,GAAG,KAAK,EACI;IACV,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC3C,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAA8B,CAAC;IAChE,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAA;AACvI,CAAC;AAED,eAAe,IAAI,CAAC,MAAM,CAAC,CAAC","sourcesContent":["import React, { memo } from 'react';\nimport { TextProps } from \"react-native/types\";\nimport { useTheme } from \"../../model/useThemeProvider\";\nimport { TypoOptions, TypoStyle, TextColorOptions, TypoSubStyle } from \"../../theme/types\";\nimport TextAtom from \"../atoms/TextAtom\"\n\nexport interface ZSTextProps extends TextProps {\n typo?: TypoOptions;\n color?: TextColorOptions;\n}\n\nfunction ZSText({\n typo = 'body.2',\n color = 'primary',\n ...props\n}: ZSTextProps) {\n const { palette, typography } = useTheme();\n const [s01, s02] = typo.split('.') as [TypoStyle, TypoSubStyle];\n return <TextAtom {...props} style={[typography[s01][s02], { color: palette.text[color] }, props.style]}>{props.children}</TextAtom>\n}\n\nexport default memo(ZSText);\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { TextInputProps } from 'react-native';
|
|
2
|
+
import { TypoOptions } from '../../theme';
|
|
3
|
+
export type BoxStyle = 'outline' | 'underline' | 'inbox';
|
|
4
|
+
interface TextFieldProps {
|
|
5
|
+
typo?: TypoOptions;
|
|
6
|
+
status?: 'default' | 'error';
|
|
7
|
+
value: string;
|
|
8
|
+
onChangeText?: (text: string) => void;
|
|
9
|
+
inputBgColor?: string;
|
|
10
|
+
labelBgColor?: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
labelColor?: string;
|
|
13
|
+
placeHolderColor?: string;
|
|
14
|
+
fontSize?: number;
|
|
15
|
+
borderColor?: string;
|
|
16
|
+
borderRadius?: number;
|
|
17
|
+
focusColor?: string;
|
|
18
|
+
errorColor?: string;
|
|
19
|
+
paddingHorizontal?: number;
|
|
20
|
+
borderWidth?: number;
|
|
21
|
+
errorMessage?: string;
|
|
22
|
+
textInputProps?: TextInputProps;
|
|
23
|
+
boxStyle?: BoxStyle;
|
|
24
|
+
innerBoxStyle?: 'top' | 'middle' | 'bottom';
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
allowFontScaling?: boolean;
|
|
27
|
+
isTextArea?: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare function ZSTextField({ typo, status, value, onChangeText, label, labelColor, placeHolderColor, inputBgColor, labelBgColor, borderWidth, borderColor, focusColor, errorColor, borderRadius, paddingHorizontal, errorMessage, textInputProps, boxStyle, innerBoxStyle, disabled, allowFontScaling, isTextArea, }: TextFieldProps): JSX.Element;
|
|
30
|
+
export default ZSTextField;
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sour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KAAqB,EACrB,UAAsB,EACtB,gBAA4B,EAC5B,YAAsB,EACtB,YAAsB,EACtB,WAAiB,EACjB,WAAuB,EACvB,UAAsB,EACtB,UAAsB,EACtB,YAAiB,EACjB,iBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,QAAoB,EACpB,aAAa,EACb,QAAgB,EAChB,gBAAuB,EACvB,UAAkB,GACnB,EAAE,cAAc,GAAG,GAAG,CAAC,OAAO,CAwI9B;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React, { useMemo, useCallback, useState, useEffect } from 'react';
|
|
2
|
+
import { TextInput } from 'react-native';
|
|
3
|
+
import Animated, { interpolate, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
4
|
+
import ButtonClose from './ui/ButtonClose';
|
|
5
|
+
import ErrorComponent from './ui/ErrorComponent';
|
|
6
|
+
import { extractStyle } from '../../model/utils';
|
|
7
|
+
import { useTheme } from '../../model/useThemeProvider';
|
|
8
|
+
import ViewAtom from '../atoms/ViewAtom';
|
|
9
|
+
function ZSTextField({ typo = 'body.2', status = 'default', value, onChangeText, label = 'Placeholder', labelColor = '#757575', placeHolderColor = '#B1B1B1', inputBgColor = 'white', labelBgColor = 'white', borderWidth = 1.2, borderColor = '#E7EDF0', focusColor = '#007AFF', errorColor = '#FF3B30', borderRadius = 14, paddingHorizontal = 15, errorMessage, textInputProps, boxStyle = 'outline', innerBoxStyle, disabled = false, allowFontScaling = true, isTextArea = false, }) {
|
|
10
|
+
const { typography, palette } = useTheme();
|
|
11
|
+
const [primaryStyle, subStyle] = typo.split('.');
|
|
12
|
+
// 폰트 크기 및 패밀리 추출
|
|
13
|
+
const fontSize = useMemo(() => extractStyle(typography[primaryStyle][subStyle], 'fontSize') || 17, [typography, primaryStyle, subStyle]);
|
|
14
|
+
const fontFamily = useMemo(() => extractStyle(typography[primaryStyle][subStyle], 'fontFamily') || '', [typography, primaryStyle, subStyle]);
|
|
15
|
+
// 컴포넌트 상태 관리
|
|
16
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
17
|
+
const labelAnimationValue = useSharedValue(0);
|
|
18
|
+
const boxHeightValue = useSharedValue(0);
|
|
19
|
+
// 포커스 및 값 변경 시 라벨 애니메이션 트리거
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const shouldAnimate = value !== '' || isFocused;
|
|
22
|
+
labelAnimationValue.value = withTiming(shouldAnimate ? 1 : 0, { duration: 50 });
|
|
23
|
+
}, [value, isFocused, labelAnimationValue]);
|
|
24
|
+
// 라벨 애니메이션 스타일
|
|
25
|
+
const animatedLabelStyle = useAnimatedStyle(() => {
|
|
26
|
+
const labelFontSize = interpolate(labelAnimationValue.value, [0, 1], [fontSize + (boxStyle === 'inbox' ? 5 : 0), boxStyle === 'inbox' ? 10 : 12], 'clamp');
|
|
27
|
+
const labelTop = interpolate(labelAnimationValue.value, [0, 1], [
|
|
28
|
+
isTextArea ? 12 : 0,
|
|
29
|
+
isTextArea ? -12 : -(boxHeightValue.value / 2) - 1 + (boxStyle === 'inbox' ? 18 : 0),
|
|
30
|
+
], 'clamp');
|
|
31
|
+
return {
|
|
32
|
+
top: labelTop,
|
|
33
|
+
fontSize: labelFontSize,
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
// 레이아웃 핸들러
|
|
37
|
+
const handleLayout = useCallback((event) => {
|
|
38
|
+
const { height } = event.nativeEvent.layout;
|
|
39
|
+
if (boxHeightValue.value !== height)
|
|
40
|
+
boxHeightValue.value = height;
|
|
41
|
+
}, [boxHeightValue]);
|
|
42
|
+
// 포커스 및 블러 핸들러
|
|
43
|
+
const handleFocus = useCallback(() => setIsFocused(true), []);
|
|
44
|
+
const handleBlur = useCallback(() => setIsFocused(false), []);
|
|
45
|
+
// 상태에 따른 테두리 색상 설정
|
|
46
|
+
const computedBorderColor = useMemo(() => (status === 'error' ? errorColor : isFocused ? focusColor : borderColor), [status, errorColor, isFocused, focusColor, borderColor]);
|
|
47
|
+
// 상태에 따른 라벨 색상 설정
|
|
48
|
+
const computedLabelColor = useMemo(() => (status === 'error' ? errorColor : isFocused ? focusColor : value ? labelColor : placeHolderColor), [status, errorColor, isFocused, focusColor, value, placeHolderColor, labelColor]);
|
|
49
|
+
// 컨테이너 스타일 정의
|
|
50
|
+
const containerStyle = useMemo(() => ({
|
|
51
|
+
width: '100%',
|
|
52
|
+
justifyContent: isTextArea ? 'flex-start' : 'center',
|
|
53
|
+
borderRadius,
|
|
54
|
+
paddingHorizontal,
|
|
55
|
+
backgroundColor: inputBgColor,
|
|
56
|
+
paddingTop: boxStyle === 'inbox' ? 13 : 0,
|
|
57
|
+
...(boxStyle === 'outline' || boxStyle === 'inbox' ? { borderWidth } : {}),
|
|
58
|
+
...(boxStyle === 'underline' ? { borderBottomWidth: borderWidth } : {}),
|
|
59
|
+
...(innerBoxStyle === 'top' ? { borderBottomLeftRadius: 0, borderBottomRightRadius: 0, borderBottomWidth: borderWidth / 2 }
|
|
60
|
+
: innerBoxStyle === 'middle' ? { borderRadius: 0, borderTopWidth: borderWidth / 2, borderBottomWidth: borderWidth / 2 }
|
|
61
|
+
: innerBoxStyle === 'bottom' ? { borderTopLeftRadius: 0, borderTopRightRadius: 0, borderTopWidth: borderWidth / 2 }
|
|
62
|
+
: {}),
|
|
63
|
+
}), [isTextArea, borderRadius, paddingHorizontal, inputBgColor, borderWidth, boxStyle, innerBoxStyle]);
|
|
64
|
+
// 라벨 스타일 정의
|
|
65
|
+
const labelTextStyle = useMemo(() => ({
|
|
66
|
+
fontSize,
|
|
67
|
+
left: paddingHorizontal,
|
|
68
|
+
backgroundColor: labelBgColor,
|
|
69
|
+
paddingHorizontal: boxStyle === 'outline' ? 5 : 0,
|
|
70
|
+
paddingVertical: 2,
|
|
71
|
+
textAlignVertical: 'center',
|
|
72
|
+
fontFamily,
|
|
73
|
+
borderRadius: boxStyle === 'outline' ? 20 : 0,
|
|
74
|
+
overflow: 'hidden',
|
|
75
|
+
}), [fontSize, paddingHorizontal, labelBgColor, boxStyle, fontFamily]);
|
|
76
|
+
// 텍스트 변경 핸들러
|
|
77
|
+
const handleTextChange = useCallback((text) => {
|
|
78
|
+
if (onChangeText)
|
|
79
|
+
onChangeText(text);
|
|
80
|
+
}, [onChangeText]);
|
|
81
|
+
return (<>
|
|
82
|
+
<ViewAtom style={[containerStyle, { borderColor: computedBorderColor }]} onLayout={handleLayout} pointerEvents={disabled ? 'none' : 'auto'}>
|
|
83
|
+
<TextInput {...textInputProps} style={[
|
|
84
|
+
{ paddingTop: 7, paddingBottom: 5 },
|
|
85
|
+
textInputProps?.style,
|
|
86
|
+
{ fontSize, width: '100%', paddingRight: 25, fontFamily },
|
|
87
|
+
]} value={value} onFocus={handleFocus} onBlur={handleBlur} onChangeText={handleTextChange} allowFontScaling={allowFontScaling} selectionColor={palette.grey[50]}/>
|
|
88
|
+
|
|
89
|
+
<ViewAtom pointerEvents="none" style={{ position: 'absolute' }}>
|
|
90
|
+
<Animated.Text allowFontScaling={allowFontScaling} style={[animatedLabelStyle, labelTextStyle, { color: computedLabelColor }]}>
|
|
91
|
+
{label}
|
|
92
|
+
</Animated.Text>
|
|
93
|
+
</ViewAtom>
|
|
94
|
+
|
|
95
|
+
{(value && isFocused) && (<ButtonClose marginTop={isTextArea ? 13 : undefined} onChangeText={onChangeText}/>)}
|
|
96
|
+
</ViewAtom>
|
|
97
|
+
|
|
98
|
+
{status === 'error' && errorMessage && (<ErrorComponent errorMessage={errorMessage} errorColor={errorColor} fontFamily={fontFamily}/>)}
|
|
99
|
+
</>);
|
|
100
|
+
}
|
|
101
|
+
export default ZSTextField;
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSTextField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAA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,UAAU,CAAC,EAAG,CAC/F,CACH;IAAA,GAAG,CACJ,CAAC;AACJ,CAAC;AAED,eAAe,WAAW,CAAC","sourcesContent":["import React, { useMemo, useCallback, useState, useEffect } from 'react';\nimport { LayoutChangeEvent, StyleProp, TextInput, TextInputProps, TextStyle, ViewStyle } from 'react-native';\nimport Animated, { interpolate, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport ButtonClose from './ui/ButtonClose';\nimport ErrorComponent from './ui/ErrorComponent';\nimport { TypoOptions, TypoStyle, TypoSubStyle } from '../../theme';\nimport { extractStyle } from '../../model/utils';\nimport { useTheme } from '../../model/useThemeProvider';\nimport ViewAtom from '../atoms/ViewAtom';\n\nexport type BoxStyle = 'outline' | 'underline' | 'inbox';\n\ninterface TextFieldProps {\n typo?: TypoOptions;\n status?: 'default' | 'error';\n value: string;\n onChangeText?: (text: string) => void;\n inputBgColor?: string;\n labelBgColor?: string;\n label?: string;\n labelColor?: string;\n placeHolderColor?: string;\n fontSize?: number;\n borderColor?: string;\n borderRadius?: number;\n focusColor?: string;\n errorColor?: string;\n paddingHorizontal?: number;\n borderWidth?: number;\n errorMessage?: string;\n textInputProps?: TextInputProps;\n boxStyle?: BoxStyle;\n innerBoxStyle?: 'top' | 'middle' | 'bottom';\n disabled?: boolean;\n allowFontScaling?: boolean;\n isTextArea?: boolean;\n}\n\nfunction ZSTextField({\n typo = 'body.2',\n status = 'default',\n value,\n onChangeText,\n label = 'Placeholder',\n labelColor = '#757575',\n placeHolderColor = '#B1B1B1',\n inputBgColor = 'white',\n labelBgColor = 'white',\n borderWidth = 1.2,\n borderColor = '#E7EDF0',\n focusColor = '#007AFF',\n errorColor = '#FF3B30',\n borderRadius = 14,\n paddingHorizontal = 15,\n errorMessage,\n textInputProps,\n boxStyle = 'outline',\n innerBoxStyle,\n disabled = false,\n allowFontScaling = true,\n isTextArea = false,\n}: TextFieldProps): JSX.Element {\n const { typography, palette } = useTheme();\n const [primaryStyle, subStyle] = typo.split('.') as [TypoStyle, TypoSubStyle];\n\n // 폰트 크기 및 패밀리 추출\n const fontSize = useMemo(() => extractStyle(typography[primaryStyle][subStyle], 'fontSize') as number || 17, [typography, primaryStyle, subStyle]);\n const fontFamily = useMemo(() => extractStyle(typography[primaryStyle][subStyle], 'fontFamily') as string || '', [typography, primaryStyle, subStyle]);\n\n // 컴포넌트 상태 관리\n const [isFocused, setIsFocused] = useState<boolean>(false);\n const labelAnimationValue = useSharedValue(0);\n const boxHeightValue = useSharedValue(0);\n\n // 포커스 및 값 변경 시 라벨 애니메이션 트리거\n useEffect(() => {\n const shouldAnimate = value !== '' || isFocused;\n labelAnimationValue.value = withTiming(shouldAnimate ? 1 : 0, { duration: 50 });\n }, [value, isFocused, labelAnimationValue]);\n\n // 라벨 애니메이션 스타일\n const animatedLabelStyle = useAnimatedStyle(() => {\n const labelFontSize = interpolate(\n labelAnimationValue.value,\n [0, 1],\n [fontSize + (boxStyle === 'inbox' ? 5 : 0), boxStyle === 'inbox' ? 10 : 12],\n 'clamp'\n );\n\n const labelTop = interpolate(\n labelAnimationValue.value,\n [0, 1],\n [\n isTextArea ? 12 : 0,\n isTextArea ? -12 : -(boxHeightValue.value / 2) - 1 + (boxStyle === 'inbox' ? 18 : 0),\n ],\n 'clamp'\n );\n\n return {\n top: labelTop,\n fontSize: labelFontSize,\n };\n });\n\n // 레이아웃 핸들러\n const handleLayout = useCallback((event: LayoutChangeEvent) => {\n const { height } = event.nativeEvent.layout;\n if (boxHeightValue.value !== height) boxHeightValue.value = height;\n }, [boxHeightValue]);\n\n // 포커스 및 블러 핸들러\n const handleFocus = useCallback(() => setIsFocused(true), []);\n const handleBlur = useCallback(() => setIsFocused(false), []);\n\n // 상태에 따른 테두리 색상 설정\n const computedBorderColor = useMemo(() => (\n status === 'error' ? errorColor : isFocused ? focusColor : borderColor\n ), [status, errorColor, isFocused, focusColor, borderColor]);\n\n // 상태에 따른 라벨 색상 설정\n const computedLabelColor = useMemo(() => (\n status === 'error' ? errorColor : isFocused ? focusColor : value ? labelColor : placeHolderColor\n ), [status, errorColor, isFocused, focusColor, value, placeHolderColor, labelColor]);\n\n // 컨테이너 스타일 정의\n const containerStyle: StyleProp<ViewStyle> = useMemo(() => ({\n width: '100%',\n justifyContent: isTextArea ? 'flex-start' : 'center',\n borderRadius,\n paddingHorizontal,\n backgroundColor: inputBgColor,\n paddingTop: boxStyle === 'inbox' ? 13 : 0,\n ...(boxStyle === 'outline' || boxStyle === 'inbox' ? { borderWidth } : {}),\n ...(boxStyle === 'underline' ? { borderBottomWidth: borderWidth } : {}),\n ...(innerBoxStyle === 'top' ? { borderBottomLeftRadius: 0, borderBottomRightRadius: 0, borderBottomWidth: borderWidth / 2 }\n : innerBoxStyle === 'middle' ? { borderRadius: 0, borderTopWidth: borderWidth / 2, borderBottomWidth: borderWidth / 2 }\n : innerBoxStyle === 'bottom' ? { borderTopLeftRadius: 0, borderTopRightRadius: 0, borderTopWidth: borderWidth / 2 }\n : {}),\n }), [isTextArea, borderRadius, paddingHorizontal, inputBgColor, borderWidth, boxStyle, innerBoxStyle]);\n\n // 라벨 스타일 정의\n const labelTextStyle: StyleProp<TextStyle> = useMemo(() => ({\n fontSize,\n left: paddingHorizontal,\n backgroundColor: labelBgColor,\n paddingHorizontal: boxStyle === 'outline' ? 5 : 0,\n paddingVertical: 2,\n textAlignVertical: 'center',\n fontFamily,\n borderRadius: boxStyle === 'outline' ? 20 : 0,\n overflow: 'hidden',\n }), [fontSize, paddingHorizontal, labelBgColor, boxStyle, fontFamily]);\n\n // 텍스트 변경 핸들러\n const handleTextChange = useCallback((text: string) => {\n if (onChangeText) onChangeText(text);\n }, [onChangeText]);\n\n return (\n <>\n <ViewAtom\n style={[containerStyle, { borderColor: computedBorderColor }]}\n onLayout={handleLayout}\n pointerEvents={disabled ? 'none' : 'auto'}\n >\n <TextInput\n {...textInputProps}\n style={[\n { paddingTop: 7, paddingBottom: 5 },\n textInputProps?.style,\n { fontSize, width: '100%', paddingRight: 25, fontFamily },\n ]}\n value={value}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChangeText={handleTextChange}\n allowFontScaling={allowFontScaling}\n selectionColor={palette.grey[50]}\n />\n\n <ViewAtom pointerEvents=\"none\" style={{ position: 'absolute' }}>\n <Animated.Text allowFontScaling={allowFontScaling} style={[animatedLabelStyle, labelTextStyle, { color: computedLabelColor }]}>\n {label}\n </Animated.Text>\n </ViewAtom>\n\n {(value && isFocused) && (\n <ButtonClose marginTop={isTextArea ? 13 : undefined} onChangeText={onChangeText} />\n )}\n </ViewAtom>\n\n {status === 'error' && errorMessage && (\n <ErrorComponent errorMessage={errorMessage} errorColor={errorColor} fontFamily={fontFamily} />\n )}\n </>\n );\n}\n\nexport default ZSTextField;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonClose.d.ts","sourceRoot":"","sources":["../../../../src/ui/ZSTextField/ui/ButtonClose.tsx"],"names":[],"mappings":"AAGA,QAAA,MAAM,WAAW,gCAGd;IACC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,gCAQA,CAAA;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TouchableOpacity } from "react-native";
|
|
2
|
+
import { SvgX } from "../../../assets/SvgX";
|
|
3
|
+
const ButtonClose = ({ onChangeText, marginTop }) => {
|
|
4
|
+
return (<TouchableOpacity style={{ position: 'absolute', padding: 3, right: 15, borderRadius: 30, backgroundColor: '#e6e6e6', justifyContent: 'center', alignItems: 'center', ...marginTop && { top: marginTop } }} hitSlop={{ top: 10, right: 10, bottom: 10, left: 10 }} onPress={() => { onChangeText?.(''); }}>
|
|
5
|
+
<SvgX color="#5E696E"/>
|
|
6
|
+
</TouchableOpacity>);
|
|
7
|
+
};
|
|
8
|
+
export default ButtonClose;
|
|
9
|
+
//# sourceMappingURL=ButtonClose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonClose.js","sourceRoot":"","sources":["../../../../src/ui/ZSTextField/ui/ButtonClose.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,MAAM,WAAW,GAAG,CAAC,EACjB,YAAY,EACZ,SAAS,EAIZ,EAAE,EAAE;IACD,OAAO,CACH,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,SAAS,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,CACvM,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CACtD,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CACvC;YAAA,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EACzB;QAAA,EAAE,gBAAgB,CAAC,CACtB,CAAA;AACL,CAAC,CAAA;AAED,eAAe,WAAW,CAAC","sourcesContent":["import { TouchableOpacity } from \"react-native\";\nimport { SvgX } from \"../../../assets/SvgX\";\n\nconst ButtonClose = ({\n onChangeText,\n marginTop\n}: {\n onChangeText?: (text: string) => void;\n marginTop?: number\n}) => {\n return (\n <TouchableOpacity style={{ position: 'absolute', padding: 3, right: 15, borderRadius: 30, backgroundColor: '#e6e6e6', justifyContent: 'center', alignItems: 'center', ...marginTop && { top: marginTop } }}\n hitSlop={{ top: 10, right: 10, bottom: 10, left: 10 }}\n onPress={() => { onChangeText?.(''); }}>\n <SvgX color=\"#5E696E\" />\n </TouchableOpacity>\n )\n}\n\nexport default ButtonClose;"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorComponent.d.ts","sourceRoot":"","sources":["../../../../src/ui/ZSTextField/ui/ErrorComponent.tsx"],"names":[],"mappings":"AAEA,QAAA,MAAM,cAAc,6CAElB;IACE,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACtB,gCAcA,CAAA;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Text, View } from "react-native";
|
|
2
|
+
const ErrorComponent = ({ errorMessage, errorColor, fontFamily }) => {
|
|
3
|
+
return (<View style={{ width: '100%', flexDirection: 'row', alignItems: 'center', paddingLeft: 3, marginTop: 5 }}>
|
|
4
|
+
<View style={{ width: 18, height: 18, justifyContent: 'center', alignItems: 'center', borderRadius: 30, backgroundColor: errorColor }}>
|
|
5
|
+
<Text allowFontScaling={false} style={{ fontWeight: 'bold', color: 'white', textAlign: 'center', textAlignVertical: 'center', fontSize: 11, fontFamily: fontFamily }}>
|
|
6
|
+
{`!`}
|
|
7
|
+
</Text>
|
|
8
|
+
</View>
|
|
9
|
+
|
|
10
|
+
<Text allowFontScaling={false} style={{ marginLeft: 5, fontSize: 14, color: errorColor, fontFamily: fontFamily }}>
|
|
11
|
+
{errorMessage}
|
|
12
|
+
</Text>
|
|
13
|
+
</View>);
|
|
14
|
+
};
|
|
15
|
+
export default ErrorComponent;
|
|
16
|
+
//# sourceMappingURL=ErrorComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorComponent.js","sourceRoot":"","sources":["../../../../src/ui/ZSTextField/ui/ErrorComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,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{\n errorMessage: string;\n errorColor: string;\n fontFamily: string;\n}) => {\n return (\n <View style={{ width: '100%', flexDirection: 'row', alignItems: 'center', paddingLeft: 3, marginTop: 5 }}>\n <View style={{ width: 18, height: 18, justifyContent: 'center', alignItems: 'center', borderRadius: 30, backgroundColor: errorColor }}>\n <Text allowFontScaling={false} style={{ fontWeight: 'bold', color: 'white', textAlign: 'center', textAlignVertical: 'center', fontSize: 11, fontFamily: fontFamily }}>\n {`!`}\n </Text>\n </View>\n\n <Text allowFontScaling={false} style={{ marginLeft: 5, fontSize: 14, color: errorColor, fontFamily: fontFamily }}>\n {errorMessage}\n </Text>\n </View>\n )\n}\n\nexport default ErrorComponent;"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ZSView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AAIrD,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;;AAsBF,wBAA4B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { memo, useMemo } from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import { useTheme } from '../../model/useThemeProvider';
|
|
4
|
+
import AnimatedWrapper from '../atoms/AnimatedWrapper';
|
|
5
|
+
const ZSView = ({ isAnimation = false, style, children, ...rest }) => {
|
|
6
|
+
const { palette } = useTheme();
|
|
7
|
+
const styles = useMemo(() => StyleSheet.create({
|
|
8
|
+
container: {
|
|
9
|
+
backgroundColor: palette.background.base,
|
|
10
|
+
},
|
|
11
|
+
}), [palette.background.base]);
|
|
12
|
+
return (<AnimatedWrapper isAnimation={isAnimation} style={[styles.container, style]} {...rest}>
|
|
13
|
+
{children}
|
|
14
|
+
</AnimatedWrapper>);
|
|
15
|
+
};
|
|
16
|
+
export default memo(ZSView);
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAa,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,eAAe,MAAM,0BAA0B,CAAC;AAMvD,MAAM,MAAM,GAAoB,CAAC,EAAE,WAAW,GAAG,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IACpF,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,CAAC;IAE/B,MAAM,MAAM,GAAG,OAAO,CACpB,GAAG,EAAE,CACH,UAAU,CAAC,MAAM,CAAC;QAChB,SAAS,EAAE;YACT,eAAe,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;SACzC;KACF,CAAC,EACJ,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAC1B,CAAC;IAEF,OAAO,CACL,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CACpF;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,eAAe,CAAC,CACnB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC,MAAM,CAAC,CAAC","sourcesContent":["import React, { memo, useMemo } from 'react';\nimport { ViewProps, StyleSheet } from 'react-native';\nimport { useTheme } from '../../model/useThemeProvider';\nimport AnimatedWrapper from '../atoms/AnimatedWrapper';\n\ntype Props = ViewProps & {\n isAnimation?: boolean;\n};\n\nconst ZSView: React.FC<Props> = ({ isAnimation = false, style, children, ...rest }) => {\n const { palette } = useTheme();\n\n const styles = useMemo(\n () =>\n StyleSheet.create({\n container: {\n backgroundColor: palette.background.base,\n },\n }),\n [palette.background.base],\n );\n\n return (\n <AnimatedWrapper isAnimation={isAnimation} style={[styles.container, style]} {...rest}>\n {children}\n </AnimatedWrapper>\n );\n};\n\nexport default memo(ZSView);\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewProps } from 'react-native';
|
|
3
|
+
import { ShadowLevel } from '../types';
|
|
4
|
+
interface AnimatedWrapperProps extends ViewProps {
|
|
5
|
+
isAnimation: boolean;
|
|
6
|
+
elevationLevel?: ShadowLevel;
|
|
7
|
+
duration?: number;
|
|
8
|
+
}
|
|
9
|
+
declare function AnimatedWrapper({ isAnimation, elevationLevel, duration, style, children, ...props }: AnimatedWrapperProps): React.JSX.Element;
|
|
10
|
+
declare const _default: React.MemoExoticComponent<typeof AnimatedWrapper>;
|
|
11
|
+
export default _default;
|
|
12
|
+
//# sourceMappingURL=AnimatedWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimatedWrapper.d.ts","sourceRoot":"","sources":["../../../src/ui/atoms/AnimatedWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,EAAQ,SAAS,EAAY,MAAM,cAAc,CAAC;AAGzD,OAAO,EAAE,WAAW,EAAe,MAAM,UAAU,CAAC;AAiBpD,UAAU,oBAAqB,SAAQ,SAAS;IAC9C,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,iBAAS,eAAe,CAAC,EACvB,WAAkB,EAClB,cAAkB,EAClB,QAA2B,EAC3B,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,qBAoDtB;;AAED,wBAA2C"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { useMemo, useCallback } from 'react';
|
|
2
|
+
import { View, Platform } from 'react-native';
|
|
3
|
+
import Animated, { FadeInDown, FadeOut, useAnimatedStyle, withTiming, useSharedValue, runOnJS } from 'react-native-reanimated';
|
|
4
|
+
import { useTheme } from '../../model/useThemeProvider';
|
|
5
|
+
const DEFAULT_DURATION = 200;
|
|
6
|
+
const SHADOW_DURATION = 50;
|
|
7
|
+
const IOS_SHADOW = [
|
|
8
|
+
{ shadowOffset: { width: 0, height: 1 }, shadowOpacity: 1, shadowRadius: 1.00 },
|
|
9
|
+
{ shadowOffset: { width: 0, height: 1 }, shadowOpacity: 1, shadowRadius: 1.41 },
|
|
10
|
+
{ shadowOffset: { width: 0, height: 1 }, shadowOpacity: 1, shadowRadius: 2.22 },
|
|
11
|
+
{ shadowOffset: { width: 0, height: 2 }, shadowOpacity: 1, shadowRadius: 2.62 },
|
|
12
|
+
{ shadowOffset: { width: 0, height: 2 }, shadowOpacity: 1, shadowRadius: 3.84 },
|
|
13
|
+
{ shadowOffset: { width: 0, height: 3 }, shadowOpacity: 1, shadowRadius: 4.65 },
|
|
14
|
+
{ shadowOffset: { width: 0, height: 3 }, shadowOpacity: 1, shadowRadius: 4.65 },
|
|
15
|
+
{ shadowOffset: { width: 0, height: 4 }, shadowOpacity: 1, shadowRadius: 4.65 },
|
|
16
|
+
{ shadowOffset: { width: 0, height: 4 }, shadowOpacity: 1, shadowRadius: 5.46 },
|
|
17
|
+
{ shadowOffset: { width: 0, height: 5 }, shadowOpacity: 1, shadowRadius: 6.27 },
|
|
18
|
+
];
|
|
19
|
+
function AnimatedWrapper({ isAnimation = true, elevationLevel = 0, duration = DEFAULT_DURATION, style, children, ...props }) {
|
|
20
|
+
const { palette } = useTheme();
|
|
21
|
+
const opacity = useSharedValue(0);
|
|
22
|
+
// 그림자 및 기타 스타일을 플랫폼에 맞게 미리 계산
|
|
23
|
+
const staticStyle = useMemo(() => {
|
|
24
|
+
if (Platform.OS === 'ios') {
|
|
25
|
+
const { shadowOpacity, ...rest } = IOS_SHADOW[elevationLevel];
|
|
26
|
+
return { shadowColor: palette.elevationShadow[elevationLevel], ...rest };
|
|
27
|
+
}
|
|
28
|
+
return { shadowColor: palette.elevationShadow[elevationLevel] };
|
|
29
|
+
}, [elevationLevel, palette]);
|
|
30
|
+
// 애니메이션 스타일 정의 (iOS 그림자 및 Android elevation 처리)
|
|
31
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
32
|
+
if (Platform.OS === 'ios') {
|
|
33
|
+
return { shadowOpacity: opacity.value * IOS_SHADOW[elevationLevel].shadowOpacity };
|
|
34
|
+
}
|
|
35
|
+
return { elevation: opacity.value * elevationLevel };
|
|
36
|
+
}, [elevationLevel]);
|
|
37
|
+
// 컴포넌트가 등장할 때 애니메이션 핸들링
|
|
38
|
+
const onEntering = useCallback(() => {
|
|
39
|
+
opacity.value = withTiming(1, { duration: SHADOW_DURATION });
|
|
40
|
+
}, [opacity]);
|
|
41
|
+
// 애니메이션 속성 메모이제이션
|
|
42
|
+
const animationProps = useMemo(() => ({
|
|
43
|
+
entering: FadeInDown.duration(duration).withCallback((finished) => {
|
|
44
|
+
'worklet';
|
|
45
|
+
if (finished) {
|
|
46
|
+
runOnJS(onEntering)();
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
exiting: FadeOut.duration(50),
|
|
50
|
+
}), [duration, onEntering]);
|
|
51
|
+
// 애니메이션이 비활성화된 경우 기본 View로 렌더링
|
|
52
|
+
if (!isAnimation) {
|
|
53
|
+
return <View style={[style, staticStyle]} {...props}>{children}</View>;
|
|
54
|
+
}
|
|
55
|
+
// 애니메이션이 적용된 View로 렌더링
|
|
56
|
+
return (<Animated.View style={[style, staticStyle, animatedStyle]} {...animationProps} {...props}>
|
|
57
|
+
{children}
|
|
58
|
+
</Animated.View>);
|
|
59
|
+
}
|
|
60
|
+
export default React.memo(AnimatedWrapper);
|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,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;IAED,uBAAuB;IACvB,OAAO,CACL,CAAC,QAAQ,CAAC,IAAI,CACZ,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAC3C,IAAI,cAAc,CAAC,CACnB,IAAI,KAAK,CAAC,CAEV;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,QAAQ,CAAC,IAAI,CAAC,CACjB,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC","sourcesContent":["import React, { useMemo, useCallback } from 'react';\nimport { View, ViewProps, Platform } from 'react-native';\nimport Animated, { FadeInDown, FadeOut, useAnimatedStyle, withTiming, useSharedValue, runOnJS } from 'react-native-reanimated';\nimport { useTheme } from '../../model/useThemeProvider';\nimport { ShadowLevel, ShadowStyle } from '../types';\n\nconst DEFAULT_DURATION = 200 as const;\nconst SHADOW_DURATION = 50 as const;\nconst IOS_SHADOW: readonly ShadowStyle[] = [\n { shadowOffset: { width: 0, height: 1 }, shadowOpacity: 1, shadowRadius: 1.00 },\n { shadowOffset: { width: 0, height: 1 }, shadowOpacity: 1, shadowRadius: 1.41 },\n { shadowOffset: { width: 0, height: 1 }, shadowOpacity: 1, shadowRadius: 2.22 },\n { shadowOffset: { width: 0, height: 2 }, shadowOpacity: 1, shadowRadius: 2.62 },\n { shadowOffset: { width: 0, height: 2 }, shadowOpacity: 1, shadowRadius: 3.84 },\n { shadowOffset: { width: 0, height: 3 }, shadowOpacity: 1, shadowRadius: 4.65 },\n { shadowOffset: { width: 0, height: 3 }, shadowOpacity: 1, shadowRadius: 4.65 },\n { shadowOffset: { width: 0, height: 4 }, shadowOpacity: 1, shadowRadius: 4.65 },\n { shadowOffset: { width: 0, height: 4 }, shadowOpacity: 1, shadowRadius: 5.46 },\n { shadowOffset: { width: 0, height: 5 }, shadowOpacity: 1, shadowRadius: 6.27 },\n] as const;\n\ninterface AnimatedWrapperProps extends ViewProps {\n isAnimation: boolean;\n elevationLevel?: ShadowLevel;\n duration?: number;\n}\n\nfunction AnimatedWrapper({\n isAnimation = true,\n elevationLevel = 0,\n duration = DEFAULT_DURATION,\n style,\n children,\n ...props\n}: AnimatedWrapperProps) {\n const { palette } = useTheme();\n const opacity = useSharedValue(0);\n\n // 그림자 및 기타 스타일을 플랫폼에 맞게 미리 계산\n const staticStyle = useMemo(() => {\n if (Platform.OS === 'ios') {\n const { shadowOpacity, ...rest } = IOS_SHADOW[elevationLevel];\n return { shadowColor: palette.elevationShadow[elevationLevel], ...rest };\n }\n return { shadowColor: palette.elevationShadow[elevationLevel] };\n }, [elevationLevel, palette]);\n\n // 애니메이션 스타일 정의 (iOS 그림자 및 Android elevation 처리)\n const animatedStyle = useAnimatedStyle(() => {\n if (Platform.OS === 'ios') {\n return { shadowOpacity: opacity.value * IOS_SHADOW[elevationLevel].shadowOpacity };\n }\n return { elevation: opacity.value * elevationLevel };\n }, [elevationLevel]);\n\n // 컴포넌트가 등장할 때 애니메이션 핸들링\n const onEntering = useCallback(() => {\n opacity.value = withTiming(1, { duration: SHADOW_DURATION });\n }, [opacity]);\n\n // 애니메이션 속성 메모이제이션\n const animationProps = useMemo(() => ({\n entering: FadeInDown.duration(duration).withCallback((finished) => {\n 'worklet';\n if (finished) {\n runOnJS(onEntering)();\n }\n }),\n exiting: FadeOut.duration(50),\n }), [duration, onEntering]);\n\n // 애니메이션이 비활성화된 경우 기본 View로 렌더링\n if (!isAnimation) {\n return <View style={[style, staticStyle]} {...props}>{children}</View>;\n }\n\n // 애니메이션이 적용된 View로 렌더링\n return (\n <Animated.View\n style={[style, staticStyle, animatedStyle]}\n {...animationProps}\n {...props}\n >\n {children}\n </Animated.View>\n );\n}\n\nexport default React.memo(AnimatedWrapper);\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ScrollView, ScrollViewProps } from 'react-native';
|
|
3
|
+
declare const ScrollViewAtom: React.ForwardRefExoticComponent<ScrollViewProps & React.RefAttributes<ScrollView>>;
|
|
4
|
+
export default ScrollViewAtom;
|
|
5
|
+
//# sourceMappingURL=ScrollViewAtom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollViewAtom.d.ts","sourceRoot":"","sources":["../../../src/ui/atoms/ScrollViewAtom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAK3D,QAAA,MAAM,cAAc,oFAQlB,CAAC;AAEH,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { ScrollView } from 'react-native';
|
|
3
|
+
// scrollViewRef를 제거하고 ref로 대체합니다.
|
|
4
|
+
const ScrollViewAtom = forwardRef(function ScrollViewAtom({ children, style, ...props }, ref) {
|
|
5
|
+
return (<ScrollView ref={ref} {...props} style={style}>
|
|
6
|
+
{children}
|
|
7
|
+
</ScrollView>);
|
|
8
|
+
});
|
|
9
|
+
export default ScrollViewAtom;
|
|
10
|
+
//# sourceMappingURL=ScrollViewAtom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollViewAtom.js","sourceRoot":"","sources":["../../../src/ui/atoms/ScrollViewAtom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;AAI3D,kCAAkC;AAClC,MAAM,cAAc,GAAG,UAAU,CAAkC,SAAS,cAAc,CACxF,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IAElC,OAAO,CACL,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAC5C;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\nimport { ScrollView, ScrollViewProps } from 'react-native';\n\ntype ScrollViewAtomProps = ScrollViewProps;\n\n// scrollViewRef를 제거하고 ref로 대체합니다.\nconst ScrollViewAtom = forwardRef<ScrollView, ScrollViewAtomProps>(function ScrollViewAtom(\n { children, style, ...props }, ref\n) {\n return (\n <ScrollView ref={ref} {...props} style={style}>\n {children}\n </ScrollView>\n );\n});\n\nexport default ScrollViewAtom;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextAtom.d.ts","sourceRoot":"","sources":["../../../src/ui/atoms/TextAtom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/C,KAAK,aAAa,GAAG,SAAS,GAAG,EAChC,CAAC;AAEF,iBAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,qBAMtD;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextAtom.js","sourceRoot":"","sources":["../../../src/ui/atoms/TextAtom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAK/C,SAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiB;IACrD,OAAO,CACL,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CACd;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAED,eAAe,QAAQ,CAAC","sourcesContent":["import React from 'react';\nimport { Text, TextProps } from 'react-native';\n\ntype TextAtomProps = TextProps & {\n};\n\nfunction TextAtom({ children, ...props }: TextAtomProps) {\n return (\n <Text {...props}>\n {children}\n </Text>\n );\n}\n\nexport default TextAtom;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewAtom.d.ts","sourceRoot":"","sources":["../../../src/ui/atoms/ViewAtom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/C,KAAK,aAAa,GAAG,SAAS,GAAG,EAChC,CAAC;AAEF,iBAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,qBAMtD;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewAtom.js","sourceRoot":"","sources":["../../../src/ui/atoms/ViewAtom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAK/C,SAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiB;IACrD,OAAO,CACL,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CACd;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAED,eAAe,QAAQ,CAAC","sourcesContent":["import React from 'react';\nimport { View, ViewProps } from 'react-native';\n\ntype ViewAtomProps = ViewProps & {\n};\n\nfunction ViewAtom({ children, ...props }: ViewAtomProps) {\n return (\n <View {...props}>\n {children}\n </View>\n );\n}\n\nexport default ViewAtom;\n"]}
|