@umituz/react-native-design-system 1.1.1 → 1.1.2
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": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Universal design system for React Native apps - Domain-Driven Design architecture with Material Design 3 components",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -26,8 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
import { create } from 'zustand';
|
|
29
|
-
|
|
30
|
-
export type ThemeMode = 'light' | 'dark';
|
|
29
|
+
import type { ThemeMode } from '../../presentation/tokens/core/ColorPalette';
|
|
31
30
|
|
|
32
31
|
interface GlobalThemeStore {
|
|
33
32
|
/** Current theme mode */
|
|
@@ -47,3 +46,6 @@ export const useDesignSystemTheme = create<GlobalThemeStore>((set) => ({
|
|
|
47
46
|
themeMode: 'light',
|
|
48
47
|
setThemeMode: (mode: ThemeMode) => set({ themeMode: mode }),
|
|
49
48
|
}));
|
|
49
|
+
|
|
50
|
+
// Re-export ThemeMode for backward compatibility
|
|
51
|
+
export type { ThemeMode };
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* Features:
|
|
8
8
|
* - Platform-specific native pickers (iOS wheel, Android dialog)
|
|
9
9
|
* - Consistent styling with design tokens
|
|
10
|
-
* - Locale-aware date/time formatting (
|
|
10
|
+
* - Locale-aware date/time formatting (native Date methods)
|
|
11
11
|
* - Timezone-aware (respects device timezone)
|
|
12
|
-
* - Automatic language integration (
|
|
12
|
+
* - Automatic language integration (native locale support)
|
|
13
13
|
* - Optional label and error states
|
|
14
14
|
* - Minimum and maximum date constraints
|
|
15
15
|
* - Disabled state support
|
|
@@ -47,7 +47,6 @@ import {
|
|
|
47
47
|
} from 'react-native';
|
|
48
48
|
import DateTimePicker, { DateTimePickerEvent } from '@react-native-community/datetimepicker';
|
|
49
49
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
50
|
-
import { useTimezone } from '@domains/timezone';
|
|
51
50
|
import { useAppDesignTokens } from '../hooks/useAppDesignTokens';
|
|
52
51
|
import { useResponsive } from '../hooks/useResponsive';
|
|
53
52
|
import { AtomicIcon, type AtomicIconColor } from './AtomicIcon';
|
|
@@ -104,7 +103,6 @@ export const AtomicDatePicker: React.FC<AtomicDatePickerProps> = ({
|
|
|
104
103
|
const { height } = useWindowDimensions();
|
|
105
104
|
const insets = useSafeAreaInsets();
|
|
106
105
|
const { isTabletDevice } = useResponsive();
|
|
107
|
-
const { formatDate: formatDateTz, formatTime } = useTimezone();
|
|
108
106
|
const [show, setShow] = useState(false);
|
|
109
107
|
|
|
110
108
|
/**
|
|
@@ -128,26 +126,35 @@ export const AtomicDatePicker: React.FC<AtomicDatePickerProps> = ({
|
|
|
128
126
|
|
|
129
127
|
/**
|
|
130
128
|
* Format date based on mode
|
|
131
|
-
* Uses
|
|
132
|
-
* Automatically respects user's selected language and device timezone
|
|
129
|
+
* Uses native Date formatting (locale-aware)
|
|
133
130
|
*/
|
|
134
131
|
const formatDate = (date: Date): string => {
|
|
135
132
|
if (mode === 'time') {
|
|
136
|
-
// Format time only
|
|
137
|
-
return
|
|
133
|
+
// Format time only
|
|
134
|
+
return date.toLocaleTimeString([], {
|
|
135
|
+
hour: '2-digit',
|
|
136
|
+
minute: '2-digit'
|
|
137
|
+
});
|
|
138
138
|
}
|
|
139
139
|
if (mode === 'datetime') {
|
|
140
|
-
// Format date + time
|
|
141
|
-
const dateStr =
|
|
140
|
+
// Format date + time
|
|
141
|
+
const dateStr = date.toLocaleDateString([], {
|
|
142
142
|
year: 'numeric',
|
|
143
143
|
month: 'short',
|
|
144
144
|
day: 'numeric',
|
|
145
145
|
});
|
|
146
|
-
const timeStr =
|
|
146
|
+
const timeStr = date.toLocaleTimeString([], {
|
|
147
|
+
hour: '2-digit',
|
|
148
|
+
minute: '2-digit'
|
|
149
|
+
});
|
|
147
150
|
return `${dateStr} ${timeStr}`;
|
|
148
151
|
}
|
|
149
|
-
// Format date only
|
|
150
|
-
return
|
|
152
|
+
// Format date only
|
|
153
|
+
return date.toLocaleDateString([], {
|
|
154
|
+
year: 'numeric',
|
|
155
|
+
month: 'long',
|
|
156
|
+
day: 'numeric',
|
|
157
|
+
});
|
|
151
158
|
};
|
|
152
159
|
|
|
153
160
|
/**
|
|
@@ -1,29 +1,113 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AtomicIcon - Design System Icon Component
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @deprecated Use Icon from @domains/icons directly in new code
|
|
4
|
+
* Universal icon component using Lucide icons.
|
|
5
|
+
* Provides semantic color mappings and size presets.
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
8
|
import React from 'react';
|
|
11
|
-
import
|
|
9
|
+
import * as LucideIcons from 'lucide-react-native';
|
|
10
|
+
import { useAppDesignTokens } from '../hooks/useAppDesignTokens';
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
* Icon size presets
|
|
14
|
+
*/
|
|
15
|
+
export type IconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Semantic color tokens
|
|
19
|
+
*/
|
|
20
|
+
export type IconColor =
|
|
21
|
+
| 'primary'
|
|
22
|
+
| 'secondary'
|
|
23
|
+
| 'error'
|
|
24
|
+
| 'warning'
|
|
25
|
+
| 'success'
|
|
26
|
+
| 'info'
|
|
27
|
+
| 'onPrimary'
|
|
28
|
+
| 'onSurface'
|
|
29
|
+
| 'textPrimary'
|
|
30
|
+
| 'textSecondary'
|
|
31
|
+
| 'textDisabled';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Icon component props
|
|
35
|
+
*/
|
|
36
|
+
export interface IconProps {
|
|
37
|
+
/** Icon name from Lucide icon set (PascalCase) */
|
|
38
|
+
name: string;
|
|
39
|
+
/** Semantic color token */
|
|
40
|
+
color?: IconColor;
|
|
41
|
+
/** Size preset */
|
|
42
|
+
size?: IconSize;
|
|
43
|
+
/** Custom size override (pixels) */
|
|
44
|
+
customSize?: number;
|
|
45
|
+
/** Custom color override (hex) */
|
|
46
|
+
customColor?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Size mapping (pixels)
|
|
51
|
+
*/
|
|
52
|
+
const sizeMap: Record<IconSize, number> = {
|
|
53
|
+
xs: 16,
|
|
54
|
+
sm: 20,
|
|
55
|
+
md: 24,
|
|
56
|
+
lg: 28,
|
|
57
|
+
xl: 32,
|
|
58
|
+
xxl: 48,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* AtomicIcon Component
|
|
18
63
|
*
|
|
19
|
-
*
|
|
64
|
+
* Universal icon component with theme integration
|
|
20
65
|
*/
|
|
21
|
-
export const AtomicIcon: React.FC<IconProps> = (
|
|
22
|
-
|
|
66
|
+
export const AtomicIcon: React.FC<IconProps> = ({
|
|
67
|
+
name,
|
|
68
|
+
color = 'textPrimary',
|
|
69
|
+
size = 'md',
|
|
70
|
+
customSize,
|
|
71
|
+
customColor,
|
|
72
|
+
}) => {
|
|
73
|
+
const tokens = useAppDesignTokens();
|
|
74
|
+
|
|
75
|
+
// Get icon component from Lucide
|
|
76
|
+
const IconComponent = (LucideIcons as any)[name];
|
|
77
|
+
|
|
78
|
+
if (!IconComponent) {
|
|
79
|
+
console.warn(`Icon "${name}" not found in Lucide icon set`);
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Resolve color from semantic token
|
|
84
|
+
const resolveColor = (): string => {
|
|
85
|
+
if (customColor) return customColor;
|
|
86
|
+
|
|
87
|
+
const colorMap: Record<IconColor, string> = {
|
|
88
|
+
primary: tokens.colors.primary,
|
|
89
|
+
secondary: tokens.colors.secondary,
|
|
90
|
+
error: tokens.colors.error,
|
|
91
|
+
warning: tokens.colors.warning,
|
|
92
|
+
success: tokens.colors.success,
|
|
93
|
+
info: tokens.colors.info,
|
|
94
|
+
onPrimary: tokens.colors.onPrimary,
|
|
95
|
+
onSurface: tokens.colors.onSurface,
|
|
96
|
+
textPrimary: tokens.colors.textPrimary,
|
|
97
|
+
textSecondary: tokens.colors.textSecondary,
|
|
98
|
+
textDisabled: tokens.colors.textDisabled,
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
return colorMap[color];
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// Resolve size
|
|
105
|
+
const iconSize = customSize || sizeMap[size];
|
|
106
|
+
|
|
107
|
+
return <IconComponent color={resolveColor()} size={iconSize} />;
|
|
23
108
|
};
|
|
24
109
|
|
|
25
110
|
// Re-export types for backward compatibility
|
|
26
|
-
export type
|
|
27
|
-
export type
|
|
28
|
-
export type
|
|
29
|
-
export type { IconName as AtomicIconName } from '@domains/icons';
|
|
111
|
+
export type AtomicIconProps = IconProps;
|
|
112
|
+
export type AtomicIconSize = IconSize;
|
|
113
|
+
export type AtomicIconColor = IconColor;
|