@draftbit/core 50.2.8-eb9d63.2 → 50.2.9-2a85dc.2
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/lib/commonjs/components/NumberInput.js +1 -1
- package/lib/commonjs/components/TextField.js +1 -1
- package/lib/commonjs/components/TextInput.js +1 -1
- package/lib/commonjs/components/Timer.js +1 -1
- package/lib/typescript/src/components/NumberInput.js +6 -2
- package/lib/typescript/src/components/NumberInput.js.map +1 -1
- package/lib/typescript/src/components/TextField.js +5 -1
- package/lib/typescript/src/components/TextField.js.map +1 -1
- package/lib/typescript/src/components/TextInput.js +7 -3
- package/lib/typescript/src/components/TextInput.js.map +1 -1
- package/lib/typescript/src/components/Timer.d.ts +1 -0
- package/lib/typescript/src/components/Timer.js +27 -21
- package/lib/typescript/src/components/Timer.js.map +1 -1
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/NumberInput.js +6 -2
- package/src/components/NumberInput.js.map +1 -1
- package/src/components/NumberInput.tsx +6 -2
- package/src/components/TextField.js +5 -1
- package/src/components/TextField.js.map +1 -1
- package/src/components/TextField.tsx +8 -0
- package/src/components/TextInput.js +7 -3
- package/src/components/TextInput.js.map +1 -1
- package/src/components/TextInput.tsx +7 -1
- package/src/components/Timer.js +27 -21
- package/src/components/Timer.js.map +1 -1
- package/src/components/Timer.tsx +33 -34
|
@@ -1 +1 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["onChangeText","onChangeTextDelayed","changeTextDelay","value","defaultValue"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/NumberInput.tsx";import React,{useEffect,useState}from"react";import{TextInput as NativeTextInput}from"react-native";import{isString,isNumber,isNaN}from"lodash";import{useDebounce,useOnUpdate}from"../hooks";import{jsx as _jsx}from"react/jsx-runtime";var NumberInput=React.forwardRef(function(_ref,ref){var onChangeText=_ref.onChangeText,onChangeTextDelayed=_ref.onChangeTextDelayed,_ref$changeTextDelay=_ref.changeTextDelay,changeTextDelay=_ref$changeTextDelay===void 0?500:_ref$changeTextDelay,value=_ref.value,defaultValue=_ref.defaultValue,props=_objectWithoutProperties(_ref,_excluded);var _useState=useState(""),_useState2=_slicedToArray(_useState,2),currentStringNumberValue=_useState2[0],setCurrentStringNumberValue=_useState2[1];var delayedValue=useDebounce(
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["onChangeText","onChangeTextDelayed","changeTextDelay","value","defaultValue"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/NumberInput.tsx";import React,{useEffect,useState}from"react";import{TextInput as NativeTextInput}from"react-native";import{isString,isNumber,isNaN}from"lodash";import{useDebounce,useOnUpdate}from"../hooks";import{jsx as _jsx}from"react/jsx-runtime";var NumberInput=React.forwardRef(function(_ref,ref){var onChangeText=_ref.onChangeText,onChangeTextDelayed=_ref.onChangeTextDelayed,_ref$changeTextDelay=_ref.changeTextDelay,changeTextDelay=_ref$changeTextDelay===void 0?500:_ref$changeTextDelay,value=_ref.value,defaultValue=_ref.defaultValue,props=_objectWithoutProperties(_ref,_excluded);var _useState=useState(""),_useState2=_slicedToArray(_useState,2),currentStringNumberValue=_useState2[0],setCurrentStringNumberValue=_useState2[1];var _React$useState=React.useState(value),_React$useState2=_slicedToArray(_React$useState,2),valueToDebounce=_React$useState2[0],setValueToDebounce=_React$useState2[1];var delayedValue=useDebounce(valueToDebounce,changeTextDelay);var formatValueToStringNumber=function formatValueToStringNumber(valueToFormat){if(valueToFormat!=null){if(isString(valueToFormat)&&valueToFormat!==""){if(/^0[1-9]$/.test(valueToFormat)){return valueToFormat.slice(1);}else if(/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)$/.test(valueToFormat)){return valueToFormat;}else{return currentStringNumberValue;}}else if(isNumber(valueToFormat)&&!isNaN(valueToFormat)){return valueToFormat.toString();}}return"";};var handleChangeText=function handleChangeText(newValue){var newStringNumberValue=formatValueToStringNumber(newValue);var number=parseFloat(newStringNumberValue);setCurrentStringNumberValue(newStringNumberValue);onChangeText==null?void 0:onChangeText(number);};useEffect(function(){var nextStringNumberValue=formatValueToStringNumber(value);if(currentStringNumberValue!==nextStringNumberValue){handleChangeText(nextStringNumberValue);}},[value]);useEffect(function(){var defaultStringNumberValue=formatValueToStringNumber(defaultValue);if(currentStringNumberValue!==defaultStringNumberValue){setCurrentStringNumberValue(defaultStringNumberValue);}},[]);useOnUpdate(function(){if(delayedValue!==undefined){var newStringNumberValue=formatValueToStringNumber(delayedValue);var number=parseFloat(newStringNumberValue);onChangeTextDelayed==null?void 0:onChangeTextDelayed(number);}},[delayedValue]);return _jsx(NativeTextInput,Object.assign({testID:"native-text-input",ref:ref,keyboardType:"numeric",value:currentStringNumberValue,onChangeText:function onChangeText(newValue){handleChangeText(newValue);setValueToDebounce(newValue);}},props));});export default NumberInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";var _jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/TextField.tsx";var _excluded=["theme","Icon","type","disabled","editable","label","error","leftIconName","leftIconMode","rightIconName","iconColor","iconSize","assistiveText","underlineColor","activeBorderColor","multiline","numberOfLines","style","render"],_excluded2=["lineHeight"],_excluded3=["backgroundColor","padding","paddingTop","paddingBottom","paddingLeft","paddingRight","borderRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor"];function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}import*as React from"react";import{View,Animated,StyleSheet,Text,I18nManager,Platform}from"react-native";import{withTheme}from"@draftbit/theme";import{applyStyles,extractStyles}from"../utilities";import TextInput from"./TextInput";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";var AnimatedText=Animated.createAnimatedComponent(Text);var FOCUS_ANIMATION_DURATION=150;var BLUR_ANIMATION_DURATION=180;var ICON_SIZE=24;var TextField=function(_React$Component){_inherits(TextField,_React$Component);var _super=_createSuper(TextField);function TextField(){var _this;_classCallCheck(this,TextField);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super.call.apply(_super,[this].concat(args));_this.state={labeled:new Animated.Value(_this.props.value||_this.props.error?0:1),focused:false,placeholder:_this.props.error?_this.props.placeholder:"",labelLayout:{measured:false,width:0}};_this._timer=setTimeout(function(){},0);_this._showPlaceholder=function(){clearTimeout(_this._timer);_this._timer=setTimeout(function(){return _this.setState({placeholder:_this.props.placeholder});},50);};_this._hidePlaceholder=function(){return _this.setState({placeholder:""});};_this._restoreLabel=function(){return Animated.timing(_this.state.labeled,{toValue:1,duration:FOCUS_ANIMATION_DURATION,useNativeDriver:Platform.OS!=="web"}).start();};_this._minmizeLabel=function(){return Animated.timing(_this.state.labeled,{toValue:0,duration:BLUR_ANIMATION_DURATION,useNativeDriver:Platform.OS!=="web"}).start();};_this._handleFocus=function(){if(_this.props.disabled){return;}_this.setState({focused:true});};_this._handleBlur=function(){if(_this.props.disabled){return;}_this.setState({focused:false});};_this._handleChangeText=function(value){if(_this.props.disabled){return;}if(typeof value==="string"){_this.setState({value:value});_this.props.onChangeText&&_this.props.onChangeText(value);}else{_this.setState({value:value.nativeEvent.text});_this.props.onChangeText&&_this.props.onChangeText(value.nativeEvent.text);}};_this._root=undefined;return _this;}_createClass(TextField,[{key:"componentDidMount",value:function componentDidMount(){if(this.props.defaultValue){this._handleChangeText(this.props.defaultValue);}if(this.props.placeholder){this._minmizeLabel();}}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){if(prevState.focused!==this.state.focused||prevState.value!==this.state.value){if(this.state.value||this.state.focused||this.props.error||this.props.placeholder){this._minmizeLabel();}else{this._restoreLabel();}}if(prevState.focused!==this.state.focused||prevProps.label!==this.props.label){if(this.state.focused||this.props.error||!this.props.label){this._showPlaceholder();}else{this._hidePlaceholder();}}}},{key:"componentWillUnmount",value:function componentWillUnmount(){clearTimeout(this._timer);}},{key:"toggleFocus",value:function toggleFocus(){this.setState(function(prevState){return{focused:!prevState.focused};});}},{key:"isFocused",value:function isFocused(){return this._root&&this._root.isFocused();}},{key:"clear",value:function clear(){return this._root&&this._root.clear();}},{key:"focus",value:function focus(){return this._root&&this._root.focus();}},{key:"blur",value:function blur(){return this._root&&this._root.blur();}},{key:"render",value:function render(){var _this2=this;var _this$props=this.props,theme=_this$props.theme,Icon=_this$props.Icon,_this$props$type=_this$props.type,type=_this$props$type===void 0?"underline":_this$props$type,_this$props$disabled=_this$props.disabled,disabled=_this$props$disabled===void 0?false:_this$props$disabled,_this$props$editable=_this$props.editable,editable=_this$props$editable===void 0?true:_this$props$editable,label=_this$props.label,_this$props$error=_this$props.error,error=_this$props$error===void 0?false:_this$props$error,leftIconName=_this$props.leftIconName,_this$props$leftIconM=_this$props.leftIconMode,leftIconMode=_this$props$leftIconM===void 0?"inset":_this$props$leftIconM,rightIconName=_this$props.rightIconName,iconColor=_this$props.iconColor,iconSize=_this$props.iconSize,assistiveText=_this$props.assistiveText,underlineColorProp=_this$props.underlineColor,_this$props$activeBor=_this$props.activeBorderColor,activeBorderColorProp=_this$props$activeBor===void 0?theme.colors.branding.primary:_this$props$activeBor,_this$props$multiline=_this$props.multiline,multiline=_this$props$multiline===void 0?false:_this$props$multiline,_this$props$numberOfL=_this$props.numberOfLines,numberOfLines=_this$props$numberOfL===void 0?4:_this$props$numberOfL,style=_this$props.style,_this$props$render=_this$props.render,render=_this$props$render===void 0?function(props){return _jsx(TextInput,Object.assign({},props));}:_this$props$render,rest=_objectWithoutProperties(_this$props,_excluded);var colors=theme.colors,typography=theme.typography;var MINIMIZED_LABEL_Y_OFFSET=-(typography.caption.lineHeight+4);var OUTLINE_MINIMIZED_LABEL_Y_OFFSET=-(16*0.5+4);var MAXIMIZED_LABEL_FONT_SIZE=typography.subtitle1.fontSize;var MINIMIZED_LABEL_FONT_SIZE=typography.caption.fontSize;var hasActiveOutline=this.state.focused||error;var inputTextColor,activeColor,underlineColor,borderColor,placeholderColor,containerStyle,backgroundColor,inputStyle;inputTextColor=colors.text.strong;if(disabled){activeColor=colors.text.light;placeholderColor=colors.text.light;borderColor="transparent";underlineColor="transparent";backgroundColor=colors.border.brand;}else{activeColor=error?colors.text.danger:activeBorderColorProp;placeholderColor=borderColor=colors.text.light;underlineColor=underlineColorProp||colors.text.light;backgroundColor=colors.background;}if(rest.placeholderTextColor){placeholderColor=rest.placeholderTextColor;}var _typography$subtitle=typography.subtitle1,lineHeight=_typography$subtitle.lineHeight,subtitle1=_objectWithoutProperties(_typography$subtitle,_excluded2);inputStyle=Object.assign({paddingVertical:0,color:inputTextColor,paddingLeft:leftIconName&&leftIconMode==="inset"?ICON_SIZE+12:0,paddingRight:rightIconName?ICON_SIZE+16+4:12},subtitle1);if(!multiline){inputStyle.height=lineHeight;}var assistiveTextLeftMargin;if(type==="underline"){containerStyle={borderTopLeftRadius:8,borderTopRightRadius:8,paddingBottom:12,marginTop:16};if(leftIconName&&leftIconMode==="outset"){assistiveTextLeftMargin=ICON_SIZE+8;}else{assistiveTextLeftMargin=0;}}else{containerStyle={borderRadius:8,borderColor:hasActiveOutline?activeColor:borderColor,borderWidth:1,paddingTop:label?16*1.5:16,paddingBottom:label?16*0.5:16,opacity:disabled?0.5:1,backgroundColor:backgroundColor};if(leftIconName&&leftIconMode==="inset"){assistiveTextLeftMargin=16+4;}else if(leftIconName&&leftIconMode==="outset"){assistiveTextLeftMargin=ICON_SIZE+8+12;}else{assistiveTextLeftMargin=12;}}if(leftIconName&&leftIconMode==="outset"){containerStyle.marginLeft=ICON_SIZE+8;}var leftIconColor;if(iconColor){leftIconColor=iconColor;}else if(error){leftIconColor=colors.text.danger;}else if(this.state.focused){leftIconColor=colors.branding.primary;}else{leftIconColor=colors.text.light;}var labelStyle=Object.assign({},typography.subtitle1,type==="solid"?{marginHorizontal:12}:{},{top:type==="solid"?16:0,left:leftIconName&&leftIconMode==="inset"?ICON_SIZE+12:0,transform:[{translateY:this.state.labeled.interpolate({inputRange:[0,1],outputRange:[type==="solid"?OUTLINE_MINIMIZED_LABEL_Y_OFFSET:MINIMIZED_LABEL_Y_OFFSET,0]})},{scale:this.state.labeled.interpolate({inputRange:[0,1],outputRange:[MINIMIZED_LABEL_FONT_SIZE/MAXIMIZED_LABEL_FONT_SIZE,1]})},{translateX:this.state.labeled.interpolate({inputRange:[0,1],outputRange:[-(1-MINIMIZED_LABEL_FONT_SIZE/MAXIMIZED_LABEL_FONT_SIZE)*(this.state.labelLayout.width/2),0]})}]});var _extractStyles=extractStyles(style),textStyles=_extractStyles.textStyles;var inputStyles=applyStyles([styles.input,inputStyle,type==="solid"?{marginHorizontal:16}:{marginHorizontal:6}],textStyles);var _ref=StyleSheet.flatten(style||{}),bgColor=_ref.backgroundColor,padding=_ref.padding,paddingTop=_ref.paddingTop,paddingBottom=_ref.paddingBottom,paddingLeft=_ref.paddingLeft,paddingRight=_ref.paddingRight,borderRadius=_ref.borderRadius,borderWidth=_ref.borderWidth,borderTopWidth=_ref.borderTopWidth,borderRightWidth=_ref.borderRightWidth,borderBottomWidth=_ref.borderBottomWidth,borderLeftWidth=_ref.borderLeftWidth,borderCol=_ref.borderColor,styleProp=_objectWithoutProperties(_ref,_excluded3);return _jsxs(View,{style:[styles.container,styleProp],children:[_jsxs(View,{style:applyStyles([containerStyle],{height:styleProp.height,backgroundColor:bgColor,padding:padding,paddingTop:paddingTop,paddingBottom:paddingBottom,paddingLeft:paddingLeft,paddingRight:paddingRight,borderRadius:borderRadius,borderWidth:borderWidth,borderTopWidth:borderTopWidth,borderRightWidth:borderRightWidth,borderBottomWidth:borderBottomWidth,borderLeftWidth:borderLeftWidth,borderColor:borderCol}),children:[type==="underline"?_jsx(Animated.View,{style:[styles.underline,{backgroundColor:bgColor||(error?colors.background.danger:this.state.focused?activeColor:underlineColor),transform:[{scaleY:this.state.focused?1:0.5}]}]}):null,label?_jsxs(View,{pointerEvents:"none",style:[StyleSheet.absoluteFill,{opacity:this.state.value||this.state.focused?this.state.labelLayout.measured?1:0:1}],children:[_jsx(AnimatedText,{onLayout:function onLayout(e){return _this2.setState({labelLayout:{width:e.nativeEvent.layout.width,measured:true}});},style:[styles.placeholder,labelStyle,{color:placeholderColor,opacity:this.state.labeled.interpolate({inputRange:[0,1],outputRange:[hasActiveOutline?1:0,0]})}],numberOfLines:1,children:label}),_jsx(AnimatedText,{style:[styles.placeholder,labelStyle,{color:placeholderColor,opacity:hasActiveOutline?this.state.labeled:1}],numberOfLines:1,children:label})]}):null,render(Object.assign({ref:function ref(c){_this2._root=c;},onChange:this._handleChangeText,placeholder:label?this.state.placeholder:this.props.placeholder,placeholderTextColor:placeholderColor,editable:!disabled&&editable,selectionColor:activeColor,multiline:multiline,numberOfLines:numberOfLines,onFocus:this._handleFocus,onBlur:this._handleBlur,underlineColorAndroid:"transparent",style:inputStyles},rest,{value:this.state.value}))]}),leftIconName?_jsx(View,{style:[styles.iconWrapper,{left:leftIconMode==="inset"&&type==="solid"?16:0}],children:_jsx(Icon,{size:iconSize||ICON_SIZE,color:leftIconColor||colors.text.light,name:leftIconName})}):null,rightIconName?_jsx(View,{style:[styles.iconWrapper,{right:16}],children:_jsx(Icon,{name:rightIconName,size:iconSize||ICON_SIZE,color:iconColor||colors.text.light})}):null,assistiveText?_jsx(Text,{style:[{color:error?colors.text.danger:colors.text.light,marginTop:8,marginLeft:assistiveTextLeftMargin}],children:assistiveText}):null]});}}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(nextProps,prevState){return{value:typeof nextProps.value!=="undefined"?nextProps.value:prevState.value};}}]);return TextField;}(React.Component);export default withTheme(TextField);var styles=StyleSheet.create({container:{alignSelf:"stretch"},placeholder:{position:"absolute",left:0},underline:{position:"absolute",left:0,right:0,bottom:0,height:2},input:{flexGrow:1,justifyContent:"center",textAlignVertical:"center",margin:0,textAlign:I18nManager.isRTL?"right":"left"},iconWrapper:{height:"100%",justifyContent:"center",alignItems:"center",position:"absolute"}});
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";var _jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/TextField.tsx";var _excluded=["theme","Icon","type","disabled","editable","label","error","leftIconName","leftIconMode","rightIconName","iconColor","iconSize","assistiveText","underlineColor","activeBorderColor","multiline","numberOfLines","style","render"],_excluded2=["lineHeight"],_excluded3=["backgroundColor","padding","paddingTop","paddingBottom","paddingLeft","paddingRight","borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor"];function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}import*as React from"react";import{View,Animated,StyleSheet,Text,I18nManager,Platform}from"react-native";import{withTheme}from"@draftbit/theme";import{applyStyles,extractStyles}from"../utilities";import TextInput from"./TextInput";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";var AnimatedText=Animated.createAnimatedComponent(Text);var FOCUS_ANIMATION_DURATION=150;var BLUR_ANIMATION_DURATION=180;var ICON_SIZE=24;var TextField=function(_React$Component){_inherits(TextField,_React$Component);var _super=_createSuper(TextField);function TextField(){var _this;_classCallCheck(this,TextField);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super.call.apply(_super,[this].concat(args));_this.state={labeled:new Animated.Value(_this.props.value||_this.props.error?0:1),focused:false,placeholder:_this.props.error?_this.props.placeholder:"",labelLayout:{measured:false,width:0}};_this._timer=setTimeout(function(){},0);_this._showPlaceholder=function(){clearTimeout(_this._timer);_this._timer=setTimeout(function(){return _this.setState({placeholder:_this.props.placeholder});},50);};_this._hidePlaceholder=function(){return _this.setState({placeholder:""});};_this._restoreLabel=function(){return Animated.timing(_this.state.labeled,{toValue:1,duration:FOCUS_ANIMATION_DURATION,useNativeDriver:Platform.OS!=="web"}).start();};_this._minmizeLabel=function(){return Animated.timing(_this.state.labeled,{toValue:0,duration:BLUR_ANIMATION_DURATION,useNativeDriver:Platform.OS!=="web"}).start();};_this._handleFocus=function(){if(_this.props.disabled){return;}_this.setState({focused:true});};_this._handleBlur=function(){if(_this.props.disabled){return;}_this.setState({focused:false});};_this._handleChangeText=function(value){if(_this.props.disabled){return;}if(typeof value==="string"){_this.setState({value:value});_this.props.onChangeText&&_this.props.onChangeText(value);}else{_this.setState({value:value.nativeEvent.text});_this.props.onChangeText&&_this.props.onChangeText(value.nativeEvent.text);}};_this._root=undefined;return _this;}_createClass(TextField,[{key:"componentDidMount",value:function componentDidMount(){if(this.props.defaultValue){this._handleChangeText(this.props.defaultValue);}if(this.props.placeholder){this._minmizeLabel();}}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){if(prevState.focused!==this.state.focused||prevState.value!==this.state.value){if(this.state.value||this.state.focused||this.props.error||this.props.placeholder){this._minmizeLabel();}else{this._restoreLabel();}}if(prevState.focused!==this.state.focused||prevProps.label!==this.props.label){if(this.state.focused||this.props.error||!this.props.label){this._showPlaceholder();}else{this._hidePlaceholder();}}}},{key:"componentWillUnmount",value:function componentWillUnmount(){clearTimeout(this._timer);}},{key:"toggleFocus",value:function toggleFocus(){this.setState(function(prevState){return{focused:!prevState.focused};});}},{key:"isFocused",value:function isFocused(){return this._root&&this._root.isFocused();}},{key:"clear",value:function clear(){return this._root&&this._root.clear();}},{key:"focus",value:function focus(){return this._root&&this._root.focus();}},{key:"blur",value:function blur(){return this._root&&this._root.blur();}},{key:"render",value:function render(){var _this2=this;var _this$props=this.props,theme=_this$props.theme,Icon=_this$props.Icon,_this$props$type=_this$props.type,type=_this$props$type===void 0?"underline":_this$props$type,_this$props$disabled=_this$props.disabled,disabled=_this$props$disabled===void 0?false:_this$props$disabled,_this$props$editable=_this$props.editable,editable=_this$props$editable===void 0?true:_this$props$editable,label=_this$props.label,_this$props$error=_this$props.error,error=_this$props$error===void 0?false:_this$props$error,leftIconName=_this$props.leftIconName,_this$props$leftIconM=_this$props.leftIconMode,leftIconMode=_this$props$leftIconM===void 0?"inset":_this$props$leftIconM,rightIconName=_this$props.rightIconName,iconColor=_this$props.iconColor,iconSize=_this$props.iconSize,assistiveText=_this$props.assistiveText,underlineColorProp=_this$props.underlineColor,_this$props$activeBor=_this$props.activeBorderColor,activeBorderColorProp=_this$props$activeBor===void 0?theme.colors.branding.primary:_this$props$activeBor,_this$props$multiline=_this$props.multiline,multiline=_this$props$multiline===void 0?false:_this$props$multiline,_this$props$numberOfL=_this$props.numberOfLines,numberOfLines=_this$props$numberOfL===void 0?4:_this$props$numberOfL,style=_this$props.style,_this$props$render=_this$props.render,render=_this$props$render===void 0?function(props){return _jsx(TextInput,Object.assign({},props));}:_this$props$render,rest=_objectWithoutProperties(_this$props,_excluded);var colors=theme.colors,typography=theme.typography;var MINIMIZED_LABEL_Y_OFFSET=-(typography.caption.lineHeight+4);var OUTLINE_MINIMIZED_LABEL_Y_OFFSET=-(16*0.5+4);var MAXIMIZED_LABEL_FONT_SIZE=typography.subtitle1.fontSize;var MINIMIZED_LABEL_FONT_SIZE=typography.caption.fontSize;var hasActiveOutline=this.state.focused||error;var inputTextColor,activeColor,underlineColor,borderColor,placeholderColor,containerStyle,backgroundColor,inputStyle;inputTextColor=colors.text.strong;if(disabled){activeColor=colors.text.light;placeholderColor=colors.text.light;borderColor="transparent";underlineColor="transparent";backgroundColor=colors.border.brand;}else{activeColor=error?colors.text.danger:activeBorderColorProp;placeholderColor=borderColor=colors.text.light;underlineColor=underlineColorProp||colors.text.light;backgroundColor=colors.background;}if(rest.placeholderTextColor){placeholderColor=rest.placeholderTextColor;}var _typography$subtitle=typography.subtitle1,lineHeight=_typography$subtitle.lineHeight,subtitle1=_objectWithoutProperties(_typography$subtitle,_excluded2);inputStyle=Object.assign({paddingVertical:0,color:inputTextColor,paddingLeft:leftIconName&&leftIconMode==="inset"?ICON_SIZE+12:0,paddingRight:rightIconName?ICON_SIZE+16+4:12},subtitle1);if(!multiline){inputStyle.height=lineHeight;}var assistiveTextLeftMargin;if(type==="underline"){containerStyle={borderTopLeftRadius:8,borderTopRightRadius:8,paddingBottom:12,marginTop:16};if(leftIconName&&leftIconMode==="outset"){assistiveTextLeftMargin=ICON_SIZE+8;}else{assistiveTextLeftMargin=0;}}else{containerStyle={borderRadius:8,borderColor:hasActiveOutline?activeColor:borderColor,borderWidth:1,paddingTop:label?16*1.5:16,paddingBottom:label?16*0.5:16,opacity:disabled?0.5:1,backgroundColor:backgroundColor};if(leftIconName&&leftIconMode==="inset"){assistiveTextLeftMargin=16+4;}else if(leftIconName&&leftIconMode==="outset"){assistiveTextLeftMargin=ICON_SIZE+8+12;}else{assistiveTextLeftMargin=12;}}if(leftIconName&&leftIconMode==="outset"){containerStyle.marginLeft=ICON_SIZE+8;}var leftIconColor;if(iconColor){leftIconColor=iconColor;}else if(error){leftIconColor=colors.text.danger;}else if(this.state.focused){leftIconColor=colors.branding.primary;}else{leftIconColor=colors.text.light;}var labelStyle=Object.assign({},typography.subtitle1,type==="solid"?{marginHorizontal:12}:{},{top:type==="solid"?16:0,left:leftIconName&&leftIconMode==="inset"?ICON_SIZE+12:0,transform:[{translateY:this.state.labeled.interpolate({inputRange:[0,1],outputRange:[type==="solid"?OUTLINE_MINIMIZED_LABEL_Y_OFFSET:MINIMIZED_LABEL_Y_OFFSET,0]})},{scale:this.state.labeled.interpolate({inputRange:[0,1],outputRange:[MINIMIZED_LABEL_FONT_SIZE/MAXIMIZED_LABEL_FONT_SIZE,1]})},{translateX:this.state.labeled.interpolate({inputRange:[0,1],outputRange:[-(1-MINIMIZED_LABEL_FONT_SIZE/MAXIMIZED_LABEL_FONT_SIZE)*(this.state.labelLayout.width/2),0]})}]});var _extractStyles=extractStyles(style),textStyles=_extractStyles.textStyles;var inputStyles=applyStyles([styles.input,inputStyle,type==="solid"?{marginHorizontal:16}:{marginHorizontal:6}],textStyles);var _ref=StyleSheet.flatten(style||{}),bgColor=_ref.backgroundColor,padding=_ref.padding,paddingTop=_ref.paddingTop,paddingBottom=_ref.paddingBottom,paddingLeft=_ref.paddingLeft,paddingRight=_ref.paddingRight,borderRadius=_ref.borderRadius,borderTopLeftRadius=_ref.borderTopLeftRadius,borderTopRightRadius=_ref.borderTopRightRadius,borderBottomLeftRadius=_ref.borderBottomLeftRadius,borderBottomRightRadius=_ref.borderBottomRightRadius,borderWidth=_ref.borderWidth,borderTopWidth=_ref.borderTopWidth,borderRightWidth=_ref.borderRightWidth,borderBottomWidth=_ref.borderBottomWidth,borderLeftWidth=_ref.borderLeftWidth,borderCol=_ref.borderColor,styleProp=_objectWithoutProperties(_ref,_excluded3);return _jsxs(View,{style:[styles.container,styleProp],children:[_jsxs(View,{style:applyStyles([containerStyle],{height:styleProp.height,backgroundColor:bgColor,padding:padding,paddingTop:paddingTop,paddingBottom:paddingBottom,paddingLeft:paddingLeft,paddingRight:paddingRight,borderRadius:borderRadius,borderTopLeftRadius:borderTopLeftRadius,borderTopRightRadius:borderTopRightRadius,borderBottomLeftRadius:borderBottomLeftRadius,borderBottomRightRadius:borderBottomRightRadius,borderWidth:borderWidth,borderTopWidth:borderTopWidth,borderRightWidth:borderRightWidth,borderBottomWidth:borderBottomWidth,borderLeftWidth:borderLeftWidth,borderColor:borderCol}),children:[type==="underline"?_jsx(Animated.View,{style:[styles.underline,{backgroundColor:bgColor||(error?colors.background.danger:this.state.focused?activeColor:underlineColor),transform:[{scaleY:this.state.focused?1:0.5}]}]}):null,label?_jsxs(View,{pointerEvents:"none",style:[StyleSheet.absoluteFill,{opacity:this.state.value||this.state.focused?this.state.labelLayout.measured?1:0:1}],children:[_jsx(AnimatedText,{onLayout:function onLayout(e){return _this2.setState({labelLayout:{width:e.nativeEvent.layout.width,measured:true}});},style:[styles.placeholder,labelStyle,{color:placeholderColor,opacity:this.state.labeled.interpolate({inputRange:[0,1],outputRange:[hasActiveOutline?1:0,0]})}],numberOfLines:1,children:label}),_jsx(AnimatedText,{style:[styles.placeholder,labelStyle,{color:placeholderColor,opacity:hasActiveOutline?this.state.labeled:1}],numberOfLines:1,children:label})]}):null,render(Object.assign({ref:function ref(c){_this2._root=c;},onChange:this._handleChangeText,placeholder:label?this.state.placeholder:this.props.placeholder,placeholderTextColor:placeholderColor,editable:!disabled&&editable,selectionColor:activeColor,multiline:multiline,numberOfLines:numberOfLines,onFocus:this._handleFocus,onBlur:this._handleBlur,underlineColorAndroid:"transparent",style:inputStyles},rest,{value:this.state.value}))]}),leftIconName?_jsx(View,{style:[styles.iconWrapper,{left:leftIconMode==="inset"&&type==="solid"?16:0}],children:_jsx(Icon,{size:iconSize||ICON_SIZE,color:leftIconColor||colors.text.light,name:leftIconName})}):null,rightIconName?_jsx(View,{style:[styles.iconWrapper,{right:16}],children:_jsx(Icon,{name:rightIconName,size:iconSize||ICON_SIZE,color:iconColor||colors.text.light})}):null,assistiveText?_jsx(Text,{style:[{color:error?colors.text.danger:colors.text.light,marginTop:8,marginLeft:assistiveTextLeftMargin}],children:assistiveText}):null]});}}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(nextProps,prevState){return{value:typeof nextProps.value!=="undefined"?nextProps.value:prevState.value};}}]);return TextField;}(React.Component);export default withTheme(TextField);var styles=StyleSheet.create({container:{alignSelf:"stretch"},placeholder:{position:"absolute",left:0},underline:{position:"absolute",left:0,right:0,bottom:0,height:2},input:{flexGrow:1,justifyContent:"center",textAlignVertical:"center",margin:0,textAlign:I18nManager.isRTL?"right":"left"},iconWrapper:{height:"100%",justifyContent:"center",alignItems:"center",position:"absolute"}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["onChangeTextDelayed","changeTextDelay","webShowOutline","style","disabled","editable","value"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/TextInput.tsx";import React from"react";import{TextInput as NativeTextInput,Platform}from"react-native";import{useDebounce,useOnUpdate}from"../hooks";import{useTheme}from"@draftbit/theme";import{jsx as _jsx}from"react/jsx-runtime";var TextInput=React.forwardRef(function(_ref,ref){var onChangeTextDelayed=_ref.onChangeTextDelayed,_ref$changeTextDelay=_ref.changeTextDelay,changeTextDelay=_ref$changeTextDelay===void 0?500:_ref$changeTextDelay,_ref$webShowOutline=_ref.webShowOutline,webShowOutline=_ref$webShowOutline===void 0?true:_ref$webShowOutline,style=_ref.style,_ref$disabled=_ref.disabled,disabled=_ref$disabled===void 0?false:_ref$disabled,_ref$editable=_ref.editable,editable=_ref$editable===void 0?true:_ref$editable,value=_ref.value,rest=_objectWithoutProperties(_ref,_excluded);var theme=useTheme();var delayedValue=useDebounce(
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["onChangeTextDelayed","changeTextDelay","webShowOutline","style","disabled","editable","value","onChangeText"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/TextInput.tsx";import React from"react";import{TextInput as NativeTextInput,Platform}from"react-native";import{useDebounce,useOnUpdate}from"../hooks";import{useTheme}from"@draftbit/theme";import{jsx as _jsx}from"react/jsx-runtime";var TextInput=React.forwardRef(function(_ref,ref){var onChangeTextDelayed=_ref.onChangeTextDelayed,_ref$changeTextDelay=_ref.changeTextDelay,changeTextDelay=_ref$changeTextDelay===void 0?500:_ref$changeTextDelay,_ref$webShowOutline=_ref.webShowOutline,webShowOutline=_ref$webShowOutline===void 0?true:_ref$webShowOutline,style=_ref.style,_ref$disabled=_ref.disabled,disabled=_ref$disabled===void 0?false:_ref$disabled,_ref$editable=_ref.editable,editable=_ref$editable===void 0?true:_ref$editable,value=_ref.value,_onChangeText=_ref.onChangeText,rest=_objectWithoutProperties(_ref,_excluded);var theme=useTheme();var _React$useState=React.useState(value),_React$useState2=_slicedToArray(_React$useState,2),valueToDebounce=_React$useState2[0],setValueToDebounce=_React$useState2[1];var delayedValue=useDebounce(valueToDebounce,changeTextDelay);useOnUpdate(function(){if(delayedValue!==undefined){onChangeTextDelayed==null?void 0:onChangeTextDelayed(delayedValue);}},[delayedValue]);return _jsx(NativeTextInput,Object.assign({testID:"native-text-input",ref:ref,value:value,editable:!disabled&&editable,style:[Platform.OS==="web"&&!webShowOutline?{outlineWidth:0}:{},{color:theme.colors.text.strong},style],onChangeText:function onChangeText(newValue){_onChangeText==null?void 0:_onChangeText(newValue);setValueToDebounce(newValue);}},rest));});export default TextInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Timer.tsx";import React,{useState,useEffect,useRef,useImperativeHandle,forwardRef}from"react";import{Text,StyleSheet}from"react-native";import{jsx as _jsx}from"react/jsx-runtime";var Timer=forwardRef(function(_ref,ref){var style=_ref.style,initialTime=_ref.initialTime,_ref$updateInterval=_ref.updateInterval,updateInterval=_ref$updateInterval===void 0?1000:_ref$updateInterval,_ref$format=_ref.format,format=_ref$format===void 0?"mm:ss":_ref$format,onTimerChange=_ref.onTimerChange,onTimerEnd=_ref.onTimerEnd,_ref$countDirection=_ref.countDirection,countDirection=_ref$countDirection===void 0?"up":_ref$countDirection;var defaultInitialTime=countDirection==="up"?0:100000;var _useState=useState(initialTime!=null?initialTime:defaultInitialTime),_useState2=_slicedToArray(_useState,2),time=_useState2[0],setTime=_useState2[1];var timerRef=useRef(null);useEffect(function(){onTimerChange==null?void 0:onTimerChange(time);},[time
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Timer.tsx";import React,{useState,useEffect,useRef,useImperativeHandle,forwardRef}from"react";import{Text,StyleSheet}from"react-native";import{jsx as _jsx}from"react/jsx-runtime";var Timer=forwardRef(function(_ref,ref){var style=_ref.style,initialTime=_ref.initialTime,_ref$updateInterval=_ref.updateInterval,updateInterval=_ref$updateInterval===void 0?1000:_ref$updateInterval,_ref$format=_ref.format,format=_ref$format===void 0?"mm:ss":_ref$format,onTimerChange=_ref.onTimerChange,onTimerEnd=_ref.onTimerEnd,_ref$countDirection=_ref.countDirection,countDirection=_ref$countDirection===void 0?"up":_ref$countDirection,timerEndTime=_ref.timerEndTime;var defaultInitialTime=countDirection==="up"?0:100000;var _useState=useState(initialTime!=null?initialTime:defaultInitialTime),_useState2=_slicedToArray(_useState,2),time=_useState2[0],setTime=_useState2[1];var timerRef=useRef(null);useEffect(function(){onTimerChange==null?void 0:onTimerChange(time);},[time]);useImperativeHandle(ref,function(){return{start:startTimer,stop:stopTimer,reset:resetTimer};});var startTimer=function startTimer(){if(timerRef.current)return;timerRef.current=setInterval(function(){setTime(function(prevTime){var newTime=countDirection==="up"?prevTime+updateInterval:prevTime-updateInterval;if(newTime<=0&&countDirection==="down"){clearTimer();onTimerEnd==null?void 0:onTimerEnd();return 0;}if(countDirection==="up"&&timerEndTime!==undefined&&newTime>=timerEndTime){clearTimer();onTimerEnd==null?void 0:onTimerEnd();return timerEndTime;}return newTime;});},updateInterval);};var stopTimer=function stopTimer(){return clearTimer();};var resetTimer=function resetTimer(){var newTime=arguments.length>0&&arguments[0]!==undefined?arguments[0]:initialTime!=null?initialTime:defaultInitialTime;clearTimer();setTime(newTime);};var clearTimer=function clearTimer(){if(timerRef.current){clearInterval(timerRef.current);timerRef.current=null;}};useEffect(function(){return function(){return clearTimer();};},[]);var formatTime=function formatTime(milliseconds){var totalSeconds=Math.floor(milliseconds/1000);var hours=Math.floor(totalSeconds/3600);var minutes=Math.floor((totalSeconds-hours*3600)/60);var seconds=totalSeconds-hours*3600-minutes*60;var ms=milliseconds%1000;var formattedHours=String(hours).padStart(2,"0");var formattedMinutes=String(minutes).padStart(2,"0");var formattedSeconds=String(seconds).padStart(2,"0");var formattedMs=String(ms).padStart(3,"0");return format.replace("hh",formattedHours).replace("mm",formattedMinutes).replace("ss",formattedSeconds).replace("ms",formattedMs);};return _jsx(Text,{style:[styles.defaultTimerStyle,style],children:formatTime(time)});});var styles=StyleSheet.create({defaultTimerStyle:{fontSize:24,textAlign:"center"}});export default Timer;
|
|
@@ -4,7 +4,8 @@ import { isString, isNumber, isNaN } from "lodash";
|
|
|
4
4
|
import { useDebounce, useOnUpdate } from "../hooks";
|
|
5
5
|
const NumberInput = React.forwardRef(({ onChangeText, onChangeTextDelayed, changeTextDelay = 500, value, defaultValue, ...props }, ref) => {
|
|
6
6
|
const [currentStringNumberValue, setCurrentStringNumberValue] = useState("");
|
|
7
|
-
const
|
|
7
|
+
const [valueToDebounce, setValueToDebounce] = React.useState(value);
|
|
8
|
+
const delayedValue = useDebounce(valueToDebounce, changeTextDelay);
|
|
8
9
|
const formatValueToStringNumber = (valueToFormat) => {
|
|
9
10
|
if (valueToFormat != null) {
|
|
10
11
|
if (isString(valueToFormat) && valueToFormat !== "") {
|
|
@@ -53,7 +54,10 @@ const NumberInput = React.forwardRef(({ onChangeText, onChangeTextDelayed, chang
|
|
|
53
54
|
onChangeTextDelayed === null || onChangeTextDelayed === void 0 ? void 0 : onChangeTextDelayed(number);
|
|
54
55
|
}
|
|
55
56
|
}, [delayedValue]);
|
|
56
|
-
return (React.createElement(NativeTextInput, { testID: "native-text-input", ref: ref, keyboardType: "numeric", value: currentStringNumberValue, onChangeText:
|
|
57
|
+
return (React.createElement(NativeTextInput, { testID: "native-text-input", ref: ref, keyboardType: "numeric", value: currentStringNumberValue, onChangeText: (newValue) => {
|
|
58
|
+
handleChangeText(newValue);
|
|
59
|
+
setValueToDebounce(newValue);
|
|
60
|
+
}, ...props }));
|
|
57
61
|
});
|
|
58
62
|
export default NumberInput;
|
|
59
63
|
//# sourceMappingURL=NumberInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.js","sourceRoot":"","sources":["../../../../src/components/NumberInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,E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AE;YACzD,2BAA2B,CAAC,wBAAwB,CAAC,CAAC;SACvD;QACD,uDAAuD;IACzD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,WAAW,CAAC,GAAG,EAAE;QACf,IAAI,YAAY,KAAK,SAAS,EAAE;YAC9B,MAAM,oBAAoB,GAAG,yBAAyB,CAAC,YAAY,CAAC,CAAC;YACrE,MAAM,MAAM,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;YAChD,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAG,MAAM,CAAC,CAAC;SAC/B;IACH,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,oBAAC,eAAe,IACd,MAAM,EAAC,mBAAmB,EAC1B,GAAG,EAAE,GAAG,EACR,YAAY,EAAC,SAAS,EACtB,KAAK,EAAE,wBAAwB,EAC/B,YAAY,EAAE,CAAC,QAAQ,EAAE,EAAE;YACzB,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAC3B,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -266,7 +266,7 @@ class TextField extends React.Component {
|
|
|
266
266
|
inputStyle,
|
|
267
267
|
type === "solid" ? { marginHorizontal: 16 } : { marginHorizontal: 6 },
|
|
268
268
|
], textStyles);
|
|
269
|
-
const { backgroundColor: bgColor, padding, paddingTop, paddingBottom, paddingLeft, paddingRight, borderRadius, borderWidth, borderTopWidth, borderRightWidth, borderBottomWidth, borderLeftWidth, borderColor: borderCol, ...styleProp } = StyleSheet.flatten(style || {});
|
|
269
|
+
const { backgroundColor: bgColor, padding, paddingTop, paddingBottom, paddingLeft, paddingRight, borderRadius, borderTopLeftRadius, borderTopRightRadius, borderBottomLeftRadius, borderBottomRightRadius, borderWidth, borderTopWidth, borderRightWidth, borderBottomWidth, borderLeftWidth, borderColor: borderCol, ...styleProp } = StyleSheet.flatten(style || {});
|
|
270
270
|
return (React.createElement(View, { style: [styles.container, styleProp] },
|
|
271
271
|
React.createElement(View, { style: applyStyles([containerStyle], {
|
|
272
272
|
height: styleProp.height,
|
|
@@ -277,6 +277,10 @@ class TextField extends React.Component {
|
|
|
277
277
|
paddingLeft,
|
|
278
278
|
paddingRight,
|
|
279
279
|
borderRadius,
|
|
280
|
+
borderTopLeftRadius,
|
|
281
|
+
borderTopRightRadius,
|
|
282
|
+
borderBottomLeftRadius,
|
|
283
|
+
borderBottomRightRadius,
|
|
280
284
|
borderWidth,
|
|
281
285
|
borderTopWidth,
|
|
282
286
|
borderRightWidth,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../../../src/components/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,IAAI,EACJ,QAAQ,EAER,UAAU,EACV,IAAI,EACJ,WAAW,EAOX,QAAQ,GACT,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,SAA6B,MAAM,aAAa,CAAC;AAExD,MAAM,YAAY,GAAG,QAAQ,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAE5D,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AACpC,MAAM,SAAS,GAAG,EAAE,CAAC;AAwCrB,MAAM,SAAU,SAAQ,KAAK,CAAC,SAAuB;IAArD;;QAUE,UAAK,GAAU;YACb,OAAO,EAAE,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CA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AK,EAAE,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,GACrC,CACG,CACR,CAAC,CAAC,CAAC,IAAI;YAEP,aAAa,CAAC,CAAC,CAAC,CACf,oBAAC,IAAI,IACH,KAAK,EAAE;oBACL;wBACE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK;wBACrD,SAAS,EAAE,CAAC;wBACZ,UAAU,EAAE,uBAAuB;qBACpC;iBACF,IAEA,aAAa,CACT,CACR,CAAC,CAAC,CAAC,IAAI,CACH,CACR,CAAC;IACJ,CAAC;CACF;AAED,eAAe,SAAS,CAAC,SAAS,CAAC,CAAC;AAEpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,SAAS,EAAE,SAAS;KACrB;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,CAAC;KACR;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,CAAC;KACV;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,CAAC;QACX,cAAc,EAAE,QAAQ;QACxB,iBAAiB,EAAE,QAAQ;QAC3B,MAAM,EAAE,CAAC;QACT,SAAS,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;KAChD;IACD,WAAW,EAAE;QACX,MAAM,EAAE,MAAM;QACd,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,QAAQ,EAAE,UAAU;KACrB;CACF,CAAC,CAAC"}
|
|
@@ -2,9 +2,10 @@ import React from "react";
|
|
|
2
2
|
import { TextInput as NativeTextInput, Platform, } from "react-native";
|
|
3
3
|
import { useDebounce, useOnUpdate } from "../hooks";
|
|
4
4
|
import { useTheme } from "@draftbit/theme";
|
|
5
|
-
const TextInput = React.forwardRef(({ onChangeTextDelayed, changeTextDelay = 500, webShowOutline = true, style, disabled = false, editable = true, value, ...rest }, ref) => {
|
|
5
|
+
const TextInput = React.forwardRef(({ onChangeTextDelayed, changeTextDelay = 500, webShowOutline = true, style, disabled = false, editable = true, value, onChangeText, ...rest }, ref) => {
|
|
6
6
|
const theme = useTheme();
|
|
7
|
-
const
|
|
7
|
+
const [valueToDebounce, setValueToDebounce] = React.useState(value);
|
|
8
|
+
const delayedValue = useDebounce(valueToDebounce, changeTextDelay);
|
|
8
9
|
useOnUpdate(() => {
|
|
9
10
|
if (delayedValue !== undefined) {
|
|
10
11
|
onChangeTextDelayed === null || onChangeTextDelayed === void 0 ? void 0 : onChangeTextDelayed(delayedValue);
|
|
@@ -15,7 +16,10 @@ const TextInput = React.forwardRef(({ onChangeTextDelayed, changeTextDelay = 500
|
|
|
15
16
|
Platform.OS === "web" && !webShowOutline ? { outlineWidth: 0 } : {},
|
|
16
17
|
{ color: theme.colors.text.strong },
|
|
17
18
|
style,
|
|
18
|
-
],
|
|
19
|
+
], onChangeText: (newValue) => {
|
|
20
|
+
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(newValue);
|
|
21
|
+
setValueToDebounce(newValue);
|
|
22
|
+
}, ...rest }));
|
|
19
23
|
});
|
|
20
24
|
export default TextInput;
|
|
21
25
|
//# sourceMappingURL=TextInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../../src/components/TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,SAAS,IAAI,eAAe,EAE5B,QAAQ,GACT,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAA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AAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,oBAAC,eAAe,IACd,MAAM,EAAC,mBAAmB,EAC1B,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,QAAQ,IAAI,QAAQ,EAC/B,KAAK,EAAE;YACL,iGAAiG;YACjG,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;YACnE,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE;YACnC,KAAK;SACN,EACD,YAAY,EAAE,CAAC,QAAQ,EAAE,EAAE;YACzB,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,QAAQ,CAAC,CAAC;YACzB,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC,KACG,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef, useImperativeHandle, forwardRef, } from "react";
|
|
2
2
|
import { Text, StyleSheet } from "react-native";
|
|
3
|
-
const Timer = forwardRef(({ style, initialTime, updateInterval = 1000, format = "mm:ss", onTimerChange, onTimerEnd, countDirection = "up", }, ref) => {
|
|
3
|
+
const Timer = forwardRef(({ style, initialTime, updateInterval = 1000, format = "mm:ss", onTimerChange, onTimerEnd, countDirection = "up", timerEndTime, }, ref) => {
|
|
4
4
|
const defaultInitialTime = countDirection === "up" ? 0 : 100000;
|
|
5
5
|
const [time, setTime] = useState(initialTime !== null && initialTime !== void 0 ? initialTime : defaultInitialTime);
|
|
6
6
|
const timerRef = useRef(null);
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
onTimerChange === null || onTimerChange === void 0 ? void 0 : onTimerChange(time);
|
|
9
|
-
|
|
9
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10
|
+
}, [time]);
|
|
10
11
|
useImperativeHandle(ref, () => ({
|
|
11
12
|
start: startTimer,
|
|
12
13
|
stop: stopTimer,
|
|
@@ -20,11 +21,20 @@ const Timer = forwardRef(({ style, initialTime, updateInterval = 1000, format =
|
|
|
20
21
|
const newTime = countDirection === "up"
|
|
21
22
|
? prevTime + updateInterval
|
|
22
23
|
: prevTime - updateInterval;
|
|
24
|
+
// Count down
|
|
23
25
|
if (newTime <= 0 && countDirection === "down") {
|
|
24
26
|
clearTimer();
|
|
25
27
|
onTimerEnd === null || onTimerEnd === void 0 ? void 0 : onTimerEnd();
|
|
26
28
|
return 0;
|
|
27
29
|
}
|
|
30
|
+
// Count up
|
|
31
|
+
if (countDirection === "up" &&
|
|
32
|
+
timerEndTime !== undefined &&
|
|
33
|
+
newTime >= timerEndTime) {
|
|
34
|
+
clearTimer();
|
|
35
|
+
onTimerEnd === null || onTimerEnd === void 0 ? void 0 : onTimerEnd();
|
|
36
|
+
return timerEndTime;
|
|
37
|
+
}
|
|
28
38
|
return newTime;
|
|
29
39
|
});
|
|
30
40
|
}, updateInterval);
|
|
@@ -40,28 +50,24 @@ const Timer = forwardRef(({ style, initialTime, updateInterval = 1000, format =
|
|
|
40
50
|
timerRef.current = null;
|
|
41
51
|
}
|
|
42
52
|
};
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
return () => clearTimer();
|
|
55
|
+
}, []);
|
|
43
56
|
const formatTime = (milliseconds) => {
|
|
44
57
|
const totalSeconds = Math.floor(milliseconds / 1000);
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const seconds = totalSeconds
|
|
58
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
59
|
+
const minutes = Math.floor((totalSeconds - hours * 3600) / 60);
|
|
60
|
+
const seconds = totalSeconds - hours * 3600 - minutes * 60;
|
|
48
61
|
const ms = milliseconds % 1000;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
case "mm:ss:ms":
|
|
59
|
-
return `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}:${String(ms).padStart(3, "0")}`;
|
|
60
|
-
case "ss:ms":
|
|
61
|
-
return `${String(totalSeconds).padStart(2, "0")}:${String(ms).padStart(3, "0")}`;
|
|
62
|
-
default:
|
|
63
|
-
return `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`;
|
|
64
|
-
}
|
|
62
|
+
const formattedHours = String(hours).padStart(2, "0");
|
|
63
|
+
const formattedMinutes = String(minutes).padStart(2, "0");
|
|
64
|
+
const formattedSeconds = String(seconds).padStart(2, "0");
|
|
65
|
+
const formattedMs = String(ms).padStart(3, "0");
|
|
66
|
+
return format
|
|
67
|
+
.replace("hh", formattedHours)
|
|
68
|
+
.replace("mm", formattedMinutes)
|
|
69
|
+
.replace("ss", formattedSeconds)
|
|
70
|
+
.replace("ms", formattedMs);
|
|
65
71
|
};
|
|
66
72
|
return (React.createElement(Text, { style: [styles.defaultTimerStyle, style] }, formatTime(time)));
|
|
67
73
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timer.js","sourceRoot":"","sources":["../../../../src/components/Timer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,SAAS,EACT,MAAM,EACN,mBAAmB,EACnB,UAAU,GACX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAAE,UAAU,EAAa,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Timer.js","sourceRoot":"","sources":["../../../../src/components/Timer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,SAAS,EACT,MAAM,EACN,mBAAmB,EACnB,UAAU,GACX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAAE,UAAU,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