@kaushverse/pickify 1.2.3 → 1.2.4

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