@once-ui-system/fx 3.0.0-beta.0 → 3.0.0-beta.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.
@@ -1,21 +1,41 @@
1
1
  import { Flex, type Speed } from "@once-ui-system/core";
2
2
  import type React from "react";
3
3
  type CelebrationType = "confetti" | "fireworks";
4
- interface CelebrationFxProps extends React.ComponentProps<typeof Flex> {
4
+ interface CelebrationFxProps extends Omit<React.ComponentProps<typeof Flex>, "onChange" | "defaultValue"> {
5
5
  type?: CelebrationType;
6
6
  /** A multiplier on the designed pace (`1`), or `"slow"`/`"medium"`/`"fast"` (0.5, 1, 2). */
7
7
  speed?: Speed;
8
+ /**
9
+ * Colours to draw with: tokens (`brand-solid-medium`, `accent-weak`), custom
10
+ * properties (`--my-color`) or CSS colours. Read again when the theme changes.
11
+ */
8
12
  colors?: string[];
13
+ /** How much to draw: pieces per cannon for confetti, sparks per shell for fireworks. 0 to 200. */
9
14
  intensity?: number;
10
- /** Milliseconds to keep emitting (seconds until 3.0). */
15
+ /**
16
+ * Milliseconds the celebration runs once it starts; then `active` turns off
17
+ * and what is in the air settles. `0` or `Infinity` runs until `active` is
18
+ * set to false.
19
+ */
11
20
  duration?: number;
12
- trigger?: "mount" | "hover" | "manual" | "click";
21
+ /**
22
+ * What starts the celebration by itself: `mount` (on load), `hover` (while
23
+ * the pointer is over it; a tap on touch screens) or `click` (a burst where
24
+ * clicked). Setting `active` starts and stops it from outside, whatever the
25
+ * trigger.
26
+ */
27
+ trigger?: "mount" | "hover" | "click";
28
+ /** Whether it is celebrating. Controlled; pair with `onActiveChange`. */
13
29
  active?: boolean;
30
+ /** The first value of `active` when uncontrolled. Defaults to `trigger === "mount"`. */
31
+ defaultActive?: boolean;
32
+ /** Called when the celebration starts (hover) or ends (`duration`, pointer leaving). */
33
+ onActiveChange?: (active: boolean) => void;
14
34
  reducedMotion?: boolean | "auto";
15
35
  children?: React.ReactNode;
16
36
  }
17
37
  declare const CelebrationFx: {
18
- ({ ref: forwardedRef, type, speed: speedProp, colors, intensity, duration, trigger, active, reducedMotion, children, style, ...rest }: CelebrationFxProps): React.JSX.Element;
38
+ ({ ref: forwardedRef, type, speed: speedProp, colors: colorsProp, intensity, duration, trigger, active: activeProp, defaultActive, onActiveChange, reducedMotion, children, onClick, onMouseEnter, onMouseLeave, ...rest }: CelebrationFxProps): React.JSX.Element;
19
39
  displayName: string;
20
40
  };
21
41
  export { CelebrationFx };