dhre-ui-kit 0.0.222 → 0.0.224

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,52 +678,132 @@ 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
  };
806
+ var CustomLoader$1 = withThemeProvider(CustomLoader);
726
807
 
727
808
  const CustomButton = ({
728
809
  title,
@@ -760,7 +841,7 @@ const CustomButton = ({
760
841
  disabled
761
842
  },
762
843
  imagePosition === "left" && leftIcon && /* @__PURE__ */ React.createElement(View, { style: iconStyle }, React.cloneElement(leftIcon, { width: 20, height: 20 })),
763
- isLoading ? /* @__PURE__ */ React.createElement(CustomLoader, { loading: isLoading }) : /* @__PURE__ */ React.createElement(
844
+ isLoading ? /* @__PURE__ */ React.createElement(CustomLoader$1, { loading: isLoading }) : /* @__PURE__ */ React.createElement(
764
845
  CustomText$1,
765
846
  {
766
847
  text: title,
@@ -4756,5 +4837,5 @@ const RadioButtonGroup = ({ data, onSelect, containerStyle, labelStyle, optionCo
4756
4837
  )));
4757
4838
  };
4758
4839
 
4759
- export { Accordion$1 as Accordion, index$1 as AppointmentCard, Badge$1 as Badge, BottomDrawer, CustomButton$1 as Button, Cards, category as Category, Checkbox as CheckBox, ContactModel, CountryDropDown as CountryPicker, CustomDocumentPicker$1 as CustomDocumentPicker, CustomDropdown$1 as CustomDropdown, CustomHeader$1 as CustomHeader, CustomIcon, CustomLoader, CustomProgressBar, CustomSearchBar, index$2 as CustomSlideButton, CustomSwitchBtn, CustomText$1 as CustomText, CustomTextInput, CustomTooltip, CustomTypography, DHRE_COLORS_ALERT, DHRE_COLORS_BG, DHRE_COLORS_PRIMARY, DHRE_COLORS_SECONDARY, DHRE_COLORS_TEXT, DHRE_DEFAULT, DateRangePicker$1 as DateRangePicker, CustomDropdown as DropDown, FONT_STYLES, feedback as FeedbackForm, FileUpload, FontStyle, Line, NotificationBandge, index$4 as OTPInput, OurOffices as OurOfficesButton, PdfView, PopUp, index as PropertyDetails, RadioButtonGroup, ShapeType, TagSingleSelection as SingleSelectionTags, Star as StarRating, index$3 as Stepper, SwipableList$1 as SwipableList, Tabs$1 as Tabs, Tags, TextDirectType, CommonTextInput as TextInput, Theme, Toast, CustomSwitch as ToggleButton, ToggleButtonType, ToggleTextType, Topic$1 as Topic, copyToClipboard, theme as default, height, horizontalScale, moderateScale, toastService, verticalScale, width };
4840
+ export { Accordion$1 as Accordion, index$1 as AppointmentCard, Badge$1 as Badge, BottomDrawer, CustomButton$1 as Button, Cards, category as Category, Checkbox as CheckBox, ContactModel, CountryDropDown as CountryPicker, CustomDocumentPicker$1 as CustomDocumentPicker, CustomDropdown$1 as CustomDropdown, CustomHeader$1 as CustomHeader, CustomIcon, CustomLoader$1 as CustomLoader, CustomProgressBar, CustomSearchBar, index$2 as CustomSlideButton, CustomSwitchBtn, CustomText$1 as CustomText, CustomTextInput, CustomTooltip, CustomTypography, DHRE_COLORS_ALERT, DHRE_COLORS_BG, DHRE_COLORS_PRIMARY, DHRE_COLORS_SECONDARY, DHRE_COLORS_TEXT, DHRE_DEFAULT, DateRangePicker$1 as DateRangePicker, CustomDropdown as DropDown, FONT_STYLES, feedback as FeedbackForm, FileUpload, FontStyle, Line, NotificationBandge, index$4 as OTPInput, OurOffices as OurOfficesButton, PdfView, PopUp, index as PropertyDetails, RadioButtonGroup, ShapeType, TagSingleSelection as SingleSelectionTags, Star as StarRating, index$3 as Stepper, SwipableList$1 as SwipableList, Tabs$1 as Tabs, Tags, TextDirectType, CommonTextInput as TextInput, Theme, Toast, CustomSwitch as ToggleButton, ToggleButtonType, ToggleTextType, Topic$1 as Topic, copyToClipboard, theme as default, height, horizontalScale, moderateScale, toastService, verticalScale, width };
4760
4841
  //# sourceMappingURL=index.mjs.map