@rn-components-dropdown/dropdown 1.0.0

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 (86) hide show
  1. package/dist/components/dropdown/Dropdown.d.ts +4 -0
  2. package/dist/components/dropdown/Dropdown.js +313 -0
  3. package/dist/components/dropdown/DropdownStyle.d.ts +151 -0
  4. package/dist/components/dropdown/DropdownStyle.js +148 -0
  5. package/dist/components/dropdown/components/chip/Chip.d.ts +3 -0
  6. package/dist/components/dropdown/components/chip/Chip.js +22 -0
  7. package/dist/components/dropdown/components/chip/ChipStyle.d.ts +84 -0
  8. package/dist/components/dropdown/components/chip/ChipStyle.js +63 -0
  9. package/dist/components/dropdown/components/input/TextInput.d.ts +3 -0
  10. package/dist/components/dropdown/components/input/TextInput.js +60 -0
  11. package/dist/components/dropdown/components/input/TextInputStyle.d.ts +32 -0
  12. package/dist/components/dropdown/components/input/TextInputStyle.js +33 -0
  13. package/dist/components/dropdown/hooks/useDetectDevice.d.ts +3 -0
  14. package/dist/components/dropdown/hooks/useDetectDevice.js +22 -0
  15. package/dist/components/dropdown/hooks/useDropdown.d.ts +26 -0
  16. package/dist/components/dropdown/hooks/useDropdown.js +263 -0
  17. package/dist/components/dropdown/hooks/useOrientation.d.ts +1 -0
  18. package/dist/components/dropdown/hooks/useOrientation.js +30 -0
  19. package/dist/components/dropdown/interface/ChipInterface.d.ts +8 -0
  20. package/dist/components/dropdown/interface/ChipInterface.js +2 -0
  21. package/dist/components/dropdown/interface/DropdownInterface.d.ts +71 -0
  22. package/dist/components/dropdown/interface/DropdownInterface.js +2 -0
  23. package/dist/components/dropdown/interface/InputProps.d.ts +8 -0
  24. package/dist/components/dropdown/interface/InputProps.js +2 -0
  25. package/dist/components/svgButton/SvgButton.d.ts +11 -0
  26. package/dist/components/svgButton/SvgButton.js +16 -0
  27. package/dist/components/svgButton/SvgButtonStyle.d.ts +28 -0
  28. package/dist/components/svgButton/SvgButtonStyle.js +29 -0
  29. package/dist/components/text/AppText.d.ts +12 -0
  30. package/dist/components/text/AppText.js +24 -0
  31. package/dist/components/text/AppTextStyle.d.ts +171 -0
  32. package/dist/components/text/AppTextStyle.js +27 -0
  33. package/dist/components/textInput/AppTextInput.d.ts +20 -0
  34. package/dist/components/textInput/AppTextInput.js +89 -0
  35. package/dist/components/textInput/AppTextInputStyle.d.ts +79 -0
  36. package/dist/components/textInput/AppTextInputStyle.js +61 -0
  37. package/dist/controller/dropDownController/DropdownController.d.ts +10 -0
  38. package/dist/controller/dropDownController/DropdownController.js +25 -0
  39. package/dist/controller/dropDownController/DropdownControllerStyle.d.ts +50 -0
  40. package/dist/controller/dropDownController/DropdownControllerStyle.js +48 -0
  41. package/dist/controller/textInputController/AppTextInputController.d.ts +13 -0
  42. package/dist/controller/textInputController/AppTextInputController.js +14 -0
  43. package/dist/controller/textInputController/InputControllerStyle.d.ts +31 -0
  44. package/dist/controller/textInputController/InputControllerStyle.js +29 -0
  45. package/dist/index.d.ts +5 -0
  46. package/dist/index.js +16 -0
  47. package/dist/interface/colors.interface.d.ts +20 -0
  48. package/dist/interface/colors.interface.js +2 -0
  49. package/dist/style/colors.d.ts +33 -0
  50. package/dist/style/colors.js +44 -0
  51. package/dist/style/index.d.ts +7 -0
  52. package/dist/style/index.js +29 -0
  53. package/dist/style/shadow.d.ts +161 -0
  54. package/dist/style/shadow.js +158 -0
  55. package/dist/style/spacing.d.ts +23 -0
  56. package/dist/style/spacing.js +26 -0
  57. package/package.json +33 -0
  58. package/src/components/dropdown/Dropdown.tsx +512 -0
  59. package/src/components/dropdown/DropdownStyle.ts +154 -0
  60. package/src/components/dropdown/components/chip/Chip.tsx +31 -0
  61. package/src/components/dropdown/components/chip/ChipStyle.ts +64 -0
  62. package/src/components/dropdown/components/input/TextInput.tsx +46 -0
  63. package/src/components/dropdown/components/input/TextInputStyle.ts +32 -0
  64. package/src/components/dropdown/hooks/useDetectDevice.ts +25 -0
  65. package/src/components/dropdown/hooks/useDropdown.ts +356 -0
  66. package/src/components/dropdown/hooks/useOrientation.ts +36 -0
  67. package/src/components/dropdown/interface/ChipInterface.ts +9 -0
  68. package/src/components/dropdown/interface/DropdownInterface.ts +90 -0
  69. package/src/components/dropdown/interface/InputProps.ts +9 -0
  70. package/src/components/svgButton/SvgButton.tsx +37 -0
  71. package/src/components/svgButton/SvgButtonStyle.ts +27 -0
  72. package/src/components/text/AppText.tsx +41 -0
  73. package/src/components/text/AppTextStyle.ts +40 -0
  74. package/src/components/textInput/AppTextInput.tsx +148 -0
  75. package/src/components/textInput/AppTextInputStyle.ts +72 -0
  76. package/src/controller/dropDownController/DropdownController.tsx +81 -0
  77. package/src/controller/dropDownController/DropdownControllerStyle.ts +47 -0
  78. package/src/controller/textInputController/AppTextInputController.tsx +50 -0
  79. package/src/controller/textInputController/InputControllerStyle.ts +28 -0
  80. package/src/index.ts +5 -0
  81. package/src/interface/colors.interface.ts +22 -0
  82. package/src/style/colors.ts +46 -0
  83. package/src/style/index.ts +14 -0
  84. package/src/style/shadow.ts +155 -0
  85. package/src/style/spacing.ts +23 -0
  86. package/tsconfig.json +13 -0
@@ -0,0 +1,71 @@
1
+ import React from 'react';
2
+ import type { StyleProp, TextStyle, ViewStyle, TextProps, ImageStyle, FlatListProps } from 'react-native';
3
+ import { ThemeColors } from '../../../interface/colors.interface';
4
+ export type IDropdownRef = {
5
+ open: () => void;
6
+ close: () => void;
7
+ };
8
+ export type SelectionType = 'single' | 'multi';
9
+ export type DropdownProps<S, T extends SelectionType> = {
10
+ data: S[];
11
+ testID?: string;
12
+ search?: boolean;
13
+ disable?: boolean;
14
+ selectionType?: T;
15
+ maxHeight?: number;
16
+ iconColor?: string;
17
+ minHeight?: number;
18
+ inverted?: boolean;
19
+ fontFamily?: string;
20
+ labelField: keyof S;
21
+ valueField: keyof S;
22
+ onBlur?: () => void;
23
+ placeholder?: string;
24
+ onFocus?: () => void;
25
+ autoScroll?: boolean;
26
+ searchField?: keyof S;
27
+ value?: S[] | undefined;
28
+ itemTestIDField?: string;
29
+ backgroundColor?: string;
30
+ keyboardAvoiding?: boolean;
31
+ searchPlaceholder?: string;
32
+ label?: string | undefined;
33
+ confirmSelectItem?: boolean;
34
+ accessibilityLabel?: string;
35
+ style?: StyleProp<ViewStyle>;
36
+ subfixIcon?: React.JSX.Element;
37
+ onClear?: (id?: number) => void;
38
+ multiSelectIcon?: React.JSX.Element;
39
+ checkIconColor?: keyof ThemeColors;
40
+ radioIconColor?: keyof ThemeColors;
41
+ onChange?: (selecteValue?: keyof S, selectedList?: SelectionType extends 'single' | 'multi' ? S[] : S) => void;
42
+ selectedTextProps?: TextProps;
43
+ activeColor?: keyof ThemeColors;
44
+ iconStyle?: StyleProp<ImageStyle>;
45
+ mode?: 'default' | 'modal' | 'auto';
46
+ itemTextStyle?: StyleProp<TextStyle>;
47
+ itemAccessibilityLabelField?: string;
48
+ labelContainer?: StyleProp<ViewStyle>;
49
+ containerStyle?: StyleProp<ViewStyle>;
50
+ labelTextStyle?: StyleProp<TextStyle>;
51
+ showsVerticalScrollIndicator?: boolean;
52
+ placeholderStyle?: StyleProp<TextStyle>;
53
+ inputSearchStyle?: StyleProp<TextStyle>;
54
+ onChangeText?: (search: string) => void;
55
+ onConfirmSelectItem?: (item: T) => void;
56
+ selectedTextStyle?: StyleProp<TextStyle>;
57
+ itemContainerStyle?: StyleProp<ViewStyle>;
58
+ dropdownPosition?: 'auto' | 'top' | 'bottom';
59
+ ref?: React.RefObject<IDropdownRef> | null | undefined;
60
+ searchQuery?: (keyword: string, labelValue: string) => boolean;
61
+ flatListProps?: Omit<FlatListProps<any>, 'renderItem' | 'data'>;
62
+ renderRightIcon?: (visible?: boolean) => React.JSX.Element | null | undefined;
63
+ renderLeftIcon?: (visible?: boolean) => React.JSX.Element | null | undefined;
64
+ renderItem?: (item: S, selected?: boolean) => React.JSX.Element | null | undefined;
65
+ renderInputSearch?: (onSearch: (text: string) => void) => React.JSX.Element | null | undefined;
66
+ };
67
+ export interface IUseDetectDevice {
68
+ isAndroid: boolean;
69
+ isIOS: boolean;
70
+ isTablet: boolean;
71
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import type React from 'react';
2
+ import type { StyleProp, ViewStyle, TextInputProps } from 'react-native';
3
+ interface Props extends TextInputProps {
4
+ style?: StyleProp<ViewStyle>;
5
+ searchIcon?: React.JSX.Element;
6
+ }
7
+ export type CTextInput = React.FC<Props>;
8
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { StyleProp, ViewStyle, PressableProps } from 'react-native';
3
+ interface Props {
4
+ isFab?: boolean;
5
+ onPress?: () => void;
6
+ icon?: React.JSX.Element;
7
+ style?: StyleProp<ViewStyle>;
8
+ pressableProps?: PressableProps;
9
+ }
10
+ declare const SvgButton: React.MemoExoticComponent<({ icon, style, onPress, isFab, pressableProps, }: Props) => React.JSX.Element>;
11
+ export default SvgButton;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const SvgButtonStyle_1 = require("./SvgButtonStyle");
8
+ const react_native_1 = require("react-native");
9
+ const SvgButton = react_1.default.memo(({ icon, style, onPress, isFab = false, pressableProps, }) => {
10
+ const { styles } = (0, SvgButtonStyle_1.useSvgButtonStyle)();
11
+ const styleProp = isFab ? [styles?.favIcon, style] : style;
12
+ return (<react_native_1.Pressable hitSlop={10} style={styleProp} onPress={onPress} {...pressableProps}>
13
+ {icon && icon}
14
+ </react_native_1.Pressable>);
15
+ });
16
+ exports.default = SvgButton;
@@ -0,0 +1,28 @@
1
+ export declare const useSvgButtonStyle: () => {
2
+ styles: {
3
+ favIcon: {
4
+ width: number;
5
+ right: number;
6
+ height: number;
7
+ bottom: number;
8
+ borderRadius: number;
9
+ position: "absolute";
10
+ alignItems: "center";
11
+ justifyContent: "center";
12
+ backgroundColor: string;
13
+ };
14
+ };
15
+ colors: {
16
+ blue: string;
17
+ gray: string;
18
+ error: string;
19
+ green: string;
20
+ white: string;
21
+ black: string;
22
+ primary: string;
23
+ lightGray: string;
24
+ grayishBlue: string;
25
+ red: string;
26
+ border: string;
27
+ };
28
+ };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSvgButtonStyle = void 0;
4
+ const react_1 = require("react");
5
+ const react_native_1 = require("react-native");
6
+ const style_1 = require("../../style");
7
+ const useSvgButtonStyle = () => {
8
+ const { ...colors } = style_1.LIGHT_COLORS;
9
+ const styles = (0, react_1.useMemo)(() => {
10
+ return react_native_1.StyleSheet.create({
11
+ favIcon: {
12
+ width: 50,
13
+ right: 25,
14
+ height: 50,
15
+ bottom: 25,
16
+ borderRadius: 6,
17
+ position: 'absolute',
18
+ alignItems: 'center',
19
+ justifyContent: 'center',
20
+ backgroundColor: colors.green,
21
+ },
22
+ });
23
+ }, [colors]);
24
+ return {
25
+ styles,
26
+ colors,
27
+ };
28
+ };
29
+ exports.useSvgButtonStyle = useSvgButtonStyle;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { TextProps } from 'react-native';
3
+ import { ThemeColors } from '../../interface/colors.interface';
4
+ interface props extends TextProps {
5
+ size?: number;
6
+ fontFamily?: any;
7
+ required?: boolean;
8
+ color?: keyof ThemeColors;
9
+ type?: 'error' | 'normal';
10
+ }
11
+ declare const AppText: ({ size, style, color, children, type, fontFamily, required, ...props }: props) => React.JSX.Element;
12
+ export default AppText;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const react_native_1 = require("react-native");
8
+ const AppTextStyle_1 = require("./AppTextStyle");
9
+ const AppText = ({ size, style, color, children, type = 'normal', fontFamily = 'regular', required, ...props }) => {
10
+ const family = fontFamily;
11
+ const styles = (0, AppTextStyle_1.useAppTextStyle)({
12
+ style: {
13
+ fontFamily: family,
14
+ },
15
+ size,
16
+ color,
17
+ type,
18
+ });
19
+ return (<react_native_1.Text allowFontScaling={false} style={[styles.container, style]} {...props}>
20
+ {children}
21
+ {required && <react_native_1.Text style={styles.require}>*</react_native_1.Text>}
22
+ </react_native_1.Text>);
23
+ };
24
+ exports.default = AppText;
@@ -0,0 +1,171 @@
1
+ import { TextStyle } from 'react-native';
2
+ import { ThemeColors } from '../../interface/colors.interface';
3
+ interface props {
4
+ size?: number;
5
+ style?: TextStyle;
6
+ color?: keyof ThemeColors;
7
+ type?: 'error' | 'normal';
8
+ }
9
+ export declare const useAppTextStyle: ({ size, style, color, type, }: props) => {
10
+ container: {
11
+ color: import("react-native").ColorValue;
12
+ fontFamily?: string | undefined;
13
+ fontSize: number;
14
+ fontStyle?: "normal" | "italic" | undefined;
15
+ fontWeight?: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | "ultralight" | "thin" | "light" | "medium" | "regular" | "semibold" | "condensedBold" | "condensed" | "heavy" | "black" | undefined;
16
+ letterSpacing?: number | undefined;
17
+ lineHeight?: number | undefined;
18
+ textAlign?: "auto" | "left" | "right" | "center" | "justify" | undefined;
19
+ textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through" | undefined;
20
+ textDecorationStyle?: "solid" | "double" | "dotted" | "dashed" | undefined;
21
+ textDecorationColor?: import("react-native").ColorValue | undefined;
22
+ textShadowColor?: import("react-native").ColorValue | undefined;
23
+ textShadowOffset?: {
24
+ width: number;
25
+ height: number;
26
+ } | undefined;
27
+ textShadowRadius?: number | undefined;
28
+ textTransform?: "none" | "capitalize" | "uppercase" | "lowercase" | undefined;
29
+ userSelect?: "auto" | "none" | "text" | "contain" | "all" | undefined;
30
+ fontVariant?: import("react-native").FontVariant[] | undefined;
31
+ writingDirection?: "auto" | "ltr" | "rtl" | undefined;
32
+ backfaceVisibility?: "visible" | "hidden" | undefined;
33
+ backgroundColor?: import("react-native").ColorValue | undefined;
34
+ borderBlockColor?: import("react-native").ColorValue | undefined;
35
+ borderBlockEndColor?: import("react-native").ColorValue | undefined;
36
+ borderBlockStartColor?: import("react-native").ColorValue | undefined;
37
+ borderBottomColor?: import("react-native").ColorValue | undefined;
38
+ borderBottomEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
39
+ borderBottomLeftRadius?: import("react-native").AnimatableNumericValue | string | undefined;
40
+ borderBottomRightRadius?: import("react-native").AnimatableNumericValue | string | undefined;
41
+ borderBottomStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
42
+ borderColor?: import("react-native").ColorValue | undefined;
43
+ borderCurve?: "circular" | "continuous" | undefined;
44
+ borderEndColor?: import("react-native").ColorValue | undefined;
45
+ borderEndEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
46
+ borderEndStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
47
+ borderLeftColor?: import("react-native").ColorValue | undefined;
48
+ borderRadius?: import("react-native").AnimatableNumericValue | string | undefined;
49
+ borderRightColor?: import("react-native").ColorValue | undefined;
50
+ borderStartColor?: import("react-native").ColorValue | undefined;
51
+ borderStartEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
52
+ borderStartStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
53
+ borderStyle?: "solid" | "dotted" | "dashed" | undefined;
54
+ borderTopColor?: import("react-native").ColorValue | undefined;
55
+ borderTopEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
56
+ borderTopLeftRadius?: import("react-native").AnimatableNumericValue | string | undefined;
57
+ borderTopRightRadius?: import("react-native").AnimatableNumericValue | string | undefined;
58
+ borderTopStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
59
+ outlineColor?: import("react-native").ColorValue | undefined;
60
+ outlineOffset?: import("react-native").AnimatableNumericValue | undefined;
61
+ outlineStyle?: "solid" | "dotted" | "dashed" | undefined;
62
+ outlineWidth?: import("react-native").AnimatableNumericValue | undefined;
63
+ opacity?: import("react-native").AnimatableNumericValue | undefined;
64
+ elevation?: number | undefined;
65
+ pointerEvents?: "box-none" | "none" | "box-only" | "auto" | undefined;
66
+ isolation?: "auto" | "isolate" | undefined;
67
+ cursor?: import("react-native").CursorValue | undefined;
68
+ boxShadow?: ReadonlyArray<import("react-native").BoxShadowValue> | string | undefined;
69
+ filter?: ReadonlyArray<import("react-native").FilterFunction> | string | undefined;
70
+ mixBlendMode?: import("react-native").BlendMode | undefined;
71
+ experimental_backgroundImage?: ReadonlyArray<import("react-native").GradientValue> | string | undefined;
72
+ alignContent?: "flex-start" | "flex-end" | "center" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
73
+ alignItems?: import("react-native").FlexAlignType | undefined;
74
+ alignSelf?: "auto" | import("react-native").FlexAlignType | undefined;
75
+ aspectRatio?: number | string | undefined;
76
+ borderBottomWidth?: number | undefined;
77
+ borderEndWidth?: number | undefined;
78
+ borderLeftWidth?: number | undefined;
79
+ borderRightWidth?: number | undefined;
80
+ borderStartWidth?: number | undefined;
81
+ borderTopWidth?: number | undefined;
82
+ borderWidth?: number | undefined;
83
+ bottom?: import("react-native").DimensionValue | undefined;
84
+ boxSizing?: "border-box" | "content-box" | undefined;
85
+ display?: "none" | "flex" | "contents" | undefined;
86
+ end?: import("react-native").DimensionValue | undefined;
87
+ flex?: number | undefined;
88
+ flexBasis?: import("react-native").DimensionValue | undefined;
89
+ flexDirection?: "row" | "column" | "row-reverse" | "column-reverse" | undefined;
90
+ rowGap?: number | string | undefined;
91
+ gap?: number | string | undefined;
92
+ columnGap?: number | string | undefined;
93
+ flexGrow?: number | undefined;
94
+ flexShrink?: number | undefined;
95
+ flexWrap?: "wrap" | "nowrap" | "wrap-reverse" | undefined;
96
+ height?: import("react-native").DimensionValue | undefined;
97
+ justifyContent?: "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly" | undefined;
98
+ left?: import("react-native").DimensionValue | undefined;
99
+ margin?: import("react-native").DimensionValue | undefined;
100
+ marginBottom?: import("react-native").DimensionValue | undefined;
101
+ marginEnd?: import("react-native").DimensionValue | undefined;
102
+ marginHorizontal?: import("react-native").DimensionValue | undefined;
103
+ marginLeft?: import("react-native").DimensionValue | undefined;
104
+ marginRight?: import("react-native").DimensionValue | undefined;
105
+ marginStart?: import("react-native").DimensionValue | undefined;
106
+ marginTop?: import("react-native").DimensionValue | undefined;
107
+ marginVertical?: import("react-native").DimensionValue | undefined;
108
+ maxHeight?: import("react-native").DimensionValue | undefined;
109
+ maxWidth?: import("react-native").DimensionValue | undefined;
110
+ minHeight?: import("react-native").DimensionValue | undefined;
111
+ minWidth?: import("react-native").DimensionValue | undefined;
112
+ overflow?: "visible" | "hidden" | "scroll" | undefined;
113
+ padding?: import("react-native").DimensionValue | undefined;
114
+ paddingBottom?: import("react-native").DimensionValue | undefined;
115
+ paddingEnd?: import("react-native").DimensionValue | undefined;
116
+ paddingHorizontal?: import("react-native").DimensionValue | undefined;
117
+ paddingLeft?: import("react-native").DimensionValue | undefined;
118
+ paddingRight?: import("react-native").DimensionValue | undefined;
119
+ paddingStart?: import("react-native").DimensionValue | undefined;
120
+ paddingTop?: import("react-native").DimensionValue | undefined;
121
+ paddingVertical?: import("react-native").DimensionValue | undefined;
122
+ position?: "absolute" | "relative" | "static" | undefined;
123
+ right?: import("react-native").DimensionValue | undefined;
124
+ start?: import("react-native").DimensionValue | undefined;
125
+ top?: import("react-native").DimensionValue | undefined;
126
+ width?: import("react-native").DimensionValue | undefined;
127
+ zIndex?: number | undefined;
128
+ direction?: "inherit" | "ltr" | "rtl" | undefined;
129
+ inset?: import("react-native").DimensionValue | undefined;
130
+ insetBlock?: import("react-native").DimensionValue | undefined;
131
+ insetBlockEnd?: import("react-native").DimensionValue | undefined;
132
+ insetBlockStart?: import("react-native").DimensionValue | undefined;
133
+ insetInline?: import("react-native").DimensionValue | undefined;
134
+ insetInlineEnd?: import("react-native").DimensionValue | undefined;
135
+ insetInlineStart?: import("react-native").DimensionValue | undefined;
136
+ marginBlock?: import("react-native").DimensionValue | undefined;
137
+ marginBlockEnd?: import("react-native").DimensionValue | undefined;
138
+ marginBlockStart?: import("react-native").DimensionValue | undefined;
139
+ marginInline?: import("react-native").DimensionValue | undefined;
140
+ marginInlineEnd?: import("react-native").DimensionValue | undefined;
141
+ marginInlineStart?: import("react-native").DimensionValue | undefined;
142
+ paddingBlock?: import("react-native").DimensionValue | undefined;
143
+ paddingBlockEnd?: import("react-native").DimensionValue | undefined;
144
+ paddingBlockStart?: import("react-native").DimensionValue | undefined;
145
+ paddingInline?: import("react-native").DimensionValue | undefined;
146
+ paddingInlineEnd?: import("react-native").DimensionValue | undefined;
147
+ paddingInlineStart?: import("react-native").DimensionValue | undefined;
148
+ shadowColor?: import("react-native").ColorValue | undefined;
149
+ shadowOffset?: Readonly<{
150
+ width: number;
151
+ height: number;
152
+ }> | undefined;
153
+ shadowOpacity?: import("react-native").AnimatableNumericValue | undefined;
154
+ shadowRadius?: number | undefined;
155
+ transform?: Readonly<import("react-native").MaximumOneOf<import("react-native").PerspectiveTransform & import("react-native").RotateTransform & import("react-native").RotateXTransform & import("react-native").RotateYTransform & import("react-native").RotateZTransform & import("react-native").ScaleTransform & import("react-native").ScaleXTransform & import("react-native").ScaleYTransform & import("react-native").TranslateXTransform & import("react-native").TranslateYTransform & import("react-native").SkewXTransform & import("react-native").SkewYTransform & import("react-native").MatrixTransform>[]> | string | undefined;
156
+ transformOrigin?: Array<string | number> | string | undefined;
157
+ transformMatrix?: Array<number> | undefined;
158
+ rotation?: import("react-native").AnimatableNumericValue | undefined;
159
+ scaleX?: import("react-native").AnimatableNumericValue | undefined;
160
+ scaleY?: import("react-native").AnimatableNumericValue | undefined;
161
+ translateX?: import("react-native").AnimatableNumericValue | undefined;
162
+ translateY?: import("react-native").AnimatableNumericValue | undefined;
163
+ textAlignVertical?: "auto" | "top" | "bottom" | "center" | undefined;
164
+ verticalAlign?: "auto" | "top" | "bottom" | "middle" | undefined;
165
+ includeFontPadding?: boolean | undefined;
166
+ };
167
+ require: {
168
+ color: string;
169
+ };
170
+ };
171
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAppTextStyle = void 0;
4
+ const react_1 = require("react");
5
+ const style_1 = require("../../style");
6
+ const react_native_1 = require("react-native");
7
+ const useAppTextStyle = ({ size, style, color, type = 'normal', }) => {
8
+ const { ...colors } = style_1.LIGHT_COLORS;
9
+ const styles = (0, react_1.useMemo)(() => {
10
+ return react_native_1.StyleSheet.create({
11
+ container: {
12
+ fontSize: size || 14,
13
+ color: type === 'error'
14
+ ? colors.error
15
+ : color
16
+ ? colors[color]
17
+ : colors.primary,
18
+ ...style,
19
+ },
20
+ require: {
21
+ color: colors.error,
22
+ },
23
+ });
24
+ }, [size, colors, style, type, color]);
25
+ return styles;
26
+ };
27
+ exports.useAppTextStyle = useAppTextStyle;
@@ -0,0 +1,20 @@
1
+ import { StyleProp, TextStyle, ViewStyle, TextInputProps } from 'react-native';
2
+ import React from 'react';
3
+ export interface AppTextProps extends TextInputProps {
4
+ label?: string;
5
+ inputRef?: any;
6
+ required?: boolean;
7
+ icon?: React.JSX.Element;
8
+ error?: string | undefined;
9
+ leftIcon?: React.JSX.Element;
10
+ style?: StyleProp<ViewStyle>;
11
+ textStyle?: StyleProp<TextStyle>;
12
+ labelStyle?: StyleProp<TextStyle>;
13
+ leftIconStyle?: StyleProp<ViewStyle>;
14
+ rightIconStyle?: StyleProp<ViewStyle>;
15
+ onIconPress?: () => Promise<void> | undefined | void;
16
+ type?: 'password' | 'number' | 'email' | 'phone' | 'text';
17
+ autoCapitalize?: 'characters' | 'words' | 'sentences' | 'none';
18
+ }
19
+ declare const AppTextInput: ({ icon, type, error, label, style, value, onBlur, onFocus, required, leftIcon, inputRef, textStyle, onPressIn, labelStyle, placeholder, onIconPress, autoCorrect, onChangeText, leftIconStyle, rightIconStyle, textContentType, placeholderTextColor, ...rest }: AppTextProps) => React.JSX.Element;
20
+ export default AppTextInput;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const react_native_1 = require("react-native");
40
+ const AppText_1 = __importDefault(require("../text/AppText"));
41
+ const SvgButton_1 = __importDefault(require("../svgButton/SvgButton"));
42
+ const react_1 = __importStar(require("react"));
43
+ const AppTextInputStyle_1 = require("./AppTextInputStyle");
44
+ const AppTextInput = ({ icon, type, error, label, style, value, onBlur, onFocus, required, leftIcon, inputRef, textStyle, onPressIn, labelStyle, placeholder, onIconPress, autoCorrect, onChangeText, leftIconStyle, rightIconStyle, textContentType, placeholderTextColor, ...rest }) => {
45
+ const { styles, colors } = (0, AppTextInputStyle_1.useAppTextInputStyle)({
46
+ type,
47
+ leftIcon,
48
+ editable: rest?.editable,
49
+ });
50
+ const [secureTextEntry, setSecureTextEntry] = (0, react_1.useState)(type === 'password');
51
+ const handlePasswordIcon = () => {
52
+ setSecureTextEntry(prev => !prev);
53
+ };
54
+ const getKeyboardType = () => {
55
+ switch (type) {
56
+ case 'email':
57
+ return 'email-address';
58
+ case 'number':
59
+ return 'numeric';
60
+ case 'phone':
61
+ return 'phone-pad';
62
+ default:
63
+ return 'default';
64
+ }
65
+ };
66
+ const renderIcon = (0, react_1.useCallback)((rightIcon, onPress) => (<SvgButton_1.default icon={rightIcon} onPress={onPress} style={[styles.rightIcon, rightIconStyle]}/>), [styles, rightIconStyle]);
67
+ return (<>
68
+ {label ? (<AppText_1.default style={[styles.label, labelStyle]}>
69
+ {label}
70
+ {required ? (<AppText_1.default style={[styles.label, styles.required]}>*</AppText_1.default>) : null}
71
+ </AppText_1.default>) : null}
72
+ <react_native_1.View style={styles.margin}>
73
+ <react_native_1.View style={[styles.container, style, error ? styles.errorWrapper : {}]}>
74
+ {leftIcon ? (<SvgButton_1.default icon={leftIcon} style={[styles.leftIcon, leftIconStyle]}/>) : null}
75
+ <react_native_1.TextInput value={value} ref={inputRef} onBlur={onBlur} onPressIn={onPressIn} allowFontScaling={false} placeholder={placeholder} autoCorrect={autoCorrect} onChangeText={onChangeText} keyboardType={getKeyboardType()} textContentType={textContentType} secureTextEntry={secureTextEntry} style={[styles.textInputStyles, textStyle]} placeholderTextColor={placeholderTextColor || colors.gray} onFocus={e => {
76
+ if (onFocus) {
77
+ onFocus(e);
78
+ }
79
+ }} {...rest}/>
80
+ {type === 'password'
81
+ ? renderIcon(icon, handlePasswordIcon)
82
+ : null}
83
+ {icon && type !== 'password' ? renderIcon(icon, onIconPress) : null}
84
+ </react_native_1.View>
85
+ {error && <AppText_1.default style={styles.error}>{error}</AppText_1.default>}
86
+ </react_native_1.View>
87
+ </>);
88
+ };
89
+ exports.default = AppTextInput;
@@ -0,0 +1,79 @@
1
+ import { ReactNode } from 'react';
2
+ import { PressableStateCallbackType } from 'react-native';
3
+ interface props {
4
+ type?: any;
5
+ editable?: boolean;
6
+ leftIcon?: ReactNode | ((state: PressableStateCallbackType) => ReactNode);
7
+ rightIcon?: ReactNode | ((state: PressableStateCallbackType) => ReactNode);
8
+ }
9
+ export declare const useAppTextInputStyle: ({ type, leftIcon, editable, }: props) => {
10
+ styles: {
11
+ container: {
12
+ flexDirection: "row";
13
+ alignItems: "center";
14
+ opacity: number;
15
+ backgroundColor: string;
16
+ shadowColor: string;
17
+ shadowOffset: {
18
+ width: number;
19
+ height: number;
20
+ };
21
+ shadowOpacity: number;
22
+ shadowRadius: number;
23
+ elevation: number;
24
+ width: "100%";
25
+ };
26
+ margin: {
27
+ marginBottom: number;
28
+ };
29
+ rightIcon: {
30
+ position: "absolute";
31
+ right: number;
32
+ };
33
+ error: {
34
+ textAlign: "left";
35
+ paddingTop: number;
36
+ alignSelf: "flex-start";
37
+ color: string;
38
+ };
39
+ label: {
40
+ color: string;
41
+ marginBottom: number;
42
+ alignSelf: "flex-start";
43
+ marginTop: number;
44
+ };
45
+ required: {
46
+ color: string;
47
+ };
48
+ errorWrapper: {
49
+ borderWidth: number;
50
+ borderColor: string;
51
+ };
52
+ textInputStyles: {
53
+ padding: number;
54
+ height: number;
55
+ width: "100%";
56
+ color: string;
57
+ paddingLeft: number;
58
+ paddingRight: number;
59
+ };
60
+ leftIcon: {
61
+ position: "absolute";
62
+ left: number;
63
+ };
64
+ };
65
+ colors: {
66
+ blue: string;
67
+ gray: string;
68
+ error: string;
69
+ green: string;
70
+ white: string;
71
+ black: string;
72
+ primary: string;
73
+ lightGray: string;
74
+ grayishBlue: string;
75
+ red: string;
76
+ border: string;
77
+ };
78
+ };
79
+ export {};