@umituz/react-native-design-system 2.11.2 → 2.11.3
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/AtomicFab.tsx +1 -1
- package/src/atoms/EmptyState.tsx +1 -1
- package/src/atoms/{AtomicBadge.tsx → badge/AtomicBadge.tsx} +3 -3
- package/src/atoms/badge/index.ts +6 -0
- package/src/atoms/button/AtomicButton.tsx +1 -1
- package/src/atoms/button/types/index.ts +1 -1
- package/src/atoms/card/AtomicCard.tsx +3 -2
- package/src/atoms/chip/AtomicChip.tsx +1 -1
- package/src/atoms/chip/types/index.ts +1 -1
- package/src/atoms/datepicker/components/DatePickerButton.tsx +3 -2
- package/src/atoms/{AtomicIcon.tsx → icon/AtomicIcon.tsx} +2 -2
- package/src/atoms/icon/iconStore.ts +119 -0
- package/src/atoms/icon/index.ts +35 -0
- package/src/atoms/index.ts +14 -9
- package/src/atoms/input/components/InputIcon.tsx +1 -1
- package/src/atoms/input/types.ts +1 -1
- package/src/atoms/picker/components/PickerChips.tsx +3 -2
- package/src/atoms/picker/components/PickerIcons.tsx +6 -3
- package/src/atoms/picker/components/PickerModal.tsx +10 -6
- package/src/atoms/picker/types/index.ts +1 -1
- package/src/exception/presentation/components/ExceptionErrorState.tsx +7 -3
- package/src/exports/atoms.ts +6 -3
- package/src/image/presentation/components/editor/FilterPickerSheet.tsx +6 -5
- package/src/image/presentation/components/editor/TextEditorSheet.tsx +1 -1
- package/src/image/presentation/components/editor/TextEditorTabs.tsx +1 -2
- package/src/molecules/SearchBar/SearchBar.tsx +5 -3
- package/src/molecules/SearchBar/SearchHistory.tsx +5 -3
- package/src/molecules/action-footer/ActionFooter.tsx +1 -1
- package/src/molecules/alerts/AlertBanner.tsx +3 -2
- package/src/molecules/alerts/AlertToast.tsx +3 -2
- package/src/molecules/bottom-sheet/components/filter/FilterBottomSheet.tsx +5 -3
- package/src/molecules/bottom-sheet/components/filter/FilterSheetComponents/FilterSheetHeader.tsx +13 -9
- package/src/molecules/bottom-sheet/components/filter/FilterSheetComponents/FilterSheetOption.tsx +8 -4
- package/src/molecules/circular-menu/CircularMenuCloseButton.tsx +3 -2
- package/src/molecules/countdown/components/Countdown.tsx +1 -1
- package/src/molecules/countdown/components/CountdownHeader.tsx +4 -3
- package/src/molecules/info-grid/InfoGrid.tsx +1 -1
- package/src/molecules/navigation/components/NavigationHeader.tsx +3 -2
- package/src/molecules/navigation/hooks/useTabConfig.ts +1 -1
- package/src/molecules/navigation/types.ts +1 -1
- package/src/molecules/navigation/utils/IconRenderer.ts +1 -2
- package/src/onboarding/presentation/components/OnboardingHeader.tsx +3 -2
- package/src/onboarding/presentation/components/OnboardingResetSetting.tsx +1 -2
- package/src/onboarding/presentation/components/OnboardingSlide.tsx +3 -2
- package/src/onboarding/presentation/components/QuestionSlideHeader.tsx +1 -2
- package/src/onboarding/presentation/components/questions/QuestionOptionItem.tsx +1 -2
- package/src/onboarding/presentation/components/questions/RatingQuestion.tsx +1 -2
- package/src/onboarding/presentation/components/questions/SingleChoiceQuestion.tsx +1 -2
- package/src/theme/core/TokenFactory.ts +1 -1
- package/src/theme/index.ts +1 -1
- package/src/theme/infrastructure/providers/DesignSystemProvider.tsx +15 -85
- package/src/atoms/IconRegistry.tsx +0 -102
- /package/src/atoms/{AtomicIcon.types.ts → icon/AtomicIcon.types.ts} +0 -0
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IconRegistry - Customizable Icon Rendering
|
|
3
|
-
*
|
|
4
|
-
* Allows apps to inject their own icon renderer instead of using
|
|
5
|
-
* the default Ionicons. This enables design system adoption without
|
|
6
|
-
* forcing a specific icon library.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* // App provides custom renderer
|
|
10
|
-
* import { MaterialIcons } from '@expo/vector-icons';
|
|
11
|
-
*
|
|
12
|
-
* const myRenderer = ({ name, size, color }) => (
|
|
13
|
-
* <MaterialIcons name={name} size={size} color={color} />
|
|
14
|
-
* );
|
|
15
|
-
*
|
|
16
|
-
* <DesignSystemProvider iconRenderer={myRenderer}>
|
|
17
|
-
* <App />
|
|
18
|
-
* </DesignSystemProvider>
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
import React, { createContext, useContext, ReactNode } from "react";
|
|
22
|
-
import type { StyleProp, ViewStyle } from "react-native";
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Props passed to the icon renderer function
|
|
26
|
-
* These are generic and not tied to any specific icon library
|
|
27
|
-
*/
|
|
28
|
-
export interface IconRenderProps {
|
|
29
|
-
/** Icon name - app interprets this based on their icon library */
|
|
30
|
-
name: string;
|
|
31
|
-
/** Size in pixels */
|
|
32
|
-
size: number;
|
|
33
|
-
/** Color (hex, rgba, named color, etc.) */
|
|
34
|
-
color: string;
|
|
35
|
-
/** Optional style */
|
|
36
|
-
style?: StyleProp<ViewStyle>;
|
|
37
|
-
/** Test ID for testing */
|
|
38
|
-
testID?: string;
|
|
39
|
-
/** Accessibility label */
|
|
40
|
-
accessibilityLabel?: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Icon renderer function type
|
|
45
|
-
* Apps provide this function to render icons with their preferred library
|
|
46
|
-
*/
|
|
47
|
-
export type IconRenderer = (props: IconRenderProps) => ReactNode;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Internal registry store
|
|
51
|
-
*/
|
|
52
|
-
interface IconRegistryValue {
|
|
53
|
-
renderIcon: IconRenderer;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const IconRegistryStore = createContext<IconRegistryValue | null>(null);
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Icon provider props
|
|
60
|
-
*/
|
|
61
|
-
interface IconProviderProps {
|
|
62
|
-
/** Icon renderer function */
|
|
63
|
-
renderIcon: IconRenderer;
|
|
64
|
-
/** Children */
|
|
65
|
-
children: ReactNode;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* IconProvider - Provides custom icon renderer to the component tree
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* <IconProvider renderIcon={myCustomRenderer}>
|
|
73
|
-
* <App />
|
|
74
|
-
* </IconProvider>
|
|
75
|
-
*/
|
|
76
|
-
export const IconProvider: React.FC<IconProviderProps> = ({
|
|
77
|
-
renderIcon,
|
|
78
|
-
children,
|
|
79
|
-
}) => {
|
|
80
|
-
return (
|
|
81
|
-
<IconRegistryStore.Provider value={{ renderIcon }}>
|
|
82
|
-
{children}
|
|
83
|
-
</IconRegistryStore.Provider>
|
|
84
|
-
);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Hook to access the icon renderer
|
|
89
|
-
* Returns null if no custom renderer is provided (fallback to Ionicons)
|
|
90
|
-
*/
|
|
91
|
-
export const useIconRenderer = (): IconRenderer | null => {
|
|
92
|
-
const registry = useContext(IconRegistryStore);
|
|
93
|
-
return registry?.renderIcon ?? null;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Hook to check if a custom icon renderer is available
|
|
98
|
-
*/
|
|
99
|
-
export const useHasCustomIconRenderer = (): boolean => {
|
|
100
|
-
const registry = useContext(IconRegistryStore);
|
|
101
|
-
return registry !== null;
|
|
102
|
-
};
|
|
File without changes
|