@draftbit/core 48.4.7 → 48.4.8-2d93ad.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.
Files changed (71) hide show
  1. package/lib/commonjs/components/Picker/Picker.js +1 -1
  2. package/lib/commonjs/components/Picker/PickerInputContainer.js +1 -0
  3. package/lib/commonjs/components/SectionList/SectionList.js +1 -1
  4. package/lib/commonjs/components/TextField.js +1 -1
  5. package/lib/commonjs/utilities.js +1 -1
  6. package/lib/typescript/src/components/Picker/Picker.d.ts +3 -35
  7. package/lib/typescript/src/components/Picker/Picker.js +69 -244
  8. package/lib/typescript/src/components/Picker/Picker.js.map +1 -1
  9. package/lib/typescript/src/components/Picker/PickerCommon.d.ts +27 -0
  10. package/lib/typescript/src/components/Picker/PickerCommon.js +2 -0
  11. package/lib/typescript/src/components/Picker/PickerCommon.js.map +1 -0
  12. package/lib/typescript/src/components/Picker/PickerInputContainer.d.ts +9 -0
  13. package/lib/typescript/src/components/Picker/PickerInputContainer.js +26 -0
  14. package/lib/typescript/src/components/Picker/PickerInputContainer.js.map +1 -0
  15. package/lib/typescript/src/components/SectionList/SectionList.d.ts +2 -1
  16. package/lib/typescript/src/components/SectionList/SectionList.js +13 -3
  17. package/lib/typescript/src/components/SectionList/SectionList.js.map +1 -1
  18. package/lib/typescript/src/components/TextField.d.ts +3 -3
  19. package/lib/typescript/src/components/TextField.js +9 -6
  20. package/lib/typescript/src/components/TextField.js.map +1 -1
  21. package/lib/typescript/src/utilities.d.ts +4 -0
  22. package/lib/typescript/src/utilities.js +15 -1
  23. package/lib/typescript/src/utilities.js.map +1 -1
  24. package/lib/typescript/tsconfig.tsbuildinfo +1 -1
  25. package/package.json +5 -3
  26. package/src/components/Picker/Picker.js +69 -244
  27. package/src/components/Picker/Picker.js.map +1 -1
  28. package/src/components/Picker/Picker.tsx +111 -441
  29. package/src/components/Picker/PickerCommon.js +2 -0
  30. package/src/components/Picker/PickerCommon.js.map +1 -0
  31. package/src/components/Picker/PickerCommon.ts +30 -0
  32. package/src/components/Picker/PickerInputContainer.js +26 -0
  33. package/src/components/Picker/PickerInputContainer.js.map +1 -0
  34. package/src/components/Picker/PickerInputContainer.tsx +74 -0
  35. package/src/components/SectionList/SectionList.js +13 -3
  36. package/src/components/SectionList/SectionList.js.map +1 -1
  37. package/src/components/SectionList/SectionList.tsx +15 -0
  38. package/src/components/TextField.js +9 -6
  39. package/src/components/TextField.js.map +1 -1
  40. package/src/components/TextField.tsx +14 -8
  41. package/src/utilities.js +15 -1
  42. package/src/utilities.js.map +1 -1
  43. package/src/utilities.ts +22 -1
  44. package/lib/commonjs/components/Picker/PickerComponent.android.js +0 -1
  45. package/lib/commonjs/components/Picker/PickerComponent.ios.js +0 -1
  46. package/lib/commonjs/components/Picker/PickerComponent.web.js +0 -1
  47. package/lib/typescript/src/components/Picker/PickerComponent.android.d.ts +0 -6
  48. package/lib/typescript/src/components/Picker/PickerComponent.android.js +0 -70
  49. package/lib/typescript/src/components/Picker/PickerComponent.android.js.map +0 -1
  50. package/lib/typescript/src/components/Picker/PickerComponent.ios.d.ts +0 -7
  51. package/lib/typescript/src/components/Picker/PickerComponent.ios.js +0 -80
  52. package/lib/typescript/src/components/Picker/PickerComponent.ios.js.map +0 -1
  53. package/lib/typescript/src/components/Picker/PickerComponent.web.d.ts +0 -6
  54. package/lib/typescript/src/components/Picker/PickerComponent.web.js +0 -71
  55. package/lib/typescript/src/components/Picker/PickerComponent.web.js.map +0 -1
  56. package/lib/typescript/src/components/Picker/PickerTypes.d.ts +0 -18
  57. package/lib/typescript/src/components/Picker/PickerTypes.js +0 -2
  58. package/lib/typescript/src/components/Picker/PickerTypes.js.map +0 -1
  59. package/src/components/Picker/PickerComponent.android.js +0 -70
  60. package/src/components/Picker/PickerComponent.android.js.map +0 -1
  61. package/src/components/Picker/PickerComponent.android.tsx +0 -116
  62. package/src/components/Picker/PickerComponent.ios.js +0 -80
  63. package/src/components/Picker/PickerComponent.ios.js.map +0 -1
  64. package/src/components/Picker/PickerComponent.ios.tsx +0 -142
  65. package/src/components/Picker/PickerComponent.web.js +0 -71
  66. package/src/components/Picker/PickerComponent.web.js.map +0 -1
  67. package/src/components/Picker/PickerComponent.web.tsx +0 -117
  68. package/src/components/Picker/PickerTypes.js +0 -2
  69. package/src/components/Picker/PickerTypes.js.map +0 -1
  70. package/src/components/Picker/PickerTypes.ts +0 -18
  71. /package/lib/commonjs/components/Picker/{PickerTypes.js → PickerCommon.js} +0 -0
@@ -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 _utilities=require("../../utilities");var _PickerInputContainer=_interopRequireDefault(require("./PickerInputContainer"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["options","onValueChange","Icon","placeholder","value","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 _ref$options=_ref.options,optionsProp=_ref$options===void 0?[]:_ref$options,_onValueChange=_ref.onValueChange,Icon=_ref.Icon,placeholder=_ref.placeholder,value=_ref.value,_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=(0,_utilities.useDeepCompareMemo)(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 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.toString(),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.jsx)(_PickerInputContainer.default,Object.assign({Icon:Icon,placeholder:placeholder,selectedValue:value,options:options,onPress:function onPress(){return setPickerVisible(!pickerVisible);}},rest,{children:(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:option,value:option};});}if((0,_lodash.isObject)(firstOption)&&firstOption.value&&firstOption.label){return options.map(function(option){return{label:option.label,value:option.value};});}throw new Error('Picker options must be either an array of strings, numbers, or an array of { "label": string | number; "value": string | number; } objects.');}var _default=Picker;exports.default=_default;
@@ -0,0 +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 _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _lodash=_interopRequireDefault(require("lodash.omit"));var _utilities=require("../../utilities");var _TextField=_interopRequireDefault(require("../TextField"));var _Touchable=_interopRequireDefault(require("../Touchable"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["options","onPress","Icon","style","placeholder","selectedValue","disabled","children"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Picker/PickerInputContainer.tsx";var PickerInputContainer=function PickerInputContainer(_ref){var _options$find;var _ref$options=_ref.options,options=_ref$options===void 0?[]:_ref$options,onPress=_ref.onPress,Icon=_ref.Icon,style=_ref.style,placeholder=_ref.placeholder,selectedValue=_ref.selectedValue,_ref$disabled=_ref.disabled,disabled=_ref$disabled===void 0?false:_ref$disabled,children=_ref.children,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);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,_lodash.default)(_reactNative.StyleSheet.flatten(style),Object.keys(containerStyle));var selectedLabel=((_options$find=options.find(function(option){return option.value===selectedValue;}))==null?void 0:_options$find.label.toString())||selectedValue||placeholder;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:containerStyle,children:[(0,_jsxRuntime.jsx)(_Touchable.default,{disabled:disabled,onPress:onPress,children:(0,_jsxRuntime.jsx)(_TextField.default,Object.assign({Icon:Icon,numberOfLines:1,onChangeText:function onChangeText(){},value:selectedLabel==null?void 0:selectedLabel.toString(),editable:false,disabled:disabled,style:textFieldStyle},rest))}),children]});};var _default=PickerInputContainer;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 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);}}};switch(listComponent){case"FlatList":return(0,_jsxRuntime.jsx)(_reactNative.FlatList,Object.assign({stickyHeaderIndices:sectionHeaderIndicies},rest,{data:dataWithSections,renderItem:renderItem}));case"FlashList":return(0,_jsxRuntime.jsx)(_flashList.FlashList,Object.assign({stickyHeaderIndices:sectionHeaderIndicies},rest,{data:dataWithSections,renderItem:renderItem}));}};var _default=SectionList;exports.default=_default;
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 +1 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.applyStyles=applyStyles;exports.effectsStyleNames=exports.borderStyleNames=void 0;exports.extractBorderAndMarginStyles=extractBorderAndMarginStyles;exports.extractEffectStyles=extractEffectStyles;exports.extractFlexItemStyles=extractFlexItemStyles;exports.extractPositionStyles=extractPositionStyles;exports.extractSizeStyles=extractSizeStyles;exports.extractStyles=extractStyles;exports.flattenReactFragments=flattenReactFragments;exports.flexItemStyleNames=void 0;exports.getValueForRadioButton=getValueForRadioButton;exports.sizeStyleNames=exports.positionStyleNames=exports.marginStyleNames=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _lodash=require("lodash");var _excluded=["color","fontFamily","fontWeight","fontSize","lineHeight","letterSpacing","textTransform","textAlign","textDecorationLine","textDecorationColor","textDecorationStyle"];function extractStyles(style){var _StyleSheet$flatten=_reactNative.StyleSheet.flatten(style||{}),color=_StyleSheet$flatten.color,fontFamily=_StyleSheet$flatten.fontFamily,fontWeight=_StyleSheet$flatten.fontWeight,fontSize=_StyleSheet$flatten.fontSize,lineHeight=_StyleSheet$flatten.lineHeight,letterSpacing=_StyleSheet$flatten.letterSpacing,textTransform=_StyleSheet$flatten.textTransform,textAlign=_StyleSheet$flatten.textAlign,textDecorationLine=_StyleSheet$flatten.textDecorationLine,textDecorationColor=_StyleSheet$flatten.textDecorationColor,textDecorationStyle=_StyleSheet$flatten.textDecorationStyle,viewStyles=(0,_objectWithoutProperties2.default)(_StyleSheet$flatten,_excluded);var textStyles={color:color,fontFamily:fontFamily,fontWeight:fontWeight,fontSize:fontSize,lineHeight:lineHeight,letterSpacing:letterSpacing,textTransform:textTransform,textAlign:textAlign,textDecorationLine:textDecorationLine,textDecorationColor:textDecorationColor,textDecorationStyle:textDecorationStyle};for(var key in textStyles){var styleKey=key;if(textStyles[styleKey]===undefined){delete textStyles[styleKey];}}return{viewStyles:viewStyles,textStyles:textStyles};}var borderStyleNames=["borderRadius","borderBottomColor","borderBottomEndRadius","borderBottomLeftRadius","borderBottomRightRadius","borderBottomStartRadius","borderBottomWidth","borderColor","borderEndColor","borderLeftColor","borderLeftWidth","borderRadius","borderRightColor","borderRightWidth","borderStartColor","borderStyle","borderTopColor","borderTopEndRadius","borderTopLeftRadius","borderTopRightRadius","borderTopStartRadius","borderTopWidth","borderWidth"];exports.borderStyleNames=borderStyleNames;var marginStyleNames=["margin","marginBottom","marginEnd","marginHorizontal","marginLeft","marginRight","marginStart","marginTop","marginVertical"];exports.marginStyleNames=marginStyleNames;function extractBorderAndMarginStyles(style,additionalBorderStyles,additionalMarginStyles){var flatStyle=_reactNative.StyleSheet.flatten(style||{});var borderStyles=(0,_lodash.pickBy)((0,_lodash.pick)(flatStyle,[].concat(borderStyleNames,(0,_toConsumableArray2.default)(additionalBorderStyles?additionalBorderStyles:[]))),_lodash.identity);var marginStyles=(0,_lodash.pickBy)((0,_lodash.pick)(flatStyle,[].concat(marginStyleNames,(0,_toConsumableArray2.default)(additionalMarginStyles?additionalMarginStyles:[]))),_lodash.identity);return{borderStyles:borderStyles,marginStyles:marginStyles};}var flexItemStyleNames=["alignSelf","flexBasis","flexShrink","flexGrow","flex"];exports.flexItemStyleNames=flexItemStyleNames;function extractFlexItemStyles(style,additionalFlexItemStyles){var flatStyle=_reactNative.StyleSheet.flatten(style||{});var flexItemStyles=(0,_lodash.pickBy)((0,_lodash.pick)(flatStyle,[].concat(flexItemStyleNames,(0,_toConsumableArray2.default)(additionalFlexItemStyles?additionalFlexItemStyles:[]))),_lodash.identity);return flexItemStyles;}var positionStyleNames=["position","left","right","top","bottom","zIndex","overflow"];exports.positionStyleNames=positionStyleNames;function extractPositionStyles(style,additionalPositionStyles){var flatStyle=_reactNative.StyleSheet.flatten(style||{});var positionStyles=(0,_lodash.pickBy)((0,_lodash.pick)(flatStyle,[].concat(positionStyleNames,(0,_toConsumableArray2.default)(additionalPositionStyles?additionalPositionStyles:[]))),_lodash.identity);return positionStyles;}var effectsStyleNames=["opacity","elevation"];exports.effectsStyleNames=effectsStyleNames;function extractEffectStyles(style,additionalEffectStyles){var flatStyle=_reactNative.StyleSheet.flatten(style||{});var effectStyles=(0,_lodash.pickBy)((0,_lodash.pick)(flatStyle,[].concat(effectsStyleNames,(0,_toConsumableArray2.default)(additionalEffectStyles?additionalEffectStyles:[]))),_lodash.identity);return effectStyles;}var sizeStyleNames=["width","height","minWidth","minHeight"];exports.sizeStyleNames=sizeStyleNames;function extractSizeStyles(style,additionalSizeStyles){var flatStyle=_reactNative.StyleSheet.flatten(style||{});var sizeStyles=(0,_lodash.pickBy)((0,_lodash.pick)(flatStyle,[].concat(sizeStyleNames,(0,_toConsumableArray2.default)(additionalSizeStyles?additionalSizeStyles:[]))),_lodash.identity);return sizeStyles;}function applyStyles(baseStyles,stylesToApply){if(!stylesToApply){return;}var flattenedStyles=_reactNative.StyleSheet.flatten(baseStyles);for(var _ref of Object.entries(stylesToApply)){var _ref2=(0,_slicedToArray2.default)(_ref,2);var key=_ref2[0];var value=_ref2[1];if(value!=null){flattenedStyles[key]=value;}}return flattenedStyles;}function getValueForRadioButton(value){if((0,_lodash.isString)(value)){return value;}else if((0,_lodash.isNumber)(value)){return String(value);}else{throw new Error("Invalid value: "+value);}}function flattenReactFragments(components){var flattened=[];for(var component of components){if(component.type===_react.default.Fragment){var _component$props;var children=_react.default.Children.toArray((_component$props=component.props)==null?void 0:_component$props.children);for(var child of children){flattened.push.apply(flattened,(0,_toConsumableArray2.default)(flattenReactFragments([child])));}}else{flattened.push(component);}}return flattened;}
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.applyStyles=applyStyles;exports.effectsStyleNames=exports.borderStyleNames=void 0;exports.extractBorderAndMarginStyles=extractBorderAndMarginStyles;exports.extractEffectStyles=extractEffectStyles;exports.extractFlexItemStyles=extractFlexItemStyles;exports.extractPositionStyles=extractPositionStyles;exports.extractSizeStyles=extractSizeStyles;exports.extractStyles=extractStyles;exports.flattenReactFragments=flattenReactFragments;exports.flexItemStyleNames=void 0;exports.getValueForRadioButton=getValueForRadioButton;exports.sizeStyleNames=exports.positionStyleNames=exports.marginStyleNames=void 0;exports.useDeepCompareMemo=useDeepCompareMemo;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _lodash=require("lodash");var _excluded=["color","fontFamily","fontWeight","fontSize","lineHeight","letterSpacing","textTransform","textAlign","textDecorationLine","textDecorationColor","textDecorationStyle"];function extractStyles(style){var _StyleSheet$flatten=_reactNative.StyleSheet.flatten(style||{}),color=_StyleSheet$flatten.color,fontFamily=_StyleSheet$flatten.fontFamily,fontWeight=_StyleSheet$flatten.fontWeight,fontSize=_StyleSheet$flatten.fontSize,lineHeight=_StyleSheet$flatten.lineHeight,letterSpacing=_StyleSheet$flatten.letterSpacing,textTransform=_StyleSheet$flatten.textTransform,textAlign=_StyleSheet$flatten.textAlign,textDecorationLine=_StyleSheet$flatten.textDecorationLine,textDecorationColor=_StyleSheet$flatten.textDecorationColor,textDecorationStyle=_StyleSheet$flatten.textDecorationStyle,viewStyles=(0,_objectWithoutProperties2.default)(_StyleSheet$flatten,_excluded);var textStyles={color:color,fontFamily:fontFamily,fontWeight:fontWeight,fontSize:fontSize,lineHeight:lineHeight,letterSpacing:letterSpacing,textTransform:textTransform,textAlign:textAlign,textDecorationLine:textDecorationLine,textDecorationColor:textDecorationColor,textDecorationStyle:textDecorationStyle};for(var key in textStyles){var styleKey=key;if(textStyles[styleKey]===undefined){delete textStyles[styleKey];}}return{viewStyles:viewStyles,textStyles:textStyles};}var borderStyleNames=["borderRadius","borderBottomColor","borderBottomEndRadius","borderBottomLeftRadius","borderBottomRightRadius","borderBottomStartRadius","borderBottomWidth","borderColor","borderEndColor","borderLeftColor","borderLeftWidth","borderRadius","borderRightColor","borderRightWidth","borderStartColor","borderStyle","borderTopColor","borderTopEndRadius","borderTopLeftRadius","borderTopRightRadius","borderTopStartRadius","borderTopWidth","borderWidth"];exports.borderStyleNames=borderStyleNames;var marginStyleNames=["margin","marginBottom","marginEnd","marginHorizontal","marginLeft","marginRight","marginStart","marginTop","marginVertical"];exports.marginStyleNames=marginStyleNames;function extractBorderAndMarginStyles(style,additionalBorderStyles,additionalMarginStyles){var flatStyle=_reactNative.StyleSheet.flatten(style||{});var borderStyles=(0,_lodash.pickBy)((0,_lodash.pick)(flatStyle,[].concat(borderStyleNames,(0,_toConsumableArray2.default)(additionalBorderStyles?additionalBorderStyles:[]))),_lodash.identity);var marginStyles=(0,_lodash.pickBy)((0,_lodash.pick)(flatStyle,[].concat(marginStyleNames,(0,_toConsumableArray2.default)(additionalMarginStyles?additionalMarginStyles:[]))),_lodash.identity);return{borderStyles:borderStyles,marginStyles:marginStyles};}var flexItemStyleNames=["alignSelf","flexBasis","flexShrink","flexGrow","flex"];exports.flexItemStyleNames=flexItemStyleNames;function extractFlexItemStyles(style,additionalFlexItemStyles){var flatStyle=_reactNative.StyleSheet.flatten(style||{});var flexItemStyles=(0,_lodash.pickBy)((0,_lodash.pick)(flatStyle,[].concat(flexItemStyleNames,(0,_toConsumableArray2.default)(additionalFlexItemStyles?additionalFlexItemStyles:[]))),_lodash.identity);return flexItemStyles;}var positionStyleNames=["position","left","right","top","bottom","zIndex","overflow"];exports.positionStyleNames=positionStyleNames;function extractPositionStyles(style,additionalPositionStyles){var flatStyle=_reactNative.StyleSheet.flatten(style||{});var positionStyles=(0,_lodash.pickBy)((0,_lodash.pick)(flatStyle,[].concat(positionStyleNames,(0,_toConsumableArray2.default)(additionalPositionStyles?additionalPositionStyles:[]))),_lodash.identity);return positionStyles;}var effectsStyleNames=["opacity","elevation"];exports.effectsStyleNames=effectsStyleNames;function extractEffectStyles(style,additionalEffectStyles){var flatStyle=_reactNative.StyleSheet.flatten(style||{});var effectStyles=(0,_lodash.pickBy)((0,_lodash.pick)(flatStyle,[].concat(effectsStyleNames,(0,_toConsumableArray2.default)(additionalEffectStyles?additionalEffectStyles:[]))),_lodash.identity);return effectStyles;}var sizeStyleNames=["width","height","minWidth","minHeight"];exports.sizeStyleNames=sizeStyleNames;function extractSizeStyles(style,additionalSizeStyles){var flatStyle=_reactNative.StyleSheet.flatten(style||{});var sizeStyles=(0,_lodash.pickBy)((0,_lodash.pick)(flatStyle,[].concat(sizeStyleNames,(0,_toConsumableArray2.default)(additionalSizeStyles?additionalSizeStyles:[]))),_lodash.identity);return sizeStyles;}function applyStyles(baseStyles,stylesToApply){if(!stylesToApply){return;}var flattenedStyles=_reactNative.StyleSheet.flatten(baseStyles);for(var _ref of Object.entries(stylesToApply)){var _ref2=(0,_slicedToArray2.default)(_ref,2);var key=_ref2[0];var value=_ref2[1];if(value!=null){flattenedStyles[key]=value;}}return flattenedStyles;}function getValueForRadioButton(value){if((0,_lodash.isString)(value)){return value;}else if((0,_lodash.isNumber)(value)){return String(value);}else{throw new Error("Invalid value: "+value);}}function flattenReactFragments(components){var flattened=[];for(var component of components){if(component.type===_react.default.Fragment){var _component$props;var children=_react.default.Children.toArray((_component$props=component.props)==null?void 0:_component$props.children);for(var child of children){flattened.push.apply(flattened,(0,_toConsumableArray2.default)(flattenReactFragments([child])));}}else{flattened.push(component);}}return flattened;}function useDeepCompareMemoize(value){var ref=_react.default.useRef();if(!(0,_lodash.isEqual)(value,ref.current)){ref.current=value;}return ref.current;}function useDeepCompareMemo(factory,deps){return _react.default.useMemo(factory,deps==null?void 0:deps.map(useDeepCompareMemoize));}
@@ -1,36 +1,4 @@
1
1
  import * as React from "react";
2
- import { ViewStyle, StyleProp } from "react-native";
3
- import type { Theme } from "../../styles/DefaultTheme";
4
- import type { IconSlot } from "../../interfaces/Icon";
5
- export interface PickerOption {
6
- value: string;
7
- label: string;
8
- }
9
- export declare type PickerProps = {
10
- error?: any;
11
- placeholder?: string;
12
- disabled?: boolean;
13
- style?: StyleProp<ViewStyle> & {
14
- height?: number;
15
- };
16
- value?: string;
17
- options: PickerOption[] | string[];
18
- onValueChange: (value: string, index: number) => void;
19
- defaultValue?: string;
20
- assistiveText?: string;
21
- label?: string;
22
- iconColor?: string;
23
- iconSize?: number;
24
- leftIconMode?: "inset" | "outset";
25
- leftIconName?: string;
26
- placeholderTextColor?: string;
27
- rightIconName?: string;
28
- type?: "solid" | "underline";
29
- autoDismissKeyboard?: boolean;
30
- theme: Theme;
31
- Icon: IconSlot["Icon"];
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;
2
+ import { PickerProps } from "./PickerCommon";
3
+ declare const Picker: React.FC<PickerProps>;
4
+ export default Picker;
@@ -1,255 +1,70 @@
1
1
  import * as React from "react";
2
- import { View, StyleSheet, Text, Platform, Dimensions, Keyboard, } from "react-native";
3
- import { omit, pickBy, identity, isObject } from "lodash";
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 "../../deprecated-components/DeprecatedButton";
9
- import Touchable from "../Touchable";
10
- import { extractStyles, extractBorderAndMarginStyles, borderStyleNames, marginStyleNames, } from "../../utilities";
11
- function normalizeOptions(options) {
12
- if (options.length === 0) {
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");
7
+ import { Button } from "../Button";
8
+ import { useDeepCompareMemo } from "../../utilities";
9
+ import PickerInputContainer from "./PickerInputContainer";
34
10
  const isIos = Platform.OS === "ios";
35
11
  const isWeb = Platform.OS === "web";
36
- const unstyledColor = "rgba(165, 173, 183, 1)";
37
- const disabledColor = "rgb(240, 240, 240)";
38
- const errorColor = "rgba(255, 69, 100, 1)";
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);
12
+ const Picker = ({ options: optionsProp = [], onValueChange, Icon, placeholder, value, autoDismissKeyboard = true, ...rest }) => {
13
+ const pickerRef = React.useRef(null);
45
14
  const [pickerVisible, setPickerVisible] = React.useState(false);
46
- const togglePickerVisible = () => {
47
- setPickerVisible(!pickerVisible);
48
- };
49
- React.useEffect(() => {
50
- if (value != null && value !== "") {
51
- setInternalValue(value);
15
+ const options = useDeepCompareMemo(() => {
16
+ const normalizedOptions = normalizeToPickerOptions(optionsProp);
17
+ // Underlying Picker component defaults selection to first element when value is not provided (or undefined)
18
+ // Placholder must be the 1st option in order to allow selection of the 'actual' 1st option
19
+ if (placeholder) {
20
+ return [{ label: placeholder, value: placeholder }, ...normalizedOptions];
52
21
  }
53
- else if (value === "") {
54
- setInternalValue(undefined);
22
+ else {
23
+ return normalizedOptions;
55
24
  }
56
- }, [value]);
57
- React.useEffect(() => {
58
- if (defaultValue != null && defaultValue !== "") {
59
- setInternalValue(defaultValue);
25
+ }, [placeholder, optionsProp]);
26
+ // When no placeholder is provided then first item should be marked selected to reflect underlying Picker internal state
27
+ if (!placeholder && options.length && !value && value !== options[0].value) {
28
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(options[0].value);
29
+ }
30
+ const renderNativePicker = () => (React.createElement(NativePicker, { ref: pickerRef, selectedValue: value, onValueChange: (newValue) => {
31
+ if (newValue !== placeholder) {
32
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue);
33
+ }
34
+ else if (newValue === placeholder) {
35
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange("");
36
+ }
37
+ }, style: [
38
+ styles.nativePicker,
39
+ isIos ? styles.iosNativePicker : styles.nonIosPicker,
40
+ ], onBlur: () => setPickerVisible(false) }, options.map((option) => (React.createElement(NativePicker.Item, { label: option.label.toString(), value: option.value, key: option.value })))));
41
+ const renderPicker = () => {
42
+ if (isIos) {
43
+ return (React.createElement(Portal, null,
44
+ React.createElement(SafeAreaView, { style: styles.nativePicker },
45
+ React.createElement(View, { style: styles.iosPickerContent },
46
+ React.createElement(Button, { Icon: Icon, type: "text", onPress: () => setPickerVisible(!pickerVisible), style: styles.iosButton }, "Close"),
47
+ renderNativePicker()))));
48
+ }
49
+ else {
50
+ return renderNativePicker();
60
51
  }
61
- }, [defaultValue]);
52
+ };
62
53
  React.useEffect(() => {
63
54
  var _a;
64
- if (pickerVisible && androidPickerRef.current) {
65
- (_a = androidPickerRef === null || androidPickerRef === void 0 ? void 0 : androidPickerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
55
+ if (pickerVisible && pickerRef.current) {
56
+ (_a = pickerRef === null || pickerRef === void 0 ? void 0 : pickerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
66
57
  }
67
- }, [pickerVisible, androidPickerRef]);
58
+ }, [pickerVisible, pickerRef]);
68
59
  React.useEffect(() => {
69
60
  if (pickerVisible && autoDismissKeyboard) {
70
61
  Keyboard.dismiss();
71
62
  }
72
63
  }, [pickerVisible, autoDismissKeyboard]);
73
- const normalizedOptions = React.useMemo(() => normalizeOptions(options), [options]);
74
- //Underlying Picker component defaults selection to first element when value is not provided (or undefined)
75
- //Placholder must be the 1st option in order to allow selection of the 'actual' 1st option
76
- const pickerOptions = React.useMemo(() => placeholder
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));
64
+ return (React.createElement(PickerInputContainer, { Icon: Icon, placeholder: placeholder, selectedValue: value, options: options, onPress: () => setPickerVisible(!pickerVisible), ...rest }, (pickerVisible || isWeb) && renderPicker()));
216
65
  };
217
66
  const styles = StyleSheet.create({
218
- marginsContainer: {
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: {
67
+ nativePicker: {
253
68
  position: "absolute",
254
69
  bottom: 0,
255
70
  left: 0,
@@ -257,14 +72,11 @@ const styles = StyleSheet.create({
257
72
  flexDirection: "row",
258
73
  justifyContent: "center",
259
74
  width: "100%",
260
- maxWidth: deviceWidth,
261
- maxHeight: deviceHeight,
262
75
  backgroundColor: "white",
263
76
  },
264
77
  iosPickerContent: {
265
78
  flexDirection: "column",
266
79
  width: "100%",
267
- maxWidth: deviceWidth,
268
80
  },
269
81
  iosButton: {
270
82
  alignSelf: "flex-end",
@@ -274,15 +86,28 @@ const styles = StyleSheet.create({
274
86
  },
275
87
  nonIosPicker: {
276
88
  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
89
  },
286
90
  });
287
- export default withTheme(Picker);
91
+ function normalizeToPickerOptions(options) {
92
+ if (options.length === 0) {
93
+ return [];
94
+ }
95
+ const firstOption = options[0];
96
+ if (typeof firstOption === ("string" || "number")) {
97
+ return options.map((option) => ({
98
+ label: option,
99
+ value: option,
100
+ }));
101
+ }
102
+ if (isObject(firstOption) && firstOption.value && firstOption.label) {
103
+ return options.map((option) => {
104
+ return {
105
+ label: option.label,
106
+ value: option.value,
107
+ };
108
+ });
109
+ }
110
+ throw new Error('Picker options must be either an array of strings, numbers, or an array of { "label": string | number; "value": string | number; } objects.');
111
+ }
112
+ export default Picker;
288
113
  //# sourceMappingURL=Picker.js.map
@@ -1 +1 @@
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,IAAI,EACJ,QAAQ,EAGR,UAAU,EACV,QAAQ,GACT,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,MAAM,MAAM,8CAA8C,CAAC;AAClE,OAAO,SAAS,MAAM,cAAc,CAAC;AAGrC,OAAO,EACL,aAAa,EACb,4BAA4B,EAC5B,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AA8BzB,SAAS,gBAAgB,CAAC,OAA+B;IACvD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,OAAO,EAAE,CAAC;KACX;IAED,IAAI,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,CA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ACD,cAAc,EAAE;QACd,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;QACb,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,eAAe;QAC/B,WAAW,EAAE,EAAE;QACf,YAAY,EAAE,EAAE;KACjB;IACD,oBAAoB,EAAE;QACpB,IAAI,EAAE,CAAC;KACR;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,CAAC;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,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE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