@trilogy-ds/react 0.0.1-beta.35 → 0.0.1-beta.45

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 (106) hide show
  1. package/lib/components/accordion/header/AccordionHeader.native.js +1 -1
  2. package/lib/components/accordion/item/AccordionItem.native.js +2 -3
  3. package/lib/components/accordion/item/AccordionItem.native.js.map +1 -1
  4. package/lib/components/enumsComponentsName.d.ts +0 -5
  5. package/lib/components/enumsComponentsName.js +0 -5
  6. package/lib/components/enumsComponentsName.js.map +1 -1
  7. package/lib/components/index.d.ts +0 -1
  8. package/lib/components/index.js +0 -1
  9. package/lib/components/index.js.map +1 -1
  10. package/lib/components/input/Input.d.ts +28 -4
  11. package/lib/components/input/Input.js +90 -260
  12. package/lib/components/input/Input.js.map +1 -1
  13. package/lib/components/input/Input.native.d.ts +6 -4
  14. package/lib/components/input/Input.native.js +126 -334
  15. package/lib/components/input/Input.native.js.map +1 -1
  16. package/lib/components/{autocomplete → input/autocomplete}/AutoComplete.d.ts +2 -3
  17. package/lib/components/{autocomplete → input/autocomplete}/AutoComplete.js +13 -21
  18. package/lib/components/input/autocomplete/AutoComplete.js.map +1 -0
  19. package/lib/components/input/autocomplete/AutoComplete.native.d.ts +4 -0
  20. package/lib/components/{autocomplete → input/autocomplete}/AutoComplete.native.js +8 -11
  21. package/lib/components/input/autocomplete/AutoComplete.native.js.map +1 -0
  22. package/lib/components/{autocomplete → input/autocomplete}/AutoCompleteProps.d.ts +1 -3
  23. package/lib/components/input/autocomplete/AutoCompleteProps.js +2 -0
  24. package/lib/components/input/autocomplete/AutoCompleteProps.js.map +1 -0
  25. package/lib/components/input/autocomplete/Autocomplete.helpers.js.map +1 -0
  26. package/lib/components/input/autocomplete/index.js.map +1 -0
  27. package/lib/components/input/autocomplete/item/AutoCompleteIem.native.d.ts +4 -0
  28. package/lib/components/input/autocomplete/item/AutoCompleteIem.native.js +15 -0
  29. package/lib/components/input/autocomplete/item/AutoCompleteIem.native.js.map +1 -0
  30. package/lib/components/{autocomplete → input/autocomplete}/item/AutoCompleteItem.d.ts +2 -2
  31. package/lib/components/{autocomplete → input/autocomplete}/item/AutoCompleteItem.js +6 -6
  32. package/lib/components/input/autocomplete/item/AutoCompleteItem.js.map +1 -0
  33. package/lib/components/input/autocomplete/item/AutoCompleteItemProps.js.map +1 -0
  34. package/lib/components/input/autocomplete/item/index.js.map +1 -0
  35. package/lib/components/{autocomplete → input/autocomplete}/menu/AutoCompleteMenu.d.ts +2 -2
  36. package/lib/components/{autocomplete → input/autocomplete}/menu/AutoCompleteMenu.js +7 -7
  37. package/lib/components/input/autocomplete/menu/AutoCompleteMenu.js.map +1 -0
  38. package/lib/components/input/autocomplete/menu/AutoCompleteMenu.native.d.ts +4 -0
  39. package/lib/components/{autocomplete → input/autocomplete}/menu/AutoCompleteMenu.native.js +6 -8
  40. package/lib/components/input/autocomplete/menu/AutoCompleteMenu.native.js.map +1 -0
  41. package/lib/components/input/autocomplete/menu/AutoCompleteMenuProps.js.map +1 -0
  42. package/lib/components/input/autocomplete/menu/index.js.map +1 -0
  43. package/lib/components/input/autocomplete/utils/debounce.js.map +1 -0
  44. package/lib/components/input/autocomplete/utils/index.js.map +1 -0
  45. package/lib/components/input/gauge/InputGauge.d.ts +9 -0
  46. package/lib/components/input/gauge/InputGauge.js +29 -0
  47. package/lib/components/input/gauge/InputGauge.js.map +1 -0
  48. package/lib/components/input/gauge/InputGauge.native.d.ts +8 -0
  49. package/lib/components/input/gauge/InputGauge.native.js +53 -0
  50. package/lib/components/input/gauge/InputGauge.native.js.map +1 -0
  51. package/lib/components/input/gauge/hook/useGauge.d.ts +32 -0
  52. package/lib/components/input/gauge/hook/useGauge.js +75 -0
  53. package/lib/components/input/gauge/hook/useGauge.js.map +1 -0
  54. package/lib/components/link/Link.native.d.ts +0 -1
  55. package/lib/components/link/Link.native.js +36 -27
  56. package/lib/components/link/Link.native.js.map +1 -1
  57. package/lib/components/range/Range.js +6 -0
  58. package/lib/components/range/Range.js.map +1 -1
  59. package/lib/components/select/web/SelectDynamic.js +14 -8
  60. package/lib/components/select/web/SelectDynamic.js.map +1 -1
  61. package/lib/context/interfaces.d.ts +1 -0
  62. package/lib/context/providerTheme.js +1 -0
  63. package/lib/context/providerTheme.js.map +1 -1
  64. package/lib/context/providerTheme.native.js +1 -0
  65. package/lib/context/providerTheme.native.js.map +1 -1
  66. package/lib/objects/Typography/TypographyBold.d.ts +1 -1
  67. package/lib/objects/Typography/TypographyBold.js +13 -10
  68. package/lib/objects/Typography/TypographyBold.js.map +1 -1
  69. package/lib/objects/facets/Color.js.map +1 -1
  70. package/package.json +1 -1
  71. package/lib/components/autocomplete/AutoComplete.js.map +0 -1
  72. package/lib/components/autocomplete/AutoComplete.native.d.ts +0 -8
  73. package/lib/components/autocomplete/AutoComplete.native.js.map +0 -1
  74. package/lib/components/autocomplete/AutoCompleteProps.js +0 -2
  75. package/lib/components/autocomplete/AutoCompleteProps.js.map +0 -1
  76. package/lib/components/autocomplete/Autocomplete.helpers.js.map +0 -1
  77. package/lib/components/autocomplete/index.js.map +0 -1
  78. package/lib/components/autocomplete/item/AutoCompleteIem.native.d.ts +0 -8
  79. package/lib/components/autocomplete/item/AutoCompleteIem.native.js +0 -17
  80. package/lib/components/autocomplete/item/AutoCompleteIem.native.js.map +0 -1
  81. package/lib/components/autocomplete/item/AutoCompleteItem.js.map +0 -1
  82. package/lib/components/autocomplete/item/AutoCompleteItemProps.js.map +0 -1
  83. package/lib/components/autocomplete/item/index.js.map +0 -1
  84. package/lib/components/autocomplete/menu/AutoCompleteMenu.js.map +0 -1
  85. package/lib/components/autocomplete/menu/AutoCompleteMenu.native.d.ts +0 -8
  86. package/lib/components/autocomplete/menu/AutoCompleteMenu.native.js.map +0 -1
  87. package/lib/components/autocomplete/menu/AutoCompleteMenuProps.js.map +0 -1
  88. package/lib/components/autocomplete/menu/index.js.map +0 -1
  89. package/lib/components/autocomplete/utils/debounce.js.map +0 -1
  90. package/lib/components/autocomplete/utils/index.js.map +0 -1
  91. /package/lib/components/{autocomplete → input/autocomplete}/Autocomplete.helpers.d.ts +0 -0
  92. /package/lib/components/{autocomplete → input/autocomplete}/Autocomplete.helpers.js +0 -0
  93. /package/lib/components/{autocomplete → input/autocomplete}/index.d.ts +0 -0
  94. /package/lib/components/{autocomplete → input/autocomplete}/index.js +0 -0
  95. /package/lib/components/{autocomplete → input/autocomplete}/item/AutoCompleteItemProps.d.ts +0 -0
  96. /package/lib/components/{autocomplete → input/autocomplete}/item/AutoCompleteItemProps.js +0 -0
  97. /package/lib/components/{autocomplete → input/autocomplete}/item/index.d.ts +0 -0
  98. /package/lib/components/{autocomplete → input/autocomplete}/item/index.js +0 -0
  99. /package/lib/components/{autocomplete → input/autocomplete}/menu/AutoCompleteMenuProps.d.ts +0 -0
  100. /package/lib/components/{autocomplete → input/autocomplete}/menu/AutoCompleteMenuProps.js +0 -0
  101. /package/lib/components/{autocomplete → input/autocomplete}/menu/index.d.ts +0 -0
  102. /package/lib/components/{autocomplete → input/autocomplete}/menu/index.js +0 -0
  103. /package/lib/components/{autocomplete → input/autocomplete}/utils/debounce.d.ts +0 -0
  104. /package/lib/components/{autocomplete → input/autocomplete}/utils/debounce.js +0 -0
  105. /package/lib/components/{autocomplete → input/autocomplete}/utils/index.d.ts +0 -0
  106. /package/lib/components/{autocomplete → input/autocomplete}/utils/index.js +0 -0
@@ -1,12 +1,14 @@
1
- import React, { useCallback, useEffect, useRef, useState } from "react";
2
- import { Animated, Keyboard, Platform, StyleSheet, TextInput, TouchableOpacity, View, } from "react-native";
3
- import { AlertState, getAlertStyle } from "../../objects/facets/Alert";
4
- import { InputAutoCapitalize, InputKeyboardAppearance, InputKeyboardType, InputStatus, InputTextContentType, InputType, } from "./InputEnum";
5
- import { Icon, IconColor, IconName, IconSize } from "../icon";
6
- import { Text } from "../text";
7
- import { getColorStyle, TrilogyColor } from "../../objects/facets/Color";
8
- import { Alignable } from "../../objects/facets/Alignable";
9
- import { ComponentName } from "../enumsComponentsName";
1
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
2
+ import { Animated, Keyboard, Platform, StyleSheet, TextInput, TouchableOpacity, View, } from 'react-native';
3
+ import { AlertState, getAlertStyle } from '../../objects/facets/Alert';
4
+ import { Alignable } from '../../objects/facets/Alignable';
5
+ import { TrilogyColor, getColorStyle } from '../../objects/facets/Color';
6
+ import { ComponentName } from '../enumsComponentsName';
7
+ import { Icon, IconName, IconSize } from '../icon';
8
+ import { Text } from '../text';
9
+ import { InputAutoCapitalize, InputKeyboardAppearance, InputKeyboardType, InputStatus, InputTextContentType, InputType, } from './InputEnum';
10
+ import AutoComplete from './autocomplete/AutoComplete.native';
11
+ import InputGauge from './gauge/InputGauge.native';
10
12
  /**
11
13
  * Input Native Component
12
14
  * @param name {string} Input name
@@ -40,16 +42,57 @@ import { ComponentName } from "../enumsComponentsName";
40
42
  const Input = ({ defaultValue, name, onChange, onFocus, onBlur, disabled, status, help, placeholder, type, hasIcon, customIcon, search, reference, keyboardStyle, autoCapitalize, autoCorrect, autoCompleteType, textContentType, keyboardType, keyType, onSubmit, maxLength, testId, accessibilityLabel, customIconRight, customIconLeft, securityGauge, validationRules, onIconClick,
41
43
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
42
44
  required, ...others }) => {
43
- const [value, setValue] = useState(defaultValue || "");
44
- const [email, setEmail] = useState("");
45
- const [isFocused, setIsFocused] = useState(false);
46
- const [dynamicPlaceholder, setDynamicPlaceholder] = useState(false);
45
+ const inputTestId = testId ? testId : placeholder ? placeholder : 'NotSpecified';
46
+ const inputAccessibilityLabel = accessibilityLabel ? accessibilityLabel : placeholder ? placeholder : 'NotSpecified';
47
47
  const animationDuration = 200;
48
48
  const placeholderDefaultSize = 20;
49
+ const inputIcon = new Map();
50
+ const inputColor = getColorStyle(TrilogyColor.MAIN);
51
+ inputIcon.set(InputStatus.SUCCESS, IconName.CHECK_CIRCLE);
52
+ inputIcon.set(InputStatus.WARNING, IconName.EXCLAMATION_CIRCLE);
53
+ inputIcon.set(InputStatus.ERROR, IconName.EXCLAMATION_CIRCLE);
54
+ const [value, setValue] = useState(defaultValue || '');
55
+ const [email, setEmail] = useState('');
56
+ const [isFocused, setIsFocused] = useState(false);
57
+ const [iconPassword, setIconPassword] = useState(IconName.EYE);
58
+ const [dynamicPlaceholder, setDynamicPlaceholder] = useState(false);
59
+ const [isKeyboardVisible, setKeyboardVisible] = useState(null);
49
60
  const animation = useRef(new Animated.Value(25)).current;
50
61
  const sizeAnimation = useRef(new Animated.Value(placeholderDefaultSize)).current;
62
+ const paddingTopByPlatform = (os, dynamicPlaceholder) => {
63
+ if (dynamicPlaceholder && !search && os === 'ios') {
64
+ return isFocused ? 9 : 10;
65
+ }
66
+ if (dynamicPlaceholder && !search && os === 'android') {
67
+ return isFocused ? 14 : 15;
68
+ }
69
+ return 0;
70
+ };
71
+ const handleChange = useCallback((text) => {
72
+ var _a;
73
+ setValue(text);
74
+ setEmail('');
75
+ const domain = (_a = text.split('@')) === null || _a === void 0 ? void 0 : _a[1];
76
+ if (domain) {
77
+ const domains = ['gmail.com', 'bbox.fr'];
78
+ domains.forEach((item) => {
79
+ const domainSplit = domain.split('');
80
+ const itemSplit = item.split('').slice(0, domainSplit.length);
81
+ if (JSON.stringify(domainSplit) == JSON.stringify(itemSplit))
82
+ setEmail(item.slice(domain.length));
83
+ });
84
+ }
85
+ }, []);
86
+ const handleClick = () => {
87
+ setValue(value + email);
88
+ setEmail('');
89
+ };
90
+ const handleSubmit = (e) => {
91
+ onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(e);
92
+ type === InputType.EMAIL && handleClick();
93
+ };
51
94
  useEffect(() => {
52
- setValue(defaultValue || "");
95
+ setValue(defaultValue || '');
53
96
  }, [defaultValue, placeholder]);
54
97
  useEffect(() => {
55
98
  if (value && value.length > 0 && placeholder && placeholder.length > 0) {
@@ -85,58 +128,9 @@ required, ...others }) => {
85
128
  }).start();
86
129
  }
87
130
  }, [dynamicPlaceholder, animation, sizeAnimation]);
88
- const inputIcon = new Map();
89
- inputIcon.set(InputStatus.SUCCESS, IconName.CHECK_CIRCLE);
90
- inputIcon.set(InputStatus.WARNING, IconName.EXCLAMATION_CIRCLE);
91
- inputIcon.set(InputStatus.ERROR, IconName.EXCLAMATION_CIRCLE);
92
- const inputColor = getColorStyle(TrilogyColor.MAIN);
93
- const [iconPassword, setIconPassword] = useState(IconName.EYE);
94
- const paddingTopByPlatform = (os, dynamicPlaceholder) => {
95
- if (dynamicPlaceholder && !search && os === "ios") {
96
- return isFocused ? 9 : 10;
97
- }
98
- if (dynamicPlaceholder && !search && os === "android") {
99
- return isFocused ? 14 : 15;
100
- }
101
- return 0;
102
- };
103
- const inputTestId = testId
104
- ? testId
105
- : placeholder
106
- ? placeholder
107
- : "NotSpecified";
108
- const inputAccessibilityLabel = accessibilityLabel
109
- ? accessibilityLabel
110
- : placeholder
111
- ? placeholder
112
- : "NotSpecified";
113
- const handleChange = useCallback((text) => {
114
- var _a;
115
- setValue(text);
116
- setEmail("");
117
- const domain = (_a = text.split("@")) === null || _a === void 0 ? void 0 : _a[1];
118
- if (domain) {
119
- const domains = ["gmail.com", "bbox.fr"];
120
- domains.forEach((item) => {
121
- const domainSplit = domain.split("");
122
- const itemSplit = item.split("").slice(0, domainSplit.length);
123
- if (JSON.stringify(domainSplit) == JSON.stringify(itemSplit))
124
- setEmail(item.slice(domain.length));
125
- });
126
- }
127
- }, []);
128
- const handleClick = () => {
129
- setValue(value + email);
130
- setEmail("");
131
- };
132
- const handleSubmit = (e) => {
133
- onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(e);
134
- type === InputType.EMAIL && handleClick();
135
- };
136
- const [isKeyboardVisible, setKeyboardVisible] = useState(null);
137
131
  useEffect(() => {
138
- const keyboardDidShowListener = Keyboard.addListener("keyboardDidShow", () => setKeyboardVisible(true));
139
- const keyboardDidHideListener = Keyboard.addListener("keyboardDidHide", () => setKeyboardVisible(false));
132
+ const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => setKeyboardVisible(true));
133
+ const keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => setKeyboardVisible(false));
140
134
  return () => {
141
135
  keyboardDidHideListener.remove();
142
136
  keyboardDidShowListener.remove();
@@ -145,306 +139,145 @@ required, ...others }) => {
145
139
  useEffect(() => {
146
140
  handleClick();
147
141
  }, [isKeyboardVisible]);
148
- const initStateVerifies = { isVerify: false, color: IconColor.NEUTRAL };
149
- const [points, setPoints] = React.useState(0);
150
- const [isLengthVerify, setIsLengthVerify] = React.useState(initStateVerifies);
151
- const [isSpecialCharsVerify, setIsSpecialCharsVerify] = React.useState(initStateVerifies);
152
- const [isNumberVerify, setIsNumberVerify] = React.useState(initStateVerifies);
153
- const [isUppercaseVerify, setIsUppercaseVerify] = React.useState(initStateVerifies);
154
- const [isLowerercaseVerify, setisLowerercaseVerify] = React.useState(initStateVerifies);
155
- const [nbAllVerifies, setNbAllVerifies] = React.useState(0);
156
- const [verifies, setVerifies] = React.useState({});
157
- const lengthVerify = {
158
- test: (e) => {
159
- var _a, _b, _c, _d;
160
- if (((_a = validationRules === null || validationRules === void 0 ? void 0 : validationRules.length) === null || _a === void 0 ? void 0 : _a.max) && !validationRules.length.min) {
161
- return e.length > 0 && e.length <= validationRules.length.max;
162
- }
163
- if (((_b = validationRules === null || validationRules === void 0 ? void 0 : validationRules.length) === null || _b === void 0 ? void 0 : _b.min) && !((_c = validationRules === null || validationRules === void 0 ? void 0 : validationRules.length) === null || _c === void 0 ? void 0 : _c.max)) {
164
- return e.length >= validationRules.length.min;
165
- }
166
- if (((_d = validationRules === null || validationRules === void 0 ? void 0 : validationRules.length) === null || _d === void 0 ? void 0 : _d.max) && validationRules.length.min) {
167
- return (e.length >= validationRules.length.min &&
168
- e.length <= validationRules.length.max);
169
- }
170
- return false;
171
- },
172
- setVerify: setIsLengthVerify,
173
- };
174
- const specialCharsverify = {
175
- // eslint-disable-next-line
176
- test: (e) => /[^\w\*]/.test(e),
177
- setVerify: setIsSpecialCharsVerify,
178
- };
179
- const numberVerify = {
180
- // eslint-disable-next-line
181
- test: (e) => /[0-9]/.test(e),
182
- setVerify: setIsNumberVerify,
183
- };
184
- const uppercaseVerify = {
185
- // eslint-disable-next-line
186
- test: (e) => /[A-Z]/.test(e),
187
- setVerify: setIsUppercaseVerify,
188
- };
189
- const lowercaseVerify = {
190
- // eslint-disable-next-line
191
- test: (e) => /[a-z]/.test(e),
192
- setVerify: setisLowerercaseVerify,
193
- };
194
- React.useEffect(() => {
195
- const data = {};
196
- validationRules &&
197
- Object.keys(validationRules).map((key) => {
198
- if (key === "number")
199
- Object.assign(data, { numberVerify });
200
- if (key === "length")
201
- Object.assign(data, { lengthVerify });
202
- if (key === "lowercase")
203
- Object.assign(data, { lowercaseVerify });
204
- if (key === "uppercase")
205
- Object.assign(data, { uppercaseVerify });
206
- if (key === "specialChars")
207
- Object.assign(data, { specialCharsverify });
208
- });
209
- setVerifies(data);
210
- setNbAllVerifies(Object.keys(data).length);
211
- }, [validationRules]);
212
- const handleVerifyPwd = (e) => {
213
- const verifiesTests = [];
214
- Object.keys(verifies).map((key) => {
215
- const test = verifies[key].test(e);
216
- verifiesTests.push(test);
217
- if (test) {
218
- verifies[key].setVerify({ isVerify: true, color: IconColor.SUCCESS });
219
- }
220
- else {
221
- verifies[key].setVerify(initStateVerifies);
222
- }
223
- });
224
- setPoints(verifiesTests.filter((item) => item).length);
225
- };
226
- const widthGauge = React.useMemo(() => {
227
- const calc = Number(((points / nbAllVerifies) * 100).toFixed(0));
228
- if (calc <= 50 && calc > 0)
229
- return "50%";
230
- if (calc <= 99 && calc > 50)
231
- return "75%";
232
- if (calc === 100)
233
- return "100%";
234
- return "0%";
235
- }, [points, nbAllVerifies]);
236
- const errorColor = getColorStyle(TrilogyColor.ERROR);
237
- const warningColor = getColorStyle(TrilogyColor.WARNING);
238
- const successColor = getColorStyle(TrilogyColor.SUCCESS);
239
- const colorGauge = React.useMemo(() => {
240
- const calc = Number(((points / nbAllVerifies) * 100).toFixed(0));
241
- if (calc <= 50 && calc > 0)
242
- return errorColor;
243
- if (calc <= 99 && calc > 50)
244
- return warningColor;
245
- if (calc === 100)
246
- return successColor;
247
- return getColorStyle(TrilogyColor.FONT, 1);
248
- }, [points, nbAllVerifies]);
249
142
  const styles = StyleSheet.create({
250
143
  input: {
251
- paddingLeft: (customIconLeft || search) && 40
252
- || (customIconLeft && isFocused
253
- || search && isFocused) && 39 || !customIconLeft && !search && isFocused && 9
254
- || 10,
255
- paddingRight: (customIcon || customIconRight || search) && 32 || 0,
144
+ paddingLeft: ((customIconLeft || search) && 40) ||
145
+ (((customIconLeft && isFocused) || (search && isFocused)) && 39) ||
146
+ (!customIconLeft && !search && isFocused && 9) ||
147
+ 10,
148
+ paddingRight: ((customIcon || customIconRight || search) && 32) || 0,
256
149
  marginTop: paddingTopByPlatform(Platform.OS, dynamicPlaceholder),
257
- width: hasIcon && (status || customIcon) ? "85%" : "95%",
150
+ width: hasIcon && (status || customIcon) ? '85%' : '95%',
258
151
  height: 46,
259
152
  color: disabled ? getColorStyle(TrilogyColor.DISABLED) : inputColor,
260
153
  },
261
154
  dynamicPlaceholder: {
262
- position: "absolute",
155
+ position: 'absolute',
263
156
  left: customIconLeft ? 40 : 10,
264
157
  color: getColorStyle(TrilogyColor.NEUTRAL),
265
158
  },
266
159
  help: {
267
160
  fontSize: 12,
268
- color: (status && status === "success" && getAlertStyle(AlertState.SUCCESS)) ||
269
- (status && status === "warning" && getAlertStyle(AlertState.WARNING)) ||
270
- (status && status === "error" && getAlertStyle(AlertState.ERROR)) ||
271
- (status && status === "default" && inputColor) ||
161
+ color: (status && status === 'success' && getAlertStyle(AlertState.SUCCESS)) ||
162
+ (status && status === 'warning' && getAlertStyle(AlertState.WARNING)) ||
163
+ (status && status === 'error' && getAlertStyle(AlertState.ERROR)) ||
164
+ (status && status === 'default' && inputColor) ||
272
165
  (disabled && getColorStyle(TrilogyColor.DISABLED)) ||
273
166
  inputColor,
274
167
  paddingLeft: 4,
275
168
  paddingTop: 2,
276
169
  },
277
170
  inputWrapper: {
278
- position: "relative",
279
- justifyContent: "center",
280
- alignSelf: "stretch",
281
- backgroundColor: disabled
282
- ? getColorStyle(TrilogyColor.DISABLED, 1)
283
- : getColorStyle(TrilogyColor.BACKGROUND),
171
+ position: 'relative',
172
+ justifyContent: 'center',
173
+ alignSelf: 'stretch',
174
+ backgroundColor: disabled ? getColorStyle(TrilogyColor.DISABLED, 1) : getColorStyle(TrilogyColor.BACKGROUND),
284
175
  borderWidth: isFocused ? 2 : 1,
285
176
  borderRadius: 3,
286
- borderColor: (status && status === "success" && getAlertStyle(AlertState.SUCCESS)) ||
287
- (status && status === "warning" && getAlertStyle(AlertState.WARNING)) ||
288
- (status && status === "error" && getAlertStyle(AlertState.ERROR)) ||
289
- (status && status === "default" && inputColor) ||
177
+ borderColor: (status && status === 'success' && getAlertStyle(AlertState.SUCCESS)) ||
178
+ (status && status === 'warning' && getAlertStyle(AlertState.WARNING)) ||
179
+ (status && status === 'error' && getAlertStyle(AlertState.ERROR)) ||
180
+ (status && status === 'default' && inputColor) ||
290
181
  (isFocused && getColorStyle(TrilogyColor.MAIN)) ||
291
182
  getColorStyle(TrilogyColor.FONT, 1),
292
183
  height: 46,
293
- width: "100%",
184
+ width: '100%',
294
185
  },
295
186
  inputContainer: {
296
187
  height: 46,
297
188
  width: 46,
298
- position: "absolute",
189
+ position: 'absolute',
299
190
  right: 0,
300
- justifyContent: "center",
191
+ justifyContent: 'center',
301
192
  },
302
193
  inputContainerLeft: {
303
194
  height: 46,
304
195
  width: 46,
305
- position: "absolute",
196
+ position: 'absolute',
306
197
  left: 0,
307
- justifyContent: "center",
198
+ justifyContent: 'center',
308
199
  },
309
200
  inputContainerRight: {
310
201
  height: 46,
311
202
  width: 46,
312
- position: "absolute",
203
+ position: 'absolute',
313
204
  right: 0,
314
- justifyContent: "center",
205
+ justifyContent: 'center',
315
206
  },
316
207
  inputIcon: {
317
- position: "absolute",
208
+ position: 'absolute',
318
209
  right: 10,
319
210
  top: !value ? -33 : -38,
320
211
  },
321
212
  inputIconLeft: {
322
- position: "absolute",
213
+ position: 'absolute',
323
214
  left: 10,
324
215
  top: !value ? -33 : -38,
325
216
  },
326
217
  text: {
327
218
  zIndex: -1,
328
- position: "absolute",
219
+ position: 'absolute',
329
220
  fontSize: 14,
330
221
  color: getColorStyle(TrilogyColor.BACKGROUND),
331
- bottom: Platform.OS === "ios" ? 9 : 5,
332
- left: customIconLeft
333
- ? Platform.OS === "ios"
334
- ? 38
335
- : 37.5
336
- : Platform.OS === "ios"
337
- ? 8
338
- : 7.5,
222
+ bottom: Platform.OS === 'ios' ? 9 : 5,
223
+ left: customIconLeft ? (Platform.OS === 'ios' ? 38 : 37.5) : Platform.OS === 'ios' ? 8 : 7.5,
339
224
  },
340
225
  domain: {
341
226
  zIndex: 1,
342
227
  color: getColorStyle(TrilogyColor.NEUTRAL),
343
228
  fontSize: 13,
344
- height: "100%",
229
+ height: '100%',
345
230
  marginTop: 3,
346
- marginBottom: Platform.OS === "ios" ? 0 : -3,
347
- },
348
- gauge: {
349
- backgroundColor: colorGauge,
350
- height: 4,
351
- width: widthGauge,
352
- borderRadius: 4,
353
- },
354
- verifies: {
355
- flexDirection: "row",
356
- justifyContent: "space-between",
357
- },
358
- containerGauge: {
359
- backgroundColor: getColorStyle(TrilogyColor.FONT, 1),
360
- height: 4,
361
- width: "100%",
362
- borderRadius: 4,
363
- marginVertical: 8,
364
- },
365
- verify: {
366
- flexDirection: "row",
367
- alignItems: "center",
368
- marginBottom: 4,
369
- },
370
- textVerify: {
371
- marginLeft: 8,
231
+ marginBottom: Platform.OS === 'ios' ? 0 : -3,
372
232
  },
373
233
  });
374
- return (React.createElement(View, { style: { width: "100%" }, accessible: !!inputAccessibilityLabel, accessibilityLabel: inputAccessibilityLabel, testID: inputTestId },
234
+ return (React.createElement(View, { style: { width: '100%' }, accessible: !!inputAccessibilityLabel, accessibilityLabel: inputAccessibilityLabel, testID: inputTestId },
375
235
  React.createElement(View, { testID: 'input-wrapper-id', style: styles.inputWrapper },
376
- dynamicPlaceholder && !search && (React.createElement(Animated.Text, { style: [
377
- styles.dynamicPlaceholder,
378
- { top: animation, fontSize: sizeAnimation },
379
- ] }, placeholder)),
380
- React.createElement(TextInput, { testID: 'input-id', clearTextOnFocus: false, secureTextEntry: !!(type &&
381
- type === InputType.PASSWORD &&
382
- iconPassword === IconName.EYE), value: value, editable: !disabled, ref: reference, maxLength: maxLength, autoCapitalize: autoCapitalize || InputAutoCapitalize.NONE, keyboardAppearance: keyboardStyle || InputKeyboardAppearance.DEFAULT, autoCorrect: autoCorrect || false, autoComplete: autoCompleteType, returnKeyType: keyType, textContentType: textContentType || InputTextContentType.NONE, keyboardType: keyboardType || InputKeyboardType.DEFAULT, onSubmitEditing: handleSubmit, onChangeText: (text) => {
236
+ dynamicPlaceholder && !search && (React.createElement(Animated.Text, { style: [styles.dynamicPlaceholder, { top: animation, fontSize: sizeAnimation }] }, placeholder)),
237
+ React.createElement(TextInput, { testID: 'input-id', clearTextOnFocus: false, secureTextEntry: !!(type && type === InputType.PASSWORD && iconPassword === IconName.EYE), value: value, editable: !disabled, ref: reference, maxLength: maxLength, autoCapitalize: autoCapitalize || InputAutoCapitalize.NONE, keyboardAppearance: keyboardStyle || InputKeyboardAppearance.DEFAULT, autoCorrect: autoCorrect || false, autoComplete: autoCompleteType, returnKeyType: keyType, textContentType: textContentType || InputTextContentType.NONE, keyboardType: keyboardType || InputKeyboardType.DEFAULT, onSubmitEditing: handleSubmit, onChangeText: (text) => {
383
238
  handleChange(text);
384
239
  if (onChange) {
385
240
  onChange({
386
- inputName: (name && name) || "",
241
+ inputName: (name && name) || '',
387
242
  inputValue: text,
388
243
  inputSelectionStart: null,
389
244
  });
390
245
  }
391
- if (securityGauge) {
392
- handleVerifyPwd(text);
393
- }
394
246
  }, onFocus: (e) => {
395
247
  setIsFocused(true);
396
248
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
397
249
  }, onBlur: (e) => {
398
250
  setIsFocused(false);
399
251
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
400
- }, placeholder: placeholder, placeholderTextColor: disabled
401
- ? getColorStyle(TrilogyColor.DISABLED)
402
- : getColorStyle(TrilogyColor.MAIN), style: styles.input, ...others }),
403
- type === "email" && (React.createElement(Text, { style: styles.text },
252
+ }, placeholder: placeholder, placeholderTextColor: disabled ? getColorStyle(TrilogyColor.DISABLED) : getColorStyle(TrilogyColor.MAIN), style: styles.input, ...others }),
253
+ type === 'email' && (React.createElement(Text, { style: styles.text },
404
254
  value,
405
255
  React.createElement(Text, { style: styles.domain }, email))),
406
256
  hasIcon &&
407
257
  ((status && status !== InputStatus.DEFAULT) || customIconLeft) &&
408
258
  type !== InputType.PASSWORD &&
409
- !customIcon && (React.createElement(Icon, { style: styles.inputIconLeft, align: Alignable.ALIGNED_START, name: (customIconLeft &&
410
- customIconLeft.replace("tri-", "").replace("ui-", "")) ||
411
- inputIcon.get(status).replace("tri-", "").replace("ui-", ""), size: IconSize.SMALL, color: (status &&
412
- status === "success" &&
413
- getAlertStyle(AlertState.SUCCESS)) ||
414
- (status &&
415
- status === "warning" &&
416
- getAlertStyle(AlertState.WARNING)) ||
417
- (status &&
418
- status === "error" &&
419
- getAlertStyle(AlertState.ERROR)) ||
420
- (status && status === "default" && inputColor) ||
259
+ !customIcon && (React.createElement(Icon, { style: styles.inputIconLeft, align: Alignable.ALIGNED_START, name: (customIconLeft && customIconLeft.replace('tri-', '').replace('ui-', '')) ||
260
+ inputIcon.get(status).replace('tri-', '').replace('ui-', ''), size: IconSize.SMALL, color: (status && status === 'success' && getAlertStyle(AlertState.SUCCESS)) ||
261
+ (status && status === 'warning' && getAlertStyle(AlertState.WARNING)) ||
262
+ (status && status === 'error' && getAlertStyle(AlertState.ERROR)) ||
263
+ (status && status === 'default' && inputColor) ||
421
264
  (disabled && getColorStyle(TrilogyColor.DISABLED)) ||
422
265
  inputColor })),
423
266
  hasIcon &&
424
267
  !search &&
425
- ((status && status !== InputStatus.DEFAULT) ||
426
- customIcon ||
427
- customIconRight) &&
268
+ ((status && status !== InputStatus.DEFAULT) || customIcon || customIconRight) &&
428
269
  type !== InputType.PASSWORD && (React.createElement(TouchableOpacity, { style: styles.inputContainer, activeOpacity: onIconClick ? 0.2 : 1, onPress: () => {
429
270
  onIconClick === null || onIconClick === void 0 ? void 0 : onIconClick({
430
- inputName: (name && name) || "",
271
+ inputName: (name && name) || '',
431
272
  inputValue: value,
432
273
  });
433
274
  } },
434
- React.createElement(Icon, { testId: 'icon-status-id', align: Alignable.ALIGNED_CENTER, name: (customIcon &&
435
- customIcon.replace("tri-", "").replace("ui-", "")) ||
436
- (customIconRight &&
437
- customIconRight.replace("tri-", "").replace("ui-", "")) ||
438
- inputIcon.get(status).replace("tri-", "").replace("ui-", ""), size: IconSize.SMALL, color: (status &&
439
- status === "success" &&
440
- getAlertStyle(AlertState.SUCCESS)) ||
441
- (status &&
442
- status === "warning" &&
443
- getAlertStyle(AlertState.WARNING)) ||
444
- (status &&
445
- status === "error" &&
446
- getAlertStyle(AlertState.ERROR)) ||
447
- (status && status === "default" && inputColor) ||
275
+ React.createElement(Icon, { testId: 'icon-status-id', align: Alignable.ALIGNED_CENTER, name: (customIcon && customIcon.replace('tri-', '').replace('ui-', '')) ||
276
+ (customIconRight && customIconRight.replace('tri-', '').replace('ui-', '')) ||
277
+ inputIcon.get(status).replace('tri-', '').replace('ui-', ''), size: IconSize.SMALL, color: (status && status === 'success' && getAlertStyle(AlertState.SUCCESS)) ||
278
+ (status && status === 'warning' && getAlertStyle(AlertState.WARNING)) ||
279
+ (status && status === 'error' && getAlertStyle(AlertState.ERROR)) ||
280
+ (status && status === 'default' && inputColor) ||
448
281
  (disabled && getColorStyle(TrilogyColor.DISABLED)) ||
449
282
  inputColor }))),
450
283
  hasIcon && type === InputType.PASSWORD && (React.createElement(React.Fragment, null,
@@ -452,7 +285,7 @@ required, ...others }) => {
452
285
  React.createElement(Icon, { name: customIconLeft }))),
453
286
  React.createElement(TouchableOpacity, { style: styles.inputContainerRight, onPress: () => {
454
287
  onIconClick === null || onIconClick === void 0 ? void 0 : onIconClick({
455
- inputName: (name && name) || "",
288
+ inputName: (name && name) || '',
456
289
  inputValue: value,
457
290
  });
458
291
  if (iconPassword === IconName.EYE) {
@@ -462,16 +295,10 @@ required, ...others }) => {
462
295
  setIconPassword(IconName.EYE);
463
296
  }
464
297
  } },
465
- React.createElement(Icon, { testId: 'password-id', align: Alignable.ALIGNED_CENTER, name: iconPassword, size: IconSize.SMALL, color: (status &&
466
- status === "success" &&
467
- getAlertStyle(AlertState.SUCCESS)) ||
468
- (status &&
469
- status === "warning" &&
470
- getAlertStyle(AlertState.WARNING)) ||
471
- (status &&
472
- status === "error" &&
473
- getAlertStyle(AlertState.ERROR)) ||
474
- (status && status === "default" && inputColor) ||
298
+ React.createElement(Icon, { testId: 'password-id', align: Alignable.ALIGNED_CENTER, name: iconPassword, size: IconSize.SMALL, color: (status && status === 'success' && getAlertStyle(AlertState.SUCCESS)) ||
299
+ (status && status === 'warning' && getAlertStyle(AlertState.WARNING)) ||
300
+ (status && status === 'error' && getAlertStyle(AlertState.ERROR)) ||
301
+ (status && status === 'default' && inputColor) ||
475
302
  (disabled && getColorStyle(TrilogyColor.DISABLED)) ||
476
303
  inputColor })))),
477
304
  search && !status && (React.createElement(React.Fragment, null,
@@ -479,59 +306,24 @@ required, ...others }) => {
479
306
  React.createElement(Icon, { align: Alignable.ALIGNED_CENTER, name: IconName.SEARCH, size: IconSize.SMALL, color: disabled ? getColorStyle(TrilogyColor.DISABLED) : getColorStyle(TrilogyColor.NEUTRAL) })),
480
307
  value.length > 0 && (React.createElement(TouchableOpacity, { testID: 'search-id', style: styles.inputContainerRight, onPressIn: () => {
481
308
  onChange === null || onChange === void 0 ? void 0 : onChange({
482
- inputName: (name && name) || "",
483
- inputValue: "",
309
+ inputName: (name && name) || '',
310
+ inputValue: '',
484
311
  inputSelectionStart: null,
485
312
  });
486
313
  onIconClick === null || onIconClick === void 0 ? void 0 : onIconClick({
487
- inputName: (name && name) || "",
488
- inputValue: "",
314
+ inputName: (name && name) || '',
315
+ inputValue: '',
489
316
  });
490
- setValue("");
317
+ setValue('');
491
318
  } },
492
319
  React.createElement(Icon, { align: Alignable.ALIGNED_CENTER, name: IconName.TIMES_CIRCLE, size: IconSize.SMALL, color: disabled ? getColorStyle(TrilogyColor.DISABLED) : getColorStyle(TrilogyColor.NEUTRAL) })))))),
493
320
  help && (React.createElement(Text, { testId: 'help-id', style: styles.help }, help)),
494
- type === InputType.PASSWORD && securityGauge && (React.createElement(View, null,
495
- React.createElement(View, { style: styles.containerGauge },
496
- React.createElement(View, { style: styles.gauge })),
497
- React.createElement(View, { style: styles.verifies },
498
- React.createElement(View, null,
499
- validationRules && validationRules.length && (React.createElement(View, { style: styles.verify },
500
- React.createElement(Icon, { color: isLengthVerify.color, name: isLengthVerify.isVerify
501
- ? IconName.CHECK_CIRCLE
502
- : IconName.TIMES, size: IconSize.SMALLER }),
503
- React.createElement(Text, { style: styles.textVerify },
504
- validationRules.length.min &&
505
- validationRules.length.max &&
506
- `Entre ${validationRules.length.min} et ${validationRules.length.max} caractères`,
507
- validationRules.length.min &&
508
- !validationRules.length.max &&
509
- `Minimum ${validationRules.length.min} caractères`,
510
- validationRules.length.max &&
511
- !validationRules.length.min &&
512
- `Maximum ${validationRules.length.max} caractères`))),
513
- validationRules && validationRules.specialChars && (React.createElement(View, { style: styles.verify },
514
- React.createElement(Icon, { color: isSpecialCharsVerify.color, name: isSpecialCharsVerify.isVerify
515
- ? IconName.CHECK_CIRCLE
516
- : IconName.TIMES, size: IconSize.SMALLER }),
517
- React.createElement(Text, { style: styles.textVerify }, "Caract\u00E8res sp\u00E9ciaux"))),
518
- validationRules && validationRules.number && (React.createElement(View, { style: styles.verify },
519
- React.createElement(Icon, { color: isNumberVerify.color, name: isNumberVerify.isVerify
520
- ? IconName.CHECK_CIRCLE
521
- : IconName.TIMES, size: IconSize.SMALLER }),
522
- React.createElement(Text, { style: styles.textVerify }, "Chiffre")))),
523
- React.createElement(View, null,
524
- validationRules && validationRules.uppercase && (React.createElement(View, { style: styles.verify },
525
- React.createElement(Icon, { color: isUppercaseVerify.color, name: isUppercaseVerify.isVerify
526
- ? IconName.CHECK_CIRCLE
527
- : IconName.TIMES, size: IconSize.SMALLER }),
528
- React.createElement(Text, { style: styles.textVerify }, "Majuscule"))),
529
- validationRules && validationRules.lowercase && (React.createElement(View, { style: styles.verify },
530
- React.createElement(Icon, { color: isLowerercaseVerify.color, name: isLowerercaseVerify.isVerify
531
- ? IconName.CHECK_CIRCLE
532
- : IconName.TIMES, size: IconSize.SMALLER }),
533
- React.createElement(Text, { style: styles.textVerify }, "Minuscule")))))))));
321
+ type === InputType.PASSWORD && securityGauge && (React.createElement(InputGauge, { validationRules: validationRules, inputValue: value }))));
534
322
  };
535
323
  Input.displayName = ComponentName.Input;
324
+ Input.AutoComplete = (props) => {
325
+ const newProps = { ...props, Input };
326
+ return React.createElement(AutoComplete, { ...newProps });
327
+ };
536
328
  export default Input;
537
329
  //# sourceMappingURL=Input.native.js.map