@rn-components-dropdown/dropdown 1.0.27 → 1.0.29

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 (49) hide show
  1. package/dist/components/dropdown/Dropdown.js +113 -148
  2. package/dist/components/dropdown/DropdownStyle.d.ts +11 -11
  3. package/dist/components/dropdown/DropdownStyle.js +20 -24
  4. package/dist/components/dropdown/component/chip/Chip.js +14 -19
  5. package/dist/components/dropdown/component/chip/ChipStyle.d.ts +8 -18
  6. package/dist/components/dropdown/component/chip/ChipStyle.js +8 -10
  7. package/dist/components/dropdown/component/input/TextInput.js +12 -50
  8. package/dist/components/dropdown/component/input/TextInputStyle.d.ts +4 -4
  9. package/dist/components/dropdown/component/input/TextInputStyle.js +7 -11
  10. package/dist/components/dropdown/hooks/useDetectDevice.js +6 -9
  11. package/dist/components/dropdown/hooks/useDropdown.d.ts +8 -4
  12. package/dist/components/dropdown/hooks/useDropdown.js +48 -53
  13. package/dist/components/dropdown/hooks/useOrientation.js +7 -10
  14. package/dist/components/dropdown/interface/ChipInterface.js +1 -2
  15. package/dist/components/dropdown/interface/DropdownInterface.d.ts +4 -4
  16. package/dist/components/dropdown/interface/DropdownInterface.js +1 -2
  17. package/dist/components/dropdown/interface/InputProps.js +1 -2
  18. package/dist/components/svgButton/SvgButton.js +8 -13
  19. package/dist/components/svgButton/SvgButtonStyle.d.ts +2 -2
  20. package/dist/components/svgButton/SvgButtonStyle.js +7 -11
  21. package/dist/components/text/AppText.js +8 -16
  22. package/dist/components/text/AppTextStyle.d.ts +3 -156
  23. package/dist/components/text/AppTextStyle.js +8 -13
  24. package/dist/components/textInput/AppTextInput.js +19 -57
  25. package/dist/components/textInput/AppTextInputStyle.d.ts +4 -4
  26. package/dist/components/textInput/AppTextInputStyle.js +16 -20
  27. package/dist/controller/dropDownController/DropdownController.d.ts +4 -5
  28. package/dist/controller/dropDownController/DropdownController.js +13 -18
  29. package/dist/controller/dropDownController/DropdownControllerStyle.d.ts +3 -3
  30. package/dist/controller/dropDownController/DropdownControllerStyle.js +10 -14
  31. package/dist/index.js +2 -10
  32. package/dist/interface/colors.interface.js +1 -2
  33. package/dist/interface/svg.interface.js +1 -2
  34. package/dist/style/colors.js +6 -9
  35. package/dist/style/index.js +6 -23
  36. package/dist/style/shadow.d.ts +0 -149
  37. package/dist/style/shadow.js +1 -147
  38. package/dist/style/spacing.d.ts +0 -12
  39. package/dist/style/spacing.js +2 -17
  40. package/package.json +1 -1
  41. package/src/components/dropdown/Dropdown.tsx +28 -26
  42. package/src/components/dropdown/hooks/useDropdown.ts +14 -3
  43. package/src/components/dropdown/interface/DropdownInterface.ts +4 -4
  44. package/src/components/text/AppText.tsx +0 -3
  45. package/src/components/text/AppTextStyle.ts +1 -3
  46. package/src/controller/dropDownController/DropdownController.tsx +18 -17
  47. package/src/style/shadow.ts +0 -143
  48. package/src/style/spacing.ts +1 -13
  49. package/tsconfig.json +8 -4
@@ -1,24 +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 AppTextStyle_1 = require("./AppTextStyle");
8
- const react_native_1 = require("react-native");
1
+ import React from 'react';
2
+ import { useAppTextStyle } from './AppTextStyle';
3
+ import { Text } from 'react-native';
9
4
  const AppText = ({ size, style, color, children, type = 'normal', fontFamily = 'regular', required, ...props }) => {
10
5
  const family = fontFamily;
11
- const styles = (0, AppTextStyle_1.useAppTextStyle)({
12
- style: {
13
- fontFamily: family,
14
- },
6
+ const styles = useAppTextStyle({
15
7
  size,
16
8
  color,
17
9
  type,
18
10
  });
19
- return (<react_native_1.Text allowFontScaling={false} style={[styles.container, style]} {...props}>
11
+ return (<Text allowFontScaling={false} style={[styles.container, style]} {...props}>
20
12
  {children}
21
- {required && <react_native_1.Text style={styles.require}>*</react_native_1.Text>}
22
- </react_native_1.Text>);
13
+ {required && <Text style={styles.require}>*</Text>}
14
+ </Text>);
23
15
  };
24
- exports.default = AppText;
16
+ export default AppText;
@@ -5,166 +5,13 @@ interface props {
5
5
  color?: ColorValue;
6
6
  type?: 'error' | 'normal';
7
7
  }
8
- export declare const useAppTextStyle: ({ size, style, color, type, }: props) => {
8
+ export declare const useAppTextStyle: ({ size, color, type, }: props) => Readonly<{
9
9
  container: {
10
- color: ColorValue;
11
- fontFamily?: string | undefined;
12
10
  fontSize: number;
13
- fontStyle?: "normal" | "italic" | undefined;
14
- 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;
15
- letterSpacing?: number | undefined;
16
- lineHeight?: number | undefined;
17
- textAlign?: "auto" | "left" | "right" | "center" | "justify" | undefined;
18
- textDecorationLine?: "none" | "underline" | "line-through" | "underline line-through" | undefined;
19
- textDecorationStyle?: "solid" | "double" | "dotted" | "dashed" | undefined;
20
- textDecorationColor?: ColorValue | undefined;
21
- textShadowColor?: ColorValue | undefined;
22
- textShadowOffset?: {
23
- width: number;
24
- height: number;
25
- } | undefined;
26
- textShadowRadius?: number | undefined;
27
- textTransform?: "none" | "capitalize" | "uppercase" | "lowercase" | undefined;
28
- userSelect?: "auto" | "none" | "text" | "contain" | "all" | undefined;
29
- fontVariant?: import("react-native").FontVariant[] | undefined;
30
- writingDirection?: "auto" | "ltr" | "rtl" | undefined;
31
- backfaceVisibility?: "visible" | "hidden" | undefined;
32
- backgroundColor?: ColorValue | undefined;
33
- borderBlockColor?: ColorValue | undefined;
34
- borderBlockEndColor?: ColorValue | undefined;
35
- borderBlockStartColor?: ColorValue | undefined;
36
- borderBottomColor?: ColorValue | undefined;
37
- borderBottomEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
38
- borderBottomLeftRadius?: import("react-native").AnimatableNumericValue | string | undefined;
39
- borderBottomRightRadius?: import("react-native").AnimatableNumericValue | string | undefined;
40
- borderBottomStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
41
- borderColor?: ColorValue | undefined;
42
- borderCurve?: "circular" | "continuous" | undefined;
43
- borderEndColor?: ColorValue | undefined;
44
- borderEndEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
45
- borderEndStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
46
- borderLeftColor?: ColorValue | undefined;
47
- borderRadius?: import("react-native").AnimatableNumericValue | string | undefined;
48
- borderRightColor?: ColorValue | undefined;
49
- borderStartColor?: ColorValue | undefined;
50
- borderStartEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
51
- borderStartStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
52
- borderStyle?: "solid" | "dotted" | "dashed" | undefined;
53
- borderTopColor?: ColorValue | undefined;
54
- borderTopEndRadius?: import("react-native").AnimatableNumericValue | string | undefined;
55
- borderTopLeftRadius?: import("react-native").AnimatableNumericValue | string | undefined;
56
- borderTopRightRadius?: import("react-native").AnimatableNumericValue | string | undefined;
57
- borderTopStartRadius?: import("react-native").AnimatableNumericValue | string | undefined;
58
- outlineColor?: ColorValue | undefined;
59
- outlineOffset?: import("react-native").AnimatableNumericValue | undefined;
60
- outlineStyle?: "solid" | "dotted" | "dashed" | undefined;
61
- outlineWidth?: import("react-native").AnimatableNumericValue | undefined;
62
- opacity?: import("react-native").AnimatableNumericValue | undefined;
63
- elevation?: number | undefined;
64
- pointerEvents?: "box-none" | "none" | "box-only" | "auto" | undefined;
65
- isolation?: "auto" | "isolate" | undefined;
66
- cursor?: import("react-native").CursorValue | undefined;
67
- boxShadow?: ReadonlyArray<import("react-native").BoxShadowValue> | string | undefined;
68
- filter?: ReadonlyArray<import("react-native").FilterFunction> | string | undefined;
69
- mixBlendMode?: import("react-native").BlendMode | undefined;
70
- experimental_backgroundImage?: ReadonlyArray<import("react-native").GradientValue> | string | undefined;
71
- alignContent?: "flex-start" | "flex-end" | "center" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
72
- alignItems?: import("react-native").FlexAlignType | undefined;
73
- alignSelf?: "auto" | import("react-native").FlexAlignType | undefined;
74
- aspectRatio?: number | string | undefined;
75
- borderBottomWidth?: number | undefined;
76
- borderEndWidth?: number | undefined;
77
- borderLeftWidth?: number | undefined;
78
- borderRightWidth?: number | undefined;
79
- borderStartWidth?: number | undefined;
80
- borderTopWidth?: number | undefined;
81
- borderWidth?: number | undefined;
82
- bottom?: import("react-native").DimensionValue | undefined;
83
- boxSizing?: "border-box" | "content-box" | undefined;
84
- display?: "none" | "flex" | "contents" | undefined;
85
- end?: import("react-native").DimensionValue | undefined;
86
- flex?: number | undefined;
87
- flexBasis?: import("react-native").DimensionValue | undefined;
88
- flexDirection?: "row" | "column" | "row-reverse" | "column-reverse" | undefined;
89
- rowGap?: number | string | undefined;
90
- gap?: number | string | undefined;
91
- columnGap?: number | string | undefined;
92
- flexGrow?: number | undefined;
93
- flexShrink?: number | undefined;
94
- flexWrap?: "wrap" | "nowrap" | "wrap-reverse" | undefined;
95
- height?: import("react-native").DimensionValue | undefined;
96
- justifyContent?: "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly" | undefined;
97
- left?: import("react-native").DimensionValue | undefined;
98
- margin?: import("react-native").DimensionValue | undefined;
99
- marginBottom?: import("react-native").DimensionValue | undefined;
100
- marginEnd?: import("react-native").DimensionValue | undefined;
101
- marginHorizontal?: import("react-native").DimensionValue | undefined;
102
- marginLeft?: import("react-native").DimensionValue | undefined;
103
- marginRight?: import("react-native").DimensionValue | undefined;
104
- marginStart?: import("react-native").DimensionValue | undefined;
105
- marginTop?: import("react-native").DimensionValue | undefined;
106
- marginVertical?: import("react-native").DimensionValue | undefined;
107
- maxHeight?: import("react-native").DimensionValue | undefined;
108
- maxWidth?: import("react-native").DimensionValue | undefined;
109
- minHeight?: import("react-native").DimensionValue | undefined;
110
- minWidth?: import("react-native").DimensionValue | undefined;
111
- overflow?: "visible" | "hidden" | "scroll" | undefined;
112
- padding?: import("react-native").DimensionValue | undefined;
113
- paddingBottom?: import("react-native").DimensionValue | undefined;
114
- paddingEnd?: import("react-native").DimensionValue | undefined;
115
- paddingHorizontal?: import("react-native").DimensionValue | undefined;
116
- paddingLeft?: import("react-native").DimensionValue | undefined;
117
- paddingRight?: import("react-native").DimensionValue | undefined;
118
- paddingStart?: import("react-native").DimensionValue | undefined;
119
- paddingTop?: import("react-native").DimensionValue | undefined;
120
- paddingVertical?: import("react-native").DimensionValue | undefined;
121
- position?: "absolute" | "relative" | "static" | undefined;
122
- right?: import("react-native").DimensionValue | undefined;
123
- start?: import("react-native").DimensionValue | undefined;
124
- top?: import("react-native").DimensionValue | undefined;
125
- width?: import("react-native").DimensionValue | undefined;
126
- zIndex?: number | undefined;
127
- direction?: "inherit" | "ltr" | "rtl" | undefined;
128
- inset?: import("react-native").DimensionValue | undefined;
129
- insetBlock?: import("react-native").DimensionValue | undefined;
130
- insetBlockEnd?: import("react-native").DimensionValue | undefined;
131
- insetBlockStart?: import("react-native").DimensionValue | undefined;
132
- insetInline?: import("react-native").DimensionValue | undefined;
133
- insetInlineEnd?: import("react-native").DimensionValue | undefined;
134
- insetInlineStart?: import("react-native").DimensionValue | undefined;
135
- marginBlock?: import("react-native").DimensionValue | undefined;
136
- marginBlockEnd?: import("react-native").DimensionValue | undefined;
137
- marginBlockStart?: import("react-native").DimensionValue | undefined;
138
- marginInline?: import("react-native").DimensionValue | undefined;
139
- marginInlineEnd?: import("react-native").DimensionValue | undefined;
140
- marginInlineStart?: import("react-native").DimensionValue | undefined;
141
- paddingBlock?: import("react-native").DimensionValue | undefined;
142
- paddingBlockEnd?: import("react-native").DimensionValue | undefined;
143
- paddingBlockStart?: import("react-native").DimensionValue | undefined;
144
- paddingInline?: import("react-native").DimensionValue | undefined;
145
- paddingInlineEnd?: import("react-native").DimensionValue | undefined;
146
- paddingInlineStart?: import("react-native").DimensionValue | undefined;
147
- shadowColor?: ColorValue | undefined;
148
- shadowOffset?: Readonly<{
149
- width: number;
150
- height: number;
151
- }> | undefined;
152
- shadowOpacity?: import("react-native").AnimatableNumericValue | undefined;
153
- shadowRadius?: number | undefined;
154
- 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;
155
- transformOrigin?: Array<string | number> | string | undefined;
156
- transformMatrix?: Array<number> | undefined;
157
- rotation?: import("react-native").AnimatableNumericValue | undefined;
158
- scaleX?: import("react-native").AnimatableNumericValue | undefined;
159
- scaleY?: import("react-native").AnimatableNumericValue | undefined;
160
- translateX?: import("react-native").AnimatableNumericValue | undefined;
161
- translateY?: import("react-native").AnimatableNumericValue | undefined;
162
- textAlignVertical?: "auto" | "top" | "bottom" | "center" | undefined;
163
- verticalAlign?: "auto" | "top" | "bottom" | "middle" | undefined;
164
- includeFontPadding?: boolean | undefined;
11
+ color: string | number | import("react-native").NativeColorValue;
165
12
  };
166
13
  require: {
167
14
  color: string;
168
15
  };
169
- };
16
+ }>;
170
17
  export {};
@@ -1,23 +1,18 @@
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({
1
+ import { useMemo } from 'react';
2
+ import { LIGHT_COLORS } from '../../style';
3
+ import { StyleSheet } from 'react-native';
4
+ export const useAppTextStyle = ({ size, color, type = 'normal', }) => {
5
+ const { ...colors } = LIGHT_COLORS;
6
+ const styles = useMemo(() => {
7
+ return StyleSheet.create({
11
8
  container: {
12
9
  fontSize: size || 14,
13
10
  color: type === 'error' ? colors.error : color ? color : colors.primary,
14
- ...style,
15
11
  },
16
12
  require: {
17
13
  color: colors.error,
18
14
  },
19
15
  });
20
- }, [size, colors, style, type, color]);
16
+ }, [size, colors, type, color]);
21
17
  return styles;
22
18
  };
23
- exports.useAppTextStyle = useAppTextStyle;
@@ -1,53 +1,15 @@
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");
1
+ import { View, TextInput, } from 'react-native';
2
+ import AppText from '../text/AppText';
3
+ import SvgButton from '../svgButton/SvgButton';
4
+ import React, { useCallback, useState } from 'react';
5
+ import { useAppTextInputStyle } from './AppTextInputStyle';
44
6
  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)({
7
+ const { styles, colors } = useAppTextInputStyle({
46
8
  type,
47
9
  leftIcon,
48
10
  editable: rest?.editable,
49
11
  });
50
- const [secureTextEntry, setSecureTextEntry] = (0, react_1.useState)(type === 'password');
12
+ const [secureTextEntry, setSecureTextEntry] = useState(type === 'password');
51
13
  const handlePasswordIcon = () => {
52
14
  setSecureTextEntry(prev => !prev);
53
15
  };
@@ -63,16 +25,16 @@ const AppTextInput = ({ icon, type, error, label, style, value, onBlur, onFocus,
63
25
  return 'default';
64
26
  }
65
27
  };
66
- const renderIcon = (0, react_1.useCallback)((rightIcon, onPress) => (<SvgButton_1.default icon={rightIcon} onPress={onPress} style={[styles.rightIcon, rightIconStyle]}/>), [styles, rightIconStyle]);
28
+ const renderIcon = useCallback((rightIcon, onPress) => (<SvgButton icon={rightIcon} onPress={onPress} style={[styles.rightIcon, rightIconStyle]}/>), [styles, rightIconStyle]);
67
29
  return (<>
68
- {label ? (<AppText_1.default style={[styles.label, labelStyle]}>
30
+ {label ? (<AppText style={[styles.label, labelStyle]}>
69
31
  {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 => {
32
+ {required ? (<AppText style={[styles.label, styles.required]}>*</AppText>) : null}
33
+ </AppText>) : null}
34
+ <View style={styles.margin}>
35
+ <View style={[styles.container, style, error ? styles.errorWrapper : {}]}>
36
+ {leftIcon ? (<SvgButton icon={leftIcon} style={[styles.leftIcon, leftIconStyle]}/>) : null}
37
+ <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
38
  if (onFocus) {
77
39
  onFocus(e);
78
40
  }
@@ -81,9 +43,9 @@ const AppTextInput = ({ icon, type, error, label, style, value, onBlur, onFocus,
81
43
  ? renderIcon(icon, handlePasswordIcon)
82
44
  : null}
83
45
  {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>
46
+ </View>
47
+ {error && <AppText style={styles.error}>{error}</AppText>}
48
+ </View>
87
49
  </>);
88
50
  };
89
- exports.default = AppTextInput;
51
+ export default AppTextInput;
@@ -7,7 +7,7 @@ interface props {
7
7
  rightIcon?: ReactNode | ((state: PressableStateCallbackType) => ReactNode);
8
8
  }
9
9
  export declare const useAppTextInputStyle: ({ type, leftIcon, editable, }: props) => {
10
- styles: {
10
+ styles: Readonly<{
11
11
  container: {
12
12
  flexDirection: "row";
13
13
  alignItems: "center";
@@ -21,7 +21,7 @@ export declare const useAppTextInputStyle: ({ type, leftIcon, editable, }: props
21
21
  shadowOpacity: number;
22
22
  shadowRadius: number;
23
23
  elevation: number;
24
- width: "100%";
24
+ width: string;
25
25
  };
26
26
  margin: {
27
27
  marginBottom: number;
@@ -52,7 +52,7 @@ export declare const useAppTextInputStyle: ({ type, leftIcon, editable, }: props
52
52
  textInputStyles: {
53
53
  padding: number;
54
54
  height: number;
55
- width: "100%";
55
+ width: string;
56
56
  color: string;
57
57
  paddingLeft: number;
58
58
  paddingRight: number;
@@ -61,7 +61,7 @@ export declare const useAppTextInputStyle: ({ type, leftIcon, editable, }: props
61
61
  position: "absolute";
62
62
  left: number;
63
63
  };
64
- };
64
+ }>;
65
65
  colors: {
66
66
  blue: string;
67
67
  gray: string;
@@ -1,39 +1,36 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useAppTextInputStyle = void 0;
4
- const react_1 = require("react");
5
- const react_native_1 = require("react-native");
6
- const style_1 = require("../../style");
7
- const useAppTextInputStyle = ({ type, leftIcon, editable = true, }) => {
8
- const { ...colors } = style_1.LIGHT_COLORS;
9
- const styles = (0, react_1.useMemo)(() => {
10
- return react_native_1.StyleSheet.create({
1
+ import { useMemo } from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import { DEFAULT_COLORS, LIGHT_COLORS, SHADOW, SPACING } from '../../style';
4
+ export const useAppTextInputStyle = ({ type, leftIcon, editable = true, }) => {
5
+ const { ...colors } = LIGHT_COLORS;
6
+ const styles = useMemo(() => {
7
+ return StyleSheet.create({
11
8
  container: {
12
9
  width: '100%',
13
- ...style_1.SHADOW.shadow1,
10
+ ...SHADOW.shadow1,
14
11
  flexDirection: 'row',
15
12
  alignItems: 'center',
16
13
  opacity: !editable ? 0.5 : 1,
17
- backgroundColor: style_1.DEFAULT_COLORS.white,
14
+ backgroundColor: DEFAULT_COLORS.white,
18
15
  },
19
16
  margin: {
20
- marginBottom: style_1.SPACING.s10,
17
+ marginBottom: SPACING.s10,
21
18
  },
22
19
  rightIcon: {
23
20
  position: 'absolute',
24
- right: style_1.SPACING.s20,
21
+ right: SPACING.s20,
25
22
  },
26
23
  error: {
27
24
  textAlign: 'left',
28
- paddingTop: style_1.SPACING.s4,
25
+ paddingTop: SPACING.s4,
29
26
  alignSelf: 'flex-start',
30
27
  color: colors.red,
31
28
  },
32
29
  label: {
33
30
  color: colors.primary,
34
- marginBottom: style_1.SPACING.s12,
31
+ marginBottom: SPACING.s12,
35
32
  alignSelf: 'flex-start',
36
- marginTop: style_1.SPACING.s10,
33
+ marginTop: SPACING.s10,
37
34
  },
38
35
  required: {
39
36
  color: colors.red,
@@ -47,15 +44,14 @@ const useAppTextInputStyle = ({ type, leftIcon, editable = true, }) => {
47
44
  height: 48,
48
45
  width: '100%',
49
46
  color: colors.primary,
50
- paddingLeft: leftIcon ? style_1.SPACING.s45 : 16,
47
+ paddingLeft: leftIcon ? SPACING.s45 : 16,
51
48
  paddingRight: type === 'password' ? 50 : 16,
52
49
  },
53
50
  leftIcon: {
54
51
  position: 'absolute',
55
- left: style_1.SPACING.s14,
52
+ left: SPACING.s14,
56
53
  },
57
54
  });
58
55
  }, [editable, colors, leftIcon, type]);
59
56
  return { styles, colors };
60
57
  };
61
- exports.useAppTextInputStyle = useAppTextInputStyle;
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
- import { DropdownProps, SelectionType } from '../../components/dropdown/interface/DropdownInterface';
2
+ import { DropdownProps, SELECTIONS_TYPE } from '../../components/dropdown/interface/DropdownInterface';
3
3
  import { Control, FieldValues, Path } from 'react-hook-form';
4
- type DropControllerProps<S, T extends SelectionType, U extends FieldValues> = {
4
+ interface DropControllerProps<U extends FieldValues, S, T extends SELECTIONS_TYPE = 'single'> extends DropdownProps<S, T> {
5
5
  control: Control<U>;
6
6
  controller: Path<U>;
7
- dropProps: DropdownProps<S, T>;
8
- };
9
- declare const AppDropdownController: <S, T extends SelectionType, U extends FieldValues>(props: DropControllerProps<S, T, U>) => React.JSX.Element;
7
+ }
8
+ declare const AppDropdownController: <U extends FieldValues, S, T extends SELECTIONS_TYPE = "single">(props: DropControllerProps<U, S, T>) => React.JSX.Element;
10
9
  export default AppDropdownController;
@@ -1,25 +1,20 @@
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 AppText_1 = __importDefault(require("../../components/text/AppText"));
9
- const Dropdown_1 = __importDefault(require("../../components/dropdown/Dropdown"));
10
- const DropdownControllerStyle_1 = require("./DropdownControllerStyle");
11
- const react_hook_form_1 = require("react-hook-form");
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import AppText from '../../components/text/AppText';
4
+ import DropdownComponent from '../../components/dropdown/Dropdown';
5
+ import { useDropdownControllerStyle } from './DropdownControllerStyle';
6
+ import { Controller } from 'react-hook-form';
12
7
  const AppDropdownController = (props) => {
13
- const { control, controller, dropProps: { data, label, labelField, valueField, placeholder, selectionType, containerStyle, ...rest }, } = props;
14
- const { styles } = (0, DropdownControllerStyle_1.useDropdownControllerStyle)();
15
- return (<react_hook_form_1.Controller control={control} name={controller} render={({ fieldState: { error }, field: { onBlur, onChange, value }, }) => (<react_native_1.View style={styles.mainContainer}>
16
- <Dropdown_1.default data={data} value={value} label={label} onBlur={onBlur} onChange={(selectValue, selectedItem) => {
8
+ const { data, label, control, labelField, controller, valueField, placeholder, selectionType, containerStyle, ...rest } = props;
9
+ const { styles } = useDropdownControllerStyle();
10
+ return (<Controller control={control} name={controller} render={({ fieldState: { error }, field: { onBlur, onChange, value }, }) => (<View style={styles.mainContainer}>
11
+ <DropdownComponent data={data} value={value} label={label} onBlur={onBlur} onChange={(selectValue, selectedItem) => {
17
12
  if (selectionType === 'multi') {
18
13
  return onChange(selectedItem);
19
14
  }
20
15
  return onChange(selectValue);
21
16
  }} labelField={labelField} valueField={valueField} placeholder={placeholder} selectionType={selectionType} containerStyle={containerStyle} labelTextStyle={styles.labelText} itemTextStyle={styles.dropdownText} placeholderStyle={styles.itemContainer} selectedTextStyle={styles.selectionText} style={[styles.dropdownContainer, error && styles.errorWrapper]} {...rest}/>
22
- {error && <AppText_1.default style={styles.error}>{error?.message}</AppText_1.default>}
23
- </react_native_1.View>)}/>);
17
+ {error && <AppText style={styles.error}>{error?.message}</AppText>}
18
+ </View>)}/>);
24
19
  };
25
- exports.default = AppDropdownController;
20
+ export default AppDropdownController;
@@ -1,7 +1,7 @@
1
1
  export declare const useDropdownControllerStyle: () => {
2
- styles: {
2
+ styles: Readonly<{
3
3
  mainContainer: {
4
- width: "100%";
4
+ width: string;
5
5
  marginBottom: number;
6
6
  };
7
7
  dropdownContainer: {
@@ -33,7 +33,7 @@ export declare const useDropdownControllerStyle: () => {
33
33
  error: {
34
34
  color: string;
35
35
  };
36
- };
36
+ }>;
37
37
  colors: {
38
38
  blue: string;
39
39
  gray: string;
@@ -1,23 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useDropdownControllerStyle = void 0;
4
- const react_1 = require("react");
5
- const react_native_1 = require("react-native");
6
- const style_1 = require("../../style");
7
- const useDropdownControllerStyle = () => {
8
- const { ...colors } = style_1.LIGHT_COLORS;
9
- const styles = (0, react_1.useMemo)(() => {
10
- return react_native_1.StyleSheet.create({
1
+ import { useMemo } from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import { LIGHT_COLORS, SPACING } from '../../style';
4
+ export const useDropdownControllerStyle = () => {
5
+ const { ...colors } = LIGHT_COLORS;
6
+ const styles = useMemo(() => {
7
+ return StyleSheet.create({
11
8
  mainContainer: {
12
9
  width: '100%',
13
- marginBottom: style_1.SPACING?.s4,
10
+ marginBottom: SPACING?.s4,
14
11
  },
15
12
  dropdownContainer: {
16
13
  borderWidth: 1,
17
14
  borderRadius: 6,
18
- marginBottom: style_1.SPACING.s10,
15
+ marginBottom: SPACING.s10,
19
16
  borderColor: colors.border,
20
- paddingHorizontal: style_1.SPACING.s10,
17
+ paddingHorizontal: SPACING.s10,
21
18
  },
22
19
  labelText: {
23
20
  color: colors.gray,
@@ -45,4 +42,3 @@ const useDropdownControllerStyle = () => {
45
42
  }, [colors]);
46
43
  return { styles, colors };
47
44
  };
48
- exports.useDropdownControllerStyle = useDropdownControllerStyle;
package/dist/index.js CHANGED
@@ -1,10 +1,2 @@
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
- exports.DropdownController = exports.Dropdown = void 0;
7
- var Dropdown_1 = require("./components/dropdown/Dropdown");
8
- Object.defineProperty(exports, "Dropdown", { enumerable: true, get: function () { return __importDefault(Dropdown_1).default; } });
9
- var DropdownController_1 = require("./controller/dropDownController/DropdownController");
10
- Object.defineProperty(exports, "DropdownController", { enumerable: true, get: function () { return __importDefault(DropdownController_1).default; } });
1
+ export { default as Dropdown } from './components/dropdown/Dropdown';
2
+ export { default as DropdownController } from './controller/dropDownController/DropdownController';
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_COLORS = exports.THEMES = exports.DARK_COLORS = exports.LIGHT_COLORS = void 0;
4
- exports.LIGHT_COLORS = {
1
+ export const LIGHT_COLORS = {
5
2
  blue: '#0000ff',
6
3
  gray: '#5c5b5b',
7
4
  error: '#dc3545',
@@ -14,7 +11,7 @@ exports.LIGHT_COLORS = {
14
11
  red: 'rgba(205, 46, 49, 1)',
15
12
  border: 'rgba(224, 224, 224, 1)',
16
13
  };
17
- exports.DARK_COLORS = {
14
+ export const DARK_COLORS = {
18
15
  blue: '#0000ff',
19
16
  gray: '#5c5b5b',
20
17
  error: '#dc3545',
@@ -27,17 +24,17 @@ exports.DARK_COLORS = {
27
24
  red: 'rgba(205, 46, 49, 1)',
28
25
  border: 'rgba(224, 224, 224, 1)',
29
26
  };
30
- exports.THEMES = {
27
+ export const THEMES = {
31
28
  light: {
32
29
  mode: 'light',
33
- colors: exports.LIGHT_COLORS,
30
+ colors: LIGHT_COLORS,
34
31
  },
35
32
  dark: {
36
33
  mode: 'dark',
37
- colors: exports.DARK_COLORS,
34
+ colors: DARK_COLORS,
38
35
  },
39
36
  };
40
- exports.DEFAULT_COLORS = {
37
+ export const DEFAULT_COLORS = {
41
38
  blue: '#3683BC',
42
39
  white: '#FFFFFF',
43
40
  blackOpacity: 'rgba(0, 0, 0, 0.5)',