@0610studio/zs-ui 0.16.2 → 0.17.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.
Files changed (85) hide show
  1. package/app.plugin.js +39 -0
  2. package/build/ZsUiModule.d.ts.map +1 -1
  3. package/build/assets/SvgCheck.d.ts.map +1 -1
  4. package/build/assets/SvgExclamation.d.ts.map +1 -1
  5. package/build/assets/SvgX.d.ts.map +1 -1
  6. package/build/context/OverlayContext.d.ts +0 -1
  7. package/build/context/OverlayContext.d.ts.map +1 -1
  8. package/build/context/OverlayContext.js.map +1 -1
  9. package/build/context/ThemeContext.d.ts.map +1 -1
  10. package/build/context/ThemeContext.js +68 -35
  11. package/build/context/ThemeContext.js.map +1 -1
  12. package/build/model/globalOverlay.d.ts.map +1 -1
  13. package/build/model/globalOverlay.js.map +1 -1
  14. package/build/model/types.d.ts +1 -1
  15. package/build/model/types.d.ts.map +1 -1
  16. package/build/model/useFoldingState.d.ts.map +1 -1
  17. package/build/model/useFoldingState.js +25 -16
  18. package/build/model/useFoldingState.js.map +1 -1
  19. package/build/model/useKeyboard.d.ts.map +1 -1
  20. package/build/model/useOverlay.d.ts +0 -1
  21. package/build/model/useOverlay.d.ts.map +1 -1
  22. package/build/model/useOverlay.js.map +1 -1
  23. package/build/model/useStyleSheetCreate.d.ts.map +1 -1
  24. package/build/model/utils.d.ts.map +1 -1
  25. package/build/model/utils.js.map +1 -1
  26. package/build/overlay/BottomSheetOverlay/index.d.ts.map +1 -1
  27. package/build/overlay/BottomSheetOverlay/index.js +8 -2
  28. package/build/overlay/BottomSheetOverlay/index.js.map +1 -1
  29. package/build/overlay/Modality/index.d.ts.map +1 -1
  30. package/build/overlay/Modality/index.js +0 -3
  31. package/build/overlay/Modality/index.js.map +1 -1
  32. package/build/overlay/PopOver/PopOverButton.js.map +1 -1
  33. package/build/overlay/PopOver/PopOverMenu.d.ts +2 -2
  34. package/build/overlay/PopOver/PopOverMenu.d.ts.map +1 -1
  35. package/build/overlay/PopOver/PopOverMenu.js.map +1 -1
  36. package/build/overlay/SnackbarNotify/index.d.ts +1 -1
  37. package/build/overlay/SnackbarNotify/index.d.ts.map +1 -1
  38. package/build/overlay/SnackbarNotify/index.js.map +1 -1
  39. package/build/overlay/SnackbarNotify/ui/SnackbarItem.d.ts +1 -1
  40. package/build/overlay/SnackbarNotify/ui/SnackbarItem.d.ts.map +1 -1
  41. package/build/overlay/ZSPortal/index.js.map +1 -1
  42. package/build/theme/palette.d.ts +4 -4
  43. package/build/theme/palette.d.ts.map +1 -1
  44. package/build/theme/palette.js +1 -1
  45. package/build/theme/palette.js.map +1 -1
  46. package/build/ui/ZSAboveKeyboard/index.d.ts +0 -1
  47. package/build/ui/ZSAboveKeyboard/index.d.ts.map +1 -1
  48. package/build/ui/ZSBlockButton/index.d.ts +0 -1
  49. package/build/ui/ZSBlockButton/index.d.ts.map +1 -1
  50. package/build/ui/ZSBlockButton/index.js +9 -1
  51. package/build/ui/ZSBlockButton/index.js.map +1 -1
  52. package/build/ui/ZSContainer/index.d.ts +12 -12
  53. package/build/ui/ZSContainer/index.d.ts.map +1 -1
  54. package/build/ui/ZSContainer/index.js.map +1 -1
  55. package/build/ui/ZSPressable/index.d.ts.map +1 -1
  56. package/build/ui/ZSPressable/index.js +0 -1
  57. package/build/ui/ZSPressable/index.js.map +1 -1
  58. package/build/ui/ZSRadioGroup/index.js.map +1 -1
  59. package/build/ui/ZSSkeleton/index.d.ts +1 -1
  60. package/build/ui/ZSSkeleton/index.d.ts.map +1 -1
  61. package/build/ui/ZSSkeleton/index.js +0 -1
  62. package/build/ui/ZSSkeleton/index.js.map +1 -1
  63. package/build/ui/ZSSkeletonBox/index.d.ts.map +1 -1
  64. package/build/ui/ZSSkeletonBox/index.js +0 -1
  65. package/build/ui/ZSSkeletonBox/index.js.map +1 -1
  66. package/build/ui/ZSSwitch/index.d.ts.map +1 -1
  67. package/build/ui/ZSSwitch/index.js +17 -20
  68. package/build/ui/ZSSwitch/index.js.map +1 -1
  69. package/build/ui/ZSText/index.d.ts.map +1 -1
  70. package/build/ui/ZSText/index.js +14 -1
  71. package/build/ui/ZSText/index.js.map +1 -1
  72. package/build/ui/ZSTextField/index.d.ts +0 -1
  73. package/build/ui/ZSTextField/index.d.ts.map +1 -1
  74. package/build/ui/ZSTextField/index.js +41 -47
  75. package/build/ui/ZSTextField/index.js.map +1 -1
  76. package/build/ui/ZSTextField/ui/ButtonClose.d.ts +4 -5
  77. package/build/ui/ZSTextField/ui/ButtonClose.d.ts.map +1 -1
  78. package/build/ui/ZSTextField/ui/ButtonClose.js.map +1 -1
  79. package/build/ui/ZSTextField/ui/ErrorComponent.d.ts +0 -1
  80. package/build/ui/ZSTextField/ui/ErrorComponent.d.ts.map +1 -1
  81. package/build/ui/atoms/AnimatedWrapper.d.ts +1 -2
  82. package/build/ui/atoms/AnimatedWrapper.d.ts.map +1 -1
  83. package/build/ui/atoms/AnimatedWrapper.js +12 -4
  84. package/build/ui/atoms/AnimatedWrapper.js.map +1 -1
  85. package/package.json +34 -21
@@ -1,4 +1,4 @@
1
- import { useMemo, useCallback, useState, forwardRef, useEffect } from 'react';
1
+ import { useMemo, useCallback, useState, forwardRef, useEffect, useRef } from 'react';
2
2
  import { Platform, TextInput } from 'react-native';
3
3
  import Animated, { interpolate, useAnimatedStyle, useSharedValue, withTiming, ReduceMotion } from 'react-native-reanimated';
4
4
  import ButtonClose from './ui/ButtonClose';
@@ -15,19 +15,20 @@ const ZSTextField = forwardRef(({ typo = 'body.2', status = 'default', value, on
15
15
  const fErrorColor = errorColor || palette.danger.main;
16
16
  const fontSize = extractStyle(typography[primaryStyle][subStyle], 'fontSize') || 17;
17
17
  const fontFamily = extractStyle(typography[primaryStyle][subStyle], 'fontFamily') || '';
18
- const labelProgress = useSharedValue(value !== '' ? 1 : 0);
19
- const focusProgress = useSharedValue(0);
20
- const errorProgress = useSharedValue(0);
18
+ const floatProgress = useSharedValue(value !== '' ? 1 : 0);
21
19
  const [isFocusedForUI, setIsFocusedForUI] = useState(false);
22
20
  const boxHeightValue = useSharedValue(0);
23
21
  const isError = status === 'error';
24
22
  const hasValue = value !== '';
23
+ const isFocusedRef = useRef(false);
24
+ const hasValueRef = useRef(hasValue);
25
+ hasValueRef.current = hasValue;
25
26
  useEffect(() => {
26
- labelProgress.value = withTiming(hasValue ? 1 : 0, TIMING_CONFIG);
27
+ const target = hasValue ? 1 : 0;
28
+ if (!isFocusedRef.current && floatProgress.value !== target) {
29
+ floatProgress.value = withTiming(target, TIMING_CONFIG);
30
+ }
27
31
  }, [hasValue]);
28
- useEffect(() => {
29
- errorProgress.value = withTiming(isError ? 1 : 0, TIMING_CONFIG);
30
- }, [isError]);
31
32
  const animationConstants = useMemo(() => ({
32
33
  baseFontSize: fontSize + (boxStyle === 'inbox' ? 1 : 0),
33
34
  targetFontSize: boxStyle === 'inbox' ? 10 : 11,
@@ -35,16 +36,13 @@ const ZSTextField = forwardRef(({ typo = 'body.2', status = 'default', value, on
35
36
  targetTopOffset: boxStyle === 'inbox' ? 17 : 2,
36
37
  }), [fontSize, boxStyle, isTextArea]);
37
38
  const animatedLabelStyle = useAnimatedStyle(() => {
38
- 'worklet';
39
- const progress = Math.max(labelProgress.value, focusProgress.value);
39
+ const progress = floatProgress.value;
40
40
  const labelTranslateY = interpolate(progress, [0, 1], [
41
41
  0,
42
42
  isTextArea ? -24 : -(boxHeightValue.value / 2) - 1 + animationConstants.targetTopOffset - animationConstants.baseTop,
43
43
  ], 'clamp');
44
44
  const labelScale = interpolate(progress, [0, 1], [1, animationConstants.targetFontSize / animationConstants.baseFontSize], 'clamp');
45
45
  return {
46
- top: animationConstants.baseTop,
47
- transformOrigin: 'left center',
48
46
  transform: [
49
47
  { translateY: labelTranslateY },
50
48
  { scale: labelScale },
@@ -56,11 +54,18 @@ const ZSTextField = forwardRef(({ typo = 'body.2', status = 'default', value, on
56
54
  boxHeightValue.value = height;
57
55
  }, []);
58
56
  const handleFocus = useCallback(() => {
59
- focusProgress.value = withTiming(1, TIMING_CONFIG);
57
+ isFocusedRef.current = true;
58
+ if (floatProgress.value !== 1) {
59
+ floatProgress.value = withTiming(1, TIMING_CONFIG);
60
+ }
60
61
  setIsFocusedForUI(true);
61
62
  }, []);
62
63
  const handleBlur = useCallback(() => {
63
- focusProgress.value = withTiming(0, TIMING_CONFIG);
64
+ isFocusedRef.current = false;
65
+ const target = hasValueRef.current ? 1 : 0;
66
+ if (floatProgress.value !== target) {
67
+ floatProgress.value = withTiming(target, TIMING_CONFIG);
68
+ }
64
69
  setIsFocusedForUI(false);
65
70
  }, []);
66
71
  const colorConfig = useMemo(() => ({
@@ -70,31 +75,18 @@ const ZSTextField = forwardRef(({ typo = 'body.2', status = 'default', value, on
70
75
  placeholderColor: placeHolderColor || palette.grey[40],
71
76
  errorColor: fErrorColor,
72
77
  }), [focusColor, palette.primary.main, borderColor, palette.grey, labelColor, palette.text.secondary, placeHolderColor, fErrorColor]);
73
- const animatedColorStyle = useAnimatedStyle(() => {
74
- 'worklet';
75
- const borderColor = errorProgress.value > 0
76
- ? colorConfig.errorColor
77
- : focusProgress.value > 0
78
- ? colorConfig.primaryColor
79
- : colorConfig.defaultBorderColor;
80
- return {
81
- borderColor,
82
- };
83
- }, [colorConfig]);
84
- const animatedLabelColorStyle = useAnimatedStyle(() => {
85
- 'worklet';
86
- const floatProgress = Math.max(labelProgress.value, focusProgress.value);
87
- const labelColor = errorProgress.value > 0
88
- ? colorConfig.errorColor
89
- : focusProgress.value > 0
90
- ? colorConfig.primaryColor
91
- : floatProgress > 0
92
- ? colorConfig.defaultLabelColor
93
- : colorConfig.placeholderColor;
94
- return {
95
- color: labelColor,
96
- };
97
- }, [colorConfig]);
78
+ const currentBorderColor = isError
79
+ ? colorConfig.errorColor
80
+ : isFocusedForUI
81
+ ? colorConfig.primaryColor
82
+ : colorConfig.defaultBorderColor;
83
+ const currentLabelColor = isError
84
+ ? colorConfig.errorColor
85
+ : isFocusedForUI
86
+ ? colorConfig.primaryColor
87
+ : hasValue
88
+ ? colorConfig.defaultLabelColor
89
+ : colorConfig.placeholderColor;
98
90
  const styleConfig = useMemo(() => {
99
91
  const baseStyle = {
100
92
  width: '100%',
@@ -137,22 +129,24 @@ const ZSTextField = forwardRef(({ typo = 'body.2', status = 'default', value, on
137
129
  }
138
130
  return { ...baseStyle, ...borderStyle, ...innerStyle };
139
131
  }, [isTextArea, borderRadius, paddingHorizontal, inputBgColor, borderWidth, boxStyle, innerBoxStyle, palette.background.base]);
140
- const labelTextStyle = {
132
+ const labelTextStyle = useMemo(() => ({
141
133
  fontSize,
134
+ top: animationConstants.baseTop,
142
135
  left: paddingHorizontal,
136
+ transformOrigin: 'left center',
143
137
  backgroundColor: labelBgColor || palette.background.base,
144
138
  paddingHorizontal: boxStyle === 'outline' ? 5 : 0,
145
139
  paddingVertical: 2,
146
140
  textAlignVertical: 'center',
147
141
  fontFamily,
148
142
  borderRadius: boxStyle === 'outline' ? 5 : 0,
149
- overflow: 'hidden',
150
- };
143
+ ...(Platform.OS === 'android' ? { overflow: 'hidden' } : {}),
144
+ }), [fontSize, animationConstants.baseTop, paddingHorizontal, labelBgColor, palette.background.base, boxStyle, fontFamily]);
151
145
  const handleTextChange = (text) => {
152
146
  if (onChangeText)
153
147
  onChangeText(text);
154
148
  };
155
- const textInputStyle = [
149
+ const textInputStyle = useMemo(() => [
156
150
  {
157
151
  paddingTop: 7 + iosOffset,
158
152
  paddingBottom: 5 + iosOffset,
@@ -164,21 +158,21 @@ const ZSTextField = forwardRef(({ typo = 'body.2', status = 'default', value, on
164
158
  ...(Platform.OS === 'web' ? { outline: 'none' } : {}),
165
159
  },
166
160
  textInputProps?.style,
167
- ];
161
+ ], [palette.text.base, fontSize, fontFamily, textInputProps?.style]);
168
162
  const shouldShowCloseButton = value && isFocusedForUI;
169
163
  const shouldShowError = status === 'error' && errorMessage;
170
164
  return (<ViewAtom style={{ alignSelf: 'stretch', width: '100%' }}>
171
- <Animated.View style={[styleConfig, animatedColorStyle]} onLayout={handleLayout} pointerEvents={disabled ? 'none' : 'auto'}>
165
+ <ViewAtom style={[styleConfig, { borderColor: currentBorderColor }]} onLayout={handleLayout} pointerEvents={disabled ? 'none' : 'auto'}>
172
166
  <TextInput {...textInputProps} ref={ref} style={textInputStyle} value={value} onFocus={handleFocus} onBlur={handleBlur} onChangeText={handleTextChange} allowFontScaling={allowFontScaling} selectionColor={palette.grey[50]} autoCorrect={false} spellCheck={false}/>
173
167
 
174
168
  <ViewAtom pointerEvents="none" style={{ position: 'absolute' }}>
175
- <Animated.Text allowFontScaling={allowFontScaling} style={[animatedLabelStyle, labelTextStyle, animatedLabelColorStyle]}>
169
+ <Animated.Text allowFontScaling={allowFontScaling} style={[labelTextStyle, { color: currentLabelColor }, animatedLabelStyle]}>
176
170
  {label}
177
171
  </Animated.Text>
178
172
  </ViewAtom>
179
173
 
180
174
  {shouldShowCloseButton && (<ButtonClose marginTop={isTextArea ? 13 : undefined} onChangeText={onChangeText}/>)}
181
- </Animated.View>
175
+ </ViewAtom>
182
176
 
183
177
  {shouldShowError && (<ErrorComponent errorMessage={errorMessage} errorColor={fErrorColor}/>)}
184
178
  </ViewAtom>);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSTextField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAqB,QAAQ,EAAa,SAAS,EAA6B,MAAM,cAAc,CAAC;AAC5G,OAAO,QAAQ,EAAE,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5H,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OA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,CAAC,gBAAgB,CAAC,CAC/B,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CACnC,cAAc,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CACjC,WAAW,CAAC,CAAC,KAAK,CAAC,CACnB,UAAU,CAAC,CAAC,KAAK,CAAC,EAGpB;;QAAA,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAC7D;UAAA,CAAC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,kBAAkB,EAAE,cAAc,EAAE,uBAAuB,CAAC,CAAC,CACtH;YAAA,CAAC,KAAK,CACR;UAAA,EAAE,QAAQ,CAAC,IAAI,CACjB;QAAA,EAAE,QAAQ,CAEV;;QAAA,CAAC,qBAAqB,IAAI,CACxB,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,CAAC,IAAI,CAEf;;MAAA,CAAC,eAAe,IAAI,CAClB,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,CAAC,CAAC;AAEH,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC;AAExC,eAAe,WAAW,CAAC","sourcesContent":["import { useMemo, useCallback, useState, forwardRef, useEffect } from 'react';\nimport { LayoutChangeEvent, Platform, StyleProp, TextInput, TextInputProps, TextStyle } from 'react-native';\nimport Animated, { interpolate, useAnimatedStyle, useSharedValue, withTiming, ReduceMotion } from 'react-native-reanimated';\nimport ButtonClose from './ui/ButtonClose';\nimport ErrorComponent from './ui/ErrorComponent';\nimport { TypoOptions, TypoStyle, TypoSubStyle } from '../../theme/types';\nimport { extractStyle } from '../../model/utils';\nimport { useTheme } from '../../context/ThemeContext';\nimport ViewAtom from '../atoms/ViewAtom';\n\nexport type BoxStyle = 'outline' | 'underline' | 'inbox';\n\nconst iosOffset = Platform.OS === 'ios' ? 8 : 4;\nconst ANIM_DURATION = 150;\nconst TIMING_CONFIG = { duration: ANIM_DURATION, reduceMotion: ReduceMotion.System };\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\nexport type ZSTextFieldRef = TextInput;\n\nconst ZSTextField = forwardRef<ZSTextFieldRef, TextFieldProps>(({\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}, ref) => {\n const { typography, palette } = useTheme();\n const [primaryStyle, subStyle] = typo.split('.') as [TypoStyle, TypoSubStyle];\n const fErrorColor = errorColor || palette.danger.main;\n\n const fontSize = extractStyle(typography[primaryStyle][subStyle], 'fontSize') as number || 17;\n const fontFamily = extractStyle(typography[primaryStyle][subStyle], 'fontFamily') as string || '';\n\n const labelProgress = useSharedValue(value !== '' ? 1 : 0);\n const focusProgress = useSharedValue(0);\n const errorProgress = useSharedValue(0);\n const [isFocusedForUI, setIsFocusedForUI] = useState<boolean>(false);\n const boxHeightValue = useSharedValue(0);\n \n const isError = status === 'error';\n const hasValue = value !== '';\n\n useEffect(() => {\n labelProgress.value = withTiming(hasValue ? 1 : 0, TIMING_CONFIG);\n }, [hasValue]);\n\n useEffect(() => {\n errorProgress.value = withTiming(isError ? 1 : 0, TIMING_CONFIG);\n }, [isError]);\n\n const animationConstants = useMemo(() => ({\n baseFontSize: fontSize + (boxStyle === 'inbox' ? 1 : 0),\n targetFontSize: boxStyle === 'inbox' ? 10 : 11,\n baseTop: isTextArea ? 12 : 0,\n targetTopOffset: boxStyle === 'inbox' ? 17 : 2,\n }), [fontSize, boxStyle, isTextArea]);\n\n const animatedLabelStyle = useAnimatedStyle(() => {\n 'worklet';\n \n const progress = Math.max(labelProgress.value, focusProgress.value);\n \n const labelTranslateY = interpolate(\n progress,\n [0, 1],\n [\n 0,\n isTextArea ? -24 : -(boxHeightValue.value / 2) - 1 + animationConstants.targetTopOffset - animationConstants.baseTop,\n ],\n 'clamp'\n );\n\n const labelScale = interpolate(\n progress,\n [0, 1],\n [1, animationConstants.targetFontSize / animationConstants.baseFontSize],\n 'clamp'\n );\n\n return {\n top: animationConstants.baseTop,\n transformOrigin: 'left center',\n transform: [\n { translateY: labelTranslateY },\n { scale: labelScale },\n ],\n };\n }, [animationConstants, isTextArea]);\n\n const handleLayout = useCallback((event: LayoutChangeEvent) => {\n const { height } = event.nativeEvent.layout;\n boxHeightValue.value = height;\n }, []);\n\n const handleFocus = useCallback(() => {\n focusProgress.value = withTiming(1, TIMING_CONFIG);\n setIsFocusedForUI(true);\n }, []);\n\n const handleBlur = useCallback(() => {\n focusProgress.value = withTiming(0, TIMING_CONFIG);\n setIsFocusedForUI(false);\n }, []);\n\n const colorConfig = useMemo(() => ({\n primaryColor: focusColor || palette.primary.main,\n defaultBorderColor: borderColor || palette.grey[30],\n defaultLabelColor: labelColor || palette.text.secondary,\n placeholderColor: placeHolderColor || palette.grey[40],\n errorColor: fErrorColor,\n }), [focusColor, palette.primary.main, borderColor, palette.grey, labelColor, palette.text.secondary, placeHolderColor, fErrorColor]);\n\n const animatedColorStyle = useAnimatedStyle(() => {\n 'worklet';\n \n const borderColor = errorProgress.value > 0 \n ? colorConfig.errorColor\n : focusProgress.value > 0\n ? colorConfig.primaryColor\n : colorConfig.defaultBorderColor;\n \n return {\n borderColor,\n };\n }, [colorConfig]);\n\n const animatedLabelColorStyle = useAnimatedStyle(() => {\n 'worklet';\n \n const floatProgress = Math.max(labelProgress.value, focusProgress.value);\n \n const labelColor = errorProgress.value > 0\n ? colorConfig.errorColor\n : focusProgress.value > 0\n ? colorConfig.primaryColor\n : floatProgress > 0\n ? colorConfig.defaultLabelColor\n : colorConfig.placeholderColor;\n \n return {\n color: labelColor,\n };\n }, [colorConfig]);\n\n const styleConfig = useMemo(() => {\n const baseStyle = {\n width: '100%' as const,\n justifyContent: isTextArea ? 'flex-start' as const : 'center' as const,\n borderRadius,\n paddingHorizontal,\n backgroundColor: inputBgColor || palette.background.base,\n paddingTop: boxStyle === 'inbox' ? 13 : 0,\n };\n\n // 박스 스타일에 따른 테두리 설정\n let borderStyle = {};\n if (boxStyle === 'outline' || boxStyle === 'inbox') {\n borderStyle = { borderWidth };\n } else if (boxStyle === 'underline') {\n borderStyle = { borderBottomWidth: borderWidth };\n }\n\n // innerBoxStyle에 따른 스타일 설정\n let innerStyle = {};\n if (innerBoxStyle === 'top') {\n innerStyle = { \n borderBottomLeftRadius: 0, \n borderBottomRightRadius: 0, \n borderBottomWidth: borderWidth / 2 \n };\n } else if (innerBoxStyle === 'middle') {\n innerStyle = { \n borderRadius: 0, \n borderTopWidth: borderWidth / 2, \n borderBottomWidth: borderWidth / 2 \n };\n } else if (innerBoxStyle === 'bottom') {\n innerStyle = { \n borderTopLeftRadius: 0, \n borderTopRightRadius: 0, \n borderTopWidth: borderWidth / 2 \n };\n }\n\n return { ...baseStyle, ...borderStyle, ...innerStyle };\n }, [isTextArea, borderRadius, paddingHorizontal, inputBgColor, borderWidth, boxStyle, innerBoxStyle, palette.background.base]);\n\n const labelTextStyle: StyleProp<TextStyle> = {\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 };\n\n const handleTextChange = (text: string) => {\n if (onChangeText) onChangeText(text);\n };\n\n const textInputStyle = [\n { \n paddingTop: 7 + iosOffset, \n paddingBottom: 5 + iosOffset, \n color: palette.text.base,\n fontSize, \n width: '100%' as const, \n paddingRight: 25, \n fontFamily,\n ...(Platform.OS === 'web' ? { outline: 'none' } : {}),\n },\n textInputProps?.style,\n ];\n\n const shouldShowCloseButton = value && isFocusedForUI;\n const shouldShowError = status === 'error' && errorMessage;\n\n return (\n <ViewAtom style={{ alignSelf: 'stretch', width: '100%' }}>\n <Animated.View\n style={[styleConfig, animatedColorStyle]}\n onLayout={handleLayout}\n pointerEvents={disabled ? 'none' : 'auto'}\n >\n <TextInput\n {...textInputProps}\n ref={ref}\n style={textInputStyle}\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, animatedLabelColorStyle]}>\n {label}\n </Animated.Text>\n </ViewAtom>\n\n {shouldShowCloseButton && (\n <ButtonClose marginTop={isTextArea ? 13 : undefined} onChangeText={onChangeText} />\n )}\n </Animated.View>\n\n {shouldShowError && (\n <ErrorComponent errorMessage={errorMessage} errorColor={fErrorColor} />\n )}\n </ViewAtom>\n );\n});\n\nZSTextField.displayName = 'ZSTextField';\n\nexport default ZSTextField;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSTextField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtF,OAAO,EAAqB,QAAQ,EAAa,SAAS,EAA6B,MAAM,cAAc,CAAC;AAC5G,OAAO,QAAQ,EAAE,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5H,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,4BAA4B,CAAC;AACtD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AAIzC,MAAM,SAAS,GAAG,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,aAAa,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,CAAC,MAAM,EAAE,CAAC;AA8BrF,MAAM,WAAW,GAAG,UAAU,CAAiC,CAAC,EAC9D,IAAI,GAAG,QAAQ,EACf,MAAM,GAAG,SAAS,EAClB,KAAK,EACL,YAAY,EACZ,KAAK,GAAG,aAAa,EACrB,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,WAAW,GAAG,GAAG,EACjB,WAAW,EACX,UAAU,EACV,UAAU,EACV,YAAY,GAAG,EAAE,EACjB,iBAAiB,GAAG,EAAE,EACtB,YAAY,EACZ,c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BAAiB,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAC3H;YAAA,CAAC,KAAK,CACR;UAAA,EAAE,QAAQ,CAAC,IAAI,CACjB;QAAA,EAAE,QAAQ,CAEV;;QAAA,CAAC,qBAAqB,IAAI,CACxB,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,eAAe,IAAI,CAClB,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,CAAC,CAAC;AAEH,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC;AAExC,eAAe,WAAW,CAAC","sourcesContent":["import { useMemo, useCallback, useState, forwardRef, useEffect, useRef } from 'react';\nimport { LayoutChangeEvent, Platform, StyleProp, TextInput, TextInputProps, TextStyle } from 'react-native';\nimport Animated, { interpolate, useAnimatedStyle, useSharedValue, withTiming, ReduceMotion } from 'react-native-reanimated';\nimport ButtonClose from './ui/ButtonClose';\nimport ErrorComponent from './ui/ErrorComponent';\nimport { TypoOptions, TypoStyle, TypoSubStyle } from '../../theme/types';\nimport { extractStyle } from '../../model/utils';\nimport { useTheme } from '../../context/ThemeContext';\nimport ViewAtom from '../atoms/ViewAtom';\n\nexport type BoxStyle = 'outline' | 'underline' | 'inbox';\n\nconst iosOffset = Platform.OS === 'ios' ? 8 : 4;\nconst ANIM_DURATION = 150;\nconst TIMING_CONFIG = { duration: ANIM_DURATION, reduceMotion: ReduceMotion.System };\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\nexport type ZSTextFieldRef = TextInput;\n\nconst ZSTextField = forwardRef<ZSTextFieldRef, TextFieldProps>(({\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}, ref) => {\n const { typography, palette } = useTheme();\n const [primaryStyle, subStyle] = typo.split('.') as [TypoStyle, TypoSubStyle];\n const fErrorColor = errorColor || palette.danger.main;\n\n const fontSize = extractStyle(typography[primaryStyle][subStyle], 'fontSize') as number || 17;\n const fontFamily = extractStyle(typography[primaryStyle][subStyle], 'fontFamily') as string || '';\n const floatProgress = useSharedValue(value !== '' ? 1 : 0);\n const [isFocusedForUI, setIsFocusedForUI] = useState<boolean>(false);\n const boxHeightValue = useSharedValue(0);\n\n const isError = status === 'error';\n const hasValue = value !== '';\n\n const isFocusedRef = useRef(false);\n const hasValueRef = useRef(hasValue);\n hasValueRef.current = hasValue;\n\n useEffect(() => {\n const target = hasValue ? 1 : 0;\n if (!isFocusedRef.current && floatProgress.value !== target) {\n floatProgress.value = withTiming(target, TIMING_CONFIG);\n }\n }, [hasValue]);\n\n const animationConstants = useMemo(() => ({\n baseFontSize: fontSize + (boxStyle === 'inbox' ? 1 : 0),\n targetFontSize: boxStyle === 'inbox' ? 10 : 11,\n baseTop: isTextArea ? 12 : 0,\n targetTopOffset: boxStyle === 'inbox' ? 17 : 2,\n }), [fontSize, boxStyle, isTextArea]);\n\n const animatedLabelStyle = useAnimatedStyle(() => {\n const progress = floatProgress.value;\n\n const labelTranslateY = interpolate(\n progress,\n [0, 1],\n [\n 0,\n isTextArea ? -24 : -(boxHeightValue.value / 2) - 1 + animationConstants.targetTopOffset - animationConstants.baseTop,\n ],\n 'clamp'\n );\n\n const labelScale = interpolate(\n progress,\n [0, 1],\n [1, animationConstants.targetFontSize / animationConstants.baseFontSize],\n 'clamp'\n );\n\n return {\n transform: [\n { translateY: labelTranslateY },\n { scale: labelScale },\n ],\n };\n }, [animationConstants, isTextArea]);\n\n const handleLayout = useCallback((event: LayoutChangeEvent) => {\n const { height } = event.nativeEvent.layout;\n boxHeightValue.value = height;\n }, []);\n\n const handleFocus = useCallback(() => {\n isFocusedRef.current = true;\n if (floatProgress.value !== 1) {\n floatProgress.value = withTiming(1, TIMING_CONFIG);\n }\n setIsFocusedForUI(true);\n }, []);\n\n const handleBlur = useCallback(() => {\n isFocusedRef.current = false;\n const target = hasValueRef.current ? 1 : 0;\n if (floatProgress.value !== target) {\n floatProgress.value = withTiming(target, TIMING_CONFIG);\n }\n setIsFocusedForUI(false);\n }, []);\n\n const colorConfig = useMemo(() => ({\n primaryColor: focusColor || palette.primary.main,\n defaultBorderColor: borderColor || palette.grey[30],\n defaultLabelColor: labelColor || palette.text.secondary,\n placeholderColor: placeHolderColor || palette.grey[40],\n errorColor: fErrorColor,\n }), [focusColor, palette.primary.main, borderColor, palette.grey, labelColor, palette.text.secondary, placeHolderColor, fErrorColor]);\n\n const currentBorderColor = isError\n ? colorConfig.errorColor\n : isFocusedForUI\n ? colorConfig.primaryColor\n : colorConfig.defaultBorderColor;\n\n const currentLabelColor = isError\n ? colorConfig.errorColor\n : isFocusedForUI\n ? colorConfig.primaryColor\n : hasValue\n ? colorConfig.defaultLabelColor\n : colorConfig.placeholderColor;\n\n const styleConfig = useMemo(() => {\n const baseStyle = {\n width: '100%' as const,\n justifyContent: isTextArea ? 'flex-start' as const : 'center' as const,\n borderRadius,\n paddingHorizontal,\n backgroundColor: inputBgColor || palette.background.base,\n paddingTop: boxStyle === 'inbox' ? 13 : 0,\n };\n\n // 박스 스타일에 따른 테두리 설정\n let borderStyle = {};\n if (boxStyle === 'outline' || boxStyle === 'inbox') {\n borderStyle = { borderWidth };\n } else if (boxStyle === 'underline') {\n borderStyle = { borderBottomWidth: borderWidth };\n }\n\n // innerBoxStyle에 따른 스타일 설정\n let innerStyle = {};\n if (innerBoxStyle === 'top') {\n innerStyle = {\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 0,\n borderBottomWidth: borderWidth / 2\n };\n } else if (innerBoxStyle === 'middle') {\n innerStyle = {\n borderRadius: 0,\n borderTopWidth: borderWidth / 2,\n borderBottomWidth: borderWidth / 2\n };\n } else if (innerBoxStyle === 'bottom') {\n innerStyle = {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderTopWidth: borderWidth / 2\n };\n }\n\n return { ...baseStyle, ...borderStyle, ...innerStyle };\n }, [isTextArea, borderRadius, paddingHorizontal, inputBgColor, borderWidth, boxStyle, innerBoxStyle, palette.background.base]);\n\n const labelTextStyle: StyleProp<TextStyle> = useMemo(() => ({\n fontSize,\n top: animationConstants.baseTop,\n left: paddingHorizontal,\n transformOrigin: 'left center',\n backgroundColor: labelBgColor || palette.background.base,\n paddingHorizontal: boxStyle === 'outline' ? 5 : 0,\n paddingVertical: 2,\n textAlignVertical: 'center' as const,\n fontFamily,\n borderRadius: boxStyle === 'outline' ? 5 : 0,\n ...(Platform.OS === 'android' ? { overflow: 'hidden' as const } : {}),\n }), [fontSize, animationConstants.baseTop, paddingHorizontal, labelBgColor, palette.background.base, boxStyle, fontFamily]);\n\n const handleTextChange = (text: string) => {\n if (onChangeText) onChangeText(text);\n };\n\n const textInputStyle = useMemo(() => [\n {\n paddingTop: 7 + iosOffset,\n paddingBottom: 5 + iosOffset,\n color: palette.text.base,\n fontSize,\n width: '100%' as const,\n paddingRight: 25,\n fontFamily,\n ...(Platform.OS === 'web' ? { outline: 'none' } : {}),\n },\n textInputProps?.style,\n ], [palette.text.base, fontSize, fontFamily, textInputProps?.style]);\n\n const shouldShowCloseButton = value && isFocusedForUI;\n const shouldShowError = status === 'error' && errorMessage;\n\n return (\n <ViewAtom style={{ alignSelf: 'stretch', width: '100%' }}>\n <ViewAtom\n style={[styleConfig, { borderColor: currentBorderColor }]}\n onLayout={handleLayout}\n pointerEvents={disabled ? 'none' : 'auto'}\n >\n <TextInput\n {...textInputProps}\n ref={ref}\n style={textInputStyle}\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={[labelTextStyle, { color: currentLabelColor }, animatedLabelStyle]}>\n {label}\n </Animated.Text>\n </ViewAtom>\n\n {shouldShowCloseButton && (\n <ButtonClose marginTop={isTextArea ? 13 : undefined} onChangeText={onChangeText} />\n )}\n </ViewAtom>\n\n {shouldShowError && (\n <ErrorComponent errorMessage={errorMessage} errorColor={fErrorColor} />\n )}\n </ViewAtom>\n );\n});\n\nZSTextField.displayName = 'ZSTextField';\n\nexport default ZSTextField;\n"]}
@@ -1,8 +1,7 @@
1
- /// <reference types="react" />
2
- import { type ViewProps } from "react-native";
1
+ import { type TouchableOpacityProps } from "react-native";
3
2
  declare const ButtonClose: ({ onChangeText, marginTop, ...props }: {
4
- onChangeText?: ((text: string) => void) | undefined;
5
- marginTop?: number | undefined;
6
- } & ViewProps) => import("react").JSX.Element;
3
+ onChangeText?: (text: string) => void;
4
+ marginTop?: number;
5
+ } & TouchableOpacityProps) => import("react").JSX.Element;
7
6
  export default ButtonClose;
8
7
  //# sourceMappingURL=ButtonClose.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonClose.d.ts","sourceRoot":"","sources":["../../../../src/ui/ZSTextField/ui/ButtonClose.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGhE,QAAA,MAAM,WAAW;2BAKS,MAAM,KAAK,IAAI;;6CAYxC,CAAA;AAED,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"ButtonClose.d.ts","sourceRoot":"","sources":["../../../../src/ui/ZSTextField/ui/ButtonClose.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAG5E,QAAA,MAAM,WAAW,GAAI,uCAIlB;IACC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,qBAAqB,gCAUxB,CAAA;AAED,eAAe,WAAW,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonClose.js","sourceRoot":"","sources":["../../../../src/ui/ZSTextField/ui/ButtonClose.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAkB,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,MAAM,WAAW,GAAG,CAAC,EACjB,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EAIC,EAAE,EAAE;IACb,OAAO,CACH,CAAC,gBAAgB,CACb,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,CACzL,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,IAAI,KAAK,CAAC,CACV;YAAA,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EACzB;QAAA,EAAE,gBAAgB,CAAC,CACtB,CAAA;AACL,CAAC,CAAA;AAED,eAAe,WAAW,CAAC","sourcesContent":["import { TouchableOpacity, type ViewProps } from \"react-native\";\nimport { SvgX } from \"../../../assets/SvgX\";\n\nconst ButtonClose = ({\n onChangeText,\n marginTop,\n ...props\n}: {\n onChangeText?: (text: string) => void;\n marginTop?: number;\n} & ViewProps) => {\n return (\n <TouchableOpacity\n 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 {...props}>\n <SvgX color=\"#5E696E\" />\n </TouchableOpacity>\n )\n}\n\nexport default ButtonClose;\n"]}
1
+ {"version":3,"file":"ButtonClose.js","sourceRoot":"","sources":["../../../../src/ui/ZSTextField/ui/ButtonClose.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA8B,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,MAAM,WAAW,GAAG,CAAC,EACjB,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EAIa,EAAE,EAAE;IACzB,OAAO,CACH,CAAC,gBAAgB,CACb,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,CACzL,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,IAAI,KAAK,CAAC,CACV;YAAA,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EACzB;QAAA,EAAE,gBAAgB,CAAC,CACtB,CAAA;AACL,CAAC,CAAA;AAED,eAAe,WAAW,CAAC","sourcesContent":["import { TouchableOpacity, type TouchableOpacityProps } from \"react-native\";\nimport { SvgX } from \"../../../assets/SvgX\";\n\nconst ButtonClose = ({\n onChangeText,\n marginTop,\n ...props\n}: {\n onChangeText?: (text: string) => void;\n marginTop?: number;\n} & TouchableOpacityProps) => {\n return (\n <TouchableOpacity\n 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 {...props}>\n <SvgX color=\"#5E696E\" />\n </TouchableOpacity>\n )\n}\n\nexport default ButtonClose;\n"]}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ViewProps } from "react-native";
3
2
  declare const ErrorComponent: ({ errorMessage, errorColor, ...props }: {
4
3
  errorMessage: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorComponent.d.ts","sourceRoot":"","sources":["../../../../src/ui/ZSTextField/ui/ErrorComponent.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,QAAA,MAAM,cAAc;kBAKJ,MAAM;gBACR,MAAM;6CAcnB,CAAA;AAED,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"ErrorComponent.d.ts","sourceRoot":"","sources":["../../../../src/ui/ZSTextField/ui/ErrorComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,QAAA,MAAM,cAAc,GAAI,wCAIrB;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,SAAS,gCAaZ,CAAA;AAED,eAAe,cAAc,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ViewProps } from 'react-native';
3
- import { ShadowLevel } from '../../theme/types';
4
- import { ViewColorOptions } from '../../theme/types';
3
+ import { ShadowLevel, ViewColorOptions } from '../../theme/types';
5
4
  interface AnimatedWrapperProps extends ViewProps {
6
5
  isAnimation: boolean;
7
6
  elevationLevel?: ShadowLevel;
@@ -1 +1 @@
1
- {"version":3,"file":"AnimatedWrapper.d.ts","sourceRoot":"","sources":["../../../src/ui/atoms/AnimatedWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAQ,SAAS,EAAY,MAAM,cAAc,CAAC;AAGzD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAA8B,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAMjF,UAAU,oBAAqB,SAAQ,SAAS;IAC9C,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AAED,iBAAS,eAAe,CAAC,EACvB,WAAkB,EAClB,cAAkB,EAClB,QAA2B,EAC3B,KAAK,EACL,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE,oBAAoB,qBA4EtB;;AAED,wBAA2C"}
1
+ {"version":3,"file":"AnimatedWrapper.d.ts","sourceRoot":"","sources":["../../../src/ui/atoms/AnimatedWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAQ,SAAS,EAAY,MAAM,cAAc,CAAC;AAGzD,OAAO,EAAgB,WAAW,EAAmB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAajG,UAAU,oBAAqB,SAAQ,SAAS;IAC9C,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AAED,iBAAS,eAAe,CAAC,EACvB,WAAkB,EAClB,cAAkB,EAClB,QAA2B,EAC3B,KAAK,EACL,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE,oBAAoB,qBAiFtB;;AAED,wBAA2C"}
@@ -6,6 +6,9 @@ import { IOS_SHADOW } from '../../theme/elevation';
6
6
  const DEFAULT_DURATION = 200;
7
7
  const SHADOW_DURATION = 50;
8
8
  const IS_IOS = Platform.OS === 'ios';
9
+ function isColorMap(value) {
10
+ return typeof value === 'object' && value !== null;
11
+ }
9
12
  function AnimatedWrapper({ isAnimation = true, elevationLevel = 0, duration = DEFAULT_DURATION, style, children, color, ...props }) {
10
13
  const { elevation, palette } = useTheme();
11
14
  const animationFinished = useSharedValue(false);
@@ -19,10 +22,16 @@ function AnimatedWrapper({ isAnimation = true, elevationLevel = 0, duration = DE
19
22
  return elevationLevel ? palette.background.base : undefined;
20
23
  }
21
24
  const [c01, c02] = color.split('.');
22
- if (c02)
23
- return palette[c01][c02];
25
+ if (c02) {
26
+ if (c01 === 'background')
27
+ return palette.background[c02];
28
+ if (c01 === 'text')
29
+ return palette.text[c02];
30
+ const semanticPalette = palette[c01];
31
+ return isColorMap(semanticPalette) ? semanticPalette[c02] : undefined;
32
+ }
24
33
  if (c01)
25
- return palette.background[c01];
34
+ return palette.background[c01] ?? palette[c01]?.main;
26
35
  if (elevationLevel)
27
36
  return palette.background.base;
28
37
  return undefined;
@@ -36,7 +45,6 @@ function AnimatedWrapper({ isAnimation = true, elevationLevel = 0, duration = DE
36
45
  return 0;
37
46
  }, []);
38
47
  const animatedStyle = useAnimatedStyle(() => {
39
- 'worklet';
40
48
  const shadowValue = shadowProgress.value;
41
49
  if (staticConfig.isIOS) {
42
50
  return { shadowOpacity: shadowValue * staticConfig.maxShadowOpacity };
@@ -1 +1 @@
1
- {"version":3,"file":"AnimatedWrapper.js","sourceRoot":"","sources":["../../../src/ui/atoms/AnimatedWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,IAAI,EAAa,QAAQ,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,QAAQ,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACvI,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,MAAM,gBAAgB,GAAG,GAAY,CAAC;AACtC,MAAM,eAAe,GAAG,EAAW,CAAC;AACpC,MAAM,MAAM,GAAG,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC;AASrC,SAAS,eAAe,CAAC,EACvB,WAAW,GAAG,IAAI,EAClB,cAAc,GAAG,CAAC,EAClB,QAAQ,GAAG,gBAAgB,EAC3B,KAAK,EACL,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACa;IACrB,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC1C,MAAM,iBAA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IAAA,EAAE,QAAQ,CAAC,IAAI,CAAC,CACjB,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC","sourcesContent":["import React, { useMemo } from 'react';\nimport { View, ViewProps, Platform } from 'react-native';\nimport Animated, { FadeInDown, FadeOut, useAnimatedStyle, withTiming, useSharedValue, useDerivedValue } from 'react-native-reanimated';\nimport { useTheme } from '../../context/ThemeContext';\nimport { ShadowLevel } from '../../theme/types';\nimport { IOS_SHADOW } from '../../theme/elevation';\nimport { SubColorOptions, ViewColor, ViewColorOptions } from '../../theme/types';\n\nconst DEFAULT_DURATION = 200 as const;\nconst SHADOW_DURATION = 50 as const;\nconst IS_IOS = Platform.OS === 'ios';\n\ninterface AnimatedWrapperProps extends ViewProps {\n isAnimation: boolean;\n elevationLevel?: ShadowLevel;\n duration?: number;\n color?: ViewColorOptions;\n}\n\nfunction AnimatedWrapper({\n isAnimation = true,\n elevationLevel = 0,\n duration = DEFAULT_DURATION,\n style,\n children,\n color,\n ...props\n}: AnimatedWrapperProps) {\n const { elevation, palette } = useTheme();\n const animationFinished = useSharedValue(false);\n \n const staticConfig = useMemo(() => ({\n isIOS: IS_IOS,\n maxShadowOpacity: IS_IOS ? IOS_SHADOW[elevationLevel].shadowOpacity : 0,\n maxElevation: IS_IOS ? 0 : elevationLevel,\n }), [elevationLevel]);\n \n const backgroundColor = useMemo(() => {\n if (!color) {\n return elevationLevel ? palette.background.base : undefined;\n }\n \n const [c01, c02] = color.split('.') as [ViewColor, SubColorOptions];\n if (c02) return palette[c01][c02];\n if (c01) return palette.background[c01];\n if (elevationLevel) return palette.background.base;\n return undefined;\n }, [color, palette, elevationLevel]);\n\n const staticStyle = elevation[elevationLevel];\n\n const shadowProgress = useDerivedValue(() => {\n 'worklet';\n if (animationFinished.value) {\n return withTiming(1, { duration: SHADOW_DURATION });\n }\n return 0;\n }, []);\n\n const animatedStyle = useAnimatedStyle(() => {\n 'worklet';\n const shadowValue = shadowProgress.value;\n \n if (staticConfig.isIOS) {\n return { shadowOpacity: shadowValue * staticConfig.maxShadowOpacity };\n }\n return { elevation: shadowValue * staticConfig.maxElevation };\n }, [staticConfig]);\n\n const animationProps = useMemo(() => ({\n entering: FadeInDown.duration(duration).withCallback((finished) => {\n 'worklet';\n if (finished) {\n animationFinished.value = true;\n }\n }),\n exiting: FadeOut.duration(50),\n }), [duration]);\n\n const baseStyle = [\n style,\n backgroundColor && { backgroundColor },\n staticStyle\n ];\n\n const animatedStyleArray = [\n ...baseStyle,\n animatedStyle\n ];\n\n if (!isAnimation) {\n return <View style={baseStyle} {...props}>{children}</View>;\n }\n\n return (\n <Animated.View\n style={animatedStyleArray}\n {...animationProps}\n {...props}\n >\n {children}\n </Animated.View>\n );\n}\n\nexport default React.memo(AnimatedWrapper);\n"]}
1
+ {"version":3,"file":"AnimatedWrapper.js","sourceRoot":"","sources":["../../../src/ui/atoms/AnimatedWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,IAAI,EAAa,QAAQ,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,QAAQ,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACvI,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,gBAAgB,GAAG,GAAY,CAAC;AACtC,MAAM,eAAe,GAAG,EAAW,CAAC;AACpC,MAAM,MAAM,GAAG,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC;AAIrC,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AASD,SAAS,eAAe,CAAC,EACvB,W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O,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;KAC9B,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEhB,MAAM,SAAS,GAAG;QAChB,KAAK;QACL,eAAe,IAAI,EAAE,eAAe,EAAE;QACtC,WAAW;KACZ,CAAC;IAEF,MAAM,kBAAkB,GAAG;QACzB,GAAG,SAAS;QACZ,aAAa;KACd,CAAC;IAEF,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,CACL,CAAC,QAAQ,CAAC,IAAI,CACZ,KAAK,CAAC,CAAC,kBAAkB,CAAC,CAC1B,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 } from 'react';\nimport { View, ViewProps, Platform } from 'react-native';\nimport Animated, { FadeInDown, FadeOut, useAnimatedStyle, withTiming, useSharedValue, useDerivedValue } from 'react-native-reanimated';\nimport { useTheme } from '../../context/ThemeContext';\nimport { ColorPalette, ShadowLevel, ThemeBackground, ViewColorOptions } from '../../theme/types';\nimport { IOS_SHADOW } from '../../theme/elevation';\n\nconst DEFAULT_DURATION = 200 as const;\nconst SHADOW_DURATION = 50 as const;\nconst IS_IOS = Platform.OS === 'ios';\ntype SemanticPaletteKey = 'primary' | 'secondary' | 'danger' | 'warning' | 'success' | 'information' | 'grey';\ntype PaletteShade = keyof ColorPalette;\n\nfunction isColorMap(value: unknown): value is Record<string, string> {\n return typeof value === 'object' && value !== null;\n}\n\ninterface AnimatedWrapperProps extends ViewProps {\n isAnimation: boolean;\n elevationLevel?: ShadowLevel;\n duration?: number;\n color?: ViewColorOptions;\n}\n\nfunction AnimatedWrapper({\n isAnimation = true,\n elevationLevel = 0,\n duration = DEFAULT_DURATION,\n style,\n children,\n color,\n ...props\n}: AnimatedWrapperProps) {\n const { elevation, palette } = useTheme();\n const animationFinished = useSharedValue(false);\n \n const staticConfig = useMemo(() => ({\n isIOS: IS_IOS,\n maxShadowOpacity: IS_IOS ? IOS_SHADOW[elevationLevel].shadowOpacity : 0,\n maxElevation: IS_IOS ? 0 : elevationLevel,\n }), [elevationLevel]);\n \n const backgroundColor = useMemo(() => {\n if (!color) {\n return elevationLevel ? palette.background.base : undefined;\n }\n \n const [c01, c02] = color.split('.') as [string, string | undefined];\n if (c02) {\n if (c01 === 'background') return palette.background[c02 as keyof ThemeBackground];\n if (c01 === 'text') return palette.text[c02 as keyof typeof palette.text];\n\n const semanticPalette = palette[c01 as SemanticPaletteKey];\n return isColorMap(semanticPalette) ? semanticPalette[c02 as PaletteShade] : undefined;\n }\n if (c01) return palette.background[c01 as keyof ThemeBackground] ?? palette[c01 as SemanticPaletteKey]?.main;\n if (elevationLevel) return palette.background.base;\n return undefined;\n }, [color, palette, elevationLevel]);\n\n const staticStyle = elevation[elevationLevel];\n\n const shadowProgress = useDerivedValue(() => {\n 'worklet';\n if (animationFinished.value) {\n return withTiming(1, { duration: SHADOW_DURATION });\n }\n return 0;\n }, []);\n\n const animatedStyle = useAnimatedStyle(() => {\n const shadowValue = shadowProgress.value;\n \n if (staticConfig.isIOS) {\n return { shadowOpacity: shadowValue * staticConfig.maxShadowOpacity };\n }\n return { elevation: shadowValue * staticConfig.maxElevation };\n }, [staticConfig]);\n\n const animationProps = useMemo(() => ({\n entering: FadeInDown.duration(duration).withCallback((finished) => {\n 'worklet';\n if (finished) {\n animationFinished.value = true;\n }\n }),\n exiting: FadeOut.duration(50),\n }), [duration]);\n\n const baseStyle = [\n style,\n backgroundColor && { backgroundColor },\n staticStyle\n ];\n\n const animatedStyleArray = [\n ...baseStyle,\n animatedStyle\n ];\n\n if (!isAnimation) {\n return <View style={baseStyle} {...props}>{children}</View>;\n }\n\n return (\n <Animated.View\n style={animatedStyleArray}\n {...animationProps}\n {...props}\n >\n {children}\n </Animated.View>\n );\n}\n\nexport default React.memo(AnimatedWrapper);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0610studio/zs-ui",
3
- "version": "0.16.2",
3
+ "version": "0.17.1",
4
4
  "private": false,
5
5
  "description": "EXPO ZS-UI",
6
6
  "type": "commonjs",
@@ -10,6 +10,7 @@
10
10
  "build",
11
11
  "android",
12
12
  "ios",
13
+ "app.plugin.js",
13
14
  "expo-module.config.json",
14
15
  "README.md",
15
16
  "LICENSE"
@@ -41,37 +42,46 @@
41
42
  "license": "MIT",
42
43
  "homepage": "https://github.com/0610studio/zs-ui",
43
44
  "devDependencies": {
44
- "@react-native-async-storage/async-storage": "1.23.1",
45
+ "@babel/core": "^7.20.0",
46
+ "@expo/metro-runtime": "6.1.2",
47
+ "@react-native-async-storage/async-storage": "2.2.0",
45
48
  "@testing-library/react-native": "^13.3.3",
46
49
  "@types/jest": "^29.5.12",
47
- "@types/react": "^18.0.25",
50
+ "@types/react": "~19.1.17",
48
51
  "babel-jest": "^29",
49
- "expo-module-scripts": "^3.5.2",
50
- "expo-modules-core": "~2.3.5",
51
- "expo-navigation-bar": ">=4.0.7",
52
- "expo-router": "4.0.21",
52
+ "eslint": "^8.57.1",
53
+ "expo": "54.0.33",
54
+ "expo-constants": "~18.0.13",
55
+ "expo-linking": "~8.0.11",
56
+ "expo-module-scripts": "^5.0.8",
57
+ "expo-modules-core": "3.0.29",
58
+ "expo-navigation-bar": "~5.0.10",
59
+ "expo-router": "~6.0.23",
53
60
  "jest": "^29",
54
- "jest-expo": "^51",
55
- "react": "19.0.0",
56
- "react-native": "0.79.6",
57
- "react-native-reanimated": "~3.17.4",
58
- "react-native-safe-area-context": "5.4.0",
59
- "react-native-screens": "~4.11.1",
60
- "react-native-svg": "15.11.2",
61
- "react-test-renderer": "19.0.0",
61
+ "jest-expo": "~54.0.17",
62
+ "react": "19.1.0",
63
+ "react-dom": "19.1.0",
64
+ "react-native": "0.81.5",
65
+ "react-native-reanimated": "4.1.6",
66
+ "react-native-safe-area-context": "5.6.2",
67
+ "react-native-screens": "~4.16.0",
68
+ "react-native-svg": "15.12.1",
69
+ "react-native-worklets": "0.5.1",
70
+ "react-test-renderer": "19.1.0",
62
71
  "ts-jest": "^29.2.5",
63
- "typescript": "4.9.5"
72
+ "typescript": "~5.9.3"
64
73
  },
65
74
  "peerDependencies": {
66
75
  "@react-native-async-storage/async-storage": "*",
67
- "expo": ">=53.0.0",
68
- "expo-navigation-bar": ">=4.0.7",
76
+ "expo": ">=54.0.0",
77
+ "expo-navigation-bar": ">=5.0.0",
69
78
  "expo-router": "*",
70
79
  "react": "*",
71
- "react-native": ">=0.79.0",
72
- "react-native-reanimated": "^3.0.0",
80
+ "react-native": ">=0.81.0",
81
+ "react-native-reanimated": ">=4.1.0 <5.0.0",
73
82
  "react-native-safe-area-context": "*",
74
- "react-native-svg": "*"
83
+ "react-native-svg": "*",
84
+ "react-native-worklets": ">=0.5.0 <0.9.0"
75
85
  },
76
86
  "peerDependenciesMeta": {
77
87
  "@react-native-async-storage/async-storage": {
@@ -92,6 +102,9 @@
92
102
  "react-native-reanimated": {
93
103
  "optional": false
94
104
  },
105
+ "react-native-worklets": {
106
+ "optional": false
107
+ },
95
108
  "react-native-safe-area-context": {
96
109
  "optional": false
97
110
  },