@kaushverse/pickify 1.2.2 → 1.2.3

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