@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,4 @@
1
+ import React from 'react';
2
+ import { DropdownProps } from './interface/DropdownInterface';
3
+ declare const DropdownComponent: <T, Mode extends "single" | "multi">(props: DropdownProps<T, Mode>) => React.JSX.Element;
4
+ export default DropdownComponent;
@@ -0,0 +1,313 @@
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
+ /* eslint-disable react-hooks/exhaustive-deps */
40
+ const react_1 = __importStar(require("react"));
41
+ const react_native_1 = require("react-native");
42
+ const lodash_1 = __importDefault(require("lodash"));
43
+ const AppText_1 = __importDefault(require("../text/AppText"));
44
+ const Chip_1 = __importDefault(require("./components/chip/Chip"));
45
+ const useDropdown_1 = __importDefault(require("./hooks/useDropdown"));
46
+ const SvgButton_1 = __importDefault(require("../svgButton/SvgButton"));
47
+ const DropdownStyle_1 = require("./DropdownStyle");
48
+ const TextInput_1 = __importDefault(require("./components/input/TextInput"));
49
+ const DropdownComponent = (props) => {
50
+ const { label, testID, iconStyle, renderItem, style = {}, subfixIcon, labelField, valueField, onChangeText, itemTextStyle, flatListProps, minHeight = 0, containerStyle, search = false, renderLeftIcon, multiSelectIcon, itemTestIDField, maxHeight = 300, inverted = true, renderRightIcon, backgroundColor, placeholderStyle, inputSearchStyle, searchPlaceholder, selectedTextStyle, renderInputSearch, iconColor = 'gray', accessibilityLabel, itemContainerStyle, labelContainer = {}, labelTextStyle = {}, selectedTextProps = {}, selectionType = 'single', activeColor = 'lightGray', keyboardAvoiding = true, dropdownPosition = 'auto', placeholder = 'Select item', itemAccessibilityLabelField, showsVerticalScrollIndicator = true, } = props;
51
+ const { styles, colors } = (0, DropdownStyle_1.useDropdownStyle)({});
52
+ const { ref, font, visible, refList, position, onSelect, listData, onSearch, onMeasure, searchText, showOrClose, scrollIndex, currentValue, onCheckPress, onClearPress, setSearchText, keyboardHeight, } = (0, useDropdown_1.default)({ ...props });
53
+ const renderRight = () => {
54
+ return renderRightIcon ? (renderRightIcon(visible)) : (<SvgButton_1.default icon={subfixIcon} onPress={showOrClose} style={react_native_1.StyleSheet.flatten([
55
+ iconStyle,
56
+ styles.icon,
57
+ { tintColor: iconColor },
58
+ ])}/>);
59
+ };
60
+ const _renderDropdown = () => {
61
+ const isSelected = currentValue && lodash_1.default.get(currentValue, valueField);
62
+ return (<react_native_1.TouchableWithoutFeedback testID={testID} accessible={!!accessibilityLabel} accessibilityLabel={accessibilityLabel} onPress={() => (selectionType === 'single' ? showOrClose() : null)}>
63
+ <react_native_1.View style={styles.dropdown}>
64
+ {renderLeftIcon?.(visible)}
65
+ {selectionType === 'single' ? (<AppText_1.default style={[
66
+ styles.textItem,
67
+ isSelected !== null ? selectedTextStyle : placeholderStyle,
68
+ font(),
69
+ ]} {...selectedTextProps}>
70
+ {isSelected !== null
71
+ ? lodash_1.default.get(currentValue, labelField)
72
+ : placeholder}
73
+ </AppText_1.default>) : currentValue?.length === 0 ? (<AppText_1.default style={[styles.textItem, placeholderStyle, font()]} {...selectedTextProps}>
74
+ {placeholder}
75
+ </AppText_1.default>) : (<react_native_1.View style={styles.showMultiSelectContainer}>
76
+ <react_native_1.ScrollView showsVerticalScrollIndicator={false}>
77
+ <react_native_1.View style={styles.wraps}>
78
+ {currentValue?.map?.((i) => (<Chip_1.default label={i.name} chipColor={'red'} textColor={'white'} key={i?.[valueField]} onClearPress={() => onClearPress(i)}/>))}
79
+ </react_native_1.View>
80
+ </react_native_1.ScrollView>
81
+ </react_native_1.View>)}
82
+ {renderRight()}
83
+ </react_native_1.View>
84
+ </react_native_1.TouchableWithoutFeedback>);
85
+ };
86
+ const renderRadio = (0, react_1.useCallback)((selected) => {
87
+ return (<react_native_1.View style={styles.itemIconContainer}>
88
+ {selected && <react_native_1.View style={styles.iconSubContainer}/>}
89
+ </react_native_1.View>);
90
+ }, [styles]);
91
+ const renderCheckItem = (0, react_1.useCallback)(({ item, index }) => {
92
+ const isSelected = lodash_1.default.some(currentValue, h => lodash_1.default.isEqual(lodash_1.default.get(h, valueField), lodash_1.default.get(item, valueField)));
93
+ return (<react_native_1.TouchableHighlight key={index.toString()} testID={lodash_1.default.get(item, itemTestIDField || labelField)} accessible={!!accessibilityLabel} accessibilityLabel={lodash_1.default.get(item, itemAccessibilityLabelField || labelField)} underlayColor={colors[activeColor]} onPress={() => onCheckPress(item)}>
94
+ <react_native_1.View style={react_native_1.StyleSheet.flatten([itemContainerStyle])}>
95
+ {renderItem ? (renderItem(item, isSelected)) : (<react_native_1.View style={styles.item}>
96
+ <SvgButton_1.default icon={multiSelectIcon} onPress={() => onCheckPress(item)} style={[
97
+ styles.checkContainer,
98
+ {
99
+ backgroundColor: isSelected ? colors.gray : colors.white,
100
+ },
101
+ ]}/>
102
+ <AppText_1.default style={react_native_1.StyleSheet.flatten([
103
+ styles.textItem,
104
+ itemTextStyle,
105
+ font(),
106
+ ])}>
107
+ {lodash_1.default.get(item, labelField)}
108
+ </AppText_1.default>
109
+ </react_native_1.View>)}
110
+ </react_native_1.View>
111
+ </react_native_1.TouchableHighlight>);
112
+ }, [
113
+ font,
114
+ colors,
115
+ styles,
116
+ labelField,
117
+ renderItem,
118
+ valueField,
119
+ activeColor,
120
+ currentValue,
121
+ itemTextStyle,
122
+ itemTestIDField,
123
+ accessibilityLabel,
124
+ itemContainerStyle,
125
+ itemAccessibilityLabelField,
126
+ ]);
127
+ const _renderItem = (0, react_1.useCallback)(({ item, index }) => {
128
+ const isSelected = currentValue && lodash_1.default.get(currentValue, valueField);
129
+ const selected = lodash_1.default.isEqual(lodash_1.default.get(item, valueField), isSelected);
130
+ lodash_1.default.assign(item, { _index: index });
131
+ return (<react_native_1.TouchableHighlight key={index.toString()} testID={lodash_1.default.get(item, itemTestIDField || labelField)} accessible={!!accessibilityLabel} accessibilityLabel={lodash_1.default.get(item, itemAccessibilityLabelField || labelField)} underlayColor={colors[activeColor]} onPress={() => onSelect(item)}>
132
+ <react_native_1.View style={react_native_1.StyleSheet.flatten([itemContainerStyle])}>
133
+ {renderItem ? (renderItem(item, selected)) : (<react_native_1.View style={styles.item}>
134
+ {renderRadio(selected)}
135
+ <AppText_1.default style={react_native_1.StyleSheet.flatten([
136
+ styles.textItem,
137
+ itemTextStyle,
138
+ font(),
139
+ ])}>
140
+ {lodash_1.default.get(item, labelField)}
141
+ </AppText_1.default>
142
+ </react_native_1.View>)}
143
+ </react_native_1.View>
144
+ </react_native_1.TouchableHighlight>);
145
+ }, [
146
+ font,
147
+ colors,
148
+ styles,
149
+ onSelect,
150
+ labelField,
151
+ renderItem,
152
+ valueField,
153
+ renderRadio,
154
+ activeColor,
155
+ currentValue,
156
+ itemTextStyle,
157
+ itemTestIDField,
158
+ accessibilityLabel,
159
+ itemContainerStyle,
160
+ itemAccessibilityLabelField,
161
+ ]);
162
+ const renderSearch = (0, react_1.useCallback)(() => {
163
+ if (search) {
164
+ if (renderInputSearch) {
165
+ return renderInputSearch(text => {
166
+ if (onChangeText) {
167
+ setSearchText(text);
168
+ onChangeText(text);
169
+ }
170
+ onSearch(text);
171
+ });
172
+ }
173
+ else {
174
+ return (<TextInput_1.default value={searchText} autoCorrect={false} testID={testID + ' input'} placeholder={searchPlaceholder} placeholderTextColor={colors.black} style={[styles.input, inputSearchStyle]} accessibilityLabel={accessibilityLabel + ' input'} onChangeText={(e) => {
175
+ if (onChangeText) {
176
+ setSearchText(e);
177
+ onChangeText(e);
178
+ }
179
+ onSearch(e);
180
+ }}/>);
181
+ }
182
+ }
183
+ return null;
184
+ }, [
185
+ search,
186
+ testID,
187
+ colors,
188
+ styles,
189
+ onSearch,
190
+ searchText,
191
+ onChangeText,
192
+ inputSearchStyle,
193
+ renderInputSearch,
194
+ searchPlaceholder,
195
+ accessibilityLabel,
196
+ ]);
197
+ const _renderList = (0, react_1.useCallback)((isTopPosition) => {
198
+ const isInverted = !inverted ? false : isTopPosition;
199
+ const _renderListHelper = () => {
200
+ return (<react_native_1.FlatList ref={refList} data={listData} {...flatListProps} testID={testID + ' flatlist'} keyboardShouldPersistTaps="handled" onScrollToIndexFailed={scrollIndex} inverted={isTopPosition ? inverted : false} keyExtractor={(_item, index) => index.toString()} accessibilityLabel={accessibilityLabel + ' flatlist'} showsVerticalScrollIndicator={showsVerticalScrollIndicator} renderItem={selectionType === 'single' ? _renderItem : renderCheckItem}/>);
201
+ };
202
+ return (<react_native_1.TouchableWithoutFeedback>
203
+ <react_native_1.View style={styles.flexShrink}>
204
+ {isInverted && _renderListHelper()}
205
+ {renderSearch()}
206
+ {!isInverted && _renderListHelper()}
207
+ </react_native_1.View>
208
+ </react_native_1.TouchableWithoutFeedback>);
209
+ }, [
210
+ inverted,
211
+ styles,
212
+ testID,
213
+ listData,
214
+ scrollIndex,
215
+ renderSearch,
216
+ flatListProps,
217
+ renderCheckItem,
218
+ accessibilityLabel,
219
+ showsVerticalScrollIndicator,
220
+ ]);
221
+ const _renderModal = (0, react_1.useCallback)(() => {
222
+ if (visible && position) {
223
+ const { isFull, width, height, top, bottom, left } = position;
224
+ const onAutoPosition = () => {
225
+ if (keyboardHeight > 0) {
226
+ return bottom < keyboardHeight + height;
227
+ }
228
+ return bottom < (search ? 150 : 100);
229
+ };
230
+ if (width && top && bottom) {
231
+ const styleVertical = {
232
+ left: left,
233
+ maxHeight: maxHeight,
234
+ minHeight: minHeight,
235
+ };
236
+ const isTopPosition = dropdownPosition === 'auto'
237
+ ? onAutoPosition()
238
+ : dropdownPosition === 'top';
239
+ let keyboardStyle = {};
240
+ let extendHeight = !isTopPosition ? top : bottom;
241
+ if (keyboardAvoiding &&
242
+ keyboardHeight > 0 &&
243
+ isTopPosition &&
244
+ dropdownPosition === 'auto') {
245
+ extendHeight = keyboardHeight;
246
+ }
247
+ return (<react_native_1.Modal transparent visible={visible} statusBarTranslucent onRequestClose={showOrClose} supportedOrientations={['landscape', 'portrait']}>
248
+ <react_native_1.TouchableWithoutFeedback onPress={showOrClose}>
249
+ <react_native_1.View style={react_native_1.StyleSheet.flatten([
250
+ styles.flex1,
251
+ isFull && styles.styleContainerVertical,
252
+ backgroundColor && { backgroundColor: backgroundColor },
253
+ keyboardStyle,
254
+ ])}>
255
+ <react_native_1.View style={react_native_1.StyleSheet.flatten([
256
+ styles.flex1,
257
+ !isTopPosition
258
+ ? { paddingTop: extendHeight }
259
+ : {
260
+ justifyContent: 'flex-end',
261
+ paddingBottom: extendHeight,
262
+ },
263
+ isFull && styles.fullScreen,
264
+ ])}>
265
+ <react_native_1.View style={react_native_1.StyleSheet.flatten([
266
+ styles.container,
267
+ isFull ? styles.styleHorizontal : styleVertical,
268
+ {
269
+ width,
270
+ },
271
+ containerStyle,
272
+ ])}>
273
+ {_renderList(isTopPosition)}
274
+ </react_native_1.View>
275
+ </react_native_1.View>
276
+ </react_native_1.View>
277
+ </react_native_1.TouchableWithoutFeedback>
278
+ </react_native_1.Modal>);
279
+ }
280
+ return null;
281
+ }
282
+ return null;
283
+ }, [
284
+ search,
285
+ styles,
286
+ visible,
287
+ position,
288
+ maxHeight,
289
+ minHeight,
290
+ showOrClose,
291
+ _renderList,
292
+ keyboardHeight,
293
+ containerStyle,
294
+ backgroundColor,
295
+ dropdownPosition,
296
+ keyboardAvoiding,
297
+ ]);
298
+ const _renderLabel = (0, react_1.useCallback)(() => {
299
+ return label ? (<react_native_1.View style={[styles.labelContainer, labelContainer]}>
300
+ <AppText_1.default style={[styles.labelTextStyle, labelTextStyle]}>
301
+ {label}
302
+ </AppText_1.default>
303
+ </react_native_1.View>) : (<></>);
304
+ }, [label, labelContainer, labelTextStyle, styles]);
305
+ return (<react_native_1.View style={styles.mainContainer}>
306
+ {_renderLabel()}
307
+ <react_native_1.View ref={ref} onLayout={onMeasure} style={react_native_1.StyleSheet.flatten([styles.mainWrap, style])}>
308
+ {_renderDropdown()}
309
+ {_renderModal()}
310
+ </react_native_1.View>
311
+ </react_native_1.View>);
312
+ };
313
+ exports.default = DropdownComponent;
@@ -0,0 +1,151 @@
1
+ import { ThemeColors } from '../../interface/colors.interface';
2
+ interface Props {
3
+ size?: number;
4
+ radioIconColor?: keyof ThemeColors;
5
+ checkIconColor?: keyof ThemeColors;
6
+ }
7
+ export declare const useDropdownStyle: (props: Props) => {
8
+ styles: {
9
+ mainContainer: {
10
+ width: "100%";
11
+ };
12
+ mainWrap: {
13
+ borderWidth: number;
14
+ borderRadius: number;
15
+ paddingHorizontal: number;
16
+ justifyContent: "center";
17
+ borderColor: string;
18
+ };
19
+ container: {
20
+ flexShrink: number;
21
+ borderWidth: number;
22
+ borderColor: string;
23
+ shadowColor: string;
24
+ backgroundColor: string;
25
+ shadowOffset: {
26
+ width: number;
27
+ height: number;
28
+ };
29
+ elevation: number;
30
+ shadowOpacity: number;
31
+ shadowRadius: number;
32
+ };
33
+ flex1: {
34
+ flex: number;
35
+ };
36
+ flexShrink: {
37
+ flexShrink: number;
38
+ };
39
+ wrapTop: {
40
+ justifyContent: "flex-end";
41
+ };
42
+ dropdown: {
43
+ minHeight: number;
44
+ maxHeight: number;
45
+ alignItems: "center";
46
+ justifyContent: "space-between";
47
+ flexDirection: "row" | "row-reverse";
48
+ };
49
+ title: {
50
+ fontSize: number;
51
+ marginVertical: number;
52
+ writingDirection: "ltr" | "rtl";
53
+ };
54
+ item: {
55
+ padding: number;
56
+ alignItems: "center";
57
+ borderBottomWidth: number;
58
+ borderColor: string;
59
+ justifyContent: "space-between";
60
+ flexDirection: "row" | "row-reverse";
61
+ };
62
+ textItem: {
63
+ flex: number;
64
+ fontSize: number;
65
+ writingDirection: "ltr" | "rtl";
66
+ };
67
+ icon: {
68
+ width: number;
69
+ height: number;
70
+ };
71
+ input: {
72
+ margin: number;
73
+ height: number;
74
+ borderWidth: number;
75
+ borderColor: string;
76
+ marginBottom: number;
77
+ paddingHorizontal: number;
78
+ };
79
+ fullScreen: {
80
+ alignItems: "center";
81
+ justifyContent: "center";
82
+ };
83
+ labelContainer: {
84
+ marginBottom: number;
85
+ paddingVertical: number;
86
+ };
87
+ labelTextStyle: {
88
+ color: string;
89
+ };
90
+ itemIconContainer: {
91
+ borderWidth: number;
92
+ marginRight: number;
93
+ borderRadius: number;
94
+ width: number;
95
+ height: number;
96
+ alignItems: "center";
97
+ justifyContent: "center";
98
+ padding: number;
99
+ borderColor: string;
100
+ };
101
+ iconSubContainer: {
102
+ width: "100%";
103
+ height: "100%";
104
+ borderRadius: number;
105
+ backgroundColor: string;
106
+ };
107
+ styleHorizontal: {
108
+ width: number | "100%";
109
+ alignSelf: "center";
110
+ };
111
+ styleContainerVertical: {
112
+ alignItems: "center";
113
+ backgroundColor: string;
114
+ };
115
+ checkContainer: {
116
+ borderWidth: number;
117
+ borderRadius: number;
118
+ marginRight: number;
119
+ width: number;
120
+ height: number;
121
+ alignItems: "center";
122
+ justifyContent: "center";
123
+ borderColor: string;
124
+ };
125
+ showMultiSelectContainer: {
126
+ width: "90%";
127
+ height: "auto";
128
+ maxHeight: number;
129
+ };
130
+ wraps: {
131
+ flexWrap: "wrap";
132
+ paddingVertical: number;
133
+ flexDirection: "row";
134
+ paddingHorizontal: number;
135
+ };
136
+ };
137
+ colors: {
138
+ blue: string;
139
+ gray: string;
140
+ error: string;
141
+ green: string;
142
+ white: string;
143
+ black: string;
144
+ primary: string;
145
+ lightGray: string;
146
+ grayishBlue: string;
147
+ red: string;
148
+ border: string;
149
+ };
150
+ };
151
+ export {};
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDropdownStyle = void 0;
4
+ const react_1 = require("react");
5
+ const react_native_1 = require("react-native");
6
+ const useOrientation_1 = require("./hooks/useOrientation");
7
+ const style_1 = require("../../style");
8
+ const useDropdownStyle = (props) => {
9
+ const orientation = (0, useOrientation_1.useDeviceOrientation)();
10
+ const { ...colors } = style_1.LIGHT_COLORS;
11
+ const { size = 16, radioIconColor, checkIconColor } = props;
12
+ const styles = (0, react_1.useMemo)(() => {
13
+ return react_native_1.StyleSheet.create({
14
+ mainContainer: {
15
+ width: '100%',
16
+ },
17
+ mainWrap: {
18
+ borderWidth: 1,
19
+ borderRadius: 6,
20
+ paddingHorizontal: 6,
21
+ justifyContent: 'center',
22
+ borderColor: colors.lightGray,
23
+ },
24
+ container: {
25
+ flexShrink: 1,
26
+ borderWidth: 0.5,
27
+ borderColor: '#EEEEEE',
28
+ shadowColor: colors.black,
29
+ backgroundColor: colors.white,
30
+ shadowOffset: {
31
+ width: 0,
32
+ height: 1,
33
+ },
34
+ elevation: 2,
35
+ shadowOpacity: 0.2,
36
+ shadowRadius: 1.41,
37
+ },
38
+ flex1: {
39
+ flex: 1,
40
+ },
41
+ flexShrink: {
42
+ flexShrink: 1,
43
+ },
44
+ wrapTop: {
45
+ justifyContent: 'flex-end',
46
+ },
47
+ dropdown: {
48
+ minHeight: 48,
49
+ maxHeight: 170,
50
+ alignItems: 'center',
51
+ justifyContent: 'space-between',
52
+ flexDirection: react_native_1.I18nManager.isRTL ? 'row-reverse' : 'row',
53
+ },
54
+ title: {
55
+ fontSize: 16,
56
+ marginVertical: style_1.SPACING.s6,
57
+ writingDirection: react_native_1.I18nManager.isRTL ? 'rtl' : 'ltr',
58
+ },
59
+ item: {
60
+ padding: 17,
61
+ alignItems: 'center',
62
+ borderBottomWidth: 0.5,
63
+ borderColor: colors.lightGray,
64
+ justifyContent: 'space-between',
65
+ flexDirection: react_native_1.I18nManager.isRTL ? 'row-reverse' : 'row',
66
+ },
67
+ textItem: {
68
+ flex: 1,
69
+ fontSize: 16,
70
+ writingDirection: react_native_1.I18nManager.isRTL ? 'rtl' : 'ltr',
71
+ },
72
+ icon: {
73
+ width: 20,
74
+ height: 20,
75
+ },
76
+ input: {
77
+ margin: 6,
78
+ height: 45,
79
+ borderWidth: 0.5,
80
+ borderColor: '#DDDDDD',
81
+ marginBottom: style_1.SPACING.s8,
82
+ paddingHorizontal: style_1.SPACING.s8,
83
+ },
84
+ fullScreen: {
85
+ alignItems: 'center',
86
+ justifyContent: 'center',
87
+ },
88
+ labelContainer: {
89
+ marginBottom: style_1.SPACING.s6,
90
+ paddingVertical: style_1.SPACING.s6,
91
+ },
92
+ labelTextStyle: {
93
+ color: colors.black,
94
+ },
95
+ itemIconContainer: {
96
+ borderWidth: 2,
97
+ marginRight: 10,
98
+ borderRadius: 100,
99
+ width: size || 24,
100
+ height: size || 24,
101
+ alignItems: 'center',
102
+ justifyContent: 'center',
103
+ padding: (size || 24) / 8,
104
+ borderColor: radioIconColor || colors.gray,
105
+ },
106
+ iconSubContainer: {
107
+ width: '100%',
108
+ height: '100%',
109
+ borderRadius: 100,
110
+ backgroundColor: radioIconColor || colors.gray,
111
+ },
112
+ styleHorizontal: {
113
+ width: orientation === 'LANDSCAPE' ? style_1.SCREEN_WIDTH / 2 : '100%',
114
+ alignSelf: 'center',
115
+ },
116
+ styleContainerVertical: {
117
+ alignItems: 'center',
118
+ backgroundColor: style_1.DEFAULT_COLORS.blackOpacity,
119
+ },
120
+ checkContainer: {
121
+ borderWidth: 2,
122
+ borderRadius: 2,
123
+ marginRight: 10,
124
+ width: size || 16,
125
+ height: size || 16,
126
+ alignItems: 'center',
127
+ justifyContent: 'center',
128
+ borderColor: checkIconColor ? checkIconColor : colors.gray,
129
+ },
130
+ showMultiSelectContainer: {
131
+ width: '90%',
132
+ height: 'auto',
133
+ maxHeight: 200,
134
+ },
135
+ wraps: {
136
+ flexWrap: 'wrap',
137
+ paddingVertical: 6,
138
+ flexDirection: 'row',
139
+ paddingHorizontal: 10,
140
+ },
141
+ });
142
+ }, [size, colors, orientation, radioIconColor, checkIconColor]);
143
+ return {
144
+ styles,
145
+ colors,
146
+ };
147
+ };
148
+ exports.useDropdownStyle = useDropdownStyle;
@@ -0,0 +1,3 @@
1
+ import { ChipInterface } from '../../interface/ChipInterface';
2
+ declare const Chip: (props: ChipInterface) => import("react").JSX.Element;
3
+ export default Chip;
@@ -0,0 +1,22 @@
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_native_1 = require("react-native");
7
+ const ChipStyle_1 = __importDefault(require("./ChipStyle"));
8
+ const AppText_1 = __importDefault(require("../../../text/AppText"));
9
+ const SvgButton_1 = __importDefault(require("../../../svgButton/SvgButton"));
10
+ const Chip = (props) => {
11
+ const { styles } = (0, ChipStyle_1.default)({ ...props });
12
+ const { label, onClearPress, textColor, clearIcon } = props;
13
+ return (<react_native_1.View style={styles.box}>
14
+ <AppText_1.default size={12} fontFamily={'semiBold'} style={styles.chipText} color={textColor ? textColor : 'gray'}>
15
+ {label}
16
+ </AppText_1.default>
17
+ <react_native_1.View style={styles.clearContainer}>
18
+ <SvgButton_1.default icon={clearIcon} onPress={onClearPress} style={styles.clearIcon}/>
19
+ </react_native_1.View>
20
+ </react_native_1.View>);
21
+ };
22
+ exports.default = Chip;