@draftbit/core 48.6.2 → 49.0.1-5261a6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +1 -1
- package/lib/commonjs/components/Config.js +1 -1
- package/lib/commonjs/components/DatePicker/DatePicker.js +1 -1
- package/lib/commonjs/components/Progress/CircularProgress/CircularProgress.js +1 -1
- package/lib/commonjs/components/Progress/IndeterminateProgress.js +1 -1
- package/lib/commonjs/components/Progress/LinearProgress/LinearProgress.js +1 -1
- package/lib/commonjs/components/SectionList/SectionList.js +1 -1
- package/lib/commonjs/components/StepIndicator.js +1 -1
- package/lib/commonjs/utilities.js +1 -1
- package/lib/typescript/src/Provider.d.ts +1 -1
- package/lib/typescript/src/components/AccordionGroup.d.ts +1 -1
- package/lib/typescript/src/components/ActionSheet/ActionSheet.d.ts +1 -1
- package/lib/typescript/src/components/BottomSheet/BottomSheet.d.ts +5 -3
- package/lib/typescript/src/components/BottomSheet/BottomSheet.js +56 -47
- package/lib/typescript/src/components/BottomSheet/BottomSheet.js.map +1 -1
- package/lib/typescript/src/components/DatePicker/DatePickerComponent.web.d.ts +2574 -2223
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts +1 -1
- package/lib/typescript/src/components/FormRow.d.ts +1 -1
- package/lib/typescript/src/components/Image.js +1 -1
- package/lib/typescript/src/components/Image.js.map +1 -1
- package/lib/typescript/src/components/Portal/Portal.d.ts +1 -1
- package/lib/typescript/src/components/Portal/PortalHost.d.ts +1 -1
- package/lib/typescript/src/components/Portal/PortalManager.d.ts +1 -1
- package/lib/typescript/src/components/Pressable.d.ts +2 -2
- package/lib/typescript/src/components/ScreenContainer.d.ts +1 -1
- package/lib/typescript/src/components/SectionList/SectionHeader.d.ts +1 -1
- package/lib/typescript/src/components/SectionList/SectionList.d.ts +2 -2
- package/lib/typescript/src/components/Slider.d.ts +1 -1
- package/lib/typescript/src/components/StepIndicator.d.ts +7 -7
- package/lib/typescript/src/components/SwipeableItem/SwipeableList.d.ts +1 -1
- package/lib/typescript/src/components/Swiper/Swiper.d.ts +1 -1
- package/lib/typescript/src/components/Swiper/SwiperItem.d.ts +1 -1
- package/lib/typescript/src/components/Switch.d.ts +2 -2
- package/lib/typescript/src/components/Table/Table.d.ts +1 -1
- package/lib/typescript/src/components/Text.d.ts +1 -1
- package/lib/typescript/src/components/TextField.d.ts +1 -1
- package/lib/typescript/src/components/Touchable.d.ts +2 -2
- package/lib/typescript/src/components/Typography.d.ts +3 -3
- package/lib/typescript/src/deprecated-components/AccordionItem.d.ts +1 -1
- package/lib/typescript/src/deprecated-components/Card.d.ts +1 -1
- package/lib/typescript/src/deprecated-components/CircularProgress.d.ts +1 -1
- package/lib/typescript/src/deprecated-components/Layout.d.ts +6 -6
- package/lib/typescript/src/deprecated-components/ProgressBar.d.ts +1 -1
- package/lib/typescript/src/deprecated-components/ProgressBar.js.map +1 -1
- package/lib/typescript/src/styles/DefaultTheme.d.ts +858 -741
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -10
- package/src/components/BottomSheet/BottomSheet.js +56 -47
- package/src/components/BottomSheet/BottomSheet.js.map +1 -1
- package/src/components/BottomSheet/BottomSheet.tsx +82 -73
- package/src/components/Image.js +1 -1
- package/src/components/Image.js.map +1 -1
- package/src/components/Image.tsx +10 -1
- package/src/deprecated-components/ProgressBar.js.map +1 -1
- package/src/deprecated-components/ProgressBar.tsx +1 -1
- package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js +0 -1
- package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.d.ts +0 -169
- package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.js +0 -438
- package/lib/typescript/src/components/BottomSheet/BottomSheetComponent.js.map +0 -1
- package/src/components/BottomSheet/BottomSheetComponent.js +0 -438
- package/src/components/BottomSheet/BottomSheetComponent.js.map +0 -1
- package/src/components/BottomSheet/BottomSheetComponent.tsx +0 -895
|
@@ -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 _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var
|
|
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 _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _bottomSheet=_interopRequireWildcard(require("@gorhom/bottom-sheet"));var _theming=require("../../theming");var _utilities=require("../../utilities");var _jsxRuntime=require("react/jsx-runtime");var _excluded=["theme","snapPoints","topSnapPosition","middleSnapPosition","bottomSnapPosition","initialSnapIndex","initialSnapPosition","showHandle","handleColor","topBorderRadius","borderWidth","borderColor","onSettle","style","children"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/BottomSheet/BottomSheet.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 windowHeight=_reactNative.Dimensions.get("window").height;var BottomSheet=_react.default.forwardRef(function(_ref,ref){var theme=_ref.theme,snapPointsProp=_ref.snapPoints,_ref$topSnapPosition=_ref.topSnapPosition,topSnapPosition=_ref$topSnapPosition===void 0?"10%":_ref$topSnapPosition,_ref$middleSnapPositi=_ref.middleSnapPosition,middleSnapPosition=_ref$middleSnapPositi===void 0?"50%":_ref$middleSnapPositi,_ref$bottomSnapPositi=_ref.bottomSnapPosition,bottomSnapPosition=_ref$bottomSnapPositi===void 0?"80%":_ref$bottomSnapPositi,initialSnapIndex=_ref.initialSnapIndex,_ref$initialSnapPosit=_ref.initialSnapPosition,initialSnapPosition=_ref$initialSnapPosit===void 0?"bottom":_ref$initialSnapPosit,_ref$showHandle=_ref.showHandle,showHandle=_ref$showHandle===void 0?true:_ref$showHandle,_ref$handleColor=_ref.handleColor,handleColor=_ref$handleColor===void 0?theme.colors.divider:_ref$handleColor,_ref$topBorderRadius=_ref.topBorderRadius,topBorderRadius=_ref$topBorderRadius===void 0?20:_ref$topBorderRadius,_ref$borderWidth=_ref.borderWidth,borderWidth=_ref$borderWidth===void 0?1:_ref$borderWidth,_ref$borderColor=_ref.borderColor,borderColor=_ref$borderColor===void 0?theme.colors.divider:_ref$borderColor,onSettle=_ref.onSettle,style=_ref.style,children=_ref.children,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);var backgroundColor=(style==null?void 0:style.backgroundColor)||theme.colors.background;var snapPoints=snapPointsProp!=null?snapPointsProp:[topSnapPosition,middleSnapPosition,bottomSnapPosition];var mappedSnapPoints=(0,_utilities.useDeepCompareMemo)(function(){return convertSnapPointsForNewImplementation(snapPoints);},snapPoints);var getSnapIndexFromPosition=function getSnapIndexFromPosition(position){switch(position){case"bottom":return 0;case"middle":return 1;case"top":return 2;}};return(0,_jsxRuntime.jsx)(_bottomSheet.default,{ref:ref,snapPoints:mappedSnapPoints,index:initialSnapIndex!=undefined?mappedSnapPoints.length-initialSnapIndex-1:getSnapIndexFromPosition(initialSnapPosition),handleIndicatorStyle:[{backgroundColor:handleColor},!showHandle?{display:"none"}:{}],backgroundStyle:{backgroundColor:backgroundColor,borderTopLeftRadius:topBorderRadius,borderTopRightRadius:topBorderRadius,borderWidth:borderWidth,borderColor:borderColor},onChange:function onChange(index){return onSettle==null?void 0:onSettle(mappedSnapPoints.length-index-1);},children:(0,_jsxRuntime.jsx)(_bottomSheet.BottomSheetScrollView,Object.assign({contentContainerStyle:[styles.contentContainerStyle,style]},rest,{children:children}))});});function convertSnapPointsForNewImplementation(snapPoints){var reversedSnapPoints=(0,_toConsumableArray2.default)(snapPoints).reverse();return reversedSnapPoints.map(function(point){if(typeof point==="string"){var percentNumber=extractPercentNumber(point);if(percentNumber!==undefined){return`${100-percentNumber}%`;}return point;}else if(typeof point==="number"){return windowHeight-point;}else{return point;}});}function extractPercentNumber(percentString){var percentRegex=/(\d+)?%/;var matches=percentString.match(percentRegex);if(matches!=null&&matches.length){var percentNumber=Number(matches[1]);if(!isNaN(percentNumber)){return percentNumber;}}return undefined;}var styles=_reactNative.StyleSheet.create({contentContainerStyle:{paddingHorizontal:16,paddingVertical:10}});var _default=(0,_theming.withTheme)(BottomSheet);exports.default=_default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactNative=require("react-native");var getWindowDimensions=function getWindowDimensions(){var _Dimensions$get=_reactNative.Dimensions.get("window"),width=_Dimensions$get.width,height=_Dimensions$get.height;return{windowWidth:width,windowHeight:height};};var _getWindowDimensions=getWindowDimensions(),windowWidth=_getWindowDimensions.windowWidth,windowHeight=_getWindowDimensions.windowHeight;var getFilters=function getFilters(options){var width=options.width,height=options.height;var filters=["c_scale","q_auto","dpr_auto"];if(width)filters.push(
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactNative=require("react-native");var getWindowDimensions=function getWindowDimensions(){var _Dimensions$get=_reactNative.Dimensions.get("window"),width=_Dimensions$get.width,height=_Dimensions$get.height;return{windowWidth:width,windowHeight:height};};var _getWindowDimensions=getWindowDimensions(),windowWidth=_getWindowDimensions.windowWidth,windowHeight=_getWindowDimensions.windowHeight;var getFilters=function getFilters(options){var width=options.width,height=options.height;var filters=["c_scale","q_auto","dpr_auto"];if(width)filters.push(`w_${width}`);if(height)filters.push(`h_${height}`);return filters.join(",");};var buildImageUrl=function buildImageUrl(options,name){var filters=getFilters(options);return["https://res.cloudinary.com/altos/image/upload",filters,`${name}.png`].join("/");};var getExtension=function getExtension(){return _reactNative.Platform.OS==="web"?".svg":".png";};var _default={windowWidth:windowWidth,windowHeight:windowHeight,avatarImageUrl:buildImageUrl({width:60,height:60},"Avatar"),avatarImageSize:60,cardImageSize:200,cardImageUrl:"https://static.draftbit.com/images/placeholder-image"+getExtension(),cardIconSize:16,cardIconBackgroundOpacity:0.24,cardIconElevation:1,placeholderImageURL:"https://static.draftbit.com/images/placeholder-image"+getExtension(),getPlaceholderImageUrl:function getPlaceholderImageUrl(size){return buildImageUrl({width:size.width,height:size.height},"image-placeholder_1");},placeholderSvgURL:"https://static.draftbit.com/images/placeholder-image.svg",squareImageUrl:buildImageUrl({width:100,height:100},"Avatar"),FABSize:40,FABBorderRadius:20,FABFixedHeight:64,cardContainerShortImageAspectRatio:1,rowSingleLineImageSize:24,rowMultiLineImageSize:48,rowSingleLineIconSize:24,rowMultiLineIconSize:16,headerIconSize:24,buttonIconSize:24,swiperInactiveDotSize:6,swiperActiveDotSize:10,fieldSearchBarFullIconSize:24,stepperButtonSize:40,radioButtonSize:24,topSafeAreaViewHeight:0};exports.default=_default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var React=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeSafeAreaContext=require("react-native-safe-area-context");var _dateformat=_interopRequireDefault(require("dateformat"));var _theming=require("../../theming");var _Portal=_interopRequireDefault(require("../Portal/Portal"));var _Touchable=_interopRequireDefault(require("../Touchable"));var _DatePickerComponent=_interopRequireDefault(require("./DatePickerComponent"));var _utilities=require("../../utilities");var _jsxRuntime=require("react/jsx-runtime");var _excluded=["Icon","style","theme","date","onDateChange","defaultValue","disabled","mode","format","type","leftIconName","rightIconName","leftIconMode","label","labelSize","labelColor","placeholder","borderColor","borderColorActive","autoDismissKeyboard","minimumDate","maximumDate"],_excluded2=["lineHeight"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/DatePicker/DatePicker.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 AnimatedText=_reactNative.Animated.createAnimatedComponent(_reactNative.Text);var FOCUS_ANIMATION_DURATION=150;var BLUR_ANIMATION_DURATION=180;var ICON_SIZE=24;var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];var DatePicker=function DatePicker(_ref){var Icon=_ref.Icon,style=_ref.style,_ref$theme=_ref.theme,colors=_ref$theme.colors,typography=_ref$theme.typography,roundness=_ref$theme.roundness,disabledOpacity=_ref$theme.disabledOpacity,date=_ref.date,_ref$onDateChange=_ref.onDateChange,onDateChange=_ref$onDateChange===void 0?function(){}:_ref$onDateChange,defaultValue=_ref.defaultValue,_ref$disabled=_ref.disabled,disabled=_ref$disabled===void 0?false:_ref$disabled,_ref$mode=_ref.mode,mode=_ref$mode===void 0?"date":_ref$mode,format=_ref.format,_ref$type=_ref.type,type=_ref$type===void 0?"underline":_ref$type,leftIconName=_ref.leftIconName,rightIconName=_ref.rightIconName,_ref$leftIconMode=_ref.leftIconMode,leftIconMode=_ref$leftIconMode===void 0?"inset":_ref$leftIconMode,label=_ref.label,labelSize=_ref.labelSize,labelColor=_ref.labelColor,placeholder=_ref.placeholder,inputBorderColor=_ref.borderColor,inputBorderColorActive=_ref.borderColorActive,_ref$autoDismissKeybo=_ref.autoDismissKeyboard,autoDismissKeyboard=_ref$autoDismissKeybo===void 0?true:_ref$autoDismissKeybo,minimumDate=_ref.minimumDate,maximumDate=_ref.maximumDate,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var _React$useState=React.useState(parseDate(date)||parseDate(defaultValue)),_React$useState2=(0,_slicedToArray2.default)(_React$useState,2),value=_React$useState2[0],setValue=_React$useState2[1];React.useEffect(function(){if(defaultValue!=null){setValue(parseDate(defaultValue));}},[defaultValue]);var _React$useState3=React.useState(false),_React$useState4=(0,_slicedToArray2.default)(_React$useState3,2),pickerVisible=_React$useState4[0],setPickerVisible=_React$useState4[1];var _React$useState5=React.useState(new _reactNative.Animated.Value(date?0:1)),_React$useState6=(0,_slicedToArray2.default)(_React$useState5,1),labeled=_React$useState6[0];var _React$useState7=React.useState(""),_React$useState8=(0,_slicedToArray2.default)(_React$useState7,2),placeholder1=_React$useState8[0],setPlaceholder1=_React$useState8[1];var _React$useState9=React.useState(false),_React$useState10=(0,_slicedToArray2.default)(_React$useState9,2),focused=_React$useState10[0],setFocused=_React$useState10[1];var _React$useState11=React.useState({measured:false,width:0}),_React$useState12=(0,_slicedToArray2.default)(_React$useState11,2),labelLayout=_React$useState12[0],setLabelLayout=_React$useState12[1];var _extractStyles=(0,_utilities.extractStyles)(style),viewStyles=_extractStyles.viewStyles,textStyles=_extractStyles.textStyles;var getValidDate=function getValidDate(){if(!value){return new Date();}return typeof(value==null?void 0:value.getMonth)==="function"?value:new Date();};var formatDate=function formatDate(){if(!value)return"";var newDate=getValidDate();if(format)return(0,_dateformat.default)(newDate,format);if(mode==="time"){return""+newDate.toLocaleTimeString();}if(mode==="datetime"){return""+newDate.toLocaleString();}return MONTHS[newDate.getMonth()]+" "+newDate.getDate()+", "+newDate.getFullYear();};var toggleVisibility=function(){var _ref2=(0,_asyncToGenerator2.default)(function*(){setPickerVisible(!pickerVisible);focused?_handleBlur():_handleFocus();});return function toggleVisibility(){return _ref2.apply(this,arguments);};}();var insets=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)();var _hidePlaceholder=function _hidePlaceholder(){setPlaceholder1("");};React.useEffect(function(){setValue(parseDate(date));},[date]);React.useEffect(function(){if(value||focused||placeholder1){_reactNative.Animated.timing(labeled,{toValue:0,duration:BLUR_ANIMATION_DURATION,useNativeDriver:_reactNative.Platform.OS!=="web"}).start();}else{_reactNative.Animated.timing(labeled,{toValue:1,duration:FOCUS_ANIMATION_DURATION,useNativeDriver:_reactNative.Platform.OS!=="web"}).start();}},[value,focused,placeholder1,labeled]);React.useEffect(function(){var _showPlaceholder=function _showPlaceholder(){return setTimeout(function(){return setPlaceholder1(placeholder||"");},50);};if(focused||!label){_showPlaceholder();}else{_hidePlaceholder();}return function(){clearTimeout(_showPlaceholder());};},[focused,label,placeholder]);React.useEffect(function(){if(pickerVisible&&autoDismissKeyboard){_reactNative.Keyboard.dismiss();}},[pickerVisible,autoDismissKeyboard]);var _handleFocus=function _handleFocus(){if(disabled){return;}setFocused(true);};var _handleBlur=function _handleBlur(){if(disabled){return;}setFocused(false);};var MINIMIZED_LABEL_Y_OFFSET=-(typography.caption.lineHeight+4);var OUTLINE_MINIMIZED_LABEL_Y_OFFSET=-(16*0.5+4);var MAXIMIZED_LABEL_FONT_SIZE=textStyles.fontSize||typography.subtitle1.fontSize;var MINIMIZED_LABEL_FONT_SIZE=labelSize?labelSize:typography.caption.fontSize;var hasActiveOutline=focused;var inputTextColor,activeColor,underlineColor,borderColor=inputBorderColor,placeholderColor,containerStyle,backgroundColor,inputStyle;inputTextColor=colors.strong;if(disabled){activeColor=colors.light;placeholderColor=colors.light;borderColor="transparent";underlineColor="transparent";backgroundColor=colors.divider;}else{activeColor=inputBorderColorActive||colors.primary;placeholderColor=inputBorderColor||colors.light;underlineColor=inputBorderColor||colors.light;backgroundColor=colors.background;}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+(type==="solid"?16:12):0,paddingRight:rightIconName?ICON_SIZE+16+4:12},subtitle1,{height:lineHeight});if(type==="underline"){containerStyle={borderTopLeftRadius:roundness,borderTopRightRadius:roundness,paddingBottom:12,marginTop:16};}else{containerStyle={borderRadius:roundness,borderColor:hasActiveOutline?activeColor:borderColor,borderWidth:1,paddingTop:labeled?16*1.5:16,paddingBottom:labeled?16*0.5:16,opacity:disabled?disabledOpacity:1,backgroundColor:backgroundColor};inputStyle.paddingHorizontal=12;}if(leftIconName&&leftIconMode==="outset"){containerStyle.marginLeft=ICON_SIZE+8;}var leftIconColor;if(focused){leftIconColor=colors.primary;}else{leftIconColor=colors.light;}var leftIconProps={size:24,color:leftIconColor,name:leftIconName||""};var leftIconStyle={position:"absolute",top:0,marginTop:type==="solid"?leftIconMode==="inset"?MINIMIZED_LABEL_FONT_SIZE+4:16:leftIconMode==="outset"?16:0};var labelStyle=Object.assign({},typography.subtitle1,{top:type==="solid"?16:0,fontFamily:textStyles==null?void 0:textStyles.fontFamily,left:leftIconName&&leftIconMode==="inset"?ICON_SIZE+(type==="solid"?16:12):0,transform:[{translateY:labeled.interpolate({inputRange:[0,1],outputRange:[type==="solid"?OUTLINE_MINIMIZED_LABEL_Y_OFFSET:MINIMIZED_LABEL_Y_OFFSET,0]})},{scale:labeled.interpolate({inputRange:[0,1],outputRange:[MINIMIZED_LABEL_FONT_SIZE/MAXIMIZED_LABEL_FONT_SIZE,1]})},{translateX:labeled.interpolate({inputRange:[0,1],outputRange:[-(1-MINIMIZED_LABEL_FONT_SIZE/MAXIMIZED_LABEL_FONT_SIZE)*(labelLayout.width/2),0]})}]});var inputStyles=[styles.input,inputStyle,type==="solid"?{marginHorizontal:12}:{}];return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,style],children:[(0,_jsxRuntime.jsx)(_Touchable.default,{disabled:disabled,onPress:toggleVisibility,children:(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,style],children:[leftIconName&&leftIconMode==="outset"?(0,_jsxRuntime.jsx)(Icon,Object.assign({},leftIconProps,{style:leftIconStyle})):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[containerStyle,style?{height:style.height}:{},viewStyles],children:[type==="underline"?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.underline,{backgroundColor:focused?activeColor:underlineColor,transform:[{scaleY:focused?1:0.5}]}]}):null,label?(0,_jsxRuntime.jsxs)(_reactNative.View,{pointerEvents:"none",style:[_reactNative.StyleSheet.absoluteFill,{opacity:date||focused?labelLayout.measured?1:0:1}],children:[(0,_jsxRuntime.jsx)(AnimatedText,{onLayout:function onLayout(e){return setLabelLayout({width:e.nativeEvent.layout.width,measured:true});},style:[styles.placeholder,type==="solid"?{paddingHorizontal:12}:{},labelStyle,{color:labelColor||colors.light,opacity: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:labelColor||placeholderColor,opacity:hasActiveOutline?labeled:1}],numberOfLines:1,children:label})]}):null,leftIconName&&leftIconMode==="inset"?(0,_jsxRuntime.jsx)(Icon,Object.assign({},leftIconProps,{style:Object.assign({},leftIconStyle,{marginLeft:type==="solid"?16:0})})):null,(0,_jsxRuntime.jsx)(_reactNative.TextInput,Object.assign({value:formatDate(),placeholder:label?placeholder1:placeholder,editable:!disabled,placeholderTextColor:placeholderColor,selectionColor:activeColor,onFocus:_handleFocus,onBlur:_handleBlur,underlineColorAndroid:"transparent",style:[inputStyles,textStyles]},props))]}),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]})})}),pickerVisible&&(0,_jsxRuntime.jsx)(_Portal.default,{children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.picker,{backgroundColor:colors.divider}],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.pickerContainer,{paddingTop:insets.top,paddingBottom:insets.bottom,paddingLeft:insets.left,paddingRight:insets.right}],children:(0,_jsxRuntime.jsx)(_DatePickerComponent.default,{value:getValidDate(),mode:mode,isVisible:pickerVisible,toggleVisibility:toggleVisibility,minimumDate:parseDate(minimumDate),maximumDate:parseDate(maximumDate),onChange:function onChange(_event,data){toggleVisibility();setValue(data);onDateChange(data);}})})})})]});};var styles=_reactNative.StyleSheet.create({container:{alignSelf:"stretch"},picker:{position:"absolute",bottom:0,left:0,right:0,flexDirection:"row",justifyContent:"center"},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"},placeholder:{position:"absolute",left:0},pickerContainer:{flexDirection:"column",width:"100%",zIndex:100},closeButton:{alignSelf:"flex-end"}});function parseDate(date){if(typeof date==="string"){var parsed=Date.parse(date);if(!isNaN(parsed)){return new Date(parsed);}console.warn("Invalid date string:","'"+date+"'.","See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format");return undefined;}return date;}var _default=(0,_theming.withTheme)(DatePicker);exports.default=_default;
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var React=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeSafeAreaContext=require("react-native-safe-area-context");var _dateformat=_interopRequireDefault(require("dateformat"));var _theming=require("../../theming");var _Portal=_interopRequireDefault(require("../Portal/Portal"));var _Touchable=_interopRequireDefault(require("../Touchable"));var _DatePickerComponent=_interopRequireDefault(require("./DatePickerComponent"));var _utilities=require("../../utilities");var _jsxRuntime=require("react/jsx-runtime");var _excluded=["Icon","style","theme","date","onDateChange","defaultValue","disabled","mode","format","type","leftIconName","rightIconName","leftIconMode","label","labelSize","labelColor","placeholder","borderColor","borderColorActive","autoDismissKeyboard","minimumDate","maximumDate"],_excluded2=["lineHeight"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/DatePicker/DatePicker.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 AnimatedText=_reactNative.Animated.createAnimatedComponent(_reactNative.Text);var FOCUS_ANIMATION_DURATION=150;var BLUR_ANIMATION_DURATION=180;var ICON_SIZE=24;var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];var DatePicker=function DatePicker(_ref){var Icon=_ref.Icon,style=_ref.style,_ref$theme=_ref.theme,colors=_ref$theme.colors,typography=_ref$theme.typography,roundness=_ref$theme.roundness,disabledOpacity=_ref$theme.disabledOpacity,date=_ref.date,_ref$onDateChange=_ref.onDateChange,onDateChange=_ref$onDateChange===void 0?function(){}:_ref$onDateChange,defaultValue=_ref.defaultValue,_ref$disabled=_ref.disabled,disabled=_ref$disabled===void 0?false:_ref$disabled,_ref$mode=_ref.mode,mode=_ref$mode===void 0?"date":_ref$mode,format=_ref.format,_ref$type=_ref.type,type=_ref$type===void 0?"underline":_ref$type,leftIconName=_ref.leftIconName,rightIconName=_ref.rightIconName,_ref$leftIconMode=_ref.leftIconMode,leftIconMode=_ref$leftIconMode===void 0?"inset":_ref$leftIconMode,label=_ref.label,labelSize=_ref.labelSize,labelColor=_ref.labelColor,placeholder=_ref.placeholder,inputBorderColor=_ref.borderColor,inputBorderColorActive=_ref.borderColorActive,_ref$autoDismissKeybo=_ref.autoDismissKeyboard,autoDismissKeyboard=_ref$autoDismissKeybo===void 0?true:_ref$autoDismissKeybo,minimumDate=_ref.minimumDate,maximumDate=_ref.maximumDate,props=(0,_objectWithoutProperties2.default)(_ref,_excluded);var _React$useState=React.useState(parseDate(date)||parseDate(defaultValue)),_React$useState2=(0,_slicedToArray2.default)(_React$useState,2),value=_React$useState2[0],setValue=_React$useState2[1];React.useEffect(function(){if(defaultValue!=null){setValue(parseDate(defaultValue));}},[defaultValue]);var _React$useState3=React.useState(false),_React$useState4=(0,_slicedToArray2.default)(_React$useState3,2),pickerVisible=_React$useState4[0],setPickerVisible=_React$useState4[1];var _React$useState5=React.useState(new _reactNative.Animated.Value(date?0:1)),_React$useState6=(0,_slicedToArray2.default)(_React$useState5,1),labeled=_React$useState6[0];var _React$useState7=React.useState(""),_React$useState8=(0,_slicedToArray2.default)(_React$useState7,2),placeholder1=_React$useState8[0],setPlaceholder1=_React$useState8[1];var _React$useState9=React.useState(false),_React$useState10=(0,_slicedToArray2.default)(_React$useState9,2),focused=_React$useState10[0],setFocused=_React$useState10[1];var _React$useState11=React.useState({measured:false,width:0}),_React$useState12=(0,_slicedToArray2.default)(_React$useState11,2),labelLayout=_React$useState12[0],setLabelLayout=_React$useState12[1];var _extractStyles=(0,_utilities.extractStyles)(style),viewStyles=_extractStyles.viewStyles,textStyles=_extractStyles.textStyles;var getValidDate=function getValidDate(){if(!value){return new Date();}return typeof(value==null?void 0:value.getMonth)==="function"?value:new Date();};var formatDate=function formatDate(){if(!value)return"";var newDate=getValidDate();if(format)return(0,_dateformat.default)(newDate,format);if(mode==="time"){return`${newDate.toLocaleTimeString()}`;}if(mode==="datetime"){return`${newDate.toLocaleString()}`;}return`${MONTHS[newDate.getMonth()]} ${newDate.getDate()}, ${newDate.getFullYear()}`;};var toggleVisibility=function(){var _ref2=(0,_asyncToGenerator2.default)(function*(){setPickerVisible(!pickerVisible);focused?_handleBlur():_handleFocus();});return function toggleVisibility(){return _ref2.apply(this,arguments);};}();var insets=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)();var _hidePlaceholder=function _hidePlaceholder(){setPlaceholder1("");};React.useEffect(function(){setValue(parseDate(date));},[date]);React.useEffect(function(){if(value||focused||placeholder1){_reactNative.Animated.timing(labeled,{toValue:0,duration:BLUR_ANIMATION_DURATION,useNativeDriver:_reactNative.Platform.OS!=="web"}).start();}else{_reactNative.Animated.timing(labeled,{toValue:1,duration:FOCUS_ANIMATION_DURATION,useNativeDriver:_reactNative.Platform.OS!=="web"}).start();}},[value,focused,placeholder1,labeled]);React.useEffect(function(){var _showPlaceholder=function _showPlaceholder(){return setTimeout(function(){return setPlaceholder1(placeholder||"");},50);};if(focused||!label){_showPlaceholder();}else{_hidePlaceholder();}return function(){clearTimeout(_showPlaceholder());};},[focused,label,placeholder]);React.useEffect(function(){if(pickerVisible&&autoDismissKeyboard){_reactNative.Keyboard.dismiss();}},[pickerVisible,autoDismissKeyboard]);var _handleFocus=function _handleFocus(){if(disabled){return;}setFocused(true);};var _handleBlur=function _handleBlur(){if(disabled){return;}setFocused(false);};var MINIMIZED_LABEL_Y_OFFSET=-(typography.caption.lineHeight+4);var OUTLINE_MINIMIZED_LABEL_Y_OFFSET=-(16*0.5+4);var MAXIMIZED_LABEL_FONT_SIZE=textStyles.fontSize||typography.subtitle1.fontSize;var MINIMIZED_LABEL_FONT_SIZE=labelSize?labelSize:typography.caption.fontSize;var hasActiveOutline=focused;var inputTextColor,activeColor,underlineColor,borderColor=inputBorderColor,placeholderColor,containerStyle,backgroundColor,inputStyle;inputTextColor=colors.strong;if(disabled){activeColor=colors.light;placeholderColor=colors.light;borderColor="transparent";underlineColor="transparent";backgroundColor=colors.divider;}else{activeColor=inputBorderColorActive||colors.primary;placeholderColor=inputBorderColor||colors.light;underlineColor=inputBorderColor||colors.light;backgroundColor=colors.background;}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+(type==="solid"?16:12):0,paddingRight:rightIconName?ICON_SIZE+16+4:12},subtitle1,{height:lineHeight});if(type==="underline"){containerStyle={borderTopLeftRadius:roundness,borderTopRightRadius:roundness,paddingBottom:12,marginTop:16};}else{containerStyle={borderRadius:roundness,borderColor:hasActiveOutline?activeColor:borderColor,borderWidth:1,paddingTop:labeled?16*1.5:16,paddingBottom:labeled?16*0.5:16,opacity:disabled?disabledOpacity:1,backgroundColor:backgroundColor};inputStyle.paddingHorizontal=12;}if(leftIconName&&leftIconMode==="outset"){containerStyle.marginLeft=ICON_SIZE+8;}var leftIconColor;if(focused){leftIconColor=colors.primary;}else{leftIconColor=colors.light;}var leftIconProps={size:24,color:leftIconColor,name:leftIconName||""};var leftIconStyle={position:"absolute",top:0,marginTop:type==="solid"?leftIconMode==="inset"?MINIMIZED_LABEL_FONT_SIZE+4:16:leftIconMode==="outset"?16:0};var labelStyle=Object.assign({},typography.subtitle1,{top:type==="solid"?16:0,fontFamily:textStyles==null?void 0:textStyles.fontFamily,left:leftIconName&&leftIconMode==="inset"?ICON_SIZE+(type==="solid"?16:12):0,transform:[{translateY:labeled.interpolate({inputRange:[0,1],outputRange:[type==="solid"?OUTLINE_MINIMIZED_LABEL_Y_OFFSET:MINIMIZED_LABEL_Y_OFFSET,0]})},{scale:labeled.interpolate({inputRange:[0,1],outputRange:[MINIMIZED_LABEL_FONT_SIZE/MAXIMIZED_LABEL_FONT_SIZE,1]})},{translateX:labeled.interpolate({inputRange:[0,1],outputRange:[-(1-MINIMIZED_LABEL_FONT_SIZE/MAXIMIZED_LABEL_FONT_SIZE)*(labelLayout.width/2),0]})}]});var inputStyles=[styles.input,inputStyle,type==="solid"?{marginHorizontal:12}:{}];return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,style],children:[(0,_jsxRuntime.jsx)(_Touchable.default,{disabled:disabled,onPress:toggleVisibility,children:(0,_jsxRuntime.jsx)(_reactNative.View,{pointerEvents:"none",children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,style],children:[leftIconName&&leftIconMode==="outset"?(0,_jsxRuntime.jsx)(Icon,Object.assign({},leftIconProps,{style:leftIconStyle})):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[containerStyle,style?{height:style.height}:{},viewStyles],children:[type==="underline"?(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.underline,{backgroundColor:focused?activeColor:underlineColor,transform:[{scaleY:focused?1:0.5}]}]}):null,label?(0,_jsxRuntime.jsxs)(_reactNative.View,{pointerEvents:"none",style:[_reactNative.StyleSheet.absoluteFill,{opacity:date||focused?labelLayout.measured?1:0:1}],children:[(0,_jsxRuntime.jsx)(AnimatedText,{onLayout:function onLayout(e){return setLabelLayout({width:e.nativeEvent.layout.width,measured:true});},style:[styles.placeholder,type==="solid"?{paddingHorizontal:12}:{},labelStyle,{color:labelColor||colors.light,opacity: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:labelColor||placeholderColor,opacity:hasActiveOutline?labeled:1}],numberOfLines:1,children:label})]}):null,leftIconName&&leftIconMode==="inset"?(0,_jsxRuntime.jsx)(Icon,Object.assign({},leftIconProps,{style:Object.assign({},leftIconStyle,{marginLeft:type==="solid"?16:0})})):null,(0,_jsxRuntime.jsx)(_reactNative.TextInput,Object.assign({value:formatDate(),placeholder:label?placeholder1:placeholder,editable:!disabled,placeholderTextColor:placeholderColor,selectionColor:activeColor,onFocus:_handleFocus,onBlur:_handleBlur,underlineColorAndroid:"transparent",style:[inputStyles,textStyles]},props))]}),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]})})}),pickerVisible&&(0,_jsxRuntime.jsx)(_Portal.default,{children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.picker,{backgroundColor:colors.divider}],children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.pickerContainer,{paddingTop:insets.top,paddingBottom:insets.bottom,paddingLeft:insets.left,paddingRight:insets.right}],children:(0,_jsxRuntime.jsx)(_DatePickerComponent.default,{value:getValidDate(),mode:mode,isVisible:pickerVisible,toggleVisibility:toggleVisibility,minimumDate:parseDate(minimumDate),maximumDate:parseDate(maximumDate),onChange:function onChange(_event,data){toggleVisibility();setValue(data);onDateChange(data);}})})})})]});};var styles=_reactNative.StyleSheet.create({container:{alignSelf:"stretch"},picker:{position:"absolute",bottom:0,left:0,right:0,flexDirection:"row",justifyContent:"center"},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"},placeholder:{position:"absolute",left:0},pickerContainer:{flexDirection:"column",width:"100%",zIndex:100},closeButton:{alignSelf:"flex-end"}});function parseDate(date){if(typeof date==="string"){var parsed=Date.parse(date);if(!isNaN(parsed)){return new Date(parsed);}console.warn("Invalid date string:",`'${date}'.`,"See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format");return undefined;}return date;}var _default=(0,_theming.withTheme)(DatePicker);exports.default=_default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CircularProgress=exports.AnimatedPath=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireDefault(require("react"));var _reactNativeSvg=_interopRequireWildcard(require("react-native-svg"));var _reactNative=require("react-native");var _reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated"));var _ProgressCommon=require("../ProgressCommon");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/CircularProgress/CircularProgress.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 AnimatedPath=_reactNativeReanimated.default.createAnimatedComponent(_reactNativeSvg.Path);exports.AnimatedPath=AnimatedPath;var CircularProgress=function CircularProgress(_ref){var theme=_ref.theme,_ref$minimumValue=_ref.minimumValue,minimumValue=_ref$minimumValue===void 0?0:_ref$minimumValue,_ref$maximumValue=_ref.maximumValue,maximumValue=_ref$maximumValue===void 0?100:_ref$maximumValue,_ref$value=_ref.value,value=_ref$value===void 0?minimumValue:_ref$value,_ref$thickness=_ref.thickness,thickness=_ref$thickness===void 0?10:_ref$thickness,_ref$trackThickness=_ref.trackThickness,trackThickness=_ref$trackThickness===void 0?thickness:_ref$trackThickness,_ref$color=_ref.color,color=_ref$color===void 0?theme.colors.primary:_ref$color,_ref$trackColor=_ref.trackColor,trackColor=_ref$trackColor===void 0?theme.colors.divider:_ref$trackColor,_ref$trackOpacity=_ref.trackOpacity,trackOpacity=_ref$trackOpacity===void 0?1:_ref$trackOpacity,_ref$showTrack=_ref.showTrack,showTrack=_ref$showTrack===void 0?true:_ref$showTrack,_ref$animationDuratio=_ref.animationDuration,animationDuration=_ref$animationDuratio===void 0?_ProgressCommon.DEFAULT_ANIMATION_DURATION:_ref$animationDuratio,_ref$isAnimated=_ref.isAnimated,isAnimated=_ref$isAnimated===void 0?true:_ref$isAnimated,_ref$lineCap=_ref.lineCap,lineCap=_ref$lineCap===void 0?"round":_ref$lineCap,_ref$trackLineCap=_ref.trackLineCap,trackLineCap=_ref$trackLineCap===void 0?lineCap:_ref$trackLineCap,dashWidth=_ref.dashWidth,trackDashWidth=_ref.trackDashWidth,dashGap=_ref.dashGap,trackDashGap=_ref.trackDashGap,dashOffset=_ref.dashOffset,trackDashOffset=_ref.trackDashOffset,customDashArray=_ref.customDashArray,trackCustomDashArray=_ref.trackCustomDashArray,onFullPathWidth=_ref.onFullPathWidth,_ref$startPosition=_ref.startPosition,startPosition=_ref$startPosition===void 0?"top":_ref$startPosition,style=_ref.style,testID=_ref.testID;var _React$useState=_react.default.useState(0),_React$useState2=(0,_slicedToArray2.default)(_React$useState,2),svgContainerWidth=_React$useState2[0],setSvgContainerWidth=_React$useState2[1];var _React$useState3=_react.default.useState(0),_React$useState4=(0,_slicedToArray2.default)(_React$useState3,2),circumfrence=_React$useState4[0],setCircumefrence=_React$useState4[1];var dashArray=dashWidth!==undefined?dashWidth+" "+(dashGap||dashWidth):undefined;var trackDashArray=trackDashWidth!==undefined?trackDashWidth+" "+(trackDashGap||trackDashWidth):undefined;var maxThickness=Math.max(thickness,trackThickness);var thicknessOffset=maxThickness/2;var radius=svgContainerWidth/2;var c=2*Math.PI*radius;if(c!==circumfrence){setCircumefrence(c);}var startAngle=_react.default.useMemo(function(){switch(startPosition){case"top":return 0;case"right":return 90;case"bottom":return 180;case"left":return 270;}},[startPosition]);var currentFillPercentage=value/(maximumValue+minimumValue);var currentAngle=(0,_reactNativeReanimated.useSharedValue)(startAngle);var progressPathAnimatedProps=(0,_reactNativeReanimated.useAnimatedProps)(function(){var _f=function _f(){var isBelowMinAngle=currentAngle.value<=startAngle;return{d:circlePath(radius,radius,radius-thicknessOffset,startAngle,Math.min(currentAngle.value,startAngle+360)),strokeOpacity:isBelowMinAngle?0.0:1.0};};_f._closure={currentAngle:currentAngle,startAngle:startAngle,circlePath:circlePath,radius:radius,thicknessOffset:thicknessOffset};_f.asString="function _f(){const{currentAngle,startAngle,circlePath,radius,thicknessOffset}=jsThis._closure;{const isBelowMinAngle=currentAngle.value<=startAngle;return{d:circlePath(radius,radius,radius-thicknessOffset,startAngle,Math.min(currentAngle.value,startAngle+360)),strokeOpacity:isBelowMinAngle?0.0:1.0};}}";_f.__workletHash=17187939934928;_f.__location="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/CircularProgress/CircularProgress.tsx (85:64)";return _f;}());_react.default.useEffect(function(){currentAngle.value=(0,_reactNativeReanimated.withTiming)(startAngle+currentFillPercentage*360,{duration:isAnimated?animationDuration:0});},[value,currentFillPercentage,animationDuration,currentAngle,maximumValue,minimumValue,isAnimated,startAngle]);_react.default.useEffect(function(){onFullPathWidth==null?void 0:onFullPathWidth(circumfrence);},[circumfrence,onFullPathWidth]);return(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:function onLayout(event){var width=event.nativeEvent.layout.width;setSvgContainerWidth(width);},style:[{height:svgContainerWidth},style],children:(0,_jsxRuntime.jsxs)(_reactNativeSvg.default,{testID:testID!=null?testID:"circular-progress-component",style:{flex:1},children:[showTrack&&(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:circlePath(radius,radius,radius-thicknessOffset,startAngle,startAngle+360),stroke:trackColor,strokeWidth:trackThickness,strokeOpacity:trackOpacity,strokeLinecap:trackLineCap,strokeDasharray:trackCustomDashArray||trackDashArray,strokeDashoffset:trackDashOffset,fill:"rgba(0,0,0,0)"}),(0,_jsxRuntime.jsx)(AnimatedPath,{animatedProps:progressPathAnimatedProps,stroke:color,strokeWidth:thickness,strokeLinecap:lineCap,strokeDasharray:customDashArray||dashArray,strokeDashoffset:dashOffset,fill:"rgba(0,0,0,0)",onPress:function onPress(){}})]})});};exports.CircularProgress=CircularProgress;var circlePath=function(){var _f=function _f(x,y,radius,startAngle,endAngle){function polarToCartesian(centerX,centerY,radius,angleInDegrees){var angleInRadians=(angleInDegrees-90)*Math.PI/180.0;return{x:centerX+radius*Math.cos(angleInRadians),y:centerY+radius*Math.sin(angleInRadians)};}var start=polarToCartesian(x,y,radius,endAngle*0.9999);var end=polarToCartesian(x,y,radius,startAngle);var largeArcFlag=endAngle-startAngle<=180?"0":"1";var d=["M",start.x,start.y,"A",radius,radius,0,largeArcFlag,0,end.x,end.y];return d.join(" ");};_f._closure={};_f.asString="function circlePath(x,y,radius,startAngle,endAngle){function polarToCartesian(centerX,centerY,radius,angleInDegrees){var angleInRadians=(angleInDegrees-90)*Math.PI/180.0;return{x:centerX+radius*Math.cos(angleInRadians),y:centerY+radius*Math.sin(angleInRadians)};}var start=polarToCartesian(x,y,radius,endAngle*0.9999);var end=polarToCartesian(x,y,radius,startAngle);var largeArcFlag=endAngle-startAngle<=180?\"0\":\"1\";var d=[\"M\",start.x,start.y,\"A\",radius,radius,0,largeArcFlag,0,end.x,end.y];return d.join(\" \");}";_f.__workletHash=3990955206175;_f.__location="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/CircularProgress/CircularProgress.tsx (166:0)";return _f;}();
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.CircularProgress=exports.AnimatedPath=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireDefault(require("react"));var _reactNativeSvg=_interopRequireWildcard(require("react-native-svg"));var _reactNative=require("react-native");var _reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated"));var _ProgressCommon=require("../ProgressCommon");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/CircularProgress/CircularProgress.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 AnimatedPath=_reactNativeReanimated.default.createAnimatedComponent(_reactNativeSvg.Path);exports.AnimatedPath=AnimatedPath;var _worklet_16562771247151_init_data={code:"function anonymous() {\n const {\n currentAngle,\n startAngle,\n circlePath,\n radius,\n thicknessOffset\n } = this._closure;\n const isBelowMinAngle = currentAngle.value <= startAngle;\n return {\n d: circlePath(radius, radius, radius - thicknessOffset, startAngle, Math.min(currentAngle.value, startAngle + 360)),\n strokeOpacity: isBelowMinAngle ? 0.0 : 1.0\n };\n}",location:"/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/CircularProgress/CircularProgress.tsx",sourceMap:"{\"version\":3,\"names\":[\"anonymous\",\"currentAngle\",\"startAngle\",\"circlePath\",\"radius\",\"thicknessOffset\",\"_closure\",\"isBelowMinAngle\",\"value\",\"d\",\"Math\",\"min\",\"strokeOpacity\"],\"sources\":[\"/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/CircularProgress/CircularProgress.tsx\"],\"mappings\":\"AAoFgE,SAAAA,SAAMA,CAAA;EAAA;IAAAC,YAAA;IAAAC,UAAA;IAAAC,UAAA;IAAAC,MAAA;IAAAC;EAAA,SAAAC,QAAA;EAClE,MAAMC,eAAe,GAAGN,YAAY,CAACO,KAAK,IAAIN,UAAU;EACxD,OAAO;IACLO,CAAC,EAAEN,UAAU,CACXC,MAAM,EACNA,MAAM,EACNA,MAAM,GAAGC,eAAe,EACxBH,UAAU,EACVQ,IAAI,CAACC,GAAG,CAACV,YAAY,CAACO,KAAK,EAAEN,UAAU,GAAG,GAAG,CAC/C,CAAC;IACDU,aAAa,EAAEL,eAAe,GAAG,GAAG,GAAG;EACzC,CAAC;AACH\"}"};var CircularProgress=function CircularProgress(_ref){var theme=_ref.theme,_ref$minimumValue=_ref.minimumValue,minimumValue=_ref$minimumValue===void 0?0:_ref$minimumValue,_ref$maximumValue=_ref.maximumValue,maximumValue=_ref$maximumValue===void 0?100:_ref$maximumValue,_ref$value=_ref.value,value=_ref$value===void 0?minimumValue:_ref$value,_ref$thickness=_ref.thickness,thickness=_ref$thickness===void 0?10:_ref$thickness,_ref$trackThickness=_ref.trackThickness,trackThickness=_ref$trackThickness===void 0?thickness:_ref$trackThickness,_ref$color=_ref.color,color=_ref$color===void 0?theme.colors.primary:_ref$color,_ref$trackColor=_ref.trackColor,trackColor=_ref$trackColor===void 0?theme.colors.divider:_ref$trackColor,_ref$trackOpacity=_ref.trackOpacity,trackOpacity=_ref$trackOpacity===void 0?1:_ref$trackOpacity,_ref$showTrack=_ref.showTrack,showTrack=_ref$showTrack===void 0?true:_ref$showTrack,_ref$animationDuratio=_ref.animationDuration,animationDuration=_ref$animationDuratio===void 0?_ProgressCommon.DEFAULT_ANIMATION_DURATION:_ref$animationDuratio,_ref$isAnimated=_ref.isAnimated,isAnimated=_ref$isAnimated===void 0?true:_ref$isAnimated,_ref$lineCap=_ref.lineCap,lineCap=_ref$lineCap===void 0?"round":_ref$lineCap,_ref$trackLineCap=_ref.trackLineCap,trackLineCap=_ref$trackLineCap===void 0?lineCap:_ref$trackLineCap,dashWidth=_ref.dashWidth,trackDashWidth=_ref.trackDashWidth,dashGap=_ref.dashGap,trackDashGap=_ref.trackDashGap,dashOffset=_ref.dashOffset,trackDashOffset=_ref.trackDashOffset,customDashArray=_ref.customDashArray,trackCustomDashArray=_ref.trackCustomDashArray,onFullPathWidth=_ref.onFullPathWidth,_ref$startPosition=_ref.startPosition,startPosition=_ref$startPosition===void 0?"top":_ref$startPosition,style=_ref.style,testID=_ref.testID;var _React$useState=_react.default.useState(0),_React$useState2=(0,_slicedToArray2.default)(_React$useState,2),svgContainerWidth=_React$useState2[0],setSvgContainerWidth=_React$useState2[1];var _React$useState3=_react.default.useState(0),_React$useState4=(0,_slicedToArray2.default)(_React$useState3,2),circumfrence=_React$useState4[0],setCircumefrence=_React$useState4[1];var dashArray=dashWidth!==undefined?`${dashWidth} ${dashGap||dashWidth}`:undefined;var trackDashArray=trackDashWidth!==undefined?`${trackDashWidth} ${trackDashGap||trackDashWidth}`:undefined;var maxThickness=Math.max(thickness,trackThickness);var thicknessOffset=maxThickness/2;var radius=svgContainerWidth/2;var c=2*Math.PI*radius;if(c!==circumfrence){setCircumefrence(c);}var startAngle=_react.default.useMemo(function(){switch(startPosition){case"top":return 0;case"right":return 90;case"bottom":return 180;case"left":return 270;}},[startPosition]);var currentFillPercentage=value/(maximumValue+minimumValue);var currentAngle=(0,_reactNativeReanimated.useSharedValue)(startAngle);var progressPathAnimatedProps=(0,_reactNativeReanimated.useAnimatedProps)(function(){var _e=[new global.Error(),-6,-27];var _f=function _f(){var isBelowMinAngle=currentAngle.value<=startAngle;return{d:circlePath(radius,radius,radius-thicknessOffset,startAngle,Math.min(currentAngle.value,startAngle+360)),strokeOpacity:isBelowMinAngle?0.0:1.0};};_f._closure={currentAngle:currentAngle,startAngle:startAngle,circlePath:circlePath,radius:radius,thicknessOffset:thicknessOffset};_f.__initData=_worklet_16562771247151_init_data;_f.__workletHash=16562771247151;_f.__stackDetails=_e;_f.__version="3.3.0";return _f;}());_react.default.useEffect(function(){currentAngle.value=(0,_reactNativeReanimated.withTiming)(startAngle+currentFillPercentage*360,{duration:isAnimated?animationDuration:0});},[value,currentFillPercentage,animationDuration,currentAngle,maximumValue,minimumValue,isAnimated,startAngle]);_react.default.useEffect(function(){onFullPathWidth==null?void 0:onFullPathWidth(circumfrence);},[circumfrence,onFullPathWidth]);return(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:function onLayout(event){var width=event.nativeEvent.layout.width;setSvgContainerWidth(width);},style:[{height:svgContainerWidth},style],children:(0,_jsxRuntime.jsxs)(_reactNativeSvg.default,{testID:testID!=null?testID:"circular-progress-component",style:{flex:1},children:[showTrack&&(0,_jsxRuntime.jsx)(_reactNativeSvg.Path,{d:circlePath(radius,radius,radius-thicknessOffset,startAngle,startAngle+360),stroke:trackColor,strokeWidth:trackThickness,strokeOpacity:trackOpacity,strokeLinecap:trackLineCap,strokeDasharray:trackCustomDashArray||trackDashArray,strokeDashoffset:trackDashOffset,fill:"rgba(0,0,0,0)"}),(0,_jsxRuntime.jsx)(AnimatedPath,{animatedProps:progressPathAnimatedProps,stroke:color,strokeWidth:thickness,strokeLinecap:lineCap,strokeDasharray:customDashArray||dashArray,strokeDashoffset:dashOffset,fill:"rgba(0,0,0,0)",onPress:function onPress(){}})]})});};exports.CircularProgress=CircularProgress;var _worklet_13438583604277_init_data={code:"function circlePath(x, y, radius, startAngle, endAngle) {\n function polarToCartesian(centerX, centerY, radius, angleInDegrees) {\n var angleInRadians = (angleInDegrees - 90) * Math.PI / 180.0;\n return {\n x: centerX + radius * Math.cos(angleInRadians),\n y: centerY + radius * Math.sin(angleInRadians)\n };\n }\n var start = polarToCartesian(x, y, radius, endAngle * 0.9999);\n var end = polarToCartesian(x, y, radius, startAngle);\n var largeArcFlag = endAngle - startAngle <= 180 ? \"0\" : \"1\";\n var d = [\"M\", start.x, start.y, \"A\", radius, radius, 0, largeArcFlag, 0, end.x, end.y];\n return d.join(\" \");\n}",location:"/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/CircularProgress/CircularProgress.tsx",sourceMap:"{\"version\":3,\"names\":[\"circlePath\",\"x\",\"y\",\"radius\",\"startAngle\",\"endAngle\",\"polarToCartesian\",\"centerX\",\"centerY\",\"angleInDegrees\",\"Math\",\"cos\",\"angleInRadians\",\"sin\",\"start\",\"end\",\"largeArcFlag\",\"d\",\"join\"],\"sources\":[\"/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/CircularProgress/CircularProgress.tsx\"],\"mappings\":\"AAoKA,SAAAA,WAAAC,CAAA,EAAAC,CAAA,EAAAC,MAAA,EAAAC,UAAA,EAAAC,QAAA;EAQa,SAAAC,iBAAAC,OAAA,EAAAC,OAAA,EAAAL,MAAA,EAAAM,cAAA;;IAEX,OAAS;MAMPR,CAAA,EAAIM,OAAA,GAAAJ,MAAkB,GAACO,IAAA,CAAAC,GAAA,CAAAC,cAAuB;MAC9CV,CAAA,EAAAM,OAAO,GAAAL,MAAA,GAAAO,IAAA,CAAAG,GAAA,CAAAD,cAAA;;;MAGNE,KAAA,GAAAR,gBAAA,CAAAL,CAAA,EAAAC,CAAA,EAAAC,MAAA,EAAAE,QAAA;EACH,IAAAU,GAAA,GAAAT,gBAAA,CAAAL,CAAA,EAAAC,CAAA,EAAAC,MAAA,EAAAC,UAAA;EAEA,IAAIY,YAAQ,GAAAX,QAAA,GAAkBD,UAAK,IAAQ,SAAQ,GAAG;EACtD,IAAIa,CAAA,GAAG,IAAG,EAAAH,KAAA,CAAAb,CAAA,EAAAa,KAAkB,CAAAZ,CAAE,EAAC,GAAE,EAAAC,MAAQ,EAAAA,MAAU,EAAC,GAAAa,YAAA,KAAAD,GAAA,CAAAd,CAAA,EAAAc,GAAA,CAAAb,CAAA;EACpD,OAAIe,CAAA,CAAAC,IAAA,IAAY\"}"};var circlePath=function(){var _e=[new global.Error(),1,-27];var _f=function _f(x,y,radius,startAngle,endAngle){function polarToCartesian(centerX,centerY,radius,angleInDegrees){var angleInRadians=(angleInDegrees-90)*Math.PI/180.0;return{x:centerX+radius*Math.cos(angleInRadians),y:centerY+radius*Math.sin(angleInRadians)};}var start=polarToCartesian(x,y,radius,endAngle*0.9999);var end=polarToCartesian(x,y,radius,startAngle);var largeArcFlag=endAngle-startAngle<=180?"0":"1";var d=["M",start.x,start.y,"A",radius,radius,0,largeArcFlag,0,end.x,end.y];return d.join(" ");};_f._closure={};_f.__initData=_worklet_13438583604277_init_data;_f.__workletHash=13438583604277;_f.__stackDetails=_e;_f.__version="3.3.0";return _f;}();
|
|
@@ -1 +1 @@
|
|
|
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=_interopRequireDefault(require("react"));var _reactNativeReanimated=require("react-native-reanimated");var _ProgressCommon=require("./ProgressCommon");var _jsxRuntime=require("react/jsx-runtime");var _excluded=["ProgressComponent"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/IndeterminateProgress.tsx";var IndeterminateProgress=function IndeterminateProgress(_ref){var ProgressComponent=_ref.ProgressComponent,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);var _React$useState=_react.default.useState(0),_React$useState2=(0,_slicedToArray2.default)(_React$useState,2),pathWidth=_React$useState2[0],setPathWidth=_React$useState2[1];var _React$useState3=_react.default.useState(0),_React$useState4=(0,_slicedToArray2.default)(_React$useState3,2),value=_React$useState4[0],setValue=_React$useState4[1];var _React$useState5=_react.default.useState(0),_React$useState6=(0,_slicedToArray2.default)(_React$useState5,2),dashOffset=_React$useState6[0],setDashOffset=_React$useState6[1];var animationDuration=rest.animationDuration||_ProgressCommon.DEFAULT_ANIMATION_DURATION;var currentOffset=(0,_reactNativeReanimated.useSharedValue)(0);(0,_reactNativeReanimated.useAnimatedReaction)(function(){var _f=function _f(){return currentOffset.value;};_f._closure={currentOffset:currentOffset};_f.
|
|
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=_interopRequireDefault(require("react"));var _reactNativeReanimated=require("react-native-reanimated");var _ProgressCommon=require("./ProgressCommon");var _jsxRuntime=require("react/jsx-runtime");var _excluded=["ProgressComponent"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/IndeterminateProgress.tsx";var _worklet_7042433682028_init_data={code:"function anonymous() {\n const {\n currentOffset\n } = this._closure;\n return currentOffset.value;\n}",location:"/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/IndeterminateProgress.tsx",sourceMap:"{\"version\":3,\"names\":[\"anonymous\",\"currentOffset\",\"_closure\",\"value\"],\"sources\":[\"/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/IndeterminateProgress.tsx\"],\"mappings\":\"AA+BI,SAAAA,UAAA;EAAA;IAAAC;EAAA,SAAAC,QAAA;EAAA,OAAMD,aAAc,CAAAE,KAAA;AAAA\"}"};var _worklet_6348489877103_init_data={code:"function anonymous(result) {\n const {\n runOnJS,\n setDashOffset\n } = this._closure;\n return runOnJS(setDashOffset)(result);\n}",location:"/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/IndeterminateProgress.tsx",sourceMap:"{\"version\":3,\"names\":[\"anonymous\",\"result\",\"runOnJS\",\"setDashOffset\",\"_closure\"],\"sources\":[\"/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/IndeterminateProgress.tsx\"],\"mappings\":\"AAgCK,SAAAA,SAAMA,CAAAC,MAAA;EAAA;IAAAC,OAAA;IAAAC;EAAA,SAAAC,QAAA;EAAA,OAAKF,OAAQ,CAAAC,aAAc,CAAC,CAAAF,MAAM;AAAA\"}"};var IndeterminateProgress=function IndeterminateProgress(_ref){var ProgressComponent=_ref.ProgressComponent,rest=(0,_objectWithoutProperties2.default)(_ref,_excluded);var _React$useState=_react.default.useState(0),_React$useState2=(0,_slicedToArray2.default)(_React$useState,2),pathWidth=_React$useState2[0],setPathWidth=_React$useState2[1];var _React$useState3=_react.default.useState(0),_React$useState4=(0,_slicedToArray2.default)(_React$useState3,2),value=_React$useState4[0],setValue=_React$useState4[1];var _React$useState5=_react.default.useState(0),_React$useState6=(0,_slicedToArray2.default)(_React$useState5,2),dashOffset=_React$useState6[0],setDashOffset=_React$useState6[1];var animationDuration=rest.animationDuration||_ProgressCommon.DEFAULT_ANIMATION_DURATION;var currentOffset=(0,_reactNativeReanimated.useSharedValue)(0);(0,_reactNativeReanimated.useAnimatedReaction)(function(){var _e=[new global.Error(),-2,-27];var _f=function _f(){return currentOffset.value;};_f._closure={currentOffset:currentOffset};_f.__initData=_worklet_7042433682028_init_data;_f.__workletHash=7042433682028;_f.__stackDetails=_e;_f.__version="3.3.0";return _f;}(),function(){var _e=[new global.Error(),-3,-27];var _f=function _f(result){return(0,_reactNativeReanimated.runOnJS)(setDashOffset)(result);};_f._closure={runOnJS:_reactNativeReanimated.runOnJS,setDashOffset:setDashOffset};_f.__initData=_worklet_6348489877103_init_data;_f.__workletHash=6348489877103;_f.__stackDetails=_e;_f.__version="3.3.0";return _f;}());var repeatIndeterminateAnimation=_react.default.useCallback(function(){if(value===0){setValue(100);currentOffset.value=(0,_reactNativeReanimated.withTiming)(pathWidth,{duration:animationDuration});}else{setValue(0);currentOffset.value=(0,_reactNativeReanimated.withTiming)(0,{duration:animationDuration});}},[currentOffset,value,animationDuration,pathWidth]);_react.default.useEffect(function(){var timeout=setTimeout(function(){repeatIndeterminateAnimation();},animationDuration);return function(){return clearTimeout(timeout);};},[animationDuration,repeatIndeterminateAnimation]);return(0,_jsxRuntime.jsx)(ProgressComponent,Object.assign({},rest,{testID:rest.testID||"indeterminate-progress",onFullPathWidth:function onFullPathWidth(width){setPathWidth(width);rest.onFullPathWidth==null?void 0:rest.onFullPathWidth(width);},dashOffset:dashOffset,dashGap:pathWidth/2,dashWidth:pathWidth/2,animationDuration:animationDuration,minimumValue:0,maximumValue:100,value:100}));};var _default=IndeterminateProgress;exports.default=_default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.LinearProgress=exports.AnimatedLine=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireDefault(require("react"));var _reactNativeSvg=_interopRequireWildcard(require("react-native-svg"));var _reactNative=require("react-native");var _reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated"));var _ProgressCommon=require("../ProgressCommon");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/LinearProgress/LinearProgress.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 AnimatedLine=_reactNativeReanimated.default.createAnimatedComponent(_reactNativeSvg.Line);exports.AnimatedLine=AnimatedLine;var LinearProgress=function LinearProgress(_ref){var theme=_ref.theme,_ref$minimumValue=_ref.minimumValue,minimumValue=_ref$minimumValue===void 0?0:_ref$minimumValue,_ref$maximumValue=_ref.maximumValue,maximumValue=_ref$maximumValue===void 0?100:_ref$maximumValue,_ref$value=_ref.value,value=_ref$value===void 0?minimumValue:_ref$value,_ref$thickness=_ref.thickness,thickness=_ref$thickness===void 0?10:_ref$thickness,_ref$trackThickness=_ref.trackThickness,trackThickness=_ref$trackThickness===void 0?thickness:_ref$trackThickness,_ref$color=_ref.color,color=_ref$color===void 0?theme.colors.primary:_ref$color,_ref$trackColor=_ref.trackColor,trackColor=_ref$trackColor===void 0?theme.colors.divider:_ref$trackColor,_ref$trackOpacity=_ref.trackOpacity,trackOpacity=_ref$trackOpacity===void 0?1:_ref$trackOpacity,_ref$showTrack=_ref.showTrack,showTrack=_ref$showTrack===void 0?true:_ref$showTrack,_ref$animationDuratio=_ref.animationDuration,animationDuration=_ref$animationDuratio===void 0?_ProgressCommon.DEFAULT_ANIMATION_DURATION:_ref$animationDuratio,_ref$isAnimated=_ref.isAnimated,isAnimated=_ref$isAnimated===void 0?true:_ref$isAnimated,_ref$lineCap=_ref.lineCap,lineCap=_ref$lineCap===void 0?"round":_ref$lineCap,_ref$trackLineCap=_ref.trackLineCap,trackLineCap=_ref$trackLineCap===void 0?lineCap:_ref$trackLineCap,dashWidth=_ref.dashWidth,trackDashWidth=_ref.trackDashWidth,dashGap=_ref.dashGap,trackDashGap=_ref.trackDashGap,dashOffset=_ref.dashOffset,trackDashOffset=_ref.trackDashOffset,customDashArray=_ref.customDashArray,trackCustomDashArray=_ref.trackCustomDashArray,onFullPathWidth=_ref.onFullPathWidth,style=_ref.style,testID=_ref.testID;var _React$useState=_react.default.useState(0),_React$useState2=(0,_slicedToArray2.default)(_React$useState,2),svgContainerWidth=_React$useState2[0],setSvgContainerWidth=_React$useState2[1];var dashArray=dashWidth!==undefined
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.LinearProgress=exports.AnimatedLine=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireDefault(require("react"));var _reactNativeSvg=_interopRequireWildcard(require("react-native-svg"));var _reactNative=require("react-native");var _reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated"));var _ProgressCommon=require("../ProgressCommon");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/LinearProgress/LinearProgress.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 AnimatedLine=_reactNativeReanimated.default.createAnimatedComponent(_reactNativeSvg.Line);exports.AnimatedLine=AnimatedLine;var _worklet_2308108033703_init_data={code:"function anonymous() {\n const {\n currentProgressLineWidth,\n thicknessOffset,\n progressLineWidth\n } = this._closure;\n const isBelowMinWidth = currentProgressLineWidth.value <= thicknessOffset;\n return {\n x2: Math.min(progressLineWidth, currentProgressLineWidth.value),\n strokeOpacity: isBelowMinWidth ? 0.0 : 1.0\n };\n}",location:"/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/LinearProgress/LinearProgress.tsx",sourceMap:"{\"version\":3,\"names\":[\"anonymous\",\"currentProgressLineWidth\",\"thicknessOffset\",\"progressLineWidth\",\"_closure\",\"isBelowMinWidth\",\"value\",\"x2\",\"Math\",\"min\",\"strokeOpacity\"],\"sources\":[\"/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/LinearProgress/LinearProgress.tsx\"],\"mappings\":\"AA8DgE,SAAAA,SAAMA,CAAA;EAAA;IAAAC,wBAAA;IAAAC,eAAA;IAAAC;EAAA,SAAAC,QAAA;EAClE,MAAMC,eAAe,GAAGJ,wBAAwB,CAACK,KAAK,IAAIJ,eAAe;EACzE,OAAO;IACLK,EAAE,EAAEC,IAAI,CAACC,GAAG,CAACN,iBAAiB,EAAEF,wBAAwB,CAACK,KAAK,CAAC;IAC/DI,aAAa,EAAEL,eAAe,GAAG,GAAG,GAAG;EACzC,CAAC;AACH\"}"};var LinearProgress=function LinearProgress(_ref){var theme=_ref.theme,_ref$minimumValue=_ref.minimumValue,minimumValue=_ref$minimumValue===void 0?0:_ref$minimumValue,_ref$maximumValue=_ref.maximumValue,maximumValue=_ref$maximumValue===void 0?100:_ref$maximumValue,_ref$value=_ref.value,value=_ref$value===void 0?minimumValue:_ref$value,_ref$thickness=_ref.thickness,thickness=_ref$thickness===void 0?10:_ref$thickness,_ref$trackThickness=_ref.trackThickness,trackThickness=_ref$trackThickness===void 0?thickness:_ref$trackThickness,_ref$color=_ref.color,color=_ref$color===void 0?theme.colors.primary:_ref$color,_ref$trackColor=_ref.trackColor,trackColor=_ref$trackColor===void 0?theme.colors.divider:_ref$trackColor,_ref$trackOpacity=_ref.trackOpacity,trackOpacity=_ref$trackOpacity===void 0?1:_ref$trackOpacity,_ref$showTrack=_ref.showTrack,showTrack=_ref$showTrack===void 0?true:_ref$showTrack,_ref$animationDuratio=_ref.animationDuration,animationDuration=_ref$animationDuratio===void 0?_ProgressCommon.DEFAULT_ANIMATION_DURATION:_ref$animationDuratio,_ref$isAnimated=_ref.isAnimated,isAnimated=_ref$isAnimated===void 0?true:_ref$isAnimated,_ref$lineCap=_ref.lineCap,lineCap=_ref$lineCap===void 0?"round":_ref$lineCap,_ref$trackLineCap=_ref.trackLineCap,trackLineCap=_ref$trackLineCap===void 0?lineCap:_ref$trackLineCap,dashWidth=_ref.dashWidth,trackDashWidth=_ref.trackDashWidth,dashGap=_ref.dashGap,trackDashGap=_ref.trackDashGap,dashOffset=_ref.dashOffset,trackDashOffset=_ref.trackDashOffset,customDashArray=_ref.customDashArray,trackCustomDashArray=_ref.trackCustomDashArray,onFullPathWidth=_ref.onFullPathWidth,style=_ref.style,testID=_ref.testID;var _React$useState=_react.default.useState(0),_React$useState2=(0,_slicedToArray2.default)(_React$useState,2),svgContainerWidth=_React$useState2[0],setSvgContainerWidth=_React$useState2[1];var dashArray=dashWidth!==undefined?`${dashWidth} ${dashGap||dashWidth}`:undefined;var trackDashArray=trackDashWidth!==undefined?`${trackDashWidth} ${trackDashGap||trackDashWidth}`:undefined;var maxThickness=Math.max(thickness,trackThickness);var thicknessOffset=maxThickness/2;var progressLineWidth=svgContainerWidth-thicknessOffset;var trackProgressLineWidth=svgContainerWidth-thicknessOffset;var currentFillPercentage=value/(maximumValue+minimumValue);var currentProgressLineWidth=(0,_reactNativeReanimated.useSharedValue)(0);var progressLineAnimatedProps=(0,_reactNativeReanimated.useAnimatedProps)(function(){var _e=[new global.Error(),-4,-27];var _f=function _f(){var isBelowMinWidth=currentProgressLineWidth.value<=thicknessOffset;return{x2:Math.min(progressLineWidth,currentProgressLineWidth.value),strokeOpacity:isBelowMinWidth?0.0:1.0};};_f._closure={currentProgressLineWidth:currentProgressLineWidth,thicknessOffset:thicknessOffset,progressLineWidth:progressLineWidth};_f.__initData=_worklet_2308108033703_init_data;_f.__workletHash=2308108033703;_f.__stackDetails=_e;_f.__version="3.3.0";return _f;}());_react.default.useEffect(function(){currentProgressLineWidth.value=(0,_reactNativeReanimated.withTiming)(progressLineWidth*currentFillPercentage,{duration:isAnimated?animationDuration:0});},[value,progressLineWidth,currentFillPercentage,animationDuration,currentProgressLineWidth,maximumValue,minimumValue,isAnimated]);return(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:function onLayout(event){var width=event.nativeEvent.layout.width;setSvgContainerWidth(width);onFullPathWidth==null?void 0:onFullPathWidth(width);},style:[{height:maxThickness},style],children:(0,_jsxRuntime.jsxs)(_reactNativeSvg.default,{testID:testID!=null?testID:"linear-progress-component",style:{flex:1},children:[showTrack&&(0,_jsxRuntime.jsx)(_reactNativeSvg.Line,{x1:thicknessOffset,y1:thicknessOffset,x2:trackProgressLineWidth,y2:thicknessOffset,stroke:trackColor,strokeWidth:trackThickness,strokeOpacity:trackOpacity,strokeLinecap:trackLineCap,strokeDasharray:trackCustomDashArray||trackDashArray,strokeDashoffset:trackDashOffset}),(0,_jsxRuntime.jsx)(AnimatedLine,{animatedProps:progressLineAnimatedProps,x1:thicknessOffset,y1:thicknessOffset,y2:thicknessOffset,stroke:color,strokeWidth:thickness,strokeLinecap:lineCap,strokeDasharray:customDashArray||dashArray,strokeDashoffset:dashOffset,onPress:function onPress(){}})]})});};exports.LinearProgress=LinearProgress;
|
|
@@ -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","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
|
|
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 _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));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 _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/StepIndicator.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 _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 STEP_STATUS={CURRENT:"current",FINISHED:"finished",UNFINISHED:"unfinished"};var StepIndicator=function(_Component){(0,_inherits2.default)(StepIndicator,_Component);var _super=_createSuper(StepIndicator);function StepIndicator(props){var _this;(0,_classCallCheck2.default)(this,StepIndicator);_this=_super.call(this,props);_this.renderProgressBarBackground=function(){var _this$props=_this.props,stepCount=_this$props.stepCount,direction=_this$props.direction;var progressBarBackgroundStyle;if(direction==="vertical"){progressBarBackgroundStyle={backgroundColor:_this.state.customStyles.separatorUnFinishedColor,position:"absolute",left:(_this.state.width-_this.state.customStyles.separatorStrokeWidth)/2,top:_this.state.height/(2*stepCount),bottom:_this.state.height/(2*stepCount),width:_this.state.customStyles.separatorStrokeUnfinishedWidth===0?_this.state.customStyles.separatorStrokeWidth:_this.state.customStyles.separatorStrokeUnfinishedWidth};}else{progressBarBackgroundStyle={backgroundColor:_this.state.customStyles.separatorUnFinishedColor,position:"absolute",top:(_this.state.height-_this.state.customStyles.separatorStrokeWidth)/2,left:_this.state.width/(2*stepCount),right:_this.state.width/(2*stepCount),height:_this.state.customStyles.separatorStrokeUnfinishedWidth===0?_this.state.customStyles.separatorStrokeWidth:_this.state.customStyles.separatorStrokeUnfinishedWidth};}return(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:function onLayout(event){if(direction==="vertical"){_this.setState({progressBarSize:event.nativeEvent.layout.height},function(){_this.onCurrentPositionChanged(_this.props.currentPosition);});}else{_this.setState({progressBarSize:event.nativeEvent.layout.width},function(){_this.onCurrentPositionChanged(_this.props.currentPosition);});}},style:progressBarBackgroundStyle});};_this.renderProgressBar=function(){var _this$props2=_this.props,stepCount=_this$props2.stepCount,direction=_this$props2.direction;var progressBarStyle;if(direction==="vertical"){progressBarStyle={backgroundColor:_this.state.customStyles.separatorFinishedColor,position:"absolute",left:(_this.state.width-_this.state.customStyles.separatorStrokeWidth)/2,top:_this.state.height/(2*stepCount),bottom:_this.state.height/(2*stepCount),width:_this.state.customStyles.separatorStrokeFinishedWidth===0?_this.state.customStyles.separatorStrokeWidth:_this.state.customStyles.separatorStrokeFinishedWidth,height:_this.progressAnim};}else{progressBarStyle={backgroundColor:_this.state.customStyles.separatorFinishedColor,position:"absolute",top:(_this.state.height-_this.state.customStyles.separatorStrokeWidth)/2,left:_this.state.width/(2*stepCount),right:_this.state.width/(2*stepCount),height:_this.state.customStyles.separatorStrokeFinishedWidth===0?_this.state.customStyles.separatorStrokeWidth:_this.state.customStyles.separatorStrokeFinishedWidth,width:_this.progressAnim};}return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:progressBarStyle});};_this.renderStepIndicator=function(){var steps=[];var _this$props3=_this.props,stepCount=_this$props3.stepCount,direction=_this$props3.direction;var _loop=function _loop(position){steps.push((0,_jsxRuntime.jsx)(_reactNative.TouchableWithoutFeedback,{onPress:function onPress(){return _this.stepPressed(position);},children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.stepContainer,direction==="vertical"?{flexDirection:"column"}:{flexDirection:"row"}],children:_this.renderStep(position)})},position));};for(var position=0;position<stepCount;position++){_loop(position);}return(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:function onLayout(event){return _this.setState({width:event.nativeEvent.layout.width,height:event.nativeEvent.layout.height});},style:[styles.stepIndicatorContainer,direction==="vertical"?{flexDirection:"column",width:_this.state.customStyles.currentStepIndicatorSize}:{flexDirection:"row",height:_this.state.customStyles.currentStepIndicatorSize}],children:steps});};_this.renderStepLabels=function(){var _this$props4=_this.props,labels=_this$props4.labels,direction=_this$props4.direction,currentPosition=_this$props4.currentPosition,renderLabel=_this$props4.renderLabel;var labelViews=labels.map(function(label,index){var selectedStepLabelStyle=index===currentPosition?{color:_this.state.customStyles.currentStepLabelColor}:{color:_this.state.customStyles.labelColor};return(0,_jsxRuntime.jsx)(_reactNative.TouchableWithoutFeedback,{style:styles.stepLabelItem,onPress:function onPress(){return _this.stepPressed(index);},children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.stepLabelItem,children:renderLabel?renderLabel({position:index,stepStatus:_this.getStepStatus(index),label:label,currentPosition:currentPosition}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.stepLabel,selectedStepLabelStyle,{fontSize:_this.state.customStyles.labelSize,fontFamily:_this.state.customStyles.labelFontFamily}],children:label})})},index);});return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.stepLabelsContainer,direction==="vertical"?{flexDirection:"column",paddingHorizontal:4}:{flexDirection:"row",paddingVertical:4},{alignItems:_this.state.customStyles.labelAlign}],children:labelViews});};_this.renderStep=function(position){var renderStepIndicator=_this.props.renderStepIndicator;var stepStyle;var indicatorLabelStyle;switch(_this.getStepStatus(position)){case STEP_STATUS.CURRENT:{stepStyle={backgroundColor:_this.state.customStyles.stepIndicatorCurrentColor,borderWidth:_this.state.customStyles.currentStepStrokeWidth,borderColor:_this.state.customStyles.stepStrokeCurrentColor,height:_this.sizeAnim,width:_this.sizeAnim,borderRadius:_this.borderRadiusAnim};indicatorLabelStyle={fontSize:_this.state.customStyles.currentStepIndicatorLabelFontSize,color:_this.state.customStyles.stepIndicatorLabelCurrentColor};break;}case STEP_STATUS.FINISHED:{stepStyle={backgroundColor:_this.state.customStyles.stepIndicatorFinishedColor,borderWidth:_this.state.customStyles.stepStrokeWidth,borderColor:_this.state.customStyles.stepStrokeFinishedColor,height:_this.state.customStyles.stepIndicatorSize,width:_this.state.customStyles.stepIndicatorSize,borderRadius:_this.state.customStyles.stepIndicatorSize/2};indicatorLabelStyle={fontSize:_this.state.customStyles.stepIndicatorLabelFontSize,color:_this.state.customStyles.stepIndicatorLabelFinishedColor};break;}case STEP_STATUS.UNFINISHED:{stepStyle={backgroundColor:_this.state.customStyles.stepIndicatorUnFinishedColor,borderWidth:_this.state.customStyles.stepStrokeWidth,borderColor:_this.state.customStyles.stepStrokeUnFinishedColor,height:_this.state.customStyles.stepIndicatorSize,width:_this.state.customStyles.stepIndicatorSize,borderRadius:_this.state.customStyles.stepIndicatorSize/2};indicatorLabelStyle={overflow:"hidden",fontSize:_this.state.customStyles.stepIndicatorLabelFontSize,color:_this.state.customStyles.stepIndicatorLabelUnFinishedColor};break;}default:}return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.step,stepStyle],children:renderStepIndicator?renderStepIndicator({position:position,stepStatus:_this.getStepStatus(position)}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:indicatorLabelStyle,children:""+(position+1)})},"step-indicator");};_this.getStepStatus=function(stepPosition){var currentPosition=_this.props.currentPosition;if(stepPosition===currentPosition){return STEP_STATUS.CURRENT;}else if(stepPosition<currentPosition){return STEP_STATUS.FINISHED;}else{return STEP_STATUS.UNFINISHED;}};_this.onCurrentPositionChanged=function(position){var stepCount=_this.props.stepCount;if(position>stepCount-1){position=stepCount-1;}var animateToPosition=_this.state.progressBarSize/(stepCount-1)*position;_this.sizeAnim.setValue(_this.state.customStyles.stepIndicatorSize);_this.borderRadiusAnim.setValue(_this.state.customStyles.stepIndicatorSize/2);_reactNative.Animated.sequence([_reactNative.Animated.timing(_this.progressAnim,{toValue:animateToPosition,duration:200}),_reactNative.Animated.parallel([_reactNative.Animated.timing(_this.sizeAnim,{toValue:_this.state.customStyles.currentStepIndicatorSize,duration:100}),_reactNative.Animated.timing(_this.borderRadiusAnim,{toValue:_this.state.customStyles.currentStepIndicatorSize/2,duration:100})])]).start();};var defaultStyles={stepIndicatorSize:30,currentStepIndicatorSize:40,separatorStrokeWidth:3,separatorStrokeUnfinishedWidth:0,separatorStrokeFinishedWidth:0,currentStepStrokeWidth:5,stepStrokeWidth:0,stepStrokeCurrentColor:"#4aae4f",stepStrokeFinishedColor:"#4aae4f",stepStrokeUnFinishedColor:"#4aae4f",separatorFinishedColor:"#4aae4f",separatorUnFinishedColor:"#a4d4a5",stepIndicatorFinishedColor:"#4aae4f",stepIndicatorUnFinishedColor:"#a4d4a5",stepIndicatorCurrentColor:"#ffffff",stepIndicatorLabelFontSize:15,currentStepIndicatorLabelFontSize:15,stepIndicatorLabelCurrentColor:"#000000",stepIndicatorLabelFinishedColor:"#ffffff",stepIndicatorLabelUnFinishedColor:"rgba(255,255,255,0.5)",labelColor:"#000000",labelSize:13,labelAlign:"center",currentStepLabelColor:"#4aae4f"};var customStyles=Object.assign(defaultStyles,props.customStyles);_this.state={width:0,height:1,progressBarSize:-2,customStyles:customStyles};_this.progressAnim=new _reactNative.Animated.Value(0);_this.sizeAnim=new _reactNative.Animated.Value(_this.state.customStyles.stepIndicatorSize);_this.borderRadiusAnim=new _reactNative.Animated.Value(_this.state.customStyles.stepIndicatorSize/2);return _this;}(0,_createClass2.default)(StepIndicator,[{key:"stepPressed",value:function stepPressed(position){if(this.props.onPress){this.props.onPress(position);}}},{key:"render",value:function render(){var _this$props5=this.props,labels=_this$props5.labels,direction=_this$props5.direction;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,direction==="vertical"?{flexDirection:"row",flex:1}:{flexDirection:"column"}],children:[this.state.width!==0&&this.renderProgressBarBackground(),this.state.width!==0&&this.renderProgressBar(),this.renderStepIndicator(),labels&&this.renderStepLabels()]});}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){if(prevProps.currentPosition!==this.props.currentPosition){this.onCurrentPositionChanged(this.props.currentPosition);}}}]);return StepIndicator;}(_react.Component);exports.default=StepIndicator;var styles=_reactNative.StyleSheet.create({container:{backgroundColor:"transparent"},stepIndicatorContainer:{flexDirection:"row",alignItems:"center",justifyContent:"space-around",backgroundColor:"transparent"},stepLabelsContainer:{justifyContent:"space-around"},step:{alignItems:"center",justifyContent:"center",zIndex:2},stepContainer:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center"},stepLabel:{fontSize:12,textAlign:"center",fontWeight:"500"},stepLabelItem:{flex:1,alignItems:"center",justifyContent:"center"}});StepIndicator.defaultProps={currentPosition:0,stepCount:5,customStyles:{},direction:"horizontal"};
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));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 _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/StepIndicator.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 _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 STEP_STATUS={CURRENT:"current",FINISHED:"finished",UNFINISHED:"unfinished"};var StepIndicator=function(_Component){(0,_inherits2.default)(StepIndicator,_Component);var _super=_createSuper(StepIndicator);function StepIndicator(props){var _this;(0,_classCallCheck2.default)(this,StepIndicator);_this=_super.call(this,props);_this.renderProgressBarBackground=function(){var _this$props=_this.props,stepCount=_this$props.stepCount,direction=_this$props.direction;var progressBarBackgroundStyle;if(direction==="vertical"){progressBarBackgroundStyle={backgroundColor:_this.state.customStyles.separatorUnFinishedColor,position:"absolute",left:(_this.state.width-_this.state.customStyles.separatorStrokeWidth)/2,top:_this.state.height/(2*stepCount),bottom:_this.state.height/(2*stepCount),width:_this.state.customStyles.separatorStrokeUnfinishedWidth===0?_this.state.customStyles.separatorStrokeWidth:_this.state.customStyles.separatorStrokeUnfinishedWidth};}else{progressBarBackgroundStyle={backgroundColor:_this.state.customStyles.separatorUnFinishedColor,position:"absolute",top:(_this.state.height-_this.state.customStyles.separatorStrokeWidth)/2,left:_this.state.width/(2*stepCount),right:_this.state.width/(2*stepCount),height:_this.state.customStyles.separatorStrokeUnfinishedWidth===0?_this.state.customStyles.separatorStrokeWidth:_this.state.customStyles.separatorStrokeUnfinishedWidth};}return(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:function onLayout(event){if(direction==="vertical"){_this.setState({progressBarSize:event.nativeEvent.layout.height},function(){_this.onCurrentPositionChanged(_this.props.currentPosition);});}else{_this.setState({progressBarSize:event.nativeEvent.layout.width},function(){_this.onCurrentPositionChanged(_this.props.currentPosition);});}},style:progressBarBackgroundStyle});};_this.renderProgressBar=function(){var _this$props2=_this.props,stepCount=_this$props2.stepCount,direction=_this$props2.direction;var progressBarStyle;if(direction==="vertical"){progressBarStyle={backgroundColor:_this.state.customStyles.separatorFinishedColor,position:"absolute",left:(_this.state.width-_this.state.customStyles.separatorStrokeWidth)/2,top:_this.state.height/(2*stepCount),bottom:_this.state.height/(2*stepCount),width:_this.state.customStyles.separatorStrokeFinishedWidth===0?_this.state.customStyles.separatorStrokeWidth:_this.state.customStyles.separatorStrokeFinishedWidth,height:_this.progressAnim};}else{progressBarStyle={backgroundColor:_this.state.customStyles.separatorFinishedColor,position:"absolute",top:(_this.state.height-_this.state.customStyles.separatorStrokeWidth)/2,left:_this.state.width/(2*stepCount),right:_this.state.width/(2*stepCount),height:_this.state.customStyles.separatorStrokeFinishedWidth===0?_this.state.customStyles.separatorStrokeWidth:_this.state.customStyles.separatorStrokeFinishedWidth,width:_this.progressAnim};}return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:progressBarStyle});};_this.renderStepIndicator=function(){var steps=[];var _this$props3=_this.props,stepCount=_this$props3.stepCount,direction=_this$props3.direction;var _loop=function _loop(position){steps.push((0,_jsxRuntime.jsx)(_reactNative.TouchableWithoutFeedback,{onPress:function onPress(){return _this.stepPressed(position);},children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.stepContainer,direction==="vertical"?{flexDirection:"column"}:{flexDirection:"row"}],children:_this.renderStep(position)})},position));};for(var position=0;position<stepCount;position++){_loop(position);}return(0,_jsxRuntime.jsx)(_reactNative.View,{onLayout:function onLayout(event){return _this.setState({width:event.nativeEvent.layout.width,height:event.nativeEvent.layout.height});},style:[styles.stepIndicatorContainer,direction==="vertical"?{flexDirection:"column",width:_this.state.customStyles.currentStepIndicatorSize}:{flexDirection:"row",height:_this.state.customStyles.currentStepIndicatorSize}],children:steps});};_this.renderStepLabels=function(){var _this$props4=_this.props,labels=_this$props4.labels,direction=_this$props4.direction,currentPosition=_this$props4.currentPosition,renderLabel=_this$props4.renderLabel;var labelViews=labels.map(function(label,index){var selectedStepLabelStyle=index===currentPosition?{color:_this.state.customStyles.currentStepLabelColor}:{color:_this.state.customStyles.labelColor};return(0,_jsxRuntime.jsx)(_reactNative.TouchableWithoutFeedback,{style:styles.stepLabelItem,onPress:function onPress(){return _this.stepPressed(index);},children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.stepLabelItem,children:renderLabel?renderLabel({position:index,stepStatus:_this.getStepStatus(index),label:label,currentPosition:currentPosition}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.stepLabel,selectedStepLabelStyle,{fontSize:_this.state.customStyles.labelSize,fontFamily:_this.state.customStyles.labelFontFamily}],children:label})})},index);});return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.stepLabelsContainer,direction==="vertical"?{flexDirection:"column",paddingHorizontal:4}:{flexDirection:"row",paddingVertical:4},{alignItems:_this.state.customStyles.labelAlign}],children:labelViews});};_this.renderStep=function(position){var renderStepIndicator=_this.props.renderStepIndicator;var stepStyle;var indicatorLabelStyle;switch(_this.getStepStatus(position)){case STEP_STATUS.CURRENT:{stepStyle={backgroundColor:_this.state.customStyles.stepIndicatorCurrentColor,borderWidth:_this.state.customStyles.currentStepStrokeWidth,borderColor:_this.state.customStyles.stepStrokeCurrentColor,height:_this.sizeAnim,width:_this.sizeAnim,borderRadius:_this.borderRadiusAnim};indicatorLabelStyle={fontSize:_this.state.customStyles.currentStepIndicatorLabelFontSize,color:_this.state.customStyles.stepIndicatorLabelCurrentColor};break;}case STEP_STATUS.FINISHED:{stepStyle={backgroundColor:_this.state.customStyles.stepIndicatorFinishedColor,borderWidth:_this.state.customStyles.stepStrokeWidth,borderColor:_this.state.customStyles.stepStrokeFinishedColor,height:_this.state.customStyles.stepIndicatorSize,width:_this.state.customStyles.stepIndicatorSize,borderRadius:_this.state.customStyles.stepIndicatorSize/2};indicatorLabelStyle={fontSize:_this.state.customStyles.stepIndicatorLabelFontSize,color:_this.state.customStyles.stepIndicatorLabelFinishedColor};break;}case STEP_STATUS.UNFINISHED:{stepStyle={backgroundColor:_this.state.customStyles.stepIndicatorUnFinishedColor,borderWidth:_this.state.customStyles.stepStrokeWidth,borderColor:_this.state.customStyles.stepStrokeUnFinishedColor,height:_this.state.customStyles.stepIndicatorSize,width:_this.state.customStyles.stepIndicatorSize,borderRadius:_this.state.customStyles.stepIndicatorSize/2};indicatorLabelStyle={overflow:"hidden",fontSize:_this.state.customStyles.stepIndicatorLabelFontSize,color:_this.state.customStyles.stepIndicatorLabelUnFinishedColor};break;}default:}return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[styles.step,stepStyle],children:renderStepIndicator?renderStepIndicator({position:position,stepStatus:_this.getStepStatus(position)}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:indicatorLabelStyle,children:`${position+1}`})},"step-indicator");};_this.getStepStatus=function(stepPosition){var currentPosition=_this.props.currentPosition;if(stepPosition===currentPosition){return STEP_STATUS.CURRENT;}else if(stepPosition<currentPosition){return STEP_STATUS.FINISHED;}else{return STEP_STATUS.UNFINISHED;}};_this.onCurrentPositionChanged=function(position){var stepCount=_this.props.stepCount;if(position>stepCount-1){position=stepCount-1;}var animateToPosition=_this.state.progressBarSize/(stepCount-1)*position;_this.sizeAnim.setValue(_this.state.customStyles.stepIndicatorSize);_this.borderRadiusAnim.setValue(_this.state.customStyles.stepIndicatorSize/2);_reactNative.Animated.sequence([_reactNative.Animated.timing(_this.progressAnim,{toValue:animateToPosition,duration:200}),_reactNative.Animated.parallel([_reactNative.Animated.timing(_this.sizeAnim,{toValue:_this.state.customStyles.currentStepIndicatorSize,duration:100}),_reactNative.Animated.timing(_this.borderRadiusAnim,{toValue:_this.state.customStyles.currentStepIndicatorSize/2,duration:100})])]).start();};var defaultStyles={stepIndicatorSize:30,currentStepIndicatorSize:40,separatorStrokeWidth:3,separatorStrokeUnfinishedWidth:0,separatorStrokeFinishedWidth:0,currentStepStrokeWidth:5,stepStrokeWidth:0,stepStrokeCurrentColor:"#4aae4f",stepStrokeFinishedColor:"#4aae4f",stepStrokeUnFinishedColor:"#4aae4f",separatorFinishedColor:"#4aae4f",separatorUnFinishedColor:"#a4d4a5",stepIndicatorFinishedColor:"#4aae4f",stepIndicatorUnFinishedColor:"#a4d4a5",stepIndicatorCurrentColor:"#ffffff",stepIndicatorLabelFontSize:15,currentStepIndicatorLabelFontSize:15,stepIndicatorLabelCurrentColor:"#000000",stepIndicatorLabelFinishedColor:"#ffffff",stepIndicatorLabelUnFinishedColor:"rgba(255,255,255,0.5)",labelColor:"#000000",labelSize:13,labelAlign:"center",currentStepLabelColor:"#4aae4f"};var customStyles=Object.assign(defaultStyles,props.customStyles);_this.state={width:0,height:1,progressBarSize:-2,customStyles:customStyles};_this.progressAnim=new _reactNative.Animated.Value(0);_this.sizeAnim=new _reactNative.Animated.Value(_this.state.customStyles.stepIndicatorSize);_this.borderRadiusAnim=new _reactNative.Animated.Value(_this.state.customStyles.stepIndicatorSize/2);return _this;}(0,_createClass2.default)(StepIndicator,[{key:"stepPressed",value:function stepPressed(position){if(this.props.onPress){this.props.onPress(position);}}},{key:"render",value:function render(){var _this$props5=this.props,labels=_this$props5.labels,direction=_this$props5.direction;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.container,direction==="vertical"?{flexDirection:"row",flex:1}:{flexDirection:"column"}],children:[this.state.width!==0&&this.renderProgressBarBackground(),this.state.width!==0&&this.renderProgressBar(),this.renderStepIndicator(),labels&&this.renderStepLabels()]});}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){if(prevProps.currentPosition!==this.props.currentPosition){this.onCurrentPositionChanged(this.props.currentPosition);}}}]);return StepIndicator;}(_react.Component);exports.default=StepIndicator;var styles=_reactNative.StyleSheet.create({container:{backgroundColor:"transparent"},stepIndicatorContainer:{flexDirection:"row",alignItems:"center",justifyContent:"space-around",backgroundColor:"transparent"},stepLabelsContainer:{justifyContent:"space-around"},step:{alignItems:"center",justifyContent:"center",zIndex:2},stepContainer:{flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center"},stepLabel:{fontSize:12,textAlign:"center",fontWeight:"500"},stepLabelItem:{flex:1,alignItems:"center",justifyContent:"center"}});StepIndicator.defaultProps={currentPosition:0,stepCount:5,customStyles:{},direction:"horizontal"};
|
|
@@ -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;exports.useDeepCompareEffect=useDeepCompareEffect;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(
|
|
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.useDeepCompareEffect=useDeepCompareEffect;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));}function useDeepCompareEffect(effect,deps){return _react.default.useEffect(effect,deps==null?void 0:deps.map(useDeepCompareMemoize));}
|
|
@@ -17,5 +17,5 @@ declare type AccordionGroupProps = {
|
|
|
17
17
|
} & IconSlot;
|
|
18
18
|
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<AccordionGroupProps, "theme"> & {
|
|
19
19
|
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
20
|
-
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<AccordionGroupProps> & (({ label, expanded: expandedProp, openColor, closedColor, caretColor: caretColorProp, caretSize, icon, iconSize, style, children, theme, Icon, }: AccordionGroupProps) => JSX.Element), {}>;
|
|
20
|
+
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<AccordionGroupProps> & (({ label, expanded: expandedProp, openColor, closedColor, caretColor: caretColorProp, caretSize, icon, iconSize, style, children, theme, Icon, }: AccordionGroupProps) => React.JSX.Element), {}>;
|
|
21
21
|
export default _default;
|
|
@@ -4,5 +4,5 @@ interface Props {
|
|
|
4
4
|
onClose: () => void;
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
}
|
|
7
|
-
declare const ActionSheet: ({ visible, onClose, children }: Props) => JSX.Element;
|
|
7
|
+
declare const ActionSheet: ({ visible, onClose, children }: Props) => React.JSX.Element;
|
|
8
8
|
export default ActionSheet;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { StyleProp, ViewStyle, ScrollViewProps } from "react-native";
|
|
3
|
-
import BottomSheetComponent from "./BottomSheetComponent";
|
|
4
3
|
import type { Theme } from "../../styles/DefaultTheme";
|
|
5
4
|
declare type SnapPosition = "top" | "middle" | "bottom";
|
|
6
5
|
export interface BottomSheetProps extends ScrollViewProps {
|
|
7
6
|
topSnapPosition?: string | number;
|
|
8
7
|
middleSnapPosition?: string | number;
|
|
9
8
|
bottomSnapPosition?: string | number;
|
|
9
|
+
/**
|
|
10
|
+
* As distance from top (number or percentage string), sorted from top to bottom
|
|
11
|
+
*/
|
|
10
12
|
snapPoints?: (string | number)[];
|
|
11
13
|
initialSnapIndex?: number;
|
|
12
14
|
initialSnapPosition?: SnapPosition;
|
|
@@ -22,7 +24,7 @@ export interface BottomSheetProps extends ScrollViewProps {
|
|
|
22
24
|
style?: StyleProp<ViewStyle>;
|
|
23
25
|
theme: Theme;
|
|
24
26
|
}
|
|
25
|
-
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<BottomSheetProps & React.RefAttributes<
|
|
27
|
+
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<BottomSheetProps & React.RefAttributes<import("@gorhom/bottom-sheet/lib/typescript/types").BottomSheetMethods>, "theme"> & {
|
|
26
28
|
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
27
|
-
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<BottomSheetProps & React.RefAttributes<
|
|
29
|
+
}> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<BottomSheetProps & React.RefAttributes<import("@gorhom/bottom-sheet/lib/typescript/types").BottomSheetMethods>> & React.ForwardRefExoticComponent<BottomSheetProps & React.RefAttributes<import("@gorhom/bottom-sheet/lib/typescript/types").BottomSheetMethods>>, {}>;
|
|
28
30
|
export default _default;
|
|
@@ -1,72 +1,81 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { StyleSheet,
|
|
3
|
-
import BottomSheetComponent from "
|
|
2
|
+
import { StyleSheet, Dimensions, } from "react-native";
|
|
3
|
+
import BottomSheetComponent, { BottomSheetScrollView, } from "@gorhom/bottom-sheet";
|
|
4
4
|
import { withTheme } from "../../theming";
|
|
5
|
+
import { useDeepCompareMemo } from "../../utilities";
|
|
6
|
+
const windowHeight = Dimensions.get("window").height;
|
|
7
|
+
// Clarification:
|
|
8
|
+
// Input of snap points is sorted top -> bottom where each value represents distance from top
|
|
9
|
+
// Implementation using `@gorhom/bottom-sheet` is sorted bottom -> top where each value represents distance from bottom
|
|
5
10
|
const BottomSheet = React.forwardRef(({ theme, snapPoints: snapPointsProp, topSnapPosition = "10%", middleSnapPosition = "50%", bottomSnapPosition = "80%", initialSnapIndex, initialSnapPosition = "bottom", showHandle = true, handleColor = theme.colors.divider, topBorderRadius = 20, borderWidth = 1, borderColor = theme.colors.divider, onSettle, style, children, ...rest }, ref) => {
|
|
6
11
|
const backgroundColor = (style === null || style === void 0 ? void 0 : style.backgroundColor) || theme.colors.background;
|
|
7
|
-
const snapPoints = snapPointsProp
|
|
12
|
+
const snapPoints = snapPointsProp !== null && snapPointsProp !== void 0 ? snapPointsProp : [
|
|
8
13
|
topSnapPosition,
|
|
9
14
|
middleSnapPosition,
|
|
10
15
|
bottomSnapPosition,
|
|
11
16
|
];
|
|
17
|
+
const mappedSnapPoints = useDeepCompareMemo(() => convertSnapPointsForNewImplementation(snapPoints), snapPoints);
|
|
12
18
|
const getSnapIndexFromPosition = (position) => {
|
|
13
19
|
switch (position) {
|
|
14
|
-
case "
|
|
20
|
+
case "bottom":
|
|
15
21
|
return 0;
|
|
16
22
|
case "middle":
|
|
17
23
|
return 1;
|
|
18
|
-
case "
|
|
24
|
+
case "top":
|
|
19
25
|
return 2;
|
|
20
26
|
}
|
|
21
27
|
};
|
|
22
|
-
return (React.createElement(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
borderTopLeftRadius: topBorderRadius,
|
|
36
|
-
borderTopRightRadius: topBorderRadius,
|
|
37
|
-
borderWidth,
|
|
38
|
-
borderColor,
|
|
39
|
-
},
|
|
40
|
-
]), onSettle: onSettle, ...rest }, children)));
|
|
28
|
+
return (React.createElement(BottomSheetComponent, { ref: ref, snapPoints: mappedSnapPoints, index: initialSnapIndex != undefined
|
|
29
|
+
? mappedSnapPoints.length - initialSnapIndex - 1
|
|
30
|
+
: getSnapIndexFromPosition(initialSnapPosition), handleIndicatorStyle: [
|
|
31
|
+
{ backgroundColor: handleColor },
|
|
32
|
+
!showHandle ? { display: "none" } : {},
|
|
33
|
+
], backgroundStyle: {
|
|
34
|
+
backgroundColor,
|
|
35
|
+
borderTopLeftRadius: topBorderRadius,
|
|
36
|
+
borderTopRightRadius: topBorderRadius,
|
|
37
|
+
borderWidth,
|
|
38
|
+
borderColor,
|
|
39
|
+
}, onChange: (index) => onSettle === null || onSettle === void 0 ? void 0 : onSettle(mappedSnapPoints.length - index - 1) },
|
|
40
|
+
React.createElement(BottomSheetScrollView, { contentContainerStyle: [styles.contentContainerStyle, style], ...rest }, children)));
|
|
41
41
|
});
|
|
42
|
+
// @gorhom/bottom-sheet has a different format for snap points and requires some manipulation
|
|
43
|
+
function convertSnapPointsForNewImplementation(snapPoints) {
|
|
44
|
+
// Older implementation required snap points sorted top -> bottom, new library requires bottom -> top
|
|
45
|
+
const reversedSnapPoints = [...snapPoints].reverse();
|
|
46
|
+
// Older implementation required snap points as distance from top, new library requires them as distance from bottom
|
|
47
|
+
return reversedSnapPoints.map((point) => {
|
|
48
|
+
if (typeof point === "string") {
|
|
49
|
+
const percentNumber = extractPercentNumber(point);
|
|
50
|
+
if (percentNumber !== undefined) {
|
|
51
|
+
return `${100 - percentNumber}%`;
|
|
52
|
+
}
|
|
53
|
+
return point;
|
|
54
|
+
}
|
|
55
|
+
else if (typeof point === "number") {
|
|
56
|
+
return windowHeight - point;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return point;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function extractPercentNumber(percentString) {
|
|
64
|
+
const percentRegex = /(\d+)?%/;
|
|
65
|
+
const matches = percentString.match(percentRegex);
|
|
66
|
+
if (matches === null || matches === void 0 ? void 0 : matches.length) {
|
|
67
|
+
const percentNumber = Number(matches[1]);
|
|
68
|
+
if (!isNaN(percentNumber)) {
|
|
69
|
+
return percentNumber;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
42
74
|
const styles = StyleSheet.create({
|
|
43
|
-
//Render on top of everything
|
|
44
|
-
parentContainer: {
|
|
45
|
-
position: "absolute",
|
|
46
|
-
left: 0,
|
|
47
|
-
right: 0,
|
|
48
|
-
top: 0,
|
|
49
|
-
bottom: 0,
|
|
50
|
-
zIndex: 10,
|
|
51
|
-
overflow: "hidden",
|
|
52
|
-
},
|
|
53
75
|
contentContainerStyle: {
|
|
54
76
|
paddingHorizontal: 16,
|
|
55
77
|
paddingVertical: 10,
|
|
56
78
|
},
|
|
57
|
-
containerStyle: {
|
|
58
|
-
flex: 1,
|
|
59
|
-
overflow: "hidden",
|
|
60
|
-
},
|
|
61
|
-
handleContainer: {
|
|
62
|
-
alignItems: "center",
|
|
63
|
-
paddingVertical: 20,
|
|
64
|
-
},
|
|
65
|
-
handle: {
|
|
66
|
-
width: 40,
|
|
67
|
-
height: 2,
|
|
68
|
-
borderRadius: 4,
|
|
69
|
-
},
|
|
70
79
|
});
|
|
71
80
|
export default withTheme(BottomSheet);
|
|
72
81
|
//# sourceMappingURL=BottomSheet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.js","sourceRoot":"","sources":["../../../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,UAAU,
|
|
1
|
+
{"version":3,"file":"BottomSheet.js","sourceRoot":"","sources":["../../../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,UAAU,EAIV,UAAU,GACX,MAAM,cAAc,CAAC;AAEtB,OAAO,oBAAoB,EAAE,EAC3B,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAIrD,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;AAyBrD,iBAAiB;AACjB,6FAA6F;AAC7F,uHAAuH;AACvH,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAClC,CACE,EACE,KAAK,EACL,UAAU,EAAE,cAAc,EAC1B,eAAe,GAAG,KAAK,EACvB,kBAAkB,GAAG,KAAK,EAC1B,kBAAkB,GAAG,KAAK,EAC1B,gBAAgB,EAChB,mBAAmB,GAAG,QAAQ,EAC9B,UAAU,GAAG,IAAI,EACjB,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,EAClC,eAAe,GAAG,EAAE,EACpB,WAAW,GAAG,CAAC,EACf,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,EAClC,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,GAAG,IAAI,EACR,EACD,GAAG,EACH,EAAE;IACF,MAAM,eAAe,GACnB,CAAC,KAAmB,aAAnB,KAAK,uBAAL,KAAK,CAAgB,eAAe,KAAI,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;IAEnE,MAAM,UAAU,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI;QACnC,eAAe;QACf,kBAAkB;QAClB,kBAAkB;KACnB,CAAC;IAEF,MAAM,gBAAgB,GAAG,kBAAkB,CACzC,GAAG,EAAE,CAAC,qCAAqC,CAAC,UAAU,CAAC,EACvD,UAAU,CACX,CAAC;IAEF,MAAM,wBAAwB,GAAG,CAAC,QAAsB,EAAE,EAAE;QAC1D,QAAQ,QAAQ,EAAE;YAChB,KAAK,QAAQ;gBACX,OAAO,CAAC,CAAC;YACX,KAAK,QAAQ;gBACX,OAAO,CAAC,CAAC;YACX,KAAK,KAAK;gBACR,OAAO,CAAC,CAAC;SACZ;IACH,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,oBAAoB,IACnB,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,gBAAgB,EAC5B,KAAK,EACH,gBAAgB,IAAI,SAAS;YAC3B,CAAC,CAAC,gBAAgB,CAAC,MAAM,GAAG,gBAAgB,GAAG,CAAC;YAChD,CAAC,CAAC,wBAAwB,CAAC,mBAAmB,CAAC,EAEnD,oBAAoB,EAAE;YACpB,EAAE,eAAe,EAAE,WAAW,EAAE;YAChC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE;SACvC,EACD,eAAe,EAAE;YACf,eAAe;YACf,mBAAmB,EAAE,eAAe;YACpC,oBAAoB,EAAE,eAAe;YACrC,WAAW;YACX,WAAW;SACZ,EACD,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,gBAAgB,CAAC,MAAM,GAAG,KAAK,GAAG,CAAC,CAAC;QAEpE,oBAAC,qBAAqB,IACpB,qBAAqB,EAAE,CAAC,MAAM,CAAC,qBAAqB,EAAE,KAAK,CAAC,KACxD,IAAI,IAEP,QAAQ,CACa,CACH,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,6FAA6F;AAC7F,SAAS,qCAAqC,CAC5C,UAA+B;IAE/B,qGAAqG;IACrG,MAAM,kBAAkB,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;IAErD,oHAAoH;IACpH,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACtC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,MAAM,aAAa,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;YAClD,IAAI,aAAa,KAAK,SAAS,EAAE;gBAC/B,OAAO,GAAG,GAAG,GAAG,aAAa,GAAG,CAAC;aAClC;YACD,OAAO,KAAK,CAAC;SACd;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YACpC,OAAO,YAAY,GAAG,KAAK,CAAC;SAC7B;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,oBAAoB,CAAC,aAAqB;IACjD,MAAM,YAAY,GAAG,SAAS,CAAC;IAC/B,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAClD,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,EAAE;QACnB,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;YACzB,OAAO,aAAa,CAAC;SACtB;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,qBAAqB,EAAE;QACrB,iBAAiB,EAAE,EAAE;QACrB,eAAe,EAAE,EAAE;KACpB;CACF,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC,WAAW,CAAC,CAAC"}
|