@umituz/react-native-design-system 4.23.67 → 4.23.69

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.
Files changed (68) hide show
  1. package/package.json +1 -1
  2. package/src/atoms/EmptyState.tsx +2 -2
  3. package/src/atoms/icon/AtomicIcon.tsx +41 -112
  4. package/src/atoms/icon/components/iconRenderer.tsx +118 -0
  5. package/src/atoms/icon/utils/iconUtils.ts +94 -0
  6. package/src/exception/infrastructure/services/ExceptionService.ts +29 -17
  7. package/src/exception/presentation/components/ExceptionEmptyState.tsx +1 -1
  8. package/src/exception/presentation/components/ExceptionErrorState.tsx +1 -1
  9. package/src/image/infrastructure/services/ImageBatchService.ts +1 -7
  10. package/src/image/infrastructure/types/BatchTypes.ts +11 -0
  11. package/src/image/infrastructure/utils/BatchProcessor.ts +1 -1
  12. package/src/image/infrastructure/utils/ImageErrorHandler.ts +1 -0
  13. package/src/infinite-scroll/presentation/components/infinite-scroll-list.tsx +2 -2
  14. package/src/layouts/ScreenHeader/ScreenHeader.tsx +3 -3
  15. package/src/media/presentation/hooks/useCardMediaGeneration.ts +4 -4
  16. package/src/media/presentation/hooks/useCardMediaUpload.ts +4 -4
  17. package/src/media/presentation/hooks/useCardMediaValidation.ts +4 -4
  18. package/src/media/presentation/hooks/useCardMultimediaFlashcard.ts +5 -5
  19. package/src/media/presentation/hooks/useMediaGeneration.ts +4 -4
  20. package/src/media/presentation/hooks/useMediaUpload.ts +4 -4
  21. package/src/media/presentation/hooks/useMediaValidation.ts +4 -4
  22. package/src/media/presentation/hooks/useMultimediaFlashcard.ts +5 -5
  23. package/src/molecules/BaseModal.tsx +1 -1
  24. package/src/molecules/ConfirmationModalContent.tsx +2 -2
  25. package/src/molecules/ConfirmationModalMain.tsx +2 -2
  26. package/src/molecules/alerts/AlertToast.tsx +163 -192
  27. package/src/molecules/alerts/utils/alertToastHelpers.ts +70 -0
  28. package/src/molecules/bottom-sheet/components/filter/FilterBottomSheet.tsx +2 -2
  29. package/src/molecules/calendar/presentation/components/AtomicCalendar.tsx +1 -1
  30. package/src/molecules/calendar/presentation/components/CalendarDayCell.tsx +2 -1
  31. package/src/molecules/calendar/presentation/components/CalendarWeekdayHeader.tsx +1 -1
  32. package/src/molecules/confirmation-modal/useConfirmationModal.ts +6 -6
  33. package/src/molecules/countdown/components/Countdown.tsx +2 -2
  34. package/src/molecules/splash/components/SplashScreen.tsx +9 -23
  35. package/src/molecules/swipe-actions/domain/entities/SwipeAction.ts +1 -1
  36. package/src/molecules/swipe-actions/presentation/components/SwipeActionButton.tsx +2 -2
  37. package/src/organisms/FormContainer.tsx +2 -2
  38. package/src/responsive/validation.ts +1 -0
  39. package/src/services/api/ApiClient.ts +242 -0
  40. package/src/services/api/index.ts +9 -0
  41. package/src/services/api/types/ApiTypes.ts +50 -0
  42. package/src/services/api/utils/requestBuilder.ts +92 -0
  43. package/src/services/api/utils/responseHandler.ts +130 -0
  44. package/src/storage/cache/domain/ErrorHandler.ts +1 -0
  45. package/src/storage/domain/errors/StorageError.ts +6 -0
  46. package/src/storage/infrastructure/repositories/AsyncStorageRepository.ts +31 -16
  47. package/src/tanstack/domain/repositories/BaseRepository.ts +16 -72
  48. package/src/tanstack/domain/repositories/IBaseRepository.ts +34 -0
  49. package/src/tanstack/domain/repositories/helpers/repositoryHelpers.ts +58 -0
  50. package/src/tanstack/domain/repositories/mixins/repositoryInvalidationMethods.ts +101 -0
  51. package/src/tanstack/domain/repositories/mixins/repositoryQueryMethods.ts +102 -0
  52. package/src/tanstack/infrastructure/providers/TanstackProvider.tsx +3 -3
  53. package/src/tanstack/presentation/hooks/types/prefetchTypes.ts +33 -0
  54. package/src/tanstack/presentation/hooks/usePrefetch.ts +8 -28
  55. package/src/tanstack/presentation/hooks/utils/prefetchLogger.ts +27 -0
  56. package/src/theme/index.ts +0 -3
  57. package/src/theme/infrastructure/providers/DesignSystemProvider.tsx +15 -4
  58. package/src/utils/colorMapper.ts +193 -0
  59. package/src/utils/formatHelper.ts +16 -0
  60. package/src/utils/formatters/dateFormatter.ts +64 -0
  61. package/src/utils/formatters/numberFormatter.ts +130 -0
  62. package/src/utils/formatters/stringFormatter.ts +190 -0
  63. package/src/utils/index.ts +15 -0
  64. package/src/utils/styleComposer.ts +94 -0
  65. package/src/utils/validationHelper.ts +16 -0
  66. package/src/utils/validators/dataValidators.ts +111 -0
  67. package/src/utils/validators/numericValidators.ts +106 -0
  68. package/src/utils/validators/stringValidators.ts +85 -0
@@ -0,0 +1,85 @@
1
+ /**
2
+ * String Validators
3
+ * Validation functions for string-based inputs
4
+ */
5
+
6
+ import type { ValidationResult } from './dataValidators';
7
+
8
+ /**
9
+ * String length validation options
10
+ */
11
+ export interface StringLengthValidationOptions {
12
+ min?: number;
13
+ max?: number;
14
+ trimWhitespace?: boolean;
15
+ }
16
+
17
+ /**
18
+ * Validates a string length
19
+ *
20
+ * @param value - String value to validate
21
+ * @param options - Validation options
22
+ * @returns Validation result with error message if invalid
23
+ */
24
+ export function validateStringLength(
25
+ value: string,
26
+ options: StringLengthValidationOptions = {}
27
+ ): ValidationResult {
28
+ const { trimWhitespace = true } = options;
29
+ const strValue = trimWhitespace ? value.trim() : value;
30
+
31
+ if (!strValue) {
32
+ return { isValid: false, error: 'Value is required' };
33
+ }
34
+
35
+ const { min, max } = options;
36
+
37
+ if (min !== undefined && strValue.length < min) {
38
+ return { isValid: false, error: `Value must be at least ${min} characters` };
39
+ }
40
+
41
+ if (max !== undefined && strValue.length > max) {
42
+ return { isValid: false, error: `Value must be at most ${max} characters` };
43
+ }
44
+
45
+ return { isValid: true };
46
+ }
47
+
48
+ /**
49
+ * Phone number validation options
50
+ */
51
+ export interface PhoneValidationOptions {
52
+ countryCode?: string;
53
+ allowLandline?: boolean;
54
+ }
55
+
56
+ /**
57
+ * Validates a phone number
58
+ *
59
+ * @param phone - Phone number string to validate
60
+ * @param options - Validation options
61
+ * @returns Validation result with error message if invalid
62
+ */
63
+ export function validatePhone(
64
+ phone: string,
65
+ _options: PhoneValidationOptions = {}
66
+ ): ValidationResult {
67
+ if (!phone || phone.trim() === '') {
68
+ return { isValid: false, error: 'Phone number is required' };
69
+ }
70
+
71
+ // Remove all non-numeric characters
72
+ const cleanedPhone = phone.replace(/\D/g, '');
73
+
74
+ // Check minimum length (at least 10 digits for most countries)
75
+ if (cleanedPhone.length < 10) {
76
+ return { isValid: false, error: 'Please enter a valid phone number' };
77
+ }
78
+
79
+ // Check maximum length (maximum 15 digits for international numbers)
80
+ if (cleanedPhone.length > 15) {
81
+ return { isValid: false, error: 'Please enter a valid phone number' };
82
+ }
83
+
84
+ return { isValid: true };
85
+ }