@servesall/atoms 1.1.8 → 1.1.9

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.
@@ -233,6 +233,7 @@
233
233
  greenLight: "#F3FFFC",
234
234
  greenDark: "#236A56",
235
235
  greyText: "#b2bec3",
236
+ greyButton: "#94A3A9",
236
237
  red: "#ff7675",
237
238
  redlight: "#FFFAF9",
238
239
  redDark: "#9C4140",
@@ -288,8 +289,8 @@
288
289
  return React__default["default"].useContext(styled.ThemeContext);
289
290
  };
290
291
 
291
- var _templateObject$m, _templateObject2$d, _templateObject3$6, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1;
292
- var H1 = styled__default["default"].Text(_templateObject$m || (_templateObject$m = _taggedTemplateLiteral(["\n font-size: ", ";\n font-family: ", ";\n text-align: ", ";\n color: ", ";\n line-height: ", ";\n ", ";\n"])), function (props) {
292
+ var _templateObject$n, _templateObject2$e, _templateObject3$7, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1;
293
+ var H1 = styled__default["default"].Text(_templateObject$n || (_templateObject$n = _taggedTemplateLiteral(["\n font-size: ", ";\n font-family: ", ";\n text-align: ", ";\n color: ", ";\n line-height: ", ";\n ", ";\n"])), function (props) {
293
294
  return props.theme.large;
294
295
  }, function (props) {
295
296
  return props.fontFamily || props.theme.fontFamily1;
@@ -302,7 +303,7 @@
302
303
  }, function (props) {
303
304
  return props.style;
304
305
  });
305
- var H2 = styled__default["default"].Text(_templateObject2$d || (_templateObject2$d = _taggedTemplateLiteral(["\n font-size: ", ";\n font-family: ", ";\n text-align: ", ";\n color: ", ";\n line-height: ", ";\n ", ";\n"])), function (props) {
306
+ var H2 = styled__default["default"].Text(_templateObject2$e || (_templateObject2$e = _taggedTemplateLiteral(["\n font-size: ", ";\n font-family: ", ";\n text-align: ", ";\n color: ", ";\n line-height: ", ";\n ", ";\n"])), function (props) {
306
307
  return props.theme.medium;
307
308
  }, function (props) {
308
309
  return props.fontFamily || props.theme.fontFamily1;
@@ -315,7 +316,7 @@
315
316
  }, function (props) {
316
317
  return props.style;
317
318
  });
318
- var H3 = styled__default["default"].Text(_templateObject3$6 || (_templateObject3$6 = _taggedTemplateLiteral(["\n font-size: ", ";\n font-family: ", ";\n text-align: ", ";\n color: ", ";\n line-height: ", ";\n ", ";\n"])), function (props) {
319
+ var H3 = styled__default["default"].Text(_templateObject3$7 || (_templateObject3$7 = _taggedTemplateLiteral(["\n font-size: ", ";\n font-family: ", ";\n text-align: ", ";\n color: ", ";\n line-height: ", ";\n ", ";\n"])), function (props) {
319
320
  return props.theme.small;
320
321
  }, function (props) {
321
322
  return props.fontFamily || props.theme.fontFamily1;
@@ -542,14 +543,14 @@
542
543
  style: PropTypes__default["default"].object
543
544
  };
544
545
 
545
- var _templateObject$l, _templateObject2$c, _templateObject3$5, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19;
546
+ var _templateObject$m, _templateObject2$d, _templateObject3$6, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19;
546
547
  var DEFAULT_FLEX_DIRECTION = reactNative.Platform.OS === "web" ? "column" : "column";
547
- var CenterElement = styled__default["default"].View(_templateObject$l || (_templateObject$l = _taggedTemplateLiteral(["\n align-items: center;\n justify-content: center;\n flex: 1;\n flex-direction: ", ";\n ", ";\n"])), function (props) {
548
+ var CenterElement = styled__default["default"].View(_templateObject$m || (_templateObject$m = _taggedTemplateLiteral(["\n align-items: center;\n justify-content: center;\n flex: 1;\n flex-direction: ", ";\n ", ";\n"])), function (props) {
548
549
  return props.flexDirection || DEFAULT_FLEX_DIRECTION;
549
550
  }, function (props) {
550
551
  return props.style;
551
552
  });
552
- var CenterLeftElement = styled__default["default"].View(_templateObject2$c || (_templateObject2$c = _taggedTemplateLiteral(["\n align-items: ", ";\n justify-content: ", ";\n flex: 1;\n flex-direction: ", ";\n ", ";\n"])), function (props) {
553
+ var CenterLeftElement = styled__default["default"].View(_templateObject2$d || (_templateObject2$d = _taggedTemplateLiteral(["\n align-items: ", ";\n justify-content: ", ";\n flex: 1;\n flex-direction: ", ";\n ", ";\n"])), function (props) {
553
554
  return (props.flexDirection || DEFAULT_FLEX_DIRECTION) === "row" ? "center" : "flex-start";
554
555
  }, function (props) {
555
556
  return (props.flexDirection || DEFAULT_FLEX_DIRECTION) === "row" ? "flex-start" : "center";
@@ -558,7 +559,7 @@
558
559
  }, function (props) {
559
560
  return props.style;
560
561
  });
561
- var CenterRightElement = styled__default["default"].View(_templateObject3$5 || (_templateObject3$5 = _taggedTemplateLiteral(["\n align-items: ", ";\n justify-content: ", ";\n flex: 1;\n flex-direction: ", ";\n ", ";\n"])), function (props) {
562
+ var CenterRightElement = styled__default["default"].View(_templateObject3$6 || (_templateObject3$6 = _taggedTemplateLiteral(["\n align-items: ", ";\n justify-content: ", ";\n flex: 1;\n flex-direction: ", ";\n ", ";\n"])), function (props) {
562
563
  return (props.flexDirection || DEFAULT_FLEX_DIRECTION) === "row" ? "center" : "flex-end";
563
564
  }, function (props) {
564
565
  return (props.flexDirection || DEFAULT_FLEX_DIRECTION) === "row" ? "flex-end" : "center";
@@ -893,22 +894,22 @@
893
894
  }, children);
894
895
  };
895
896
 
896
- var _templateObject$k, _templateObject2$b, _templateObject3$4;
897
- var InputWrapper$1 = styled__default["default"].Pressable(_templateObject$k || (_templateObject$k = _taggedTemplateLiteral(["\n min-height: 80px;\n"])));
898
- var InputElement$1 = styled__default["default"].TextInput(_templateObject2$b || (_templateObject2$b = _taggedTemplateLiteral(["\n margin-top: 26px;\n min-height: 50px;\n font-family: ", ";\n font-size: ", ";\n color: ", ";\n"])), function (props) {
897
+ var _templateObject$l, _templateObject2$c, _templateObject3$5;
898
+ var InputWrapper$2 = styled__default["default"].Pressable(_templateObject$l || (_templateObject$l = _taggedTemplateLiteral(["\n min-height: 80px;\n"])));
899
+ var InputElement$2 = styled__default["default"].TextInput(_templateObject2$c || (_templateObject2$c = _taggedTemplateLiteral(["\n margin-top: 26px;\n min-height: 50px;\n font-family: ", ";\n font-size: ", ";\n color: ", ";\n"])), function (props) {
899
900
  return props.theme.fontFamily2;
900
901
  }, function (props) {
901
902
  return props.theme.small;
902
903
  }, function (props) {
903
904
  return props.theme.color2;
904
905
  });
905
- var BorderWrapper$2 = styled__default["default"].View(_templateObject3$4 || (_templateObject3$4 = _taggedTemplateLiteral(["\n height: 4px;\n"])));
906
+ var BorderWrapper$3 = styled__default["default"].View(_templateObject3$5 || (_templateObject3$5 = _taggedTemplateLiteral(["\n height: 4px;\n"])));
906
907
 
907
- var _templateObject$j, _templateObject2$a;
908
- var BorderIdle$1 = styled__default["default"].View(_templateObject$j || (_templateObject$j = _taggedTemplateLiteral(["\n height: 4px;\n background-color: ", ";\n flex: 1;\n position: absolute;\n width: 100%;\n z-index: 10;\n"])), function (props) {
908
+ var _templateObject$k, _templateObject2$b;
909
+ var BorderIdle$1 = styled__default["default"].View(_templateObject$k || (_templateObject$k = _taggedTemplateLiteral(["\n height: 4px;\n background-color: ", ";\n flex: 1;\n position: absolute;\n width: 100%;\n z-index: 10;\n"])), function (props) {
909
910
  return props.color;
910
911
  });
911
- var BorderActive$1 = styled__default["default"].View(_templateObject2$a || (_templateObject2$a = _taggedTemplateLiteral(["\n height: 4px;\n background-color: ", ";\n z-index: 11;\n"])), function (props) {
912
+ var BorderActive$1 = styled__default["default"].View(_templateObject2$b || (_templateObject2$b = _taggedTemplateLiteral(["\n height: 4px;\n background-color: ", ";\n z-index: 11;\n"])), function (props) {
912
913
  return props.color;
913
914
  });
914
915
 
@@ -944,7 +945,7 @@
944
945
  })));
945
946
  };
946
947
 
947
- var PlaceholderElement$1 = /*#__PURE__*/React__default["default"].memo(function (_ref) {
948
+ var PlaceholderElement$2 = /*#__PURE__*/React__default["default"].memo(function (_ref) {
948
949
  var children = _ref.children,
949
950
  active = _ref.active;
950
951
  var bottom = Animated.useSharedValue(active ? 50 : 4);
@@ -1024,18 +1025,18 @@
1024
1025
  return /*#__PURE__*/React__default["default"].createElement(reactNative.KeyboardAvoidingView, {
1025
1026
  behavior: reactNative.Platform.OS === "ios" ? "padding" : "height",
1026
1027
  keyboardVerticalOffset: keyboardVerticalOffset
1027
- }, /*#__PURE__*/React__default["default"].createElement(InputWrapper$1, {
1028
+ }, /*#__PURE__*/React__default["default"].createElement(InputWrapper$2, {
1028
1029
  onPress: function onPress() {
1029
1030
  var _inputRef$current2;
1030
1031
 
1031
1032
  setIsFocused(true);
1032
1033
  (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus();
1033
1034
  }
1034
- }, /*#__PURE__*/React__default["default"].createElement(PlaceholderElement$1, {
1035
+ }, /*#__PURE__*/React__default["default"].createElement(PlaceholderElement$2, {
1035
1036
  active: isFocused || textValue && textValue.length > 0
1036
1037
  }, !hasError ? children : /*#__PURE__*/React__default["default"].createElement(H3Text, {
1037
1038
  color: borderColorError
1038
- }, error || hasError)), /*#__PURE__*/React__default["default"].createElement(InputElement$1, {
1039
+ }, error || hasError)), /*#__PURE__*/React__default["default"].createElement(InputElement$2, {
1039
1040
  ref: inputRef,
1040
1041
  onFocus: function onFocus() {
1041
1042
  return setIsFocused(true);
@@ -1055,7 +1056,7 @@
1055
1056
  keyboardType: keyboardType,
1056
1057
  editable: editable,
1057
1058
  style: style
1058
- }), /*#__PURE__*/React__default["default"].createElement(BorderWrapper$2, null, /*#__PURE__*/React__default["default"].createElement(Line$1, {
1059
+ }), /*#__PURE__*/React__default["default"].createElement(BorderWrapper$3, null, /*#__PURE__*/React__default["default"].createElement(Line$1, {
1059
1060
  active: isFocused,
1060
1061
  borderColorActive: borderColorActive,
1061
1062
  borderColorIdle: borderColorIdle,
@@ -1202,9 +1203,9 @@
1202
1203
  }))));
1203
1204
  };
1204
1205
 
1205
- var _templateObject$i, _templateObject2$9, _templateObject3$3;
1206
- var InputWrapper = styled__default["default"].Pressable(_templateObject$i || (_templateObject$i = _taggedTemplateLiteral(["\n min-height: 70px;\n"])));
1207
- var InputElement = styled__default["default"].TextInput(_templateObject2$9 || (_templateObject2$9 = _taggedTemplateLiteral(["\n min-height: 40px;\n font-family: ", ";\n font-size: ", ";\n color: ", ";\n background-color: ", ";\n"])), function (props) {
1206
+ var _templateObject$j, _templateObject2$a, _templateObject3$4;
1207
+ var InputWrapper$1 = styled__default["default"].Pressable(_templateObject$j || (_templateObject$j = _taggedTemplateLiteral(["\n min-height: 70px;\n"])));
1208
+ var InputElement$1 = styled__default["default"].TextInput(_templateObject2$a || (_templateObject2$a = _taggedTemplateLiteral(["\n min-height: 40px;\n font-family: ", ";\n font-size: ", ";\n color: ", ";\n background-color: ", ";\n"])), function (props) {
1208
1209
  return props.theme.fontFamily2;
1209
1210
  }, function (props) {
1210
1211
  return props.theme.small;
@@ -1213,15 +1214,31 @@
1213
1214
  }, function (props) {
1214
1215
  return props.active ? props.theme.color1 : props.theme.color10;
1215
1216
  });
1216
- var BorderWrapper$1 = styled__default["default"].View(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteral(["\n min-height: 70px;\n padding-top: 26px;\n border-width: 2px;\n border-color: ", ";\n border-radius: ", ";\n background-color: ", ";\n"])), function (props) {
1217
+ var BorderWrapper$2 = styled__default["default"].View(_templateObject3$4 || (_templateObject3$4 = _taggedTemplateLiteral(["\n min-height: 70px;\n padding-top: 26px;\n border-width: 2px;\n border-color: ", ";\n border-radius: ", ";\n background-color: ", ";\n ", "\n"])), function (props) {
1217
1218
  return props.color;
1218
1219
  }, function (props) {
1219
1220
  return props.theme.borderRadiusSmall;
1220
1221
  }, function (props) {
1221
1222
  return props.active ? props.theme.color1 : props.theme.color10;
1223
+ }, function (_ref) {
1224
+ var isRightBound = _ref.isRightBound,
1225
+ isLeftBound = _ref.isLeftBound,
1226
+ active = _ref.active;
1227
+
1228
+ if (isRightBound) {
1229
+ if (!active) {
1230
+ return "borderTopRightRadius: 0px; borderBottomRightRadius: 0px; border-right-width: 0px;";
1231
+ }
1232
+
1233
+ return "borderTopRightRadius: 0px; borderBottomRightRadius: 0px;";
1234
+ }
1235
+
1236
+ if (isLeftBound) {
1237
+ return "borderTopLeftRadius: 0px; borderBottomLeftRadius: 0px;";
1238
+ }
1222
1239
  });
1223
1240
 
1224
- var PlaceholderElement = /*#__PURE__*/React__default["default"].memo(function (_ref) {
1241
+ var PlaceholderElement$1 = /*#__PURE__*/React__default["default"].memo(function (_ref) {
1225
1242
  var children = _ref.children,
1226
1243
  active = _ref.active;
1227
1244
  var top = Animated.useSharedValue(active ? 10 : 30);
@@ -1278,7 +1295,11 @@
1278
1295
  keyboardVerticalOffset = _ref$keyboardVertical === void 0 ? 0 : _ref$keyboardVertical,
1279
1296
  _ref$hasError = _ref.hasError,
1280
1297
  hasError = _ref$hasError === void 0 ? false : _ref$hasError,
1281
- error = _ref.error;
1298
+ error = _ref.error,
1299
+ _ref$isRightBound = _ref.isRightBound,
1300
+ isRightBound = _ref$isRightBound === void 0 ? false : _ref$isRightBound,
1301
+ _ref$isLeftBound = _ref.isLeftBound,
1302
+ isLeftBound = _ref$isLeftBound === void 0 ? false : _ref$isLeftBound;
1282
1303
 
1283
1304
  var _useState = React.useState(false),
1284
1305
  _useState2 = _slicedToArray(_useState, 2),
@@ -1302,7 +1323,7 @@
1302
1323
  return /*#__PURE__*/React__default["default"].createElement(reactNative.KeyboardAvoidingView, {
1303
1324
  behavior: reactNative.Platform.OS === "ios" ? "padding" : "height",
1304
1325
  keyboardVerticalOffset: keyboardVerticalOffset
1305
- }, /*#__PURE__*/React__default["default"].createElement(InputWrapper, {
1326
+ }, /*#__PURE__*/React__default["default"].createElement(InputWrapper$1, {
1306
1327
  onPress: function onPress() {
1307
1328
  var _inputRef$current2;
1308
1329
 
@@ -1311,14 +1332,16 @@
1311
1332
  editable && setIsFocused(true);
1312
1333
  editable && ((_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus());
1313
1334
  }
1314
- }, /*#__PURE__*/React__default["default"].createElement(BorderWrapper$1, {
1335
+ }, /*#__PURE__*/React__default["default"].createElement(BorderWrapper$2, {
1336
+ isRightBound: isRightBound,
1337
+ isLeftBound: isLeftBound,
1315
1338
  active: isFocused,
1316
1339
  color: !hasError ? isFocused ? borderColorActive : borderColorIdle : borderColorError
1317
- }, /*#__PURE__*/React__default["default"].createElement(PlaceholderElement, {
1340
+ }, /*#__PURE__*/React__default["default"].createElement(PlaceholderElement$1, {
1318
1341
  active: isFocused || textValue && textValue.length > 0 || value && value.length > 0
1319
1342
  }, /*#__PURE__*/React__default["default"].createElement(MarginHorizontal, null, !hasError ? children : /*#__PURE__*/React__default["default"].createElement(H4Text, {
1320
1343
  color: borderColorError
1321
- }, error || hasError))), /*#__PURE__*/React__default["default"].createElement(MarginHorizontal, null, /*#__PURE__*/React__default["default"].createElement(InputElement, {
1344
+ }, error || hasError))), /*#__PURE__*/React__default["default"].createElement(MarginHorizontal, null, /*#__PURE__*/React__default["default"].createElement(InputElement$1, {
1322
1345
  ref: inputRef,
1323
1346
  onFocus: function onFocus() {
1324
1347
  return setIsFocused(true);
@@ -1342,6 +1365,192 @@
1342
1365
  })))));
1343
1366
  };
1344
1367
 
1368
+ var _templateObject$i, _templateObject2$9, _templateObject3$3;
1369
+ var InputWrapper = styled__default["default"].Pressable(_templateObject$i || (_templateObject$i = _taggedTemplateLiteral(["\n min-height: 70px;\n"])));
1370
+ var InputElement = styled__default["default"].TextInput(_templateObject2$9 || (_templateObject2$9 = _taggedTemplateLiteral(["\n min-height: 40px;\n font-family: ", ";\n font-size: ", ";\n color: ", ";\n background-color: ", ";\n"])), function (props) {
1371
+ return props.theme.fontFamily2;
1372
+ }, function (props) {
1373
+ return props.theme.small;
1374
+ }, function (props) {
1375
+ return props.theme.color2;
1376
+ }, function (props) {
1377
+ return props.active ? props.theme.color1 : props.theme.color10;
1378
+ });
1379
+ var BorderWrapper$1 = styled__default["default"].View(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteral(["\n min-height: 70px;\n padding-top: 26px;\n border-width: 2px;\n border-color: ", ";\n border-radius: ", ";\n background-color: ", ";\n"])), function (props) {
1380
+ return props.color;
1381
+ }, function (props) {
1382
+ return props.theme.borderRadiusSmall;
1383
+ }, function (props) {
1384
+ return props.active ? props.theme.color1 : props.theme.color10;
1385
+ });
1386
+
1387
+ var PlaceholderElement = /*#__PURE__*/React__default["default"].memo(function (_ref) {
1388
+ var children = _ref.children,
1389
+ active = _ref.active;
1390
+ var top = Animated.useSharedValue(active ? 10 : 30);
1391
+ var animatedStyle = Animated.useAnimatedStyle(function () {
1392
+ return {
1393
+ top: Animated.withTiming(top.value, {
1394
+ duration: 250,
1395
+ easing: Animated.Easing.bezier(0.19, 1.0, 0.22, 1.0)
1396
+ })
1397
+ };
1398
+ });
1399
+ React.useEffect(function () {
1400
+ if (active) {
1401
+ top.value = 10;
1402
+ }
1403
+
1404
+ if (!active) {
1405
+ top.value = 30;
1406
+ }
1407
+ }, [active]);
1408
+ return /*#__PURE__*/React__default["default"].createElement(Animated__default["default"].View, {
1409
+ style: [{
1410
+ position: "absolute",
1411
+ zIndex: 1,
1412
+ justifyContent: "center"
1413
+ }, animatedStyle]
1414
+ }, children);
1415
+ });
1416
+
1417
+ var InputPhone = function InputPhone(_ref) {
1418
+ var children = _ref.children,
1419
+ style = _ref.style,
1420
+ borderColorIdle = _ref.borderColorIdle,
1421
+ borderColorActive = _ref.borderColorActive,
1422
+ borderColorError = _ref.borderColorError,
1423
+ _ref$textChangePrefix = _ref.textChangePrefix,
1424
+ textChangePrefix = _ref$textChangePrefix === void 0 ? function () {} : _ref$textChangePrefix,
1425
+ _ref$textChangeNumber = _ref.textChangeNumber,
1426
+ textChangeNumber = _ref$textChangeNumber === void 0 ? function () {} : _ref$textChangeNumber,
1427
+ _ref$onPress = _ref.onPress,
1428
+ _onPress = _ref$onPress === void 0 ? function () {} : _ref$onPress,
1429
+ valuePrefix = _ref.valuePrefix,
1430
+ valueNumber = _ref.valueNumber,
1431
+ defaultValuePrefix = _ref.defaultValuePrefix,
1432
+ defaultValueNumber = _ref.defaultValueNumber,
1433
+ _ref$multiline = _ref.multiline,
1434
+ multiline = _ref$multiline === void 0 ? false : _ref$multiline,
1435
+ _ref$numberOfLines = _ref.numberOfLines,
1436
+ numberOfLines = _ref$numberOfLines === void 0 ? 1 : _ref$numberOfLines,
1437
+ _ref$maxLength = _ref.maxLength,
1438
+ maxLength = _ref$maxLength === void 0 ? 1000 : _ref$maxLength,
1439
+ _ref$autoFocus = _ref.autoFocus,
1440
+ autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
1441
+ keyboardType = _ref.keyboardType,
1442
+ _ref$editable = _ref.editable,
1443
+ editable = _ref$editable === void 0 ? true : _ref$editable,
1444
+ _ref$keyboardVertical = _ref.keyboardVerticalOffset,
1445
+ keyboardVerticalOffset = _ref$keyboardVertical === void 0 ? 0 : _ref$keyboardVertical,
1446
+ _ref$hasError = _ref.hasError,
1447
+ hasError = _ref$hasError === void 0 ? false : _ref$hasError,
1448
+ error = _ref.error;
1449
+
1450
+ var _useState = React.useState(false),
1451
+ _useState2 = _slicedToArray(_useState, 2),
1452
+ isFocused = _useState2[0],
1453
+ setIsFocused = _useState2[1];
1454
+
1455
+ var _useState3 = React.useState(valuePrefix || defaultValuePrefix),
1456
+ _useState4 = _slicedToArray(_useState3, 2),
1457
+ textValue = _useState4[0],
1458
+ setTextValue = _useState4[1];
1459
+
1460
+ var _useState5 = React.useState(false),
1461
+ _useState6 = _slicedToArray(_useState5, 2),
1462
+ isFocusedPrefix = _useState6[0],
1463
+ setIsFocusedPrefix = _useState6[1];
1464
+
1465
+ var _useState7 = React.useState(valueNumber || defaultValueNumber),
1466
+ _useState8 = _slicedToArray(_useState7, 2),
1467
+ textPrefixValue = _useState8[0],
1468
+ setTextPrefixValue = _useState8[1];
1469
+
1470
+ var inputRef = React.useRef();
1471
+ React.useEffect(function () {
1472
+ textChangeNumber(textValue);
1473
+ }, [textValue]);
1474
+ React.useEffect(function () {
1475
+ textChangePrefix(textPrefixValue);
1476
+ }, [textPrefixValue]);
1477
+ React.useEffect(function () {
1478
+ var _inputRef$current;
1479
+
1480
+ autoFocus && ((_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus());
1481
+ }, [autoFocus]);
1482
+ return /*#__PURE__*/React__default["default"].createElement(reactNative.KeyboardAvoidingView, {
1483
+ behavior: reactNative.Platform.OS === "ios" ? "padding" : "height",
1484
+ keyboardVerticalOffset: keyboardVerticalOffset
1485
+ }, /*#__PURE__*/React__default["default"].createElement(InputWrapper, {
1486
+ onPress: function onPress() {
1487
+ var _inputRef$current2;
1488
+
1489
+ _onPress();
1490
+
1491
+ editable && setIsFocused(true);
1492
+ editable && ((_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus());
1493
+ }
1494
+ }, /*#__PURE__*/React__default["default"].createElement(BorderWrapper$1, {
1495
+ active: isFocused,
1496
+ color: !hasError ? isFocused ? borderColorActive : borderColorIdle : borderColorError
1497
+ }, /*#__PURE__*/React__default["default"].createElement(Row, {
1498
+ style: {
1499
+ backgroundColor: "red",
1500
+ width: "100%"
1501
+ }
1502
+ }, /*#__PURE__*/React__default["default"].createElement(Box, null, /*#__PURE__*/React__default["default"].createElement(PlaceholderElement, {
1503
+ active: isFocusedPrefix || textPrefixValue && textPrefixValue.length > 0 || valuePrefix && valuePrefix.length > 0
1504
+ }, /*#__PURE__*/React__default["default"].createElement(MarginHorizontal, null, !hasError ? children[0] : /*#__PURE__*/React__default["default"].createElement(H4Text, {
1505
+ color: borderColorError
1506
+ }, error || hasError)))), /*#__PURE__*/React__default["default"].createElement(Box, null, /*#__PURE__*/React__default["default"].createElement(PlaceholderElement, {
1507
+ active: isFocused || textValue && textValue.length > 0 || valueNumber && valueNumber.length > 0
1508
+ }, /*#__PURE__*/React__default["default"].createElement(MarginHorizontal, null, !hasError ? children[1] : /*#__PURE__*/React__default["default"].createElement(H4Text, {
1509
+ color: borderColorError
1510
+ }, error || hasError))))), /*#__PURE__*/React__default["default"].createElement(MarginHorizontal, null, /*#__PURE__*/React__default["default"].createElement(Row, null, /*#__PURE__*/React__default["default"].createElement(InputElement, {
1511
+ onFocus: function onFocus() {
1512
+ return setIsFocusedPrefix(true);
1513
+ },
1514
+ onBlur: function onBlur() {
1515
+ return setIsFocusedPrefix(false);
1516
+ },
1517
+ onChangeText: function onChangeText(text) {
1518
+ return setTextPrefixValue(text);
1519
+ },
1520
+ defaultValue: defaultValuePrefix,
1521
+ value: valuePrefix,
1522
+ multiline: multiline,
1523
+ numberOfLines: numberOfLines,
1524
+ maxLength: maxLength,
1525
+ autoFocus: autoFocus,
1526
+ keyboardType: keyboardType,
1527
+ editable: editable,
1528
+ active: isFocusedPrefix,
1529
+ style: style
1530
+ }), /*#__PURE__*/React__default["default"].createElement(InputElement, {
1531
+ ref: inputRef,
1532
+ onFocus: function onFocus() {
1533
+ return setIsFocused(true);
1534
+ },
1535
+ onBlur: function onBlur() {
1536
+ return setIsFocused(false);
1537
+ },
1538
+ onChangeText: function onChangeText(text) {
1539
+ return setTextValue(text);
1540
+ },
1541
+ defaultValue: defaultValueNumber,
1542
+ value: valueNumber,
1543
+ multiline: multiline,
1544
+ numberOfLines: numberOfLines,
1545
+ maxLength: maxLength,
1546
+ autoFocus: autoFocus,
1547
+ keyboardType: keyboardType,
1548
+ editable: editable,
1549
+ active: isFocused,
1550
+ style: style
1551
+ }))))));
1552
+ };
1553
+
1345
1554
  var _templateObject$h, _templateObject2$8, _templateObject3$2;
1346
1555
  var ButtonWrapper = styled__default["default"].Pressable(_templateObject$h || (_templateObject$h = _taggedTemplateLiteral([""])));
1347
1556
  var BorderWrapper = styled__default["default"].View(_templateObject2$8 || (_templateObject2$8 = _taggedTemplateLiteral(["\n height: 18px;\n position: absolute;\n width: 100%;\n bottom: 10;\n z-index: 0;\n"])));
@@ -1419,14 +1628,12 @@
1419
1628
 
1420
1629
  var _templateObject$f, _templateObject2$6;
1421
1630
  styled__default["default"].View(_templateObject$f || (_templateObject$f = _taggedTemplateLiteral([""])));
1422
- var ButtonStyle$4 = styled__default["default"].Pressable(_templateObject2$6 || (_templateObject2$6 = _taggedTemplateLiteral(["\n min-height: ", ";\n width: 100%;\n border-radius: ", ";\n background-color: ", ";\n opacity: ", ";\n ", ";\n"])), function (props) {
1631
+ var ButtonStyle$4 = styled__default["default"].Pressable(_templateObject2$6 || (_templateObject2$6 = _taggedTemplateLiteral(["\n min-height: ", ";\n width: 100%;\n border-radius: ", ";\n background-color: ", ";\n ", ";\n"])), function (props) {
1423
1632
  return props.size === "big" ? "60px" : "54px";
1424
1633
  }, function (props) {
1425
- return props.theme.borderRadiusMedium;
1426
- }, function (props) {
1427
- return props.color;
1634
+ return props.smallBorder ? props.theme.borderRadiusSmall : props.theme.borderRadiusMedium;
1428
1635
  }, function (props) {
1429
- return props.active ? 1 : 0.7;
1636
+ return props.active ? props.color : props.theme.greyButton;
1430
1637
  }, function (props) {
1431
1638
  return props.style;
1432
1639
  });
@@ -1441,6 +1648,8 @@
1441
1648
  style = _ref.style,
1442
1649
  _ref$size = _ref.size,
1443
1650
  size = _ref$size === void 0 ? "big" : _ref$size,
1651
+ _ref$smallBorder = _ref.smallBorder,
1652
+ smallBorder = _ref$smallBorder === void 0 ? false : _ref$smallBorder,
1444
1653
  _ref$hitSlop = _ref.hitSlop,
1445
1654
  hitSlop = _ref$hitSlop === void 0 ? 0 : _ref$hitSlop;
1446
1655
  var scale = Animated.useSharedValue(1);
@@ -1455,6 +1664,7 @@
1455
1664
  return /*#__PURE__*/React__default["default"].createElement(Animated__default["default"].View, {
1456
1665
  style: [animatedStyle]
1457
1666
  }, /*#__PURE__*/React__default["default"].createElement(ButtonStyle$4, {
1667
+ smallBorder: smallBorder,
1458
1668
  hitSlop: hitSlop,
1459
1669
  size: size,
1460
1670
  active: active,
@@ -54227,11 +54437,19 @@
54227
54437
  source: {
54228
54438
  uri: item.src
54229
54439
  }
54230
- }), /*#__PURE__*/React__default["default"].createElement(Row, null, /*#__PURE__*/React__default["default"].createElement(Box, {
54440
+ }), /*#__PURE__*/React__default["default"].createElement(Row, {
54441
+ style: {
54442
+ alignItems: "center"
54443
+ }
54444
+ }, /*#__PURE__*/React__default["default"].createElement(Box, {
54231
54445
  style: {
54232
54446
  flex: 4
54233
54447
  }
54234
- }, /*#__PURE__*/React__default["default"].createElement(MarginHorizontal, null, /*#__PURE__*/React__default["default"].createElement(H4Text, null, item.name))), variant === "countryCode" && /*#__PURE__*/React__default["default"].createElement(Box, null, /*#__PURE__*/React__default["default"].createElement(MarginHorizontal, null, /*#__PURE__*/React__default["default"].createElement(H4Text, null, item.code)))))))));
54448
+ }, /*#__PURE__*/React__default["default"].createElement(MarginHorizontal, null, /*#__PURE__*/React__default["default"].createElement(H4Text, null, item.name))), variant === "countryCode" && /*#__PURE__*/React__default["default"].createElement(Box, {
54449
+ style: {
54450
+ flex: 3
54451
+ }
54452
+ }, /*#__PURE__*/React__default["default"].createElement(MarginHorizontal, null, /*#__PURE__*/React__default["default"].createElement(H4Text, null, item.code)))))))));
54235
54453
  };
54236
54454
 
54237
54455
  function NewCustomer(_ref2) {
@@ -54373,6 +54591,7 @@
54373
54591
  exports.Input = Input$1;
54374
54592
  exports.InputNormal = Input;
54375
54593
  exports.InputOtp = InputOtp;
54594
+ exports.InputPhone = InputPhone;
54376
54595
  exports.Loader = Loader;
54377
54596
  exports.Margin = Margin;
54378
54597
  exports.MarginBottom = MarginBottom;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servesall/atoms",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "Atoms for react-native",
5
5
  "main": "dist/bundle.cjs.js",
6
6
  "module": "dist/bundle.esm.js",
@@ -5,8 +5,11 @@ export const ButtonWrapper = styled.View``;
5
5
  export const ButtonStyle = styled.Pressable`
6
6
  min-height: ${(props) => (props.size === "big" ? "60px" : "54px")};
7
7
  width: 100%;
8
- border-radius: ${(props) => props.theme.borderRadiusMedium};
9
- background-color: ${(props) => props.color};
10
- opacity: ${(props) => (props.active ? 1 : 0.7)};
8
+ border-radius: ${(props) =>
9
+ props.smallBorder
10
+ ? props.theme.borderRadiusSmall
11
+ : props.theme.borderRadiusMedium};
12
+ background-color: ${(props) =>
13
+ props.active ? props.color : props.theme.greyButton};
11
14
  ${(props) => props.style};
12
15
  `;
@@ -14,6 +14,7 @@ const RoundedBtn = ({
14
14
  onClick = () => {},
15
15
  style,
16
16
  size = "big",
17
+ smallBorder = false,
17
18
  hitSlop = 0,
18
19
  }) => {
19
20
  const scale = useSharedValue(1);
@@ -32,6 +33,7 @@ const RoundedBtn = ({
32
33
  return (
33
34
  <Animated.View style={[animatedStyle]}>
34
35
  <ButtonStyle
36
+ smallBorder={smallBorder}
35
37
  hitSlop={hitSlop}
36
38
  size={size}
37
39
  active={active}
@@ -31,14 +31,14 @@ const Item = ({ item, setSelected, variant }) => {
31
31
  uri: item.src,
32
32
  }}
33
33
  />
34
- <Row>
34
+ <Row style={{ alignItems: "center" }}>
35
35
  <Box style={{ flex: 4 }}>
36
36
  <MarginHorizontal>
37
37
  <H4>{item.name}</H4>
38
38
  </MarginHorizontal>
39
39
  </Box>
40
40
  {variant === "countryCode" && (
41
- <Box>
41
+ <Box style={{ flex: 3 }}>
42
42
  <MarginHorizontal>
43
43
  <H4>{item.code}</H4>
44
44
  </MarginHorizontal>
@@ -20,4 +20,15 @@ export const BorderWrapper = styled.View`
20
20
  border-radius: ${(props) => props.theme.borderRadiusSmall};
21
21
  background-color: ${(props) =>
22
22
  props.active ? props.theme.color1 : props.theme.color10};
23
+ ${({ isRightBound, isLeftBound, active }) => {
24
+ if (isRightBound) {
25
+ if (!active) {
26
+ return "borderTopRightRadius: 0px; borderBottomRightRadius: 0px; border-right-width: 0px;";
27
+ }
28
+ return "borderTopRightRadius: 0px; borderBottomRightRadius: 0px;";
29
+ }
30
+ if (isLeftBound) {
31
+ return "borderTopLeftRadius: 0px; borderBottomLeftRadius: 0px;";
32
+ }
33
+ }}
23
34
  `;
@@ -24,6 +24,8 @@ const Input = ({
24
24
  keyboardVerticalOffset = 0,
25
25
  hasError = false,
26
26
  error,
27
+ isRightBound = false,
28
+ isLeftBound = false,
27
29
  }) => {
28
30
  const [isFocused, setIsFocused] = useState(false);
29
31
  const [textValue, setTextValue] = useState(value || defaultValue);
@@ -50,6 +52,8 @@ const Input = ({
50
52
  }}
51
53
  >
52
54
  <BorderWrapper
55
+ isRightBound={isRightBound}
56
+ isLeftBound={isLeftBound}
53
57
  active={isFocused}
54
58
  color={
55
59
  !hasError
@@ -0,0 +1,23 @@
1
+ import styled from "styled-components/native";
2
+
3
+ export const InputWrapper = styled.Pressable`
4
+ min-height: 70px;
5
+ `;
6
+
7
+ export const InputElement = styled.TextInput`
8
+ min-height: 40px;
9
+ font-family: ${(props) => props.theme.fontFamily2};
10
+ font-size: ${(props) => props.theme.small};
11
+ color: ${(props) => props.theme.color2};
12
+ background-color: ${(props) =>
13
+ props.active ? props.theme.color1 : props.theme.color10};
14
+ `;
15
+ export const BorderWrapper = styled.View`
16
+ min-height: 70px;
17
+ padding-top: 26px;
18
+ border-width: 2px;
19
+ border-color: ${(props) => props.color};
20
+ border-radius: ${(props) => props.theme.borderRadiusSmall};
21
+ background-color: ${(props) =>
22
+ props.active ? props.theme.color1 : props.theme.color10};
23
+ `;
@@ -0,0 +1,46 @@
1
+ import React, { useEffect } from "react";
2
+ import Animated, {
3
+ Easing,
4
+ useAnimatedStyle,
5
+ useSharedValue,
6
+ withTiming,
7
+ } from "react-native-reanimated";
8
+
9
+ const PlaceholderElement = React.memo(({ children, active }) => {
10
+ const top = useSharedValue(active ? 10 : 30);
11
+
12
+ const animatedStyle = useAnimatedStyle(() => {
13
+ return {
14
+ top: withTiming(top.value, {
15
+ duration: 250,
16
+ easing: Easing.bezier(0.19, 1.0, 0.22, 1.0),
17
+ }),
18
+ };
19
+ });
20
+
21
+ useEffect(() => {
22
+ if (active) {
23
+ top.value = 10;
24
+ }
25
+ if (!active) {
26
+ top.value = 30;
27
+ }
28
+ }, [active]);
29
+
30
+ return (
31
+ <Animated.View
32
+ style={[
33
+ {
34
+ position: "absolute",
35
+ zIndex: 1,
36
+ justifyContent: "center",
37
+ },
38
+ animatedStyle,
39
+ ]}
40
+ >
41
+ {children}
42
+ </Animated.View>
43
+ );
44
+ });
45
+
46
+ export default PlaceholderElement;