@umituz/react-native-design-system 2.8.34 → 2.8.36
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/package.json +1 -1
- package/src/atoms/AtomicInput.tsx +3 -1
- package/src/atoms/input/types.ts +3 -1
- package/src/exports/molecules.ts +1 -0
- package/src/molecules/alerts/AlertBanner.tsx +15 -5
- package/src/molecules/alerts/AlertToast.tsx +19 -4
- package/src/molecules/filter-group/FilterGroup.tsx +1 -1
- package/src/molecules/navigation/types.ts +1 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.36",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive, safe area, exception, infinite scroll, UUID, image, timezone, offline, and onboarding utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -52,6 +52,7 @@ export const AtomicInput = React.forwardRef<TextInput, AtomicInputProps>(({
|
|
|
52
52
|
onFocus,
|
|
53
53
|
multiline = false,
|
|
54
54
|
numberOfLines,
|
|
55
|
+
textContentType,
|
|
55
56
|
}, ref) => {
|
|
56
57
|
const tokens = useAppDesignTokens();
|
|
57
58
|
|
|
@@ -114,7 +115,7 @@ export const AtomicInput = React.forwardRef<TextInput, AtomicInputProps>(({
|
|
|
114
115
|
fontSize: sizeConfig.fontSize,
|
|
115
116
|
lineHeight: (sizeConfig.fontSize || 16) * 1.2,
|
|
116
117
|
color: textColor,
|
|
117
|
-
paddingVertical:
|
|
118
|
+
paddingVertical: 4,
|
|
118
119
|
},
|
|
119
120
|
leadingIcon ? { paddingLeft: sizeConfig.iconSize + 8 } : undefined,
|
|
120
121
|
(trailingIcon || showPasswordToggle) ? { paddingRight: sizeConfig.iconSize + 8 } : undefined,
|
|
@@ -153,6 +154,7 @@ export const AtomicInput = React.forwardRef<TextInput, AtomicInputProps>(({
|
|
|
153
154
|
editable={!isDisabled}
|
|
154
155
|
multiline={multiline}
|
|
155
156
|
numberOfLines={numberOfLines}
|
|
157
|
+
textContentType={textContentType}
|
|
156
158
|
style={textInputStyle}
|
|
157
159
|
onBlur={() => {
|
|
158
160
|
setIsFocused(false);
|
package/src/atoms/input/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StyleProp } from 'react-native';
|
|
1
|
+
import type { StyleProp, TextInputProps } from 'react-native';
|
|
2
2
|
import type { TextStyle, ViewStyle } from 'react-native';
|
|
3
3
|
import type { IconName } from '../AtomicIcon';
|
|
4
4
|
|
|
@@ -67,6 +67,8 @@ export interface AtomicInputProps {
|
|
|
67
67
|
multiline?: boolean;
|
|
68
68
|
/** Number of lines for multiline input */
|
|
69
69
|
numberOfLines?: number;
|
|
70
|
+
/** iOS text content type for AutoFill */
|
|
71
|
+
textContentType?: TextInputProps['textContentType'];
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
export type { AtomicInputProps as InputProps };
|
package/src/exports/molecules.ts
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Displays a banner-style alert at the top or bottom of the screen.
|
|
5
5
|
* Full-width notification bar for important messages.
|
|
6
|
+
* Auto-dismisses after duration (default 3 seconds).
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
|
-
import React from 'react';
|
|
9
|
+
import React, { useEffect } from 'react';
|
|
9
10
|
import { StyleSheet, View, Pressable } from 'react-native';
|
|
10
11
|
import { useSafeAreaInsets } from '../../safe-area';
|
|
11
12
|
import { AtomicText, AtomicIcon } from '../../atoms';
|
|
@@ -13,6 +14,8 @@ import { useAppDesignTokens } from '../../theme';
|
|
|
13
14
|
import { Alert, AlertType, AlertPosition } from './AlertTypes';
|
|
14
15
|
import { useAlertStore } from './AlertStore';
|
|
15
16
|
|
|
17
|
+
const DEFAULT_DURATION = 3000;
|
|
18
|
+
|
|
16
19
|
interface AlertBannerProps {
|
|
17
20
|
alert: Alert;
|
|
18
21
|
}
|
|
@@ -23,12 +26,19 @@ export function AlertBanner({ alert }: AlertBannerProps) {
|
|
|
23
26
|
const tokens = useAppDesignTokens();
|
|
24
27
|
|
|
25
28
|
const handleDismiss = () => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
alert.onDismiss?.();
|
|
29
|
-
}
|
|
29
|
+
dismissAlert(alert.id);
|
|
30
|
+
alert.onDismiss?.();
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
// Auto-dismiss after duration
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const duration = alert.duration ?? DEFAULT_DURATION;
|
|
36
|
+
if (duration <= 0) return;
|
|
37
|
+
|
|
38
|
+
const timer = setTimeout(handleDismiss, duration);
|
|
39
|
+
return () => clearTimeout(timer);
|
|
40
|
+
}, [alert.id, alert.duration]);
|
|
41
|
+
|
|
32
42
|
const getBackgroundColor = (type: AlertType): string => {
|
|
33
43
|
switch (type) {
|
|
34
44
|
case AlertType.SUCCESS:
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
* Floats on top of content.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import React from 'react';
|
|
8
|
+
import React, { useEffect } from 'react';
|
|
9
9
|
import { StyleSheet, View, Pressable, StyleProp, ViewStyle } from 'react-native';
|
|
10
10
|
import { AtomicText, AtomicIcon } from '../../atoms';
|
|
11
11
|
import { useAppDesignTokens } from '../../theme';
|
|
12
12
|
import { Alert, AlertType } from './AlertTypes';
|
|
13
13
|
import { useAlertStore } from './AlertStore';
|
|
14
14
|
|
|
15
|
+
const DEFAULT_DURATION = 3000;
|
|
16
|
+
|
|
15
17
|
interface AlertToastProps {
|
|
16
18
|
alert: Alert;
|
|
17
19
|
}
|
|
@@ -20,13 +22,26 @@ export function AlertToast({ alert }: AlertToastProps) {
|
|
|
20
22
|
const dismissAlert = useAlertStore((state: { dismissAlert: (id: string) => void }) => state.dismissAlert);
|
|
21
23
|
const tokens = useAppDesignTokens();
|
|
22
24
|
|
|
25
|
+
const dismiss = () => {
|
|
26
|
+
dismissAlert(alert.id);
|
|
27
|
+
alert.onDismiss?.();
|
|
28
|
+
};
|
|
29
|
+
|
|
23
30
|
const handleDismiss = () => {
|
|
24
31
|
if (alert.dismissible) {
|
|
25
|
-
|
|
26
|
-
alert.onDismiss?.();
|
|
32
|
+
dismiss();
|
|
27
33
|
}
|
|
28
34
|
};
|
|
29
35
|
|
|
36
|
+
// Auto-dismiss after duration
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const duration = alert.duration ?? DEFAULT_DURATION;
|
|
39
|
+
if (duration <= 0) return;
|
|
40
|
+
|
|
41
|
+
const timer = setTimeout(dismiss, duration);
|
|
42
|
+
return () => clearTimeout(timer);
|
|
43
|
+
}, [alert.id, alert.duration]);
|
|
44
|
+
|
|
30
45
|
const getBackgroundColor = (type: AlertType): string => {
|
|
31
46
|
const colors = {
|
|
32
47
|
[AlertType.SUCCESS]: tokens.colors.success,
|
|
@@ -125,7 +140,7 @@ export function AlertToast({ alert }: AlertToastProps) {
|
|
|
125
140
|
onPress={async () => {
|
|
126
141
|
await action.onPress();
|
|
127
142
|
if (action.closeOnPress ?? true) {
|
|
128
|
-
|
|
143
|
+
dismiss();
|
|
129
144
|
}
|
|
130
145
|
}}
|
|
131
146
|
style={[
|
|
@@ -3,10 +3,7 @@ import type {
|
|
|
3
3
|
BottomTabNavigationOptions,
|
|
4
4
|
BottomTabScreenProps,
|
|
5
5
|
} from "@react-navigation/bottom-tabs";
|
|
6
|
-
import type {
|
|
7
|
-
StackNavigationOptions,
|
|
8
|
-
StackScreenProps,
|
|
9
|
-
} from "@react-navigation/stack";
|
|
6
|
+
import type { StackNavigationOptions } from "@react-navigation/stack";
|
|
10
7
|
import type { IconName } from "../../atoms/AtomicIcon";
|
|
11
8
|
|
|
12
9
|
export type NavigationParams = Record<string, unknown>;
|