@0610studio/zs-ui 0.18.0 → 0.19.0

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 (164) hide show
  1. package/build/ZsUiModule.d.ts.map +1 -1
  2. package/build/ZsUiModule.js +0 -2
  3. package/build/ZsUiModule.js.map +1 -1
  4. package/build/assets/SvgExclamation.d.ts.map +1 -1
  5. package/build/assets/SvgExclamation.js.map +1 -1
  6. package/build/assets/SvgTooltipTail.d.ts +7 -0
  7. package/build/assets/SvgTooltipTail.d.ts.map +1 -0
  8. package/build/assets/SvgTooltipTail.js +7 -0
  9. package/build/assets/SvgTooltipTail.js.map +1 -0
  10. package/build/context/OverlayContext.d.ts.map +1 -1
  11. package/build/context/OverlayContext.js +11 -14
  12. package/build/context/OverlayContext.js.map +1 -1
  13. package/build/context/ThemeContext.d.ts +9 -0
  14. package/build/context/ThemeContext.d.ts.map +1 -1
  15. package/build/context/ThemeContext.js +24 -15
  16. package/build/context/ThemeContext.js.map +1 -1
  17. package/build/index.d.ts +16 -3
  18. package/build/index.d.ts.map +1 -1
  19. package/build/index.js +7 -7
  20. package/build/index.js.map +1 -1
  21. package/build/model/globalOverlay.d.ts +0 -8
  22. package/build/model/globalOverlay.d.ts.map +1 -1
  23. package/build/model/globalOverlay.js +0 -9
  24. package/build/model/globalOverlay.js.map +1 -1
  25. package/build/model/types.d.ts +2 -1
  26. package/build/model/types.d.ts.map +1 -1
  27. package/build/model/types.js.map +1 -1
  28. package/build/model/useFoldingState.d.ts.map +1 -1
  29. package/build/model/useFoldingState.js +51 -32
  30. package/build/model/useFoldingState.js.map +1 -1
  31. package/build/model/useKeyboard.d.ts.map +1 -1
  32. package/build/model/useKeyboard.js +8 -4
  33. package/build/model/useKeyboard.js.map +1 -1
  34. package/build/model/utils.d.ts +1 -1
  35. package/build/model/utils.d.ts.map +1 -1
  36. package/build/model/utils.js +2 -1
  37. package/build/model/utils.js.map +1 -1
  38. package/build/overlay/AlertOverlay/index.d.ts +1 -2
  39. package/build/overlay/AlertOverlay/index.d.ts.map +1 -1
  40. package/build/overlay/AlertOverlay/index.js +13 -11
  41. package/build/overlay/AlertOverlay/index.js.map +1 -1
  42. package/build/overlay/BottomSheetOverlay/index.d.ts.map +1 -1
  43. package/build/overlay/BottomSheetOverlay/index.js +22 -11
  44. package/build/overlay/BottomSheetOverlay/index.js.map +1 -1
  45. package/build/overlay/LoadingNotify/index.d.ts +2 -2
  46. package/build/overlay/LoadingNotify/index.d.ts.map +1 -1
  47. package/build/overlay/LoadingNotify/index.js +2 -2
  48. package/build/overlay/LoadingNotify/index.js.map +1 -1
  49. package/build/overlay/Modality/index.d.ts.map +1 -1
  50. package/build/overlay/Modality/index.js +6 -12
  51. package/build/overlay/Modality/index.js.map +1 -1
  52. package/build/overlay/PopOver/PopOverMenu.d.ts.map +1 -1
  53. package/build/overlay/PopOver/PopOverMenu.js +7 -8
  54. package/build/overlay/PopOver/PopOverMenu.js.map +1 -1
  55. package/build/overlay/SnackbarNotify/index.d.ts +3 -3
  56. package/build/overlay/SnackbarNotify/index.d.ts.map +1 -1
  57. package/build/overlay/SnackbarNotify/index.js +5 -4
  58. package/build/overlay/SnackbarNotify/index.js.map +1 -1
  59. package/build/overlay/SnackbarNotify/ui/SnackbarItem.d.ts +4 -4
  60. package/build/overlay/SnackbarNotify/ui/SnackbarItem.d.ts.map +1 -1
  61. package/build/overlay/SnackbarNotify/ui/SnackbarItem.js +9 -9
  62. package/build/overlay/SnackbarNotify/ui/SnackbarItem.js.map +1 -1
  63. package/build/overlay/ZSPortal/index.d.ts.map +1 -1
  64. package/build/overlay/ZSPortal/index.js +15 -4
  65. package/build/overlay/ZSPortal/index.js.map +1 -1
  66. package/build/overlay/ui/ModalBackground.js.map +1 -1
  67. package/build/theme/elevation.d.ts +94 -10
  68. package/build/theme/elevation.d.ts.map +1 -1
  69. package/build/theme/elevation.js +39 -35
  70. package/build/theme/elevation.js.map +1 -1
  71. package/build/theme/intentColors.d.ts +9 -0
  72. package/build/theme/intentColors.d.ts.map +1 -0
  73. package/build/theme/intentColors.js +30 -0
  74. package/build/theme/intentColors.js.map +1 -0
  75. package/build/theme/palette.d.ts +1 -5
  76. package/build/theme/palette.d.ts.map +1 -1
  77. package/build/theme/palette.js +3 -12
  78. package/build/theme/palette.js.map +1 -1
  79. package/build/theme/resolveColor.d.ts +4 -0
  80. package/build/theme/resolveColor.d.ts.map +1 -0
  81. package/build/theme/resolveColor.js +29 -0
  82. package/build/theme/resolveColor.js.map +1 -0
  83. package/build/theme/tokens.d.ts +35 -0
  84. package/build/theme/tokens.d.ts.map +1 -0
  85. package/build/theme/tokens.js +35 -0
  86. package/build/theme/tokens.js.map +1 -0
  87. package/build/theme/typography.d.ts.map +1 -1
  88. package/build/theme/typography.js +36 -72
  89. package/build/theme/typography.js.map +1 -1
  90. package/build/ui/ZSBlockButton/index.d.ts +4 -2
  91. package/build/ui/ZSBlockButton/index.d.ts.map +1 -1
  92. package/build/ui/ZSBlockButton/index.js +17 -80
  93. package/build/ui/ZSBlockButton/index.js.map +1 -1
  94. package/build/ui/ZSBorderBeam/index.d.ts +48 -0
  95. package/build/ui/ZSBorderBeam/index.d.ts.map +1 -0
  96. package/build/ui/ZSBorderBeam/index.js +135 -0
  97. package/build/ui/ZSBorderBeam/index.js.map +1 -0
  98. package/build/ui/ZSCheckBox/index.d.ts +18 -0
  99. package/build/ui/ZSCheckBox/index.d.ts.map +1 -0
  100. package/build/ui/ZSCheckBox/index.js +60 -0
  101. package/build/ui/ZSCheckBox/index.js.map +1 -0
  102. package/build/ui/ZSChip/index.d.ts +28 -0
  103. package/build/ui/ZSChip/index.d.ts.map +1 -0
  104. package/build/ui/ZSChip/index.js +76 -0
  105. package/build/ui/ZSChip/index.js.map +1 -0
  106. package/build/ui/ZSContainer/index.d.ts +19 -0
  107. package/build/ui/ZSContainer/index.d.ts.map +1 -1
  108. package/build/ui/ZSContainer/index.js +29 -15
  109. package/build/ui/ZSContainer/index.js.map +1 -1
  110. package/build/ui/ZSPressable/index.d.ts.map +1 -1
  111. package/build/ui/ZSPressable/index.js +9 -6
  112. package/build/ui/ZSPressable/index.js.map +1 -1
  113. package/build/ui/ZSRadioGroup/index.d.ts +4 -4
  114. package/build/ui/ZSRadioGroup/index.d.ts.map +1 -1
  115. package/build/ui/ZSRadioGroup/index.js +72 -52
  116. package/build/ui/ZSRadioGroup/index.js.map +1 -1
  117. package/build/ui/ZSSegmented/index.d.ts +26 -0
  118. package/build/ui/ZSSegmented/index.d.ts.map +1 -0
  119. package/build/ui/ZSSegmented/index.js +124 -0
  120. package/build/ui/ZSSegmented/index.js.map +1 -0
  121. package/build/ui/ZSSkeleton/SkiaShimmer.d.ts +18 -0
  122. package/build/ui/ZSSkeleton/SkiaShimmer.d.ts.map +1 -0
  123. package/build/ui/ZSSkeleton/SkiaShimmer.js +73 -0
  124. package/build/ui/ZSSkeleton/SkiaShimmer.js.map +1 -0
  125. package/build/ui/ZSSkeleton/index.d.ts +9 -3
  126. package/build/ui/ZSSkeleton/index.d.ts.map +1 -1
  127. package/build/ui/ZSSkeleton/index.js +13 -44
  128. package/build/ui/ZSSkeleton/index.js.map +1 -1
  129. package/build/ui/ZSSkeletonBox/index.d.ts +10 -3
  130. package/build/ui/ZSSkeletonBox/index.d.ts.map +1 -1
  131. package/build/ui/ZSSkeletonBox/index.js +9 -47
  132. package/build/ui/ZSSkeletonBox/index.js.map +1 -1
  133. package/build/ui/ZSSwitch/index.d.ts +4 -2
  134. package/build/ui/ZSSwitch/index.d.ts.map +1 -1
  135. package/build/ui/ZSSwitch/index.js +8 -6
  136. package/build/ui/ZSSwitch/index.js.map +1 -1
  137. package/build/ui/ZSText/index.d.ts +3 -2
  138. package/build/ui/ZSText/index.d.ts.map +1 -1
  139. package/build/ui/ZSText/index.js +5 -16
  140. package/build/ui/ZSText/index.js.map +1 -1
  141. package/build/ui/ZSTextField/index.d.ts.map +1 -1
  142. package/build/ui/ZSTextField/index.js +57 -40
  143. package/build/ui/ZSTextField/index.js.map +1 -1
  144. package/build/ui/ZSTextField/ui/ButtonClose.d.ts.map +1 -1
  145. package/build/ui/ZSTextField/ui/ButtonClose.js +4 -1
  146. package/build/ui/ZSTextField/ui/ButtonClose.js.map +1 -1
  147. package/build/ui/ZSTooltip/index.d.ts +38 -0
  148. package/build/ui/ZSTooltip/index.d.ts.map +1 -0
  149. package/build/ui/ZSTooltip/index.js +99 -0
  150. package/build/ui/ZSTooltip/index.js.map +1 -0
  151. package/build/ui/ZSView/index.d.ts +3 -2
  152. package/build/ui/ZSView/index.d.ts.map +1 -1
  153. package/build/ui/ZSView/index.js +7 -8
  154. package/build/ui/ZSView/index.js.map +1 -1
  155. package/build/ui/atoms/AnimatedWrapper.d.ts.map +1 -1
  156. package/build/ui/atoms/AnimatedWrapper.js +33 -40
  157. package/build/ui/atoms/AnimatedWrapper.js.map +1 -1
  158. package/build/ui/atoms/TextAtom.d.ts +1 -2
  159. package/build/ui/atoms/TextAtom.d.ts.map +1 -1
  160. package/build/ui/atoms/TextAtom.js.map +1 -1
  161. package/build/ui/atoms/ViewAtom.d.ts +1 -2
  162. package/build/ui/atoms/ViewAtom.d.ts.map +1 -1
  163. package/build/ui/atoms/ViewAtom.js.map +1 -1
  164. package/package.json +6 -1
@@ -1,41 +1,33 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { useMemo } from 'react';
3
- import { View, Platform } from 'react-native';
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 { IOS_SHADOW } from '../../theme/elevation';
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 staticConfig = useMemo(() => ({
17
- isIOS: IS_IOS,
18
- maxShadowOpacity: IS_IOS ? (IOS_SHADOW[elevationLevel]?.shadowOpacity ?? 0) : 0,
19
- maxElevation: IS_IOS ? 0 : elevationLevel,
20
- }), [elevationLevel]);
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
- const [c01, c02] = color.split('.');
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 shadowValue = shadowProgress.value;
50
- if (staticConfig.isIOS) {
51
- return { shadowOpacity: shadowValue * staticConfig.maxShadowOpacity };
52
- }
53
- return { elevation: shadowValue * staticConfig.maxElevation };
54
- }, [staticConfig]);
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 baseStyle = [
65
- style,
66
- backgroundColor && { backgroundColor },
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,QAAQ,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,QAAQ,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,EAAE,UAA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AG,YAAY,CAAC,gBAAgB,EAAE,CAAC;QACxE,CAAC;QACD,OAAO,EAAE,SAAS,EAAE,WAAW,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC;IAChE,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACpC,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,EAAE;YAChE,SAAS,CAAC;YACV,IAAI,QAAQ,EAAE,CAAC;gBACb,iBAAiB,CAAC,KAAK,GAAG,IAAI,CAAC;YACjC,CAAC;QACH,CAAC,CAAC;QACF,OAAO,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,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, 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) : 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"]}
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,QA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AAO,EAAE,WAAW,CAAC,EACnC,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,CAC9B,CAAC;IAEF,MAAM,kBAAkB,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
- type TextAtomProps = TextProps & {};
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,KAAK,aAAa,GAAG,SAAS,GAAG,EAChC,CAAC;AAEF,iBAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,qBAMtD;AAED,eAAe,QAAQ,CAAC"}
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;AAK/C,SAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiB;IACrD,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\ntype TextAtomProps = TextProps & {\n};\n\nfunction TextAtom({ children, ...props }: TextAtomProps) {\n return (\n <Text {...props}>\n {children}\n </Text>\n );\n}\n\nexport default TextAtom;\n"]}
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
- type ViewAtomProps = ViewProps & {};
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,KAAK,aAAa,GAAG,SAAS,GAAG,EAChC,CAAC;AAEF,iBAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,qBAMtD;AAED,eAAe,QAAQ,CAAC"}
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;AAK/C,SAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAiB;IACrD,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\ntype ViewAtomProps = ViewProps & {\n};\n\nfunction ViewAtom({ children, ...props }: ViewAtomProps) {\n return (\n <View {...props}>\n {children}\n </View>\n );\n}\n\nexport default ViewAtom;\n"]}
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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0610studio/zs-ui",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "private": false,
5
5
  "description": "EXPO ZS-UI",
6
6
  "type": "commonjs",
@@ -42,6 +42,7 @@
42
42
  "homepage": "https://github.com/0610studio/zs-ui",
43
43
  "devDependencies": {
44
44
  "@babel/core": "^7.20.0",
45
+ "@shopify/react-native-skia": "2.6.6",
45
46
  "@babel/plugin-transform-modules-commonjs": "^7.29.7",
46
47
  "@babel/preset-react": "^7.29.7",
47
48
  "@babel/preset-typescript": "^7.29.7",
@@ -75,6 +76,7 @@
75
76
  },
76
77
  "peerDependencies": {
77
78
  "@react-native-async-storage/async-storage": "*",
79
+ "@shopify/react-native-skia": ">=2.0.0",
78
80
  "expo": ">=56.0.0",
79
81
  "expo-navigation-bar": ">=56.0.0",
80
82
  "expo-router": "*",
@@ -89,6 +91,9 @@
89
91
  "@react-native-async-storage/async-storage": {
90
92
  "optional": false
91
93
  },
94
+ "@shopify/react-native-skia": {
95
+ "optional": false
96
+ },
92
97
  "expo-navigation-bar": {
93
98
  "optional": false
94
99
  },