@0610studio/zs-ui 0.5.1 → 0.5.3
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/build/model/useStyleSheetCreate.d.ts +1 -1
- package/build/model/useStyleSheetCreate.d.ts.map +1 -1
- package/build/model/useStyleSheetCreate.js.map +1 -1
- package/build/ui/ZSContainer/index.d.ts +0 -4
- package/build/ui/ZSContainer/index.d.ts.map +1 -1
- package/build/ui/ZSContainer/index.js +20 -10
- package/build/ui/ZSContainer/index.js.map +1 -1
- package/build/ui/ZSContainer/ui/VariantView.d.ts +2 -1
- package/build/ui/ZSContainer/ui/VariantView.d.ts.map +1 -1
- package/build/ui/ZSContainer/ui/VariantView.js +2 -2
- package/build/ui/ZSContainer/ui/VariantView.js.map +1 -1
- package/build/ui/ZSTextField/index.js +2 -2
- package/build/ui/ZSTextField/index.js.map +1 -1
- package/package.json +30 -4
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Theme } from "../theme/types";
|
|
2
|
-
export declare const useStyleSheetCreate: (createStyles: (palette: Theme) =>
|
|
2
|
+
export declare const useStyleSheetCreate: <T extends Record<string, any>>(createStyles: (palette: Theme) => T) => T;
|
|
3
3
|
//# sourceMappingURL=useStyleSheetCreate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStyleSheetCreate.d.ts","sourceRoot":"","sources":["../../src/model/useStyleSheetCreate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,eAAO,MAAM,mBAAmB,GAAI,cAAc,CAAC,OAAO,EAAE,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"useStyleSheetCreate.d.ts","sourceRoot":"","sources":["../../src/model/useStyleSheetCreate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/D,cAAc,CAAC,OAAO,EAAE,KAAK,KAAK,CAAC,KAClC,CAGF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStyleSheetCreate.js","sourceRoot":"","sources":["../../src/model/useStyleSheetCreate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,
|
|
1
|
+
{"version":3,"file":"useStyleSheetCreate.js","sourceRoot":"","sources":["../../src/model/useStyleSheetCreate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,YAAmC,EAChC,EAAE;IACL,MAAM,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC/B,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AACzD,CAAC,CAAC","sourcesContent":["import { useMemo } from \"react\";\nimport { Theme } from \"../theme/types\";\nimport { useTheme } from \"./useThemeProvider\";\n\nexport const useStyleSheetCreate = <T extends Record<string, any>>(\n createStyles: (palette: Theme) => T\n): T => {\n const { palette } = useTheme();\n return useMemo(() => createStyles(palette), [palette]);\n};"]}
|
|
@@ -12,8 +12,6 @@ export type ZSContainerProps = ViewProps & {
|
|
|
12
12
|
rightComponent?: ReactNode;
|
|
13
13
|
showsVerticalScrollIndicator?: boolean;
|
|
14
14
|
loadingComponent?: React.ReactNode;
|
|
15
|
-
keyboardVerticalOffset?: number;
|
|
16
|
-
behavior?: 'padding' | 'height' | 'position';
|
|
17
15
|
automaticallyAdjustKeyboardInsets?: boolean;
|
|
18
16
|
keyboardScrollExtraOffset?: number;
|
|
19
17
|
translucent?: boolean;
|
|
@@ -33,8 +31,6 @@ declare const ZSContainer: React.ForwardRefExoticComponent<ViewProps & {
|
|
|
33
31
|
rightComponent?: ReactNode;
|
|
34
32
|
showsVerticalScrollIndicator?: boolean;
|
|
35
33
|
loadingComponent?: React.ReactNode;
|
|
36
|
-
keyboardVerticalOffset?: number;
|
|
37
|
-
behavior?: "padding" | "height" | "position";
|
|
38
34
|
automaticallyAdjustKeyboardInsets?: boolean;
|
|
39
35
|
keyboardScrollExtraOffset?: number;
|
|
40
36
|
translucent?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ZSContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAgE,MAAM,OAAO,CAAC;AACvG,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ZSContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAgE,MAAM,OAAO,CAAC;AACvG,OAAO,EAAE,SAAS,EAA4C,UAAU,EAAE,oBAAoB,EAAE,iBAAiB,EAA4C,MAAM,cAAc,CAAC;AAKlL,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG;IACzC,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,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,iCAAiC,CAAC,EAAE,OAAO,CAAC;IAC5C,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACpE,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC;AAExC,QAAA,MAAM,WAAW;sBApBG,MAAM;eACb,OAAO;qBACD,MAAM;eACZ,eAAe,GAAG,cAAc;YACnC,KAAK,CAAC,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;yBAC7B,OAAO;mBACb,SAAS;sBACN,SAAS;qBACV,SAAS;mCACK,OAAO;uBACnB,KAAK,CAAC,SAAS;wCACE,OAAO;gCACf,MAAM;kBACpB,OAAO;eACV,CAAC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,KAAK,IAAI;0BAC7C,MAAM;oCAiK5B,CAAC;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;CAcjB,CAAC;AAEH,eAAe,WAAW,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useState, useEffect, useImperativeHandle, forwardRef, useRef } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StatusBar, StyleSheet, ActivityIndicator, Keyboard, View, Platform } from 'react-native';
|
|
3
3
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
4
4
|
import { useTheme } from '../../model/useThemeProvider';
|
|
5
5
|
import VariantView from './ui/VariantView';
|
|
6
|
-
const ZSContainer = forwardRef(function ZSContainer({ backgroundColor, isLoader = false, statusBarColor, barStyle, edges = ['top', 'bottom'], scrollViewDisabled = false, topComponent, bottomComponent, rightComponent, showsVerticalScrollIndicator = true, loadingComponent = <ActivityIndicator />,
|
|
6
|
+
const ZSContainer = forwardRef(function ZSContainer({ backgroundColor, isLoader = false, statusBarColor, barStyle, edges = ['top', 'bottom'], scrollViewDisabled = false, topComponent, bottomComponent, rightComponent, showsVerticalScrollIndicator = true, loadingComponent = <ActivityIndicator />, automaticallyAdjustKeyboardInsets = true, keyboardScrollExtraOffset, translucent, scrollEventThrottle = 100, ...props }, forwardedRef) {
|
|
7
7
|
const { palette, splitBreakpoint, splitRatio, dimensions: { height: windowHeight, width: windowWidth }, isSplitView } = useTheme();
|
|
8
8
|
const [isDelayed, setIsDelayed] = useState(true);
|
|
9
|
+
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
9
10
|
const positionRef = useRef(0);
|
|
10
11
|
const scrollViewRef = useRef(null);
|
|
11
12
|
const lastTouchY = useRef(0);
|
|
@@ -18,7 +19,10 @@ const ZSContainer = forwardRef(function ZSContainer({ backgroundColor, isLoader
|
|
|
18
19
|
return () => clearTimeout(timer);
|
|
19
20
|
}, []);
|
|
20
21
|
useEffect(() => {
|
|
21
|
-
const
|
|
22
|
+
const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
|
|
23
|
+
const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';
|
|
24
|
+
const keyboardShowSubscription = Keyboard.addListener(showEvent, (e) => {
|
|
25
|
+
setKeyboardHeight(e.endCoordinates.height);
|
|
22
26
|
if (scrollViewRef.current && keyboardScrollExtraOffset) {
|
|
23
27
|
const screenHeight = windowHeight;
|
|
24
28
|
const keyboardHeight = e.endCoordinates.height;
|
|
@@ -28,16 +32,22 @@ const ZSContainer = forwardRef(function ZSContainer({ backgroundColor, isLoader
|
|
|
28
32
|
const currentScrollPosition = positionRef.current || 0;
|
|
29
33
|
const touchPosition = lastTouchY.current || 0;
|
|
30
34
|
const scrollOffset = touchPosition - availableScreenHeight + keyboardScrollExtraOffset;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
scrollViewRef.current?.scrollTo({
|
|
37
|
+
y: currentScrollPosition + scrollOffset,
|
|
38
|
+
animated: true,
|
|
39
|
+
});
|
|
40
|
+
}, 150);
|
|
35
41
|
}
|
|
36
42
|
});
|
|
43
|
+
const keyboardHideSubscription = Keyboard.addListener(hideEvent, () => {
|
|
44
|
+
setKeyboardHeight(0);
|
|
45
|
+
});
|
|
37
46
|
return () => {
|
|
38
47
|
positionRef.current = null;
|
|
39
48
|
lastTouchY.current = null;
|
|
40
49
|
keyboardShowSubscription.remove();
|
|
50
|
+
keyboardHideSubscription.remove();
|
|
41
51
|
};
|
|
42
52
|
}, [keyboardScrollExtraOffset]);
|
|
43
53
|
const handleScroll = (event) => {
|
|
@@ -58,7 +68,7 @@ const ZSContainer = forwardRef(function ZSContainer({ backgroundColor, isLoader
|
|
|
58
68
|
return (<View style={styles.splitContainer}>
|
|
59
69
|
|
|
60
70
|
{/* 메인 컴포넌트 */}
|
|
61
|
-
<VariantView style={props.style} children={props.children} scrollViewRef={scrollViewRef} variantWidth={leftWidth} showsVerticalScrollIndicator={showsVerticalScrollIndicator} automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets} scrollViewDisabled={scrollViewDisabled} scrollEventThrottle={scrollEventThrottle} handleScroll={handleScroll} handleTouch={handleTouch}/>
|
|
71
|
+
<VariantView style={props.style} children={props.children} scrollViewRef={scrollViewRef} variantWidth={leftWidth} showsVerticalScrollIndicator={showsVerticalScrollIndicator} automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets} scrollViewDisabled={scrollViewDisabled} scrollEventThrottle={scrollEventThrottle} handleScroll={handleScroll} handleTouch={handleTouch} keyboardHeight={keyboardHeight}/>
|
|
62
72
|
|
|
63
73
|
{/* 폴드/태블릿 화면 오른쪽 컴포넌트 */}
|
|
64
74
|
{rightComponent && splitEnabled && (<VariantView style={styles.splitView} children={rightComponent} variantWidth={rightWidth} showsVerticalScrollIndicator={showsVerticalScrollIndicator} automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets} scrollViewDisabled={false} scrollEventThrottle={scrollEventThrottle}/>)}
|
|
@@ -69,11 +79,11 @@ const ZSContainer = forwardRef(function ZSContainer({ backgroundColor, isLoader
|
|
|
69
79
|
styles.flex1,
|
|
70
80
|
{ width: '100%' },
|
|
71
81
|
]} edges={edges}>
|
|
72
|
-
{!isDelayed && (<
|
|
82
|
+
{!isDelayed && (<View style={[styles.flex1, { width: '100%' }]}>
|
|
73
83
|
{topComponent && topComponent}
|
|
74
84
|
{renderContent()}
|
|
75
85
|
{!isLoader && bottomComponent && bottomComponent}
|
|
76
|
-
</
|
|
86
|
+
</View>)}
|
|
77
87
|
|
|
78
88
|
{(barStyle || statusBarColor || translucent) && (<StatusBar barStyle={barStyle} backgroundColor={statusBarColor || palette.background.base} translucent={translucent}/>)}
|
|
79
89
|
</SafeAreaView>);
|
|
@@ -1 +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,mBAAmB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvG,OAAO,EAAa,oBAAoB,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAuD,QAAQ,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAC9L,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAyB3C,MAAM,WAAW,GAAG,UAAU,CAAmC,SAAS,WAAW,CACnF,EACE,eAAe,EACf,QAAQ,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QACpB,QAAQ,EAAE,CAAC;QACX,UAAU,EAAE,QAAQ;KACrB;IACD,cAAc,EAAE;QACd,IAAI,EAAE,CAAC;QACP,aAAa,EAAE,KAAK;QACpB,KAAK,EAAE,MAAM;KACd;IACD,SAAS,EAAE;QACT,SAAS,EAAE,MAAM;KAClB;CACF,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC","sourcesContent":["import React, { ReactNode, useState, useEffect, useImperativeHandle, forwardRef, useRef } from 'react';\r\nimport { ViewProps, KeyboardAvoidingView, StatusBar, StyleSheet, ActivityIndicator, ScrollView, NativeSyntheticEvent, NativeScrollEvent, Keyboard, View, DimensionValue } from 'react-native';\r\nimport { SafeAreaView } from 'react-native-safe-area-context';\r\nimport { useTheme } from '../../model/useThemeProvider';\r\nimport VariantView from './ui/VariantView';\r\n\r\nexport type ZSContainerProps = ViewProps & {\r\n backgroundColor?: string;\r\n isLoader?: boolean;\r\n statusBarColor?: string;\r\n barStyle?: 'light-content' | 'dark-content';\r\n edges?: Array<'top' | 'right' | 'bottom' | 'left'>;\r\n scrollViewDisabled?: boolean;\r\n topComponent?: ReactNode;\r\n bottomComponent?: ReactNode;\r\n rightComponent?: ReactNode;\r\n showsVerticalScrollIndicator?: boolean;\r\n loadingComponent?: React.ReactNode;\r\n keyboardVerticalOffset?: number;\r\n behavior?: 'padding' | 'height' | 'position';\r\n automaticallyAdjustKeyboardInsets?: boolean;\r\n keyboardScrollExtraOffset?: number;\r\n translucent?: boolean;\r\n onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;\r\n scrollEventThrottle?: number;\r\n};\r\n\r\nexport type ZSContainerRef = ScrollView;\r\n\r\nconst ZSContainer = forwardRef<ZSContainerRef, ZSContainerProps>(function ZSContainer(\r\n {\r\n backgroundColor,\r\n isLoader = false,\r\n statusBarColor,\r\n barStyle,\r\n edges = ['top', 'bottom'],\r\n scrollViewDisabled = false,\r\n topComponent,\r\n bottomComponent,\r\n rightComponent,\r\n showsVerticalScrollIndicator = true,\r\n loadingComponent = <ActivityIndicator />,\r\n keyboardVerticalOffset,\r\n behavior,\r\n automaticallyAdjustKeyboardInsets = true,\r\n keyboardScrollExtraOffset,\r\n translucent,\r\n scrollEventThrottle = 100,\r\n ...props\r\n },\r\n forwardedRef\r\n) {\r\n const { palette, splitBreakpoint, splitRatio, dimensions: { height: windowHeight, width: windowWidth }, isSplitView } = useTheme();\r\n const [isDelayed, setIsDelayed] = useState(true);\r\n const positionRef = useRef<number | null>(0);\r\n const scrollViewRef = useRef<ScrollView>(null);\r\n const lastTouchY = useRef<number | null>(0);\r\n const splitEnabled = !!(isSplitView && (windowWidth >= splitBreakpoint) && rightComponent);\r\n\r\n useImperativeHandle(forwardedRef, () => scrollViewRef.current as ScrollView, []);\r\n\r\n useEffect(() => {\r\n const timer = setTimeout(() => {\r\n setIsDelayed(false);\r\n }, 200);\r\n return () => clearTimeout(timer);\r\n }, []);\r\n\r\n useEffect(() => {\r\n const keyboardShowSubscription = Keyboard.addListener('keyboardDidShow', (e) => {\r\n if (scrollViewRef.current && keyboardScrollExtraOffset) {\r\n const screenHeight = windowHeight;\r\n const keyboardHeight = e.endCoordinates.height;\r\n const safeAreaBottom = 0;\r\n const availableScreenHeight = screenHeight - keyboardHeight - safeAreaBottom;\r\n\r\n // 현재 터치 위치와 스크롤 위치를 기반으로 새로운 스크롤 위치 계산\r\n const currentScrollPosition = positionRef.current || 0;\r\n const touchPosition = lastTouchY.current || 0;\r\n\r\n const scrollOffset = touchPosition - availableScreenHeight + keyboardScrollExtraOffset;\r\n scrollViewRef.current.scrollTo({\r\n y: currentScrollPosition + scrollOffset,\r\n animated: true,\r\n });\r\n }\r\n });\r\n\r\n return () => {\r\n positionRef.current = null;\r\n lastTouchY.current = null;\r\n keyboardShowSubscription.remove();\r\n };\r\n }, [keyboardScrollExtraOffset]);\r\n\r\n const handleScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {\r\n if (props.onScroll) props.onScroll(event);\r\n if (keyboardScrollExtraOffset) positionRef.current = event.nativeEvent.contentOffset.y;\r\n };\r\n\r\n const handleTouch = (evt: any) => {\r\n if (keyboardScrollExtraOffset) lastTouchY.current = evt.nativeEvent.pageY;\r\n };\r\n\r\n const renderContent = () => {\r\n if (isLoader) return loadingComponent;\r\n\r\n const leftWidth = (splitEnabled ? `${splitRatio * 100}%` : '100%') as DimensionValue;\r\n const rightWidth = `${(1 - splitRatio) * 100}%` as DimensionValue;\r\n\r\n return (\r\n <View style={styles.splitContainer}>\r\n\r\n {/* 메인 컴포넌트 */}\r\n <VariantView\r\n style={props.style}\r\n children={props.children}\r\n scrollViewRef={scrollViewRef}\r\n variantWidth={leftWidth}\r\n showsVerticalScrollIndicator={showsVerticalScrollIndicator}\r\n automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets}\r\n scrollViewDisabled={scrollViewDisabled}\r\n scrollEventThrottle={scrollEventThrottle}\r\n handleScroll={handleScroll}\r\n handleTouch={handleTouch}\r\n />\r\n\r\n {/* 폴드/태블릿 화면 오른쪽 컴포넌트 */}\r\n {rightComponent && splitEnabled && (\r\n <VariantView\r\n style={styles.splitView}\r\n children={rightComponent}\r\n variantWidth={rightWidth}\r\n showsVerticalScrollIndicator={showsVerticalScrollIndicator}\r\n automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets}\r\n scrollViewDisabled={false}\r\n scrollEventThrottle={scrollEventThrottle}\r\n />\r\n )}\r\n </View>\r\n );\r\n };\r\n\r\n return (\r\n <SafeAreaView\r\n style={[\r\n { backgroundColor: backgroundColor || palette.background.base },\r\n styles.flex1,\r\n { width: '100%' },\r\n ]}\r\n edges={edges}\r\n >\r\n {!isDelayed && (\r\n <KeyboardAvoidingView\r\n style={[styles.flex1, { width: '100%' }]}\r\n behavior={behavior}\r\n keyboardVerticalOffset={keyboardVerticalOffset}\r\n >\r\n {topComponent && topComponent}\r\n {renderContent()}\r\n {!isLoader && bottomComponent && bottomComponent}\r\n </KeyboardAvoidingView>\r\n )}\r\n\r\n {\r\n (barStyle || statusBarColor || translucent) && (\r\n <StatusBar\r\n barStyle={barStyle}\r\n backgroundColor={statusBarColor || palette.background.base}\r\n translucent={translucent}\r\n />\r\n )\r\n }\r\n </SafeAreaView>\r\n );\r\n});\r\n\r\nexport const styles = StyleSheet.create({\r\n flex1: { flex: 1 },\r\n scrollContainerStyle: {\r\n flexGrow: 1,\r\n alignItems: 'center',\r\n },\r\n splitContainer: {\r\n flex: 1,\r\n flexDirection: 'row',\r\n width: '100%',\r\n },\r\n splitView: {\r\n minHeight: '100%',\r\n },\r\n});\r\n\r\nexport default ZSContainer;\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,QAAQ,EAAE,SAAS,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvG,OAAO,EAAa,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAuD,QAAQ,EAAE,IAAI,EAAkB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAClL,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAuB3C,MAAM,WAAW,GAAG,UAAU,CAAmC,SAAS,WAAW,CACnF,EACE,eAAe,EACf,QAAQ,GAAG,KAAK,EAChB,cAAc,EACd,QAAQ,EACR,KAAK,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,EACzB,kBAAkB,GAAG,KAAK,EAC1B,YAAY,EACZ,eAAe,EACf,cAAc,EACd,4BAA4B,GAAG,IAAI,EACnC,gBAAgB,GAAG,CAAC,iBAAiB,CAAC,AAAD,EAAG,EACxC,iCAAiC,GAAG,IAAI,EACxC,yBAAyB,EACzB,WAAW,EACX,mBAAmB,GAAG,GAAG,EACzB,GAA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C,CAAC,WAAW,CAAC,EACzB,CAEN,CACF;IAAA,EAAE,YAAY,CAAC,CAChB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IACtC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;IAClB,oBAAoB,EAAE;QACpB,QAAQ,EAAE,CAAC;QACX,UAAU,EAAE,QAAQ;KACrB;IACD,cAAc,EAAE;QACd,IAAI,EAAE,CAAC;QACP,aAAa,EAAE,KAAK;QACpB,KAAK,EAAE,MAAM;KACd;IACD,SAAS,EAAE;QACT,SAAS,EAAE,MAAM;KAClB;CACF,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC","sourcesContent":["import React, { ReactNode, useState, useEffect, useImperativeHandle, forwardRef, useRef } from 'react';\r\nimport { ViewProps, StatusBar, StyleSheet, ActivityIndicator, ScrollView, NativeSyntheticEvent, NativeScrollEvent, Keyboard, View, DimensionValue, Platform } from 'react-native';\r\nimport { SafeAreaView } from 'react-native-safe-area-context';\r\nimport { useTheme } from '../../model/useThemeProvider';\r\nimport VariantView from './ui/VariantView';\r\n\r\nexport type ZSContainerProps = ViewProps & {\r\n backgroundColor?: string;\r\n isLoader?: boolean;\r\n statusBarColor?: string;\r\n barStyle?: 'light-content' | 'dark-content';\r\n edges?: Array<'top' | 'right' | 'bottom' | 'left'>;\r\n scrollViewDisabled?: boolean;\r\n topComponent?: ReactNode;\r\n bottomComponent?: ReactNode;\r\n rightComponent?: ReactNode;\r\n showsVerticalScrollIndicator?: boolean;\r\n loadingComponent?: React.ReactNode;\r\n automaticallyAdjustKeyboardInsets?: boolean;\r\n keyboardScrollExtraOffset?: number;\r\n translucent?: boolean;\r\n onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;\r\n scrollEventThrottle?: number;\r\n};\r\n\r\nexport type ZSContainerRef = ScrollView;\r\n\r\nconst ZSContainer = forwardRef<ZSContainerRef, ZSContainerProps>(function ZSContainer(\r\n {\r\n backgroundColor,\r\n isLoader = false,\r\n statusBarColor,\r\n barStyle,\r\n edges = ['top', 'bottom'],\r\n scrollViewDisabled = false,\r\n topComponent,\r\n bottomComponent,\r\n rightComponent,\r\n showsVerticalScrollIndicator = true,\r\n loadingComponent = <ActivityIndicator />,\r\n automaticallyAdjustKeyboardInsets = true,\r\n keyboardScrollExtraOffset,\r\n translucent,\r\n scrollEventThrottle = 100,\r\n ...props\r\n },\r\n forwardedRef\r\n) {\r\n const { palette, splitBreakpoint, splitRatio, dimensions: { height: windowHeight, width: windowWidth }, isSplitView } = useTheme();\r\n const [isDelayed, setIsDelayed] = useState(true);\r\n const [keyboardHeight, setKeyboardHeight] = useState(0);\r\n const positionRef = useRef<number | null>(0);\r\n const scrollViewRef = useRef<ScrollView>(null);\r\n const lastTouchY = useRef<number | null>(0);\r\n const splitEnabled = !!(isSplitView && (windowWidth >= splitBreakpoint) && rightComponent);\r\n\r\n useImperativeHandle(forwardedRef, () => scrollViewRef.current as ScrollView, []);\r\n\r\n useEffect(() => {\r\n const timer = setTimeout(() => {\r\n setIsDelayed(false);\r\n }, 200);\r\n return () => clearTimeout(timer);\r\n }, []);\r\n\r\n\r\n useEffect(() => {\r\n const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';\r\n const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';\r\n\r\n const keyboardShowSubscription = Keyboard.addListener(showEvent, (e) => {\r\n setKeyboardHeight(e.endCoordinates.height);\r\n if (scrollViewRef.current && keyboardScrollExtraOffset) {\r\n const screenHeight = windowHeight;\r\n const keyboardHeight = e.endCoordinates.height;\r\n const safeAreaBottom = 0;\r\n const availableScreenHeight = screenHeight - keyboardHeight - safeAreaBottom;\r\n\r\n // 현재 터치 위치와 스크롤 위치를 기반으로 새로운 스크롤 위치 계산\r\n const currentScrollPosition = positionRef.current || 0;\r\n const touchPosition = lastTouchY.current || 0;\r\n const scrollOffset = touchPosition - availableScreenHeight + keyboardScrollExtraOffset;\r\n\r\n setTimeout(() => {\r\n scrollViewRef.current?.scrollTo({\r\n y: currentScrollPosition + scrollOffset,\r\n animated: true,\r\n });\r\n }, 150);\r\n }\r\n });\r\n\r\n const keyboardHideSubscription = Keyboard.addListener(hideEvent, () => {\r\n setKeyboardHeight(0);\r\n });\r\n\r\n return () => {\r\n positionRef.current = null;\r\n lastTouchY.current = null;\r\n keyboardShowSubscription.remove();\r\n keyboardHideSubscription.remove();\r\n };\r\n }, [keyboardScrollExtraOffset]);\r\n\r\n const handleScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {\r\n if (props.onScroll) props.onScroll(event);\r\n if (keyboardScrollExtraOffset) positionRef.current = event.nativeEvent.contentOffset.y;\r\n };\r\n\r\n const handleTouch = (evt: any) => {\r\n if (keyboardScrollExtraOffset) lastTouchY.current = evt.nativeEvent.pageY;\r\n };\r\n\r\n const renderContent = () => {\r\n if (isLoader) return loadingComponent;\r\n\r\n const leftWidth = (splitEnabled ? `${splitRatio * 100}%` : '100%') as DimensionValue;\r\n const rightWidth = `${(1 - splitRatio) * 100}%` as DimensionValue;\r\n\r\n return (\r\n <View style={styles.splitContainer}>\r\n\r\n {/* 메인 컴포넌트 */}\r\n <VariantView\r\n style={props.style}\r\n children={props.children}\r\n scrollViewRef={scrollViewRef}\r\n variantWidth={leftWidth}\r\n showsVerticalScrollIndicator={showsVerticalScrollIndicator}\r\n automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets}\r\n scrollViewDisabled={scrollViewDisabled}\r\n scrollEventThrottle={scrollEventThrottle}\r\n handleScroll={handleScroll}\r\n handleTouch={handleTouch}\r\n keyboardHeight={keyboardHeight}\r\n />\r\n\r\n {/* 폴드/태블릿 화면 오른쪽 컴포넌트 */}\r\n {rightComponent && splitEnabled && (\r\n <VariantView\r\n style={styles.splitView}\r\n children={rightComponent}\r\n variantWidth={rightWidth}\r\n showsVerticalScrollIndicator={showsVerticalScrollIndicator}\r\n automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets}\r\n scrollViewDisabled={false}\r\n scrollEventThrottle={scrollEventThrottle}\r\n />\r\n )}\r\n </View>\r\n );\r\n };\r\n\r\n return (\r\n <SafeAreaView\r\n style={[\r\n { backgroundColor: backgroundColor || palette.background.base },\r\n styles.flex1,\r\n { width: '100%' },\r\n ]}\r\n edges={edges}\r\n >\r\n {!isDelayed && (\r\n <View\r\n style={[styles.flex1, { width: '100%' }]}\r\n >\r\n {topComponent && topComponent}\r\n {renderContent()}\r\n {!isLoader && bottomComponent && bottomComponent}\r\n </View>\r\n )}\r\n\r\n {\r\n (barStyle || statusBarColor || translucent) && (\r\n <StatusBar\r\n barStyle={barStyle}\r\n backgroundColor={statusBarColor || palette.background.base}\r\n translucent={translucent}\r\n />\r\n )\r\n }\r\n </SafeAreaView>\r\n );\r\n});\r\n\r\nexport const styles = StyleSheet.create({\r\n flex1: { flex: 1 },\r\n scrollContainerStyle: {\r\n flexGrow: 1,\r\n alignItems: 'center',\r\n },\r\n splitContainer: {\r\n flex: 1,\r\n flexDirection: 'row',\r\n width: '100%',\r\n },\r\n splitView: {\r\n minHeight: '100%',\r\n },\r\n});\r\n\r\nexport default ZSContainer;\r\n"]}
|
|
@@ -10,7 +10,8 @@ interface VariantViewProps {
|
|
|
10
10
|
handleScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
11
11
|
handleTouch?: (event: any) => void;
|
|
12
12
|
scrollEventThrottle?: number;
|
|
13
|
+
keyboardHeight?: number;
|
|
13
14
|
}
|
|
14
|
-
export default function VariantView({ children, scrollViewDisabled, style, scrollViewRef, variantWidth, showsVerticalScrollIndicator, automaticallyAdjustKeyboardInsets, handleScroll, handleTouch, scrollEventThrottle }: VariantViewProps): import("react").JSX.Element;
|
|
15
|
+
export default function VariantView({ children, scrollViewDisabled, style, scrollViewRef, variantWidth, showsVerticalScrollIndicator, automaticallyAdjustKeyboardInsets, handleScroll, handleTouch, scrollEventThrottle, keyboardHeight }: VariantViewProps): import("react").JSX.Element;
|
|
15
16
|
export {};
|
|
16
17
|
//# sourceMappingURL=VariantView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VariantView.d.ts","sourceRoot":"","sources":["../../../../src/ui/ZSContainer/ui/VariantView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,iBAAiB,EAAQ,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/H,UAAU,gBAAgB;
|
|
1
|
+
{"version":3,"file":"VariantView.d.ts","sourceRoot":"","sources":["../../../../src/ui/ZSContainer/ui/VariantView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,iBAAiB,EAAQ,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/H,UAAU,gBAAgB;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC5C,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,iCAAiC,CAAC,EAAE,OAAO,CAAC;IAC5C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACxE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,4BAA4B,EAAE,iCAAiC,EAAE,YAAY,EAAE,WAAW,EAAE,mBAAmB,EAAE,cAAc,EAAE,EAAE,gBAAgB,+BA0B1P"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { styles } from '..';
|
|
2
2
|
import { ScrollView, View } from 'react-native';
|
|
3
|
-
export default function VariantView({ children, scrollViewDisabled, style, scrollViewRef, variantWidth, showsVerticalScrollIndicator, automaticallyAdjustKeyboardInsets, handleScroll, handleTouch, scrollEventThrottle }) {
|
|
3
|
+
export default function VariantView({ children, scrollViewDisabled, style, scrollViewRef, variantWidth, showsVerticalScrollIndicator, automaticallyAdjustKeyboardInsets, handleScroll, handleTouch, scrollEventThrottle, keyboardHeight }) {
|
|
4
4
|
return (scrollViewDisabled ? (<View style={[style, { width: variantWidth }]}>
|
|
5
5
|
{children}
|
|
6
|
-
</View>) : (<ScrollView ref={scrollViewRef} style={{ width: variantWidth }} contentContainerStyle={styles.scrollContainerStyle} bounces={false} overScrollMode="never" showsVerticalScrollIndicator={showsVerticalScrollIndicator} keyboardShouldPersistTaps="handled" automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets} onScroll={handleScroll} onTouchStart={handleTouch} scrollEventThrottle={scrollEventThrottle}>
|
|
6
|
+
</View>) : (<ScrollView ref={scrollViewRef} style={{ width: variantWidth, paddingBottom: keyboardHeight || 0 }} contentContainerStyle={styles.scrollContainerStyle} bounces={false} overScrollMode="never" showsVerticalScrollIndicator={showsVerticalScrollIndicator} keyboardShouldPersistTaps="handled" automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets} onScroll={handleScroll} onTouchStart={handleTouch} scrollEventThrottle={scrollEventThrottle}>
|
|
7
7
|
<View style={[styles.splitView, style, { width: '100%' }]}>
|
|
8
8
|
{children}
|
|
9
9
|
</View>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VariantView.js","sourceRoot":"","sources":["../../../../src/ui/ZSContainer/ui/VariantView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,UAAU,EAA2C,IAAI,EAAwC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"VariantView.js","sourceRoot":"","sources":["../../../../src/ui/ZSContainer/ui/VariantView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,UAAU,EAA2C,IAAI,EAAwC,MAAM,cAAc,CAAC;AAgB/H,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,4BAA4B,EAAE,iCAAiC,EAAE,YAAY,EAAE,WAAW,EAAE,mBAAmB,EAAE,cAAc,EAAoB;IACzP,OAAO,CACL,kBAAkB,CAAC,CAAC,CAAC,CACnB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC,CAC5C;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,CACF,CAAC,UAAU,CACT,GAAG,CAAC,CAAC,aAAa,CAAC,CACnB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,IAAI,CAAC,EAAE,CAAC,CACnE,qBAAqB,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CACnD,OAAO,CAAC,CAAC,KAAK,CAAC,CACf,cAAc,CAAC,OAAO,CACtB,4BAA4B,CAAC,CAAC,4BAA4B,CAAC,CAC3D,yBAAyB,CAAC,SAAS,CACnC,iCAAiC,CAAC,CAAC,iCAAiC,CAAC,CACrE,QAAQ,CAAC,CAAC,YAAY,CAAC,CACvB,YAAY,CAAC,CAAC,WAAW,CAAC,CAC1B,mBAAmB,CAAC,CAAC,mBAAmB,CAAC,CAEzC;QAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CACxD;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,UAAU,CAAC,CACd,CACF,CAAA;AACH,CAAC","sourcesContent":["import { styles } from '..';\nimport { ScrollView, NativeSyntheticEvent, NativeScrollEvent, View, DimensionValue, StyleProp, ViewStyle } from 'react-native';\n\ninterface VariantViewProps {\n children: React.ReactNode;\n scrollViewDisabled?: boolean;\n style: StyleProp<ViewStyle>;\n scrollViewRef?: React.RefObject<ScrollView>;\n variantWidth?: DimensionValue;\n showsVerticalScrollIndicator?: boolean;\n automaticallyAdjustKeyboardInsets?: boolean;\n handleScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;\n handleTouch?: (event: any) => void;\n scrollEventThrottle?: number;\n keyboardHeight?: number;\n}\n\nexport default function VariantView({ children, scrollViewDisabled, style, scrollViewRef, variantWidth, showsVerticalScrollIndicator, automaticallyAdjustKeyboardInsets, handleScroll, handleTouch, scrollEventThrottle, keyboardHeight }: VariantViewProps) {\n return (\n scrollViewDisabled ? (\n <View style={[style, { width: variantWidth }]}>\n {children}\n </View>\n ) : (\n <ScrollView\n ref={scrollViewRef}\n style={{ width: variantWidth, paddingBottom: keyboardHeight || 0 }}\n contentContainerStyle={styles.scrollContainerStyle}\n bounces={false}\n overScrollMode=\"never\"\n showsVerticalScrollIndicator={showsVerticalScrollIndicator}\n keyboardShouldPersistTaps=\"handled\"\n automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets}\n onScroll={handleScroll}\n onTouchStart={handleTouch}\n scrollEventThrottle={scrollEventThrottle}\n >\n <View style={[styles.splitView, style, { width: '100%' }]}>\n {children}\n </View>\n </ScrollView>\n )\n )\n}"]}
|
|
@@ -24,10 +24,10 @@ function ZSTextField({ typo = 'body.2', status = 'default', value, onChangeText,
|
|
|
24
24
|
}, [value, isFocused]);
|
|
25
25
|
// 라벨 애니메이션 스타일
|
|
26
26
|
const animatedLabelStyle = useAnimatedStyle(() => {
|
|
27
|
-
const labelFontSize = interpolate(labelAnimationValue.value, [0, 1], [fontSize + (boxStyle === 'inbox' ?
|
|
27
|
+
const labelFontSize = interpolate(labelAnimationValue.value, [0, 1], [fontSize + (boxStyle === 'inbox' ? 1 : 0), boxStyle === 'inbox' ? 10 : 11], 'clamp');
|
|
28
28
|
const labelTop = interpolate(labelAnimationValue.value, [0, 1], [
|
|
29
29
|
isTextArea ? 12 : 0,
|
|
30
|
-
isTextArea ? -12 : -(boxHeightValue.value / 2) - 1 + (boxStyle === 'inbox' ? 17 :
|
|
30
|
+
isTextArea ? -12 : -(boxHeightValue.value / 2) - 1 + (boxStyle === 'inbox' ? 17 : 2),
|
|
31
31
|
], 'clamp');
|
|
32
32
|
return {
|
|
33
33
|
top: labelTop,
|
|
@@ -1 +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,OAAO,CAAC;AACzE,OAAO,EAAqB,QAAQ,EAAa,SAAS,EAAwC,MAAM,cAAc,CAAC;AACvH,OAAO,QAAQ,EAAE,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC9G,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AAIzC,MAAM,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C,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,EAAG,CACpF,CACH;MAAA,EAAE,QAAQ,CAEV;;MAAA,CAAC,MAAM,KAAK,OAAO,IAAI,YAAY,IAAI,CACrC,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,EAAG,CACxE,CACH;IAAA,EAAE,QAAQ,CAAC,CACZ,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import React, { useMemo, useCallback, useState, useEffect } from 'react';\nimport { LayoutChangeEvent, Platform, 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\nconst iosOffset = Platform.OS === 'ios' ? 8 : 4;\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,\n placeHolderColor,\n inputBgColor,\n labelBgColor,\n borderWidth = 1.2,\n borderColor,\n focusColor,\n errorColor,\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 let fErrorColor = errorColor || palette.danger.main;\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 labelAnimationValue.value = withTiming(\n value !== '' || isFocused ? 1 : 0,\n { duration: 150 }\n );\n }, [value, isFocused]);\n\n // 라벨 애니메이션 스타일\n const animatedLabelStyle = useAnimatedStyle(() => {\n const labelFontSize = interpolate(\n labelAnimationValue.value,\n [0, 1],\n [fontSize + (boxStyle === 'inbox' ? 2 : 0), boxStyle === 'inbox' ? 11 : 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' ? 17 : 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' ? fErrorColor : isFocused ? (focusColor || palette.primary.main) : (borderColor || palette.grey[30])\n ), [status, fErrorColor, isFocused, focusColor, borderColor, palette]);\n\n // 상태에 따른 라벨 색상 설정\n const computedLabelColor = useMemo(() => (\n status === 'error' ? fErrorColor : isFocused ? (focusColor || palette.primary.main) : value ? (labelColor || palette.text.secondary) : (placeHolderColor || palette.grey[40])\n ), [status, fErrorColor, isFocused, focusColor, value, placeHolderColor, labelColor, palette]);\n\n // 컨테이너 스타일 정의\n const containerStyle: StyleProp<ViewStyle> = useMemo(() => ({\n width: '100%',\n justifyContent: isTextArea ? 'flex-start' : 'center',\n borderRadius,\n paddingHorizontal,\n backgroundColor: inputBgColor || palette.background.base,\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, palette]);\n\n // 라벨 스타일 정의\n const labelTextStyle: StyleProp<TextStyle> = useMemo(() => ({\n fontSize,\n left: paddingHorizontal,\n backgroundColor: labelBgColor || palette.background.base,\n paddingHorizontal: boxStyle === 'outline' ? 5 : 0,\n paddingVertical: 2,\n textAlignVertical: 'center',\n fontFamily,\n borderRadius: boxStyle === 'outline' ? 5 : 0,\n overflow: 'hidden',\n }), [fontSize, paddingHorizontal, labelBgColor, boxStyle, fontFamily, palette]);\n\n // 텍스트 변경 핸들러\n const handleTextChange = useCallback((text: string) => {\n if (onChangeText) onChangeText(text);\n }, [onChangeText]);\n\n return (\n <ViewAtom style={{ alignSelf: 'stretch', width: '100%' }}>\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 + iosOffset, paddingBottom: 5 + iosOffset, color: palette.text.base },\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 autoCorrect={false}\n spellCheck={false}\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={fErrorColor} />\n )}\n </ViewAtom>\n );\n}\n\nexport default React.memo(ZSTextField);\n"]}
|
|
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,OAAO,CAAC;AACzE,OAAO,EAAqB,QAAQ,EAAa,SAAS,EAAwC,MAAM,cAAc,CAAC;AACvH,OAAO,QAAQ,EAAE,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,U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AAE,KAAK,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAC5H;YAAA,CAAC,KAAK,CACR;UAAA,EAAE,QAAQ,CAAC,IAAI,CACjB;QAAA,EAAE,QAAQ,CAEV;;QAAA,CAAC,CAAC,KAAK,IAAI,SAAS,CAAC,IAAI,CACvB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,EAAG,CACpF,CACH;MAAA,EAAE,QAAQ,CAEV;;MAAA,CAAC,MAAM,KAAK,OAAO,IAAI,YAAY,IAAI,CACrC,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,EAAG,CACxE,CACH;IAAA,EAAE,QAAQ,CAAC,CACZ,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import React, { useMemo, useCallback, useState, useEffect } from 'react';\nimport { LayoutChangeEvent, Platform, 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\nconst iosOffset = Platform.OS === 'ios' ? 8 : 4;\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,\n placeHolderColor,\n inputBgColor,\n labelBgColor,\n borderWidth = 1.2,\n borderColor,\n focusColor,\n errorColor,\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 let fErrorColor = errorColor || palette.danger.main;\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 labelAnimationValue.value = withTiming(\n value !== '' || isFocused ? 1 : 0,\n { duration: 150 }\n );\n }, [value, isFocused]);\n\n // 라벨 애니메이션 스타일\n const animatedLabelStyle = useAnimatedStyle(() => {\n const labelFontSize = interpolate(\n labelAnimationValue.value,\n [0, 1],\n [fontSize + (boxStyle === 'inbox' ? 1 : 0), boxStyle === 'inbox' ? 10 : 11],\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' ? 17 : 2),\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' ? fErrorColor : isFocused ? (focusColor || palette.primary.main) : (borderColor || palette.grey[30])\n ), [status, fErrorColor, isFocused, focusColor, borderColor, palette]);\n\n // 상태에 따른 라벨 색상 설정\n const computedLabelColor = useMemo(() => (\n status === 'error' ? fErrorColor : isFocused ? (focusColor || palette.primary.main) : value ? (labelColor || palette.text.secondary) : (placeHolderColor || palette.grey[40])\n ), [status, fErrorColor, isFocused, focusColor, value, placeHolderColor, labelColor, palette]);\n\n // 컨테이너 스타일 정의\n const containerStyle: StyleProp<ViewStyle> = useMemo(() => ({\n width: '100%',\n justifyContent: isTextArea ? 'flex-start' : 'center',\n borderRadius,\n paddingHorizontal,\n backgroundColor: inputBgColor || palette.background.base,\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, palette]);\n\n // 라벨 스타일 정의\n const labelTextStyle: StyleProp<TextStyle> = useMemo(() => ({\n fontSize,\n left: paddingHorizontal,\n backgroundColor: labelBgColor || palette.background.base,\n paddingHorizontal: boxStyle === 'outline' ? 5 : 0,\n paddingVertical: 2,\n textAlignVertical: 'center',\n fontFamily,\n borderRadius: boxStyle === 'outline' ? 5 : 0,\n overflow: 'hidden',\n }), [fontSize, paddingHorizontal, labelBgColor, boxStyle, fontFamily, palette]);\n\n // 텍스트 변경 핸들러\n const handleTextChange = useCallback((text: string) => {\n if (onChangeText) onChangeText(text);\n }, [onChangeText]);\n\n return (\n <ViewAtom style={{ alignSelf: 'stretch', width: '100%' }}>\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 + iosOffset, paddingBottom: 5 + iosOffset, color: palette.text.base },\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 autoCorrect={false}\n spellCheck={false}\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={fErrorColor} />\n )}\n </ViewAtom>\n );\n}\n\nexport default React.memo(ZSTextField);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0610studio/zs-ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "EXPO ZS-UI",
|
|
6
6
|
"type": "module",
|
|
@@ -49,11 +49,37 @@
|
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@react-native-async-storage/async-storage": "*",
|
|
52
|
-
"expo": "
|
|
52
|
+
"expo": ">=52.0.0",
|
|
53
53
|
"react": "*",
|
|
54
|
-
"react-native": "
|
|
55
|
-
"react-native-reanimated": "
|
|
54
|
+
"react-native": ">=0.76.0",
|
|
55
|
+
"react-native-reanimated": "^3.0.0",
|
|
56
56
|
"react-native-safe-area-context": "*",
|
|
57
57
|
"react-native-svg": "*"
|
|
58
|
+
},
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"@react-native-async-storage/async-storage": {
|
|
61
|
+
"optional": false
|
|
62
|
+
},
|
|
63
|
+
"expo": {
|
|
64
|
+
"optional": false
|
|
65
|
+
},
|
|
66
|
+
"react": {
|
|
67
|
+
"optional": false
|
|
68
|
+
},
|
|
69
|
+
"react-native": {
|
|
70
|
+
"optional": false
|
|
71
|
+
},
|
|
72
|
+
"react-native-reanimated": {
|
|
73
|
+
"optional": false
|
|
74
|
+
},
|
|
75
|
+
"react-native-safe-area-context": {
|
|
76
|
+
"optional": false
|
|
77
|
+
},
|
|
78
|
+
"react-native-svg": {
|
|
79
|
+
"optional": false
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"installConfig": {
|
|
83
|
+
"hoistingLimits": "workspaces"
|
|
58
84
|
}
|
|
59
85
|
}
|