etendo-ui-library 1.4.24 → 1.4.26
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.d.ts +3 -3
- package/dist-native/components/inputBase/InputBase.js +1 -1
- package/dist-native/components/inputBase/InputBase.styles.d.ts +2 -5
- package/dist-native/components/inputBase/InputBase.styles.js +1 -1
- package/dist-native/components/inputBase/InputBase.types.d.ts +4 -1
- package/dist-native/components/inputBase/date-picker-input/DatePickerInput.types.d.ts +1 -1
- package/dist-native/components/inputBase/dropdown-input/DropdownInput.types.d.ts +1 -1
- package/dist-native/components/inputBase/file-search-input/FileSearchInput.constants.d.ts +2 -0
- package/dist-native/components/inputBase/file-search-input/FileSearchInput.constants.js +1 -1
- package/dist-native/components/inputBase/file-search-input/FileSearchInput.js +1 -1
- package/dist-native/components/inputBase/password-input/PasswordInput.types.d.ts +1 -1
- package/dist-native/components/inputBase/search-input/SearchInput.types.d.ts +1 -1
- package/dist-web/components/containers/searchContainer/SearchContainer.js +1 -1
- package/dist-web/components/inputBase/InputBase.d.ts +3 -3
- package/dist-web/components/inputBase/InputBase.js +50 -20
- package/dist-web/components/inputBase/InputBase.styles.d.ts +2 -5
- package/dist-web/components/inputBase/InputBase.styles.js +4 -7
- package/dist-web/components/inputBase/InputBase.types.d.ts +4 -1
- package/dist-web/components/inputBase/date-picker-input/DatePickerInput.js +1 -1
- package/dist-web/components/inputBase/date-picker-input/DatePickerInput.types.d.ts +1 -1
- package/dist-web/components/inputBase/dropdown-input/DropdownInput.js +1 -1
- package/dist-web/components/inputBase/dropdown-input/DropdownInput.types.d.ts +1 -1
- package/dist-web/components/inputBase/file-search-input/FileSearchInput.constants.d.ts +2 -0
- package/dist-web/components/inputBase/file-search-input/FileSearchInput.constants.js +3 -1
- package/dist-web/components/inputBase/file-search-input/FileSearchInput.js +11 -2
- package/dist-web/components/inputBase/password-input/PasswordInput.types.d.ts +1 -1
- package/dist-web/components/inputBase/search-input/SearchInput.js +1 -1
- package/dist-web/components/inputBase/search-input/SearchInput.types.d.ts +1 -1
- package/dist-web/components/inputBase/text-input/TextInput.js +1 -1
- package/dist-web/components/text-message/AnchorComponent.js +1 -1
- package/dist-web/components/text-message/CodeComponent.js +1 -1
- package/dist-web/components/text-message/MarkdownUtils.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { IInputBase } from
|
|
3
|
-
declare const InputBase: ({ value, placeholder, title, helperText, isDisabled, isError, onChangeText, icon, rightButtons, onPress, onBlur, onSubmitEditing, secureTextEntry, keyboardType, styleContainer, isFocusable, refInputContainer, refInput }: IInputBase) => React.JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IInputBase } from "./InputBase.types";
|
|
3
|
+
declare const InputBase: ({ value, placeholder, title, helperText, isDisabled, isError, onChangeText, icon, rightButtons, onPress, onBlur, onSubmitEditing, onKeyPress, secureTextEntry, keyboardType, styleContainer, isFocusable, refInputContainer, refInput, multiline, numberOfLines, }: IInputBase) => React.JSX.Element;
|
|
4
4
|
export default InputBase;
|
|
@@ -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 _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _reactNative=require("react-native");var _react=_interopRequireWildcard(require("react"));var _InputBase=require("./InputBase.styles");var _colors=require("../../styles/colors");var _table_utils=require("../../helpers/table_utils");var _gridContainer=require("../containers/gridContainer");var _excluded=["style"],_excluded2=["iconLeft","iconRight"];var _this=this,_jsxFileName="/home/jenkins/agent/workspace/etendo_ui_library_develop/etendo_ui_library/src/components/inputBase/InputBase.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&&{}.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 InputBase=function InputBase(_ref){var value=_ref.value,placeholder=_ref.placeholder,title=_ref.title,helperText=_ref.helperText,isDisabled=_ref.isDisabled,isError=_ref.isError,onChangeText=_ref.onChangeText,icon=_ref.icon,rightButtons=_ref.rightButtons,onPress=_ref.onPress,onBlur=_ref.onBlur,onSubmitEditing=_ref.onSubmitEditing,secureTextEntry=_ref.secureTextEntry,_ref$keyboardType=_ref.keyboardType,keyboardType=_ref$keyboardType===void 0?
|
|
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 _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _reactNative=require("react-native");var _react=_interopRequireWildcard(require("react"));var _InputBase=require("./InputBase.styles");var _colors=require("../../styles/colors");var _table_utils=require("../../helpers/table_utils");var _gridContainer=require("../containers/gridContainer");var _excluded=["style"],_excluded2=["iconLeft","iconRight"];var _this=this,_jsxFileName="/home/jenkins/agent/workspace/etendo_ui_library_develop/etendo_ui_library/src/components/inputBase/InputBase.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&&{}.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 InputBase=function InputBase(_ref){var value=_ref.value,placeholder=_ref.placeholder,title=_ref.title,helperText=_ref.helperText,isDisabled=_ref.isDisabled,isError=_ref.isError,onChangeText=_ref.onChangeText,icon=_ref.icon,rightButtons=_ref.rightButtons,onPress=_ref.onPress,onBlur=_ref.onBlur,onSubmitEditing=_ref.onSubmitEditing,onKeyPress=_ref.onKeyPress,secureTextEntry=_ref.secureTextEntry,_ref$keyboardType=_ref.keyboardType,keyboardType=_ref$keyboardType===void 0?"default":_ref$keyboardType,styleContainer=_ref.styleContainer,_ref$isFocusable=_ref.isFocusable,isFocusable=_ref$isFocusable===void 0?true:_ref$isFocusable,refInputContainer=_ref.refInputContainer,refInput=_ref.refInput,multiline=_ref.multiline,numberOfLines=_ref.numberOfLines;var heightTextInputLine=_InputBase.styles.textInput.lineHeight;var borderMultiline={borderWidth:0.001,borderColor:"transparent"};var isEditable=onPress?false:!isDisabled;var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),isFocused=_useState2[0],setIsFocused=_useState2[1];var _useState3=(0,_react.useState)(heightTextInputLine),_useState4=(0,_slicedToArray2.default)(_useState3,2),inputHeight=_useState4[0],setInputHeight=_useState4[1];var _useState5=(0,_react.useState)(false),_useState6=(0,_slicedToArray2.default)(_useState5,2),isScrollMultiline=_useState6[0],setIsScrollMultiline=_useState6[1];var borderWidth=isFocused?3:1;var paddingVertical=7-borderWidth;var paddingHorizontal=12-borderWidth;var onFocusChange=function onFocusChange(){if(!isDisabled&&isFocusable){setIsFocused(true);}};var onBlurChange=function onBlurChange(){setIsFocused(false);onBlur==null?void 0:onBlur();};var determineColor=function determineColor(icon){if(icon){return iconColorStyle();}if(isDisabled){return _colors.NEUTRAL_500;}return isError?_colors.DANGER_700:_colors.PRIMARY_100;};var textColorStyle=function textColorStyle(){if(!value||isDisabled){return _colors.NEUTRAL_500;}if(isFocused){return _colors.PRIMARY_100;}if(isError&&!isFocused){return _colors.DANGER_700;}return _colors.PRIMARY_100;};var iconColorStyle=function iconColorStyle(){if(isDisabled){return _colors.NEUTRAL_500;}if(isFocused){return _colors.PRIMARY_100;}if(isError&&!isFocused){return _colors.DANGER_700;}return _colors.PRIMARY_100;};var textInputStyle=[_InputBase.styles.textInput,{color:textColorStyle()}];if(_reactNative.Platform.OS==="web"){textInputStyle.push({outlineWidth:0});}var handleChange=function handleChange(string){if(onChangeText){if(["numeric","number-pad","phone-pad","decimal-pad"].includes(keyboardType)){var regexNumber=/^[\d.,\/]*$/;if(regexNumber.test(string)||string===""){onChangeText(string);}}else{onChangeText(string);}}};var determineIconStyles=function determineIconStyles(icon,disable){if(!icon)return null;var _icon$props=icon.props,_icon$props$style=_icon$props.style,style=_icon$props$style===void 0?{}:_icon$props$style,otherIconProps=(0,_objectWithoutProperties2.default)(_icon$props,_excluded);return _react.default.cloneElement(icon,Object.assign({fill:disable?_colors.NEUTRAL_500:determineColor(true),style:Object.assign({},style,{height:style.height||_InputBase.styles.icon.height,width:style.width||_InputBase.styles.icon.width})},otherIconProps));};var handleContentSizeChange=function handleContentSizeChange(e){if(multiline){var height=e.nativeEvent.contentSize.height;var maxHeight=heightTextInputLine*5;setIsScrollMultiline(height>heightTextInputLine);if(height<maxHeight){setInputHeight(height);}else{setInputHeight(maxHeight);}}};return _react.default.createElement(_react.default.Fragment,null,!!title&&_react.default.createElement(_reactNative.Text,{numberOfLines:1,ellipsizeMode:"tail",style:[_InputBase.styles.title,{color:determineColor()}],__self:_this,__source:{fileName:_jsxFileName,lineNumber:158,columnNumber:9}},title),_react.default.createElement(_reactNative.View,{ref:refInputContainer,style:[_InputBase.styles.container,{borderColor:determineColor()},{paddingHorizontal:paddingHorizontal,paddingVertical:paddingVertical,borderWidth:borderWidth},Object.assign({},styleContainer)],__self:_this,__source:{fileName:_jsxFileName,lineNumber:166,columnNumber:7}},!!icon&&_react.default.createElement(_reactNative.View,{style:_InputBase.styles.iconContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:180,columnNumber:11}},_react.default.cloneElement(icon,{style:_InputBase.styles.icon,fill:determineColor(true)})),_react.default.createElement(_reactNative.TextInput,{ref:refInput,value:value,onPressIn:onPress,onChangeText:handleChange,placeholder:placeholder,editable:isEditable,onFocus:onFocusChange,onBlur:onBlurChange,onSubmitEditing:onSubmitEditing,keyboardType:keyboardType,secureTextEntry:secureTextEntry,multiline:multiline,onContentSizeChange:handleContentSizeChange,numberOfLines:numberOfLines,onKeyPress:onKeyPress,style:[textInputStyle,onPress&&(0,_table_utils.cursorPointer)(),{maxHeight:inputHeight},isScrollMultiline&&borderMultiline],__self:_this,__source:{fileName:_jsxFileName,lineNumber:187,columnNumber:9}}),!!rightButtons&&_react.default.createElement(_gridContainer.GridContainer,{gapHorizontal:12,stylesContainer:_InputBase.styles.gridContainer,components:rightButtons.map(function(ButtonComponent,index){var _ButtonComponent$prop=ButtonComponent.props,iconLeft=_ButtonComponent$prop.iconLeft,iconRight=_ButtonComponent$prop.iconRight,otherProps=(0,_objectWithoutProperties2.default)(_ButtonComponent$prop,_excluded2);var modifiedProps=Object.assign({},otherProps);modifiedProps.paddingVertical=(modifiedProps==null?void 0:modifiedProps.paddingVertical)||0;modifiedProps.paddingHorizontal=(modifiedProps==null?void 0:modifiedProps.paddingHorizontal)||0;modifiedProps.iconLeft=determineIconStyles(iconLeft,modifiedProps.disabled||isDisabled);modifiedProps.iconRight=determineIconStyles(iconRight,modifiedProps.disabled||isDisabled);modifiedProps.text="";return _react.default.createElement(ButtonComponent.type,(0,_extends2.default)({},modifiedProps,{key:index,disabled:isDisabled||modifiedProps.disabled,typeStyle:"white",__self:_this,__source:{fileName:_jsxFileName,lineNumber:235,columnNumber:17}}));}),__self:_this,__source:{fileName:_jsxFileName,lineNumber:213,columnNumber:11}})),!!helperText&&_react.default.createElement(_reactNative.Text,{numberOfLines:1,ellipsizeMode:"tail",style:[_InputBase.styles.helperText,{color:determineColor()}],__self:_this,__source:{fileName:_jsxFileName,lineNumber:247,columnNumber:9}},helperText));};var _default=exports.default=InputBase;
|
|
@@ -8,7 +8,6 @@ export declare const styles: {
|
|
|
8
8
|
};
|
|
9
9
|
container: {
|
|
10
10
|
backgroundColor: string;
|
|
11
|
-
height: number;
|
|
12
11
|
borderRadius: number;
|
|
13
12
|
borderColor: string;
|
|
14
13
|
overflow: "hidden";
|
|
@@ -17,20 +16,18 @@ export declare const styles: {
|
|
|
17
16
|
flexDirection: "row";
|
|
18
17
|
};
|
|
19
18
|
containerInput: {
|
|
20
|
-
height: number;
|
|
21
19
|
flex: number;
|
|
22
20
|
};
|
|
23
21
|
textInput: {
|
|
24
|
-
paddingHorizontal: number;
|
|
25
|
-
height: number;
|
|
26
22
|
backgroundColor: string;
|
|
27
23
|
fontSize: number;
|
|
28
24
|
fontStyle: "normal";
|
|
29
25
|
fontWeight: "500";
|
|
30
|
-
lineHeight: number;
|
|
31
26
|
letterSpacing: number;
|
|
27
|
+
lineHeight: number;
|
|
32
28
|
color: string;
|
|
33
29
|
flex: number;
|
|
30
|
+
textAlignVertical: "center";
|
|
34
31
|
};
|
|
35
32
|
helperText: {
|
|
36
33
|
fontSize: 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:{fontSize:16,fontWeight:'600',lineHeight:24,letterSpacing:-0.16,color:_colors.NEUTRAL_800},container:{backgroundColor:_colors.NEUTRAL_50,
|
|
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,borderRadius:8,borderColor:_colors.PRIMARY_100,overflow:'hidden',justifyContent:'center',alignItems:'center',flexDirection:'row'},containerInput:{flex:1},textInput:{backgroundColor:_colors.NEUTRAL_50,fontSize:16,fontStyle:'normal',fontWeight:'500',letterSpacing:-0.16,lineHeight:24,color:_colors.PRIMARY_100,flex:1,textAlignVertical:'center'},helperText:{fontSize:14,fontWeight:'500',lineHeight:24,letterSpacing:-0.14},gridContainer:{alignItems:'center',paddingLeft:12},iconContainer:{marginRight:8},icon:{width:24,height:24}});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement, RefObject } from 'react';
|
|
2
|
-
import { ColorValue, ImageStyle, NativeSyntheticEvent, TextInput, TextInputSubmitEditingEventData, View, ViewStyle } from 'react-native';
|
|
2
|
+
import { ColorValue, ImageStyle, NativeSyntheticEvent, TextInput, TextInputKeyPressEventData, TextInputSubmitEditingEventData, View, ViewStyle } from 'react-native';
|
|
3
3
|
import { ButtonProps } from '../button/Button.types';
|
|
4
4
|
export interface SvgImageProps {
|
|
5
5
|
style?: ImageStyle;
|
|
@@ -14,6 +14,7 @@ export interface IInputBase {
|
|
|
14
14
|
onBlur?: () => void;
|
|
15
15
|
onChangeText?: (value: string) => void;
|
|
16
16
|
onSubmitEditing?: (event: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void;
|
|
17
|
+
onKeyPress?: (e: NativeSyntheticEvent<TextInputKeyPressEventData>) => void;
|
|
17
18
|
placeholder?: string;
|
|
18
19
|
rightButtons?: RightButtons;
|
|
19
20
|
title?: string;
|
|
@@ -25,4 +26,6 @@ export interface IInputBase {
|
|
|
25
26
|
isFocusable?: boolean;
|
|
26
27
|
refInputContainer?: RefObject<View>;
|
|
27
28
|
refInput?: RefObject<TextInput>;
|
|
29
|
+
multiline?: boolean;
|
|
30
|
+
numberOfLines?: number;
|
|
28
31
|
}
|
|
@@ -5,7 +5,7 @@ export type DayItem = {
|
|
|
5
5
|
};
|
|
6
6
|
export type DateFormat = "DD/MM/YYYY" | "MM/DD/YYYY";
|
|
7
7
|
export type LanguageFormat = "en-US" | "es-ES";
|
|
8
|
-
export interface DatePickerInputProps extends Omit<IInputBase, "keyboardType" | "secureTextEntry"> {
|
|
8
|
+
export interface DatePickerInputProps extends Omit<IInputBase, "keyboardType" | "secureTextEntry" | 'multiline' | 'numberOfLines'> {
|
|
9
9
|
language: LanguageFormat;
|
|
10
10
|
dateFormat: DateFormat;
|
|
11
11
|
showCalendar?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DimensionValue, NativeScrollEvent, NativeSyntheticEvent, ScrollView } from 'react-native';
|
|
2
2
|
import { IInputBase } from '../InputBase.types';
|
|
3
3
|
import { RefObject } from 'react';
|
|
4
|
-
export interface IDropdownInput extends Omit<IInputBase, 'keyboardType' | 'secureTextEntry'> {
|
|
4
|
+
export interface IDropdownInput extends Omit<IInputBase, 'keyboardType' | 'secureTextEntry' | 'multiline' | 'numberOfLines'> {
|
|
5
5
|
staticData?: any[];
|
|
6
6
|
displayKey?: string;
|
|
7
7
|
maxVisibleOptions?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.SUPPORTED_MIME_TYPES=void 0;var SUPPORTED_MIME_TYPES=exports.SUPPORTED_MIME_TYPES=['text/x-c','text/x-c++','application/csv','application/vnd.openxmlformats-officedocument.wordprocessingml.document','text/html','text/x-java','application/json','text/markdown','application/pdf','text/x-php','application/vnd.openxmlformats-officedocument.presentationml.presentation','text/x-python','text/x-script.python','text/x-ruby','text/x-tex','text/plain','text/css','image/jpeg','image/jpeg','text/javascript','image/gif','image/png','application/x-tar','application/typescript','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/xml','text/xml','application/zip'];
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.SUPPORTED_MIME_TYPES=exports.KEY_SHIFT=exports.KEY_ENTER=void 0;var SUPPORTED_MIME_TYPES=exports.SUPPORTED_MIME_TYPES=['text/x-c','text/x-c++','application/csv','application/vnd.openxmlformats-officedocument.wordprocessingml.document','text/html','text/x-java','application/json','text/markdown','application/pdf','text/x-php','application/vnd.openxmlformats-officedocument.presentationml.presentation','text/x-python','text/x-script.python','text/x-ruby','text/x-tex','text/plain','text/css','image/jpeg','image/jpeg','text/javascript','image/gif','image/png','application/x-tar','application/typescript','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/xml','text/xml','application/zip'];var KEY_SHIFT=exports.KEY_SHIFT='shiftKey';var KEY_ENTER=exports.KEY_ENTER='enter';
|
|
@@ -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 _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));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 _FileIcon=require("../../../assets/images/icons/FileIcon");var _button=require("../../button");var _secondaryComponents=require("../../secondaryComponents");var _functions_utils=require("../../../helpers/functions_utils");var _icons=require("../../../assets/images/icons");var _excluded=["value","placeholder","onChangeText","onSubmit","setFile","onFileUploaded","onError","uploadConfig","maxFileSize","rightButtons","isAttachDisable","isSendDisable"];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&&{}.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 POSITION_DOWN_FILE=52;var POSITION_UP_FILE=-60;var FileSearchInput=function FileSearchInput(_ref){var value=_ref.value,placeholder=_ref.placeholder,onChangeText=_ref.onChangeText,onSubmit=_ref.onSubmit,setFile=_ref.setFile,onFileUploaded=_ref.onFileUploaded,onError=_ref.onError,uploadConfig=_ref.uploadConfig,_ref$maxFileSize=_ref.maxFileSize,maxFileSize=_ref$maxFileSize===void 0?512:_ref$maxFileSize,rightButtons=_ref.rightButtons,isAttachDisable=_ref.isAttachDisable,isSendDisable=_ref.isSendDisable,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 _useState11=(0,_react.useState)({top:0,left:0,width:0}),_useState12=(0,_slicedToArray2.default)(_useState11,2),modalPosition=_useState12[0],setModalPosition=_useState12[1];var _Dimensions$get=_reactNative.Dimensions.get('window'),windowHeight=_Dimensions$get.height,windowWidth=_Dimensions$get.width;var refInput=(0,_react.useRef)(null);var dropAreaRef=(0,_react.useRef)(null);var fileInputRef=(0,_react.useRef)(null);var abortControllerRef=(0,_react.useRef)(null);var resetProgress=function resetProgress(){setLocalFile(null);setIsFileValid(false);setLoadingFile(false);setProgress(0);setFileStatus('none');};var handleDragOver=function handleDragOver(event){event.preventDefault();};var handleDrop=function handleDrop(event){event.preventDefault();var files=event.dataTransfer.files;if(files.length>0){var droppedFile=files[0];validateAndLoadFile(droppedFile);if(!!setFile)setFile(droppedFile);setLocalFile(droppedFile);}};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(!!setFile)setFile(pickedFile);setIsFileValid(true);startLoading(pickedFile);try{if(!!uploadFile)yield uploadFile(pickedFile);}catch(error){console.error('Error uploading file:',error);setFileStatus('error');onError==null?void 0:onError(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(error){if(!DocumentPicker.isCancel(error)){console.error(error);onError==null?void 0:onError(error);}}}});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.";}}};var UploadButton=_react.default.createElement(_button.Button,{paddingVertical:7,typeStyle:"white",onPress:handleFileButtonClick,disabled:isAttachDisable,iconLeft:_react.default.createElement(_icons.PaperclipIcon,{style:_FileSearchInput.styles.fileIcon,__self:_this,__source:{fileName:_jsxFileName,lineNumber:222,columnNumber:17}}),__self:_this,__source:{fileName:_jsxFileName,lineNumber:217,columnNumber:5}});var SendButton=_react.default.createElement(_button.Button,{paddingVertical:7,typeStyle:"white",onPress:handleSendMessage,disabled:isSendDisable,iconLeft:_react.default.createElement(_icons.CornerDownRightIcon,{style:_FileSearchInput.styles.fileIcon,__self:_this,__source:{fileName:_jsxFileName,lineNumber:231,columnNumber:17}}),__self:_this,__source:{fileName:_jsxFileName,lineNumber:226,columnNumber:5}});var buttons=rightButtons;if(!!uploadConfig){buttons=buttons?[].concat((0,_toConsumableArray2.default)(buttons),[UploadButton]):[UploadButton];}if(!!onSubmit){buttons=buttons?[].concat((0,_toConsumableArray2.default)(buttons),[SendButton]):[SendButton];}var handleFileSelect=function(){var _ref4=(0,_asyncToGenerator2.default)(function*(event){var file=event.target.files[0];if(file){if(yield validateAndLoadFile(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);abortControllerRef.current=new AbortController();var signal=abortControllerRef.current.signal;try{var response=yield fetch(uploadConfig.url,{method:uploadConfig.method,body:formData,headers:uploadConfig.headers,signal:signal});if(response.ok){completeProgress();setLoadingFile(false);setFileStatus('loaded');if(!!onFileUploaded){var data=yield response.json();onFileUploaded(data);}}else{var errorResponse=yield response.json();console.error('Error uploading file:',errorResponse);onError==null?void 0:onError(errorResponse);setFileStatus('error');resetProgress();if(!!setFile)setFile(null);}}catch(error){if(error.name==='AbortError'){console.error('File upload cancelled');setFileStatus('canceled');}else{console.error('Error uploading file:',error);setFileStatus('error');}resetProgress();if(!!setFile)setFile(null);}}});return function uploadFile(_x3){return _ref5.apply(this,arguments);};}();var handleCancelFile=function handleCancelFile(){if(abortControllerRef.current){abortControllerRef.current.abort();}resetProgress();animateProgress(0);if(!!setFile)setFile(null);setFileStatus('canceled');if(fileInputRef.current){fileInputRef.current.value=null;}};(0,_react.useEffect)(function(){return function(){if(abortControllerRef.current){abortControllerRef.current.abort();}};},[]);var adjustDropdownPosition=(0,_react.useCallback)(function(){if(refInput.current){refInput.current.measure(function(x,y,width,height,pageX,pageY){setModalPosition({top:height+12>pageY?POSITION_DOWN_FILE:POSITION_UP_FILE,left:pageX,width:width});});}},[windowHeight]);(0,_react.useEffect)(function(){adjustDropdownPosition();if((0,_functions_utils.isWebPlatform)()){var handleScroll=function handleScroll(){adjustDropdownPosition();};window.addEventListener('scroll',handleScroll,{passive:true});return function(){return window.removeEventListener('scroll',handleScroll);};}},[windowHeight,windowWidth,adjustDropdownPosition]);return _react.default.createElement(_reactNative.SafeAreaView,{style:_FileSearchInput.styles.container,__self:_this,__source:{fileName:_jsxFileName,lineNumber:349,columnNumber:5}},_react.default.createElement(_reactNative.View,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:350,columnNumber:7}},(0,_functions_utils.isWebPlatform)()?_react.default.createElement("div",{ref:dropAreaRef,onDrop:handleDrop,onDragOver:handleDragOver,onDragEnter:handleDragOver,onDragLeave:handleDragOver,__self:_this,__source:{fileName:_jsxFileName,lineNumber:352,columnNumber:11}},_react.default.createElement(_InputBase.default,(0,_extends2.default)({},inputBaseProps,{refInputContainer:refInput,value:value,onChangeText:onChangeText,rightButtons:buttons,onSubmitEditing:handleSendMessage,placeholder:placeholder,__self:_this,__source:{fileName:_jsxFileName,lineNumber:358,columnNumber:13}})),_react.default.createElement("input",{type:"file",ref:fileInputRef,style:{display:'none'},onChange:handleFileSelect,__self:_this,__source:{fileName:_jsxFileName,lineNumber:367,columnNumber:13}})):_react.default.createElement(_InputBase.default,(0,_extends2.default)({},inputBaseProps,{value:value,onChangeText:onChangeText,rightButtons:buttons,placeholder:placeholder,__self:_this,__source:{fileName:_jsxFileName,lineNumber:375,columnNumber:11}}))),file&&isFileValid&&fileStatus!=='canceled'&&_react.default.createElement(_reactNative.View,{onStartShouldSetResponder:function onStartShouldSetResponder(){return true;},style:[_FileSearchInput.styles.fileContainer,{top:modalPosition.top},{width:modalPosition.width}],__self:_this,__source:{fileName:_jsxFileName,lineNumber:385,columnNumber:9}},_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileNameContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:396,columnNumber:11}},_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileNameLoadedLeftContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:397,columnNumber:13}},_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileIconContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:398,columnNumber:15}},_react.default.createElement(_FileIcon.FileIcon,{style:_FileSearchInput.styles.fileIcon,__self:_this,__source:{fileName:_jsxFileName,lineNumber:399,columnNumber:17}})),_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileContent,__self:_this,__source:{fileName:_jsxFileName,lineNumber:401,columnNumber:15}},_react.default.createElement(_reactNative.Text,{style:_FileSearchInput.styles.fileNameText,numberOfLines:1,ellipsizeMode:"tail",__self:_this,__source:{fileName:_jsxFileName,lineNumber:402,columnNumber:17}},file==null?void 0:file.name),progress>0&&_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.progressBarContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:409,columnNumber:19}},_react.default.createElement(_secondaryComponents.SkeletonItem,{width:progress+"%",height:8,color:_colors.NEUTRAL_1000,borderRadius:16,__self:_this,__source:{fileName:_jsxFileName,lineNumber:410,columnNumber:21}})))),_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileNameRightContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:421,columnNumber:13}},fileStatus==='loaded'&&_react.default.createElement(_icons.CheckCircleFillIcon,{style:_FileSearchInput.styles.checkCircleIcon,fill:_colors.SUCCESS_600,__self:_this,__source:{fileName:_jsxFileName,lineNumber:423,columnNumber:17}}),_react.default.createElement(_reactNative.TouchableOpacity,{style:_FileSearchInput.styles.containerXicon,onPress:handleCancelFile,__self:_this,__source:{fileName:_jsxFileName,lineNumber:428,columnNumber:15}},_react.default.createElement(_icons.XIcon,{style:_FileSearchInput.styles.deleteIcon,__self:_this,__source:{fileName:_jsxFileName,lineNumber:431,columnNumber:17}}))))));};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 _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));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 _FileIcon=require("../../../assets/images/icons/FileIcon");var _button=require("../../button");var _secondaryComponents=require("../../secondaryComponents");var _functions_utils=require("../../../helpers/functions_utils");var _icons=require("../../../assets/images/icons");var _FileSearchInput2=require("./FileSearchInput.constants");var _excluded=["value","placeholder","onChangeText","onSubmit","setFile","onFileUploaded","onError","uploadConfig","maxFileSize","rightButtons","isAttachDisable","isSendDisable"];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&&{}.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 POSITION_DOWN_FILE=52;var POSITION_UP_FILE=-60;var FileSearchInput=function FileSearchInput(_ref){var value=_ref.value,placeholder=_ref.placeholder,onChangeText=_ref.onChangeText,onSubmit=_ref.onSubmit,setFile=_ref.setFile,onFileUploaded=_ref.onFileUploaded,onError=_ref.onError,uploadConfig=_ref.uploadConfig,_ref$maxFileSize=_ref.maxFileSize,maxFileSize=_ref$maxFileSize===void 0?512:_ref$maxFileSize,rightButtons=_ref.rightButtons,isAttachDisable=_ref.isAttachDisable,isSendDisable=_ref.isSendDisable,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 _useState11=(0,_react.useState)({top:0,left:0,width:0}),_useState12=(0,_slicedToArray2.default)(_useState11,2),modalPosition=_useState12[0],setModalPosition=_useState12[1];var _Dimensions$get=_reactNative.Dimensions.get('window'),windowHeight=_Dimensions$get.height,windowWidth=_Dimensions$get.width;var refInput=(0,_react.useRef)(null);var dropAreaRef=(0,_react.useRef)(null);var fileInputRef=(0,_react.useRef)(null);var abortControllerRef=(0,_react.useRef)(null);var resetProgress=function resetProgress(){setLocalFile(null);setIsFileValid(false);setLoadingFile(false);setProgress(0);setFileStatus('none');};var handleDragOver=function handleDragOver(event){event.preventDefault();};var handleDrop=function handleDrop(event){event.preventDefault();var files=event.dataTransfer.files;if(files.length>0){var droppedFile=files[0];validateAndLoadFile(droppedFile);if(!!setFile)setFile(droppedFile);setLocalFile(droppedFile);}};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(!!setFile)setFile(pickedFile);setIsFileValid(true);startLoading(pickedFile);try{if(!!uploadFile)yield uploadFile(pickedFile);}catch(error){console.error('Error uploading file:',error);setFileStatus('error');onError==null?void 0:onError(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(error){if(!DocumentPicker.isCancel(error)){console.error(error);onError==null?void 0:onError(error);}}}});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.";}}};var UploadButton=_react.default.createElement(_button.Button,{paddingVertical:7,typeStyle:"white",onPress:handleFileButtonClick,disabled:isAttachDisable,iconLeft:_react.default.createElement(_icons.PaperclipIcon,{style:_FileSearchInput.styles.fileIcon,__self:_this,__source:{fileName:_jsxFileName,lineNumber:226,columnNumber:17}}),__self:_this,__source:{fileName:_jsxFileName,lineNumber:221,columnNumber:5}});var SendButton=_react.default.createElement(_button.Button,{paddingVertical:7,typeStyle:"white",onPress:handleSendMessage,disabled:isSendDisable,iconLeft:_react.default.createElement(_icons.CornerDownRightIcon,{style:_FileSearchInput.styles.fileIcon,__self:_this,__source:{fileName:_jsxFileName,lineNumber:235,columnNumber:17}}),__self:_this,__source:{fileName:_jsxFileName,lineNumber:230,columnNumber:5}});var buttons=rightButtons;if(!!uploadConfig){buttons=buttons?[].concat((0,_toConsumableArray2.default)(buttons),[UploadButton]):[UploadButton];}if(!!onSubmit){buttons=buttons?[].concat((0,_toConsumableArray2.default)(buttons),[SendButton]):[SendButton];}var handleFileSelect=function(){var _ref4=(0,_asyncToGenerator2.default)(function*(event){var file=event.target.files[0];if(file){if(yield validateAndLoadFile(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);abortControllerRef.current=new AbortController();var signal=abortControllerRef.current.signal;try{var response=yield fetch(uploadConfig.url,{method:uploadConfig.method,body:formData,headers:uploadConfig.headers,signal:signal});if(response.ok){completeProgress();setLoadingFile(false);setFileStatus('loaded');if(!!onFileUploaded){var data=yield response.json();onFileUploaded(data);}}else{var errorResponse=yield response.json();console.error('Error uploading file:',errorResponse);onError==null?void 0:onError(errorResponse);setFileStatus('error');resetProgress();if(!!setFile)setFile(null);}}catch(error){if(error.name==='AbortError'){console.error('File upload cancelled');setFileStatus('canceled');}else{console.error('Error uploading file:',error);setFileStatus('error');}resetProgress();if(!!setFile)setFile(null);}}});return function uploadFile(_x3){return _ref5.apply(this,arguments);};}();var handleCancelFile=function handleCancelFile(){if(abortControllerRef.current){abortControllerRef.current.abort();}resetProgress();animateProgress(0);if(!!setFile)setFile(null);setFileStatus('canceled');if(fileInputRef.current){fileInputRef.current.value=null;}};(0,_react.useEffect)(function(){return function(){if(abortControllerRef.current){abortControllerRef.current.abort();}};},[]);var adjustDropdownPosition=(0,_react.useCallback)(function(){if(refInput.current){refInput.current.measure(function(x,y,width,height,pageX,pageY){setModalPosition({top:height+12>pageY?POSITION_DOWN_FILE:POSITION_UP_FILE,left:pageX,width:width});});}},[windowHeight]);(0,_react.useEffect)(function(){adjustDropdownPosition();if((0,_functions_utils.isWebPlatform)()){var handleScroll=function handleScroll(){adjustDropdownPosition();};window.addEventListener('scroll',handleScroll,{passive:true});return function(){return window.removeEventListener('scroll',handleScroll);};}},[windowHeight,windowWidth,adjustDropdownPosition]);var onKeyPressHandler=function onKeyPressHandler(e){if(_FileSearchInput2.KEY_SHIFT in e&&e.nativeEvent.key===_FileSearchInput2.KEY_ENTER&&!e.nativeEvent.shiftKey){e.preventDefault();handleSendMessage();}};return _react.default.createElement(_reactNative.SafeAreaView,{style:_FileSearchInput.styles.container,__self:_this,__source:{fileName:_jsxFileName,lineNumber:362,columnNumber:5}},_react.default.createElement(_reactNative.View,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:363,columnNumber:7}},(0,_functions_utils.isWebPlatform)()?_react.default.createElement("div",{ref:dropAreaRef,onDrop:handleDrop,onDragOver:handleDragOver,onDragEnter:handleDragOver,onDragLeave:handleDragOver,__self:_this,__source:{fileName:_jsxFileName,lineNumber:365,columnNumber:11}},_react.default.createElement(_InputBase.default,(0,_extends2.default)({},inputBaseProps,{refInputContainer:refInput,value:value,onChangeText:onChangeText,rightButtons:buttons,onSubmitEditing:handleSendMessage,placeholder:placeholder,onKeyPress:onKeyPressHandler,__self:_this,__source:{fileName:_jsxFileName,lineNumber:371,columnNumber:13}})),_react.default.createElement("input",{type:"file",ref:fileInputRef,style:{display:'none'},onChange:handleFileSelect,__self:_this,__source:{fileName:_jsxFileName,lineNumber:381,columnNumber:13}})):_react.default.createElement(_InputBase.default,(0,_extends2.default)({},inputBaseProps,{value:value,onChangeText:onChangeText,rightButtons:buttons,placeholder:placeholder,__self:_this,__source:{fileName:_jsxFileName,lineNumber:389,columnNumber:11}}))),file&&isFileValid&&fileStatus!=='canceled'&&_react.default.createElement(_reactNative.View,{onStartShouldSetResponder:function onStartShouldSetResponder(){return true;},style:[_FileSearchInput.styles.fileContainer,{top:modalPosition.top},{width:modalPosition.width}],__self:_this,__source:{fileName:_jsxFileName,lineNumber:399,columnNumber:9}},_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileNameContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:410,columnNumber:11}},_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileNameLoadedLeftContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:411,columnNumber:13}},_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileIconContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:412,columnNumber:15}},_react.default.createElement(_FileIcon.FileIcon,{style:_FileSearchInput.styles.fileIcon,__self:_this,__source:{fileName:_jsxFileName,lineNumber:413,columnNumber:17}})),_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileContent,__self:_this,__source:{fileName:_jsxFileName,lineNumber:415,columnNumber:15}},_react.default.createElement(_reactNative.Text,{style:_FileSearchInput.styles.fileNameText,numberOfLines:1,ellipsizeMode:"tail",__self:_this,__source:{fileName:_jsxFileName,lineNumber:416,columnNumber:17}},file==null?void 0:file.name),progress>0&&_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.progressBarContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:423,columnNumber:19}},_react.default.createElement(_secondaryComponents.SkeletonItem,{width:progress+"%",height:8,color:_colors.NEUTRAL_1000,borderRadius:16,__self:_this,__source:{fileName:_jsxFileName,lineNumber:424,columnNumber:21}})))),_react.default.createElement(_reactNative.View,{style:_FileSearchInput.styles.fileNameRightContainer,__self:_this,__source:{fileName:_jsxFileName,lineNumber:435,columnNumber:13}},fileStatus==='loaded'&&_react.default.createElement(_icons.CheckCircleFillIcon,{style:_FileSearchInput.styles.checkCircleIcon,fill:_colors.SUCCESS_600,__self:_this,__source:{fileName:_jsxFileName,lineNumber:437,columnNumber:17}}),_react.default.createElement(_reactNative.TouchableOpacity,{style:_FileSearchInput.styles.containerXicon,onPress:handleCancelFile,__self:_this,__source:{fileName:_jsxFileName,lineNumber:442,columnNumber:15}},_react.default.createElement(_icons.XIcon,{style:_FileSearchInput.styles.deleteIcon,__self:_this,__source:{fileName:_jsxFileName,lineNumber:445,columnNumber:17}}))))));};var _default=exports.default=FileSearchInput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IInputBase } from '../InputBase.types';
|
|
2
|
-
export interface IPasswordInput extends Omit<IInputBase, 'keyboardType' | 'secureTextEntry'> {
|
|
2
|
+
export interface IPasswordInput extends Omit<IInputBase, 'keyboardType' | 'secureTextEntry' | 'multiline' | 'numberOfLines'> {
|
|
3
3
|
value?: string;
|
|
4
4
|
onChangeText?: (text: string) => void;
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IInputBase } from '../InputBase.types';
|
|
2
|
-
export interface ISearchInput extends Omit<IInputBase, 'keyboardType' | 'secureTextEntry'> {
|
|
2
|
+
export interface ISearchInput extends Omit<IInputBase, 'keyboardType' | 'secureTextEntry' | 'multiline' | 'numberOfLines'> {
|
|
3
3
|
value?: string;
|
|
4
4
|
onChangeText?: (text: string) => void;
|
|
5
5
|
onSubmit?: (text: string) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["styleContainer", "styleGridContainer", "buttons", "widthSearchInput", "gridGapHorizontal", "gridGapVertical"];
|
|
2
2
|
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; }
|
|
3
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var
|
|
3
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { View } from "react-native-web";
|
|
6
6
|
import { DEFAULT_SEARCH_WIDTH } from "./SearchContainer.default";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { IInputBase } from
|
|
3
|
-
declare const InputBase: ({ value, placeholder, title, helperText, isDisabled, isError, onChangeText, icon, rightButtons, onPress, onBlur, onSubmitEditing, secureTextEntry, keyboardType, styleContainer, isFocusable, refInputContainer, refInput }: IInputBase) => React.JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IInputBase } from "./InputBase.types";
|
|
3
|
+
declare const InputBase: ({ value, placeholder, title, helperText, isDisabled, isError, onChangeText, icon, rightButtons, onPress, onBlur, onSubmitEditing, onKeyPress, secureTextEntry, keyboardType, styleContainer, isFocusable, refInputContainer, refInput, multiline, numberOfLines, }: IInputBase) => React.JSX.Element;
|
|
4
4
|
export default InputBase;
|
|
@@ -8,15 +8,15 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
9
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
10
|
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; }
|
|
11
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var
|
|
11
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
12
12
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
13
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
14
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
15
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
16
16
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
17
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
-
import { Platform, Text, TextInput,
|
|
19
|
-
import React, { useState } from
|
|
18
|
+
import { Platform, Text, TextInput, View } from "react-native-web";
|
|
19
|
+
import React, { useState } from "react";
|
|
20
20
|
import { styles } from "./InputBase.styles";
|
|
21
21
|
import { DANGER_700, NEUTRAL_500, PRIMARY_100 } from "../../styles/colors";
|
|
22
22
|
import { cursorPointer } from "../../helpers/table_utils";
|
|
@@ -34,22 +34,38 @@ var InputBase = function InputBase(_ref) {
|
|
|
34
34
|
onPress = _ref.onPress,
|
|
35
35
|
onBlur = _ref.onBlur,
|
|
36
36
|
onSubmitEditing = _ref.onSubmitEditing,
|
|
37
|
+
onKeyPress = _ref.onKeyPress,
|
|
37
38
|
secureTextEntry = _ref.secureTextEntry,
|
|
38
39
|
_ref$keyboardType = _ref.keyboardType,
|
|
39
|
-
keyboardType = _ref$keyboardType === void 0 ?
|
|
40
|
+
keyboardType = _ref$keyboardType === void 0 ? "default" : _ref$keyboardType,
|
|
40
41
|
styleContainer = _ref.styleContainer,
|
|
41
42
|
_ref$isFocusable = _ref.isFocusable,
|
|
42
43
|
isFocusable = _ref$isFocusable === void 0 ? true : _ref$isFocusable,
|
|
43
44
|
refInputContainer = _ref.refInputContainer,
|
|
44
|
-
refInput = _ref.refInput
|
|
45
|
+
refInput = _ref.refInput,
|
|
46
|
+
multiline = _ref.multiline,
|
|
47
|
+
numberOfLines = _ref.numberOfLines;
|
|
48
|
+
var heightTextInputLine = styles.textInput.lineHeight;
|
|
49
|
+
var borderMultiline = {
|
|
50
|
+
borderWidth: 0.001,
|
|
51
|
+
borderColor: "transparent"
|
|
52
|
+
};
|
|
53
|
+
var isEditable = onPress ? false : !isDisabled;
|
|
45
54
|
var _useState = useState(false),
|
|
46
55
|
_useState2 = _slicedToArray(_useState, 2),
|
|
47
56
|
isFocused = _useState2[0],
|
|
48
57
|
setIsFocused = _useState2[1];
|
|
58
|
+
var _useState3 = useState(heightTextInputLine),
|
|
59
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
60
|
+
inputHeight = _useState4[0],
|
|
61
|
+
setInputHeight = _useState4[1];
|
|
62
|
+
var _useState5 = useState(false),
|
|
63
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
64
|
+
isScrollMultiline = _useState6[0],
|
|
65
|
+
setIsScrollMultiline = _useState6[1];
|
|
49
66
|
var borderWidth = isFocused ? 3 : 1;
|
|
50
|
-
var paddingVertical =
|
|
67
|
+
var paddingVertical = 7 - borderWidth;
|
|
51
68
|
var paddingHorizontal = 12 - borderWidth;
|
|
52
|
-
var isEditable = onPress ? false : !isDisabled;
|
|
53
69
|
var onFocusChange = function onFocusChange() {
|
|
54
70
|
if (!isDisabled && isFocusable) {
|
|
55
71
|
setIsFocused(true);
|
|
@@ -95,16 +111,16 @@ var InputBase = function InputBase(_ref) {
|
|
|
95
111
|
var textInputStyle = [styles.textInput, {
|
|
96
112
|
color: textColorStyle()
|
|
97
113
|
}];
|
|
98
|
-
if (Platform.OS ===
|
|
114
|
+
if (Platform.OS === "web") {
|
|
99
115
|
textInputStyle.push({
|
|
100
116
|
outlineWidth: 0
|
|
101
117
|
});
|
|
102
118
|
}
|
|
103
119
|
var handleChange = function handleChange(string) {
|
|
104
120
|
if (onChangeText) {
|
|
105
|
-
if ([
|
|
121
|
+
if (["numeric", "number-pad", "phone-pad", "decimal-pad"].includes(keyboardType)) {
|
|
106
122
|
var regexNumber = /^[\d.,\/]*$/;
|
|
107
|
-
if (regexNumber.test(string) || string ===
|
|
123
|
+
if (regexNumber.test(string) || string === "") {
|
|
108
124
|
onChangeText(string);
|
|
109
125
|
}
|
|
110
126
|
} else {
|
|
@@ -126,6 +142,18 @@ var InputBase = function InputBase(_ref) {
|
|
|
126
142
|
})
|
|
127
143
|
}, otherIconProps));
|
|
128
144
|
};
|
|
145
|
+
var handleContentSizeChange = function handleContentSizeChange(e) {
|
|
146
|
+
if (multiline) {
|
|
147
|
+
var height = e.nativeEvent.contentSize.height;
|
|
148
|
+
var maxHeight = heightTextInputLine * 5;
|
|
149
|
+
setIsScrollMultiline(height > heightTextInputLine);
|
|
150
|
+
if (height < maxHeight) {
|
|
151
|
+
setInputHeight(height);
|
|
152
|
+
} else {
|
|
153
|
+
setInputHeight(maxHeight);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
129
157
|
return /*#__PURE__*/React.createElement(React.Fragment, null, !!title && /*#__PURE__*/React.createElement(Text, {
|
|
130
158
|
numberOfLines: 1,
|
|
131
159
|
ellipsizeMode: "tail",
|
|
@@ -146,11 +174,7 @@ var InputBase = function InputBase(_ref) {
|
|
|
146
174
|
}, /*#__PURE__*/React.cloneElement(icon, {
|
|
147
175
|
style: styles.icon,
|
|
148
176
|
fill: determineColor(true)
|
|
149
|
-
})), /*#__PURE__*/React.createElement(
|
|
150
|
-
disabled: isDisabled,
|
|
151
|
-
style: styles.containerInput,
|
|
152
|
-
onPress: onPress
|
|
153
|
-
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
177
|
+
})), /*#__PURE__*/React.createElement(TextInput, {
|
|
154
178
|
ref: refInput,
|
|
155
179
|
value: value,
|
|
156
180
|
onPressIn: onPress,
|
|
@@ -160,10 +184,16 @@ var InputBase = function InputBase(_ref) {
|
|
|
160
184
|
onFocus: onFocusChange,
|
|
161
185
|
onBlur: onBlurChange,
|
|
162
186
|
onSubmitEditing: onSubmitEditing,
|
|
163
|
-
style: [textInputStyle, onPress && cursorPointer()],
|
|
164
187
|
keyboardType: keyboardType,
|
|
165
|
-
secureTextEntry: secureTextEntry
|
|
166
|
-
|
|
188
|
+
secureTextEntry: secureTextEntry,
|
|
189
|
+
multiline: multiline,
|
|
190
|
+
onContentSizeChange: handleContentSizeChange,
|
|
191
|
+
numberOfLines: numberOfLines,
|
|
192
|
+
onKeyPress: onKeyPress,
|
|
193
|
+
style: [textInputStyle, onPress && cursorPointer(), {
|
|
194
|
+
maxHeight: inputHeight
|
|
195
|
+
}, isScrollMultiline && borderMultiline]
|
|
196
|
+
}), !!rightButtons && /*#__PURE__*/React.createElement(GridContainer, {
|
|
167
197
|
gapHorizontal: 12,
|
|
168
198
|
stylesContainer: styles.gridContainer,
|
|
169
199
|
components: rightButtons.map(function (ButtonComponent, index) {
|
|
@@ -176,11 +206,11 @@ var InputBase = function InputBase(_ref) {
|
|
|
176
206
|
modifiedProps.paddingHorizontal = (modifiedProps === null || modifiedProps === void 0 ? void 0 : modifiedProps.paddingHorizontal) || 0;
|
|
177
207
|
modifiedProps.iconLeft = determineIconStyles(iconLeft, modifiedProps.disabled || isDisabled);
|
|
178
208
|
modifiedProps.iconRight = determineIconStyles(iconRight, modifiedProps.disabled || isDisabled);
|
|
179
|
-
modifiedProps.text =
|
|
209
|
+
modifiedProps.text = "";
|
|
180
210
|
return /*#__PURE__*/React.createElement(ButtonComponent.type, _extends({}, modifiedProps, {
|
|
181
211
|
key: index,
|
|
182
212
|
disabled: isDisabled || modifiedProps.disabled,
|
|
183
|
-
typeStyle:
|
|
213
|
+
typeStyle: "white"
|
|
184
214
|
}));
|
|
185
215
|
})
|
|
186
216
|
})), !!helperText && /*#__PURE__*/React.createElement(Text, {
|
|
@@ -8,7 +8,6 @@ export declare const styles: {
|
|
|
8
8
|
};
|
|
9
9
|
container: {
|
|
10
10
|
backgroundColor: string;
|
|
11
|
-
height: number;
|
|
12
11
|
borderRadius: number;
|
|
13
12
|
borderColor: string;
|
|
14
13
|
overflow: "hidden";
|
|
@@ -17,20 +16,18 @@ export declare const styles: {
|
|
|
17
16
|
flexDirection: "row";
|
|
18
17
|
};
|
|
19
18
|
containerInput: {
|
|
20
|
-
height: number;
|
|
21
19
|
flex: number;
|
|
22
20
|
};
|
|
23
21
|
textInput: {
|
|
24
|
-
paddingHorizontal: number;
|
|
25
|
-
height: number;
|
|
26
22
|
backgroundColor: string;
|
|
27
23
|
fontSize: number;
|
|
28
24
|
fontStyle: "normal";
|
|
29
25
|
fontWeight: "500";
|
|
30
|
-
lineHeight: number;
|
|
31
26
|
letterSpacing: number;
|
|
27
|
+
lineHeight: number;
|
|
32
28
|
color: string;
|
|
33
29
|
flex: number;
|
|
30
|
+
textAlignVertical: "center";
|
|
34
31
|
};
|
|
35
32
|
helperText: {
|
|
36
33
|
fontSize: number;
|
|
@@ -10,7 +10,6 @@ export var styles = StyleSheet.create({
|
|
|
10
10
|
},
|
|
11
11
|
container: {
|
|
12
12
|
backgroundColor: NEUTRAL_50,
|
|
13
|
-
height: 48,
|
|
14
13
|
borderRadius: 8,
|
|
15
14
|
borderColor: PRIMARY_100,
|
|
16
15
|
overflow: 'hidden',
|
|
@@ -19,25 +18,23 @@ export var styles = StyleSheet.create({
|
|
|
19
18
|
flexDirection: 'row'
|
|
20
19
|
},
|
|
21
20
|
containerInput: {
|
|
22
|
-
height: 45,
|
|
23
21
|
flex: 1
|
|
24
22
|
},
|
|
25
23
|
textInput: {
|
|
26
|
-
paddingHorizontal: 0,
|
|
27
|
-
height: 48,
|
|
28
24
|
backgroundColor: NEUTRAL_50,
|
|
29
25
|
fontSize: 16,
|
|
30
26
|
fontStyle: 'normal',
|
|
31
27
|
fontWeight: '500',
|
|
32
|
-
lineHeight: 22,
|
|
33
28
|
letterSpacing: -0.16,
|
|
29
|
+
lineHeight: 24,
|
|
34
30
|
color: PRIMARY_100,
|
|
35
|
-
flex: 1
|
|
31
|
+
flex: 1,
|
|
32
|
+
textAlignVertical: 'center'
|
|
36
33
|
},
|
|
37
34
|
helperText: {
|
|
38
35
|
fontSize: 14,
|
|
39
36
|
fontWeight: '500',
|
|
40
|
-
lineHeight:
|
|
37
|
+
lineHeight: 24,
|
|
41
38
|
letterSpacing: -0.14
|
|
42
39
|
},
|
|
43
40
|
gridContainer: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement, RefObject } from 'react';
|
|
2
|
-
import { ColorValue, ImageStyle, NativeSyntheticEvent, TextInput, TextInputSubmitEditingEventData, View, ViewStyle } from 'react-native';
|
|
2
|
+
import { ColorValue, ImageStyle, NativeSyntheticEvent, TextInput, TextInputKeyPressEventData, TextInputSubmitEditingEventData, View, ViewStyle } from 'react-native';
|
|
3
3
|
import { ButtonProps } from '../button/Button.types';
|
|
4
4
|
export interface SvgImageProps {
|
|
5
5
|
style?: ImageStyle;
|
|
@@ -14,6 +14,7 @@ export interface IInputBase {
|
|
|
14
14
|
onBlur?: () => void;
|
|
15
15
|
onChangeText?: (value: string) => void;
|
|
16
16
|
onSubmitEditing?: (event: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void;
|
|
17
|
+
onKeyPress?: (e: NativeSyntheticEvent<TextInputKeyPressEventData>) => void;
|
|
17
18
|
placeholder?: string;
|
|
18
19
|
rightButtons?: RightButtons;
|
|
19
20
|
title?: string;
|
|
@@ -25,4 +26,6 @@ export interface IInputBase {
|
|
|
25
26
|
isFocusable?: boolean;
|
|
26
27
|
refInputContainer?: RefObject<View>;
|
|
27
28
|
refInput?: RefObject<TextInput>;
|
|
29
|
+
multiline?: boolean;
|
|
30
|
+
numberOfLines?: number;
|
|
28
31
|
}
|
|
@@ -7,7 +7,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7
7
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
8
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
9
|
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; }
|
|
10
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
11
11
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
12
12
|
import { View, Modal, TouchableWithoutFeedback, TouchableOpacity, Text, ScrollView, Pressable, FlatList, Dimensions } from "react-native-web";
|
|
13
13
|
import InputBase from "../InputBase";
|
|
@@ -5,7 +5,7 @@ export type DayItem = {
|
|
|
5
5
|
};
|
|
6
6
|
export type DateFormat = "DD/MM/YYYY" | "MM/DD/YYYY";
|
|
7
7
|
export type LanguageFormat = "en-US" | "es-ES";
|
|
8
|
-
export interface DatePickerInputProps extends Omit<IInputBase, "keyboardType" | "secureTextEntry"> {
|
|
8
|
+
export interface DatePickerInputProps extends Omit<IInputBase, "keyboardType" | "secureTextEntry" | 'multiline' | 'numberOfLines'> {
|
|
9
9
|
language: LanguageFormat;
|
|
10
10
|
dateFormat: DateFormat;
|
|
11
11
|
showCalendar?: boolean;
|
|
@@ -15,7 +15,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
15
15
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
17
|
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; }
|
|
18
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var
|
|
18
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
19
19
|
import React, { useRef, useEffect, useCallback, useState } from 'react';
|
|
20
20
|
import { View, Dimensions } from "react-native-web";
|
|
21
21
|
import InputBase from "../InputBase";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DimensionValue, NativeScrollEvent, NativeSyntheticEvent, ScrollView } from 'react-native';
|
|
2
2
|
import { IInputBase } from '../InputBase.types';
|
|
3
3
|
import { RefObject } from 'react';
|
|
4
|
-
export interface IDropdownInput extends Omit<IInputBase, 'keyboardType' | 'secureTextEntry'> {
|
|
4
|
+
export interface IDropdownInput extends Omit<IInputBase, 'keyboardType' | 'secureTextEntry' | 'multiline' | 'numberOfLines'> {
|
|
5
5
|
staticData?: any[];
|
|
6
6
|
displayKey?: string;
|
|
7
7
|
maxVisibleOptions?: number;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
// Supported files
|
|
2
|
-
export var SUPPORTED_MIME_TYPES = ['text/x-c', 'text/x-c++', 'application/csv', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'text/html', 'text/x-java', 'application/json', 'text/markdown', 'application/pdf', 'text/x-php', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'text/x-python', 'text/x-script.python', 'text/x-ruby', 'text/x-tex', 'text/plain', 'text/css', 'image/jpeg', 'image/jpeg', 'text/javascript', 'image/gif', 'image/png', 'application/x-tar', 'application/typescript', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/xml', 'text/xml', 'application/zip'];
|
|
2
|
+
export var SUPPORTED_MIME_TYPES = ['text/x-c', 'text/x-c++', 'application/csv', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'text/html', 'text/x-java', 'application/json', 'text/markdown', 'application/pdf', 'text/x-php', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'text/x-python', 'text/x-script.python', 'text/x-ruby', 'text/x-tex', 'text/plain', 'text/css', 'image/jpeg', 'image/jpeg', 'text/javascript', 'image/gif', 'image/png', 'application/x-tar', 'application/typescript', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/xml', 'text/xml', 'application/zip'];
|
|
3
|
+
export var KEY_SHIFT = 'shiftKey';
|
|
4
|
+
export var KEY_ENTER = 'enter';
|
|
@@ -15,7 +15,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
15
15
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
17
|
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; }
|
|
18
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var
|
|
18
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
19
19
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
20
20
|
import { View, TouchableOpacity, Text, SafeAreaView, Dimensions } from "react-native-web";
|
|
21
21
|
import InputBase from "../InputBase";
|
|
@@ -33,6 +33,8 @@ import { Button } from "../../button";
|
|
|
33
33
|
import { SkeletonItem } from "../../secondaryComponents";
|
|
34
34
|
import { isWebPlatform } from "../../../helpers/functions_utils";
|
|
35
35
|
import { CheckCircleFillIcon, CornerDownRightIcon, PaperclipIcon, XIcon } from "../../../assets/images/icons";
|
|
36
|
+
import { KEY_ENTER, KEY_SHIFT } from "./FileSearchInput.constants";
|
|
37
|
+
|
|
36
38
|
// Import DocumentPicker for mobile platforms only
|
|
37
39
|
var DocumentPicker = null;
|
|
38
40
|
if (!isWebPlatform()) {
|
|
@@ -454,6 +456,12 @@ var FileSearchInput = function FileSearchInput(_ref) {
|
|
|
454
456
|
};
|
|
455
457
|
}
|
|
456
458
|
}, [windowHeight, windowWidth, adjustDropdownPosition]);
|
|
459
|
+
var onKeyPressHandler = function onKeyPressHandler(e) {
|
|
460
|
+
if (KEY_SHIFT in e && e.nativeEvent.key === KEY_ENTER && !e.nativeEvent.shiftKey) {
|
|
461
|
+
e.preventDefault();
|
|
462
|
+
handleSendMessage();
|
|
463
|
+
}
|
|
464
|
+
};
|
|
457
465
|
return /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
458
466
|
style: styles.container
|
|
459
467
|
}, /*#__PURE__*/React.createElement(View, null, isWebPlatform() ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -468,7 +476,8 @@ var FileSearchInput = function FileSearchInput(_ref) {
|
|
|
468
476
|
onChangeText: onChangeText,
|
|
469
477
|
rightButtons: buttons,
|
|
470
478
|
onSubmitEditing: handleSendMessage,
|
|
471
|
-
placeholder: placeholder
|
|
479
|
+
placeholder: placeholder,
|
|
480
|
+
onKeyPress: onKeyPressHandler
|
|
472
481
|
})), /*#__PURE__*/React.createElement("input", {
|
|
473
482
|
type: "file",
|
|
474
483
|
ref: fileInputRef,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IInputBase } from '../InputBase.types';
|
|
2
|
-
export interface IPasswordInput extends Omit<IInputBase, 'keyboardType' | 'secureTextEntry'> {
|
|
2
|
+
export interface IPasswordInput extends Omit<IInputBase, 'keyboardType' | 'secureTextEntry' | 'multiline' | 'numberOfLines'> {
|
|
3
3
|
value?: string;
|
|
4
4
|
onChangeText?: (text: string) => void;
|
|
5
5
|
}
|
|
@@ -7,7 +7,7 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
7
7
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
9
|
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; }
|
|
10
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import InputBase from "../InputBase";
|
|
13
13
|
import { SearchIcon } from "../../../assets/images/icons";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IInputBase } from '../InputBase.types';
|
|
2
|
-
export interface ISearchInput extends Omit<IInputBase, 'keyboardType' | 'secureTextEntry'> {
|
|
2
|
+
export interface ISearchInput extends Omit<IInputBase, 'keyboardType' | 'secureTextEntry' | 'multiline' | 'numberOfLines'> {
|
|
3
3
|
value?: string;
|
|
4
4
|
onChangeText?: (text: string) => void;
|
|
5
5
|
onSubmit?: (text: string) => void;
|
|
@@ -7,7 +7,7 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
7
7
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
9
|
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; }
|
|
10
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import InputBase from "../InputBase";
|
|
13
13
|
import { CheckCircleFillIcon, XCircleFillIcon } from "../../../assets/images/icons";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["node", "children", "href"];
|
|
2
2
|
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); }
|
|
3
3
|
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; }
|
|
4
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var
|
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { INITIAL_100 } from "../../styles/colors";
|
|
7
7
|
import { Linking, Text } from "react-native-web";
|
|
@@ -7,7 +7,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7
7
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
8
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
9
|
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; }
|
|
10
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
11
11
|
import { useState } from "react";
|
|
12
12
|
import { Clipboard, StyleSheet, Text, View } from "react-native-web";
|
|
13
13
|
import React from 'react';
|
|
@@ -14,7 +14,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
15
|
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); }
|
|
16
16
|
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; }
|
|
17
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var
|
|
17
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
18
18
|
import React, { useState } from 'react';
|
|
19
19
|
import { Text, ScrollView } from "react-native-web";
|
|
20
20
|
import ReactMarkdown from 'react-markdown';
|