dhre-ui-kit 0.0.221 → 0.0.223

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/index.mjs CHANGED
@@ -1,8 +1,9 @@
1
- import React, { createContext, useContext, useState, useEffect, useRef, memo, useCallback } from 'react';
1
+ import React, { createContext, useContext, useRef, useEffect, useState, memo, useCallback } from 'react';
2
2
  import { useSelector } from 'react-redux';
3
- import { Dimensions, StyleSheet, Text, Pressable, View, Modal, KeyboardAvoidingView, Platform, ActivityIndicator, TextInput, ScrollView, Animated, FlatList, TouchableOpacity, Alert, Linking, PanResponder } from 'react-native';
3
+ import { Dimensions, StyleSheet, Text, Pressable, View, Modal, KeyboardAvoidingView, Platform, Animated, Easing, TextInput, ScrollView, FlatList, TouchableOpacity, Alert, Linking, PanResponder } from 'react-native';
4
4
  import { PanGestureHandler, GestureHandlerRootView, Swipeable } from 'react-native-gesture-handler';
5
5
  import { BlurView } from '@react-native-community/blur';
6
+ import Svg, { Defs, LinearGradient, Stop, Circle } from 'react-native-svg';
6
7
  import Tooltip from 'react-native-walkthrough-tooltip';
7
8
  import Pdf from 'react-native-pdf';
8
9
  import * as Progress from 'react-native-progress';
@@ -335,13 +336,13 @@ const CustomTypography = ({
335
336
  Text,
336
337
  {
337
338
  testID,
338
- style: [textStyle, styles$C.container, style],
339
+ style: [textStyle, styles$B.container, style],
339
340
  ...props
340
341
  },
341
342
  text
342
343
  );
343
344
  };
344
- const styles$C = StyleSheet.create({
345
+ const styles$B = StyleSheet.create({
345
346
  container: { writingDirection: "auto", alignSelf: "flex-start" }
346
347
  });
347
348
 
@@ -553,7 +554,7 @@ const DHRE_COLORS_TEXT = {
553
554
  DH_SURFACE_SECONDARY: "#212121"
554
555
  };
555
556
 
556
- const styles$B = StyleSheet.create({
557
+ const styles$A = StyleSheet.create({
557
558
  badge: {
558
559
  backgroundColor: DHRE_COLORS_ALERT.DH_SUCCESS_GREEN,
559
560
  borderRadius: 15,
@@ -580,16 +581,16 @@ const Badge = ({
580
581
  return /* @__PURE__ */ React.createElement(
581
582
  Pressable,
582
583
  {
583
- style: [styles$B.badge, commonStyles.centerRow, style],
584
+ style: [styles$A.badge, commonStyles.centerRow, style],
584
585
  testID: "BADGE",
585
586
  onPress: handleIconPress
586
587
  },
587
- iconName && /* @__PURE__ */ React.createElement(View, { style: [styles$B.icon, iconStyle] }, React.cloneElement(iconName)),
588
+ iconName && /* @__PURE__ */ React.createElement(View, { style: [styles$A.icon, iconStyle] }, React.cloneElement(iconName)),
588
589
  text && /* @__PURE__ */ React.createElement(
589
590
  CustomTypography,
590
591
  {
591
592
  variant: "B3semiBold",
592
- style: [styles$B.text, textStyle],
593
+ style: [styles$A.text, textStyle],
593
594
  text
594
595
  }
595
596
  )
@@ -597,7 +598,7 @@ const Badge = ({
597
598
  };
598
599
  var Badge$1 = withThemeProvider(Badge);
599
600
 
600
- const styles$A = StyleSheet.create({
601
+ const styles$z = StyleSheet.create({
601
602
  mainContainer: {
602
603
  flex: 1,
603
604
  justifyContent: "flex-end"
@@ -677,51 +678,130 @@ const BottomDrawer = ({
677
678
  behavior: Platform.OS === "ios" ? "padding" : "height",
678
679
  style: { flex: 1 }
679
680
  },
680
- /* @__PURE__ */ React.createElement(View, { style: [styles$A.mainContainer, style], testID }, showBlurView ? /* @__PURE__ */ React.createElement(
681
+ /* @__PURE__ */ React.createElement(View, { style: [styles$z.mainContainer, style], testID }, showBlurView ? /* @__PURE__ */ React.createElement(
681
682
  BlurView,
682
683
  {
683
- style: [styles$A.blurView, blurViewStyle],
684
+ style: [styles$z.blurView, blurViewStyle],
684
685
  blurType,
685
686
  blurAmount
686
687
  }
687
- ) : null, /* @__PURE__ */ React.createElement(View, { style: [styles$A.modalContainer, modalContainerStyle] }, showHeader && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(View, { style: styles$A.separator }), /* @__PURE__ */ React.createElement(View, { style: styles$A.headerContainer }, showLeftIcon && leftIcon ? React.cloneElement(leftIcon, {
688
+ ) : null, /* @__PURE__ */ React.createElement(View, { style: [styles$z.modalContainer, modalContainerStyle] }, showHeader && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(View, { style: styles$z.separator }), /* @__PURE__ */ React.createElement(View, { style: styles$z.headerContainer }, showLeftIcon && leftIcon ? React.cloneElement(leftIcon, {
688
689
  width: moderateScale(24),
689
690
  height: moderateScale(24),
690
- style: styles$A.leftIconStyle,
691
+ style: styles$z.leftIconStyle,
691
692
  onPress: onLeftIconPress
692
693
  }) : null, /* @__PURE__ */ React.createElement(
693
694
  CustomTypography,
694
695
  {
695
696
  variant: titleVariant,
696
697
  text: title,
697
- style: { ...styles$A.title, ...titleStyle }
698
+ style: { ...styles$z.title, ...titleStyle }
698
699
  }
699
700
  ), showRightIcon && rightIcon ? React.cloneElement(rightIcon, {
700
701
  width: moderateScale(24),
701
702
  height: moderateScale(24),
702
- style: styles$A.rightIconStyle,
703
+ style: styles$z.rightIconStyle,
703
704
  onPress: toggleModal
704
705
  }) : null)), children))
705
706
  ))
706
707
  );
707
708
  };
708
709
 
709
- const styles$z = StyleSheet.create({
710
- container: {
711
- flex: 1,
712
- justifyContent: "center",
713
- alignItems: "center",
714
- backgroundColor: "transparent",
715
- position: "absolute",
716
- width: "100%",
717
- height: "100%",
718
- zIndex: 1e3
719
- }
720
- });
710
+ const createStyles$3 = (theme) => {
711
+ return StyleSheet.create({
712
+ backdrop: {
713
+ flex: 1,
714
+ justifyContent: "center",
715
+ alignItems: "center",
716
+ backgroundColor: "rgba(0, 0, 0, 0.3)"
717
+ },
718
+ box: {
719
+ width: 148,
720
+ height: 187,
721
+ backgroundColor: theme.SURFACE_PRIMARY,
722
+ borderRadius: 16,
723
+ justifyContent: "center",
724
+ alignItems: "center",
725
+ shadowColor: "#000",
726
+ shadowOffset: { width: 0, height: 2 },
727
+ shadowOpacity: 0.2,
728
+ shadowRadius: 4,
729
+ elevation: 5
730
+ },
731
+ loader: {
732
+ width: 80,
733
+ height: 80,
734
+ justifyContent: "center",
735
+ alignItems: "center"
736
+ },
737
+ text: {
738
+ marginTop: 16,
739
+ textAlign: "center",
740
+ alignSelf: "center",
741
+ alignContent: "center",
742
+ color: theme.CONTENT_PRIMARY
743
+ }
744
+ });
745
+ };
721
746
 
722
747
  const CustomLoader = ({ loading }) => {
748
+ const rotateAnim = useRef(new Animated.Value(0)).current;
749
+ const { theme, mode } = useTheme();
750
+ const styles = createStyles$3(theme);
751
+ useEffect(() => {
752
+ if (loading) {
753
+ Animated.loop(
754
+ Animated.parallel([
755
+ Animated.timing(rotateAnim, {
756
+ toValue: 1,
757
+ duration: 1500,
758
+ easing: Easing.linear,
759
+ useNativeDriver: true
760
+ })
761
+ ])
762
+ ).start();
763
+ }
764
+ }, [loading]);
723
765
  if (!loading) return null;
724
- return /* @__PURE__ */ React.createElement(View, { style: styles$z.container }, /* @__PURE__ */ React.createElement(ActivityIndicator, { size: "large", color: "#686868" }));
766
+ const spin = rotateAnim.interpolate({
767
+ inputRange: [0, 1],
768
+ outputRange: ["0deg", "360deg"]
769
+ });
770
+ return /* @__PURE__ */ React.createElement(Modal, { transparent: true, visible: loading, animationType: "fade" }, /* @__PURE__ */ React.createElement(View, { style: styles.backdrop }, /* @__PURE__ */ React.createElement(View, { style: styles.box }, /* @__PURE__ */ React.createElement(Animated.View, { style: [styles.loader, { transform: [{ rotate: spin }] }] }, /* @__PURE__ */ React.createElement(Svg, { width: "100", height: "100", viewBox: "0 0 100 100" }, /* @__PURE__ */ React.createElement(Defs, null, /* @__PURE__ */ React.createElement(LinearGradient, { id: "grad", x1: "0%", y1: "0%", x2: "100%", y2: "100%" }, /* @__PURE__ */ React.createElement(Stop, { offset: "0%", stopColor: "#000000", stopOpacity: "2" }), /* @__PURE__ */ React.createElement(
771
+ Stop,
772
+ {
773
+ offset: "40%",
774
+ stopColor: mode === "dark" ? "#5A5A5A00" : "#686868",
775
+ stopOpacity: "5"
776
+ }
777
+ ), /* @__PURE__ */ React.createElement(
778
+ Stop,
779
+ {
780
+ offset: "100%",
781
+ stopColor: mode === "dark" ? "#FFFFFF" : "#AAAAAA",
782
+ stopOpacity: ".9"
783
+ }
784
+ ))), /* @__PURE__ */ React.createElement(
785
+ Circle,
786
+ {
787
+ cx: "50",
788
+ cy: "50",
789
+ r: "40",
790
+ stroke: "url(#grad)",
791
+ strokeWidth: "8",
792
+ fill: "none",
793
+ strokeDasharray: "250",
794
+ strokeLinecap: "round"
795
+ }
796
+ ))), /* @__PURE__ */ React.createElement(
797
+ CustomText$1,
798
+ {
799
+ text: "Loading...",
800
+ style: styles.text,
801
+ variant: FontStyle.B4_REGULAR,
802
+ textColor: "#000000"
803
+ }
804
+ ))));
725
805
  };
726
806
 
727
807
  const CustomButton = ({
@@ -3421,7 +3501,8 @@ const CustomDropdown = (props) => {
3421
3501
  menuContainerStyle,
3422
3502
  activeColor,
3423
3503
  keepPlaceholderOnFocus = false,
3424
- selectedItemTextStyle
3504
+ selectedItemTextStyle,
3505
+ disable
3425
3506
  } = props;
3426
3507
  const [value, setValue] = useState(defaultValue);
3427
3508
  const [isFocus, setIsFocus] = useState(false);
@@ -3493,7 +3574,8 @@ const CustomDropdown = (props) => {
3493
3574
  itemTextStyle,
3494
3575
  containerStyle: menuContainerStyle,
3495
3576
  activeColor,
3496
- itemContainerStyle: [styles$8.itemListStyle, itemContainerStyle]
3577
+ itemContainerStyle: [styles$8.itemListStyle, itemContainerStyle],
3578
+ disable
3497
3579
  }
3498
3580
  ));
3499
3581
  };