@umituz/react-native-design-system 2.5.6 → 2.5.7

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.5.6",
3
+ "version": "2.5.7",
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",
@@ -18,7 +18,7 @@ interface AlertBannerProps {
18
18
  }
19
19
 
20
20
  export function AlertBanner({ alert }: AlertBannerProps) {
21
- const dismissAlert = useAlertStore((state) => state.dismissAlert);
21
+ const dismissAlert = useAlertStore((state: { dismissAlert: (id: string) => void }) => state.dismissAlert);
22
22
  const insets = useSafeAreaInsets();
23
23
  const tokens = useAppDesignTokens();
24
24
 
@@ -10,22 +10,22 @@ import { useAlertStore } from './AlertStore';
10
10
  import { AlertToast } from './AlertToast';
11
11
  import { AlertBanner } from './AlertBanner';
12
12
  import { AlertModal } from './AlertModal';
13
- import { AlertMode } from './AlertTypes';
13
+ import { Alert, AlertMode } from './AlertTypes';
14
14
 
15
15
  export const AlertContainer: React.FC = () => {
16
- const alerts = useAlertStore((state) => state.alerts);
16
+ const alerts = useAlertStore((state: { alerts: Alert[] }) => state.alerts);
17
17
  const insets = useSafeAreaInsets();
18
18
  const tokens = useAppDesignTokens();
19
19
 
20
- const toasts = alerts.filter((a) => a.mode === AlertMode.TOAST);
21
- const banners = alerts.filter((a) => a.mode === AlertMode.BANNER);
22
- const modals = alerts.filter((a) => a.mode === AlertMode.MODAL);
20
+ const toasts = alerts.filter((a: Alert) => a.mode === AlertMode.TOAST);
21
+ const banners = alerts.filter((a: Alert) => a.mode === AlertMode.BANNER);
22
+ const modals = alerts.filter((a: Alert) => a.mode === AlertMode.MODAL);
23
23
 
24
24
  return (
25
25
  <View style={styles.container} pointerEvents="box-none">
26
26
  {/* Banners at top */}
27
27
  <View style={[styles.bannerContainer, { paddingTop: insets.top }]}>
28
- {banners.map((alert) => (
28
+ {banners.map((alert: Alert) => (
29
29
  <AlertBanner key={alert.id} alert={alert} />
30
30
  ))}
31
31
  </View>
@@ -38,7 +38,7 @@ export const AlertContainer: React.FC = () => {
38
38
  paddingHorizontal: tokens.spacing.md,
39
39
  }
40
40
  ]}>
41
- {toasts.map((alert) => (
41
+ {toasts.map((alert: Alert) => (
42
42
  <View key={alert.id} style={{ marginBottom: tokens.spacing.sm, width: '100%' }}>
43
43
  <AlertToast alert={alert} />
44
44
  </View>
@@ -46,7 +46,7 @@ export const AlertContainer: React.FC = () => {
46
46
  </View>
47
47
 
48
48
  {/* Modals on top of everything */}
49
- {modals.map((alert) => (
49
+ {modals.map((alert: Alert) => (
50
50
  <AlertModal key={alert.id} alert={alert} />
51
51
  ))}
52
52
  </View>
@@ -14,7 +14,7 @@ interface AlertModalProps {
14
14
  }
15
15
 
16
16
  export const AlertModal: React.FC<AlertModalProps> = ({ alert }) => {
17
- const dismissAlert = useAlertStore((state) => state.dismissAlert);
17
+ const dismissAlert = useAlertStore((state: { dismissAlert: (id: string) => void }) => state.dismissAlert);
18
18
  const tokens = useAppDesignTokens();
19
19
 
20
20
  const handleClose = () => {
@@ -2,21 +2,27 @@
2
2
  * Alert Store
3
3
  */
4
4
 
5
- import { create } from 'zustand';
5
+ import { create, type StoreApi } from 'zustand';
6
6
  import { Alert } from './AlertTypes';
7
7
 
8
8
  interface AlertState {
9
9
  alerts: Alert[];
10
+ }
11
+
12
+ interface AlertActions {
10
13
  addAlert: (alert: Alert) => void;
11
14
  dismissAlert: (id: string) => void;
12
15
  clearAlerts: () => void;
13
16
  }
14
17
 
15
- export const useAlertStore = create<AlertState>((set) => ({
18
+ type AlertStore = AlertState & AlertActions;
19
+ type SetState = StoreApi<AlertStore>['setState'];
20
+
21
+ export const useAlertStore = create<AlertStore>((set: SetState) => ({
16
22
  alerts: [],
17
- addAlert: (alert) => set((state) => ({ alerts: [...state.alerts, alert] })),
18
- dismissAlert: (id) => set((state) => ({
19
- alerts: state.alerts.filter((a) => a.id !== id)
23
+ addAlert: (alert: Alert) => set((state: AlertStore) => ({ alerts: [...state.alerts, alert] })),
24
+ dismissAlert: (id: string) => set((state: AlertStore) => ({
25
+ alerts: state.alerts.filter((a: Alert) => a.id !== id)
20
26
  })),
21
27
  clearAlerts: () => set({ alerts: [] }),
22
28
  }));
@@ -17,7 +17,7 @@ interface AlertToastProps {
17
17
  }
18
18
 
19
19
  export function AlertToast({ alert }: AlertToastProps) {
20
- const dismissAlert = useAlertStore((state) => state.dismissAlert);
20
+ const dismissAlert = useAlertStore((state: { dismissAlert: (id: string) => void }) => state.dismissAlert);
21
21
  const tokens = useAppDesignTokens();
22
22
 
23
23
  const handleDismiss = () => {