@draftbit/core 48.4.8-550850.2 → 48.4.8-618b68.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/Picker/Picker.js +1 -1
- package/lib/commonjs/components/SectionList/SectionList.js +1 -1
- package/lib/commonjs/components/TextField.js +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts +4 -10
- package/lib/typescript/src/components/Picker/Picker.js +84 -243
- package/lib/typescript/src/components/Picker/Picker.js.map +1 -1
- package/lib/typescript/src/components/SectionList/SectionList.d.ts +2 -1
- package/lib/typescript/src/components/SectionList/SectionList.js +13 -3
- package/lib/typescript/src/components/SectionList/SectionList.js.map +1 -1
- package/lib/typescript/src/components/TextField.d.ts +3 -3
- package/lib/typescript/src/components/TextField.js +9 -6
- package/lib/typescript/src/components/TextField.js.map +1 -1
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/Picker/Picker.js +84 -243
- package/src/components/Picker/Picker.js.map +1 -1
- package/src/components/Picker/Picker.tsx +134 -401
- package/src/components/SectionList/SectionList.js +13 -3
- package/src/components/SectionList/SectionList.js.map +1 -1
- package/src/components/SectionList/SectionList.tsx +15 -0
- package/src/components/TextField.js +9 -6
- package/src/components/TextField.js.map +1 -1
- package/src/components/TextField.tsx +14 -8
- package/lib/commonjs/components/Picker/PickerComponent.android.js +0 -1
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +0 -1
- package/lib/commonjs/components/Picker/PickerComponent.web.js +0 -1
- package/lib/typescript/src/components/Picker/PickerComponent.android.d.ts +0 -6
- package/lib/typescript/src/components/Picker/PickerComponent.android.js +0 -70
- package/lib/typescript/src/components/Picker/PickerComponent.android.js.map +0 -1
- package/lib/typescript/src/components/Picker/PickerComponent.ios.d.ts +0 -7
- package/lib/typescript/src/components/Picker/PickerComponent.ios.js +0 -80
- package/lib/typescript/src/components/Picker/PickerComponent.ios.js.map +0 -1
- package/lib/typescript/src/components/Picker/PickerComponent.web.d.ts +0 -6
- package/lib/typescript/src/components/Picker/PickerComponent.web.js +0 -71
- package/lib/typescript/src/components/Picker/PickerComponent.web.js.map +0 -1
- package/src/components/Picker/PickerComponent.android.js +0 -70
- package/src/components/Picker/PickerComponent.android.js.map +0 -1
- package/src/components/Picker/PickerComponent.android.tsx +0 -116
- package/src/components/Picker/PickerComponent.ios.js +0 -80
- package/src/components/Picker/PickerComponent.ios.js.map +0 -1
- package/src/components/Picker/PickerComponent.ios.tsx +0 -142
- package/src/components/Picker/PickerComponent.web.js +0 -71
- package/src/components/Picker/PickerComponent.web.js.map +0 -1
- package/src/components/Picker/PickerComponent.web.tsx +0 -117
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var React=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _lodash=require("lodash");var _reactNativeSafeAreaContext=require("react-native-safe-area-context");var _picker=require("@react-native-picker/picker");var _theming=require("../../theming");var _Portal=_interopRequireDefault(require("../Portal/Portal"));var _DeprecatedButton=_interopRequireDefault(require("../../deprecated-components/DeprecatedButton"));var _Touchable=_interopRequireDefault(require("../Touchable"));var _utilities=require("../../utilities");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Picker/Picker.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}function normalizeOptions(options){if(options.length===0){return[];}if(typeof options[0]===("string"||"number")){return options.map(function(option){return{label:String(option),value:String(option)};});}if((0,_lodash.isObject)(options[0])&&options[0].value!==null&&options[0].label!==null){return options.map(function(option){return{label:String(option.label),value:String(option.value)};});}throw new Error('Picker options must be either an array of strings or array of { "label": string; "value": string; } objects.');}var _Dimensions$get=_reactNative.Dimensions.get("screen"),deviceWidth=_Dimensions$get.width,deviceHeight=_Dimensions$get.height;var isIos=_reactNative.Platform.OS==="ios";var isWeb=_reactNative.Platform.OS==="web";var unstyledColor="rgba(165, 173, 183, 1)";var disabledColor="rgb(240, 240, 240)";var errorColor="rgba(255, 69, 100, 1)";var Picker=function Picker(_ref){var _find$label,_find;var error=_ref.error,_ref$options=_ref.options,options=_ref$options===void 0?[]:_ref$options,onValueChange=_ref.onValueChange,defaultValue=_ref.defaultValue,Icon=_ref.Icon,style=_ref.style,placeholder=_ref.placeholder,value=_ref.value,_ref$disabled=_ref.disabled,disabled=_ref$disabled===void 0?false:_ref$disabled,assistiveText=_ref.assistiveText,label=_ref.label,_ref$iconColor=_ref.iconColor,iconColor=_ref$iconColor===void 0?unstyledColor:_ref$iconColor,_ref$iconSize=_ref.iconSize,iconSize=_ref$iconSize===void 0?24:_ref$iconSize,_ref$leftIconMode=_ref.leftIconMode,leftIconMode=_ref$leftIconMode===void 0?"inset":_ref$leftIconMode,leftIconName=_ref.leftIconName,_ref$placeholderTextC=_ref.placeholderTextColor,placeholderTextColor=_ref$placeholderTextC===void 0?unstyledColor:_ref$placeholderTextC,rightIconName=_ref.rightIconName,_ref$type=_ref.type,type=_ref$type===void 0?"solid":_ref$type,_ref$autoDismissKeybo=_ref.autoDismissKeyboard,autoDismissKeyboard=_ref$autoDismissKeybo===void 0?true:_ref$autoDismissKeybo;var androidPickerRef=React.useRef(undefined);var _React$useState=React.useState(value||defaultValue),_React$useState2=(0,_slicedToArray2.default)(_React$useState,2),internalValue=_React$useState2[0],setInternalValue=_React$useState2[1];var _React$useState3=React.useState(false),_React$useState4=(0,_slicedToArray2.default)(_React$useState3,2),pickerVisible=_React$useState4[0],setPickerVisible=_React$useState4[1];var togglePickerVisible=function togglePickerVisible(){setPickerVisible(!pickerVisible);};React.useEffect(function(){if(value!=null&&value!==""){setInternalValue(value);}else if(value===""){setInternalValue(undefined);}},[value]);React.useEffect(function(){if(defaultValue!=null&&defaultValue!==""){setInternalValue(defaultValue);}},[defaultValue]);React.useEffect(function(){if(pickerVisible&&androidPickerRef.current){var _androidPickerRef$cur;androidPickerRef==null?void 0:(_androidPickerRef$cur=androidPickerRef.current)==null?void 0:_androidPickerRef$cur.focus();}},[pickerVisible,androidPickerRef]);React.useEffect(function(){if(pickerVisible&&autoDismissKeyboard){_reactNative.Keyboard.dismiss();}},[pickerVisible,autoDismissKeyboard]);var normalizedOptions=React.useMemo(function(){return normalizeOptions(options);},[options]);var pickerOptions=React.useMemo(function(){return placeholder?[{label:placeholder,value:placeholder}].concat((0,_toConsumableArray2.default)(normalizedOptions)):normalizedOptions;},[placeholder,normalizedOptions]);if(!placeholder&&pickerOptions.length&&!internalValue&&internalValue!==pickerOptions[0].value){onValueChange==null?void 0:onValueChange(pickerOptions[0].value,0);setInternalValue(pickerOptions[0].value);}var _extractStyles=(0,_utilities.extractStyles)(style),viewStyles=_extractStyles.viewStyles,textStyles=_extractStyles.textStyles;var additionalBorderStyles=["backgroundColor"];var additionalMarginStyles=["bottom","height","left","maxHeight","maxWidth","minHeight","minWidth","overflow","position","right","top","width","zIndex"];var _extractBorderAndMarg=(0,_utilities.extractBorderAndMarginStyles)(viewStyles,additionalBorderStyles,additionalMarginStyles),extractedBorderStyles=_extractBorderAndMarg.borderStyles,extractedMarginStyles=_extractBorderAndMarg.marginStyles;var borderStyles=Object.assign({},Object.assign({},type==="solid"?{borderTopLeftRadius:5,borderTopRightRadius:5,borderBottomRightRadius:5,borderBottomLeftRadius:5,borderTopWidth:1,borderRightWidth:1,borderLeftWidth:1}:{},{borderBottomWidth:1,borderColor:unstyledColor,borderStyle:"solid"}),extractedBorderStyles,error?{borderColor:errorColor}:{},disabled?{borderColor:"transparent",backgroundColor:disabledColor}:{});var marginStyles=Object.assign({height:60},extractedMarginStyles);var stylesWithoutBordersAndMargins=(0,_lodash.omit)(viewStyles,[].concat((0,_toConsumableArray2.default)(_utilities.borderStyleNames),(0,_toConsumableArray2.default)(_utilities.marginStyleNames),additionalBorderStyles,additionalMarginStyles));var selectedLabel=internalValue&&((_find$label=(_find=pickerOptions.find(function(option){return option.value===internalValue;}))==null?void 0:_find.label)!=null?_find$label:internalValue);var labelText=label?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{textAlign:textStyles.textAlign,color:unstyledColor,fontSize:12,paddingBottom:4},children:label}):null;var leftIconOutset=leftIconMode==="outset";var leftIcon=leftIconName?(0,_jsxRuntime.jsx)(Icon,{name:leftIconName,color:disabled?unstyledColor:iconColor,size:iconSize,style:{marginRight:4,marginLeft:4}}):null;var rightIcon=rightIconName?(0,_jsxRuntime.jsx)(Icon,{name:rightIconName,color:disabled?unstyledColor:iconColor,size:iconSize,style:{marginRight:-10,marginLeft:8}}):null;var textAlign=textStyles==null?void 0:textStyles.textAlign;var calculateLeftPadding=function calculateLeftPadding(){if(leftIconOutset){if(textAlign==="center"){return iconSize-Math.abs(8-iconSize);}return iconSize+8;}return 0;};var assistiveTextLabel=assistiveText?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:{textAlign:textAlign,width:"100%",paddingLeft:calculateLeftPadding(),color:unstyledColor,fontSize:12,paddingTop:4},children:assistiveText}):null;var primaryTextStyle=Object.assign({color:unstyledColor,fontSize:14},(0,_lodash.pickBy)(textStyles,_lodash.identity),placeholder===internalValue?{color:placeholderTextColor}:{},disabled?{color:unstyledColor}:{});var handleValueChange=function handleValueChange(newValue,itemIndex){if(newValue!==""&&newValue!==placeholder){onValueChange==null?void 0:onValueChange(newValue,itemIndex);setInternalValue(newValue);}else if(newValue===placeholder){onValueChange==null?void 0:onValueChange("",0);setInternalValue(undefined);}};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.marginsContainer,marginStyles],children:[(0,_jsxRuntime.jsxs)(_Touchable.default,{disabled:disabled,onPress:togglePickerVisible,style:styles.touchableContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{pointerEvents:"none",style:[styles.outsetContainer,stylesWithoutBordersAndMargins,!leftIconOutset?borderStyles:{}],children:[leftIcon,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.insetContainer,leftIconOutset?borderStyles:{}],children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.primaryTextContainer,children:[labelText,(0,_jsxRuntime.jsx)(_reactNative.Text,{style:primaryTextStyle,children:String(selectedLabel!=null?selectedLabel:placeholder)})]}),rightIcon]})]}),assistiveTextLabel]}),isIos&&pickerVisible?(0,_jsxRuntime.jsx)(_Portal.default,{children:(0,_jsxRuntime.jsx)(_reactNativeSafeAreaContext.SafeAreaView,{style:styles.iosPicker,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.iosPickerContent,children:[(0,_jsxRuntime.jsx)(_DeprecatedButton.default,{Icon:Icon,type:"text",onPress:togglePickerVisible,style:styles.iosButton,children:"Close"}),(0,_jsxRuntime.jsx)(_picker.Picker,{style:styles.iosNativePicker,selectedValue:internalValue,onValueChange:handleValueChange,children:pickerOptions.map(function(option){return(0,_jsxRuntime.jsx)(_picker.Picker.Item,{label:option.label,value:option.value},option.value);})})]})})}):null,!isIos&&(pickerVisible||isWeb)?(0,_jsxRuntime.jsx)(_picker.Picker,{enabled:!disabled,selectedValue:internalValue,onValueChange:handleValueChange,style:styles.nonIosPicker,ref:androidPickerRef,onBlur:function onBlur(){return setPickerVisible(false);},children:pickerOptions.map(function(option){return(0,_jsxRuntime.jsx)(_picker.Picker.Item,{label:option.label,value:option.value},option.value);})}):null]});};var styles=_reactNative.StyleSheet.create({marginsContainer:{alignSelf:"stretch",alignItems:"center",width:"100%",maxWidth:deviceWidth},touchableContainer:{flex:1,height:"100%",width:"100%",alignSelf:"stretch",alignItems:"center"},outsetContainer:{flex:1,height:"100%",width:"100%",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},insetContainer:{flex:1,height:"100%",width:"100%",flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingLeft:12,paddingRight:12},primaryTextContainer:{flex:1},iosPicker:{position:"absolute",bottom:0,left:0,right:0,flexDirection:"row",justifyContent:"center",width:"100%",maxWidth:deviceWidth,maxHeight:deviceHeight,backgroundColor:"white"},iosPickerContent:{flexDirection:"column",width:"100%",maxWidth:deviceWidth},iosButton:{alignSelf:"flex-end"},iosNativePicker:{backgroundColor:"white"},nonIosPicker:{opacity:0,position:"absolute",top:0,left:0,right:0,bottom:0,width:"100%",maxWidth:deviceWidth,maxHeight:deviceHeight}});var _default=(0,_theming.withTheme)(Picker);exports.default=_default;
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;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 _lodash=require("lodash");var _reactNativeSafeAreaContext=require("react-native-safe-area-context");var _picker=require("@react-native-picker/picker");var _Portal=_interopRequireDefault(require("../Portal/Portal"));var _Button=require("../Button");var _Touchable=_interopRequireDefault(require("../Touchable"));var _utilities=require("../../utilities");var _TextField=_interopRequireDefault(require("../TextField"));var _lodash2=_interopRequireDefault(require("lodash.omit"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["options","onValueChange","Icon","style","placeholder","value","disabled","autoDismissKeyboard"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Picker/Picker.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var isIos=_reactNative.Platform.OS==="ios";var isWeb=_reactNative.Platform.OS==="web";var Picker=function Picker(_ref){var _options$find;var _ref$options=_ref.options,optionsProp=_ref$options===void 0?[]:_ref$options,_onValueChange=_ref.onValueChange,Icon=_ref.Icon,style=_ref.style,placeholder=_ref.placeholder,value=_ref.value,_ref$disabled=_ref.disabled,disabled=_ref$disabled===void 0?false:_ref$disabled,_ref$autoDismissKeybo=_ref.autoDismissKeyboard,autoDismissKeyboard=_ref$autoDismissKeybo===void 0?true:_ref$autoDismissKeybo,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);var pickerRef=React.useRef(null);var _React$useState=React.useState(false),_React$useState2=(0,_slicedToArray2.default)(_React$useState,2),pickerVisible=_React$useState2[0],setPickerVisible=_React$useState2[1];var options=React.useMemo(function(){var normalizedOptions=normalizeToPickerOptions(optionsProp);if(placeholder){return[{label:placeholder,value:placeholder}].concat(normalizedOptions);}else{return normalizedOptions;}},[placeholder,optionsProp]);if(!placeholder&&options.length&&!value&&value!==options[0].value){_onValueChange==null?void 0:_onValueChange(options[0].value);}var selectedLabel=((_options$find=options.find(function(option){return option.value===String(value);}))==null?void 0:_options$find.label)||value||placeholder;var containerStyle=_reactNative.StyleSheet.flatten([(0,_utilities.extractSizeStyles)(style),(0,_utilities.extractPositionStyles)(style),(0,_utilities.extractFlexItemStyles)(style),(0,_utilities.extractBorderAndMarginStyles)(style).marginStyles]);var textFieldStyle=(0,_lodash2.default)(style,Object.keys(containerStyle));var renderNativePicker=function renderNativePicker(){return(0,_jsxRuntime.jsx)(_picker.Picker,{ref:pickerRef,selectedValue:value,onValueChange:function onValueChange(newValue){if(newValue!==placeholder){_onValueChange==null?void 0:_onValueChange(newValue);}else if(newValue===placeholder){_onValueChange==null?void 0:_onValueChange("");}},style:[styles.nativePicker,isIos?styles.iosNativePicker:styles.nonIosPicker],onBlur:function onBlur(){return setPickerVisible(false);},children:options.map(function(option){return(0,_jsxRuntime.jsx)(_picker.Picker.Item,{label:option.label,value:option.value},option.value);})});};var renderPicker=function renderPicker(){if(isIos){return(0,_jsxRuntime.jsx)(_Portal.default,{children:(0,_jsxRuntime.jsx)(_reactNativeSafeAreaContext.SafeAreaView,{style:styles.nativePicker,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.iosPickerContent,children:[(0,_jsxRuntime.jsx)(_Button.Button,{Icon:Icon,type:"text",onPress:function onPress(){return setPickerVisible(!pickerVisible);},style:styles.iosButton,children:"Close"}),renderNativePicker()]})})});}else{return renderNativePicker();}};React.useEffect(function(){if(pickerVisible&&pickerRef.current){var _pickerRef$current;pickerRef==null?void 0:(_pickerRef$current=pickerRef.current)==null?void 0:_pickerRef$current.focus();}},[pickerVisible,pickerRef]);React.useEffect(function(){if(pickerVisible&&autoDismissKeyboard){_reactNative.Keyboard.dismiss();}},[pickerVisible,autoDismissKeyboard]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:containerStyle,children:[(0,_jsxRuntime.jsx)(_Touchable.default,{disabled:disabled,onPress:function onPress(){return setPickerVisible(!pickerVisible);},children:(0,_jsxRuntime.jsx)(_TextField.default,Object.assign({Icon:Icon,numberOfLines:1,onChangeText:function onChangeText(){},value:String(selectedLabel!=null?selectedLabel:placeholder),editable:false,disabled:disabled,style:textFieldStyle},rest))}),(pickerVisible||isWeb)&&renderPicker()]});};var styles=_reactNative.StyleSheet.create({nativePicker:{position:"absolute",bottom:0,left:0,right:0,flexDirection:"row",justifyContent:"center",width:"100%",backgroundColor:"white"},iosPickerContent:{flexDirection:"column",width:"100%"},iosButton:{alignSelf:"flex-end"},iosNativePicker:{backgroundColor:"white"},nonIosPicker:{opacity:0}});function normalizeToPickerOptions(options){if(options.length===0){return[];}var firstOption=options[0];if(typeof firstOption===("string"||"number")){return options.map(function(option){return{label:String(option),value:String(option)};});}if((0,_lodash.isObject)(firstOption)&&firstOption.value&&firstOption.label){return options.map(function(option){return{label:String(option.label),value:String(option.value)};});}throw new Error('Picker options must be either an array of strings or array of { "label": string; "value": string; } objects.');}var _default=Picker;exports.default=_default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.DEFAULT_SECTION=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _flashList=require("@shopify/flash-list");var _reactNative=require("react-native");var _SectionHeader=_interopRequireWildcard(require("./SectionHeader"));var _utilities=require("../../utilities");var _jsxRuntime=require("react/jsx-runtime");var _excluded=["sectionKey","stickyHeader","listComponent","data","renderItem"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/SectionList/SectionList.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var DEFAULT_SECTION="Uncategorized";exports.DEFAULT_SECTION=DEFAULT_SECTION;var SectionList=function SectionList(_ref){var sectionKey=_ref.sectionKey,_ref$stickyHeader=_ref.stickyHeader,stickyHeader=_ref$stickyHeader===void 0?false:_ref$stickyHeader,_ref$listComponent=_ref.listComponent,listComponent=_ref$listComponent===void 0?"FlatList":_ref$listComponent,dataProp=_ref.data,renderItemProp=_ref.renderItem,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);var data=_react.default.useMemo(function(){return Array.isArray(dataProp)?dataProp:[];},[dataProp]);var dataWithSections=_react.default.useMemo(function(){var result=[];var sectionDataItems={};for(var
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.DEFAULT_SECTION=void 0;var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _flashList=require("@shopify/flash-list");var _reactNative=require("react-native");var _SectionHeader=_interopRequireWildcard(require("./SectionHeader"));var _utilities=require("../../utilities");var _jsxRuntime=require("react/jsx-runtime");var _excluded=["sectionKey","stickyHeader","listComponent","data","renderItem","keyExtractor"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/SectionList/SectionList.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var DEFAULT_SECTION="Uncategorized";exports.DEFAULT_SECTION=DEFAULT_SECTION;var SectionList=function SectionList(_ref){var sectionKey=_ref.sectionKey,_ref$stickyHeader=_ref.stickyHeader,stickyHeader=_ref$stickyHeader===void 0?false:_ref$stickyHeader,_ref$listComponent=_ref.listComponent,listComponent=_ref$listComponent===void 0?"FlatList":_ref$listComponent,dataProp=_ref.data,renderItemProp=_ref.renderItem,keyExtractorProp=_ref.keyExtractor,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);var data=_react.default.useMemo(function(){return Array.isArray(dataProp)?dataProp:[];},[dataProp]);var dataWithSections=_react.default.useMemo(function(){var result=[];var sectionDataItems={};for(var _item of data){var _item$sectionKey;var section=((_item$sectionKey=_item[sectionKey])==null?void 0:_item$sectionKey.toString())||DEFAULT_SECTION;if(sectionDataItems[section]){sectionDataItems[section].push(_item);}else{sectionDataItems[section]=[_item];}}for(var _section in sectionDataItems){result.push({type:"SECTION_ITEM",title:_section});var sectionItems=sectionDataItems[_section].map(function(item){return{type:"DATA_ITEM",data:item};});result.push.apply(result,(0,_toConsumableArray2.default)(sectionItems));}return result;},[data,sectionKey]);var sectionHeaderIndicies=_react.default.useMemo(function(){return stickyHeader?dataWithSections.filter(function(item){return item.type==="SECTION_ITEM";}).map(function(item){return dataWithSections.indexOf(item);}):undefined;},[dataWithSections,stickyHeader]);var extractSectionHeader=function extractSectionHeader(element){if(!element){return null;}var props=element.props||{};var children=(0,_utilities.flattenReactFragments)(_react.default.Children.toArray(props.children));if(element.type===_SectionHeader.default){return element;}else{for(var child of children){if(child.type===_SectionHeader.default){return child;}}}return null;};var extractRemainingNonSectionHeader=function extractRemainingNonSectionHeader(element){if(!element){return null;}var props=element.props||{};var children=(0,_utilities.flattenReactFragments)(_react.default.Children.toArray(props.children));if(element.type===_SectionHeader.default){return null;}else{var newChildren=[];for(var child of children){if(child.type!==_SectionHeader.default){newChildren.push(child);}}return _react.default.cloneElement(element,Object.assign({},props,{children:newChildren}));}};var renderItem=function renderItem(_ref2){var item=_ref2.item,index=_ref2.index;switch(item.type){case"SECTION_ITEM":{var renderedItem=renderItemProp({index:index,section:item.title});return extractSectionHeader(renderedItem)||(0,_jsxRuntime.jsx)(_SectionHeader.DefaultSectionHeader,{title:item.title});}case"DATA_ITEM":{var _renderedItem=renderItemProp({item:item.data,index:index,section:item.data[sectionKey]||DEFAULT_SECTION});return extractRemainingNonSectionHeader(_renderedItem);}}};var keyExtractor=function keyExtractor(item,index){switch(item.type){case"SECTION_ITEM":{return"section_"+index.toString();}case"DATA_ITEM":{return(keyExtractorProp==null?void 0:keyExtractorProp(item.data,index))||index.toString();}}};switch(listComponent){case"FlatList":return(0,_jsxRuntime.jsx)(_reactNative.FlatList,Object.assign({stickyHeaderIndices:sectionHeaderIndicies},rest,{data:dataWithSections,renderItem:renderItem,keyExtractor:keyExtractor}));case"FlashList":return(0,_jsxRuntime.jsx)(_flashList.FlashList,Object.assign({stickyHeaderIndices:sectionHeaderIndicies},rest,{data:dataWithSections,renderItem:renderItem,keyExtractor:keyExtractor}));}};var _default=SectionList;exports.default=_default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var React=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _theming=require("../theming");var _utilities=require("../utilities");var _TextInput=_interopRequireDefault(require("./TextInput"));var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/TextField.tsx";var _excluded=["Icon","type","disabled","label","error","leftIconName","leftIconMode","rightIconName","assistiveText","underlineColor","activeBorderColor","multiline","numberOfLines","style","theme","render"],_excluded2=["lineHeight"],_excluded3=["backgroundColor","padding","paddingTop","paddingBottom","paddingLeft","paddingRight","borderRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor"];function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=(0,_getPrototypeOf2.default)(Derived),result;if(hasNativeReflectConstruct){var NewTarget=(0,_getPrototypeOf2.default)(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return(0,_possibleConstructorReturn2.default)(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;}}var AnimatedText=_reactNative.Animated.createAnimatedComponent(_reactNative.Text);var FOCUS_ANIMATION_DURATION=150;var BLUR_ANIMATION_DURATION=180;var ICON_SIZE=24;var TextField=function(_React$Component){(0,_inherits2.default)(TextField,_React$Component);var _super=_createSuper(TextField);function TextField(){var _this;(0,_classCallCheck2.default)(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={nativeProps:{},labeled:new _reactNative.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 _reactNative.Animated.timing(_this.state.labeled,{toValue:1,duration:FOCUS_ANIMATION_DURATION,useNativeDriver:true}).start();};_this._minmizeLabel=function(){return _reactNative.Animated.timing(_this.state.labeled,{toValue:0,duration:BLUR_ANIMATION_DURATION,useNativeDriver:true}).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;}(0,_createClass2.default)(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:"setNativeProps",value:function setNativeProps(args){this.setState(function(state){return Object.assign({},state,{nativeState:args||{}});});}},{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,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,label=_this$props.label,_this$props$error=_this$props.error,error=_this$props$error===void 0?false:_this$props$error,leftIconName=_this$props.leftIconName,leftIconMode=_this$props.leftIconMode,rightIconName=_this$props.rightIconName,assistiveText=_this$props.assistiveText,underlineColorProp=_this$props.underlineColor,activeBorderColorProp=_this$props.activeBorderColor,_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$theme=_this$props.theme,colors=_this$props$theme.colors,typography=_this$props$theme.typography,roundness=_this$props$theme.roundness,disabledOpacity=_this$props$theme.disabledOpacity,_this$props$render=_this$props.render,render=_this$props$render===void 0?function(props){return(0,_jsxRuntime.jsx)(_TextInput.default,Object.assign({},props));}:_this$props$render,rest=(0,_objectWithoutProperties2.default)(_this$props,_excluded);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.strong;if(disabled){activeColor=colors.light;placeholderColor=colors.light;borderColor="transparent";underlineColor="transparent";backgroundColor=colors.divider;}else{activeColor=error?colors.error:activeBorderColorProp;placeholderColor=borderColor=colors.light;underlineColor=underlineColorProp;backgroundColor=colors.background;}if(rest.placeholderTextColor){placeholderColor=rest.placeholderTextColor;}var _typography$subtitle=typography.subtitle1,lineHeight=_typography$subtitle.lineHeight,subtitle1=(0,_objectWithoutProperties2.default)(_typography$subtitle,_excluded2);inputStyle=Object.assign({paddingVertical:0,color:inputTextColor,paddingLeft:leftIconName&&leftIconMode==="inset"?ICON_SIZE+12+(type==="solid"?16:0):0,paddingRight:rightIconName?ICON_SIZE+16+4:12},subtitle1);if(!multiline){inputStyle.height=lineHeight;}var assistiveTextLeftMargin;if(type==="underline"){containerStyle={borderTopLeftRadius:roundness,borderTopRightRadius:roundness,paddingBottom:12,marginTop:16};if(leftIconName&&leftIconMode==="outset"){assistiveTextLeftMargin=ICON_SIZE+8;}else{assistiveTextLeftMargin=0;}}else{containerStyle={borderRadius:roundness,borderColor:hasActiveOutline?activeColor:borderColor,borderWidth:1,paddingTop:label?16*1.5:16,paddingBottom:label?16*0.5:16,opacity:disabled?disabledOpacity:1,backgroundColor:backgroundColor};if(leftIconName&&leftIconMode==="inset"){assistiveTextLeftMargin=16+4;}else if(leftIconName&&leftIconMode==="outset"){assistiveTextLeftMargin=ICON_SIZE+8+12;}else{assistiveTextLeftMargin=12;}inputStyle.paddingHorizontal=12;}if(leftIconName&&leftIconMode==="outset"){containerStyle.marginLeft=ICON_SIZE+8;}var leftIconColor;if(error){leftIconColor=colors.error;}else if(this.state.focused){leftIconColor=colors.primary;}else{leftIconColor=colors.light;}var leftIconProps={size:24,color:leftIconColor,name:leftIconName||""};var leftIconStyle={position:"absolute",marginTop:type==="solid"?MINIMIZED_LABEL_FONT_SIZE+4:leftIconMode==="outset"?16:0,marginLeft:leftIconMode==="inset"&&type==="solid"?16:0};var labelStyle=Object.assign({},typography.subtitle1,{top:type==="solid"?16:0,left:leftIconName&&leftIconMode==="inset"?ICON_SIZE+(type==="solid"?16: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=(0,_utilities.extractStyles)(style),textStyles=_extractStyles.textStyles;var inputStyles=(0,_utilities.applyStyles)([styles.input,inputStyle,type==="solid"?{marginHorizontal:12}:{}],textStyles);var _ref=_reactNative.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=(0,_objectWithoutProperties2.default)(_ref,_excluded3);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,styleProp],children:[leftIconName&&leftIconMode==="outset"?(0,_jsxRuntime.jsx)(Icon,Object.assign({},leftIconProps,{style:leftIconStyle})):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:(0,_utilities.applyStyles)([containerStyle],{height:style==null?void 0:style.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"?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.underline,{backgroundColor:bgColor||(error?colors.error:this.state.focused?activeColor:underlineColor),transform:[{scaleY:this.state.focused?1:0.5}]}]}):null,label?(0,_jsxRuntime.jsxs)(_reactNative.View,{pointerEvents:"none",style:[_reactNative.StyleSheet.absoluteFill,{opacity:this.state.value||this.state.focused?this.state.labelLayout.measured?1:0:1}],children:[(0,_jsxRuntime.jsx)(AnimatedText,{onLayout:function onLayout(e){return _this2.setState({labelLayout:{width:e.nativeEvent.layout.width,measured:true}});},style:[styles.placeholder,type==="solid"?{paddingHorizontal:12}:{},labelStyle,{color:placeholderColor,opacity:this.state.labeled.interpolate({inputRange:[0,1],outputRange:[hasActiveOutline?1:0,0]})}],numberOfLines:1,children:label}),(0,_jsxRuntime.jsx)(AnimatedText,{style:[styles.placeholder,type==="solid"?{paddingHorizontal:12}:{},labelStyle,{color:placeholderColor,opacity:hasActiveOutline?this.state.labeled:1}],numberOfLines:1,children:label})]}):null,leftIconName&&leftIconMode==="inset"?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{justifyContent:type==="solid"?"center":undefined},children:(0,_jsxRuntime.jsx)(Icon,Object.assign({},leftIconProps,{style:leftIconStyle}))}):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,selectionColor:activeColor,multiline:multiline,numberOfLines:numberOfLines,onFocus:this._handleFocus,onBlur:this._handleBlur,underlineColorAndroid:"transparent",style:inputStyles},rest,this.state.nativeProps,{value:this.state.value}))]}),rightIconName?(0,_jsxRuntime.jsx)(Icon,{name:rightIconName,size:ICON_SIZE,color:colors.light,style:{position:"absolute",right:16,marginTop:type==="solid"?MINIMIZED_LABEL_FONT_SIZE+4:16}}):null,assistiveText?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{color:error?colors.error:colors.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);var _default=(0,_theming.withTheme)(TextField);exports.default=_default;var styles=_reactNative.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:_reactNative.I18nManager.isRTL?"right":"left"}});
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var React=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _theming=require("../theming");var _utilities=require("../utilities");var _TextInput=_interopRequireDefault(require("./TextInput"));var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/TextField.tsx";var _excluded=["Icon","type","disabled","label","error","leftIconName","leftIconMode","rightIconName","iconColor","iconSize","assistiveText","underlineColor","activeBorderColor","multiline","numberOfLines","style","theme","render"],_excluded2=["lineHeight"],_excluded3=["backgroundColor","padding","paddingTop","paddingBottom","paddingLeft","paddingRight","borderRadius","borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderColor"];function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=(0,_getPrototypeOf2.default)(Derived),result;if(hasNativeReflectConstruct){var NewTarget=(0,_getPrototypeOf2.default)(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return(0,_possibleConstructorReturn2.default)(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;}}var AnimatedText=_reactNative.Animated.createAnimatedComponent(_reactNative.Text);var FOCUS_ANIMATION_DURATION=150;var BLUR_ANIMATION_DURATION=180;var ICON_SIZE=24;var TextField=function(_React$Component){(0,_inherits2.default)(TextField,_React$Component);var _super=_createSuper(TextField);function TextField(){var _this;(0,_classCallCheck2.default)(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={nativeProps:{},labeled:new _reactNative.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 _reactNative.Animated.timing(_this.state.labeled,{toValue:1,duration:FOCUS_ANIMATION_DURATION,useNativeDriver:true}).start();};_this._minmizeLabel=function(){return _reactNative.Animated.timing(_this.state.labeled,{toValue:0,duration:BLUR_ANIMATION_DURATION,useNativeDriver:true}).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;}(0,_createClass2.default)(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:"setNativeProps",value:function setNativeProps(args){this.setState(function(state){return Object.assign({},state,{nativeState:args||{}});});}},{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,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,label=_this$props.label,_this$props$error=_this$props.error,error=_this$props$error===void 0?false:_this$props$error,leftIconName=_this$props.leftIconName,leftIconMode=_this$props.leftIconMode,rightIconName=_this$props.rightIconName,iconColor=_this$props.iconColor,iconSize=_this$props.iconSize,assistiveText=_this$props.assistiveText,underlineColorProp=_this$props.underlineColor,activeBorderColorProp=_this$props.activeBorderColor,_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$theme=_this$props.theme,colors=_this$props$theme.colors,typography=_this$props$theme.typography,roundness=_this$props$theme.roundness,disabledOpacity=_this$props$theme.disabledOpacity,_this$props$render=_this$props.render,render=_this$props$render===void 0?function(props){return(0,_jsxRuntime.jsx)(_TextInput.default,Object.assign({},props));}:_this$props$render,rest=(0,_objectWithoutProperties2.default)(_this$props,_excluded);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.strong;if(disabled){activeColor=colors.light;placeholderColor=colors.light;borderColor="transparent";underlineColor="transparent";backgroundColor=colors.divider;}else{activeColor=error?colors.error:activeBorderColorProp;placeholderColor=borderColor=colors.light;underlineColor=underlineColorProp||colors.light;backgroundColor=colors.background;}if(rest.placeholderTextColor){placeholderColor=rest.placeholderTextColor;}var _typography$subtitle=typography.subtitle1,lineHeight=_typography$subtitle.lineHeight,subtitle1=(0,_objectWithoutProperties2.default)(_typography$subtitle,_excluded2);inputStyle=Object.assign({paddingVertical:0,color:inputTextColor,paddingLeft:leftIconName&&leftIconMode==="inset"?ICON_SIZE+12+(type==="solid"?16:0):0,paddingRight:rightIconName?ICON_SIZE+16+4:12},subtitle1);if(!multiline){inputStyle.height=lineHeight;}var assistiveTextLeftMargin;if(type==="underline"){containerStyle={borderTopLeftRadius:roundness,borderTopRightRadius:roundness,paddingBottom:12,marginTop:16};if(leftIconName&&leftIconMode==="outset"){assistiveTextLeftMargin=ICON_SIZE+8;}else{assistiveTextLeftMargin=0;}}else{containerStyle={borderRadius:roundness,borderColor:hasActiveOutline?activeColor:borderColor,borderWidth:1,paddingTop:label?16*1.5:16,paddingBottom:label?16*0.5:16,opacity:disabled?disabledOpacity:1,backgroundColor:backgroundColor};if(leftIconName&&leftIconMode==="inset"){assistiveTextLeftMargin=16+4;}else if(leftIconName&&leftIconMode==="outset"){assistiveTextLeftMargin=ICON_SIZE+8+12;}else{assistiveTextLeftMargin=12;}inputStyle.paddingHorizontal=12;}if(leftIconName&&leftIconMode==="outset"){containerStyle.marginLeft=ICON_SIZE+8;}var leftIconColor;if(iconColor){leftIconColor=iconColor;}else if(error){leftIconColor=colors.error;}else if(this.state.focused){leftIconColor=colors.primary;}else{leftIconColor=colors.light;}var leftIconProps={size:iconSize||24,color:leftIconColor,name:leftIconName||""};var leftIconStyle={position:"absolute",marginTop:type==="solid"?MINIMIZED_LABEL_FONT_SIZE+4:leftIconMode==="outset"?16:0,marginLeft:leftIconMode==="inset"&&type==="solid"?16:0};var labelStyle=Object.assign({},typography.subtitle1,{top:type==="solid"?16:0,left:leftIconName&&leftIconMode==="inset"?ICON_SIZE+(type==="solid"?16: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=(0,_utilities.extractStyles)(style),textStyles=_extractStyles.textStyles;var inputStyles=(0,_utilities.applyStyles)([styles.input,inputStyle,type==="solid"?{marginHorizontal:12}:{}],textStyles);var _ref=_reactNative.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=(0,_objectWithoutProperties2.default)(_ref,_excluded3);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,styleProp],children:[leftIconName&&leftIconMode==="outset"?(0,_jsxRuntime.jsx)(Icon,Object.assign({},leftIconProps,{style:leftIconStyle})):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:(0,_utilities.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"?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.underline,{backgroundColor:bgColor||(error?colors.error:this.state.focused?activeColor:underlineColor),transform:[{scaleY:this.state.focused?1:0.5}]}]}):null,label?(0,_jsxRuntime.jsxs)(_reactNative.View,{pointerEvents:"none",style:[_reactNative.StyleSheet.absoluteFill,{opacity:this.state.value||this.state.focused?this.state.labelLayout.measured?1:0:1}],children:[(0,_jsxRuntime.jsx)(AnimatedText,{onLayout:function onLayout(e){return _this2.setState({labelLayout:{width:e.nativeEvent.layout.width,measured:true}});},style:[styles.placeholder,type==="solid"?{paddingHorizontal:12}:{},labelStyle,{color:placeholderColor,opacity:this.state.labeled.interpolate({inputRange:[0,1],outputRange:[hasActiveOutline?1:0,0]})}],numberOfLines:1,children:label}),(0,_jsxRuntime.jsx)(AnimatedText,{style:[styles.placeholder,type==="solid"?{paddingHorizontal:12}:{},labelStyle,{color:placeholderColor,opacity:hasActiveOutline?this.state.labeled:1}],numberOfLines:1,children:label})]}):null,leftIconName&&leftIconMode==="inset"?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{justifyContent:type==="solid"?"center":undefined},children:(0,_jsxRuntime.jsx)(Icon,Object.assign({},leftIconProps,{style:leftIconStyle}))}):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,selectionColor:activeColor,multiline:multiline,numberOfLines:numberOfLines,onFocus:this._handleFocus,onBlur:this._handleBlur,underlineColorAndroid:"transparent",style:inputStyles},rest,this.state.nativeProps,{value:this.state.value}))]}),rightIconName?(0,_jsxRuntime.jsx)(Icon,{name:rightIconName,size:iconSize||ICON_SIZE,color:iconColor||colors.light,style:{position:"absolute",right:16,marginTop:type==="solid"?MINIMIZED_LABEL_FONT_SIZE+4:16}}):null,assistiveText?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[{color:error?colors.error:colors.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);var _default=(0,_theming.withTheme)(TextField);exports.default=_default;var styles=_reactNative.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:_reactNative.I18nManager.isRTL?"right":"left"}});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { ViewStyle, StyleProp } from "react-native";
|
|
3
|
-
import type { Theme } from "../../styles/DefaultTheme";
|
|
4
3
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
5
4
|
export interface PickerOption {
|
|
6
5
|
value: string;
|
|
@@ -15,8 +14,7 @@ export declare type PickerProps = {
|
|
|
15
14
|
};
|
|
16
15
|
value?: string;
|
|
17
16
|
options: PickerOption[] | string[];
|
|
18
|
-
onValueChange: (value: string
|
|
19
|
-
defaultValue?: string;
|
|
17
|
+
onValueChange: (value: string) => void;
|
|
20
18
|
assistiveText?: string;
|
|
21
19
|
label?: string;
|
|
22
20
|
iconColor?: string;
|
|
@@ -27,10 +25,6 @@ export declare type PickerProps = {
|
|
|
27
25
|
rightIconName?: string;
|
|
28
26
|
type?: "solid" | "underline";
|
|
29
27
|
autoDismissKeyboard?: boolean;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<PickerProps, "theme"> & {
|
|
34
|
-
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
35
|
-
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<PickerProps> & React.FC<PickerProps>, {}>;
|
|
36
|
-
export default _default;
|
|
28
|
+
} & IconSlot;
|
|
29
|
+
declare const Picker: React.FC<PickerProps>;
|
|
30
|
+
export default Picker;
|
|
@@ -1,255 +1,86 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet,
|
|
3
|
-
import {
|
|
2
|
+
import { View, StyleSheet, Platform, Keyboard, } from "react-native";
|
|
3
|
+
import { isObject } from "lodash";
|
|
4
4
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
5
5
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
6
|
-
import { withTheme } from "../../theming";
|
|
7
6
|
import Portal from "../Portal/Portal";
|
|
8
|
-
import Button from "
|
|
7
|
+
import { Button } from "../Button";
|
|
9
8
|
import Touchable from "../Touchable";
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return [];
|
|
14
|
-
}
|
|
15
|
-
if (typeof options[0] === ("string" || "number")) {
|
|
16
|
-
return options.map((option) => ({
|
|
17
|
-
label: String(option),
|
|
18
|
-
value: String(option),
|
|
19
|
-
}));
|
|
20
|
-
}
|
|
21
|
-
if (isObject(options[0]) &&
|
|
22
|
-
options[0].value !== null &&
|
|
23
|
-
options[0].label !== null) {
|
|
24
|
-
return options.map((option) => {
|
|
25
|
-
return {
|
|
26
|
-
label: String(option.label),
|
|
27
|
-
value: String(option.value),
|
|
28
|
-
};
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
throw new Error('Picker options must be either an array of strings or array of { "label": string; "value": string; } objects.');
|
|
32
|
-
}
|
|
33
|
-
const { width: deviceWidth, height: deviceHeight } = Dimensions.get("screen");
|
|
9
|
+
import { extractBorderAndMarginStyles, extractSizeStyles, extractFlexItemStyles, extractPositionStyles, } from "../../utilities";
|
|
10
|
+
import TextField from "../TextField";
|
|
11
|
+
import omit from "lodash.omit";
|
|
34
12
|
const isIos = Platform.OS === "ios";
|
|
35
13
|
const isWeb = Platform.OS === "web";
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
//Empty string for 'value' is treated as a non-value
|
|
40
|
-
//reason: Draftbit uses empty string as initial value for string state*/
|
|
41
|
-
const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "solid", autoDismissKeyboard = true, }) => {
|
|
42
|
-
var _a, _b;
|
|
43
|
-
const androidPickerRef = React.useRef(undefined);
|
|
44
|
-
const [internalValue, setInternalValue] = React.useState(value || defaultValue);
|
|
14
|
+
const Picker = ({ options: optionsProp = [], onValueChange, Icon, style, placeholder, value, disabled = false, autoDismissKeyboard = true, ...rest }) => {
|
|
15
|
+
var _a;
|
|
16
|
+
const pickerRef = React.useRef(null);
|
|
45
17
|
const [pickerVisible, setPickerVisible] = React.useState(false);
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
|
|
18
|
+
const options = React.useMemo(() => {
|
|
19
|
+
const normalizedOptions = normalizeToPickerOptions(optionsProp);
|
|
20
|
+
// Underlying Picker component defaults selection to first element when value is not provided (or undefined)
|
|
21
|
+
// Placholder must be the 1st option in order to allow selection of the 'actual' 1st option
|
|
22
|
+
if (placeholder) {
|
|
23
|
+
return [{ label: placeholder, value: placeholder }, ...normalizedOptions];
|
|
52
24
|
}
|
|
53
|
-
else
|
|
54
|
-
|
|
25
|
+
else {
|
|
26
|
+
return normalizedOptions;
|
|
55
27
|
}
|
|
56
|
-
}, [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
28
|
+
}, [placeholder, optionsProp]);
|
|
29
|
+
// When no placeholder is provided then first item should be marked selected to reflect underlying Picker internal state
|
|
30
|
+
if (!placeholder && options.length && !value && value !== options[0].value) {
|
|
31
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(options[0].value);
|
|
32
|
+
}
|
|
33
|
+
const selectedLabel = ((_a = options.find((option) => option.value === String(value))) === null || _a === void 0 ? void 0 : _a.label) ||
|
|
34
|
+
value ||
|
|
35
|
+
placeholder;
|
|
36
|
+
const containerStyle = StyleSheet.flatten([
|
|
37
|
+
extractSizeStyles(style),
|
|
38
|
+
extractPositionStyles(style),
|
|
39
|
+
extractFlexItemStyles(style),
|
|
40
|
+
extractBorderAndMarginStyles(style).marginStyles,
|
|
41
|
+
]);
|
|
42
|
+
const textFieldStyle = omit(style, Object.keys(containerStyle));
|
|
43
|
+
const renderNativePicker = () => (React.createElement(NativePicker, { ref: pickerRef, selectedValue: value, onValueChange: (newValue) => {
|
|
44
|
+
if (newValue !== placeholder) {
|
|
45
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue);
|
|
46
|
+
}
|
|
47
|
+
else if (newValue === placeholder) {
|
|
48
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange("");
|
|
49
|
+
}
|
|
50
|
+
}, style: [
|
|
51
|
+
styles.nativePicker,
|
|
52
|
+
isIos ? styles.iosNativePicker : styles.nonIosPicker,
|
|
53
|
+
], onBlur: () => setPickerVisible(false) }, options.map((option) => (React.createElement(NativePicker.Item, { label: option.label, value: option.value, key: option.value })))));
|
|
54
|
+
const renderPicker = () => {
|
|
55
|
+
if (isIos) {
|
|
56
|
+
return (React.createElement(Portal, null,
|
|
57
|
+
React.createElement(SafeAreaView, { style: styles.nativePicker },
|
|
58
|
+
React.createElement(View, { style: styles.iosPickerContent },
|
|
59
|
+
React.createElement(Button, { Icon: Icon, type: "text", onPress: () => setPickerVisible(!pickerVisible), style: styles.iosButton }, "Close"),
|
|
60
|
+
renderNativePicker()))));
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return renderNativePicker();
|
|
60
64
|
}
|
|
61
|
-
}
|
|
65
|
+
};
|
|
62
66
|
React.useEffect(() => {
|
|
63
67
|
var _a;
|
|
64
|
-
if (pickerVisible &&
|
|
65
|
-
(_a =
|
|
68
|
+
if (pickerVisible && pickerRef.current) {
|
|
69
|
+
(_a = pickerRef === null || pickerRef === void 0 ? void 0 : pickerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
66
70
|
}
|
|
67
|
-
}, [pickerVisible,
|
|
71
|
+
}, [pickerVisible, pickerRef]);
|
|
68
72
|
React.useEffect(() => {
|
|
69
73
|
if (pickerVisible && autoDismissKeyboard) {
|
|
70
74
|
Keyboard.dismiss();
|
|
71
75
|
}
|
|
72
76
|
}, [pickerVisible, autoDismissKeyboard]);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
? [{ label: placeholder, value: placeholder }, ...normalizedOptions]
|
|
78
|
-
: normalizedOptions, [placeholder, normalizedOptions]);
|
|
79
|
-
//When no placeholder is provided then first item should be marked selected to reflect underlying Picker internal state
|
|
80
|
-
if (!placeholder &&
|
|
81
|
-
pickerOptions.length &&
|
|
82
|
-
!internalValue &&
|
|
83
|
-
internalValue !== pickerOptions[0].value //Prevent infinite state changes incase first value is falsy
|
|
84
|
-
) {
|
|
85
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(pickerOptions[0].value, 0);
|
|
86
|
-
setInternalValue(pickerOptions[0].value);
|
|
87
|
-
}
|
|
88
|
-
const { viewStyles, textStyles } = extractStyles(style);
|
|
89
|
-
const additionalBorderStyles = ["backgroundColor"];
|
|
90
|
-
const additionalMarginStyles = [
|
|
91
|
-
"bottom",
|
|
92
|
-
"height",
|
|
93
|
-
"left",
|
|
94
|
-
"maxHeight",
|
|
95
|
-
"maxWidth",
|
|
96
|
-
"minHeight",
|
|
97
|
-
"minWidth",
|
|
98
|
-
"overflow",
|
|
99
|
-
"position",
|
|
100
|
-
"right",
|
|
101
|
-
"top",
|
|
102
|
-
"width",
|
|
103
|
-
"zIndex",
|
|
104
|
-
];
|
|
105
|
-
const { borderStyles: extractedBorderStyles, marginStyles: extractedMarginStyles, } = extractBorderAndMarginStyles(viewStyles, additionalBorderStyles, additionalMarginStyles);
|
|
106
|
-
const borderStyles = {
|
|
107
|
-
...{
|
|
108
|
-
...(type === "solid"
|
|
109
|
-
? {
|
|
110
|
-
borderTopLeftRadius: 5,
|
|
111
|
-
borderTopRightRadius: 5,
|
|
112
|
-
borderBottomRightRadius: 5,
|
|
113
|
-
borderBottomLeftRadius: 5,
|
|
114
|
-
borderTopWidth: 1,
|
|
115
|
-
borderRightWidth: 1,
|
|
116
|
-
borderLeftWidth: 1,
|
|
117
|
-
}
|
|
118
|
-
: {}),
|
|
119
|
-
borderBottomWidth: 1,
|
|
120
|
-
borderColor: unstyledColor,
|
|
121
|
-
borderStyle: "solid",
|
|
122
|
-
},
|
|
123
|
-
...extractedBorderStyles,
|
|
124
|
-
...(error ? { borderColor: errorColor } : {}),
|
|
125
|
-
...(disabled
|
|
126
|
-
? { borderColor: "transparent", backgroundColor: disabledColor }
|
|
127
|
-
: {}),
|
|
128
|
-
};
|
|
129
|
-
const marginStyles = {
|
|
130
|
-
height: 60,
|
|
131
|
-
...extractedMarginStyles,
|
|
132
|
-
};
|
|
133
|
-
const stylesWithoutBordersAndMargins = omit(viewStyles, [
|
|
134
|
-
...borderStyleNames,
|
|
135
|
-
...marginStyleNames,
|
|
136
|
-
...additionalBorderStyles,
|
|
137
|
-
...additionalMarginStyles,
|
|
138
|
-
]);
|
|
139
|
-
const selectedLabel = internalValue &&
|
|
140
|
-
((_b = (_a = pickerOptions.find((option) => option.value === internalValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : internalValue);
|
|
141
|
-
const labelText = label ? (React.createElement(Text, { style: {
|
|
142
|
-
textAlign: textStyles.textAlign,
|
|
143
|
-
color: unstyledColor,
|
|
144
|
-
fontSize: 12,
|
|
145
|
-
paddingBottom: 4,
|
|
146
|
-
} }, label)) : null;
|
|
147
|
-
const leftIconOutset = leftIconMode === "outset";
|
|
148
|
-
const leftIcon = leftIconName ? (React.createElement(Icon, { name: leftIconName, color: disabled ? unstyledColor : iconColor, size: iconSize, style: {
|
|
149
|
-
marginRight: 4,
|
|
150
|
-
marginLeft: 4,
|
|
151
|
-
} })) : null;
|
|
152
|
-
const rightIcon = rightIconName ? (React.createElement(Icon, { name: rightIconName, color: disabled ? unstyledColor : iconColor, size: iconSize, style: {
|
|
153
|
-
marginRight: -10,
|
|
154
|
-
marginLeft: 8,
|
|
155
|
-
} })) : null;
|
|
156
|
-
const textAlign = textStyles === null || textStyles === void 0 ? void 0 : textStyles.textAlign;
|
|
157
|
-
const calculateLeftPadding = () => {
|
|
158
|
-
if (leftIconOutset) {
|
|
159
|
-
if (textAlign === "center") {
|
|
160
|
-
return iconSize - Math.abs(8 - iconSize);
|
|
161
|
-
}
|
|
162
|
-
return iconSize + 8;
|
|
163
|
-
}
|
|
164
|
-
return 0;
|
|
165
|
-
};
|
|
166
|
-
const assistiveTextLabel = assistiveText ? (React.createElement(Text, { style: {
|
|
167
|
-
textAlign,
|
|
168
|
-
width: "100%",
|
|
169
|
-
paddingLeft: calculateLeftPadding(),
|
|
170
|
-
color: unstyledColor,
|
|
171
|
-
fontSize: 12,
|
|
172
|
-
paddingTop: 4,
|
|
173
|
-
} }, assistiveText)) : null;
|
|
174
|
-
const primaryTextStyle = {
|
|
175
|
-
color: unstyledColor,
|
|
176
|
-
fontSize: 14,
|
|
177
|
-
...pickBy(textStyles, identity),
|
|
178
|
-
...(placeholder === internalValue ? { color: placeholderTextColor } : {}),
|
|
179
|
-
...(disabled ? { color: unstyledColor } : {}),
|
|
180
|
-
};
|
|
181
|
-
const handleValueChange = (newValue, itemIndex) => {
|
|
182
|
-
if (newValue !== "" && newValue !== placeholder) {
|
|
183
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
|
|
184
|
-
setInternalValue(newValue);
|
|
185
|
-
}
|
|
186
|
-
else if (newValue === placeholder) {
|
|
187
|
-
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange("", 0);
|
|
188
|
-
setInternalValue(undefined);
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
return (
|
|
192
|
-
/* marginsContainer */
|
|
193
|
-
React.createElement(View, { style: [styles.marginsContainer, marginStyles] },
|
|
194
|
-
React.createElement(Touchable, { disabled: disabled, onPress: togglePickerVisible, style: styles.touchableContainer },
|
|
195
|
-
React.createElement(View, { pointerEvents: "none", style: [
|
|
196
|
-
styles.outsetContainer,
|
|
197
|
-
stylesWithoutBordersAndMargins,
|
|
198
|
-
!leftIconOutset ? borderStyles : {},
|
|
199
|
-
] },
|
|
200
|
-
leftIcon,
|
|
201
|
-
React.createElement(View, { style: [
|
|
202
|
-
styles.insetContainer,
|
|
203
|
-
leftIconOutset ? borderStyles : {},
|
|
204
|
-
] },
|
|
205
|
-
React.createElement(View, { style: styles.primaryTextContainer },
|
|
206
|
-
labelText,
|
|
207
|
-
React.createElement(Text, { style: primaryTextStyle }, String(selectedLabel !== null && selectedLabel !== void 0 ? selectedLabel : placeholder))),
|
|
208
|
-
rightIcon)),
|
|
209
|
-
assistiveTextLabel),
|
|
210
|
-
isIos && pickerVisible ? (React.createElement(Portal, null,
|
|
211
|
-
React.createElement(SafeAreaView, { style: styles.iosPicker },
|
|
212
|
-
React.createElement(View, { style: styles.iosPickerContent },
|
|
213
|
-
React.createElement(Button, { Icon: Icon, type: "text", onPress: togglePickerVisible, style: styles.iosButton }, "Close"),
|
|
214
|
-
React.createElement(NativePicker, { style: styles.iosNativePicker, selectedValue: internalValue, onValueChange: handleValueChange }, pickerOptions.map((option) => (React.createElement(NativePicker.Item, { label: option.label, value: option.value, key: option.value })))))))) : null,
|
|
215
|
-
!isIos && (pickerVisible || isWeb) ? (React.createElement(NativePicker, { enabled: !disabled, selectedValue: internalValue, onValueChange: handleValueChange, style: styles.nonIosPicker, ref: androidPickerRef, onBlur: () => setPickerVisible(false) }, pickerOptions.map((option) => (React.createElement(NativePicker.Item, { label: option.label, value: option.value, key: option.value }))))) : null));
|
|
77
|
+
return (React.createElement(View, { style: containerStyle },
|
|
78
|
+
React.createElement(Touchable, { disabled: disabled, onPress: () => setPickerVisible(!pickerVisible) },
|
|
79
|
+
React.createElement(TextField, { Icon: Icon, numberOfLines: 1, onChangeText: () => { }, value: String(selectedLabel !== null && selectedLabel !== void 0 ? selectedLabel : placeholder), editable: false, disabled: disabled, style: textFieldStyle, ...rest })),
|
|
80
|
+
(pickerVisible || isWeb) && renderPicker()));
|
|
216
81
|
};
|
|
217
82
|
const styles = StyleSheet.create({
|
|
218
|
-
|
|
219
|
-
alignSelf: "stretch",
|
|
220
|
-
alignItems: "center",
|
|
221
|
-
width: "100%",
|
|
222
|
-
maxWidth: deviceWidth,
|
|
223
|
-
},
|
|
224
|
-
touchableContainer: {
|
|
225
|
-
flex: 1,
|
|
226
|
-
height: "100%",
|
|
227
|
-
width: "100%",
|
|
228
|
-
alignSelf: "stretch",
|
|
229
|
-
alignItems: "center",
|
|
230
|
-
},
|
|
231
|
-
outsetContainer: {
|
|
232
|
-
flex: 1,
|
|
233
|
-
height: "100%",
|
|
234
|
-
width: "100%",
|
|
235
|
-
flexDirection: "row",
|
|
236
|
-
alignItems: "center",
|
|
237
|
-
justifyContent: "space-between",
|
|
238
|
-
},
|
|
239
|
-
insetContainer: {
|
|
240
|
-
flex: 1,
|
|
241
|
-
height: "100%",
|
|
242
|
-
width: "100%",
|
|
243
|
-
flexDirection: "row",
|
|
244
|
-
alignItems: "center",
|
|
245
|
-
justifyContent: "space-between",
|
|
246
|
-
paddingLeft: 12,
|
|
247
|
-
paddingRight: 12,
|
|
248
|
-
},
|
|
249
|
-
primaryTextContainer: {
|
|
250
|
-
flex: 1,
|
|
251
|
-
},
|
|
252
|
-
iosPicker: {
|
|
83
|
+
nativePicker: {
|
|
253
84
|
position: "absolute",
|
|
254
85
|
bottom: 0,
|
|
255
86
|
left: 0,
|
|
@@ -257,14 +88,11 @@ const styles = StyleSheet.create({
|
|
|
257
88
|
flexDirection: "row",
|
|
258
89
|
justifyContent: "center",
|
|
259
90
|
width: "100%",
|
|
260
|
-
maxWidth: deviceWidth,
|
|
261
|
-
maxHeight: deviceHeight,
|
|
262
91
|
backgroundColor: "white",
|
|
263
92
|
},
|
|
264
93
|
iosPickerContent: {
|
|
265
94
|
flexDirection: "column",
|
|
266
95
|
width: "100%",
|
|
267
|
-
maxWidth: deviceWidth,
|
|
268
96
|
},
|
|
269
97
|
iosButton: {
|
|
270
98
|
alignSelf: "flex-end",
|
|
@@ -274,15 +102,28 @@ const styles = StyleSheet.create({
|
|
|
274
102
|
},
|
|
275
103
|
nonIosPicker: {
|
|
276
104
|
opacity: 0,
|
|
277
|
-
position: "absolute",
|
|
278
|
-
top: 0,
|
|
279
|
-
left: 0,
|
|
280
|
-
right: 0,
|
|
281
|
-
bottom: 0,
|
|
282
|
-
width: "100%",
|
|
283
|
-
maxWidth: deviceWidth,
|
|
284
|
-
maxHeight: deviceHeight,
|
|
285
105
|
},
|
|
286
106
|
});
|
|
287
|
-
|
|
107
|
+
function normalizeToPickerOptions(options) {
|
|
108
|
+
if (options.length === 0) {
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
const firstOption = options[0];
|
|
112
|
+
if (typeof firstOption === ("string" || "number")) {
|
|
113
|
+
return options.map((option) => ({
|
|
114
|
+
label: String(option),
|
|
115
|
+
value: String(option),
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
if (isObject(firstOption) && firstOption.value && firstOption.label) {
|
|
119
|
+
return options.map((option) => {
|
|
120
|
+
return {
|
|
121
|
+
label: String(option.label),
|
|
122
|
+
value: String(option.value),
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
throw new Error('Picker options must be either an array of strings or array of { "label": string; "value": string; } objects.');
|
|
127
|
+
}
|
|
128
|
+
export default Picker;
|
|
288
129
|
//# sourceMappingURL=Picker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QACP,KAAK,EAAE,CAAC;QACR,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,QAAQ;QACxB,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,WAAW;QACrB,SAAS,EAAE,YAAY;QACvB,eAAe,EAAE,OAAO;KACzB;IACD,gBAAgB,EAAE;QAChB,aAAa,EAAE,QAAQ;QACvB,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,WAAW;KACtB;IACD,SAAS,EAAE;QACT,SAAS,EAAE,UAAU;KACtB;IACD,eAAe,EAAE;QACf,eAAe,EAAE,OAAO;KACzB;IACD,YAAY,EAAE;QACZ,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,WAAW;QACrB,SAAS,EAAE,YAAY;KACxB;CACF,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC,MAAM,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"Picker.js","sourceRoot":"","sources":["../../../../../src/components/Picker/Picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,IAAI,EACJ,UAAU,EACV,QAAQ,EAGR,QAAQ,GACT,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EACL,4BAA4B,EAC5B,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,GAC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CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,KAAK,EAAE;QACnE,OAAQ,OAA0B,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YAChD,OAAO;gBACL,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;aAC5B,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IAED,MAAM,IAAI,KAAK,CACb,8GAA8G,CAC/G,CAAC;AACJ,CAAC;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -10,6 +10,7 @@ interface AdditionalSectionListProps<T> {
|
|
|
10
10
|
index: number;
|
|
11
11
|
section: string;
|
|
12
12
|
}) => JSX.Element;
|
|
13
|
+
keyExtractor?: (item: T, index: number) => string;
|
|
13
14
|
listComponent?: ListComponentType;
|
|
14
15
|
}
|
|
15
16
|
declare type FlatListSectionListProps<T> = Omit<FlatListProps<T>, "renderItem"> & AdditionalSectionListProps<T>;
|
|
@@ -17,5 +18,5 @@ declare type FlashListSectionListProps<T> = Omit<FlashListProps<T>, "renderItem"
|
|
|
17
18
|
export declare const DEFAULT_SECTION = "Uncategorized";
|
|
18
19
|
declare const SectionList: <T extends {
|
|
19
20
|
[key: string]: any;
|
|
20
|
-
}>({ sectionKey, stickyHeader, listComponent, data: dataProp, renderItem: renderItemProp, ...rest }: FlatListSectionListProps<T> | FlashListSectionListProps<T>) => JSX.Element;
|
|
21
|
+
}>({ sectionKey, stickyHeader, listComponent, data: dataProp, renderItem: renderItemProp, keyExtractor: keyExtractorProp, ...rest }: FlatListSectionListProps<T> | FlashListSectionListProps<T>) => JSX.Element;
|
|
21
22
|
export default SectionList;
|