@kaushverse/pickify 1.2.1 → 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,41 +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
- const totalActions = actions.length;
757
- const startAngle = -Math.PI / 3;
759
+ const total = actions.length;
760
+ const startAngle = -Math.PI / 2.2;
758
761
  const endAngle = -Math.PI * 0.8;
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);
762
+ const angle = startAngle + index / (total - 1 || 1) * (endAngle - startAngle);
763
+ translateX = radius * Math.cos(angle);
764
+ translateY = radius * Math.sin(angle);
763
765
  }
764
766
  const animStyle = {
765
767
  transform: [
@@ -777,20 +779,40 @@ var FloatingButton = class extends import_react4.default.Component {
777
779
  },
778
780
  {
779
781
  scale: this.animation.interpolate({
780
- inputRange: [0, 0.5, 1],
781
- outputRange: [0, 1.2, 1]
782
+ inputRange: [0, 0.3, 0.7, 1],
783
+ outputRange: [0, 1.2, 0.95, 1]
782
784
  })
783
785
  }
784
786
  ],
785
- 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
+ ]
786
806
  };
787
807
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
788
808
  import_react_native5.TouchableWithoutFeedback,
789
809
  {
790
810
  onPress: () => {
791
811
  this.toggleMenu();
792
- action.onPress?.();
793
- action.navigateTo?.();
812
+ setTimeout(() => {
813
+ action.onPress?.();
814
+ action.navigateTo?.();
815
+ }, 100);
794
816
  },
795
817
  children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
796
818
  import_react_native5.Animated.View,
@@ -798,12 +820,18 @@ var FloatingButton = class extends import_react4.default.Component {
798
820
  style: [
799
821
  defaultStyles4.secondary,
800
822
  styles2?.secondaryButton,
801
- { backgroundColor: action.color || "#F02A4B" },
802
- animStyle
823
+ {
824
+ backgroundColor: action.color || "#F02A4B",
825
+ width: secondarySize,
826
+ height: secondarySize,
827
+ borderRadius: secondarySize / 2
828
+ },
829
+ animStyle,
830
+ mode !== "circle" && delayedStyle
803
831
  ],
804
832
  children: renderItemIcon?.({
805
833
  name: action.icon,
806
- size: 20,
834
+ size: secondarySize * 0.42,
807
835
  color: action.iconColor || "#FFF"
808
836
  })
809
837
  }
@@ -813,7 +841,16 @@ var FloatingButton = class extends import_react4.default.Component {
813
841
  );
814
842
  };
815
843
  render() {
816
- 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;
817
854
  const rotation = {
818
855
  transform: [
819
856
  {
@@ -824,48 +861,53 @@ var FloatingButton = class extends import_react4.default.Component {
824
861
  }
825
862
  ]
826
863
  };
827
- const scale = {
864
+ const mainScale = {
828
865
  transform: [
829
866
  {
830
867
  scale: this.animation.interpolate({
831
868
  inputRange: [0, 0.5, 1],
832
- outputRange: [1, 1.1, 1]
869
+ outputRange: [1, 1.15, 1]
833
870
  })
834
871
  }
835
872
  ]
836
873
  };
837
874
  const mainIcon = mainIconName || "add";
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)(
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)(
840
879
  import_react_native5.Animated.View,
841
880
  {
842
881
  style: [
843
- defaultStyles4.circleContainer,
844
- styles2?.circleContainer,
882
+ defaultStyles4.mainButtonWrapper,
883
+ styles2?.mainButton,
884
+ rotation,
885
+ mainScale,
845
886
  {
846
- transform: [
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,
847
898
  {
848
- scale: this.animation.interpolate({
849
- inputRange: [0, 1],
850
- outputRange: [0, 1]
851
- })
899
+ width: buttonSize,
900
+ height: buttonSize,
901
+ borderRadius: buttonSize / 2
852
902
  }
853
903
  ],
854
- opacity: this.animation
904
+ children: renderMainIcon?.({
905
+ name: mainIcon,
906
+ size: buttonSize * 0.46,
907
+ color: "#FFF"
908
+ })
855
909
  }
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
- }) })
910
+ )
869
911
  }
870
912
  ) })
871
913
  ] });
@@ -877,54 +919,31 @@ var defaultStyles4 = import_react_native5.StyleSheet.create({
877
919
  bottom: 100,
878
920
  right: 20,
879
921
  alignItems: "center",
880
- justifyContent: "center"
922
+ justifyContent: "center",
923
+ zIndex: 1e3
881
924
  },
882
925
  mainButtonWrapper: {
883
- width: 60,
884
- height: 60,
885
- borderRadius: 30,
886
926
  backgroundColor: "#F02A4B",
887
927
  alignItems: "center",
888
928
  justifyContent: "center",
889
929
  shadowColor: "#000",
890
- shadowOffset: {
891
- width: 0,
892
- height: 2
893
- },
894
- shadowOpacity: 0.25,
895
- shadowRadius: 3.84,
896
- elevation: 5
930
+ shadowOffset: { width: 0, height: 4 },
931
+ shadowOpacity: 0.3,
932
+ shadowRadius: 4.65,
933
+ elevation: 8
897
934
  },
898
935
  button: {
899
- width: 60,
900
- height: 60,
901
- borderRadius: 30,
902
936
  backgroundColor: "#F02A4B",
903
937
  alignItems: "center",
904
938
  justifyContent: "center"
905
939
  },
906
- circleContainer: {
907
- position: "absolute",
908
- width: 200,
909
- height: 200,
910
- right: -60,
911
- bottom: -60,
912
- alignItems: "center",
913
- justifyContent: "center"
914
- },
915
940
  secondary: {
916
941
  position: "absolute",
917
- width: 48,
918
- height: 48,
919
- borderRadius: 24,
920
942
  backgroundColor: "#F02A4B",
921
943
  alignItems: "center",
922
944
  justifyContent: "center",
923
945
  shadowColor: "#000",
924
- shadowOffset: {
925
- width: 0,
926
- height: 2
927
- },
946
+ shadowOffset: { width: 0, height: 2 },
928
947
  shadowOpacity: 0.25,
929
948
  shadowRadius: 3.84,
930
949
  elevation: 5
package/dist/index.mjs CHANGED
@@ -709,41 +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
- const totalActions = actions.length;
741
- const startAngle = -Math.PI / 3;
743
+ const total = actions.length;
744
+ const startAngle = -Math.PI / 2.2;
742
745
  const endAngle = -Math.PI * 0.8;
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);
746
+ const angle = startAngle + index / (total - 1 || 1) * (endAngle - startAngle);
747
+ translateX = radius * Math.cos(angle);
748
+ translateY = radius * Math.sin(angle);
747
749
  }
748
750
  const animStyle = {
749
751
  transform: [
@@ -761,20 +763,40 @@ var FloatingButton = class extends React4.Component {
761
763
  },
762
764
  {
763
765
  scale: this.animation.interpolate({
764
- inputRange: [0, 0.5, 1],
765
- outputRange: [0, 1.2, 1]
766
+ inputRange: [0, 0.3, 0.7, 1],
767
+ outputRange: [0, 1.2, 0.95, 1]
766
768
  })
767
769
  }
768
770
  ],
769
- 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
+ ]
770
790
  };
771
791
  return /* @__PURE__ */ jsx5(
772
792
  TouchableWithoutFeedback,
773
793
  {
774
794
  onPress: () => {
775
795
  this.toggleMenu();
776
- action.onPress?.();
777
- action.navigateTo?.();
796
+ setTimeout(() => {
797
+ action.onPress?.();
798
+ action.navigateTo?.();
799
+ }, 100);
778
800
  },
779
801
  children: /* @__PURE__ */ jsx5(
780
802
  Animated3.View,
@@ -782,12 +804,18 @@ var FloatingButton = class extends React4.Component {
782
804
  style: [
783
805
  defaultStyles4.secondary,
784
806
  styles2?.secondaryButton,
785
- { backgroundColor: action.color || "#F02A4B" },
786
- animStyle
807
+ {
808
+ backgroundColor: action.color || "#F02A4B",
809
+ width: secondarySize,
810
+ height: secondarySize,
811
+ borderRadius: secondarySize / 2
812
+ },
813
+ animStyle,
814
+ mode !== "circle" && delayedStyle
787
815
  ],
788
816
  children: renderItemIcon?.({
789
817
  name: action.icon,
790
- size: 20,
818
+ size: secondarySize * 0.42,
791
819
  color: action.iconColor || "#FFF"
792
820
  })
793
821
  }
@@ -797,7 +825,16 @@ var FloatingButton = class extends React4.Component {
797
825
  );
798
826
  };
799
827
  render() {
800
- 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;
801
838
  const rotation = {
802
839
  transform: [
803
840
  {
@@ -808,48 +845,53 @@ var FloatingButton = class extends React4.Component {
808
845
  }
809
846
  ]
810
847
  };
811
- const scale = {
848
+ const mainScale = {
812
849
  transform: [
813
850
  {
814
851
  scale: this.animation.interpolate({
815
852
  inputRange: [0, 0.5, 1],
816
- outputRange: [1, 1.1, 1]
853
+ outputRange: [1, 1.15, 1]
817
854
  })
818
855
  }
819
856
  ]
820
857
  };
821
858
  const mainIcon = mainIconName || "add";
822
- return /* @__PURE__ */ jsxs5(View5, { style: [defaultStyles4.container, styles2?.container, style], children: [
823
- /* @__PURE__ */ jsx5(
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(
824
863
  Animated3.View,
825
864
  {
826
865
  style: [
827
- defaultStyles4.circleContainer,
828
- styles2?.circleContainer,
866
+ defaultStyles4.mainButtonWrapper,
867
+ styles2?.mainButton,
868
+ rotation,
869
+ mainScale,
829
870
  {
830
- transform: [
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,
831
882
  {
832
- scale: this.animation.interpolate({
833
- inputRange: [0, 1],
834
- outputRange: [0, 1]
835
- })
883
+ width: buttonSize,
884
+ height: buttonSize,
885
+ borderRadius: buttonSize / 2
836
886
  }
837
887
  ],
838
- opacity: this.animation
888
+ children: renderMainIcon?.({
889
+ name: mainIcon,
890
+ size: buttonSize * 0.46,
891
+ color: "#FFF"
892
+ })
839
893
  }
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
- }) })
894
+ )
853
895
  }
854
896
  ) })
855
897
  ] });
@@ -861,54 +903,31 @@ var defaultStyles4 = StyleSheet5.create({
861
903
  bottom: 100,
862
904
  right: 20,
863
905
  alignItems: "center",
864
- justifyContent: "center"
906
+ justifyContent: "center",
907
+ zIndex: 1e3
865
908
  },
866
909
  mainButtonWrapper: {
867
- width: 60,
868
- height: 60,
869
- borderRadius: 30,
870
910
  backgroundColor: "#F02A4B",
871
911
  alignItems: "center",
872
912
  justifyContent: "center",
873
913
  shadowColor: "#000",
874
- shadowOffset: {
875
- width: 0,
876
- height: 2
877
- },
878
- shadowOpacity: 0.25,
879
- shadowRadius: 3.84,
880
- elevation: 5
914
+ shadowOffset: { width: 0, height: 4 },
915
+ shadowOpacity: 0.3,
916
+ shadowRadius: 4.65,
917
+ elevation: 8
881
918
  },
882
919
  button: {
883
- width: 60,
884
- height: 60,
885
- borderRadius: 30,
886
920
  backgroundColor: "#F02A4B",
887
921
  alignItems: "center",
888
922
  justifyContent: "center"
889
923
  },
890
- circleContainer: {
891
- position: "absolute",
892
- width: 200,
893
- height: 200,
894
- right: -60,
895
- bottom: -60,
896
- alignItems: "center",
897
- justifyContent: "center"
898
- },
899
924
  secondary: {
900
925
  position: "absolute",
901
- width: 48,
902
- height: 48,
903
- borderRadius: 24,
904
926
  backgroundColor: "#F02A4B",
905
927
  alignItems: "center",
906
928
  justifyContent: "center",
907
929
  shadowColor: "#000",
908
- shadowOffset: {
909
- width: 0,
910
- height: 2
911
- },
930
+ shadowOffset: { width: 0, height: 2 },
912
931
  shadowOpacity: 0.25,
913
932
  shadowRadius: 3.84,
914
933
  elevation: 5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaushverse/pickify",
3
- "version": "1.2.1",
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",