@kaushverse/pickify 1.1.15 → 1.2.0

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/dist/index.d.mts CHANGED
@@ -151,16 +151,10 @@ type Props = {
151
151
  styles?: FloatingButtonStyles;
152
152
  style?: ViewStyle;
153
153
  mainIconName?: string;
154
- spacing?: number;
155
- animationDuration?: number;
156
- buttonSize?: number;
157
- secondaryButtonSize?: number;
158
154
  };
159
155
  declare class FloatingButton extends React$1.Component<Props> {
160
156
  animation: Animated.Value;
161
- state: {
162
- open: boolean;
163
- };
157
+ open: boolean;
164
158
  toggleMenu: () => void;
165
159
  renderAction: (action: Action, index: number) => react_jsx_runtime.JSX.Element;
166
160
  render(): react_jsx_runtime.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -151,16 +151,10 @@ type Props = {
151
151
  styles?: FloatingButtonStyles;
152
152
  style?: ViewStyle;
153
153
  mainIconName?: string;
154
- spacing?: number;
155
- animationDuration?: number;
156
- buttonSize?: number;
157
- secondaryButtonSize?: number;
158
154
  };
159
155
  declare class FloatingButton extends React$1.Component<Props> {
160
156
  animation: Animated.Value;
161
- state: {
162
- open: boolean;
163
- };
157
+ open: boolean;
164
158
  toggleMenu: () => void;
165
159
  renderAction: (action: Action, index: number) => react_jsx_runtime.JSX.Element;
166
160
  render(): react_jsx_runtime.JSX.Element;
package/dist/index.js CHANGED
@@ -720,49 +720,46 @@ var defaultStyles3 = import_react_native4.StyleSheet.create({
720
720
  // src/core/FloatingButton.tsx
721
721
  var import_react4 = __toESM(require("react"));
722
722
  var import_react_native5 = require("react-native");
723
- var import_vector_icons = require("@expo/vector-icons");
724
723
  var import_jsx_runtime5 = require("react/jsx-runtime");
725
724
  var FloatingButton = class extends import_react4.default.Component {
726
725
  animation = new import_react_native5.Animated.Value(0);
727
- state = {
728
- open: false
729
- };
726
+ open = false;
730
727
  toggleMenu = () => {
731
- const toValue = this.state.open ? 0 : 1;
732
728
  import_react_native5.Animated.spring(this.animation, {
733
- toValue,
729
+ toValue: this.open ? 0 : 1,
734
730
  useNativeDriver: true,
735
- stiffness: 250,
736
- damping: 20,
737
- mass: 1
731
+ damping: 12,
732
+ mass: 0.6,
733
+ stiffness: 180
738
734
  }).start();
739
- this.setState({ open: !this.state.open });
735
+ this.open = !this.open;
740
736
  };
741
737
  renderAction = (action, index) => {
742
738
  const {
743
739
  mode = "vertical",
744
- radius = 90,
740
+ radius = 100,
745
741
  actions,
746
742
  renderItemIcon,
747
- styles: styles2,
748
- spacing = 65,
749
- secondaryButtonSize = 48
743
+ styles: styles2
750
744
  } = this.props;
751
745
  let translateX = 0;
752
746
  let translateY = 0;
753
747
  if (mode === "vertical") {
754
- translateY = -spacing * (index + 1);
748
+ translateY = -70 * (index + 1);
749
+ translateX = 0;
755
750
  }
756
751
  if (mode === "horizontal") {
757
- translateX = -spacing * (index + 1);
752
+ translateX = -70 * (index + 1);
753
+ translateY = 0;
758
754
  }
759
755
  if (mode === "circle") {
760
756
  const totalActions = actions.length;
761
- const startAngle = -Math.PI / 2.5;
762
- const endAngle = -Math.PI * 0.7;
757
+ const startAngle = -Math.PI / 3;
758
+ const endAngle = -Math.PI * 0.8;
763
759
  const angle = startAngle + index / (totalActions - 1 || 1) * (endAngle - startAngle);
764
- translateX = radius * Math.cos(angle);
765
- translateY = radius * Math.sin(angle);
760
+ const adjustedRadius = radius * 0.65;
761
+ translateX = adjustedRadius * Math.cos(angle);
762
+ translateY = adjustedRadius * Math.sin(angle);
766
763
  }
767
764
  const animStyle = {
768
765
  transform: [
@@ -780,25 +777,20 @@ var FloatingButton = class extends import_react4.default.Component {
780
777
  },
781
778
  {
782
779
  scale: this.animation.interpolate({
783
- inputRange: [0, 0.3, 0.7, 1],
784
- outputRange: [0, 1.1, 0.95, 1]
780
+ inputRange: [0, 0.5, 1],
781
+ outputRange: [0, 1.2, 1]
785
782
  })
786
783
  }
787
784
  ],
788
- opacity: this.animation.interpolate({
789
- inputRange: [0, 0.2, 1],
790
- outputRange: [0, 0.8, 1]
791
- })
785
+ opacity: this.animation
792
786
  };
793
787
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
794
788
  import_react_native5.TouchableWithoutFeedback,
795
789
  {
796
790
  onPress: () => {
797
791
  this.toggleMenu();
798
- setTimeout(() => {
799
- action.onPress?.();
800
- action.navigateTo?.();
801
- }, 100);
792
+ action.onPress?.();
793
+ action.navigateTo?.();
802
794
  },
803
795
  children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
804
796
  import_react_native5.Animated.View,
@@ -806,26 +798,14 @@ var FloatingButton = class extends import_react4.default.Component {
806
798
  style: [
807
799
  defaultStyles4.secondary,
808
800
  styles2?.secondaryButton,
809
- {
810
- backgroundColor: action.color || "#F02A4B",
811
- width: secondaryButtonSize,
812
- height: secondaryButtonSize,
813
- borderRadius: secondaryButtonSize / 2
814
- },
801
+ { backgroundColor: action.color || "#F02A4B" },
815
802
  animStyle
816
803
  ],
817
- children: renderItemIcon ? renderItemIcon({
804
+ children: renderItemIcon?.({
818
805
  name: action.icon,
819
- size: secondaryButtonSize * 0.42,
806
+ size: 20,
820
807
  color: action.iconColor || "#FFF"
821
- }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
822
- import_vector_icons.Ionicons,
823
- {
824
- name: action.icon,
825
- size: secondaryButtonSize * 0.42,
826
- color: action.iconColor || "#FFF"
827
- }
828
- )
808
+ })
829
809
  }
830
810
  )
831
811
  },
@@ -833,14 +813,7 @@ var FloatingButton = class extends import_react4.default.Component {
833
813
  );
834
814
  };
835
815
  render() {
836
- const {
837
- actions,
838
- renderMainIcon,
839
- styles: styles2,
840
- style,
841
- mainIconName,
842
- buttonSize = 56
843
- } = this.props;
816
+ const { actions, renderMainIcon, styles: styles2, style, mainIconName } = this.props;
844
817
  const rotation = {
845
818
  transform: [
846
819
  {
@@ -851,57 +824,48 @@ var FloatingButton = class extends import_react4.default.Component {
851
824
  }
852
825
  ]
853
826
  };
854
- const mainScale = {
827
+ const scale = {
855
828
  transform: [
856
829
  {
857
830
  scale: this.animation.interpolate({
858
831
  inputRange: [0, 0.5, 1],
859
- outputRange: [1, 1.15, 1]
832
+ outputRange: [1, 1.1, 1]
860
833
  })
861
834
  }
862
835
  ]
863
836
  };
864
837
  const mainIcon = mainIconName || "add";
865
- const containerStyle = [
866
- defaultStyles4.container,
867
- styles2?.container,
868
- style,
869
- { right: 20, bottom: 100 }
870
- ];
871
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native5.View, { style: containerStyle, children: [
872
- actions.map(this.renderAction),
873
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native5.TouchableWithoutFeedback, { onPress: this.toggleMenu, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
838
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native5.View, { style: [defaultStyles4.container, styles2?.container, style], children: [
839
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
874
840
  import_react_native5.Animated.View,
875
841
  {
876
842
  style: [
877
- defaultStyles4.mainButtonWrapper,
878
- styles2?.mainButton,
879
- rotation,
880
- mainScale,
881
- {
882
- width: buttonSize,
883
- height: buttonSize,
884
- borderRadius: buttonSize / 2
885
- }
886
- ],
887
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
888
- import_react_native5.View,
843
+ defaultStyles4.circleContainer,
844
+ styles2?.circleContainer,
889
845
  {
890
- style: [
891
- defaultStyles4.button,
846
+ transform: [
892
847
  {
893
- width: buttonSize,
894
- height: buttonSize,
895
- borderRadius: buttonSize / 2
848
+ scale: this.animation.interpolate({
849
+ inputRange: [0, 1],
850
+ outputRange: [0, 1]
851
+ })
896
852
  }
897
853
  ],
898
- children: renderMainIcon ? renderMainIcon({
899
- name: mainIcon,
900
- size: buttonSize * 0.46,
901
- color: "#FFF"
902
- }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_vector_icons.Ionicons, { name: "add", size: buttonSize * 0.46, color: "#FFF" })
854
+ opacity: this.animation
903
855
  }
904
- )
856
+ ],
857
+ children: actions.map(this.renderAction)
858
+ }
859
+ ),
860
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native5.TouchableWithoutFeedback, { onPress: this.toggleMenu, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
861
+ import_react_native5.Animated.View,
862
+ {
863
+ style: [defaultStyles4.mainButtonWrapper, rotation, scale],
864
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native5.View, { style: [defaultStyles4.button, styles2?.mainButton], children: renderMainIcon?.({
865
+ name: mainIcon,
866
+ size: 26,
867
+ color: "#FFF"
868
+ }) })
905
869
  }
906
870
  ) })
907
871
  ] });
@@ -910,29 +874,60 @@ var FloatingButton = class extends import_react4.default.Component {
910
874
  var defaultStyles4 = import_react_native5.StyleSheet.create({
911
875
  container: {
912
876
  position: "absolute",
877
+ bottom: 100,
878
+ right: 20,
913
879
  alignItems: "center",
914
- justifyContent: "center",
915
- zIndex: 1e3
880
+ justifyContent: "center"
916
881
  },
917
882
  mainButtonWrapper: {
883
+ width: 60,
884
+ height: 60,
885
+ borderRadius: 30,
918
886
  backgroundColor: "#F02A4B",
919
887
  alignItems: "center",
920
888
  justifyContent: "center",
921
- elevation: 8,
922
- zIndex: 1e3
889
+ shadowColor: "#000",
890
+ shadowOffset: {
891
+ width: 0,
892
+ height: 2
893
+ },
894
+ shadowOpacity: 0.25,
895
+ shadowRadius: 3.84,
896
+ elevation: 5
923
897
  },
924
898
  button: {
899
+ width: 60,
900
+ height: 60,
901
+ borderRadius: 30,
925
902
  backgroundColor: "#F02A4B",
926
903
  alignItems: "center",
927
904
  justifyContent: "center"
928
905
  },
906
+ circleContainer: {
907
+ position: "absolute",
908
+ width: 200,
909
+ height: 200,
910
+ right: -70,
911
+ bottom: -70,
912
+ alignItems: "center",
913
+ justifyContent: "center"
914
+ },
929
915
  secondary: {
930
916
  position: "absolute",
917
+ width: 48,
918
+ height: 48,
919
+ borderRadius: 24,
931
920
  backgroundColor: "#F02A4B",
932
921
  alignItems: "center",
933
922
  justifyContent: "center",
934
- elevation: 5,
935
- zIndex: 999
923
+ shadowColor: "#000",
924
+ shadowOffset: {
925
+ width: 0,
926
+ height: 2
927
+ },
928
+ shadowOpacity: 0.25,
929
+ shadowRadius: 3.84,
930
+ elevation: 5
936
931
  }
937
932
  });
938
933
 
package/dist/index.mjs CHANGED
@@ -704,49 +704,46 @@ import {
704
704
  TouchableWithoutFeedback,
705
705
  View as View5
706
706
  } from "react-native";
707
- import { Ionicons } from "@expo/vector-icons";
708
707
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
709
708
  var FloatingButton = class extends React4.Component {
710
709
  animation = new Animated3.Value(0);
711
- state = {
712
- open: false
713
- };
710
+ open = false;
714
711
  toggleMenu = () => {
715
- const toValue = this.state.open ? 0 : 1;
716
712
  Animated3.spring(this.animation, {
717
- toValue,
713
+ toValue: this.open ? 0 : 1,
718
714
  useNativeDriver: true,
719
- stiffness: 250,
720
- damping: 20,
721
- mass: 1
715
+ damping: 12,
716
+ mass: 0.6,
717
+ stiffness: 180
722
718
  }).start();
723
- this.setState({ open: !this.state.open });
719
+ this.open = !this.open;
724
720
  };
725
721
  renderAction = (action, index) => {
726
722
  const {
727
723
  mode = "vertical",
728
- radius = 90,
724
+ radius = 100,
729
725
  actions,
730
726
  renderItemIcon,
731
- styles: styles2,
732
- spacing = 65,
733
- secondaryButtonSize = 48
727
+ styles: styles2
734
728
  } = this.props;
735
729
  let translateX = 0;
736
730
  let translateY = 0;
737
731
  if (mode === "vertical") {
738
- translateY = -spacing * (index + 1);
732
+ translateY = -70 * (index + 1);
733
+ translateX = 0;
739
734
  }
740
735
  if (mode === "horizontal") {
741
- translateX = -spacing * (index + 1);
736
+ translateX = -70 * (index + 1);
737
+ translateY = 0;
742
738
  }
743
739
  if (mode === "circle") {
744
740
  const totalActions = actions.length;
745
- const startAngle = -Math.PI / 2.5;
746
- const endAngle = -Math.PI * 0.7;
741
+ const startAngle = -Math.PI / 3;
742
+ const endAngle = -Math.PI * 0.8;
747
743
  const angle = startAngle + index / (totalActions - 1 || 1) * (endAngle - startAngle);
748
- translateX = radius * Math.cos(angle);
749
- translateY = radius * Math.sin(angle);
744
+ const adjustedRadius = radius * 0.65;
745
+ translateX = adjustedRadius * Math.cos(angle);
746
+ translateY = adjustedRadius * Math.sin(angle);
750
747
  }
751
748
  const animStyle = {
752
749
  transform: [
@@ -764,25 +761,20 @@ var FloatingButton = class extends React4.Component {
764
761
  },
765
762
  {
766
763
  scale: this.animation.interpolate({
767
- inputRange: [0, 0.3, 0.7, 1],
768
- outputRange: [0, 1.1, 0.95, 1]
764
+ inputRange: [0, 0.5, 1],
765
+ outputRange: [0, 1.2, 1]
769
766
  })
770
767
  }
771
768
  ],
772
- opacity: this.animation.interpolate({
773
- inputRange: [0, 0.2, 1],
774
- outputRange: [0, 0.8, 1]
775
- })
769
+ opacity: this.animation
776
770
  };
777
771
  return /* @__PURE__ */ jsx5(
778
772
  TouchableWithoutFeedback,
779
773
  {
780
774
  onPress: () => {
781
775
  this.toggleMenu();
782
- setTimeout(() => {
783
- action.onPress?.();
784
- action.navigateTo?.();
785
- }, 100);
776
+ action.onPress?.();
777
+ action.navigateTo?.();
786
778
  },
787
779
  children: /* @__PURE__ */ jsx5(
788
780
  Animated3.View,
@@ -790,26 +782,14 @@ var FloatingButton = class extends React4.Component {
790
782
  style: [
791
783
  defaultStyles4.secondary,
792
784
  styles2?.secondaryButton,
793
- {
794
- backgroundColor: action.color || "#F02A4B",
795
- width: secondaryButtonSize,
796
- height: secondaryButtonSize,
797
- borderRadius: secondaryButtonSize / 2
798
- },
785
+ { backgroundColor: action.color || "#F02A4B" },
799
786
  animStyle
800
787
  ],
801
- children: renderItemIcon ? renderItemIcon({
788
+ children: renderItemIcon?.({
802
789
  name: action.icon,
803
- size: secondaryButtonSize * 0.42,
790
+ size: 20,
804
791
  color: action.iconColor || "#FFF"
805
- }) : /* @__PURE__ */ jsx5(
806
- Ionicons,
807
- {
808
- name: action.icon,
809
- size: secondaryButtonSize * 0.42,
810
- color: action.iconColor || "#FFF"
811
- }
812
- )
792
+ })
813
793
  }
814
794
  )
815
795
  },
@@ -817,14 +797,7 @@ var FloatingButton = class extends React4.Component {
817
797
  );
818
798
  };
819
799
  render() {
820
- const {
821
- actions,
822
- renderMainIcon,
823
- styles: styles2,
824
- style,
825
- mainIconName,
826
- buttonSize = 56
827
- } = this.props;
800
+ const { actions, renderMainIcon, styles: styles2, style, mainIconName } = this.props;
828
801
  const rotation = {
829
802
  transform: [
830
803
  {
@@ -835,57 +808,48 @@ var FloatingButton = class extends React4.Component {
835
808
  }
836
809
  ]
837
810
  };
838
- const mainScale = {
811
+ const scale = {
839
812
  transform: [
840
813
  {
841
814
  scale: this.animation.interpolate({
842
815
  inputRange: [0, 0.5, 1],
843
- outputRange: [1, 1.15, 1]
816
+ outputRange: [1, 1.1, 1]
844
817
  })
845
818
  }
846
819
  ]
847
820
  };
848
821
  const mainIcon = mainIconName || "add";
849
- const containerStyle = [
850
- defaultStyles4.container,
851
- styles2?.container,
852
- style,
853
- { right: 20, bottom: 100 }
854
- ];
855
- return /* @__PURE__ */ jsxs5(View5, { style: containerStyle, children: [
856
- actions.map(this.renderAction),
857
- /* @__PURE__ */ jsx5(TouchableWithoutFeedback, { onPress: this.toggleMenu, children: /* @__PURE__ */ jsx5(
822
+ return /* @__PURE__ */ jsxs5(View5, { style: [defaultStyles4.container, styles2?.container, style], children: [
823
+ /* @__PURE__ */ jsx5(
858
824
  Animated3.View,
859
825
  {
860
826
  style: [
861
- defaultStyles4.mainButtonWrapper,
862
- styles2?.mainButton,
863
- rotation,
864
- mainScale,
865
- {
866
- width: buttonSize,
867
- height: buttonSize,
868
- borderRadius: buttonSize / 2
869
- }
870
- ],
871
- children: /* @__PURE__ */ jsx5(
872
- View5,
827
+ defaultStyles4.circleContainer,
828
+ styles2?.circleContainer,
873
829
  {
874
- style: [
875
- defaultStyles4.button,
830
+ transform: [
876
831
  {
877
- width: buttonSize,
878
- height: buttonSize,
879
- borderRadius: buttonSize / 2
832
+ scale: this.animation.interpolate({
833
+ inputRange: [0, 1],
834
+ outputRange: [0, 1]
835
+ })
880
836
  }
881
837
  ],
882
- children: renderMainIcon ? renderMainIcon({
883
- name: mainIcon,
884
- size: buttonSize * 0.46,
885
- color: "#FFF"
886
- }) : /* @__PURE__ */ jsx5(Ionicons, { name: "add", size: buttonSize * 0.46, color: "#FFF" })
838
+ opacity: this.animation
887
839
  }
888
- )
840
+ ],
841
+ children: actions.map(this.renderAction)
842
+ }
843
+ ),
844
+ /* @__PURE__ */ jsx5(TouchableWithoutFeedback, { onPress: this.toggleMenu, children: /* @__PURE__ */ jsx5(
845
+ Animated3.View,
846
+ {
847
+ style: [defaultStyles4.mainButtonWrapper, rotation, scale],
848
+ children: /* @__PURE__ */ jsx5(View5, { style: [defaultStyles4.button, styles2?.mainButton], children: renderMainIcon?.({
849
+ name: mainIcon,
850
+ size: 26,
851
+ color: "#FFF"
852
+ }) })
889
853
  }
890
854
  ) })
891
855
  ] });
@@ -894,29 +858,60 @@ var FloatingButton = class extends React4.Component {
894
858
  var defaultStyles4 = StyleSheet5.create({
895
859
  container: {
896
860
  position: "absolute",
861
+ bottom: 100,
862
+ right: 20,
897
863
  alignItems: "center",
898
- justifyContent: "center",
899
- zIndex: 1e3
864
+ justifyContent: "center"
900
865
  },
901
866
  mainButtonWrapper: {
867
+ width: 60,
868
+ height: 60,
869
+ borderRadius: 30,
902
870
  backgroundColor: "#F02A4B",
903
871
  alignItems: "center",
904
872
  justifyContent: "center",
905
- elevation: 8,
906
- zIndex: 1e3
873
+ shadowColor: "#000",
874
+ shadowOffset: {
875
+ width: 0,
876
+ height: 2
877
+ },
878
+ shadowOpacity: 0.25,
879
+ shadowRadius: 3.84,
880
+ elevation: 5
907
881
  },
908
882
  button: {
883
+ width: 60,
884
+ height: 60,
885
+ borderRadius: 30,
909
886
  backgroundColor: "#F02A4B",
910
887
  alignItems: "center",
911
888
  justifyContent: "center"
912
889
  },
890
+ circleContainer: {
891
+ position: "absolute",
892
+ width: 200,
893
+ height: 200,
894
+ right: -70,
895
+ bottom: -70,
896
+ alignItems: "center",
897
+ justifyContent: "center"
898
+ },
913
899
  secondary: {
914
900
  position: "absolute",
901
+ width: 48,
902
+ height: 48,
903
+ borderRadius: 24,
915
904
  backgroundColor: "#F02A4B",
916
905
  alignItems: "center",
917
906
  justifyContent: "center",
918
- elevation: 5,
919
- zIndex: 999
907
+ shadowColor: "#000",
908
+ shadowOffset: {
909
+ width: 0,
910
+ height: 2
911
+ },
912
+ shadowOpacity: 0.25,
913
+ shadowRadius: 3.84,
914
+ elevation: 5
920
915
  }
921
916
  });
922
917
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaushverse/pickify",
3
- "version": "1.1.15",
3
+ "version": "1.2.0",
4
4
  "description": "A fully customizable React Native picker with search, multi-select, grouping, and async support.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",