aport-tools 4.3.1 → 4.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ interface InputCheckProps {
5
5
  id: string;
6
6
  label: string;
7
7
  icon?: string;
8
- value?: string;
8
+ value: string;
9
9
  }[];
10
10
  multi?: boolean;
11
11
  max?: number;
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! aport-tools v4.3.1 | ISC */
1
+ /*! aport-tools v4.3.3 | ISC */
2
2
  import React, { useContext, useState, createContext, useCallback, useMemo } from 'react';
3
3
  import { StyleSheet, Text as Text$1, View, TextInput, TouchableOpacity, Modal, Pressable, FlatList, Keyboard, Platform, Image, Alert, ActivityIndicator } from 'react-native';
4
4
  import { ThemeContext } from 'aport-themes';
@@ -386,13 +386,12 @@ var TextArea = function TextArea(_a) {
386
386
  style: [styles$6.textArea, style, {
387
387
  backgroundColor: colors.body.hex,
388
388
  color: colors.text.hex,
389
- borderColor: colors.placeHolder.hex
389
+ borderColor: formErrors[name] ? colors.error.hex : "#CCC"
390
390
  }],
391
391
  value: formValues[name] || '',
392
392
  onChangeText: handleChange,
393
393
  placeholder: label,
394
- placeholderTextColor: "#888" // Can be themed if needed
395
- ,
394
+ placeholderTextColor: colors.placeHolder.hex,
396
395
  multiline: true,
397
396
  numberOfLines: 4,
398
397
  textAlignVertical: "top"
@@ -471,7 +470,8 @@ var InputList = function InputList(_a) {
471
470
  onChange = _a.onChange;
472
471
  var _h = useFormContext(),
473
472
  formValues = _h.formValues,
474
- setFormValue = _h.setFormValue;
473
+ setFormValue = _h.setFormValue,
474
+ formErrors = _h.errors;
475
475
  var _j = useState(false),
476
476
  isDropdownVisible = _j[0],
477
477
  setIsDropdownVisible = _j[1];
@@ -548,14 +548,18 @@ var InputList = function InputList(_a) {
548
548
  marginBottom: 4
549
549
  }
550
550
  }, name), /*#__PURE__*/React.createElement(TouchableOpacity, {
551
- style: styles$4.inputContainer,
551
+ style: [styles$4.inputContainer, {
552
+ borderColor: formErrors[name] ? colors.error.hex : "#CCC"
553
+ }],
552
554
  onPress: toggleDropdown,
553
555
  disabled: disabled
554
556
  }, /*#__PURE__*/React.createElement(Text$1, {
555
557
  style: {
556
558
  color: colors.text.hex
557
559
  }
558
- }, renderSelectedText())), /*#__PURE__*/React.createElement(Modal, {
560
+ }, renderSelectedText())), formErrors[name] && formErrors[name].length > 0 && (/*#__PURE__*/React.createElement(ErrorList, {
561
+ errors: formErrors[name]
562
+ })), /*#__PURE__*/React.createElement(Modal, {
559
563
  visible: isDropdownVisible,
560
564
  transparent: true,
561
565
  animationType: "fade"
@@ -604,11 +608,12 @@ var InputList = function InputList(_a) {
604
608
  }))));
605
609
  };
606
610
  var styles$4 = StyleSheet.create({
607
- container: {},
611
+ container: {
612
+ marginVertical: 10
613
+ },
608
614
  inputContainer: {
609
615
  padding: 12,
610
616
  borderWidth: 1,
611
- borderColor: '#ccc',
612
617
  borderRadius: 5
613
618
  },
614
619
  dropdownContainer: {
@@ -761,7 +766,7 @@ var InputCheck = function InputCheck(_a) {
761
766
  return /*#__PURE__*/React.createElement(Card, {
762
767
  pressable: true,
763
768
  onPress: function onPress() {
764
- return handleSelect(item.id, item.value);
769
+ return handleSelect(item.id.toString(), item.value);
765
770
  },
766
771
  style: [styles$2.card, isSelected && {
767
772
  backgroundColor: colors.primary.hex
@@ -776,8 +781,7 @@ var InputCheck = function InputCheck(_a) {
776
781
  })), /*#__PURE__*/React.createElement(Text, {
777
782
  style: [styles$2.label, {
778
783
  color: isSelected ? colors.textButton.hex : colors.text.hex
779
- } // Replace with colors.textButton.hex
780
- ]
784
+ }]
781
785
  }, item.label));
782
786
  };
783
787
  return /*#__PURE__*/React.createElement(FlatList, {
@@ -834,9 +838,8 @@ var InputAttach = function InputAttach(_a) {
834
838
  _e = _a.placeholder,
835
839
  placeholder = _e === void 0 ? "Upload an image" : _e;
836
840
  var _f = useFormContext(),
837
- setFormValue = _f.setFormValue;
838
- _f.formValues;
839
- var errors = _f.errors;
841
+ setFormValue = _f.setFormValue,
842
+ errors = _f.errors;
840
843
  var _g = useState([]),
841
844
  selectedFiles = _g[0],
842
845
  setSelectedFiles = _g[1];
@@ -857,7 +860,9 @@ var InputAttach = function InputAttach(_a) {
857
860
  return [2 /*return*/];
858
861
  }
859
862
  return [4 /*yield*/, ImagePicker.launchImageLibraryAsync({
860
- mediaTypes: ImagePicker.MediaTypeOptions.Images,
863
+ mediaTypes: ["images"],
864
+ // Updated usage
865
+ allowsEditing: true,
861
866
  allowsMultipleSelection: amount > 1,
862
867
  quality: 1
863
868
  })];
@@ -950,7 +955,7 @@ var styles$1 = StyleSheet.create({
950
955
  marginVertical: 10
951
956
  },
952
957
  label: {
953
- marginBottom: 5
958
+ marginTop: 5
954
959
  },
955
960
  fileContainer: {
956
961
  flexDirection: "row",