etendo-ui-library 1.3.89 → 1.3.90
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.
- package/dist-native/components/inputBase/InputBase.styles.d.ts +0 -3
- package/dist-native/components/inputBase/InputBase.styles.js +1 -1
- package/dist-native/components/inputBase/file-search-input/FileSearchInput.d.ts +1 -1
- package/dist-native/components/inputBase/file-search-input/FileSearchInput.js +1 -1
- package/dist-native/components/inputBase/file-search-input/FileSearchInput.styles.d.ts +12 -3
- package/dist-native/components/inputBase/file-search-input/FileSearchInput.styles.js +1 -1
- package/dist-native/components/inputBase/file-search-input/FileSearchInput.types.d.ts +10 -10
- package/dist-native/helpers/functions_utils.d.ts +1 -0
- package/dist-native/helpers/functions_utils.js +1 -0
- package/dist-web/components/inputBase/InputBase.styles.d.ts +0 -3
- package/dist-web/components/inputBase/InputBase.styles.js +0 -3
- package/dist-web/components/inputBase/file-search-input/FileSearchInput.d.ts +1 -1
- package/dist-web/components/inputBase/file-search-input/FileSearchInput.js +104 -51
- package/dist-web/components/inputBase/file-search-input/FileSearchInput.styles.d.ts +12 -3
- package/dist-web/components/inputBase/file-search-input/FileSearchInput.styles.js +15 -6
- package/dist-web/components/inputBase/file-search-input/FileSearchInput.types.d.ts +10 -10
- package/dist-web/helpers/functions_utils.d.ts +1 -0
- package/dist-web/helpers/functions_utils.js +4 -0
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare const styles: {
|
|
2
2
|
title: {
|
|
3
|
-
fontFamily: string;
|
|
4
3
|
fontSize: number;
|
|
5
4
|
fontWeight: "600";
|
|
6
5
|
lineHeight: number;
|
|
@@ -54,7 +53,6 @@ export declare const styles: {
|
|
|
54
53
|
paddingHorizontal: number;
|
|
55
54
|
height: number;
|
|
56
55
|
backgroundColor: string;
|
|
57
|
-
fontFamily: string;
|
|
58
56
|
fontSize: number;
|
|
59
57
|
fontStyle: "normal";
|
|
60
58
|
fontWeight: "500";
|
|
@@ -64,7 +62,6 @@ export declare const styles: {
|
|
|
64
62
|
flex: number;
|
|
65
63
|
};
|
|
66
64
|
helperText: {
|
|
67
|
-
fontFamily: string;
|
|
68
65
|
fontSize: number;
|
|
69
66
|
fontWeight: "500";
|
|
70
67
|
lineHeight: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.styles=void 0;var _reactNative=require("react-native");var _colors=require("../../styles/colors");var styles=exports.styles=_reactNative.StyleSheet.create({title:{
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.styles=void 0;var _reactNative=require("react-native");var _colors=require("../../styles/colors");var styles=exports.styles=_reactNative.StyleSheet.create({title:{fontSize:16,fontWeight:'600',lineHeight:24,letterSpacing:-0.16,color:_colors.NEUTRAL_800},container:{backgroundColor:_colors.NEUTRAL_50,height:48,borderRadius:8,borderColor:_colors.PRIMARY_100,overflow:'hidden',justifyContent:'center',alignItems:'center',flexDirection:'row'},containerIsError:{borderColor:_colors.DANGER_600},containerIsDisabled:{borderColor:_colors.NEUTRAL_400},containerPlaceholder:{borderColor:_colors.NEUTRAL_400},iconPlaceholder:{color:_colors.NEUTRAL_800},iconIsDisabled:{color:_colors.NEUTRAL_500},iconIsError:{color:_colors.NEUTRAL_800},iconIsFocus:{color:_colors.NEUTRAL_1000},textPlaceholder:{color:_colors.NEUTRAL_500},textIsError:{color:_colors.DANGER_700},textIsFocus:{color:_colors.NEUTRAL_800},textIsDisabled:{color:_colors.NEUTRAL_500},textInput:{paddingHorizontal:0,height:48,backgroundColor:_colors.NEUTRAL_50,fontSize:16,fontStyle:'normal',fontWeight:'500',lineHeight:22,letterSpacing:-0.16,color:_colors.PRIMARY_100,flex:1},helperText:{fontSize:14,fontWeight:'500',lineHeight:22,letterSpacing:-0.14,color:_colors.NEUTRAL_800},iconLeft:{width:24,height:24,marginRight:8},iconRight:{width:24,height:24,marginLeft:8},iconSize:{width:24,height:24},buttonContainer:{flexDirection:'row',paddingVertical:0,gap:0,marginLeft:5}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FileSearchInputProps } from './FileSearchInput.types';
|
|
3
|
-
declare const FileSearchInput: ({ value, placeholder, onChangeText, onSubmit, setFile,
|
|
3
|
+
declare const FileSearchInput: ({ value, placeholder, onChangeText, onSubmit, setFile, uploadConfig, maxFileSize, ...inputBaseProps }: FileSearchInputProps) => React.JSX.Element;
|
|
4
4
|
export default FileSearchInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _InputBase=_interopRequireDefault(require("../InputBase"));var _FileSearchInput=require("./FileSearchInput.styles");var _colors=require("../../../styles/colors");var _CheckCircleIcon=require("../../../assets/images/icons/CheckCircleIcon");var _Clipboard=require("../../../assets/images/icons/Clipboard");var _DeleteIcon=require("../../../assets/images/icons/DeleteIcon");var _FileIcon=require("../../../assets/images/icons/FileIcon");var _button=require("../../button");var _alert=require("../../alert");var _excluded=["value","placeholder","onChangeText","onSubmit","setFile","uploadFile","loadedFile","setLoadedFile","maxFileSize"];var _this=this,_jsxFileName="/home/jenkins/agent/workspace/etendo_ui_library_develop/etendo_ui_library/src/components/inputBase/file-search-input/FileSearchInput.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var DocumentPicker=null;if(_reactNative.Platform.OS!=='web'){try{import('react-native-document-picker').then(function(module){DocumentPicker=module.default;}).catch(function(error){console.error('Cannot load DocumentPicker',error);});}catch(error){console.error('Error importing DocumentPicker',error);}}var FileSearchInput=function FileSearchInput(_ref){var value=_ref.value,placeholder=_ref.placeholder,onChangeText=_ref.onChangeText,onSubmit=_ref.onSubmit,setFile=_ref.setFile,uploadFile=_ref.uploadFile,loadedFile=_ref.loadedFile,setLoadedFile=_ref.setLoadedFile,_ref$maxFileSize=_ref.maxFileSize,maxFileSize=_ref$maxFileSize===void 0?512:_ref$maxFileSize,inputBaseProps=(0,_objectWithoutProperties2.default)(_ref,_excluded);var _useState=(0,_react.useState)(null),_useState2=(0,_slicedToArray2.default)(_useState,2),file=_useState2[0],setLocalFile=_useState2[1];var _useState3=(0,_react.useState)(false),_useState4=(0,_slicedToArray2.default)(_useState3,2),isFileValid=_useState4[0],setIsFileValid=_useState4[1];var _useState5=(0,_react.useState)(false),_useState6=(0,_slicedToArray2.default)(_useState5,2),loadingFile=_useState6[0],setLoadingFile=_useState6[1];var _useState7=(0,_react.useState)(0),_useState8=(0,_slicedToArray2.default)(_useState7,2),progress=_useState8[0],setProgress=_useState8[1];var dropAreaRef=(0,_react.useRef)(null);var fileInputRef=(0,_react.useRef)(null);var resetProgress=function resetProgress(){setLocalFile(null);setIsFileValid(false);setLoadingFile(false);setProgress(0);if(!!setLoadedFile)setLoadedFile(false);};var handleDrop=function handleDrop(event){event.preventDefault();var files=event.dataTransfer.files;if(files.length>0){var _file=files[0];startLoading(_file);if(!!setFile)setFile(_file);}};var completeProgress=function completeProgress(){setProgress(100);animateProgress(100);setLoadingFile(false);setIsFileValid(true);setTimeout(function(){if(!!setLoadedFile)setLoadedFile(true);setProgress(0);},100);};var animateProgress=function animateProgress(toValue){setProgress(toValue);};var startLoading=function startLoading(pickedFile){setLoadingFile(true);if(!!setFile)pickedFile;setLocalFile(pickedFile);setProgress(25);animateProgress(25);};var validateAndLoadFile=function(){var _ref2=(0,_asyncToGenerator2.default)(function*(pickedFile){resetProgress();if(maxFileSize&&pickedFile.size>maxFileSize*1024*1024){(0,_alert.show)("File size should not exceed "+maxFileSize+" MB",'error');setIsFileValid(false);setLoadingFile(false);setLocalFile(null);return false;}setIsFileValid(true);setLoadingFile(true);setLocalFile(pickedFile);startLoading(pickedFile);try{if(!!uploadFile)yield uploadFile(pickedFile);}catch(error){console.error('Error uploading file:',error);(0,_alert.show)('Error uploading file','error');}return true;});return function validateAndLoadFile(_x){return _ref2.apply(this,arguments);};}();var handleFileButtonClick=function(){var _ref3=(0,_asyncToGenerator2.default)(function*(){if(_reactNative.Platform.OS==='web'){fileInputRef.current.click();}else if(_reactNative.Platform.OS==='android'||_reactNative.Platform.OS==='ios'){if(!DocumentPicker){console.error('DocumentPicker is not available on this platform.');return;}try{var response=yield DocumentPicker.pick({type:[DocumentPicker.types.allFiles]});var pickedFile={name:response[0].name,size:response[0].size,type:response[0].type,uri:response[0].uri};validateAndLoadFile(pickedFile);}catch(err){if(!DocumentPicker.isCancel(err)){console.error(err);}}}});return function handleFileButtonClick(){return _ref3.apply(this,arguments);};}();var handleSendMessage=function handleSendMessage(){if(!loadingFile&&value.trim()!==''){onSubmit==null?void 0:onSubmit(value,isFileValid?file:null);resetProgress();if(!!setFile)setFile(null);setLocalFile(null);setIsFileValid(false);if(!!uploadFile)uploadFile(file);}else{var errorMessage='Please wait for the file to finish loading.';if(value.trim()===''){errorMessage='Message cannot be empty.';}else if(file&&!isFileValid){errorMessage="File size should not exceed "+maxFileSize+" MB.";}(0,_alert.show)(errorMessage,'error');}};var rightButtons=[];if(!!uploadFile){rightButtons.push(_react.default.createElement(_button.Button,{width:48,typeStyle:"white",onPress:handleFileButtonClick,iconLeft:_react.default.createElement(_Clipboard.ClipboardIcon,{style:{width:24,height:24},fill:_colors.PRIMARY_100,__self:_this,__source:{fileName:_jsxFileName,lineNumber:196,columnNumber:11}}),__self:_this,__source:{fileName:_jsxFileName,lineNumber:191,columnNumber:7}}));}var handleFileSelect=function(){var _ref4=(0,_asyncToGenerator2.default)(function*(event){var file=event.target.files[0];if(file){if(yield validateAndLoadFile(file)){startLoading(file);if(!!setFile)setFile(file);setLocalFile(file);}}event.target.value=null;});return function handleFileSelect(_x2){return _ref4.apply(this,arguments);};}();var handleDeleteFile=function handleDeleteFile(){resetProgress();setProgress(0);animateProgress(0);setLocalFile(null);setLoadingFile(false);if(!!setFile)setFile(null);if(!!setLoadedFile)setLoadedFile(false);if(fileInputRef.current){fileInputRef.current.value=null;}};(0,_react.useEffect)(function(){if(loadedFile){completeProgress();}},[loadedFile]);return _react.default.createElement(_reactNative.SafeAreaView,{style:_FileSearchInput.styles.container,__self:_this,__source:{fileName:_jsxFileName,lineNumber:237,columnNumber:5}},_react.default.createElement(_alert.Alert,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:238,columnNumber:7}}),file&&isFileValid&&_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileNameContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:241,columnNumber:9}},_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileNameLoadedLeftContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:242,columnNumber:11}},_react.default.createElement(_FileIcon.FileIcon,{style:_FileSearchInput.styles.fileIcon,__self:_this,__source:{fileName:_jsxFileName,lineNumber:244,columnNumber:13}}),_react.default.createElement(_reactNative.View,{style:{height:_reactNative.Platform.OS==="web"?undefined:28,width:"80%"},__self:_this,__source:{fileName:_jsxFileName,lineNumber:246,columnNumber:13}},_react.default.createElement(_reactNative.Text,{style:_FileSearchInput.styles.fileNameText,numberOfLines:1,ellipsizeMode:"tail",__self:_this,__source:{fileName:_jsxFileName,lineNumber:247,columnNumber:15}},file.name),progress>0&&_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.progressBarContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:251,columnNumber:17}},_react.default.createElement(_reactNative.View,{style:{width:progress+"%",height:8,backgroundColor:_colors.NEUTRAL_1000,borderRadius:16},__self:_this,__source:{fileName:_jsxFileName,lineNumber:252,columnNumber:19}})))),_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileNameRightContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:257,columnNumber:11}},_react.default.createElement(_CheckCircleIcon.CheckCircleIcon,{style:_FileSearchInput.styles.checkCircleIcon,fill:_colors.SUCCESS_600,__self:_this,__source:{fileName:_jsxFileName,lineNumber:258,columnNumber:13}}),_react.default.createElement(_reactNative.TouchableOpacity,{onPress:handleDeleteFile,__self:_this,__source:{fileName:_jsxFileName,lineNumber:262,columnNumber:13}},_react.default.createElement(_DeleteIcon.DeleteIcon,{style:_FileSearchInput.styles.deleteIcon,__self:_this,__source:{fileName:_jsxFileName,lineNumber:263,columnNumber:15}})))),_react.default.createElement(_reactNative.View,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:269,columnNumber:7}},_reactNative.Platform.OS==='web'?_react.default.createElement("div",{ref:dropAreaRef,onDrop:handleDrop,__self:_this,__source:{fileName:_jsxFileName,lineNumber:271,columnNumber:11}},_react.default.createElement(_InputBase.default,(0,_extends2.default)({},inputBaseProps,{value:value,onChangeText:onChangeText,onSubmit:handleSendMessage,rightButtons:rightButtons,isLoading:loadingFile,placeholder:placeholder,__self:_this,__source:{fileName:_jsxFileName,lineNumber:272,columnNumber:13}})),_react.default.createElement("input",{type:"file",ref:fileInputRef,style:{display:'none'},onChange:handleFileSelect,__self:_this,__source:{fileName:_jsxFileName,lineNumber:281,columnNumber:13}})):_react.default.createElement(_InputBase.default,(0,_extends2.default)({},inputBaseProps,{value:value,onChangeText:onChangeText,onSubmit:handleSendMessage,rightButtons:rightButtons,isLoading:loadingFile,placeholder:placeholder,__self:_this,__source:{fileName:_jsxFileName,lineNumber:289,columnNumber:11}}))));};var _default=exports.default=FileSearchInput;
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _InputBase=_interopRequireDefault(require("../InputBase"));var _FileSearchInput=require("./FileSearchInput.styles");var _colors=require("../../../styles/colors");var _CheckCircleIcon=require("../../../assets/images/icons/CheckCircleIcon");var _Clipboard=require("../../../assets/images/icons/Clipboard");var _DeleteIcon=require("../../../assets/images/icons/DeleteIcon");var _FileIcon=require("../../../assets/images/icons/FileIcon");var _button=require("../../button");var _alert=require("../../alert");var _ErrorIcon=require("../../../assets/images/icons/ErrorIcon");var _secondaryComponents=require("../../secondaryComponents");var _functions_utils=require("../../../helpers/functions_utils");var _excluded=["value","placeholder","onChangeText","onSubmit","setFile","uploadConfig","maxFileSize"];var _this=this,_jsxFileName="/home/jenkins/agent/workspace/etendo_ui_library_develop/etendo_ui_library/src/components/inputBase/file-search-input/FileSearchInput.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var DocumentPicker=null;if(!(0,_functions_utils.isWebPlatform)()){try{import('react-native-document-picker').then(function(module){DocumentPicker=module.default;}).catch(function(error){console.error('Cannot load DocumentPicker',error);});}catch(error){console.error('Error importing DocumentPicker',error);}}var FileSearchInput=function FileSearchInput(_ref){var value=_ref.value,placeholder=_ref.placeholder,onChangeText=_ref.onChangeText,onSubmit=_ref.onSubmit,setFile=_ref.setFile,uploadConfig=_ref.uploadConfig,_ref$maxFileSize=_ref.maxFileSize,maxFileSize=_ref$maxFileSize===void 0?512:_ref$maxFileSize,inputBaseProps=(0,_objectWithoutProperties2.default)(_ref,_excluded);var _useState=(0,_react.useState)(0),_useState2=(0,_slicedToArray2.default)(_useState,2),progress=_useState2[0],setProgress=_useState2[1];var _useState3=(0,_react.useState)(null),_useState4=(0,_slicedToArray2.default)(_useState3,2),file=_useState4[0],setLocalFile=_useState4[1];var _useState5=(0,_react.useState)(false),_useState6=(0,_slicedToArray2.default)(_useState5,2),loadingFile=_useState6[0],setLoadingFile=_useState6[1];var _useState7=(0,_react.useState)(false),_useState8=(0,_slicedToArray2.default)(_useState7,2),isFileValid=_useState8[0],setIsFileValid=_useState8[1];var _useState9=(0,_react.useState)('none'),_useState10=(0,_slicedToArray2.default)(_useState9,2),fileStatus=_useState10[0],setFileStatus=_useState10[1];var dropAreaRef=(0,_react.useRef)(null);var fileInputRef=(0,_react.useRef)(null);var resetProgress=function resetProgress(){setLocalFile(null);setIsFileValid(false);setLoadingFile(false);setProgress(0);setFileStatus("none");};var handleDrop=function handleDrop(event){event.preventDefault();var files=event.dataTransfer.files;if(files.length>0){var _file=files[0];startLoading(_file);if(!!setFile)setFile(_file);}};var completeProgress=function completeProgress(){setProgress(100);animateProgress(100);setLoadingFile(false);setIsFileValid(true);setTimeout(function(){setFileStatus("loaded");setProgress(0);},100);};var animateProgress=function animateProgress(toValue){setProgress(toValue);};var startLoading=function startLoading(pickedFile){setLoadingFile(true);if(!!setFile)pickedFile;setLocalFile(pickedFile);setProgress(25);animateProgress(25);};var validateAndLoadFile=function(){var _ref2=(0,_asyncToGenerator2.default)(function*(pickedFile){resetProgress();if(maxFileSize&&pickedFile.size>maxFileSize*1024*1024){(0,_alert.show)("File size should not exceed "+maxFileSize+" MB",'error');setIsFileValid(false);setLoadingFile(false);setLocalFile(null);return false;}setIsFileValid(true);setLoadingFile(true);setLocalFile(pickedFile);startLoading(pickedFile);try{if(!!uploadFile)yield uploadFile(pickedFile);}catch(error){console.error('Error uploading file:',error);(0,_alert.show)('Error uploading file','error');}return true;});return function validateAndLoadFile(_x){return _ref2.apply(this,arguments);};}();var handleFileButtonClick=function(){var _ref3=(0,_asyncToGenerator2.default)(function*(){if((0,_functions_utils.isWebPlatform)()){fileInputRef.current.click();}else{if(!DocumentPicker){console.error('DocumentPicker is not available on this platform.');return;}try{var response=yield DocumentPicker.pick({type:[DocumentPicker.types.allFiles]});var pickedFile={name:response[0].name,size:response[0].size,type:response[0].type,uri:response[0].uri};validateAndLoadFile(pickedFile);}catch(err){if(!DocumentPicker.isCancel(err)){console.error(err);}}}});return function handleFileButtonClick(){return _ref3.apply(this,arguments);};}();var handleSendMessage=function handleSendMessage(){if(!loadingFile&&value.trim()!==''){onSubmit==null?void 0:onSubmit(value,isFileValid?file:null);resetProgress();if(!!setFile)setFile(null);setLocalFile(null);setIsFileValid(false);}else{var errorMessage='Please wait for the file to finish loading.';if(value.trim()===''){errorMessage='Message cannot be empty.';}else if(file&&!isFileValid){errorMessage="File size should not exceed "+maxFileSize+" MB.";}(0,_alert.show)(errorMessage,'error');}};var rightButtons=[];if(!!uploadConfig){rightButtons.push(_react.default.createElement(_button.Button,{width:48,typeStyle:"white",onPress:handleFileButtonClick,iconLeft:_react.default.createElement(_Clipboard.ClipboardIcon,{style:{width:24,height:24},fill:_colors.PRIMARY_100,__self:_this,__source:{fileName:_jsxFileName,lineNumber:196,columnNumber:11}}),__self:_this,__source:{fileName:_jsxFileName,lineNumber:191,columnNumber:7}}));}var handleFileSelect=function(){var _ref4=(0,_asyncToGenerator2.default)(function*(event){var file=event.target.files[0];if(file){if(yield validateAndLoadFile(file)){startLoading(file);if(!!setFile)setFile(file);setLocalFile(file);}}event.target.value=null;});return function handleFileSelect(_x2){return _ref4.apply(this,arguments);};}();var uploadFile=function(){var _ref5=(0,_asyncToGenerator2.default)(function*(pickedFile){if(!!uploadConfig){var formData=new FormData();formData.append("file",pickedFile);var response;try{response=yield fetch(uploadConfig.url,{method:uploadConfig.method,body:formData,headers:uploadConfig.headers});if(response.ok){setFileStatus('loaded');}else{throw new Error('Failed to upload file');}}catch(error){console.error('Error uploading file:',error);setFileStatus('error');}}});return function uploadFile(_x3){return _ref5.apply(this,arguments);};}();var handleDeleteFile=function handleDeleteFile(){resetProgress();setProgress(0);animateProgress(0);setLocalFile(null);setLoadingFile(false);if(!!setFile)setFile(null);setFileStatus("none");if(fileInputRef.current){fileInputRef.current.value=null;}};(0,_react.useEffect)(function(){if(fileStatus==="loaded"){completeProgress();}},[fileStatus]);return _react.default.createElement(_reactNative.SafeAreaView,{style:_FileSearchInput.styles.container,__self:_this,__source:{fileName:_jsxFileName,lineNumber:262,columnNumber:5}},_react.default.createElement(_alert.Alert,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:263,columnNumber:7}}),file&&isFileValid&&_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileNameContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:267,columnNumber:9}},_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileNameLoadedLeftContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:268,columnNumber:11}},_react.default.createElement(_FileIcon.FileIcon,{style:_FileSearchInput.styles.fileIcon,__self:_this,__source:{fileName:_jsxFileName,lineNumber:270,columnNumber:13}}),_react.default.createElement(_reactNative.View,{style:{height:(0,_functions_utils.isWebPlatform)()?undefined:28,width:"80%"},__self:_this,__source:{fileName:_jsxFileName,lineNumber:272,columnNumber:13}},_react.default.createElement(_reactNative.Text,{style:_FileSearchInput.styles.fileNameText,numberOfLines:1,ellipsizeMode:"tail",__self:_this,__source:{fileName:_jsxFileName,lineNumber:273,columnNumber:15}},file.name),progress>0&&_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.progressBarContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:277,columnNumber:17}},_react.default.createElement(_secondaryComponents.SkeletonItem,{width:progress+"%",height:8,color:_colors.NEUTRAL_1000,borderRadius:16,__self:_this,__source:{fileName:_jsxFileName,lineNumber:278,columnNumber:19}})))),_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileNameRightContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:283,columnNumber:11}},fileStatus==='loaded'&&_react.default.createElement(_CheckCircleIcon.CheckCircleIcon,{style:_FileSearchInput.styles.checkCircleIcon,fill:_colors.SUCCESS_600,__self:_this,__source:{fileName:_jsxFileName,lineNumber:285,columnNumber:15}}),fileStatus==='error'&&_react.default.createElement(_reactNative.TouchableOpacity,{onPress:handleDeleteFile,__self:_this,__source:{fileName:_jsxFileName,lineNumber:291,columnNumber:15}},_react.default.createElement(_ErrorIcon.ErrorIcon,{style:_FileSearchInput.styles.errorIcon,fill:_colors.DANGER_700,__self:_this,__source:{fileName:_jsxFileName,lineNumber:292,columnNumber:17}})),fileStatus==='none'&&_react.default.createElement(_reactNative.TouchableOpacity,{onPress:handleDeleteFile,__self:_this,__source:{fileName:_jsxFileName,lineNumber:299,columnNumber:15}},_react.default.createElement(_DeleteIcon.DeleteIcon,{style:_FileSearchInput.styles.deleteIcon,__self:_this,__source:{fileName:_jsxFileName,lineNumber:300,columnNumber:17}})))),_react.default.createElement(_reactNative.View,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:307,columnNumber:7}},(0,_functions_utils.isWebPlatform)()?_react.default.createElement("div",{ref:dropAreaRef,onDrop:handleDrop,__self:_this,__source:{fileName:_jsxFileName,lineNumber:309,columnNumber:11}},_react.default.createElement(_InputBase.default,(0,_extends2.default)({},inputBaseProps,{value:value,onChangeText:onChangeText,onSubmit:handleSendMessage,rightButtons:rightButtons,isLoading:loadingFile,placeholder:placeholder,__self:_this,__source:{fileName:_jsxFileName,lineNumber:310,columnNumber:13}})),_react.default.createElement("input",{type:"file",ref:fileInputRef,style:{display:'none'},onChange:handleFileSelect,__self:_this,__source:{fileName:_jsxFileName,lineNumber:319,columnNumber:13}})):_react.default.createElement(_InputBase.default,(0,_extends2.default)({},inputBaseProps,{value:value,onChangeText:onChangeText,onSubmit:handleSendMessage,rightButtons:rightButtons,isLoading:loadingFile,placeholder:placeholder,__self:_this,__source:{fileName:_jsxFileName,lineNumber:327,columnNumber:11}}))));};var _default=exports.default=FileSearchInput;
|
|
@@ -30,19 +30,23 @@ export declare const styles: {
|
|
|
30
30
|
};
|
|
31
31
|
fileNameLeftContent: {
|
|
32
32
|
height: number;
|
|
33
|
-
width: "
|
|
33
|
+
width: "85%";
|
|
34
34
|
};
|
|
35
35
|
fileNameLoadedLeftContainer: {
|
|
36
36
|
alignItems: "center";
|
|
37
37
|
flexDirection: "row";
|
|
38
38
|
gap: number;
|
|
39
|
-
width: "
|
|
39
|
+
width: "85%" | "80%";
|
|
40
40
|
};
|
|
41
41
|
checkCircleIcon: {
|
|
42
42
|
height: number;
|
|
43
43
|
width: number;
|
|
44
44
|
marginRight: number;
|
|
45
45
|
};
|
|
46
|
+
errorIcon: {
|
|
47
|
+
height: number;
|
|
48
|
+
width: number;
|
|
49
|
+
};
|
|
46
50
|
deleteIcon: {
|
|
47
51
|
height: number;
|
|
48
52
|
width: number;
|
|
@@ -72,6 +76,11 @@ export declare const styles: {
|
|
|
72
76
|
height: number;
|
|
73
77
|
width: number;
|
|
74
78
|
};
|
|
79
|
+
fileContainer: {
|
|
80
|
+
height: number | undefined;
|
|
81
|
+
width: "100%";
|
|
82
|
+
backgroundColor: string;
|
|
83
|
+
};
|
|
75
84
|
progressBarFill: {
|
|
76
85
|
backgroundColor: string;
|
|
77
86
|
borderRadius: number;
|
|
@@ -79,9 +88,9 @@ export declare const styles: {
|
|
|
79
88
|
};
|
|
80
89
|
progressBarContainer: {
|
|
81
90
|
backgroundColor: string;
|
|
82
|
-
width: "100%";
|
|
83
91
|
borderRadius: number;
|
|
84
92
|
marginLeft: number | undefined;
|
|
93
|
+
width: "100%";
|
|
85
94
|
};
|
|
86
95
|
progressBar: {
|
|
87
96
|
height: "100%";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.styles=void 0;var _reactNative=require("react-native");var _colors=require("../../../styles/colors");var styles=exports.styles=_reactNative.StyleSheet.create({container:{width:"100%",height:"10%"},inputContainer:{flex:1},fileNameContainer:{alignItems:'center',backgroundColor:_colors.NEUTRAL_50,borderColor:_colors.NEUTRAL_400,borderRadius:8,borderWidth:1,flexDirection:"row",gap:4,height:"100%",flex:1,justifyContent:"space-between",marginBottom:4,paddingHorizontal:8,paddingVertical:_reactNative.Platform.OS==="web"?16:32},fileNameLeftContainer:{flexDirection:"row",gap:4},fileNameRightContainer:{flexDirection:"row"},fileNameLeftContent:{height:24,width:"
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.styles=void 0;var _reactNative=require("react-native");var _colors=require("../../../styles/colors");var styles=exports.styles=_reactNative.StyleSheet.create({container:{width:"100%",height:"10%"},inputContainer:{flex:1},fileNameContainer:{alignItems:'center',backgroundColor:_colors.NEUTRAL_50,borderColor:_colors.NEUTRAL_400,borderRadius:8,borderWidth:1,flexDirection:"row",gap:4,height:"100%",flex:1,justifyContent:"space-between",marginBottom:4,paddingHorizontal:8,paddingVertical:_reactNative.Platform.OS==="web"?16:32},fileNameLeftContainer:{flexDirection:"row",gap:4},fileNameRightContainer:{flexDirection:"row"},fileNameLeftContent:{height:24,width:"85%"},fileNameLoadedLeftContainer:{alignItems:"center",flexDirection:"row",gap:4,width:_reactNative.Platform.OS==="web"?"80%":"85%"},checkCircleIcon:{height:24,width:24,marginRight:8},errorIcon:{height:20,width:20},deleteIcon:{height:20,width:20},loadingContainer:{alignItems:"center",justifyContent:"center",paddingHorizontal:8,paddingVertical:16,width:"100%"},loadingText:{fontSize:14},fileNameText:{color:_colors.NEUTRAL_1000,fontWeight:"500",fontSize:_reactNative.Platform.OS==="web"?14:16,paddingBottom:_reactNative.Platform.OS==="web"?4:undefined,overflow:'hidden',whiteSpace:'nowrap',width:"100%",flex:1,marginLeft:_reactNative.Platform.OS==="web"?undefined:8},fileIcon:{height:36,width:36},fileContainer:{height:_reactNative.Platform.OS==="web"?undefined:28,width:"100%",backgroundColor:"red"},progressBarFill:{backgroundColor:_colors.NEUTRAL_100,borderRadius:10,height:'100%'},progressBarContainer:{backgroundColor:_colors.NEUTRAL_300,borderRadius:16,marginLeft:_reactNative.Platform.OS==="web"?undefined:8,width:"100%"},progressBar:{height:'100%',backgroundColor:_colors.NEUTRAL_1000,borderRadius:2}});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react-native" />
|
|
2
2
|
import { IInputBase } from '../InputBase.types';
|
|
3
|
+
interface UploadConfig {
|
|
4
|
+
file: any;
|
|
5
|
+
url: string;
|
|
6
|
+
method: string;
|
|
7
|
+
headers: HeadersInit_;
|
|
8
|
+
}
|
|
3
9
|
export interface FileSearchInputProps extends IInputBase {
|
|
4
10
|
value: string;
|
|
5
|
-
setFile?: (file: any) => void;
|
|
6
11
|
onChangeText: (text: string) => void;
|
|
7
12
|
onSubmit: (message: string, file?: any) => void;
|
|
8
13
|
placeholder: string;
|
|
9
|
-
|
|
14
|
+
setFile?: (file: any) => void;
|
|
10
15
|
maxFileSize?: number;
|
|
11
|
-
|
|
12
|
-
setLoadedFile?: (loaded: boolean) => void;
|
|
13
|
-
}
|
|
14
|
-
export interface FileStatusDisplayProps {
|
|
15
|
-
file: any;
|
|
16
|
-
progressAnim: Animated.Value;
|
|
17
|
-
handleDeleteFile: () => void;
|
|
16
|
+
uploadConfig?: UploadConfig | undefined;
|
|
18
17
|
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isWebPlatform: () => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.isWebPlatform=void 0;var _reactNative=require("react-native");var isWebPlatform=exports.isWebPlatform=function isWebPlatform(){return _reactNative.Platform.OS==='web';};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare const styles: {
|
|
2
2
|
title: {
|
|
3
|
-
fontFamily: string;
|
|
4
3
|
fontSize: number;
|
|
5
4
|
fontWeight: "600";
|
|
6
5
|
lineHeight: number;
|
|
@@ -54,7 +53,6 @@ export declare const styles: {
|
|
|
54
53
|
paddingHorizontal: number;
|
|
55
54
|
height: number;
|
|
56
55
|
backgroundColor: string;
|
|
57
|
-
fontFamily: string;
|
|
58
56
|
fontSize: number;
|
|
59
57
|
fontStyle: "normal";
|
|
60
58
|
fontWeight: "500";
|
|
@@ -64,7 +62,6 @@ export declare const styles: {
|
|
|
64
62
|
flex: number;
|
|
65
63
|
};
|
|
66
64
|
helperText: {
|
|
67
|
-
fontFamily: string;
|
|
68
65
|
fontSize: number;
|
|
69
66
|
fontWeight: "500";
|
|
70
67
|
lineHeight: number;
|
|
@@ -2,7 +2,6 @@ import { StyleSheet } from "react-native-web";
|
|
|
2
2
|
import { DANGER_600, DANGER_700, NEUTRAL_1000, NEUTRAL_400, NEUTRAL_50, NEUTRAL_500, NEUTRAL_800, PRIMARY_100 } from "../../styles/colors";
|
|
3
3
|
export var styles = StyleSheet.create({
|
|
4
4
|
title: {
|
|
5
|
-
fontFamily: 'Inter',
|
|
6
5
|
fontSize: 16,
|
|
7
6
|
fontWeight: '600',
|
|
8
7
|
lineHeight: 24,
|
|
@@ -56,7 +55,6 @@ export var styles = StyleSheet.create({
|
|
|
56
55
|
paddingHorizontal: 0,
|
|
57
56
|
height: 48,
|
|
58
57
|
backgroundColor: NEUTRAL_50,
|
|
59
|
-
fontFamily: 'Inter',
|
|
60
58
|
fontSize: 16,
|
|
61
59
|
fontStyle: 'normal',
|
|
62
60
|
fontWeight: '500',
|
|
@@ -66,7 +64,6 @@ export var styles = StyleSheet.create({
|
|
|
66
64
|
flex: 1
|
|
67
65
|
},
|
|
68
66
|
helperText: {
|
|
69
|
-
fontFamily: 'Inter',
|
|
70
67
|
fontSize: 14,
|
|
71
68
|
fontWeight: '500',
|
|
72
69
|
lineHeight: 22,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FileSearchInputProps } from './FileSearchInput.types';
|
|
3
|
-
declare const FileSearchInput: ({ value, placeholder, onChangeText, onSubmit, setFile,
|
|
3
|
+
declare const FileSearchInput: ({ value, placeholder, onChangeText, onSubmit, setFile, uploadConfig, maxFileSize, ...inputBaseProps }: FileSearchInputProps) => React.JSX.Element;
|
|
4
4
|
export default FileSearchInput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["value", "placeholder", "onChangeText", "onSubmit", "setFile", "
|
|
2
|
+
var _excluded = ["value", "placeholder", "onChangeText", "onSubmit", "setFile", "uploadConfig", "maxFileSize"];
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
5
5
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
@@ -13,12 +13,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
14
14
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
15
15
|
import React, { useState, useRef, useEffect } from 'react';
|
|
16
|
-
import { View, TouchableOpacity,
|
|
16
|
+
import { View, TouchableOpacity, Text, SafeAreaView } from "react-native-web";
|
|
17
17
|
import InputBase from "../InputBase";
|
|
18
18
|
|
|
19
19
|
// Import styles
|
|
20
20
|
import { styles } from "./FileSearchInput.styles";
|
|
21
|
-
import { NEUTRAL_1000, PRIMARY_100, SUCCESS_600 } from "../../../styles/colors";
|
|
21
|
+
import { DANGER_700, NEUTRAL_1000, PRIMARY_100, SUCCESS_600 } from "../../../styles/colors";
|
|
22
22
|
|
|
23
23
|
// Import icons
|
|
24
24
|
import { CheckCircleIcon } from "../../../assets/images/icons/CheckCircleIcon";
|
|
@@ -30,10 +30,13 @@ import { FileIcon } from "../../../assets/images/icons/FileIcon";
|
|
|
30
30
|
|
|
31
31
|
import { Button } from "../../button";
|
|
32
32
|
import { Alert, show } from "../../alert";
|
|
33
|
+
import { ErrorIcon } from "../../../assets/images/icons/ErrorIcon";
|
|
34
|
+
import { SkeletonItem } from "../../secondaryComponents";
|
|
35
|
+
import { isWebPlatform } from "../../../helpers/functions_utils";
|
|
33
36
|
|
|
34
37
|
// Import DocumentPicker for mobile platforms only
|
|
35
38
|
var DocumentPicker = null;
|
|
36
|
-
if (
|
|
39
|
+
if (!isWebPlatform()) {
|
|
37
40
|
try {
|
|
38
41
|
import('react-native-document-picker').then(function (module) {
|
|
39
42
|
DocumentPicker = module["default"];
|
|
@@ -50,29 +53,31 @@ var FileSearchInput = function FileSearchInput(_ref) {
|
|
|
50
53
|
onChangeText = _ref.onChangeText,
|
|
51
54
|
onSubmit = _ref.onSubmit,
|
|
52
55
|
setFile = _ref.setFile,
|
|
53
|
-
|
|
54
|
-
loadedFile = _ref.loadedFile,
|
|
55
|
-
setLoadedFile = _ref.setLoadedFile,
|
|
56
|
+
uploadConfig = _ref.uploadConfig,
|
|
56
57
|
_ref$maxFileSize = _ref.maxFileSize,
|
|
57
58
|
maxFileSize = _ref$maxFileSize === void 0 ? 512 : _ref$maxFileSize,
|
|
58
59
|
inputBaseProps = _objectWithoutProperties(_ref, _excluded);
|
|
59
60
|
// States
|
|
60
|
-
var _useState = useState(
|
|
61
|
+
var _useState = useState(0),
|
|
61
62
|
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var _useState3 = useState(
|
|
63
|
+
progress = _useState2[0],
|
|
64
|
+
setProgress = _useState2[1];
|
|
65
|
+
var _useState3 = useState(null),
|
|
65
66
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
file = _useState4[0],
|
|
68
|
+
setLocalFile = _useState4[1];
|
|
68
69
|
var _useState5 = useState(false),
|
|
69
70
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
70
71
|
loadingFile = _useState6[0],
|
|
71
72
|
setLoadingFile = _useState6[1];
|
|
72
|
-
var _useState7 = useState(
|
|
73
|
+
var _useState7 = useState(false),
|
|
73
74
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
isFileValid = _useState8[0],
|
|
76
|
+
setIsFileValid = _useState8[1];
|
|
77
|
+
var _useState9 = useState('none'),
|
|
78
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
79
|
+
fileStatus = _useState10[0],
|
|
80
|
+
setFileStatus = _useState10[1];
|
|
76
81
|
|
|
77
82
|
// References
|
|
78
83
|
var dropAreaRef = useRef(null);
|
|
@@ -84,7 +89,7 @@ var FileSearchInput = function FileSearchInput(_ref) {
|
|
|
84
89
|
setIsFileValid(false);
|
|
85
90
|
setLoadingFile(false);
|
|
86
91
|
setProgress(0);
|
|
87
|
-
|
|
92
|
+
setFileStatus("none");
|
|
88
93
|
};
|
|
89
94
|
|
|
90
95
|
// Handles file drop events, typically from drag-and-drop actions
|
|
@@ -105,7 +110,7 @@ var FileSearchInput = function FileSearchInput(_ref) {
|
|
|
105
110
|
setLoadingFile(false);
|
|
106
111
|
setIsFileValid(true);
|
|
107
112
|
setTimeout(function () {
|
|
108
|
-
|
|
113
|
+
setFileStatus("loaded");
|
|
109
114
|
setProgress(0);
|
|
110
115
|
}, 100);
|
|
111
116
|
};
|
|
@@ -180,31 +185,27 @@ var FileSearchInput = function FileSearchInput(_ref) {
|
|
|
180
185
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
181
186
|
while (1) switch (_context2.prev = _context2.next) {
|
|
182
187
|
case 0:
|
|
183
|
-
if (!(
|
|
188
|
+
if (!isWebPlatform()) {
|
|
184
189
|
_context2.next = 4;
|
|
185
190
|
break;
|
|
186
191
|
}
|
|
187
192
|
fileInputRef.current.click();
|
|
188
|
-
_context2.next =
|
|
193
|
+
_context2.next = 18;
|
|
189
194
|
break;
|
|
190
195
|
case 4:
|
|
191
|
-
if (!(Platform.OS === 'android' || Platform.OS === 'ios')) {
|
|
192
|
-
_context2.next = 19;
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
196
|
if (DocumentPicker) {
|
|
196
|
-
_context2.next =
|
|
197
|
+
_context2.next = 7;
|
|
197
198
|
break;
|
|
198
199
|
}
|
|
199
200
|
console.error('DocumentPicker is not available on this platform.');
|
|
200
201
|
return _context2.abrupt("return");
|
|
201
|
-
case
|
|
202
|
-
_context2.prev =
|
|
203
|
-
_context2.next =
|
|
202
|
+
case 7:
|
|
203
|
+
_context2.prev = 7;
|
|
204
|
+
_context2.next = 10;
|
|
204
205
|
return DocumentPicker.pick({
|
|
205
206
|
type: [DocumentPicker.types.allFiles]
|
|
206
207
|
});
|
|
207
|
-
case
|
|
208
|
+
case 10:
|
|
208
209
|
response = _context2.sent;
|
|
209
210
|
pickedFile = {
|
|
210
211
|
name: response[0].name,
|
|
@@ -213,19 +214,19 @@ var FileSearchInput = function FileSearchInput(_ref) {
|
|
|
213
214
|
uri: response[0].uri
|
|
214
215
|
};
|
|
215
216
|
validateAndLoadFile(pickedFile);
|
|
216
|
-
_context2.next =
|
|
217
|
+
_context2.next = 18;
|
|
217
218
|
break;
|
|
218
|
-
case
|
|
219
|
-
_context2.prev =
|
|
220
|
-
_context2.t0 = _context2["catch"](
|
|
219
|
+
case 15:
|
|
220
|
+
_context2.prev = 15;
|
|
221
|
+
_context2.t0 = _context2["catch"](7);
|
|
221
222
|
if (!DocumentPicker.isCancel(_context2.t0)) {
|
|
222
223
|
console.error(_context2.t0);
|
|
223
224
|
}
|
|
224
|
-
case
|
|
225
|
+
case 18:
|
|
225
226
|
case "end":
|
|
226
227
|
return _context2.stop();
|
|
227
228
|
}
|
|
228
|
-
}, _callee2, null, [[
|
|
229
|
+
}, _callee2, null, [[7, 15]]);
|
|
229
230
|
}));
|
|
230
231
|
return function handleFileButtonClick() {
|
|
231
232
|
return _ref3.apply(this, arguments);
|
|
@@ -240,7 +241,6 @@ var FileSearchInput = function FileSearchInput(_ref) {
|
|
|
240
241
|
if (!!setFile) setFile(null);
|
|
241
242
|
setLocalFile(null);
|
|
242
243
|
setIsFileValid(false);
|
|
243
|
-
if (!!uploadFile) uploadFile(file);
|
|
244
244
|
} else {
|
|
245
245
|
var errorMessage = 'Please wait for the file to finish loading.';
|
|
246
246
|
if (value.trim() === '') {
|
|
@@ -254,7 +254,7 @@ var FileSearchInput = function FileSearchInput(_ref) {
|
|
|
254
254
|
|
|
255
255
|
// Define the right buttons for the input
|
|
256
256
|
var rightButtons = [];
|
|
257
|
-
if (!!
|
|
257
|
+
if (!!uploadConfig) {
|
|
258
258
|
rightButtons.push( /*#__PURE__*/React.createElement(Button, {
|
|
259
259
|
width: 48,
|
|
260
260
|
typeStyle: "white",
|
|
@@ -304,6 +304,56 @@ var FileSearchInput = function FileSearchInput(_ref) {
|
|
|
304
304
|
};
|
|
305
305
|
}();
|
|
306
306
|
|
|
307
|
+
// Function to upload a file to a server
|
|
308
|
+
var uploadFile = /*#__PURE__*/function () {
|
|
309
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(pickedFile) {
|
|
310
|
+
var formData, response;
|
|
311
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
312
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
313
|
+
case 0:
|
|
314
|
+
if (!uploadConfig) {
|
|
315
|
+
_context4.next = 18;
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
formData = new FormData();
|
|
319
|
+
formData.append("file", pickedFile);
|
|
320
|
+
_context4.prev = 3;
|
|
321
|
+
_context4.next = 6;
|
|
322
|
+
return fetch(uploadConfig.url, {
|
|
323
|
+
method: uploadConfig.method,
|
|
324
|
+
body: formData,
|
|
325
|
+
headers: uploadConfig.headers
|
|
326
|
+
});
|
|
327
|
+
case 6:
|
|
328
|
+
response = _context4.sent;
|
|
329
|
+
if (!response.ok) {
|
|
330
|
+
_context4.next = 11;
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
setFileStatus('loaded');
|
|
334
|
+
_context4.next = 12;
|
|
335
|
+
break;
|
|
336
|
+
case 11:
|
|
337
|
+
throw new Error('Failed to upload file');
|
|
338
|
+
case 12:
|
|
339
|
+
_context4.next = 18;
|
|
340
|
+
break;
|
|
341
|
+
case 14:
|
|
342
|
+
_context4.prev = 14;
|
|
343
|
+
_context4.t0 = _context4["catch"](3);
|
|
344
|
+
console.error('Error uploading file:', _context4.t0);
|
|
345
|
+
setFileStatus('error');
|
|
346
|
+
case 18:
|
|
347
|
+
case "end":
|
|
348
|
+
return _context4.stop();
|
|
349
|
+
}
|
|
350
|
+
}, _callee4, null, [[3, 14]]);
|
|
351
|
+
}));
|
|
352
|
+
return function uploadFile(_x3) {
|
|
353
|
+
return _ref5.apply(this, arguments);
|
|
354
|
+
};
|
|
355
|
+
}();
|
|
356
|
+
|
|
307
357
|
// Function to handle file deletion
|
|
308
358
|
var handleDeleteFile = function handleDeleteFile() {
|
|
309
359
|
resetProgress();
|
|
@@ -312,7 +362,7 @@ var FileSearchInput = function FileSearchInput(_ref) {
|
|
|
312
362
|
setLocalFile(null);
|
|
313
363
|
setLoadingFile(false);
|
|
314
364
|
if (!!setFile) setFile(null);
|
|
315
|
-
|
|
365
|
+
setFileStatus("none");
|
|
316
366
|
if (fileInputRef.current) {
|
|
317
367
|
fileInputRef.current.value = null;
|
|
318
368
|
}
|
|
@@ -320,10 +370,10 @@ var FileSearchInput = function FileSearchInput(_ref) {
|
|
|
320
370
|
|
|
321
371
|
// Effect to complete progress
|
|
322
372
|
useEffect(function () {
|
|
323
|
-
if (
|
|
373
|
+
if (fileStatus === "loaded") {
|
|
324
374
|
completeProgress();
|
|
325
375
|
}
|
|
326
|
-
}, [
|
|
376
|
+
}, [fileStatus]);
|
|
327
377
|
return /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
328
378
|
style: styles.container
|
|
329
379
|
}, /*#__PURE__*/React.createElement(Alert, null), file && isFileValid && /*#__PURE__*/React.createElement(View, {
|
|
@@ -334,7 +384,7 @@ var FileSearchInput = function FileSearchInput(_ref) {
|
|
|
334
384
|
style: styles.fileIcon
|
|
335
385
|
}), /*#__PURE__*/React.createElement(View, {
|
|
336
386
|
style: {
|
|
337
|
-
height:
|
|
387
|
+
height: isWebPlatform() ? undefined : 28,
|
|
338
388
|
width: "80%"
|
|
339
389
|
}
|
|
340
390
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
@@ -343,23 +393,26 @@ var FileSearchInput = function FileSearchInput(_ref) {
|
|
|
343
393
|
ellipsizeMode: "tail"
|
|
344
394
|
}, file.name), progress > 0 && /*#__PURE__*/React.createElement(View, {
|
|
345
395
|
style: styles.progressBarContainer
|
|
346
|
-
}, /*#__PURE__*/React.createElement(
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
borderRadius: 16
|
|
352
|
-
}
|
|
396
|
+
}, /*#__PURE__*/React.createElement(SkeletonItem, {
|
|
397
|
+
width: "".concat(progress, "%"),
|
|
398
|
+
height: 8,
|
|
399
|
+
color: NEUTRAL_1000,
|
|
400
|
+
borderRadius: 16
|
|
353
401
|
})))), /*#__PURE__*/React.createElement(View, {
|
|
354
402
|
style: styles.fileNameRightContainer
|
|
355
|
-
}, /*#__PURE__*/React.createElement(CheckCircleIcon, {
|
|
403
|
+
}, fileStatus === 'loaded' && /*#__PURE__*/React.createElement(CheckCircleIcon, {
|
|
356
404
|
style: styles.checkCircleIcon,
|
|
357
405
|
fill: SUCCESS_600
|
|
358
|
-
}), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
406
|
+
}), fileStatus === 'error' && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
407
|
+
onPress: handleDeleteFile
|
|
408
|
+
}, /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
409
|
+
style: styles.errorIcon,
|
|
410
|
+
fill: DANGER_700
|
|
411
|
+
})), fileStatus === 'none' && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
359
412
|
onPress: handleDeleteFile
|
|
360
413
|
}, /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
361
414
|
style: styles.deleteIcon
|
|
362
|
-
})))), /*#__PURE__*/React.createElement(View, null,
|
|
415
|
+
})))), /*#__PURE__*/React.createElement(View, null, isWebPlatform() ? /*#__PURE__*/React.createElement("div", {
|
|
363
416
|
ref: dropAreaRef,
|
|
364
417
|
onDrop: handleDrop
|
|
365
418
|
}, /*#__PURE__*/React.createElement(InputBase, _extends({}, inputBaseProps, {
|
|
@@ -30,19 +30,23 @@ export declare const styles: {
|
|
|
30
30
|
};
|
|
31
31
|
fileNameLeftContent: {
|
|
32
32
|
height: number;
|
|
33
|
-
width: "
|
|
33
|
+
width: "85%";
|
|
34
34
|
};
|
|
35
35
|
fileNameLoadedLeftContainer: {
|
|
36
36
|
alignItems: "center";
|
|
37
37
|
flexDirection: "row";
|
|
38
38
|
gap: number;
|
|
39
|
-
width: "
|
|
39
|
+
width: "85%" | "80%";
|
|
40
40
|
};
|
|
41
41
|
checkCircleIcon: {
|
|
42
42
|
height: number;
|
|
43
43
|
width: number;
|
|
44
44
|
marginRight: number;
|
|
45
45
|
};
|
|
46
|
+
errorIcon: {
|
|
47
|
+
height: number;
|
|
48
|
+
width: number;
|
|
49
|
+
};
|
|
46
50
|
deleteIcon: {
|
|
47
51
|
height: number;
|
|
48
52
|
width: number;
|
|
@@ -72,6 +76,11 @@ export declare const styles: {
|
|
|
72
76
|
height: number;
|
|
73
77
|
width: number;
|
|
74
78
|
};
|
|
79
|
+
fileContainer: {
|
|
80
|
+
height: number | undefined;
|
|
81
|
+
width: "100%";
|
|
82
|
+
backgroundColor: string;
|
|
83
|
+
};
|
|
75
84
|
progressBarFill: {
|
|
76
85
|
backgroundColor: string;
|
|
77
86
|
borderRadius: number;
|
|
@@ -79,9 +88,9 @@ export declare const styles: {
|
|
|
79
88
|
};
|
|
80
89
|
progressBarContainer: {
|
|
81
90
|
backgroundColor: string;
|
|
82
|
-
width: "100%";
|
|
83
91
|
borderRadius: number;
|
|
84
92
|
marginLeft: number | undefined;
|
|
93
|
+
width: "100%";
|
|
85
94
|
};
|
|
86
95
|
progressBar: {
|
|
87
96
|
height: "100%";
|
|
@@ -32,19 +32,23 @@ export var styles = StyleSheet.create({
|
|
|
32
32
|
},
|
|
33
33
|
fileNameLeftContent: {
|
|
34
34
|
height: 24,
|
|
35
|
-
width: "
|
|
35
|
+
width: "85%"
|
|
36
36
|
},
|
|
37
37
|
fileNameLoadedLeftContainer: {
|
|
38
38
|
alignItems: "center",
|
|
39
39
|
flexDirection: "row",
|
|
40
40
|
gap: 4,
|
|
41
|
-
width: Platform.OS === "web" ? "
|
|
41
|
+
width: Platform.OS === "web" ? "80%" : "85%"
|
|
42
42
|
},
|
|
43
43
|
checkCircleIcon: {
|
|
44
44
|
height: 24,
|
|
45
45
|
width: 24,
|
|
46
46
|
marginRight: 8
|
|
47
47
|
},
|
|
48
|
+
errorIcon: {
|
|
49
|
+
height: 20,
|
|
50
|
+
width: 20
|
|
51
|
+
},
|
|
48
52
|
deleteIcon: {
|
|
49
53
|
height: 20,
|
|
50
54
|
width: 20
|
|
@@ -71,8 +75,13 @@ export var styles = StyleSheet.create({
|
|
|
71
75
|
marginLeft: Platform.OS === "web" ? undefined : 8
|
|
72
76
|
},
|
|
73
77
|
fileIcon: {
|
|
74
|
-
height:
|
|
75
|
-
width:
|
|
78
|
+
height: 36,
|
|
79
|
+
width: 36
|
|
80
|
+
},
|
|
81
|
+
fileContainer: {
|
|
82
|
+
height: Platform.OS === "web" ? undefined : 28,
|
|
83
|
+
width: "100%",
|
|
84
|
+
backgroundColor: "red"
|
|
76
85
|
},
|
|
77
86
|
progressBarFill: {
|
|
78
87
|
backgroundColor: NEUTRAL_100,
|
|
@@ -81,9 +90,9 @@ export var styles = StyleSheet.create({
|
|
|
81
90
|
},
|
|
82
91
|
progressBarContainer: {
|
|
83
92
|
backgroundColor: NEUTRAL_300,
|
|
84
|
-
width: '100%',
|
|
85
93
|
borderRadius: 16,
|
|
86
|
-
marginLeft: Platform.OS === "web" ? undefined : 8
|
|
94
|
+
marginLeft: Platform.OS === "web" ? undefined : 8,
|
|
95
|
+
width: "100%"
|
|
87
96
|
},
|
|
88
97
|
progressBar: {
|
|
89
98
|
height: '100%',
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react-native" />
|
|
2
2
|
import { IInputBase } from '../InputBase.types';
|
|
3
|
+
interface UploadConfig {
|
|
4
|
+
file: any;
|
|
5
|
+
url: string;
|
|
6
|
+
method: string;
|
|
7
|
+
headers: HeadersInit_;
|
|
8
|
+
}
|
|
3
9
|
export interface FileSearchInputProps extends IInputBase {
|
|
4
10
|
value: string;
|
|
5
|
-
setFile?: (file: any) => void;
|
|
6
11
|
onChangeText: (text: string) => void;
|
|
7
12
|
onSubmit: (message: string, file?: any) => void;
|
|
8
13
|
placeholder: string;
|
|
9
|
-
|
|
14
|
+
setFile?: (file: any) => void;
|
|
10
15
|
maxFileSize?: number;
|
|
11
|
-
|
|
12
|
-
setLoadedFile?: (loaded: boolean) => void;
|
|
13
|
-
}
|
|
14
|
-
export interface FileStatusDisplayProps {
|
|
15
|
-
file: any;
|
|
16
|
-
progressAnim: Animated.Value;
|
|
17
|
-
handleDeleteFile: () => void;
|
|
16
|
+
uploadConfig?: UploadConfig | undefined;
|
|
18
17
|
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isWebPlatform: () => boolean;
|