@umituz/react-native-design-system 2.6.76 → 2.6.78

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-design-system",
3
- "version": "2.6.76",
3
+ "version": "2.6.78",
4
4
  "description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive and safe area utilities",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -13,32 +13,15 @@ import { useAppDesignTokens } from '../theme';
13
13
  import {
14
14
  type IconSize as BaseIconSize,
15
15
  type IconName,
16
+ type IconColor,
16
17
  } from "./AtomicIcon.types";
17
18
 
18
19
  // Re-export IconSize for convenience
19
20
  export type IconSize = BaseIconSize;
20
- export type { IconName };
21
+ export type { IconName, IconColor };
21
22
 
22
23
  const FALLBACK_ICON = "help-circle-outline";
23
24
 
24
- // Semantic color names that map to theme tokens
25
- export type IconColor =
26
- | "primary"
27
- | "secondary"
28
- | "success"
29
- | "warning"
30
- | "error"
31
- | "info"
32
- | "onSurface"
33
- | "surfaceVariant"
34
- | "onPrimary"
35
- | "onSecondary"
36
- | "textInverse"
37
- | "textPrimary"
38
- | "textSecondary"
39
- | "textTertiary"
40
- | "onSurfaceVariant";
41
-
42
25
  export interface AtomicIconProps {
43
26
  /** Icon name (Ionicons) */
44
27
  name?: IconName;
@@ -20,11 +20,32 @@ export type IconName = IoniconsName | string;
20
20
  */
21
21
  export type IconSizePreset = "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
22
22
 
23
+
23
24
  /**
24
25
  * Icon size - preset name or custom number in pixels
25
26
  */
26
27
  export type IconSize = IconSizePreset | number;
27
28
 
29
+ /**
30
+ * Semantic color names that map to theme tokens
31
+ */
32
+ export type IconColor =
33
+ | "primary"
34
+ | "secondary"
35
+ | "success"
36
+ | "warning"
37
+ | "error"
38
+ | "info"
39
+ | "onSurface"
40
+ | "surfaceVariant"
41
+ | "onPrimary"
42
+ | "onSecondary"
43
+ | "textInverse"
44
+ | "textPrimary"
45
+ | "textSecondary"
46
+ | "textTertiary"
47
+ | "onSurfaceVariant";
48
+
28
49
  /**
29
50
  * Icon size mapping to pixels
30
51
  */
@@ -28,48 +28,32 @@ export function AlertToast({ alert }: AlertToastProps) {
28
28
  };
29
29
 
30
30
  const getBackgroundColor = (type: AlertType): string => {
31
- switch (type) {
32
- case AlertType.SUCCESS:
33
- return tokens.colors.success;
34
- case AlertType.ERROR:
35
- return tokens.colors.error;
36
- case AlertType.WARNING:
37
- return tokens.colors.warning;
38
- case AlertType.INFO:
39
- return tokens.colors.info;
40
- default:
41
- return tokens.colors.backgroundSecondary;
42
- }
31
+ const colors = {
32
+ [AlertType.SUCCESS]: tokens.colors.success,
33
+ [AlertType.ERROR]: tokens.colors.error,
34
+ [AlertType.WARNING]: tokens.colors.warning,
35
+ [AlertType.INFO]: tokens.colors.info,
36
+ };
37
+ return colors[type] || tokens.colors.backgroundSecondary;
43
38
  };
44
39
 
45
- const getActionButtonStyle = (style: 'primary' | 'secondary' | 'destructive' | undefined): StyleProp<ViewStyle> => {
46
- switch (style) {
47
- case 'primary':
48
- return { backgroundColor: tokens.colors.backgroundPrimary };
49
- case 'secondary':
50
- return {
51
- backgroundColor: undefined,
52
- borderWidth: 1,
53
- borderColor: tokens.colors.textInverse,
54
- };
55
- case 'destructive':
56
- return { backgroundColor: tokens.colors.error };
57
- default:
58
- return { backgroundColor: tokens.colors.backgroundSecondary };
40
+ const getActionButtonStyle = (style?: 'primary' | 'secondary' | 'destructive'): StyleProp<ViewStyle> => {
41
+ if (style === 'secondary') {
42
+ return {
43
+ backgroundColor: undefined,
44
+ borderWidth: 1,
45
+ borderColor: tokens.colors.textInverse,
46
+ };
59
47
  }
48
+ const colors = {
49
+ primary: tokens.colors.backgroundPrimary,
50
+ destructive: tokens.colors.error,
51
+ };
52
+ return { backgroundColor: colors[style as keyof typeof colors] || tokens.colors.backgroundSecondary };
60
53
  };
61
54
 
62
- const getActionTextColor = (style: 'primary' | 'secondary' | 'destructive' | undefined): string => {
63
- switch (style) {
64
- case 'primary':
65
- return tokens.colors.textPrimary;
66
- case 'secondary':
67
- return tokens.colors.textInverse;
68
- case 'destructive':
69
- return tokens.colors.textInverse;
70
- default:
71
- return tokens.colors.textPrimary;
72
- }
55
+ const getActionTextColor = (style?: 'primary' | 'secondary' | 'destructive'): string => {
56
+ return style === 'primary' ? tokens.colors.textPrimary : tokens.colors.textInverse;
73
57
  };
74
58
 
75
59
  const backgroundColor = getBackgroundColor(alert.type);
@@ -46,33 +46,10 @@ export interface AvatarProps {
46
46
 
47
47
  /**
48
48
  * Avatar Component
49
- *
50
49
  * Displays user avatars with automatic fallback hierarchy:
51
50
  * 1. Image (if uri provided)
52
51
  * 2. Initials (if name provided)
53
52
  * 3. Icon (fallback)
54
- *
55
- * USAGE:
56
- * ```typescript
57
- * // Image avatar
58
- * <Avatar uri="https://..." name="Ümit Uz" size="lg" />
59
- *
60
- * // Initials avatar (no image)
61
- * <Avatar name="Ümit Uz" size="md" />
62
- *
63
- * // Icon avatar (fallback)
64
- * <Avatar size="sm" />
65
- *
66
- * // With status indicator
67
- * <Avatar
68
- * name="Ümit Uz"
69
- * showStatus
70
- * status="online"
71
- * />
72
- *
73
- * // Custom shape
74
- * <Avatar name="John Doe" shape="rounded" />
75
- * ```
76
53
  */
77
54
  export const Avatar: React.FC<AvatarProps> = ({
78
55
  uri,