@chem-po/react-native 0.0.29 → 0.0.30

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 (122) hide show
  1. package/lib/commonjs/components/button/Toggle.js +19 -16
  2. package/lib/commonjs/components/button/Toggle.js.map +1 -1
  3. package/lib/commonjs/components/form/input/Editable.js +52 -73
  4. package/lib/commonjs/components/form/input/Editable.js.map +1 -1
  5. package/lib/commonjs/components/form/input/StandaloneInput.js.map +1 -1
  6. package/lib/commonjs/components/form/input/datetime/index.js +7 -2
  7. package/lib/commonjs/components/form/input/datetime/index.js.map +1 -1
  8. package/lib/commonjs/components/form/input/multipleSelect/index.js +7 -2
  9. package/lib/commonjs/components/form/input/multipleSelect/index.js.map +1 -1
  10. package/lib/commonjs/components/form/input/select/index.js +1 -1
  11. package/lib/commonjs/components/form/input/select/index.js.map +1 -1
  12. package/lib/commonjs/components/form/input/text/index.js +3 -2
  13. package/lib/commonjs/components/form/input/text/index.js.map +1 -1
  14. package/lib/commonjs/components/form/input/text/textarea.js +1 -12
  15. package/lib/commonjs/components/form/input/text/textarea.js.map +1 -1
  16. package/lib/commonjs/components/form/input/text/useWebAutoResize.js +5 -6
  17. package/lib/commonjs/components/form/input/text/useWebAutoResize.js.map +1 -1
  18. package/lib/commonjs/components/form/view/file.js +21 -12
  19. package/lib/commonjs/components/form/view/file.js.map +1 -1
  20. package/lib/commonjs/components/form/view/index.js +29 -18
  21. package/lib/commonjs/components/form/view/index.js.map +1 -1
  22. package/lib/commonjs/components/form/view/multipleSelect.js +17 -13
  23. package/lib/commonjs/components/form/view/multipleSelect.js.map +1 -1
  24. package/lib/commonjs/components/form/view/select.js +14 -7
  25. package/lib/commonjs/components/form/view/select.js.map +1 -1
  26. package/lib/commonjs/components/form/view/styles.js +0 -3
  27. package/lib/commonjs/components/form/view/styles.js.map +1 -1
  28. package/lib/commonjs/components/layout/CollapseHorizontal.js +72 -0
  29. package/lib/commonjs/components/layout/CollapseHorizontal.js.map +1 -0
  30. package/lib/commonjs/contexts/root.js +6 -6
  31. package/lib/commonjs/contexts/root.js.map +1 -1
  32. package/lib/commonjs/index.js +11 -0
  33. package/lib/commonjs/index.js.map +1 -1
  34. package/lib/commonjs/types/forms.js +6 -0
  35. package/lib/commonjs/types/forms.js.map +1 -0
  36. package/lib/commonjs/types/index.js +17 -0
  37. package/lib/commonjs/types/index.js.map +1 -0
  38. package/lib/module/components/button/Toggle.js +21 -18
  39. package/lib/module/components/button/Toggle.js.map +1 -1
  40. package/lib/module/components/form/input/Editable.js +52 -73
  41. package/lib/module/components/form/input/Editable.js.map +1 -1
  42. package/lib/module/components/form/input/StandaloneInput.js.map +1 -1
  43. package/lib/module/components/form/input/datetime/index.js +7 -2
  44. package/lib/module/components/form/input/datetime/index.js.map +1 -1
  45. package/lib/module/components/form/input/multipleSelect/index.js +7 -2
  46. package/lib/module/components/form/input/multipleSelect/index.js.map +1 -1
  47. package/lib/module/components/form/input/select/index.js +1 -1
  48. package/lib/module/components/form/input/select/index.js.map +1 -1
  49. package/lib/module/components/form/input/text/index.js +3 -2
  50. package/lib/module/components/form/input/text/index.js.map +1 -1
  51. package/lib/module/components/form/input/text/textarea.js +2 -13
  52. package/lib/module/components/form/input/text/textarea.js.map +1 -1
  53. package/lib/module/components/form/input/text/useWebAutoResize.js +5 -6
  54. package/lib/module/components/form/input/text/useWebAutoResize.js.map +1 -1
  55. package/lib/module/components/form/view/file.js +15 -6
  56. package/lib/module/components/form/view/file.js.map +1 -1
  57. package/lib/module/components/form/view/index.js +19 -8
  58. package/lib/module/components/form/view/index.js.map +1 -1
  59. package/lib/module/components/form/view/multipleSelect.js +18 -14
  60. package/lib/module/components/form/view/multipleSelect.js.map +1 -1
  61. package/lib/module/components/form/view/select.js +14 -7
  62. package/lib/module/components/form/view/select.js.map +1 -1
  63. package/lib/module/components/form/view/styles.js +0 -3
  64. package/lib/module/components/form/view/styles.js.map +1 -1
  65. package/lib/module/components/layout/CollapseHorizontal.js +64 -0
  66. package/lib/module/components/layout/CollapseHorizontal.js.map +1 -0
  67. package/lib/module/contexts/root.js +6 -6
  68. package/lib/module/contexts/root.js.map +1 -1
  69. package/lib/module/index.js +1 -0
  70. package/lib/module/index.js.map +1 -1
  71. package/lib/module/types/forms.js +2 -0
  72. package/lib/module/types/forms.js.map +1 -0
  73. package/lib/module/types/index.js +2 -0
  74. package/lib/module/types/index.js.map +1 -0
  75. package/lib/typescript/components/button/Toggle.d.ts +5 -2
  76. package/lib/typescript/components/button/Toggle.d.ts.map +1 -1
  77. package/lib/typescript/components/form/input/Editable.d.ts +2 -2
  78. package/lib/typescript/components/form/input/Editable.d.ts.map +1 -1
  79. package/lib/typescript/components/form/input/StandaloneInput.d.ts +5 -14
  80. package/lib/typescript/components/form/input/StandaloneInput.d.ts.map +1 -1
  81. package/lib/typescript/components/form/input/datetime/index.d.ts.map +1 -1
  82. package/lib/typescript/components/form/input/multipleSelect/index.d.ts.map +1 -1
  83. package/lib/typescript/components/form/input/text/index.d.ts.map +1 -1
  84. package/lib/typescript/components/form/input/text/textarea.d.ts +2 -2
  85. package/lib/typescript/components/form/input/text/textarea.d.ts.map +1 -1
  86. package/lib/typescript/components/form/input/text/useWebAutoResize.d.ts.map +1 -1
  87. package/lib/typescript/components/form/view/file.d.ts.map +1 -1
  88. package/lib/typescript/components/form/view/index.d.ts +3 -2
  89. package/lib/typescript/components/form/view/index.d.ts.map +1 -1
  90. package/lib/typescript/components/form/view/multipleSelect.d.ts.map +1 -1
  91. package/lib/typescript/components/form/view/select.d.ts +2 -1
  92. package/lib/typescript/components/form/view/select.d.ts.map +1 -1
  93. package/lib/typescript/components/form/view/styles.d.ts +0 -3
  94. package/lib/typescript/components/form/view/styles.d.ts.map +1 -1
  95. package/lib/typescript/components/layout/CollapseHorizontal.d.ts +9 -0
  96. package/lib/typescript/components/layout/CollapseHorizontal.d.ts.map +1 -0
  97. package/lib/typescript/index.d.ts +1 -0
  98. package/lib/typescript/index.d.ts.map +1 -1
  99. package/lib/typescript/types/forms.d.ts +5 -0
  100. package/lib/typescript/types/forms.d.ts.map +1 -0
  101. package/lib/typescript/types/index.d.ts +2 -0
  102. package/lib/typescript/types/index.d.ts.map +1 -0
  103. package/package.json +3 -3
  104. package/src/components/button/Toggle.tsx +21 -17
  105. package/src/components/form/input/Editable.tsx +47 -86
  106. package/src/components/form/input/StandaloneInput.tsx +4 -13
  107. package/src/components/form/input/datetime/index.tsx +7 -2
  108. package/src/components/form/input/multipleSelect/index.tsx +13 -2
  109. package/src/components/form/input/select/index.tsx +1 -1
  110. package/src/components/form/input/text/index.tsx +3 -2
  111. package/src/components/form/input/text/textarea.tsx +3 -15
  112. package/src/components/form/input/text/useWebAutoResize.tsx +5 -6
  113. package/src/components/form/view/file.tsx +9 -5
  114. package/src/components/form/view/index.tsx +26 -7
  115. package/src/components/form/view/multipleSelect.tsx +11 -9
  116. package/src/components/form/view/select.tsx +7 -2
  117. package/src/components/form/view/styles.ts +0 -3
  118. package/src/components/layout/CollapseHorizontal.tsx +82 -0
  119. package/src/contexts/root.tsx +6 -6
  120. package/src/index.ts +1 -0
  121. package/src/types/forms.ts +14 -0
  122. package/src/types/index.ts +1 -0
@@ -9,7 +9,4 @@ export const inputViewStyles = StyleSheet.create({
9
9
  value: {
10
10
  opacity: 1,
11
11
  },
12
- valueEmpty: {
13
- opacity: 0.6,
14
- },
15
12
  })
@@ -0,0 +1,82 @@
1
+ import React, { useCallback } from 'react'
2
+ import { LayoutChangeEvent, StyleProp, View, ViewStyle } from 'react-native'
3
+ import Animated, {
4
+ useAnimatedStyle,
5
+ useSharedValue,
6
+ withSequence,
7
+ withTiming,
8
+ } from 'react-native-reanimated'
9
+
10
+ export const CollapseHorizontal = ({
11
+ children,
12
+ in: isIn,
13
+ duration = 200,
14
+ style,
15
+ }: {
16
+ children: React.ReactNode
17
+ in: boolean
18
+ duration?: number
19
+ style?: StyleProp<ViewStyle>
20
+ }) => {
21
+ const contentWidth = useSharedValue(0)
22
+ const width = useSharedValue(0)
23
+ const opacity = useSharedValue(0)
24
+
25
+ const handleLayout = useCallback(
26
+ (event: LayoutChangeEvent) => {
27
+ contentWidth.value = event.nativeEvent.layout.width
28
+ // Initialize width if component is initially visible
29
+ if (isIn && width.value === 0) {
30
+ width.value = contentWidth.value
31
+ opacity.value = 1
32
+ }
33
+ },
34
+ [isIn, contentWidth, width, opacity],
35
+ )
36
+
37
+ React.useEffect(() => {
38
+ if (isIn) {
39
+ // Fade in: width first, then opacity
40
+ width.value = withTiming(contentWidth.value, {
41
+ duration,
42
+ })
43
+ opacity.value = withSequence(
44
+ withTiming(0, { duration: 0 }), // Reset opacity
45
+ withTiming(1, {
46
+ duration,
47
+ }),
48
+ )
49
+ } else {
50
+ // Fade out: opacity first, then width
51
+ opacity.value = withTiming(0, {
52
+ duration,
53
+ })
54
+ width.value = withSequence(
55
+ withTiming(width.value, { duration: 0 }), // Ensure we start from current width
56
+ withTiming(0, {
57
+ duration,
58
+ }),
59
+ )
60
+ }
61
+ }, [isIn, contentWidth.value, duration, width, opacity])
62
+
63
+ const animatedStyle = useAnimatedStyle(() => ({
64
+ width: width.value,
65
+ opacity: opacity.value,
66
+ }))
67
+
68
+ return (
69
+ <Animated.View
70
+ style={[
71
+ {
72
+ overflow: 'hidden',
73
+ pointerEvents: isIn ? 'auto' : 'none',
74
+ },
75
+ animatedStyle,
76
+ ]}>
77
+ <View style={[{ position: 'absolute' }, style]} onLayout={handleLayout}>
78
+ {children}
79
+ </View>
80
+ </Animated.View>
81
+ )
82
+ }
@@ -28,14 +28,14 @@ const createPaperTheme = (
28
28
  return {
29
29
  dark: colorMode === 'dark',
30
30
  colors: {
31
- primary: colors.accent[200],
31
+ primary: colors.accent[300],
32
32
  onPrimary: colors.text[900],
33
- primaryContainer: colors.accent[500],
34
- onPrimaryContainer: colors.text[300],
33
+ primaryContainer: colors.accent[800],
34
+ onPrimaryContainer: colors.text[150],
35
35
 
36
36
  secondary: colors.background[150],
37
37
  onSecondary: colors.text[100],
38
- secondaryContainer: colors.background[50],
38
+ secondaryContainer: colors.accent[950],
39
39
  onSecondaryContainer: colors.text[150],
40
40
 
41
41
  tertiary: colors.accent[600],
@@ -53,7 +53,7 @@ const createPaperTheme = (
53
53
  surface: colors.background[100],
54
54
  onSurface: colors.text[100],
55
55
  surfaceVariant: colors.background[200],
56
- onSurfaceVariant: colors.text[250],
56
+ onSurfaceVariant: colors.text[300],
57
57
  outline: colors.text[500],
58
58
  outlineVariant: colors.accent[300],
59
59
 
@@ -92,7 +92,7 @@ const createPaperTheme = (
92
92
  ...fonts?.bodyMedium,
93
93
  },
94
94
  bodySmall: {
95
- fontSize: 15,
95
+ fontSize: 16,
96
96
  ...fonts?.bodySmall,
97
97
  },
98
98
  },
package/src/index.ts CHANGED
@@ -3,3 +3,4 @@ export * from './constants'
3
3
  export * from './contexts'
4
4
  export * from './hooks'
5
5
  export * from './store'
6
+ export * from './types'
@@ -0,0 +1,14 @@
1
+ import { BaseCustomInput, BaseCustomInputProps } from '@chem-po/react'
2
+ import { TextStyle, ViewStyle } from 'react-native'
3
+
4
+ export type CustomInput<Value, InputStyle = TextStyle> = BaseCustomInput<
5
+ Value,
6
+ ViewStyle,
7
+ InputStyle
8
+ >
9
+
10
+ export type CustomInputProps<Value, InputStyle = TextStyle> = BaseCustomInputProps<
11
+ Value,
12
+ ViewStyle,
13
+ InputStyle
14
+ >
@@ -0,0 +1 @@
1
+ export * from './forms'