@chao-component/bag-animation-ui 1.0.4 → 1.0.5

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
@@ -1,8 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
3
  interface BagAnimationProps {
4
- isAnimating: boolean;
5
- setIsAnimating: (isAnimating: boolean) => void;
6
4
  doneFunction: () => void;
7
5
  frames?: string[];
8
6
  defaultImage?: string;
@@ -12,7 +10,7 @@ interface BagAnimationProps {
12
10
  maskOpacity?: number;
13
11
  maskBlur?: number;
14
12
  }
15
- declare function BagAnimation({ isAnimating, setIsAnimating, doneFunction, frames, defaultImage, defaultImageAlt, swipeHintText, showMask, maskOpacity, maskBlur }: BagAnimationProps): react_jsx_runtime.JSX.Element;
13
+ declare function BagAnimation({ doneFunction, frames, defaultImage, defaultImageAlt, swipeHintText, showMask, maskOpacity, maskBlur }: BagAnimationProps): react_jsx_runtime.JSX.Element;
16
14
 
17
15
  /**
18
16
  * 获取打包后的资源路径
package/dist/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
3
  interface BagAnimationProps {
4
- isAnimating: boolean;
5
- setIsAnimating: (isAnimating: boolean) => void;
6
4
  doneFunction: () => void;
7
5
  frames?: string[];
8
6
  defaultImage?: string;
@@ -12,7 +10,7 @@ interface BagAnimationProps {
12
10
  maskOpacity?: number;
13
11
  maskBlur?: number;
14
12
  }
15
- declare function BagAnimation({ isAnimating, setIsAnimating, doneFunction, frames, defaultImage, defaultImageAlt, swipeHintText, showMask, maskOpacity, maskBlur }: BagAnimationProps): react_jsx_runtime.JSX.Element;
13
+ declare function BagAnimation({ doneFunction, frames, defaultImage, defaultImageAlt, swipeHintText, showMask, maskOpacity, maskBlur }: BagAnimationProps): react_jsx_runtime.JSX.Element;
16
14
 
17
15
  /**
18
16
  * 获取打包后的资源路径
package/dist/index.js CHANGED
@@ -802,8 +802,6 @@ var defaultImagePath = "/assets/bag.png";
802
802
  // src/BagAnimation.tsx
803
803
  var import_jsx_runtime = require("react/jsx-runtime");
804
804
  function BagAnimation({
805
- isAnimating,
806
- setIsAnimating,
807
805
  doneFunction,
808
806
  frames = defaultAnimationFrames,
809
807
  defaultImage = defaultImagePath,
@@ -813,6 +811,7 @@ function BagAnimation({
813
811
  maskOpacity = 0.7,
814
812
  maskBlur = 8
815
813
  }) {
814
+ const [isAnimating, setIsAnimating] = (0, import_react.useState)(false);
816
815
  const [frame, setFrame] = (0, import_react.useState)(0);
817
816
  const [isPausedAtThird, setIsPausedAtThird] = (0, import_react.useState)(false);
818
817
  const [thirdFrameProgress, setThirdFrameProgress] = (0, import_react.useState)(0);
@@ -1143,6 +1142,9 @@ function BagAnimation({
1143
1142
  {
1144
1143
  src: mysteryBoxImage,
1145
1144
  alt: mysteryBoxAlt,
1145
+ onClick: () => {
1146
+ setIsAnimating(true);
1147
+ },
1146
1148
  className: "w-36 h-36 md:w-96 md:h-96 object-contain relative z-10"
1147
1149
  }
1148
1150
  )
package/dist/index.mjs CHANGED
@@ -786,8 +786,6 @@ var defaultImagePath = "/assets/bag.png";
786
786
  // src/BagAnimation.tsx
787
787
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
788
788
  function BagAnimation({
789
- isAnimating,
790
- setIsAnimating,
791
789
  doneFunction,
792
790
  frames = defaultAnimationFrames,
793
791
  defaultImage = defaultImagePath,
@@ -797,6 +795,7 @@ function BagAnimation({
797
795
  maskOpacity = 0.7,
798
796
  maskBlur = 8
799
797
  }) {
798
+ const [isAnimating, setIsAnimating] = useState(false);
800
799
  const [frame, setFrame] = useState(0);
801
800
  const [isPausedAtThird, setIsPausedAtThird] = useState(false);
802
801
  const [thirdFrameProgress, setThirdFrameProgress] = useState(0);
@@ -1127,6 +1126,9 @@ function BagAnimation({
1127
1126
  {
1128
1127
  src: mysteryBoxImage,
1129
1128
  alt: mysteryBoxAlt,
1129
+ onClick: () => {
1130
+ setIsAnimating(true);
1131
+ },
1130
1132
  className: "w-36 h-36 md:w-96 md:h-96 object-contain relative z-10"
1131
1133
  }
1132
1134
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chao-component/bag-animation-ui",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",