@umituz/react-native-design-system 1.5.8 → 1.5.10
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 +3 -8
- package/src/index.ts +1 -0
- package/lib/index.d.ts +0 -61
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -101
- package/lib/index.js.map +0 -1
- package/lib/presentation/atoms/AtomicAvatar.d.ts +0 -48
- package/lib/presentation/atoms/AtomicAvatar.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicAvatar.js +0 -85
- package/lib/presentation/atoms/AtomicAvatar.js.map +0 -1
- package/lib/presentation/atoms/AtomicAvatarGroup.d.ts +0 -56
- package/lib/presentation/atoms/AtomicAvatarGroup.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicAvatarGroup.js +0 -83
- package/lib/presentation/atoms/AtomicAvatarGroup.js.map +0 -1
- package/lib/presentation/atoms/AtomicBadge.d.ts +0 -42
- package/lib/presentation/atoms/AtomicBadge.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicBadge.js +0 -168
- package/lib/presentation/atoms/AtomicBadge.js.map +0 -1
- package/lib/presentation/atoms/AtomicButton.d.ts +0 -21
- package/lib/presentation/atoms/AtomicButton.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicButton.js +0 -172
- package/lib/presentation/atoms/AtomicButton.js.map +0 -1
- package/lib/presentation/atoms/AtomicCard.d.ts +0 -15
- package/lib/presentation/atoms/AtomicCard.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicCard.js +0 -70
- package/lib/presentation/atoms/AtomicCard.js.map +0 -1
- package/lib/presentation/atoms/AtomicChip.d.ts +0 -53
- package/lib/presentation/atoms/AtomicChip.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicChip.js +0 -131
- package/lib/presentation/atoms/AtomicChip.js.map +0 -1
- package/lib/presentation/atoms/AtomicDatePicker.d.ts +0 -75
- package/lib/presentation/atoms/AtomicDatePicker.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicDatePicker.js +0 -246
- package/lib/presentation/atoms/AtomicDatePicker.js.map +0 -1
- package/lib/presentation/atoms/AtomicDivider.d.ts +0 -45
- package/lib/presentation/atoms/AtomicDivider.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicDivider.js +0 -58
- package/lib/presentation/atoms/AtomicDivider.js.map +0 -1
- package/lib/presentation/atoms/AtomicFab.d.ts +0 -37
- package/lib/presentation/atoms/AtomicFab.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicFab.js +0 -68
- package/lib/presentation/atoms/AtomicFab.js.map +0 -1
- package/lib/presentation/atoms/AtomicFilter.d.ts +0 -37
- package/lib/presentation/atoms/AtomicFilter.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicFilter.js +0 -104
- package/lib/presentation/atoms/AtomicFilter.js.map +0 -1
- package/lib/presentation/atoms/AtomicFormError.d.ts +0 -30
- package/lib/presentation/atoms/AtomicFormError.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicFormError.js +0 -64
- package/lib/presentation/atoms/AtomicFormError.js.map +0 -1
- package/lib/presentation/atoms/AtomicIcon.d.ts +0 -35
- package/lib/presentation/atoms/AtomicIcon.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicIcon.js +0 -30
- package/lib/presentation/atoms/AtomicIcon.js.map +0 -1
- package/lib/presentation/atoms/AtomicImage.d.ts +0 -40
- package/lib/presentation/atoms/AtomicImage.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicImage.js +0 -92
- package/lib/presentation/atoms/AtomicImage.js.map +0 -1
- package/lib/presentation/atoms/AtomicInput.d.ts +0 -71
- package/lib/presentation/atoms/AtomicInput.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicInput.js +0 -196
- package/lib/presentation/atoms/AtomicInput.js.map +0 -1
- package/lib/presentation/atoms/AtomicNumberInput.d.ts +0 -69
- package/lib/presentation/atoms/AtomicNumberInput.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicNumberInput.js +0 -125
- package/lib/presentation/atoms/AtomicNumberInput.js.map +0 -1
- package/lib/presentation/atoms/AtomicPicker.d.ts +0 -52
- package/lib/presentation/atoms/AtomicPicker.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicPicker.js +0 -299
- package/lib/presentation/atoms/AtomicPicker.js.map +0 -1
- package/lib/presentation/atoms/AtomicProgress.d.ts +0 -44
- package/lib/presentation/atoms/AtomicProgress.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicProgress.js +0 -80
- package/lib/presentation/atoms/AtomicProgress.js.map +0 -1
- package/lib/presentation/atoms/AtomicSearchBar.d.ts +0 -19
- package/lib/presentation/atoms/AtomicSearchBar.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicSearchBar.js +0 -46
- package/lib/presentation/atoms/AtomicSearchBar.js.map +0 -1
- package/lib/presentation/atoms/AtomicSort.d.ts +0 -72
- package/lib/presentation/atoms/AtomicSort.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicSort.js +0 -77
- package/lib/presentation/atoms/AtomicSort.js.map +0 -1
- package/lib/presentation/atoms/AtomicSwitch.d.ts +0 -43
- package/lib/presentation/atoms/AtomicSwitch.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicSwitch.js +0 -104
- package/lib/presentation/atoms/AtomicSwitch.js.map +0 -1
- package/lib/presentation/atoms/AtomicText.d.ts +0 -34
- package/lib/presentation/atoms/AtomicText.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicText.js +0 -59
- package/lib/presentation/atoms/AtomicText.js.map +0 -1
- package/lib/presentation/atoms/AtomicTextArea.d.ts +0 -85
- package/lib/presentation/atoms/AtomicTextArea.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicTextArea.js +0 -196
- package/lib/presentation/atoms/AtomicTextArea.js.map +0 -1
- package/lib/presentation/atoms/AtomicTouchable.d.ts +0 -77
- package/lib/presentation/atoms/AtomicTouchable.d.ts.map +0 -1
- package/lib/presentation/atoms/AtomicTouchable.js +0 -138
- package/lib/presentation/atoms/AtomicTouchable.js.map +0 -1
- package/lib/presentation/atoms/fab/styles/fabStyles.d.ts +0 -23
- package/lib/presentation/atoms/fab/styles/fabStyles.d.ts.map +0 -1
- package/lib/presentation/atoms/fab/styles/fabStyles.js +0 -63
- package/lib/presentation/atoms/fab/styles/fabStyles.js.map +0 -1
- package/lib/presentation/atoms/fab/types/index.d.ts +0 -71
- package/lib/presentation/atoms/fab/types/index.d.ts.map +0 -1
- package/lib/presentation/atoms/fab/types/index.js +0 -2
- package/lib/presentation/atoms/fab/types/index.js.map +0 -1
- package/lib/presentation/atoms/filter/styles/filterStyles.d.ts +0 -15
- package/lib/presentation/atoms/filter/styles/filterStyles.d.ts.map +0 -1
- package/lib/presentation/atoms/filter/styles/filterStyles.js +0 -29
- package/lib/presentation/atoms/filter/styles/filterStyles.js.map +0 -1
- package/lib/presentation/atoms/filter/types/index.d.ts +0 -76
- package/lib/presentation/atoms/filter/types/index.d.ts.map +0 -1
- package/lib/presentation/atoms/filter/types/index.js +0 -2
- package/lib/presentation/atoms/filter/types/index.js.map +0 -1
- package/lib/presentation/atoms/index.d.ts +0 -273
- package/lib/presentation/atoms/index.d.ts.map +0 -1
- package/lib/presentation/atoms/index.js +0 -146
- package/lib/presentation/atoms/index.js.map +0 -1
- package/lib/presentation/atoms/input/hooks/useInputState.d.ts +0 -7
- package/lib/presentation/atoms/input/hooks/useInputState.d.ts.map +0 -1
- package/lib/presentation/atoms/input/hooks/useInputState.js +0 -13
- package/lib/presentation/atoms/input/hooks/useInputState.js.map +0 -1
- package/lib/presentation/atoms/input/styles/inputStyles.d.ts +0 -13
- package/lib/presentation/atoms/input/styles/inputStyles.d.ts.map +0 -1
- package/lib/presentation/atoms/input/styles/inputStyles.js +0 -59
- package/lib/presentation/atoms/input/styles/inputStyles.js.map +0 -1
- package/lib/presentation/atoms/input/types/index.d.ts +0 -24
- package/lib/presentation/atoms/input/types/index.d.ts.map +0 -1
- package/lib/presentation/atoms/input/types/index.js +0 -2
- package/lib/presentation/atoms/input/types/index.js.map +0 -1
- package/lib/presentation/atoms/picker/styles/pickerStyles.d.ts +0 -85
- package/lib/presentation/atoms/picker/styles/pickerStyles.d.ts.map +0 -1
- package/lib/presentation/atoms/picker/styles/pickerStyles.js +0 -177
- package/lib/presentation/atoms/picker/styles/pickerStyles.js.map +0 -1
- package/lib/presentation/atoms/picker/types/index.d.ts +0 -38
- package/lib/presentation/atoms/picker/types/index.d.ts.map +0 -1
- package/lib/presentation/atoms/picker/types/index.js +0 -2
- package/lib/presentation/atoms/picker/types/index.js.map +0 -1
- package/lib/presentation/atoms/touchable/styles/touchableStyles.d.ts +0 -31
- package/lib/presentation/atoms/touchable/styles/touchableStyles.d.ts.map +0 -1
- package/lib/presentation/atoms/touchable/styles/touchableStyles.js +0 -54
- package/lib/presentation/atoms/touchable/styles/touchableStyles.js.map +0 -1
- package/lib/presentation/atoms/touchable/types/index.d.ts +0 -134
- package/lib/presentation/atoms/touchable/types/index.d.ts.map +0 -1
- package/lib/presentation/atoms/touchable/types/index.js +0 -2
- package/lib/presentation/atoms/touchable/types/index.js.map +0 -1
- package/lib/presentation/hooks/useResponsive.d.ts +0 -80
- package/lib/presentation/hooks/useResponsive.d.ts.map +0 -1
- package/lib/presentation/hooks/useResponsive.js +0 -82
- package/lib/presentation/hooks/useResponsive.js.map +0 -1
- package/lib/presentation/molecules/AtomicConfirmationModal.d.ts +0 -73
- package/lib/presentation/molecules/AtomicConfirmationModal.d.ts.map +0 -1
- package/lib/presentation/molecules/AtomicConfirmationModal.js +0 -154
- package/lib/presentation/molecules/AtomicConfirmationModal.js.map +0 -1
- package/lib/presentation/molecules/EmptyState.d.ts +0 -41
- package/lib/presentation/molecules/EmptyState.d.ts.map +0 -1
- package/lib/presentation/molecules/EmptyState.js +0 -68
- package/lib/presentation/molecules/EmptyState.js.map +0 -1
- package/lib/presentation/molecules/FormField.d.ts +0 -22
- package/lib/presentation/molecules/FormField.d.ts.map +0 -1
- package/lib/presentation/molecules/FormField.js +0 -76
- package/lib/presentation/molecules/FormField.js.map +0 -1
- package/lib/presentation/molecules/GridContainer.d.ts +0 -40
- package/lib/presentation/molecules/GridContainer.d.ts.map +0 -1
- package/lib/presentation/molecules/GridContainer.js +0 -77
- package/lib/presentation/molecules/GridContainer.js.map +0 -1
- package/lib/presentation/molecules/IconContainer.d.ts +0 -29
- package/lib/presentation/molecules/IconContainer.d.ts.map +0 -1
- package/lib/presentation/molecules/IconContainer.js +0 -60
- package/lib/presentation/molecules/IconContainer.js.map +0 -1
- package/lib/presentation/molecules/ListItem.d.ts +0 -5
- package/lib/presentation/molecules/ListItem.d.ts.map +0 -1
- package/lib/presentation/molecules/ListItem.js +0 -24
- package/lib/presentation/molecules/ListItem.js.map +0 -1
- package/lib/presentation/molecules/ScreenHeader.d.ts +0 -55
- package/lib/presentation/molecules/ScreenHeader.d.ts.map +0 -1
- package/lib/presentation/molecules/ScreenHeader.js +0 -94
- package/lib/presentation/molecules/ScreenHeader.js.map +0 -1
- package/lib/presentation/molecules/SearchBar.d.ts +0 -18
- package/lib/presentation/molecules/SearchBar.d.ts.map +0 -1
- package/lib/presentation/molecules/SearchBar.js +0 -47
- package/lib/presentation/molecules/SearchBar.js.map +0 -1
- package/lib/presentation/molecules/SectionCard.d.ts +0 -25
- package/lib/presentation/molecules/SectionCard.d.ts.map +0 -1
- package/lib/presentation/molecules/SectionCard.js +0 -47
- package/lib/presentation/molecules/SectionCard.js.map +0 -1
- package/lib/presentation/molecules/SectionContainer.d.ts +0 -33
- package/lib/presentation/molecules/SectionContainer.d.ts.map +0 -1
- package/lib/presentation/molecules/SectionContainer.js +0 -64
- package/lib/presentation/molecules/SectionContainer.js.map +0 -1
- package/lib/presentation/molecules/SectionHeader.d.ts +0 -37
- package/lib/presentation/molecules/SectionHeader.d.ts.map +0 -1
- package/lib/presentation/molecules/SectionHeader.js +0 -73
- package/lib/presentation/molecules/SectionHeader.js.map +0 -1
- package/lib/presentation/molecules/confirmation-modal/styles/confirmationModalStyles.d.ts +0 -50
- package/lib/presentation/molecules/confirmation-modal/styles/confirmationModalStyles.d.ts.map +0 -1
- package/lib/presentation/molecules/confirmation-modal/styles/confirmationModalStyles.js +0 -115
- package/lib/presentation/molecules/confirmation-modal/styles/confirmationModalStyles.js.map +0 -1
- package/lib/presentation/molecules/confirmation-modal/types/index.d.ts +0 -86
- package/lib/presentation/molecules/confirmation-modal/types/index.d.ts.map +0 -1
- package/lib/presentation/molecules/confirmation-modal/types/index.js +0 -7
- package/lib/presentation/molecules/confirmation-modal/types/index.js.map +0 -1
- package/lib/presentation/molecules/index.d.ts +0 -27
- package/lib/presentation/molecules/index.d.ts.map +0 -1
- package/lib/presentation/molecules/index.js +0 -17
- package/lib/presentation/molecules/index.js.map +0 -1
- package/lib/presentation/molecules/listitem/styles/listItemStyles.d.ts +0 -12
- package/lib/presentation/molecules/listitem/styles/listItemStyles.d.ts.map +0 -1
- package/lib/presentation/molecules/listitem/styles/listItemStyles.js +0 -15
- package/lib/presentation/molecules/listitem/styles/listItemStyles.js.map +0 -1
- package/lib/presentation/molecules/listitem/types/index.d.ts +0 -17
- package/lib/presentation/molecules/listitem/types/index.d.ts.map +0 -1
- package/lib/presentation/molecules/listitem/types/index.js +0 -2
- package/lib/presentation/molecules/listitem/types/index.js.map +0 -1
- package/lib/presentation/organisms/AppHeader.d.ts +0 -31
- package/lib/presentation/organisms/AppHeader.d.ts.map +0 -1
- package/lib/presentation/organisms/AppHeader.js +0 -78
- package/lib/presentation/organisms/AppHeader.js.map +0 -1
- package/lib/presentation/organisms/FormContainer.d.ts +0 -76
- package/lib/presentation/organisms/FormContainer.d.ts.map +0 -1
- package/lib/presentation/organisms/FormContainer.js +0 -127
- package/lib/presentation/organisms/FormContainer.js.map +0 -1
- package/lib/presentation/organisms/ScreenLayout.d.ts +0 -84
- package/lib/presentation/organisms/ScreenLayout.d.ts.map +0 -1
- package/lib/presentation/organisms/ScreenLayout.js +0 -69
- package/lib/presentation/organisms/ScreenLayout.js.map +0 -1
- package/lib/presentation/organisms/index.d.ts +0 -16
- package/lib/presentation/organisms/index.d.ts.map +0 -1
- package/lib/presentation/organisms/index.js +0 -14
- package/lib/presentation/organisms/index.js.map +0 -1
- package/lib/presentation/tokens/commonStyles.d.ts +0 -122
- package/lib/presentation/tokens/commonStyles.d.ts.map +0 -1
- package/lib/presentation/tokens/commonStyles.js +0 -220
- package/lib/presentation/tokens/commonStyles.js.map +0 -1
- package/lib/presentation/utils/platformConstants.d.ts +0 -100
- package/lib/presentation/utils/platformConstants.d.ts.map +0 -1
- package/lib/presentation/utils/platformConstants.js +0 -114
- package/lib/presentation/utils/platformConstants.js.map +0 -1
- package/lib/presentation/utils/responsive.d.ts +0 -218
- package/lib/presentation/utils/responsive.d.ts.map +0 -1
- package/lib/presentation/utils/responsive.js +0 -452
- package/lib/presentation/utils/responsive.js.map +0 -1
- package/lib/presentation/utils/variants/compound.d.ts +0 -10
- package/lib/presentation/utils/variants/compound.d.ts.map +0 -1
- package/lib/presentation/utils/variants/compound.js +0 -16
- package/lib/presentation/utils/variants/compound.js.map +0 -1
- package/lib/presentation/utils/variants/core.d.ts +0 -15
- package/lib/presentation/utils/variants/core.d.ts.map +0 -1
- package/lib/presentation/utils/variants/core.js +0 -23
- package/lib/presentation/utils/variants/core.js.map +0 -1
- package/lib/presentation/utils/variants/helpers.d.ts +0 -5
- package/lib/presentation/utils/variants/helpers.d.ts.map +0 -1
- package/lib/presentation/utils/variants/helpers.js +0 -10
- package/lib/presentation/utils/variants/helpers.js.map +0 -1
- package/lib/presentation/utils/variants.d.ts +0 -4
- package/lib/presentation/utils/variants.d.ts.map +0 -1
- package/lib/presentation/utils/variants.js +0 -4
- package/lib/presentation/utils/variants.js.map +0 -1
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { View, TextInput, Pressable, StyleSheet } from 'react-native';
|
|
3
|
-
import { useAppDesignTokens } from '@umituz/react-native-theme';
|
|
4
|
-
import { AtomicIcon } from './AtomicIcon';
|
|
5
|
-
import { AtomicText } from './AtomicText';
|
|
6
|
-
/**
|
|
7
|
-
* AtomicInput - Pure React Native Text Input
|
|
8
|
-
*
|
|
9
|
-
* Features:
|
|
10
|
-
* - Pure React Native implementation (no Paper dependency)
|
|
11
|
-
* - Lucide icons for password toggle and custom icons
|
|
12
|
-
* - Outlined/filled/flat variants
|
|
13
|
-
* - Error, success, disabled states
|
|
14
|
-
* - Character counter
|
|
15
|
-
* - Responsive sizing
|
|
16
|
-
* - Full accessibility support
|
|
17
|
-
*/
|
|
18
|
-
export const AtomicInput = ({ variant = 'outlined', state = 'default', size = 'md', label, value = '', onChangeText, placeholder, helperText, leadingIcon, trailingIcon, onTrailingIconPress, showPasswordToggle = false, secureTextEntry = false, maxLength, showCharacterCount = false, keyboardType = 'default', autoCapitalize = 'sentences', autoCorrect = true, disabled = false, style, inputStyle, testID, onBlur, onFocus, }) => {
|
|
19
|
-
const tokens = useAppDesignTokens();
|
|
20
|
-
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
|
21
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
22
|
-
const isDisabled = state === 'disabled' || disabled;
|
|
23
|
-
const characterCount = value?.toString().length || 0;
|
|
24
|
-
const hasError = state === 'error';
|
|
25
|
-
const hasSuccess = state === 'success';
|
|
26
|
-
// Size configuration
|
|
27
|
-
const sizeConfig = {
|
|
28
|
-
sm: {
|
|
29
|
-
paddingVertical: tokens.spacing.xs,
|
|
30
|
-
paddingHorizontal: tokens.spacing.sm,
|
|
31
|
-
fontSize: tokens.typography.bodySmall.fontSize,
|
|
32
|
-
iconSize: 16,
|
|
33
|
-
minHeight: 40,
|
|
34
|
-
},
|
|
35
|
-
md: {
|
|
36
|
-
paddingVertical: tokens.spacing.sm,
|
|
37
|
-
paddingHorizontal: tokens.spacing.md,
|
|
38
|
-
fontSize: tokens.typography.bodyMedium.fontSize,
|
|
39
|
-
iconSize: 20,
|
|
40
|
-
minHeight: 48,
|
|
41
|
-
},
|
|
42
|
-
lg: {
|
|
43
|
-
paddingVertical: tokens.spacing.md,
|
|
44
|
-
paddingHorizontal: tokens.spacing.lg,
|
|
45
|
-
fontSize: tokens.typography.bodyLarge.fontSize,
|
|
46
|
-
iconSize: 24,
|
|
47
|
-
minHeight: 56,
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
const config = sizeConfig[size];
|
|
51
|
-
// Get variant styles
|
|
52
|
-
const getVariantStyle = () => {
|
|
53
|
-
const baseStyle = {
|
|
54
|
-
backgroundColor: tokens.colors.surface,
|
|
55
|
-
borderRadius: tokens.borders.radius.md,
|
|
56
|
-
};
|
|
57
|
-
let borderColor = tokens.colors.border;
|
|
58
|
-
if (isFocused)
|
|
59
|
-
borderColor = tokens.colors.primary;
|
|
60
|
-
if (hasError)
|
|
61
|
-
borderColor = tokens.colors.error;
|
|
62
|
-
if (hasSuccess)
|
|
63
|
-
borderColor = tokens.colors.success;
|
|
64
|
-
if (isDisabled)
|
|
65
|
-
borderColor = tokens.colors.borderDisabled;
|
|
66
|
-
switch (variant) {
|
|
67
|
-
case 'outlined':
|
|
68
|
-
return {
|
|
69
|
-
...baseStyle,
|
|
70
|
-
borderWidth: isFocused ? 2 : 1,
|
|
71
|
-
borderColor,
|
|
72
|
-
};
|
|
73
|
-
case 'filled':
|
|
74
|
-
return {
|
|
75
|
-
...baseStyle,
|
|
76
|
-
backgroundColor: tokens.colors.surfaceSecondary,
|
|
77
|
-
borderWidth: 0,
|
|
78
|
-
borderBottomWidth: isFocused ? 2 : 1,
|
|
79
|
-
borderBottomColor: borderColor,
|
|
80
|
-
};
|
|
81
|
-
case 'flat':
|
|
82
|
-
return {
|
|
83
|
-
...baseStyle,
|
|
84
|
-
backgroundColor: 'transparent',
|
|
85
|
-
borderWidth: 0,
|
|
86
|
-
borderBottomWidth: 1,
|
|
87
|
-
borderBottomColor: borderColor,
|
|
88
|
-
borderRadius: 0,
|
|
89
|
-
};
|
|
90
|
-
default:
|
|
91
|
-
return baseStyle;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
// Get text color based on state
|
|
95
|
-
const getTextColor = () => {
|
|
96
|
-
if (isDisabled)
|
|
97
|
-
return tokens.colors.textDisabled;
|
|
98
|
-
if (hasError)
|
|
99
|
-
return tokens.colors.error;
|
|
100
|
-
if (hasSuccess)
|
|
101
|
-
return tokens.colors.success;
|
|
102
|
-
return tokens.colors.textPrimary;
|
|
103
|
-
};
|
|
104
|
-
const iconColor = isDisabled ? tokens.colors.textDisabled : tokens.colors.textSecondary;
|
|
105
|
-
const containerStyle = [
|
|
106
|
-
styles.container,
|
|
107
|
-
getVariantStyle(),
|
|
108
|
-
{
|
|
109
|
-
paddingVertical: config.paddingVertical,
|
|
110
|
-
paddingHorizontal: config.paddingHorizontal,
|
|
111
|
-
minHeight: config.minHeight,
|
|
112
|
-
opacity: isDisabled ? 0.5 : 1,
|
|
113
|
-
},
|
|
114
|
-
style,
|
|
115
|
-
];
|
|
116
|
-
const textInputStyle = [
|
|
117
|
-
styles.input,
|
|
118
|
-
{
|
|
119
|
-
fontSize: config.fontSize,
|
|
120
|
-
color: getTextColor(),
|
|
121
|
-
},
|
|
122
|
-
leadingIcon ? { paddingLeft: config.iconSize + 8 } : undefined,
|
|
123
|
-
(trailingIcon || showPasswordToggle) ? { paddingRight: config.iconSize + 8 } : undefined,
|
|
124
|
-
inputStyle,
|
|
125
|
-
];
|
|
126
|
-
return (<View testID={testID}>
|
|
127
|
-
{label && (<AtomicText type="labelMedium" color={hasError ? 'error' : hasSuccess ? 'success' : 'secondary'} style={styles.label}>
|
|
128
|
-
{label}
|
|
129
|
-
</AtomicText>)}
|
|
130
|
-
|
|
131
|
-
<View style={containerStyle}>
|
|
132
|
-
{leadingIcon && (<View style={styles.leadingIcon}>
|
|
133
|
-
<AtomicIcon name={leadingIcon} customSize={config.iconSize} customColor={iconColor}/>
|
|
134
|
-
</View>)}
|
|
135
|
-
|
|
136
|
-
<TextInput value={value} onChangeText={onChangeText} placeholder={placeholder} placeholderTextColor={tokens.colors.textSecondary} secureTextEntry={secureTextEntry && !isPasswordVisible} maxLength={maxLength} keyboardType={keyboardType} autoCapitalize={autoCapitalize} autoCorrect={autoCorrect} editable={!isDisabled} style={textInputStyle} onBlur={() => {
|
|
137
|
-
setIsFocused(false);
|
|
138
|
-
onBlur?.();
|
|
139
|
-
}} onFocus={() => {
|
|
140
|
-
setIsFocused(true);
|
|
141
|
-
onFocus?.();
|
|
142
|
-
}} testID={testID ? `${testID}-input` : undefined}/>
|
|
143
|
-
|
|
144
|
-
{(showPasswordToggle && secureTextEntry) && (<Pressable onPress={() => setIsPasswordVisible(!isPasswordVisible)} style={styles.trailingIcon}>
|
|
145
|
-
<AtomicIcon name={isPasswordVisible ? "EyeOff" : "Eye"} customSize={config.iconSize} customColor={iconColor}/>
|
|
146
|
-
</Pressable>)}
|
|
147
|
-
|
|
148
|
-
{trailingIcon && !showPasswordToggle && (<Pressable onPress={onTrailingIconPress} style={styles.trailingIcon} disabled={!onTrailingIconPress}>
|
|
149
|
-
<AtomicIcon name={trailingIcon} customSize={config.iconSize} customColor={iconColor}/>
|
|
150
|
-
</Pressable>)}
|
|
151
|
-
</View>
|
|
152
|
-
|
|
153
|
-
{(helperText || showCharacterCount) && (<View style={styles.helperRow}>
|
|
154
|
-
{helperText && (<AtomicText type="bodySmall" color={hasError ? 'error' : 'secondary'} style={styles.helperText} testID={testID ? `${testID}-helper` : undefined}>
|
|
155
|
-
{helperText}
|
|
156
|
-
</AtomicText>)}
|
|
157
|
-
{showCharacterCount && maxLength && (<AtomicText type="bodySmall" color="secondary" style={styles.characterCount} testID={testID ? `${testID}-count` : undefined}>
|
|
158
|
-
{characterCount}/{maxLength}
|
|
159
|
-
</AtomicText>)}
|
|
160
|
-
</View>)}
|
|
161
|
-
</View>);
|
|
162
|
-
};
|
|
163
|
-
const styles = StyleSheet.create({
|
|
164
|
-
container: {
|
|
165
|
-
flexDirection: 'row',
|
|
166
|
-
alignItems: 'center',
|
|
167
|
-
},
|
|
168
|
-
input: {
|
|
169
|
-
flex: 1,
|
|
170
|
-
},
|
|
171
|
-
label: {
|
|
172
|
-
marginBottom: 4,
|
|
173
|
-
},
|
|
174
|
-
leadingIcon: {
|
|
175
|
-
position: 'absolute',
|
|
176
|
-
left: 12,
|
|
177
|
-
zIndex: 1,
|
|
178
|
-
},
|
|
179
|
-
trailingIcon: {
|
|
180
|
-
position: 'absolute',
|
|
181
|
-
right: 12,
|
|
182
|
-
zIndex: 1,
|
|
183
|
-
},
|
|
184
|
-
helperRow: {
|
|
185
|
-
flexDirection: 'row',
|
|
186
|
-
justifyContent: 'space-between',
|
|
187
|
-
marginTop: 4,
|
|
188
|
-
},
|
|
189
|
-
helperText: {
|
|
190
|
-
flex: 1,
|
|
191
|
-
},
|
|
192
|
-
characterCount: {
|
|
193
|
-
marginLeft: 8,
|
|
194
|
-
},
|
|
195
|
-
});
|
|
196
|
-
//# sourceMappingURL=AtomicInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicInput.js","sourceRoot":"","sources":["../../../src/presentation/atoms/AtomicInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAmC,MAAM,cAAc,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA0D1C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,WAAW,GAA+B,CAAC,EACtD,OAAO,GAAG,UAAU,EACpB,KAAK,GAAG,SAAS,EACjB,IAAI,GAAG,IAAI,EACX,KAAK,EACL,KAAK,GAAG,EAAE,EACV,YAAY,EACZ,WAAW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EAAE;QACL,YAAY,EAAE,CAAC;KAChB;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,CAAC;KACV;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,UAAU;QACpB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,CAAC;KACV;IACD,SAAS,EAAE;QACT,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,eAAe;QAC/B,SAAS,EAAE,CAAC;KACb;IACD,UAAU,EAAE;QACV,IAAI,EAAE,CAAC;KACR;IACD,cAAc,EAAE;QACd,UAAU,EAAE,CAAC;KACd;CACF,CAAC,CAAC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AtomicNumberInput Component
|
|
3
|
-
*
|
|
4
|
-
* A specialized number input component that wraps AtomicInput with
|
|
5
|
-
* number-specific validation and keyboard handling.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Numeric keyboard (integer or decimal)
|
|
9
|
-
* - Min/max validation
|
|
10
|
-
* - Step increment support
|
|
11
|
-
* - Automatic error states for invalid numbers
|
|
12
|
-
* - Parsed number callback (onValueChange)
|
|
13
|
-
* - Consistent styling with AtomicInput
|
|
14
|
-
* - All AtomicInput features (variants, states, sizes)
|
|
15
|
-
*
|
|
16
|
-
* Usage:
|
|
17
|
-
* ```tsx
|
|
18
|
-
* const [age, setAge] = useState<number | null>(null);
|
|
19
|
-
*
|
|
20
|
-
* <AtomicNumberInput
|
|
21
|
-
* value={age?.toString() || ''}
|
|
22
|
-
* onValueChange={setAge}
|
|
23
|
-
* label="Age"
|
|
24
|
-
* min={0}
|
|
25
|
-
* max={150}
|
|
26
|
-
* helperText="Enter your age"
|
|
27
|
-
* />
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* Why This Component:
|
|
31
|
-
* - Separation of concerns (text vs number input)
|
|
32
|
-
* - Built-in number validation
|
|
33
|
-
* - Type-safe number callbacks
|
|
34
|
-
* - Prevents non-numeric input via keyboard
|
|
35
|
-
* - Consistent with AtomicInput styling
|
|
36
|
-
*
|
|
37
|
-
* @module AtomicNumberInput
|
|
38
|
-
*/
|
|
39
|
-
import React from 'react';
|
|
40
|
-
import { AtomicInputProps } from './AtomicInput';
|
|
41
|
-
/**
|
|
42
|
-
* Props for AtomicNumberInput component
|
|
43
|
-
* Extends AtomicInput but removes text-specific props
|
|
44
|
-
*/
|
|
45
|
-
export interface AtomicNumberInputProps extends Omit<AtomicInputProps, 'keyboardType' | 'secureTextEntry' | 'showPasswordToggle' | 'onChangeText'> {
|
|
46
|
-
/** Minimum allowed value */
|
|
47
|
-
min?: number;
|
|
48
|
-
/** Maximum allowed value */
|
|
49
|
-
max?: number;
|
|
50
|
-
/** Step increment (for spinners, future feature) */
|
|
51
|
-
step?: number;
|
|
52
|
-
/** Allow decimal numbers (default: false for integers only) */
|
|
53
|
-
allowDecimal?: boolean;
|
|
54
|
-
/** Callback when valid number is entered (null if invalid/empty) */
|
|
55
|
-
onValueChange?: (value: number | null) => void;
|
|
56
|
-
/** Callback when raw text changes (optional) */
|
|
57
|
-
onTextChange?: (text: string) => void;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* AtomicNumberInput - Specialized numeric input component
|
|
61
|
-
*
|
|
62
|
-
* Wraps AtomicInput with:
|
|
63
|
-
* - Numeric keyboard
|
|
64
|
-
* - Number validation (min, max, format)
|
|
65
|
-
* - Parsed number callbacks
|
|
66
|
-
* - Automatic error states
|
|
67
|
-
*/
|
|
68
|
-
export declare const AtomicNumberInput: React.FC<AtomicNumberInputProps>;
|
|
69
|
-
//# sourceMappingURL=AtomicNumberInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicNumberInput.d.ts","sourceRoot":"","sources":["../../../src/presentation/atoms/AtomicNumberInput.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAAe,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,sBACf,SAAQ,IAAI,CACV,gBAAgB,EAChB,cAAc,GAAG,iBAAiB,GAAG,oBAAoB,GAAG,cAAc,CAC3E;IACD,4BAA4B;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oEAAoE;IACpE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC/C,gDAAgD;IAChD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA2G9D,CAAC"}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AtomicNumberInput Component
|
|
3
|
-
*
|
|
4
|
-
* A specialized number input component that wraps AtomicInput with
|
|
5
|
-
* number-specific validation and keyboard handling.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Numeric keyboard (integer or decimal)
|
|
9
|
-
* - Min/max validation
|
|
10
|
-
* - Step increment support
|
|
11
|
-
* - Automatic error states for invalid numbers
|
|
12
|
-
* - Parsed number callback (onValueChange)
|
|
13
|
-
* - Consistent styling with AtomicInput
|
|
14
|
-
* - All AtomicInput features (variants, states, sizes)
|
|
15
|
-
*
|
|
16
|
-
* Usage:
|
|
17
|
-
* ```tsx
|
|
18
|
-
* const [age, setAge] = useState<number | null>(null);
|
|
19
|
-
*
|
|
20
|
-
* <AtomicNumberInput
|
|
21
|
-
* value={age?.toString() || ''}
|
|
22
|
-
* onValueChange={setAge}
|
|
23
|
-
* label="Age"
|
|
24
|
-
* min={0}
|
|
25
|
-
* max={150}
|
|
26
|
-
* helperText="Enter your age"
|
|
27
|
-
* />
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* Why This Component:
|
|
31
|
-
* - Separation of concerns (text vs number input)
|
|
32
|
-
* - Built-in number validation
|
|
33
|
-
* - Type-safe number callbacks
|
|
34
|
-
* - Prevents non-numeric input via keyboard
|
|
35
|
-
* - Consistent with AtomicInput styling
|
|
36
|
-
*
|
|
37
|
-
* @module AtomicNumberInput
|
|
38
|
-
*/
|
|
39
|
-
import React, { useState, useEffect } from 'react';
|
|
40
|
-
import { AtomicInput } from './AtomicInput';
|
|
41
|
-
/**
|
|
42
|
-
* AtomicNumberInput - Specialized numeric input component
|
|
43
|
-
*
|
|
44
|
-
* Wraps AtomicInput with:
|
|
45
|
-
* - Numeric keyboard
|
|
46
|
-
* - Number validation (min, max, format)
|
|
47
|
-
* - Parsed number callbacks
|
|
48
|
-
* - Automatic error states
|
|
49
|
-
*/
|
|
50
|
-
export const AtomicNumberInput = ({ min, max, step = 1, allowDecimal = false, onValueChange, onTextChange, value = '', state: externalState, helperText: externalHelperText, ...props }) => {
|
|
51
|
-
const [internalError, setInternalError] = useState(undefined);
|
|
52
|
-
/**
|
|
53
|
-
* Validate number and return error message if invalid
|
|
54
|
-
*/
|
|
55
|
-
const validateNumber = (text) => {
|
|
56
|
-
// Empty is valid (null value)
|
|
57
|
-
if (!text || text === '' || text === '-' || text === '.') {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
// Parse number
|
|
61
|
-
const num = parseFloat(text);
|
|
62
|
-
// Check if valid number
|
|
63
|
-
if (isNaN(num)) {
|
|
64
|
-
return 'Invalid number';
|
|
65
|
-
}
|
|
66
|
-
// Check min constraint
|
|
67
|
-
if (min !== undefined && num < min) {
|
|
68
|
-
return `Minimum value is ${min}`;
|
|
69
|
-
}
|
|
70
|
-
// Check max constraint
|
|
71
|
-
if (max !== undefined && num > max) {
|
|
72
|
-
return `Maximum value is ${max}`;
|
|
73
|
-
}
|
|
74
|
-
return undefined;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Handle text change with validation
|
|
78
|
-
*/
|
|
79
|
-
const handleChangeText = (text) => {
|
|
80
|
-
// Allow empty, minus sign, and decimal point during typing
|
|
81
|
-
if (text === '' || text === '-' || (allowDecimal && text === '.')) {
|
|
82
|
-
setInternalError(undefined);
|
|
83
|
-
onTextChange?.(text);
|
|
84
|
-
onValueChange?.(null);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
// Validate format
|
|
88
|
-
const decimalRegex = allowDecimal ? /^-?\d*\.?\d*$/ : /^-?\d*$/;
|
|
89
|
-
if (!decimalRegex.test(text)) {
|
|
90
|
-
// Invalid format, don't update
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
// Validate number
|
|
94
|
-
const error = validateNumber(text);
|
|
95
|
-
setInternalError(error);
|
|
96
|
-
// Call text callback
|
|
97
|
-
onTextChange?.(text);
|
|
98
|
-
// Call value callback with parsed number
|
|
99
|
-
if (!error && text !== '' && text !== '-' && text !== '.') {
|
|
100
|
-
const num = parseFloat(text);
|
|
101
|
-
onValueChange?.(isNaN(num) ? null : num);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
onValueChange?.(null);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* Validate on mount and when value/constraints change
|
|
109
|
-
*/
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
if (value) {
|
|
112
|
-
const error = validateNumber(value.toString());
|
|
113
|
-
setInternalError(error);
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
setInternalError(undefined);
|
|
117
|
-
}
|
|
118
|
-
}, [value, min, max]);
|
|
119
|
-
// Determine final state (external state overrides internal error)
|
|
120
|
-
const finalState = externalState || (internalError ? 'error' : 'default');
|
|
121
|
-
// Determine final helper text (internal error overrides external helper)
|
|
122
|
-
const finalHelperText = internalError || externalHelperText;
|
|
123
|
-
return (<AtomicInput {...props} value={value} onChangeText={handleChangeText} keyboardType={allowDecimal ? 'decimal-pad' : 'numeric'} state={finalState} helperText={finalHelperText}/>);
|
|
124
|
-
};
|
|
125
|
-
//# sourceMappingURL=AtomicNumberInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicNumberInput.js","sourceRoot":"","sources":["../../../src/presentation/atoms/AtomicNumberInput.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,WAAW,EAAoB,MAAM,eAAe,CAAC;AAyB9D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAqC,CAAC,EAClE,GAAG,EACH,GAAG,EACH,IAAI,GAAG,CAAC,EACR,YAAY,GAAG,KAAK,EACpB,aAAa,EACb,YAAY,EACZ,KAAK,GAAG,EAAE,EACV,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,kBAAkB,EAC9B,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAqB,SAAS,CAAC,CAAC;IAElF;;OAEG;IACH,MAAM,cAAc,GAAG,CAAC,IAAY,EAAsB,EAAE;QAC1D,8BAA8B;QAC9B,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACzD,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,eAAe;QACf,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QAE7B,wBAAwB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
-
* Features:
|
|
7
|
-
* - Single and multi-select support
|
|
8
|
-
* - Modal display mode (full-screen on mobile)
|
|
9
|
-
* - Optional search/filter capability
|
|
10
|
-
* - Error and disabled states
|
|
11
|
-
* - Theme-aware styling
|
|
12
|
-
* - Icons for options
|
|
13
|
-
* - Clearable selection
|
|
14
|
-
* - react-hook-form integration ready
|
|
15
|
-
*
|
|
16
|
-
* Architecture:
|
|
17
|
-
* - Follows AtomicButton pattern with separated types and styles
|
|
18
|
-
* - Uses helper functions from picker/styles/pickerStyles.ts
|
|
19
|
-
* - Types defined in picker/types/index.ts
|
|
20
|
-
* - Zero inline StyleSheet.create()
|
|
21
|
-
*
|
|
22
|
-
* Usage:
|
|
23
|
-
* ```tsx
|
|
24
|
-
* const [partyType, setPartyType] = useState('birthday');
|
|
25
|
-
*
|
|
26
|
-
* <AtomicPicker
|
|
27
|
-
* value={partyType}
|
|
28
|
-
* onChange={setPartyType}
|
|
29
|
-
* options={[
|
|
30
|
-
* { label: 'Birthday Party', value: 'birthday', icon: 'cake' },
|
|
31
|
-
* { label: 'Wedding', value: 'wedding', icon: 'heart' },
|
|
32
|
-
* { label: 'Corporate Event', value: 'corporate', icon: 'briefcase' },
|
|
33
|
-
* ]}
|
|
34
|
-
* label="Party Type"
|
|
35
|
-
* placeholder="Select party type"
|
|
36
|
-
* searchable
|
|
37
|
-
* />
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* @module AtomicPicker
|
|
41
|
-
*/
|
|
42
|
-
import React from 'react';
|
|
43
|
-
import { AtomicPickerProps } from './picker/types';
|
|
44
|
-
export type { AtomicPickerProps, PickerOption, PickerSize } from './picker/types';
|
|
45
|
-
/**
|
|
46
|
-
* AtomicPicker - Universal option picker component
|
|
47
|
-
*
|
|
48
|
-
* Displays a button that opens a modal for selection.
|
|
49
|
-
* Supports single/multi-select, search, and custom rendering.
|
|
50
|
-
*/
|
|
51
|
-
export declare const AtomicPicker: React.FC<AtomicPickerProps>;
|
|
52
|
-
//# sourceMappingURL=AtomicPicker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AtomicPicker.d.ts","sourceRoot":"","sources":["../../../src/presentation/atoms/AtomicPicker.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAA4B,MAAM,OAAO,CAAC;AAYjD,OAAO,EAAE,iBAAiB,EAAgB,MAAM,gBAAgB,CAAC;AAyBjE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAElF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAkXpD,CAAC"}
|