@0610studio/zs-ui 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ZsUiModule.d.ts.map +1 -1
- package/build/ZsUiModule.js +0 -2
- package/build/ZsUiModule.js.map +1 -1
- package/build/assets/SvgExclamation.d.ts.map +1 -1
- package/build/assets/SvgExclamation.js.map +1 -1
- package/build/context/OverlayContext.d.ts.map +1 -1
- package/build/context/OverlayContext.js +11 -14
- package/build/context/OverlayContext.js.map +1 -1
- package/build/context/ThemeContext.d.ts +9 -0
- package/build/context/ThemeContext.d.ts.map +1 -1
- package/build/context/ThemeContext.js +8 -11
- package/build/context/ThemeContext.js.map +1 -1
- package/build/index.d.ts +2 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -7
- package/build/index.js.map +1 -1
- package/build/model/globalOverlay.d.ts +0 -8
- package/build/model/globalOverlay.d.ts.map +1 -1
- package/build/model/globalOverlay.js +0 -9
- package/build/model/globalOverlay.js.map +1 -1
- package/build/model/types.d.ts +1 -1
- package/build/model/types.d.ts.map +1 -1
- package/build/model/types.js.map +1 -1
- package/build/model/useKeyboard.d.ts.map +1 -1
- package/build/model/useKeyboard.js +8 -4
- package/build/model/useKeyboard.js.map +1 -1
- package/build/model/utils.d.ts +1 -1
- package/build/model/utils.d.ts.map +1 -1
- package/build/model/utils.js +2 -1
- package/build/model/utils.js.map +1 -1
- package/build/overlay/AlertOverlay/index.d.ts.map +1 -1
- package/build/overlay/AlertOverlay/index.js +2 -2
- package/build/overlay/AlertOverlay/index.js.map +1 -1
- package/build/overlay/BottomSheetOverlay/index.d.ts.map +1 -1
- package/build/overlay/BottomSheetOverlay/index.js +18 -8
- package/build/overlay/BottomSheetOverlay/index.js.map +1 -1
- package/build/overlay/Modality/index.d.ts.map +1 -1
- package/build/overlay/Modality/index.js +3 -9
- package/build/overlay/Modality/index.js.map +1 -1
- package/build/overlay/PopOver/PopOverMenu.d.ts.map +1 -1
- package/build/overlay/PopOver/PopOverMenu.js +3 -6
- package/build/overlay/PopOver/PopOverMenu.js.map +1 -1
- package/build/overlay/SnackbarNotify/index.d.ts +3 -3
- package/build/overlay/SnackbarNotify/index.d.ts.map +1 -1
- package/build/overlay/SnackbarNotify/index.js +5 -4
- package/build/overlay/SnackbarNotify/index.js.map +1 -1
- package/build/overlay/SnackbarNotify/ui/SnackbarItem.d.ts +3 -3
- package/build/overlay/SnackbarNotify/ui/SnackbarItem.d.ts.map +1 -1
- package/build/overlay/SnackbarNotify/ui/SnackbarItem.js +5 -5
- package/build/overlay/SnackbarNotify/ui/SnackbarItem.js.map +1 -1
- package/build/overlay/ZSPortal/index.d.ts.map +1 -1
- package/build/overlay/ZSPortal/index.js +15 -4
- package/build/overlay/ZSPortal/index.js.map +1 -1
- package/build/overlay/ui/ModalBackground.js.map +1 -1
- package/build/theme/elevation.d.ts +94 -10
- package/build/theme/elevation.d.ts.map +1 -1
- package/build/theme/elevation.js +39 -35
- package/build/theme/elevation.js.map +1 -1
- package/build/theme/palette.d.ts +1 -5
- package/build/theme/palette.d.ts.map +1 -1
- package/build/theme/palette.js +3 -12
- package/build/theme/palette.js.map +1 -1
- package/build/theme/resolveColor.d.ts +4 -0
- package/build/theme/resolveColor.d.ts.map +1 -0
- package/build/theme/resolveColor.js +29 -0
- package/build/theme/resolveColor.js.map +1 -0
- package/build/ui/ZSBlockButton/index.d.ts +4 -2
- package/build/ui/ZSBlockButton/index.d.ts.map +1 -1
- package/build/ui/ZSBlockButton/index.js +31 -79
- package/build/ui/ZSBlockButton/index.js.map +1 -1
- package/build/ui/ZSContainer/index.d.ts +20 -0
- package/build/ui/ZSContainer/index.d.ts.map +1 -1
- package/build/ui/ZSContainer/index.js +28 -15
- package/build/ui/ZSContainer/index.js.map +1 -1
- package/build/ui/ZSPressable/index.d.ts.map +1 -1
- package/build/ui/ZSPressable/index.js +0 -2
- package/build/ui/ZSPressable/index.js.map +1 -1
- package/build/ui/ZSRadioGroup/index.d.ts +3 -2
- package/build/ui/ZSRadioGroup/index.d.ts.map +1 -1
- package/build/ui/ZSRadioGroup/index.js +64 -52
- package/build/ui/ZSRadioGroup/index.js.map +1 -1
- package/build/ui/ZSSkeleton/index.d.ts +2 -1
- package/build/ui/ZSSkeleton/index.d.ts.map +1 -1
- package/build/ui/ZSSkeleton/index.js +2 -2
- package/build/ui/ZSSkeleton/index.js.map +1 -1
- package/build/ui/ZSSkeletonBox/index.d.ts +2 -1
- package/build/ui/ZSSkeletonBox/index.d.ts.map +1 -1
- package/build/ui/ZSSkeletonBox/index.js +7 -5
- package/build/ui/ZSSkeletonBox/index.js.map +1 -1
- package/build/ui/ZSSwitch/index.d.ts +2 -1
- package/build/ui/ZSSwitch/index.d.ts.map +1 -1
- package/build/ui/ZSSwitch/index.js +2 -2
- package/build/ui/ZSSwitch/index.js.map +1 -1
- package/build/ui/ZSText/index.d.ts +3 -2
- package/build/ui/ZSText/index.d.ts.map +1 -1
- package/build/ui/ZSText/index.js +5 -16
- package/build/ui/ZSText/index.js.map +1 -1
- package/build/ui/ZSTextField/index.d.ts.map +1 -1
- package/build/ui/ZSTextField/index.js +41 -28
- package/build/ui/ZSTextField/index.js.map +1 -1
- package/build/ui/ZSView/index.d.ts +3 -2
- package/build/ui/ZSView/index.d.ts.map +1 -1
- package/build/ui/ZSView/index.js +7 -8
- package/build/ui/ZSView/index.js.map +1 -1
- package/build/ui/atoms/AnimatedWrapper.d.ts.map +1 -1
- package/build/ui/atoms/AnimatedWrapper.js +33 -40
- package/build/ui/atoms/AnimatedWrapper.js.map +1 -1
- package/build/ui/atoms/TextAtom.d.ts +1 -2
- package/build/ui/atoms/TextAtom.d.ts.map +1 -1
- package/build/ui/atoms/TextAtom.js.map +1 -1
- package/build/ui/atoms/ViewAtom.d.ts +1 -2
- package/build/ui/atoms/ViewAtom.d.ts.map +1 -1
- package/build/ui/atoms/ViewAtom.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ZSText/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ZSText/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAA2B,MAAM,mBAAmB,CAAC;AAI3F,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AAED,iBAAS,MAAM,CAAC,EACd,IAAe,EACf,KAAc,EACd,GAAG,KAAK,EACT,EAAE,WAAW,qBAUb;;AAED,wBAAkC"}
|
package/build/ui/ZSText/index.js
CHANGED
|
@@ -1,24 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
2
3
|
import { useTheme } from "../../context/ThemeContext";
|
|
4
|
+
import { resolveTextColor } from "../../theme/resolveColor";
|
|
3
5
|
import TextAtom from "../atoms/TextAtom";
|
|
4
|
-
function isColorMap(value) {
|
|
5
|
-
return typeof value === 'object' && value !== null;
|
|
6
|
-
}
|
|
7
6
|
function ZSText({ typo = 'body.2', color = 'base', ...props }) {
|
|
8
7
|
const { palette, typography } = useTheme();
|
|
9
8
|
const [s01, s02] = typo.split('.');
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
if (!c02)
|
|
13
|
-
return palette.text[c01];
|
|
14
|
-
if (c01 === 'text')
|
|
15
|
-
return palette.text[c02];
|
|
16
|
-
if (c01 === 'background')
|
|
17
|
-
return palette.background[c02];
|
|
18
|
-
const semanticPalette = palette[c01];
|
|
19
|
-
return isColorMap(semanticPalette) ? semanticPalette[c02] : undefined;
|
|
20
|
-
})();
|
|
21
|
-
return _jsx(TextAtom, { ...props, style: [typography[s01][s02], { color: textColor }, props.style], children: props.children });
|
|
9
|
+
const textColor = resolveTextColor(palette, color);
|
|
10
|
+
return (_jsx(TextAtom, { ...props, style: [typography[s01][s02], { color: textColor }, props.style], children: props.children }));
|
|
22
11
|
}
|
|
23
|
-
export default ZSText;
|
|
12
|
+
export default React.memo(ZSText);
|
|
24
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSText/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSText/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AAOzC,SAAS,MAAM,CAAC,EACd,IAAI,GAAG,QAAQ,EACf,KAAK,GAAG,MAAM,EACd,GAAG,KAAK,EACI;IACZ,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC3C,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAA8B,CAAC;IAChE,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAEnD,OAAO,CACL,KAAC,QAAQ,OAAK,KAAK,EAAE,KAAK,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,YAClF,KAAK,CAAC,QAAQ,GACN,CACZ,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport { TextProps } from \"react-native\";\nimport { useTheme } from \"../../context/ThemeContext\";\nimport { TypoColorOptions, TypoOptions, TypoStyle, TypoSubStyle } from \"../../theme/types\";\nimport { resolveTextColor } from \"../../theme/resolveColor\";\nimport TextAtom from \"../atoms/TextAtom\";\n\nexport interface ZSTextProps extends TextProps {\n typo?: TypoOptions;\n color?: TypoColorOptions;\n}\n\nfunction ZSText({\n typo = 'body.2',\n color = 'base',\n ...props\n}: ZSTextProps) {\n const { palette, typography } = useTheme();\n const [s01, s02] = typo.split('.') as [TypoStyle, TypoSubStyle];\n const textColor = resolveTextColor(palette, color);\n\n return (\n <TextAtom {...props} style={[typography[s01][s02], { color: textColor }, props.style]}>\n {props.children}\n </TextAtom>\n );\n}\n\nexport default React.memo(ZSText);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ZSTextField/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAA0C,SAAS,EAAE,cAAc,EAAa,MAAM,cAAc,CAAC;AAI5G,OAAO,EAAE,WAAW,EAA2B,MAAM,mBAAmB,CAAC;AAKzE,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAMzD,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE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AAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,aAAa,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC;AAEvC,QAAA,MAAM,WAAW,sGA8Qf,CAAC;AAIH,eAAe,WAAW,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useCallback, useState, forwardRef, useEffect, useRef } from 'react';
|
|
3
3
|
import { Platform, TextInput } from 'react-native';
|
|
4
|
-
import Animated, { interpolate, useAnimatedStyle, useSharedValue, withTiming, ReduceMotion } from 'react-native-reanimated';
|
|
4
|
+
import Animated, { interpolate, interpolateColor, useAnimatedStyle, useSharedValue, withTiming, ReduceMotion } from 'react-native-reanimated';
|
|
5
5
|
import ButtonClose from './ui/ButtonClose';
|
|
6
6
|
import ErrorComponent from './ui/ErrorComponent';
|
|
7
7
|
import { extractStyle } from '../../model/utils';
|
|
@@ -16,11 +16,13 @@ const ZSTextField = forwardRef(({ typo = 'body.2', status = 'default', value, on
|
|
|
16
16
|
const fErrorColor = errorColor || palette.danger.main;
|
|
17
17
|
const fontSize = extractStyle(typography[primaryStyle][subStyle], 'fontSize') || 17;
|
|
18
18
|
const fontFamily = extractStyle(typography[primaryStyle][subStyle], 'fontFamily') || '';
|
|
19
|
-
const floatProgress = useSharedValue(value !== '' ? 1 : 0);
|
|
20
|
-
const [isFocusedForUI, setIsFocusedForUI] = useState(false);
|
|
21
|
-
const boxHeightValue = useSharedValue(0);
|
|
22
19
|
const isError = status === 'error';
|
|
23
20
|
const hasValue = value !== '';
|
|
21
|
+
const floatProgress = useSharedValue(hasValue ? 1 : 0);
|
|
22
|
+
const focusProgress = useSharedValue(0);
|
|
23
|
+
const errorProgress = useSharedValue(isError ? 1 : 0);
|
|
24
|
+
const boxHeightValue = useSharedValue(0);
|
|
25
|
+
const [isFocusedForUI, setIsFocusedForUI] = useState(false);
|
|
24
26
|
const isFocusedRef = useRef(false);
|
|
25
27
|
const hasValueRef = useRef(hasValue);
|
|
26
28
|
hasValueRef.current = hasValue;
|
|
@@ -30,12 +32,26 @@ const ZSTextField = forwardRef(({ typo = 'body.2', status = 'default', value, on
|
|
|
30
32
|
floatProgress.value = withTiming(target, TIMING_CONFIG);
|
|
31
33
|
}
|
|
32
34
|
}, [hasValue]);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const target = isError ? 1 : 0;
|
|
37
|
+
if (errorProgress.value !== target) {
|
|
38
|
+
errorProgress.value = withTiming(target, TIMING_CONFIG);
|
|
39
|
+
}
|
|
40
|
+
}, [isError]);
|
|
33
41
|
const animationConstants = useMemo(() => ({
|
|
34
42
|
baseFontSize: fontSize + (boxStyle === 'inbox' ? 1 : 0),
|
|
35
43
|
targetFontSize: boxStyle === 'inbox' ? 10 : 11,
|
|
36
44
|
baseTop: isTextArea ? 12 : 0,
|
|
37
45
|
targetTopOffset: boxStyle === 'inbox' ? 17 : 2,
|
|
38
46
|
}), [fontSize, boxStyle, isTextArea]);
|
|
47
|
+
const colorConfig = useMemo(() => ({
|
|
48
|
+
primaryColor: focusColor || palette.primary.main,
|
|
49
|
+
defaultBorderColor: borderColor || palette.grey[30],
|
|
50
|
+
defaultLabelColor: labelColor || palette.text.secondary,
|
|
51
|
+
placeholderColor: placeHolderColor || palette.grey[40],
|
|
52
|
+
errorColor: fErrorColor,
|
|
53
|
+
}), [focusColor, palette.primary.main, borderColor, palette.grey, labelColor, palette.text.secondary, placeHolderColor, fErrorColor]);
|
|
54
|
+
const nonFocusLabelColor = useMemo(() => (hasValue ? colorConfig.defaultLabelColor : colorConfig.placeholderColor), [hasValue, colorConfig.defaultLabelColor, colorConfig.placeholderColor]);
|
|
39
55
|
const animatedLabelStyle = useAnimatedStyle(() => {
|
|
40
56
|
const progress = floatProgress.value;
|
|
41
57
|
const labelTranslateY = interpolate(progress, [0, 1], [
|
|
@@ -43,22 +59,35 @@ const ZSTextField = forwardRef(({ typo = 'body.2', status = 'default', value, on
|
|
|
43
59
|
isTextArea ? -24 : -(boxHeightValue.value / 2) - 1 + animationConstants.targetTopOffset - animationConstants.baseTop,
|
|
44
60
|
], 'clamp');
|
|
45
61
|
const labelScale = interpolate(progress, [0, 1], [1, animationConstants.targetFontSize / animationConstants.baseFontSize], 'clamp');
|
|
62
|
+
const focusedColor = interpolateColor(focusProgress.value, [0, 1], [nonFocusLabelColor, colorConfig.primaryColor]);
|
|
63
|
+
const color = interpolateColor(errorProgress.value, [0, 1], [focusedColor, colorConfig.errorColor]);
|
|
46
64
|
return {
|
|
65
|
+
color,
|
|
47
66
|
transform: [
|
|
48
67
|
{ translateY: labelTranslateY },
|
|
49
68
|
{ scale: labelScale },
|
|
50
69
|
],
|
|
51
70
|
};
|
|
52
|
-
}, [animationConstants, isTextArea]);
|
|
71
|
+
}, [animationConstants, isTextArea, nonFocusLabelColor, colorConfig.primaryColor, colorConfig.errorColor]);
|
|
72
|
+
const animatedBorderStyle = useAnimatedStyle(() => {
|
|
73
|
+
const focusedColor = interpolateColor(focusProgress.value, [0, 1], [colorConfig.defaultBorderColor, colorConfig.primaryColor]);
|
|
74
|
+
const borderColor = interpolateColor(errorProgress.value, [0, 1], [focusedColor, colorConfig.errorColor]);
|
|
75
|
+
return { borderColor };
|
|
76
|
+
}, [colorConfig.defaultBorderColor, colorConfig.primaryColor, colorConfig.errorColor]);
|
|
53
77
|
const handleLayout = useCallback((event) => {
|
|
54
78
|
const { height } = event.nativeEvent.layout;
|
|
55
|
-
boxHeightValue.value
|
|
79
|
+
if (boxHeightValue.value !== height) {
|
|
80
|
+
boxHeightValue.value = height;
|
|
81
|
+
}
|
|
56
82
|
}, []);
|
|
57
83
|
const handleFocus = useCallback(() => {
|
|
58
84
|
isFocusedRef.current = true;
|
|
59
85
|
if (floatProgress.value !== 1) {
|
|
60
86
|
floatProgress.value = withTiming(1, TIMING_CONFIG);
|
|
61
87
|
}
|
|
88
|
+
if (focusProgress.value !== 1) {
|
|
89
|
+
focusProgress.value = withTiming(1, TIMING_CONFIG);
|
|
90
|
+
}
|
|
62
91
|
setIsFocusedForUI(true);
|
|
63
92
|
}, []);
|
|
64
93
|
const handleBlur = useCallback(() => {
|
|
@@ -67,27 +96,11 @@ const ZSTextField = forwardRef(({ typo = 'body.2', status = 'default', value, on
|
|
|
67
96
|
if (floatProgress.value !== target) {
|
|
68
97
|
floatProgress.value = withTiming(target, TIMING_CONFIG);
|
|
69
98
|
}
|
|
99
|
+
if (focusProgress.value !== 0) {
|
|
100
|
+
focusProgress.value = withTiming(0, TIMING_CONFIG);
|
|
101
|
+
}
|
|
70
102
|
setIsFocusedForUI(false);
|
|
71
103
|
}, []);
|
|
72
|
-
const colorConfig = useMemo(() => ({
|
|
73
|
-
primaryColor: focusColor || palette.primary.main,
|
|
74
|
-
defaultBorderColor: borderColor || palette.grey[30],
|
|
75
|
-
defaultLabelColor: labelColor || palette.text.secondary,
|
|
76
|
-
placeholderColor: placeHolderColor || palette.grey[40],
|
|
77
|
-
errorColor: fErrorColor,
|
|
78
|
-
}), [focusColor, palette.primary.main, borderColor, palette.grey, labelColor, palette.text.secondary, placeHolderColor, fErrorColor]);
|
|
79
|
-
const currentBorderColor = isError
|
|
80
|
-
? colorConfig.errorColor
|
|
81
|
-
: isFocusedForUI
|
|
82
|
-
? colorConfig.primaryColor
|
|
83
|
-
: colorConfig.defaultBorderColor;
|
|
84
|
-
const currentLabelColor = isError
|
|
85
|
-
? colorConfig.errorColor
|
|
86
|
-
: isFocusedForUI
|
|
87
|
-
? colorConfig.primaryColor
|
|
88
|
-
: hasValue
|
|
89
|
-
? colorConfig.defaultLabelColor
|
|
90
|
-
: colorConfig.placeholderColor;
|
|
91
104
|
const styleConfig = useMemo(() => {
|
|
92
105
|
const baseStyle = {
|
|
93
106
|
width: '100%',
|
|
@@ -97,7 +110,6 @@ const ZSTextField = forwardRef(({ typo = 'body.2', status = 'default', value, on
|
|
|
97
110
|
backgroundColor: inputBgColor || palette.background.base,
|
|
98
111
|
paddingTop: boxStyle === 'inbox' ? 13 : 0,
|
|
99
112
|
};
|
|
100
|
-
// 박스 스타일에 따른 테두리 설정
|
|
101
113
|
let borderStyle = {};
|
|
102
114
|
if (boxStyle === 'outline' || boxStyle === 'inbox') {
|
|
103
115
|
borderStyle = { borderWidth };
|
|
@@ -105,7 +117,6 @@ const ZSTextField = forwardRef(({ typo = 'body.2', status = 'default', value, on
|
|
|
105
117
|
else if (boxStyle === 'underline') {
|
|
106
118
|
borderStyle = { borderBottomWidth: borderWidth };
|
|
107
119
|
}
|
|
108
|
-
// innerBoxStyle에 따른 스타일 설정
|
|
109
120
|
let innerStyle = {};
|
|
110
121
|
if (innerBoxStyle === 'top') {
|
|
111
122
|
innerStyle = {
|
|
@@ -143,6 +154,8 @@ const ZSTextField = forwardRef(({ typo = 'body.2', status = 'default', value, on
|
|
|
143
154
|
borderRadius: boxStyle === 'outline' ? 5 : 0,
|
|
144
155
|
...(Platform.OS === 'android' ? { overflow: 'hidden' } : {}),
|
|
145
156
|
}), [fontSize, animationConstants.baseTop, paddingHorizontal, labelBgColor, palette.background.base, boxStyle, fontFamily]);
|
|
157
|
+
const boxStyleArray = useMemo(() => [styleConfig, animatedBorderStyle], [styleConfig, animatedBorderStyle]);
|
|
158
|
+
const labelStyleArray = useMemo(() => [labelTextStyle, animatedLabelStyle], [labelTextStyle, animatedLabelStyle]);
|
|
146
159
|
const handleTextChange = (text) => {
|
|
147
160
|
if (onChangeText)
|
|
148
161
|
onChangeText(text);
|
|
@@ -162,7 +175,7 @@ const ZSTextField = forwardRef(({ typo = 'body.2', status = 'default', value, on
|
|
|
162
175
|
], [palette.text.base, fontSize, fontFamily, textInputProps?.style]);
|
|
163
176
|
const shouldShowCloseButton = value && isFocusedForUI;
|
|
164
177
|
const shouldShowError = status === 'error' && errorMessage;
|
|
165
|
-
return (_jsxs(ViewAtom, { style: { alignSelf: 'stretch', width: '100%' }, children: [_jsxs(
|
|
178
|
+
return (_jsxs(ViewAtom, { style: { alignSelf: 'stretch', width: '100%' }, children: [_jsxs(Animated.View, { style: boxStyleArray, onLayout: handleLayout, pointerEvents: disabled ? 'none' : 'auto', children: [_jsx(TextInput, { ...textInputProps, ref: ref, style: textInputStyle, value: value, onFocus: handleFocus, onBlur: handleBlur, onChangeText: handleTextChange, allowFontScaling: allowFontScaling, selectionColor: palette.grey[50], autoCorrect: false, spellCheck: false }), _jsx(ViewAtom, { pointerEvents: "none", style: { position: 'absolute' }, children: _jsx(Animated.Text, { allowFontScaling: allowFontScaling, style: labelStyleArray, children: label }) }), shouldShowCloseButton && (_jsx(ButtonClose, { marginTop: isTextArea ? 13 : undefined, onChangeText: onChangeText }))] }), shouldShowError && (_jsx(ErrorComponent, { errorMessage: errorMessage, errorColor: fErrorColor }))] }));
|
|
166
179
|
});
|
|
167
180
|
ZSTextField.displayName = 'ZSTextField';
|
|
168
181
|
export default ZSTextField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSTextField/index.t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W,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
|
+
{"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,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC9I,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,E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,CAAC,CAAC,MAAM,aAEzC,KAAC,SAAS,OACJ,cAAc,EAClB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,UAAU,EAClB,YAAY,EAAE,gBAAgB,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAChC,WAAW,EAAE,KAAK,EAClB,UAAU,EAAE,KAAK,GACjB,EAEF,KAAC,QAAQ,IAAC,aAAa,EAAC,MAAM,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,YAC5D,KAAC,QAAQ,CAAC,IAAI,IAAC,gBAAgB,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,YACtE,KAAK,GACQ,GACP,EAEV,qBAAqB,IAAI,CACxB,KAAC,WAAW,IAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY,EAAE,YAAY,GAAI,CACpF,IACa,EAEf,eAAe,IAAI,CAClB,KAAC,cAAc,IAAC,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,GAAI,CACxE,IACQ,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, interpolateColor, 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 isError = status === 'error';\n const hasValue = value !== '';\n\n const floatProgress = useSharedValue(hasValue ? 1 : 0);\n const focusProgress = useSharedValue(0);\n const errorProgress = useSharedValue(isError ? 1 : 0);\n const boxHeightValue = useSharedValue(0);\n\n const [isFocusedForUI, setIsFocusedForUI] = useState<boolean>(false);\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 useEffect(() => {\n const target = isError ? 1 : 0;\n if (errorProgress.value !== target) {\n errorProgress.value = withTiming(target, TIMING_CONFIG);\n }\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 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 nonFocusLabelColor = useMemo(\n () => (hasValue ? colorConfig.defaultLabelColor : colorConfig.placeholderColor),\n [hasValue, colorConfig.defaultLabelColor, colorConfig.placeholderColor]\n );\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 const focusedColor = interpolateColor(focusProgress.value, [0, 1], [nonFocusLabelColor, colorConfig.primaryColor]);\n const color = interpolateColor(errorProgress.value, [0, 1], [focusedColor, colorConfig.errorColor]);\n\n return {\n color,\n transform: [\n { translateY: labelTranslateY },\n { scale: labelScale },\n ],\n };\n }, [animationConstants, isTextArea, nonFocusLabelColor, colorConfig.primaryColor, colorConfig.errorColor]);\n\n const animatedBorderStyle = useAnimatedStyle(() => {\n const focusedColor = interpolateColor(focusProgress.value, [0, 1], [colorConfig.defaultBorderColor, colorConfig.primaryColor]);\n const borderColor = interpolateColor(errorProgress.value, [0, 1], [focusedColor, colorConfig.errorColor]);\n return { borderColor };\n }, [colorConfig.defaultBorderColor, colorConfig.primaryColor, colorConfig.errorColor]);\n\n const handleLayout = useCallback((event: LayoutChangeEvent) => {\n const { height } = event.nativeEvent.layout;\n if (boxHeightValue.value !== height) {\n boxHeightValue.value = height;\n }\n }, []);\n\n const handleFocus = useCallback(() => {\n isFocusedRef.current = true;\n if (floatProgress.value !== 1) {\n floatProgress.value = withTiming(1, TIMING_CONFIG);\n }\n if (focusProgress.value !== 1) {\n focusProgress.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 if (focusProgress.value !== 0) {\n focusProgress.value = withTiming(0, TIMING_CONFIG);\n }\n setIsFocusedForUI(false);\n }, []);\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 let borderStyle = {};\n if (boxStyle === 'outline' || boxStyle === 'inbox') {\n borderStyle = { borderWidth };\n } else if (boxStyle === 'underline') {\n borderStyle = { borderBottomWidth: borderWidth };\n }\n\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 boxStyleArray = useMemo(\n () => [styleConfig, animatedBorderStyle],\n [styleConfig, animatedBorderStyle]\n );\n\n const labelStyleArray = useMemo(\n () => [labelTextStyle, animatedLabelStyle],\n [labelTextStyle, animatedLabelStyle]\n );\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 <Animated.View\n style={boxStyleArray}\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={labelStyleArray}>\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"]}
|
|
@@ -6,6 +6,7 @@ type Props = ViewProps & {
|
|
|
6
6
|
elevationLevel?: ShadowLevel;
|
|
7
7
|
color?: ViewColorOptions;
|
|
8
8
|
};
|
|
9
|
-
declare
|
|
10
|
-
|
|
9
|
+
declare function ZSView({ isAnimation, elevationLevel, style, children, color, ...rest }: Props): React.JSX.Element;
|
|
10
|
+
declare const _default: React.MemoExoticComponent<typeof ZSView>;
|
|
11
|
+
export default _default;
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ZSView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ZSView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAc,SAAS,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAElE,KAAK,KAAK,GAAG,SAAS,GAAG;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF,iBAAS,MAAM,CAAC,EAAE,WAAmB,EAAE,cAAkB,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,qBAclG;;AAED,wBAAkC"}
|
package/build/ui/ZSView/index.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { StyleSheet } from 'react-native';
|
|
4
|
-
import {
|
|
4
|
+
import { useStyleSheetCreate } from '../../model/useStyleSheetCreate';
|
|
5
5
|
import AnimatedWrapper from '../atoms/AnimatedWrapper';
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const styles = useMemo(() => StyleSheet.create({
|
|
6
|
+
function ZSView({ isAnimation = false, elevationLevel = 0, style, children, color, ...rest }) {
|
|
7
|
+
const styles = useStyleSheetCreate((palette) => StyleSheet.create({
|
|
9
8
|
container: {
|
|
10
9
|
backgroundColor: palette.background.base,
|
|
11
10
|
},
|
|
12
|
-
})
|
|
11
|
+
}));
|
|
13
12
|
return (_jsx(AnimatedWrapper, { color: color, isAnimation: isAnimation, elevationLevel: elevationLevel, style: [styles.container, style], ...rest, children: children }));
|
|
14
|
-
}
|
|
15
|
-
export default ZSView;
|
|
13
|
+
}
|
|
14
|
+
export default React.memo(ZSView);
|
|
16
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSView/index.tsx"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSView/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAa,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,eAAe,MAAM,0BAA0B,CAAC;AASvD,SAAS,MAAM,CAAC,EAAE,WAAW,GAAG,KAAK,EAAE,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,IAAI,EAAS;IACjG,MAAM,MAAM,GAAG,mBAAmB,CAAC,CAAC,OAAO,EAAE,EAAE,CAC7C,UAAU,CAAC,MAAM,CAAC;QAChB,SAAS,EAAE;YACT,eAAe,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;SACzC;KACF,CAAC,CACH,CAAC;IAEF,OAAO,CACL,KAAC,eAAe,IAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,KAAM,IAAI,YAChI,QAAQ,GACO,CACnB,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { StyleSheet, ViewProps } from 'react-native';\nimport { useStyleSheetCreate } from '../../model/useStyleSheetCreate';\nimport AnimatedWrapper from '../atoms/AnimatedWrapper';\nimport { ViewColorOptions, ShadowLevel } from '../../theme/types';\n\ntype Props = ViewProps & {\n isAnimation?: boolean;\n elevationLevel?: ShadowLevel;\n color?: ViewColorOptions;\n};\n\nfunction ZSView({ isAnimation = false, elevationLevel = 0, style, children, color, ...rest }: Props) {\n const styles = useStyleSheetCreate((palette) =>\n StyleSheet.create({\n container: {\n backgroundColor: palette.background.base,\n },\n }),\n );\n\n return (\n <AnimatedWrapper color={color} isAnimation={isAnimation} elevationLevel={elevationLevel} style={[styles.container, style]} {...rest}>\n {children}\n </AnimatedWrapper>\n );\n}\n\nexport default React.memo(ZSView);\n"]}
|
|
@@ -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,
|
|
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,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAOlE,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,qBAyFtB;;AAED,wBAA2C"}
|
|
@@ -1,41 +1,33 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
|
-
import { View
|
|
3
|
+
import { View } from 'react-native';
|
|
4
4
|
import Animated, { FadeInDown, FadeOut, useAnimatedStyle, withTiming, useSharedValue, useDerivedValue } from 'react-native-reanimated';
|
|
5
5
|
import { useTheme } from '../../context/ThemeContext';
|
|
6
|
-
import {
|
|
6
|
+
import { resolveViewColor } from '../../theme/resolveColor';
|
|
7
|
+
import { IOS_SHADOW, parseColorChannels } from '../../theme/elevation';
|
|
7
8
|
const DEFAULT_DURATION = 200;
|
|
8
9
|
const SHADOW_DURATION = 50;
|
|
9
|
-
const IS_IOS = Platform.OS === 'ios';
|
|
10
|
-
function isColorMap(value) {
|
|
11
|
-
return typeof value === 'object' && value !== null;
|
|
12
|
-
}
|
|
13
10
|
function AnimatedWrapper({ isAnimation = true, elevationLevel = 0, duration = DEFAULT_DURATION, style, children, color, ...props }) {
|
|
14
11
|
const { elevation, palette } = useTheme();
|
|
15
12
|
const animationFinished = useSharedValue(false);
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
const shadowConfig = useMemo(() => {
|
|
14
|
+
const shadow = IOS_SHADOW[elevationLevel];
|
|
15
|
+
const { r, g, b, a } = parseColorChannels(palette.elevationShadow[elevationLevel] ?? '');
|
|
16
|
+
return {
|
|
17
|
+
offsetX: shadow.shadowOffset.width,
|
|
18
|
+
offsetY: shadow.shadowOffset.height,
|
|
19
|
+
blurRadius: shadow.shadowRadius,
|
|
20
|
+
maxAlpha: a * shadow.shadowOpacity,
|
|
21
|
+
r,
|
|
22
|
+
g,
|
|
23
|
+
b,
|
|
24
|
+
};
|
|
25
|
+
}, [elevationLevel, palette]);
|
|
21
26
|
const backgroundColor = useMemo(() => {
|
|
22
27
|
if (!color) {
|
|
23
28
|
return elevationLevel ? palette.background.base : undefined;
|
|
24
29
|
}
|
|
25
|
-
|
|
26
|
-
if (c02) {
|
|
27
|
-
if (c01 === 'background')
|
|
28
|
-
return palette.background[c02];
|
|
29
|
-
if (c01 === 'text')
|
|
30
|
-
return palette.text[c02];
|
|
31
|
-
const semanticPalette = palette[c01];
|
|
32
|
-
return isColorMap(semanticPalette) ? semanticPalette[c02] : undefined;
|
|
33
|
-
}
|
|
34
|
-
if (c01)
|
|
35
|
-
return palette.background[c01] ?? palette[c01]?.main;
|
|
36
|
-
if (elevationLevel)
|
|
37
|
-
return palette.background.base;
|
|
38
|
-
return undefined;
|
|
30
|
+
return resolveViewColor(palette, color);
|
|
39
31
|
}, [color, palette, elevationLevel]);
|
|
40
32
|
const staticStyle = elevation[elevationLevel];
|
|
41
33
|
const shadowProgress = useDerivedValue(() => {
|
|
@@ -46,12 +38,19 @@ function AnimatedWrapper({ isAnimation = true, elevationLevel = 0, duration = DE
|
|
|
46
38
|
return 0;
|
|
47
39
|
}, []);
|
|
48
40
|
const animatedStyle = useAnimatedStyle(() => {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
41
|
+
const alpha = shadowConfig.maxAlpha * shadowProgress.value;
|
|
42
|
+
return {
|
|
43
|
+
boxShadow: [
|
|
44
|
+
{
|
|
45
|
+
offsetX: shadowConfig.offsetX,
|
|
46
|
+
offsetY: shadowConfig.offsetY,
|
|
47
|
+
blurRadius: shadowConfig.blurRadius,
|
|
48
|
+
spreadDistance: 0,
|
|
49
|
+
color: `rgba(${shadowConfig.r}, ${shadowConfig.g}, ${shadowConfig.b}, ${alpha})`,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}, [shadowConfig]);
|
|
55
54
|
const animationProps = useMemo(() => ({
|
|
56
55
|
entering: FadeInDown.duration(duration).withCallback((finished) => {
|
|
57
56
|
'worklet';
|
|
@@ -61,15 +60,9 @@ function AnimatedWrapper({ isAnimation = true, elevationLevel = 0, duration = DE
|
|
|
61
60
|
}),
|
|
62
61
|
exiting: FadeOut.duration(50),
|
|
63
62
|
}), [duration]);
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
staticStyle
|
|
68
|
-
];
|
|
69
|
-
const animatedStyleArray = [
|
|
70
|
-
...baseStyle,
|
|
71
|
-
animatedStyle
|
|
72
|
-
];
|
|
63
|
+
const bgStyle = useMemo(() => (backgroundColor ? { backgroundColor } : undefined), [backgroundColor]);
|
|
64
|
+
const baseStyle = useMemo(() => [style, bgStyle, staticStyle], [style, bgStyle, staticStyle]);
|
|
65
|
+
const animatedStyleArray = useMemo(() => [style, bgStyle, staticStyle, animatedStyle], [style, bgStyle, staticStyle, animatedStyle]);
|
|
73
66
|
if (!isAnimation) {
|
|
74
67
|
return _jsx(View, { style: baseStyle, ...props, children: children });
|
|
75
68
|
}
|
|
@@ -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,
|
|
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,MAAM,cAAc,CAAC;AAC/C,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,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEvE,MAAM,gBAAgB,GAAG,GAAY,CAAC;AACtC,MAAM,eAAe,GAAG,EAAW,CAAC;AASpC,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;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GAAG,OAAO,CAChC,GAAG,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,CAAC,EAClD,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,CAAC,CAC7C,CAAC;IAEF,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,KAAC,IAAI,IAAC,KAAK,EAAE,SAAS,KAAM,KAAK,YAAG,QAAQ,GAAQ,CAAC;IAC9D,CAAC;IAED,OAAO,CACL,KAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAE,kBAAkB,KACrB,cAAc,KACd,KAAK,YAER,QAAQ,GACK,CACjB,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC","sourcesContent":["import React, { useMemo } from 'react';\nimport { View, ViewProps } from 'react-native';\nimport Animated, { FadeInDown, FadeOut, useAnimatedStyle, withTiming, useSharedValue, useDerivedValue } from 'react-native-reanimated';\nimport { useTheme } from '../../context/ThemeContext';\nimport { ShadowLevel, ViewColorOptions } from '../../theme/types';\nimport { resolveViewColor } from '../../theme/resolveColor';\nimport { IOS_SHADOW, parseColorChannels } from '../../theme/elevation';\n\nconst DEFAULT_DURATION = 200 as const;\nconst SHADOW_DURATION = 50 as const;\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 shadowConfig = useMemo(() => {\n const shadow = IOS_SHADOW[elevationLevel];\n const { r, g, b, a } = parseColorChannels(palette.elevationShadow[elevationLevel] ?? '');\n return {\n offsetX: shadow.shadowOffset.width,\n offsetY: shadow.shadowOffset.height,\n blurRadius: shadow.shadowRadius,\n maxAlpha: a * shadow.shadowOpacity,\n r,\n g,\n b,\n };\n }, [elevationLevel, palette]);\n\n const backgroundColor = useMemo(() => {\n if (!color) {\n return elevationLevel ? palette.background.base : undefined;\n }\n return resolveViewColor(palette, color);\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 alpha = shadowConfig.maxAlpha * shadowProgress.value;\n\n return {\n boxShadow: [\n {\n offsetX: shadowConfig.offsetX,\n offsetY: shadowConfig.offsetY,\n blurRadius: shadowConfig.blurRadius,\n spreadDistance: 0,\n color: `rgba(${shadowConfig.r}, ${shadowConfig.g}, ${shadowConfig.b}, ${alpha})`,\n },\n ],\n };\n }, [shadowConfig]);\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 bgStyle = useMemo(\n () => (backgroundColor ? { backgroundColor } : undefined),\n [backgroundColor]\n );\n\n const baseStyle = useMemo(\n () => [style, bgStyle, staticStyle],\n [style, bgStyle, staticStyle]\n );\n\n const animatedStyleArray = useMemo(\n () => [style, bgStyle, staticStyle, animatedStyle],\n [style, bgStyle, staticStyle, 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,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TextProps } from 'react-native';
|
|
3
|
-
|
|
4
|
-
declare function TextAtom({ children, ...props }: TextAtomProps): React.JSX.Element;
|
|
3
|
+
declare function TextAtom({ children, ...props }: TextProps): React.JSX.Element;
|
|
5
4
|
export default TextAtom;
|
|
6
5
|
//# sourceMappingURL=TextAtom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAtom.d.ts","sourceRoot":"","sources":["../../../src/ui/atoms/TextAtom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/C,
|
|
1
|
+
{"version":3,"file":"TextAtom.d.ts","sourceRoot":"","sources":["../../../src/ui/atoms/TextAtom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/C,iBAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,qBAMlD;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAtom.js","sourceRoot":"","sources":["../../../src/ui/atoms/TextAtom.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"TextAtom.js","sourceRoot":"","sources":["../../../src/ui/atoms/TextAtom.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAE/C,SAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAa;IACjD,OAAO,CACL,KAAC,IAAI,OAAK,KAAK,YACZ,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC;AAED,eAAe,QAAQ,CAAC","sourcesContent":["import React from 'react';\nimport { Text, TextProps } from 'react-native';\n\nfunction TextAtom({ children, ...props }: TextProps) {\n return (\n <Text {...props}>\n {children}\n </Text>\n );\n}\n\nexport default TextAtom;\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
|
-
|
|
4
|
-
declare function ViewAtom({ children, ...props }: ViewAtomProps): React.JSX.Element;
|
|
3
|
+
declare function ViewAtom({ children, ...props }: ViewProps): React.JSX.Element;
|
|
5
4
|
export default ViewAtom;
|
|
6
5
|
//# sourceMappingURL=ViewAtom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewAtom.d.ts","sourceRoot":"","sources":["../../../src/ui/atoms/ViewAtom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/C,
|
|
1
|
+
{"version":3,"file":"ViewAtom.d.ts","sourceRoot":"","sources":["../../../src/ui/atoms/ViewAtom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/C,iBAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,qBAMlD;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewAtom.js","sourceRoot":"","sources":["../../../src/ui/atoms/ViewAtom.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ViewAtom.js","sourceRoot":"","sources":["../../../src/ui/atoms/ViewAtom.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAE/C,SAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAa;IACjD,OAAO,CACL,KAAC,IAAI,OAAK,KAAK,YACZ,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC;AAED,eAAe,QAAQ,CAAC","sourcesContent":["import React from 'react';\nimport { View, ViewProps } from 'react-native';\n\nfunction ViewAtom({ children, ...props }: ViewProps) {\n return (\n <View {...props}>\n {children}\n </View>\n );\n}\n\nexport default ViewAtom;\n"]}
|