@draftbit/core 49.2.5 → 49.2.6-faee0d.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/Provider.js +1 -1
- package/lib/commonjs/components/AccordionGroup.js +1 -1
- package/lib/commonjs/components/ActionSheet/ActionSheet.js +1 -1
- package/lib/commonjs/components/ActionSheet/ActionSheetCancel.js +1 -1
- package/lib/commonjs/components/ActionSheet/ActionSheetItem.js +1 -1
- package/lib/commonjs/components/ActionSheet/index.js +1 -1
- package/lib/commonjs/components/AspectRatio.js +1 -1
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +1 -1
- package/lib/commonjs/components/BottomSheet/index.js +1 -1
- package/lib/commonjs/components/Button.js +1 -1
- package/lib/commonjs/components/Checkbox/Checkbox.js +1 -1
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +1 -1
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +1 -1
- package/lib/commonjs/components/Checkbox/context.js +1 -1
- package/lib/commonjs/components/Checkbox/index.js +1 -1
- package/lib/commonjs/components/Config.js +1 -1
- package/lib/commonjs/components/DatePicker/DatePicker.js +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponent.js +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponentType.js +1 -1
- package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +1 -1
- package/lib/commonjs/components/DeckSwiper/DeckSwiperCard.js +1 -1
- package/lib/commonjs/components/DeckSwiper/index.js +1 -1
- package/lib/commonjs/components/Divider.js +1 -1
- package/lib/commonjs/components/Elevation.js +1 -1
- package/lib/commonjs/components/FormRow.js +1 -1
- package/lib/commonjs/components/IconButton.js +1 -1
- package/lib/commonjs/components/Image.js +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView.js +1 -1
- package/lib/commonjs/components/Layout/AspectRatio.js +1 -1
- package/lib/commonjs/components/Layout/Center.js +1 -1
- package/lib/commonjs/components/Layout/Circle.js +1 -1
- package/lib/commonjs/components/Layout/HStack.js +1 -1
- package/lib/commonjs/components/Layout/LayoutCommon.js +1 -1
- package/lib/commonjs/components/Layout/Spacer.js +1 -1
- package/lib/commonjs/components/Layout/Square.js +1 -1
- package/lib/commonjs/components/Layout/VStack.js +1 -1
- package/lib/commonjs/components/Layout/ZStack.js +1 -1
- package/lib/commonjs/components/Layout/index.js +1 -1
- package/lib/commonjs/components/Markdown.js +1 -1
- package/lib/commonjs/components/MediaPlayer/AudioPlayer/AudioPlayerCommon.js +1 -1
- package/lib/commonjs/components/MediaPlayer/AudioPlayer/AudioPlayerWithInterface.js +1 -1
- package/lib/commonjs/components/MediaPlayer/AudioPlayer/HeadlessAudioPlayer.js +1 -1
- package/lib/commonjs/components/MediaPlayer/AudioPlayer/index.js +1 -1
- package/lib/commonjs/components/MediaPlayer/MediaPlaybackWrapper.js +1 -1
- package/lib/commonjs/components/MediaPlayer/MediaPlayerCommon.js +1 -1
- package/lib/commonjs/components/MediaPlayer/VideoPlayer/VideoPlayer.js +1 -1
- package/lib/commonjs/components/MediaPlayer/VideoPlayer/index.js +1 -1
- package/lib/commonjs/components/NumberInput.js +1 -1
- package/lib/commonjs/components/Picker/NativePicker.js +1 -1
- package/lib/commonjs/components/Picker/PickerCommon.js +1 -1
- package/lib/commonjs/components/Picker/PickerInputContainer.js +1 -1
- package/lib/commonjs/components/Picker/dropdown/DropDownPicker.js +1 -1
- package/lib/commonjs/components/Picker/dropdown/MultiSelectPicker.js +1 -1
- package/lib/commonjs/components/Picker/dropdown/PickerItem.js +1 -1
- package/lib/commonjs/components/Picker/index.js +1 -1
- package/lib/commonjs/components/PinInput/CustomPinInputCell.js +1 -1
- package/lib/commonjs/components/PinInput/PinInput.js +1 -1
- package/lib/commonjs/components/PinInput/PinInputText.js +1 -1
- package/lib/commonjs/components/PinInput/index.js +1 -1
- package/lib/commonjs/components/Portal/Portal.js +1 -1
- package/lib/commonjs/components/Portal/PortalConsumer.js +1 -1
- package/lib/commonjs/components/Portal/PortalHost.js +1 -1
- package/lib/commonjs/components/Portal/PortalManager.js +1 -1
- package/lib/commonjs/components/Pressable.js +1 -1
- package/lib/commonjs/components/Progress/CircularProgress/CircularProgress.js +1 -1
- package/lib/commonjs/components/Progress/CircularProgress/index.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/Progress/LinearProgress/index.js +1 -1
- package/lib/commonjs/components/Progress/ProgressCommon.js +1 -1
- package/lib/commonjs/components/ProgressIndicator.js +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonGroup.js +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +1 -1
- package/lib/commonjs/components/RadioButton/context.js +1 -1
- package/lib/commonjs/components/RadioButton/index.js +1 -1
- package/lib/commonjs/components/Row.js +1 -1
- package/lib/commonjs/components/SVG.js +1 -1
- package/lib/commonjs/components/ScreenContainer.js +1 -1
- package/lib/commonjs/components/SectionList/SectionHeader.js +1 -1
- package/lib/commonjs/components/SectionList/SectionList.js +1 -1
- package/lib/commonjs/components/SectionList/index.js +1 -1
- package/lib/commonjs/components/Shadow.js +1 -1
- package/lib/commonjs/components/Slider.js +1 -1
- package/lib/commonjs/components/StarRating.js +1 -1
- package/lib/commonjs/components/StepIndicator.js +1 -1
- package/lib/commonjs/components/Stepper.js +1 -1
- package/lib/commonjs/components/Surface.js +1 -1
- package/lib/commonjs/components/SwipeableItem/SwipeableItem.js +1 -1
- package/lib/commonjs/components/SwipeableItem/SwipeableItemButton.js +1 -1
- package/lib/commonjs/components/SwipeableItem/SwipeableItemCommon.js +1 -1
- package/lib/commonjs/components/SwipeableItem/SwipeableList.js +1 -1
- package/lib/commonjs/components/SwipeableItem/index.js +1 -1
- package/lib/commonjs/components/Swiper/Swiper.js +1 -1
- package/lib/commonjs/components/Swiper/SwiperItem.js +1 -1
- package/lib/commonjs/components/Swiper/index.js +1 -1
- package/lib/commonjs/components/Switch.js +1 -1
- package/lib/commonjs/components/TabView/TabView.js +1 -1
- package/lib/commonjs/components/TabView/TabViewItem.js +1 -1
- package/lib/commonjs/components/TabView/index.js +1 -1
- package/lib/commonjs/components/Table/Table.js +1 -1
- package/lib/commonjs/components/Table/TableCell.js +1 -1
- package/lib/commonjs/components/Table/TableCommon.js +1 -1
- package/lib/commonjs/components/Table/TableRow.js +1 -1
- package/lib/commonjs/components/Table/index.js +1 -1
- package/lib/commonjs/components/Text.js +1 -1
- package/lib/commonjs/components/TextField.js +1 -1
- package/lib/commonjs/components/TextInput.js +1 -1
- package/lib/commonjs/components/Touchable.js +1 -1
- package/lib/commonjs/components/Touchable.web.js +1 -1
- package/lib/commonjs/components/Typography.js +1 -1
- package/lib/commonjs/components/YoutubePlayer/YoutubePlayer.js +1 -1
- package/lib/commonjs/components/YoutubePlayer/YoutubePlayer.native.js +2 -2
- package/lib/commonjs/components/YoutubePlayer/YoutubePlayerProps.js +1 -1
- package/lib/commonjs/components/YoutubePlayer/index.js +1 -1
- package/lib/commonjs/components/useAuthState.js +1 -1
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/deprecated-components/AccordionItem.js +1 -1
- package/lib/commonjs/deprecated-components/AnimatedCircularProgress.js +1 -1
- package/lib/commonjs/deprecated-components/AvatarEdit.js +1 -1
- package/lib/commonjs/deprecated-components/AvoidKeyboardView.js +1 -1
- package/lib/commonjs/deprecated-components/Banner.js +1 -1
- package/lib/commonjs/deprecated-components/Card.js +1 -1
- package/lib/commonjs/deprecated-components/CheckboxGroup.js +1 -1
- package/lib/commonjs/deprecated-components/CircleImage.js +1 -1
- package/lib/commonjs/deprecated-components/CircularProgress.js +1 -1
- package/lib/commonjs/deprecated-components/Container.js +1 -1
- package/lib/commonjs/deprecated-components/DeprecatedButton.js +1 -1
- package/lib/commonjs/deprecated-components/DeprecatedCardWrapper.js +1 -1
- package/lib/commonjs/deprecated-components/DeprecatedFAB.js +1 -1
- package/lib/commonjs/deprecated-components/FAB.js +1 -1
- package/lib/commonjs/deprecated-components/FieldSearchBarFull.js +1 -1
- package/lib/commonjs/deprecated-components/Layout.js +1 -1
- package/lib/commonjs/deprecated-components/ProgressBar.js +1 -1
- package/lib/commonjs/deprecated-components/ProgressCircle.js +1 -1
- package/lib/commonjs/deprecated-components/RadioButtonFieldGroup.js +1 -1
- package/lib/commonjs/deprecated-components/RowBodyIcon.js +1 -1
- package/lib/commonjs/deprecated-components/RowHeadlineImageCaption.js +1 -1
- package/lib/commonjs/deprecated-components/RowHeadlineImageIcon.js +1 -1
- package/lib/commonjs/deprecated-components/ToggleButton.js +1 -1
- package/lib/commonjs/hooks.js +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/interfaces/Icon.js +1 -1
- package/lib/commonjs/styles/DarkTheme.js +1 -1
- package/lib/commonjs/styles/DefaultTheme.js +1 -1
- package/lib/commonjs/styles/fonts.js +1 -1
- package/lib/commonjs/styles/overlay.js +1 -1
- package/lib/commonjs/styles/shadow.js +1 -1
- package/lib/commonjs/theming.js +1 -1
- package/lib/commonjs/utilities.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/LinearProgress/LinearProgress.tsx";import React from"react";import Svg,{Line}from"react-native-svg";import{View}from"react-native";import Animated,{useAnimatedProps,useSharedValue,withTiming}from"react-native-reanimated";import{DEFAULT_ANIMATION_DURATION}from"../ProgressCommon";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export var AnimatedLine=Animated.createAnimatedComponent(Line);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\"}"};export 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?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.useState(0),_React$useState2=_slicedToArray(_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=useSharedValue(0);var progressLineAnimatedProps=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.useEffect(function(){currentProgressLineWidth.value=withTiming(progressLineWidth*currentFillPercentage,{duration:isAnimated?animationDuration:0});},[value,progressLineWidth,currentFillPercentage,animationDuration,currentProgressLineWidth,maximumValue,minimumValue,isAnimated]);return _jsx(View,{onLayout:function onLayout(event){var width=event.nativeEvent.layout.width;setSvgContainerWidth(width);onFullPathWidth==null?void 0:onFullPathWidth(width);},style:[{height:maxThickness},style],children:_jsxs(Svg,{testID:testID!=null?testID:"linear-progress-component",style:{flex:1},children:[showTrack&&_jsx(Line,{x1:thicknessOffset,y1:thicknessOffset,x2:trackProgressLineWidth,y2:thicknessOffset,stroke:trackColor,strokeWidth:trackThickness,strokeOpacity:trackOpacity,strokeLinecap:trackLineCap,strokeDasharray:trackCustomDashArray||trackDashArray,strokeDashoffset:trackDashOffset}),_jsx(AnimatedLine,{animatedProps:progressLineAnimatedProps,x1:thicknessOffset,y1:thicknessOffset,y2:thicknessOffset,stroke:color,strokeWidth:thickness,strokeLinecap:lineCap,strokeDasharray:customDashArray||dashArray,strokeDashoffset:dashOffset,onPress:function onPress(){}})]})});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Progress/LinearProgress/index.tsx";import React from"react";import IndeterminateProgress from"../IndeterminateProgress";import{LinearProgress as LinearProgressComponent}from"./LinearProgress";import{withTheme}from"../../../theming";import{jsx as _jsx}from"react/jsx-runtime";var LinearProgress=function LinearProgress(props){if(props.indeterminate){return _jsx(IndeterminateProgress,Object.assign({ProgressComponent:LinearProgressComponent},props));}else{return _jsx(LinearProgressComponent,Object.assign({},props));}};export default withTheme(LinearProgress);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export var DEFAULT_ANIMATION_DURATION=500;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/ProgressIndicator.tsx";import*as React from"react";import StepIndicator from"./StepIndicator";import{withTheme}from"../theming";import{jsx as _jsx}from"react/jsx-runtime";var ProgressIndicator=function ProgressIndicator(_ref){var numberOfSteps=_ref.numberOfSteps,currentStep=_ref.currentStep,_ref$currentStepStrok=_ref.currentStepStrokeWidth,currentStepStrokeWidth=_ref$currentStepStrok===void 0?3:_ref$currentStepStrok,_ref$stepStrokeCurren=_ref.stepStrokeCurrentColor,stepStrokeCurrentColor=_ref$stepStrokeCurren===void 0?"primary":_ref$stepStrokeCurren,stepIndicatorSize=_ref.stepIndicatorSize,currentStepIndicatorSize=_ref.currentStepIndicatorSize,stepIndicatorCurrentColor=_ref.stepIndicatorCurrentColor,stepIndicatorLabelCurrentColor=_ref.stepIndicatorLabelCurrentColor,_ref$stepIndicatorLab=_ref.stepIndicatorLabelFontSize,stepIndicatorLabelFontSize=_ref$stepIndicatorLab===void 0?12:_ref$stepIndicatorLab,_ref$stepNumberFinish=_ref.stepNumberFinishedColor,stepNumberFinishedColor=_ref$stepNumberFinish===void 0?"strongInverse":_ref$stepNumberFinish,_ref$stepNumberUnfini=_ref.stepNumberUnfinishedColor,stepNumberUnfinishedColor=_ref$stepNumberUnfini===void 0?"primary":_ref$stepNumberUnfini,_ref$unfinishedColor=_ref.unfinishedColor,unfinishedColor=_ref$unfinishedColor===void 0?"light":_ref$unfinishedColor,_ref$finishedColor=_ref.finishedColor,finishedColor=_ref$finishedColor===void 0?"primary":_ref$finishedColor,theme=_ref.theme;var currentPosition=currentStep-1;return _jsx(StepIndicator,{stepCount:numberOfSteps,currentPosition:currentPosition,customStyles:{stepIndicatorSize:stepIndicatorSize,currentStepIndicatorSize:currentStepIndicatorSize?currentStepIndicatorSize:stepIndicatorSize,stepStrokeFinishedColor:finishedColor,stepStrokeUnFinishedColor:unfinishedColor,separatorFinishedColor:finishedColor,separatorUnFinishedColor:unfinishedColor,stepIndicatorFinishedColor:finishedColor,stepIndicatorUnFinishedColor:unfinishedColor,currentStepStrokeWidth:currentStepStrokeWidth,stepStrokeCurrentColor:stepStrokeCurrentColor||stepIndicatorCurrentColor,stepIndicatorLabelUnFinishedColor:stepNumberUnfinishedColor,stepIndicatorLabelFinishedColor:stepNumberFinishedColor,stepIndicatorCurrentColor:stepIndicatorCurrentColor||unfinishedColor,stepIndicatorLabelCurrentColor:stepIndicatorLabelCurrentColor||stepNumberUnfinishedColor,stepIndicatorLabelFontSize:stepIndicatorLabelFontSize,labelFontFamily:theme.typography.body1.fontFamily}});};export default withTheme(ProgressIndicator);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["Icon","disabled","color","value","selected","unselectedColor","onPress","size","selectedIcon","unselectedIcon","style"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/RadioButton/RadioButton.tsx";import*as React from"react";import Config from"../Config";import IconButton from"../IconButton";import{getValueForRadioButton}from"../../utilities";import{useRadioButtonGroupContext}from"./context";import{jsx as _jsx}from"react/jsx-runtime";var RadioButton=function RadioButton(_ref){var Icon=_ref.Icon,_ref$disabled=_ref.disabled,disabled=_ref$disabled===void 0?false:_ref$disabled,color=_ref.color,_ref$value=_ref.value,value=_ref$value===void 0?"":_ref$value,selected=_ref.selected,unselectedColor=_ref.unselectedColor,onPress=_ref.onPress,_ref$size=_ref.size,size=_ref$size===void 0?Config.radioButtonSize:_ref$size,_ref$selectedIcon=_ref.selectedIcon,selectedIcon=_ref$selectedIcon===void 0?"MaterialIcons/radio-button-checked":_ref$selectedIcon,_ref$unselectedIcon=_ref.unselectedIcon,unselectedIcon=_ref$unselectedIcon===void 0?"MaterialIcons/radio-button-unchecked":_ref$unselectedIcon,style=_ref.style,rest=_objectWithoutProperties(_ref,_excluded);var _useRadioButtonGroupC=useRadioButtonGroupContext(),contextValue=_useRadioButtonGroupC.value,onValueChange=_useRadioButtonGroupC.onValueChange;var realValue=getValueForRadioButton(value);var realContextValue=getValueForRadioButton(contextValue);var isSelected=selected!=null?selected:realContextValue===realValue;var handlePress=function handlePress(){onPress==null?void 0:onPress(realValue);onValueChange==null?void 0:onValueChange(realValue);};return _jsx(IconButton,Object.assign({Icon:Icon,icon:isSelected?selectedIcon:unselectedIcon,color:isSelected?color:unselectedColor,disabled:disabled,onPress:handlePress,size:size,style:style},rest));};export default RadioButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["direction","value","onValueChange","defaultValue","style","children"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/RadioButton/RadioButtonGroup.tsx";import*as React from"react";import{View}from"react-native";import{getValueForRadioButton}from"../../utilities";import{radioButtonGroupContext,Direction}from"./context";import{jsx as _jsx}from"react/jsx-runtime";var Provider=radioButtonGroupContext.Provider;var RadioButtonGroup=function RadioButtonGroup(_ref){var _ref$direction=_ref.direction,direction=_ref$direction===void 0?Direction.Vertical:_ref$direction,_ref$value=_ref.value,value=_ref$value===void 0?"":_ref$value,onValueChange=_ref.onValueChange,defaultValue=_ref.defaultValue,style=_ref.style,children=_ref.children,rest=_objectWithoutProperties(_ref,_excluded);var _React$useState=React.useState(""),_React$useState2=_slicedToArray(_React$useState,2),internalValue=_React$useState2[0],setInternalValue=_React$useState2[1];React.useEffect(function(){if(value!=null){var realValue=getValueForRadioButton(value);setInternalValue(realValue);}},[value]);React.useEffect(function(){if(defaultValue!=null){var realDefaultValue=getValueForRadioButton(defaultValue);setInternalValue(realDefaultValue);}},[defaultValue]);var handleValueChange=function handleValueChange(newValue){var realNewValue=getValueForRadioButton(newValue);setInternalValue(realNewValue);onValueChange==null?void 0:onValueChange(realNewValue);};var _containerStyle=[{flexDirection:direction===Direction.Horizontal?"row":"column"}];if(direction!==Direction.Vertical){_containerStyle.push({alignItems:"center"});}return _jsx(View,Object.assign({style:[{minHeight:40},style]},rest,{children:_jsx(Provider,{value:{value:internalValue,onValueChange:handleValueChange,direction:direction},children:_jsx(View,{style:_containerStyle,children:children})})}));};export default RadioButtonGroup;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["Icon","label","value","color","unselectedColor","onPress","labelContainerStyle","labelStyle","radioButtonStyle","direction","selected","disabled","style"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/RadioButton/RadioButtonRow.tsx";import*as React from"react";import{StyleSheet,View,Platform}from"react-native";import RadioButton from"./RadioButton";import Text from"../Text";import{useRadioButtonGroupContext}from"./context";import{Direction as GroupDirection}from"./context";import Touchable from"../Touchable";import{extractStyles,getValueForRadioButton}from"../../utilities";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";export var Direction=function(Direction){Direction["Row"]="row";Direction["RowReverse"]="row-reverse";return Direction;}({});var getRadioButtonAlignment=function getRadioButtonAlignment(parentDirection,direction){if(parentDirection===GroupDirection.Horizontal){return direction===Direction.Row?"flex-start":"flex-end";}else if(direction===Direction.RowReverse){return"flex-start";}else{return"flex-end";}};var renderLabel=function renderLabel(value,labelStyle,textStyle){if(typeof value==="string"){return _jsx(Text,{style:[labelStyle,textStyle],children:value});}else{return _jsx(_Fragment,{children:value});}};var RadioButtonRow=function RadioButtonRow(_ref){var Icon=_ref.Icon,label=_ref.label,_ref$value=_ref.value,value=_ref$value===void 0?"":_ref$value,color=_ref.color,unselectedColor=_ref.unselectedColor,onPress=_ref.onPress,labelContainerStyle=_ref.labelContainerStyle,labelStyle=_ref.labelStyle,radioButtonStyle=_ref.radioButtonStyle,_ref$direction=_ref.direction,direction=_ref$direction===void 0?Direction.Row:_ref$direction,selected=_ref.selected,disabled=_ref.disabled,style=_ref.style,rest=_objectWithoutProperties(_ref,_excluded);var _useRadioButtonGroupC=useRadioButtonGroupContext(),contextValue=_useRadioButtonGroupC.value,onValueChange=_useRadioButtonGroupC.onValueChange,parentDirection=_useRadioButtonGroupC.direction;var realValue=getValueForRadioButton(value);var realContextValue=getValueForRadioButton(contextValue);var isSelected=selected!=null?selected:realContextValue===realValue;var handlePress=function handlePress(){onPress==null?void 0:onPress(realValue);onValueChange==null?void 0:onValueChange(realValue);};var _extractStyles=extractStyles(style),textStyles=_extractStyles.textStyles,viewStyles=_extractStyles.viewStyles;return _jsxs(Touchable,Object.assign({onPress:handlePress,style:[styles.mainParent,{flexDirection:direction},viewStyles],disabled:disabled},rest,{children:[_jsx(View,{style:[styles.label,{alignItems:direction===Direction.Row?"flex-start":"flex-end"},labelContainerStyle],children:renderLabel(label,labelStyle,textStyles)}),_jsx(View,{style:{flex:1,alignItems:getRadioButtonAlignment(parentDirection,direction)},children:_jsx(RadioButton,{Icon:Icon,selected:isSelected,value:realValue,color:color,unselectedColor:unselectedColor,style:radioButtonStyle})})]}));};var styles=StyleSheet.create({mainParent:Object.assign({alignItems:"center",justifyContent:"space-around",paddingStart:20,minHeight:50,paddingEnd:20,display:"flex"},Platform.select({web:{cursor:"pointer",userSelect:"none"}})),label:{flex:3}});export default RadioButtonRow;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{createContext,useContext}from"react";export var Direction=function(Direction){Direction["Horizontal"]="horizontal";Direction["Vertical"]="vertical";return Direction;}({});export var radioButtonGroupContext=createContext({onValueChange:function onValueChange(){},value:"",direction:undefined});export function useRadioButtonGroupContext(){return useContext(radioButtonGroupContext);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{default as RadioButton}from"./RadioButton";export{default as RadioButtonGroup}from"./RadioButtonGroup";export{default as RadioButtonRow}from"./RadioButtonRow";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Row.tsx";import*as React from"react";import{View,Text,Image,StyleSheet}from"react-native";import{withTheme}from"../theming";import Config from"./Config";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var Row=function Row(_ref){var titleTypeStyle=_ref.titleTypeStyle,titleColor=_ref.titleColor,subtitleTypeStyle=_ref.subtitleTypeStyle,subtitleColor=_ref.subtitleColor,title=_ref.title,subtitle=_ref.subtitle,multilineSubtitle=_ref.multilineSubtitle,image=_ref.image,right=_ref.right,style=_ref.style;return _jsxs(View,{style:[styles.container,{padding:16},style],children:[_jsxs(View,{style:styles.leftContainer,children:[image&&_jsx(Image,{source:typeof image==="string"?{uri:image}:image,style:{marginRight:12,width:subtitle?Config.rowMultiLineImageSize:Config.rowSingleLineImageSize,height:subtitle?Config.rowMultiLineImageSize:Config.rowSingleLineImageSize}}),_jsxs(View,{style:styles.textContainer,children:[_jsx(Text,{style:[titleTypeStyle,{color:titleColor}],numberOfLines:1,children:title}),subtitle?_jsx(Text,{style:[subtitleTypeStyle,{color:subtitleColor,marginTop:4}],numberOfLines:multilineSubtitle?undefined:1,children:subtitle}):null]})]}),right&&right()]});};var styles=StyleSheet.create({leftContainer:{flexDirection:"row",flex:1},container:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},textContainer:{flex:1,justifyContent:"center"}});export default withTheme(Row);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/SVG.tsx";import*as React from"react";import{View,Platform,Image}from"react-native";import{SvgUri}from"react-native-svg";import Config from"./Config";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var SVG=function SVG(_ref){var _ref$source=_ref.source,source=_ref$source===void 0?Config.placeholderSvgURL:_ref$source,style=_ref.style;return _jsxs(_Fragment,{children:[Platform.OS==="ios"&&_jsx(View,{style:style,children:_jsx(SvgUri,{width:"100%",height:"100%",uri:source})}),Platform.OS==="android"&&_jsx(View,{style:style,children:_jsx(SvgUri,{width:"100%",height:"100%",uri:source})}),Platform.OS==="web"&&_jsx(Image,{style:style,source:{uri:source}})]});};export default SVG;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/ScreenContainer.tsx";var _excluded=["scrollable","hasSafeArea","hasBottomSafeArea","hasTopSafeArea","theme","style","children"];import*as React from"react";import{StyleSheet,ScrollView,View}from"react-native";import{SafeAreaView}from"react-native-safe-area-context";import{withTheme}from"../theming";import{jsx as _jsx}from"react/jsx-runtime";function ScreenContainer(_ref){var _StyleSheet$flatten;var _ref$scrollable=_ref.scrollable,scrollable=_ref$scrollable===void 0?false:_ref$scrollable,_ref$hasSafeArea=_ref.hasSafeArea,hasSafeArea=_ref$hasSafeArea===void 0?false:_ref$hasSafeArea,_ref$hasBottomSafeAre=_ref.hasBottomSafeArea,hasBottomSafeArea=_ref$hasBottomSafeAre===void 0?false:_ref$hasBottomSafeAre,_ref$hasTopSafeArea=_ref.hasTopSafeArea,hasTopSafeArea=_ref$hasTopSafeArea===void 0?false:_ref$hasTopSafeArea,theme=_ref.theme,style=_ref.style,children=_ref.children,rest=_objectWithoutProperties(_ref,_excluded);var backgroundColor=((_StyleSheet$flatten=StyleSheet.flatten(style))==null?void 0:_StyleSheet$flatten.backgroundColor)||theme.colors.background;var edges=["left","right"];if(hasSafeArea||hasTopSafeArea){edges.push("top");}if(hasSafeArea||hasBottomSafeArea){edges.push("bottom");}return _jsx(SafeAreaView,Object.assign({edges:edges,style:[styles.container,{backgroundColor:backgroundColor}]},rest,{children:scrollable?_jsx(ScrollView,{contentContainerStyle:[styles.scrollViewContainer,{backgroundColor:backgroundColor},style],children:children}):_jsx(View,{style:[styles.container,{backgroundColor:backgroundColor},style],children:children})}));}var styles=StyleSheet.create({container:{flex:1},scrollViewContainer:{flexGrow:1,flex:undefined}});export default withTheme(ScreenContainer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/SectionList/SectionHeader.tsx";import React from"react";import{View,Text}from"react-native";import{withTheme}from"../../theming";import{jsx as _jsx}from"react/jsx-runtime";var SectionHeader=function SectionHeader(_ref){var style=_ref.style,children=_ref.children;return _jsx(View,{style:[style],children:children});};export var DefaultSectionHeader=withTheme(function(_ref2){var title=_ref2.title,theme=_ref2.theme;return _jsx(Text,{testID:"default-section-header",style:{color:theme.colors.background,backgroundColor:theme.colors.primary,fontSize:16,padding:10},children:title});});export default SectionHeader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";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";import React from"react";import{FlashList}from"@shopify/flash-list";import{FlatList}from"react-native";import SectionHeader,{DefaultSectionHeader}from"./SectionHeader";import{flattenReactFragments}from"../../utilities";import{jsx as _jsx}from"react/jsx-runtime";export var DEFAULT_SECTION="Uncategorized";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=_objectWithoutProperties(_ref,_excluded);var data=React.useMemo(function(){return Array.isArray(dataProp)?dataProp:[];},[dataProp]);var dataWithSections=React.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,_toConsumableArray(sectionItems));}return result;},[data,sectionKey]);var sectionHeaderIndicies=React.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=flattenReactFragments(React.Children.toArray(props.children));if(element.type===SectionHeader){return element;}else{for(var child of children){if(child.type===SectionHeader){return child;}}}return null;};var extractRemainingNonSectionHeader=function extractRemainingNonSectionHeader(element){if(!element){return null;}var props=element.props||{};var children=flattenReactFragments(React.Children.toArray(props.children));if(element.type===SectionHeader){return null;}else{var newChildren=[];for(var child of children){if(child.type!==SectionHeader){newChildren.push(child);}}return React.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)||_jsx(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 _jsx(FlatList,Object.assign({stickyHeaderIndices:sectionHeaderIndicies},rest,{data:dataWithSections,renderItem:renderItem,keyExtractor:keyExtractor}));case"FlashList":return _jsx(FlashList,Object.assign({stickyHeaderIndices:sectionHeaderIndicies},rest,{data:dataWithSections,renderItem:renderItem,keyExtractor:keyExtractor}));}};export default SectionList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{default as SectionList}from"./SectionList";export{default as SectionHeader}from"./SectionHeader";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["offsetX","offsetY","showShadowSideStart","showShadowSideEnd","showShadowSideTop","showShadowSideBottom","showShadowCornerTopStart","showShadowCornerTopEnd","showShadowCornerBottomStart","showShadowCornerBottomEnd","paintInside","style"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Shadow.tsx";import React from"react";import{StyleSheet}from"react-native";import{Shadow as ShadowComponent}from"react-native-shadow-2";import{extractBorderAndMarginStyles,extractSizeStyles}from"../utilities";import{jsx as _jsx}from"react/jsx-runtime";var Shadow=function Shadow(_ref){var _ref$offsetX=_ref.offsetX,offsetX=_ref$offsetX===void 0?0:_ref$offsetX,_ref$offsetY=_ref.offsetY,offsetY=_ref$offsetY===void 0?0:_ref$offsetY,_ref$showShadowSideSt=_ref.showShadowSideStart,showShadowSideStart=_ref$showShadowSideSt===void 0?true:_ref$showShadowSideSt,_ref$showShadowSideEn=_ref.showShadowSideEnd,showShadowSideEnd=_ref$showShadowSideEn===void 0?true:_ref$showShadowSideEn,_ref$showShadowSideTo=_ref.showShadowSideTop,showShadowSideTop=_ref$showShadowSideTo===void 0?true:_ref$showShadowSideTo,_ref$showShadowSideBo=_ref.showShadowSideBottom,showShadowSideBottom=_ref$showShadowSideBo===void 0?true:_ref$showShadowSideBo,_ref$showShadowCorner=_ref.showShadowCornerTopStart,showShadowCornerTopStart=_ref$showShadowCorner===void 0?true:_ref$showShadowCorner,_ref$showShadowCorner2=_ref.showShadowCornerTopEnd,showShadowCornerTopEnd=_ref$showShadowCorner2===void 0?true:_ref$showShadowCorner2,_ref$showShadowCorner3=_ref.showShadowCornerBottomStart,showShadowCornerBottomStart=_ref$showShadowCorner3===void 0?true:_ref$showShadowCorner3,_ref$showShadowCorner4=_ref.showShadowCornerBottomEnd,showShadowCornerBottomEnd=_ref$showShadowCorner4===void 0?true:_ref$showShadowCorner4,_ref$paintInside=_ref.paintInside,paintInside=_ref$paintInside===void 0?true:_ref$paintInside,style=_ref.style,rest=_objectWithoutProperties(_ref,_excluded);var _extractBorderAndMarg=extractBorderAndMarginStyles(style),borderStyles=_extractBorderAndMarg.borderStyles;var shadowStyles=StyleSheet.flatten([borderStyles,extractSizeStyles(style)]);var containerStyle=StyleSheet.flatten(style);Object.keys(shadowStyles).forEach(function(key){return delete containerStyle[key];});return _jsx(ShadowComponent,Object.assign({offset:[offsetX,offsetY],sides:{start:showShadowSideStart,end:showShadowSideEnd,top:showShadowSideTop,bottom:showShadowSideBottom},corners:{topStart:showShadowCornerTopStart,topEnd:showShadowCornerTopEnd,bottomStart:showShadowCornerBottomStart,bottomEnd:showShadowCornerBottomEnd},style:shadowStyles,containerStyle:containerStyle,paintInside:paintInside},rest));};export default Shadow;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Slider.tsx";var _excluded=["Icon","leftIcon","rightIcon","leftIconColor","rightIconColor","value","defaultValue","minimumTrackTintColor","maximumTrackTintColor","thumbTintColor","minimumValue","maximumValue","tapToSeek","step","onValueChange","style","theme"];import*as React from"react";import{View,StyleSheet,Platform}from"react-native";import NativeSlider from"@react-native-community/slider";import isNumber from"lodash.isnumber";import toNumber from"lodash.tonumber";import{withTheme}from"../theming";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";function maybeParseValue(value){if(value===undefined){return undefined;}if(isNumber(value)){return value;}try{var maybe=toNumber(value);if(isNumber(maybe)){return maybe;}}catch(_unused){return undefined;}return undefined;}function Slider(_ref){var Icon=_ref.Icon,leftIcon=_ref.leftIcon,rightIcon=_ref.rightIcon,leftIconColor=_ref.leftIconColor,rightIconColor=_ref.rightIconColor,value=_ref.value,defaultValue=_ref.defaultValue,minimumTrackTintColor=_ref.minimumTrackTintColor,maximumTrackTintColor=_ref.maximumTrackTintColor,thumbTintColor=_ref.thumbTintColor,_ref$minimumValue=_ref.minimumValue,minimumValue=_ref$minimumValue===void 0?0:_ref$minimumValue,_ref$maximumValue=_ref.maximumValue,maximumValue=_ref$maximumValue===void 0?100:_ref$maximumValue,tapToSeek=_ref.tapToSeek,_ref$step=_ref.step,step=_ref$step===void 0?1:_ref$step,_ref$onValueChange=_ref.onValueChange,onValueChange=_ref$onValueChange===void 0?function(){}:_ref$onValueChange,style=_ref.style,theme=_ref.theme,rest=_objectWithoutProperties(_ref,_excluded);var _React$useState=React.useState(value||defaultValue),_React$useState2=_slicedToArray(_React$useState,2),internalValue=_React$useState2[0],setInternalValue=_React$useState2[1];var _React$useState3=React.useState({width:0,height:0}),_React$useState4=_slicedToArray(_React$useState3,2),tempThumbStyle=_React$useState4[0],setTempThumbStyle=_React$useState4[1];React.useEffect(function(){setTempThumbStyle({width:undefined,height:undefined});},[]);React.useEffect(function(){if(value!=null){setInternalValue(value);}},[value]);React.useEffect(function(){if(defaultValue!=null){setInternalValue(defaultValue);}},[defaultValue]);var minTrackColor=minimumTrackTintColor||theme.colors.primary;var maxTrackColor=maximumTrackTintColor||theme.colors.light;var thumbColor=thumbTintColor||theme.colors.primary;var leftIconThemeColor=leftIconColor||theme.colors.light;var rightIconThemeColor=rightIconColor||theme.colors.light;var parsedValue=maybeParseValue(internalValue);var handleSlidingComplete=function handleSlidingComplete(newValue){setInternalValue(newValue);onValueChange(newValue);};return _jsxs(View,Object.assign({style:[styles.container,style]},rest,{children:[leftIcon?_jsx(Icon,{color:leftIconThemeColor,name:leftIcon,size:24}):null,_jsx(NativeSlider,{value:parsedValue,step:step,minimumValue:minimumValue,maximumValue:maximumValue,tapToSeek:tapToSeek,minimumTrackTintColor:minTrackColor,maximumTrackTintColor:maxTrackColor,thumbTintColor:thumbColor,onSlidingComplete:handleSlidingComplete,style:styles.slider,thumbStyle:Platform.OS==="web"?tempThumbStyle:undefined}),rightIcon?_jsx(Icon,{color:rightIconThemeColor,name:rightIcon,size:24}):null]}));}var styles=StyleSheet.create({container:{height:40,flexDirection:"row",alignItems:"center"},slider:{flex:1,marginHorizontal:12}});export default withTheme(Slider);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["Icon","starSize","maxStars","rating","defaultValue","isEditable","activeColor","inactiveColor","style","onPress"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/StarRating.tsx";import*as React from"react";import{View,StyleSheet,Pressable}from"react-native";import{withTheme}from"../theming";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var StarRating=function StarRating(_ref){var Icon=_ref.Icon,_ref$starSize=_ref.starSize,starSize=_ref$starSize===void 0?16:_ref$starSize,_ref$maxStars=_ref.maxStars,maxStars=_ref$maxStars===void 0?5:_ref$maxStars,_ref$rating=_ref.rating,rating=_ref$rating===void 0?0:_ref$rating,defaultValue=_ref.defaultValue,_ref$isEditable=_ref.isEditable,isEditable=_ref$isEditable===void 0?false:_ref$isEditable,activeColor=_ref.activeColor,inactiveColor=_ref.inactiveColor,style=_ref.style,onPress=_ref.onPress,rest=_objectWithoutProperties(_ref,_excluded);var _React$useState=React.useState(rating||defaultValue||0),_React$useState2=_slicedToArray(_React$useState,2),localRating=_React$useState2[0],setLocalRating=_React$useState2[1];React.useEffect(function(){if(rating!=null){setLocalRating(rating);}},[rating]);React.useEffect(function(){if(defaultValue!=null){setLocalRating(defaultValue);}},[defaultValue]);var ratingHandler=React.useCallback(function(r){setLocalRating(r);!!onPress&&onPress(r);},[onPress]);var ratingRounded=Math.round(localRating*2)/2;return _jsx(View,Object.assign({style:[styles.container,style]},rest,{children:_toConsumableArray(Array(maxStars)).map(function(_,i){return _jsxs(View,{style:{display:"flex"},children:[_jsx(Icon,{name:ratingRounded-i===0.5?"MaterialIcons/star-half":"MaterialIcons/star",size:starSize,color:ratingRounded>i?activeColor:inactiveColor}),isEditable&&_jsxs(View,{style:styles.touchContainer,children:[_jsx(Pressable,{style:styles.pressable,onPress:function onPress(){return ratingHandler(i+0.5);}}),_jsx(Pressable,{style:styles.pressable,onPress:function onPress(){return ratingHandler(i+1);}})]})]},i);})}));};var styles=StyleSheet.create({container:{flexDirection:"row",alignItems:"center"},touchContainer:{display:"flex",flexDirection:"row",position:"absolute",top:0,right:0,left:0,bottom:0,zIndex:1},pressable:{flex:1,height:"100%",width:"50%"}});export default withTheme(StarRating);
|
|
@@ -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
|
+
import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inherits from"@babel/runtime/helpers/inherits";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";var _jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/StepIndicator.tsx";function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}import React,{Component}from"react";import{View,Text,StyleSheet,Animated,TouchableWithoutFeedback}from"react-native";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var STEP_STATUS={CURRENT:"current",FINISHED:"finished",UNFINISHED:"unfinished"};var StepIndicator=function(_Component){_inherits(StepIndicator,_Component);var _super=_createSuper(StepIndicator);function StepIndicator(props){var _this;_classCallCheck(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 _jsx(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 _jsx(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(_jsx(TouchableWithoutFeedback,{onPress:function onPress(){return _this.stepPressed(position);},children:_jsx(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 _jsx(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 _jsx(TouchableWithoutFeedback,{style:styles.stepLabelItem,onPress:function onPress(){return _this.stepPressed(index);},children:_jsx(View,{style:styles.stepLabelItem,children:renderLabel?renderLabel({position:index,stepStatus:_this.getStepStatus(index),label:label,currentPosition:currentPosition}):_jsx(Text,{style:[styles.stepLabel,selectedStepLabelStyle,{fontSize:_this.state.customStyles.labelSize,fontFamily:_this.state.customStyles.labelFontFamily}],children:label})})},index);});return _jsx(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 _jsx(Animated.View,{style:[styles.step,stepStyle],children:renderStepIndicator?renderStepIndicator({position:position,stepStatus:_this.getStepStatus(position)}):_jsx(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);Animated.sequence([Animated.timing(_this.progressAnim,{toValue:animateToPosition,duration:200}),Animated.parallel([Animated.timing(_this.sizeAnim,{toValue:_this.state.customStyles.currentStepIndicatorSize,duration:100}),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 Animated.Value(0);_this.sizeAnim=new Animated.Value(_this.state.customStyles.stepIndicatorSize);_this.borderRadiusAnim=new Animated.Value(_this.state.customStyles.stepIndicatorSize/2);return _this;}_createClass(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 _jsxs(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;}(Component);export{StepIndicator as default};var styles=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
|
-
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Stepper.tsx";import React,{useEffect,useState}from"react";import{View,Text}from"react-native";import{isNumber}from"lodash";import{withTheme}from"../theming";import IconButton from"./IconButton";import{extractStyles}from"../utilities";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var Stepper=function Stepper(_ref){var _ref$min=_ref.min,min=_ref$min===void 0?-Infinity:_ref$min,_ref$max=_ref.max,max=_ref$max===void 0?Infinity:_ref$max,valueProp=_ref.value,defaultValue=_ref.defaultValue,style=_ref.style,_ref$iconSize=_ref.iconSize,iconSize=_ref$iconSize===void 0?24:_ref$iconSize,iconColor=_ref.iconColor,onChange=_ref.onChange,_ref$theme=_ref.theme,colors=_ref$theme.colors,typography=_ref$theme.typography,Icon=_ref.Icon;var _extractStyles=extractStyles(style),viewStyles=_extractStyles.viewStyles,textStyles=_extractStyles.textStyles;var _useState=useState(defaultValue!=null?defaultValue:0),_useState2=_slicedToArray(_useState,2),value=_useState2[0],setValue=_useState2[1];var isValidValue=function isValidValue(valueArg){return valueArg>=min&&valueArg<=max;};var handlePlusOrMinus=function handlePlusOrMinus(type){var newValue=type==="plus"?value+1:value-1;if(isValidValue(newValue)){setValue(newValue);onChange==null?void 0:onChange(newValue);}};useEffect(function(){if(valueProp!=null&&isNumber(valueProp)&&valueProp!==value&&isValidValue(valueProp)){setValue(valueProp);}},[valueProp]);return _jsxs(View,{style:[{flexDirection:"row"},viewStyles],children:[_jsx(IconButton,{Icon:Icon,icon:"MaterialIcons/remove",onPress:function onPress(){return handlePlusOrMinus("minus");},size:iconSize,color:iconColor,disabled:value===min,style:{opacity:value===min?0.5:1}}),_jsx(Text,{style:[typography.body1,{textAlign:"center",alignSelf:"center",color:colors.medium,marginHorizontal:8},textStyles],children:value}),_jsx(IconButton,{Icon:Icon,icon:"MaterialIcons/add",onPress:function onPress(){return handlePlusOrMinus("plus");},size:iconSize,color:iconColor,disabled:value===max,style:{opacity:value===max?0.5:1}})]});};export default withTheme(Stepper);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["elevation","style","theme","children"],_excluded2=["elevation","backgroundColor"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Surface.tsx";import*as React from"react";import{Animated,StyleSheet}from"react-native";import shadow from"../styles/shadow";import overlay from"../styles/overlay";import{withTheme}from"../theming";import{jsx as _jsx}from"react/jsx-runtime";var Surface=function Surface(_ref){var propElevation=_ref.elevation,style=_ref.style,theme=_ref.theme,children=_ref.children,rest=_objectWithoutProperties(_ref,_excluded);var _ref2=StyleSheet.flatten(style)||{},_ref2$elevation=_ref2.elevation,styleElevation=_ref2$elevation===void 0?3:_ref2$elevation,backgroundColor=_ref2.backgroundColor,restStyle=_objectWithoutProperties(_ref2,_excluded2);var isDarkTheme=theme.dark,mode=theme.mode,colors=theme.colors;var elevation=propElevation!=null?propElevation:styleElevation;var evalationStyles=elevation?shadow(elevation):{};var getBackgroundColor=function getBackgroundColor(){if(backgroundColor){return backgroundColor;}else if(isDarkTheme&&mode==="adaptive"){return overlay(elevation,colors.surface);}else{return colors.surface;}};return _jsx(Animated.View,Object.assign({},rest,{style:[Object.assign({backgroundColor:getBackgroundColor(),elevation:elevation},evalationStyles,restStyle)],children:children}));};export default withTheme(Surface);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["theme","style","children","Icon","closeOnPress","leftOpenValue","rightOpenValue","leftActivationValue","rightActivationValue","swipeActivationPercentage","stopLeftSwipe","stopRightSwipe","friction","disableLeftSwipe","disableRightSwipe"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/SwipeableItem/SwipeableItem.tsx";import React from"react";import{View,StyleSheet,Text}from"react-native";import Pressable from"../Pressable";import{extractBorderAndMarginStyles,extractEffectStyles,extractFlexItemStyles,extractPositionStyles,extractSizeStyles,extractStyles,flattenReactFragments}from"../../utilities";import{SwipeRow}from"react-native-swipe-list-view";import{withTheme}from"../../theming";import SwipeableItemButton from"./SwipeableItemButton";import{SwipeableListContext}from"./SwipeableList";import{leftSwipeToSwipeableItemBehindItem,rightSwipeToSwipeableItemBehindItem,extractLeftSwipeProps,extractRightSwipeProps}from"./SwipeableItemCommon";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var SwipeableItem=function SwipeableItem(_ref){var theme=_ref.theme,style=_ref.style,childrenProp=_ref.children,Icon=_ref.Icon,closeOnPress=_ref.closeOnPress,leftOpenValue=_ref.leftOpenValue,rightOpenValue=_ref.rightOpenValue,leftActivationValue=_ref.leftActivationValue,rightActivationValue=_ref.rightActivationValue,_ref$swipeActivationP=_ref.swipeActivationPercentage,swipeActivationPercentage=_ref$swipeActivationP===void 0?80:_ref$swipeActivationP,stopLeftSwipe=_ref.stopLeftSwipe,stopRightSwipe=_ref.stopRightSwipe,_ref$friction=_ref.friction,friction=_ref$friction===void 0?20:_ref$friction,disableLeftSwipe=_ref.disableLeftSwipe,disableRightSwipe=_ref.disableRightSwipe,rest=_objectWithoutProperties(_ref,_excluded);var isEmptyObject=function isEmptyObject(object){return Object.keys(object).length===0;};var _React$useContext=React.useContext(SwipeableListContext),onStartSwiping=_React$useContext.onStartSwiping,onStopSwiping=_React$useContext.onStopSwiping;var swipeableRef=React.useRef(null);var _extractStyles=extractStyles(style),viewStyles=_extractStyles.viewStyles,textStyles=_extractStyles.textStyles;var _extractBorderAndMarg=extractBorderAndMarginStyles(viewStyles),borderStyles=_extractBorderAndMarg.borderStyles,marginStyles=_extractBorderAndMarg.marginStyles;var sizeStyles=extractSizeStyles(viewStyles);var parentContainerStyles=StyleSheet.flatten([borderStyles,marginStyles,extractFlexItemStyles(viewStyles),extractPositionStyles(viewStyles),extractEffectStyles(viewStyles),sizeStyles]);Object.keys(parentContainerStyles).forEach(function(key){return delete viewStyles[key];});var surfaceContainerStyles=StyleSheet.flatten([viewStyles,sizeStyles]);var _React$useState=React.useState(null),_React$useState2=_slicedToArray(_React$useState,2),componentWidth=_React$useState2[0],setComponentWidth=_React$useState2[1];var children=React.useMemo(function(){return flattenReactFragments(React.Children.toArray(childrenProp));},[childrenProp]);var leftSwipeButtons=React.useMemo(function(){return children.filter(function(child){return React.isValidElement(child)&&child.type===SwipeableItemButton&&child.props.revealSwipeDirection==="left";});},[children]);var rightSwipeButtons=React.useMemo(function(){return children.filter(function(child){return React.isValidElement(child)&&child.type===SwipeableItemButton&&child.props.revealSwipeDirection==="right";});},[children]);var remainingChildren=React.useMemo(function(){return React.Children.toArray(children).filter(function(child){return React.isValidElement(child)&&child.type!==SwipeableItemButton;});},[children]);var leftSwipe=extractLeftSwipeProps(rest);var rightSwipe=extractRightSwipeProps(rest);var isLeftSwipeHandled=!isEmptyObject(leftSwipe);var isRightSwipeHandled=!isEmptyObject(rightSwipe);if(leftSwipeButtons.length>2||rightSwipeButtons.length>2){throw Error("Cannot have more than 2 SwipeableItemButton(s) per side");}if(leftSwipeButtons.length&&isLeftSwipeHandled||rightSwipeButtons.length&&isRightSwipeHandled){throw Error("Colliding configuration in SwipeableItem. You cannot have SwipeableItemButton(s) on the swipe direction where swipe handling is configured. Either reset swipe configuration or remove the button(s).");}var renderBehindItem=function renderBehindItem(item,index){return _jsxs(Pressable,{testID:"swipeable-behind-item",onPress:function onPress(){item.onPress==null?void 0:item.onPress();if(item.closeOnPress!==false){var _swipeableRef$current;(_swipeableRef$current=swipeableRef.current)==null?void 0:_swipeableRef$current.closeRow();}},style:[styles.buttonContainer,{backgroundColor:item.backgroundColor||theme.colors.primary}],children:[item.icon&&_jsx(Icon,{name:item.icon,size:item.iconSize||25,color:item.color||theme.colors.surface}),item.title&&_jsx(Text,{style:[textStyles,{color:item.color||theme.colors.surface}],children:item.title})]},index.toString());};var defaultLeftOpenValue=componentWidth?componentWidth/2:0;var defaultRightOpenValue=componentWidth?-componentWidth/2:0;return _jsx(View,{onLayout:function onLayout(event){setComponentWidth(event.nativeEvent.layout.width);},style:[styles.parentContainer,parentContainerStyles],children:_jsxs(SwipeRow,Object.assign({ref:swipeableRef,leftOpenValue:isRightSwipeHandled?0:leftOpenValue||defaultLeftOpenValue,rightOpenValue:isLeftSwipeHandled?0:rightOpenValue||defaultRightOpenValue,leftActivationValue:leftActivationValue||isRightSwipeHandled?defaultLeftOpenValue*(swipeActivationPercentage/100):defaultLeftOpenValue,rightActivationValue:rightActivationValue||isLeftSwipeHandled?defaultRightOpenValue*(swipeActivationPercentage/100):defaultRightOpenValue,stopLeftSwipe:stopRightSwipe||defaultLeftOpenValue,stopRightSwipe:stopLeftSwipe||defaultRightOpenValue,onLeftAction:isRightSwipeHandled?function(){return rightSwipe.onSwipedRight==null?void 0:rightSwipe.onSwipedRight();}:undefined,onRightAction:isLeftSwipeHandled?function(){return leftSwipe.onSwipedLeft==null?void 0:leftSwipe.onSwipedLeft();}:undefined,swipeGestureBegan:onStartSwiping,swipeGestureEnded:onStopSwiping,closeOnRowPress:closeOnPress,friction:friction,disableLeftSwipe:disableRightSwipe,disableRightSwipe:disableLeftSwipe},rest,{children:[_jsxs(View,{style:styles.behindContainer,children:[_jsx(View,{style:styles.behindContainerItem,children:isRightSwipeHandled?renderBehindItem(rightSwipeToSwipeableItemBehindItem(rightSwipe),0):rightSwipeButtons.map(function(item,index){return renderBehindItem(item.props,index);})}),_jsx(View,{style:styles.behindContainerItem,children:isLeftSwipeHandled?renderBehindItem(leftSwipeToSwipeableItemBehindItem(leftSwipe),0):leftSwipeButtons.map(function(item,index){return renderBehindItem(item.props,index);})})]}),_jsx(View,{style:[styles.surfaceContainer,{backgroundColor:theme.colors.background},surfaceContainerStyles],children:remainingChildren})]}))});};var styles=StyleSheet.create({parentContainer:{overflow:"hidden",minHeight:50},behindContainer:{flex:1,width:"100%",height:"100%",flexDirection:"row"},behindContainerItem:{flex:1,flexDirection:"row"},buttonContainer:{flex:1,alignItems:"center",justifyContent:"center"},surfaceContainer:{width:"100%",minHeight:50,overflow:"hidden"}});export default withTheme(SwipeableItem);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var SwipeableItemButton=function SwipeableItemButton(){return null;};export default SwipeableItemButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{pick}from"lodash";export function extractRightSwipeProps(object){return pick(object,["onSwipedRight","rightSwipeTitle","rightSwipeIcon","rightSwipeIconSize","rightSwipeBackgroundColor","rightSwipeColor"]);}export function extractLeftSwipeProps(object){return pick(object,["onSwipedLeft","leftSwipeTitle","leftSwipeIcon","leftSwipeIconSize","leftSwipeBackgroundColor","leftSwipeColor"]);}export function rightSwipeToSwipeableItemBehindItem(swipe){return{title:swipe.rightSwipeTitle||"",revealSwipeDirection:"right",onSwipe:swipe.onSwipedRight,icon:swipe.rightSwipeIcon,iconSize:swipe.rightSwipeIconSize,backgroundColor:swipe.rightSwipeBackgroundColor,color:swipe.rightSwipeColor};}export function leftSwipeToSwipeableItemBehindItem(swipe){return{title:swipe.leftSwipeTitle||"",revealSwipeDirection:"left",onSwipe:swipe.onSwipedLeft,icon:swipe.leftSwipeIcon,iconSize:swipe.leftSwipeIconSize,backgroundColor:swipe.leftSwipeBackgroundColor,color:swipe.leftSwipeColor};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["disableScrollWhenSwiping","listComponent"];var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/SwipeableItem/SwipeableList.tsx";import React from"react";import{FlashList}from"@shopify/flash-list";import{FlatList}from"react-native";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";export var SwipeableListContext=React.createContext({onStartSwiping:function onStartSwiping(){},onStopSwiping:function onStopSwiping(){}});var SwipeableList=function SwipeableList(_ref){var _ref$disableScrollWhe=_ref.disableScrollWhenSwiping,disableScrollWhenSwiping=_ref$disableScrollWhe===void 0?true:_ref$disableScrollWhe,_ref$listComponent=_ref.listComponent,listComponent=_ref$listComponent===void 0?"FlatList":_ref$listComponent,rest=_objectWithoutProperties(_ref,_excluded);var _React$useState=React.useState(false),_React$useState2=_slicedToArray(_React$useState,2),isSwiping=_React$useState2[0],setIsSwiping=_React$useState2[1];var onStartSwiping=function onStartSwiping(){setIsSwiping(true);};var onStopSwiping=function onStopSwiping(){setIsSwiping(false);};rest.scrollEnabled=disableScrollWhenSwiping?!isSwiping:true;var renderListComponent=function renderListComponent(){switch(listComponent){case"FlatList":return _jsx(FlatList,Object.assign({},rest));case"FlashList":return _jsx(FlashList,Object.assign({},rest));}};return _jsx(SwipeableListContext.Provider,{value:{onStartSwiping:onStartSwiping,onStopSwiping:onStopSwiping},children:_jsx(_Fragment,{children:renderListComponent()})});};export default SwipeableList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{default as SwipeableItem}from"./SwipeableItem";export{default as SwipeableItemButton}from"./SwipeableItemButton";export{default as SwipeableList}from"./SwipeableList";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Swiper/Swiper.tsx";import React from"react";import{View}from"react-native";import SwiperComponent from"react-native-web-swiper";import{jsx as _jsx}from"react/jsx-runtime";var Swiper=function Swiper(_ref){var _data$length;var _ref$vertical=_ref.vertical,vertical=_ref$vertical===void 0?false:_ref$vertical,_ref$loop=_ref.loop,loop=_ref$loop===void 0?false:_ref$loop,_ref$timeout=_ref.timeout,timeout=_ref$timeout===void 0?0:_ref$timeout,_ref$from=_ref.from,from=_ref$from===void 0?0:_ref$from,_ref$prevTitle=_ref.prevTitle,prevTitle=_ref$prevTitle===void 0?"":_ref$prevTitle,_ref$nextTitle=_ref.nextTitle,nextTitle=_ref$nextTitle===void 0?"":_ref$nextTitle,prevTitleColor=_ref.prevTitleColor,nextTitleColor=_ref.nextTitleColor,_ref$dotsTouchable=_ref.dotsTouchable,dotsTouchable=_ref$dotsTouchable===void 0?true:_ref$dotsTouchable,dotColor=_ref.dotColor,dotActiveColor=_ref.dotActiveColor,data=_ref.data,keyExtractor=_ref.keyExtractor,renderItem=_ref.renderItem,childrenProp=_ref.children,onIndexChangedProp=_ref.onIndexChanged,onSwipe=_ref.onSwipe,onSwipedNext=_ref.onSwipedNext,onSwipedPrevious=_ref.onSwipedPrevious,style=_ref.style;var _React$useState=React.useState(0),_React$useState2=_slicedToArray(_React$useState,2),currentIndex=_React$useState2[0],setCurrentIndex=_React$useState2[1];var numberOfItems=(_data$length=data==null?void 0:data.length)!=null?_data$length:React.Children.count(childrenProp);var swiperRef=React.useRef(null);var onIndexChanged=function onIndexChanged(index){var previous=currentIndex;var current=index;onIndexChangedProp==null?void 0:onIndexChangedProp(index);setCurrentIndex(index);if(previous===numberOfItems-1&¤t===0){onSwipedNext==null?void 0:onSwipedNext(previous);}else if(previous===0&¤t===numberOfItems-1){onSwipedPrevious==null?void 0:onSwipedPrevious(previous);}else if(current>previous){onSwipedNext==null?void 0:onSwipedNext(previous);}else if(current<previous){onSwipedPrevious==null?void 0:onSwipedPrevious(previous);}onSwipe==null?void 0:onSwipe(previous);};var children=React.useMemo(function(){return Array.isArray(data)&&renderItem?data.map(function(item,index){var component=renderItem({item:item,index:index});if(!component){return null;}var key=keyExtractor?keyExtractor(item,index):index;return React.cloneElement(component,{key:key});}):childrenProp;},[childrenProp,data,renderItem,keyExtractor]);React.useEffect(function(){var _swiperRef$current,_swiperRef$current$pr;var childrenArray=React.Children.toArray((_swiperRef$current=swiperRef.current)==null?void 0:(_swiperRef$current$pr=_swiperRef$current.props)==null?void 0:_swiperRef$current$pr.children);if(swiperRef.current){swiperRef.current.children=childrenArray;swiperRef.current.count=childrenArray.length;swiperRef.current.forceUpdate();}},[children]);return _jsx(View,{style:style,children:_jsx(SwiperComponent,{ref:swiperRef,from:from,loop:loop,timeout:timeout,vertical:vertical,onIndexChanged:onIndexChanged,controlsProps:Object.assign({prevTitle:prevTitle,nextTitle:nextTitle,prevTitleStyle:{color:prevTitleColor},nextTitleStyle:{color:nextTitleColor},dotsTouchable:dotsTouchable},dotColor?{dotProps:{badgeStyle:{backgroundColor:dotColor}}}:{},dotActiveColor?{dotActiveStyle:{backgroundColor:dotActiveColor}}:{}),children:children})});};export default Swiper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _this=this,_jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Swiper/SwiperItem.tsx";import React from"react";import{View,StyleSheet}from"react-native";import{jsx as _jsx}from"react/jsx-runtime";var styles=StyleSheet.create({wrapper:{flex:1}});var SwiperItem=function SwiperItem(_ref){var children=_ref.children,style=_ref.style;return _jsx(View,{style:[styles.wrapper,style],children:children});};export default SwiperItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{default as Swiper}from"./Swiper";export{default as SwiperItem}from"./SwiperItem";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _jsxFileName="/home/runner/work/react-native-jigsaw/react-native-jigsaw/packages/core/src/components/Switch.tsx";var _excluded=["value","defaultValue","disabled","onValueChange","activeTrackColor","inactiveTrackColor","activeThumbColor","inactiveThumbColor","theme","style"],_excluded2=["label","direction","style","value","defaultValue","disabled","onValueChange","activeTrackColor","inactiveTrackColor","activeThumbColor","inactiveThumbColor","theme"];import*as React from"react";import{Switch as NativeSwitch}from"react-native";import{withTheme}from"../theming";import FormRow from"./FormRow";import{RowDirection}from"@draftbit/types";import{usePrevious}from"../hooks";import{jsx as _jsx}from"react/jsx-runtime";function Switch(_ref){var value=_ref.value,defaultValue=_ref.defaultValue,disabled=_ref.disabled,_onValueChange=_ref.onValueChange,activeTrackColor=_ref.activeTrackColor,inactiveTrackColor=_ref.inactiveTrackColor,activeThumbColor=_ref.activeThumbColor,inactiveThumbColor=_ref.inactiveThumbColor,theme=_ref.theme,style=_ref.style,rest=_objectWithoutProperties(_ref,_excluded);var activeTrackThemeColor=activeTrackColor||theme.colors.primary;var inactiveTrackThemeColor=inactiveTrackColor||"#EEE";var activeThumbThemeColor=activeThumbColor||"#FFF";var inactiveThumbThemeColor=inactiveThumbColor||"#FFF";var _React$useState=React.useState(value||defaultValue),_React$useState2=_slicedToArray(_React$useState,2),checked=_React$useState2[0],setChecked=_React$useState2[1];React.useEffect(function(){if(value!=null&&value!==checked){setChecked(value);}},[value,checked]);var previousDefaultValue=usePrevious(defaultValue);React.useEffect(function(){if(defaultValue!==previousDefaultValue){setChecked(Boolean(defaultValue));}},[defaultValue,previousDefaultValue]);return _jsx(NativeSwitch,Object.assign({value:checked,disabled:disabled,trackColor:{false:inactiveTrackThemeColor,true:activeTrackThemeColor},thumbColor:value?activeThumbThemeColor:inactiveThumbThemeColor,activeThumbColor:activeThumbThemeColor,ios_backgroundColor:inactiveTrackThemeColor,style:style,onValueChange:function onValueChange(bool){setChecked(bool);_onValueChange&&_onValueChange(bool);}},rest));}function Row(_ref2){var _ref2$label=_ref2.label,label=_ref2$label===void 0?"Label":_ref2$label,_ref2$direction=_ref2.direction,direction=_ref2$direction===void 0?RowDirection.Row:_ref2$direction,style=_ref2.style,value=_ref2.value,defaultValue=_ref2.defaultValue,disabled=_ref2.disabled,onValueChange=_ref2.onValueChange,activeTrackColor=_ref2.activeTrackColor,inactiveTrackColor=_ref2.inactiveTrackColor,activeThumbColor=_ref2.activeThumbColor,inactiveThumbColor=_ref2.inactiveThumbColor,theme=_ref2.theme,rest=_objectWithoutProperties(_ref2,_excluded2);var _React$useState3=React.useState(value!=null?value:defaultValue),_React$useState4=_slicedToArray(_React$useState3,2),checked=_React$useState4[0],setChecked=_React$useState4[1];React.useEffect(function(){if(value!=null){setChecked(value);}},[value]);React.useEffect(function(){if(defaultValue!=null){setChecked(defaultValue);}},[defaultValue]);return _jsx(FormRow,Object.assign({disabled:disabled,onPress:function onPress(){setChecked(!checked);onValueChange&&onValueChange(!checked);},label:label,direction:direction,style:style},rest,{children:_jsx(Switch,{theme:theme,value:checked,disabled:disabled,onValueChange:onValueChange,activeTrackColor:activeTrackColor,inactiveTrackColor:inactiveTrackColor,activeThumbColor:activeThumbColor,inactiveThumbColor:inactiveThumbColor})}));}var SwitchRow=withTheme(Row);export{SwitchRow};export default withTheme(Switch);
|