@stianlarsen/react-light-beam 1.0.6 → 1.0.8

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/README.md CHANGED
@@ -50,15 +50,16 @@ export default App;
50
50
 
51
51
  ### Props
52
52
 
53
- | Prop Name | Type | Default Value | Description |
54
- | --------------------- | --------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
55
- | `id` | `string` | `undefined` | Optional string representing a unique ID for the LightBeam container. |
56
- | `className` | `string` | `undefined` | Optional string representing custom classes to be added to the LightBeam container. |
57
- | `colorLightmode` | `string` | `rgba(0,0,0, 0.5)` | Optional string representing the color of the light beam in light mode. |
58
- | `colorDarkmode` | `string` | `rgba(255, 255, 255, 0.5)` | Optional string representing the color of the light beam in dark mode. |
59
- | `fullWidth` | `number` | `1.0` | Optional number between `0` and `1` representing the maximum width the light beam can reach. |
60
- | `maskLightByProgress` | `boolean` | `false` | If `true`, the `mask-image`'s linear gradient will start with the chosen color at 0% and the transparent part starting at 50%. As the user scrolls, it will dynamically change to have the transparent part at 95%, reducing the glow effect. If `false`, it will default to `linear-gradient(to bottom, chosenColor 25%, transparent 95%)`. |
61
- | `invert` | `boolean` | `false` | Optional boolean to invert the scroll progress calculation. |
53
+ | Prop Name | Type | Default Value | Description |
54
+ | --------------------- | ------------------------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
55
+ | `id` | `string` | `undefined` | Optional string representing a unique ID for the LightBeam container. |
56
+ | `className` | `string` | `undefined` | Optional string representing custom classes to be added to the LightBeam container. |
57
+ | `colorLightmode` | `string` | `rgba(0,0,0, 0.5)` | Optional string representing the color of the light beam in light mode. |
58
+ | `colorDarkmode` | `string` | `rgba(255, 255, 255, 0.5)` | Optional string representing the color of the light beam in dark mode. |
59
+ | `fullWidth` | `number` | `1.0` | Optional number between `0` and `1` representing the maximum width the light beam can reach. |
60
+ | `maskLightByProgress` | `boolean` | `false` | If `true`, the `mask-image`'s linear gradient will start with the chosen color at 0% and the transparent part starting at 50%. As the user scrolls, it will dynamically change to have the transparent part at 95%, reducing the glow effect. If `false`, it will default to `linear-gradient(to bottom, chosenColor 25%, transparent 95%)`. |
61
+ | `invert` | `boolean` | `false` | Optional boolean to invert the scroll progress calculation. |
62
+ | `onLoaded` | `undefined or () => void` | `undefined` | Optional function to run when the component has mounted |
62
63
 
63
64
  ### Default Configuration
64
65
 
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
2
  import { LightBeamProps } from "../types/types";
3
- export declare const LightBeam: ({ className, colorLightmode, colorDarkmode, maskLightByProgress, fullWidth, invert, id, }: LightBeamProps) => React.JSX.Element;
3
+ export declare const LightBeam: ({ className, colorLightmode, colorDarkmode, maskLightByProgress, fullWidth, invert, id, onLoaded, }: LightBeamProps) => React.JSX.Element;
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ const react_1 = __importStar(require("react"));
33
33
  const lightBeam_module_css_1 = __importDefault(require("./css/lightBeam.module.css"));
34
34
  const useDarkmode_1 = require("./hooks/useDarkmode");
35
35
  const LightBeam = ({ className, colorLightmode = "rgba(0,0,0, 0.5)", colorDarkmode = "rgba(255, 255, 255, 0.5)", maskLightByProgress = false, fullWidth = 1.0, // Default to full width
36
- invert = false, id = undefined, }) => {
36
+ invert = false, id = undefined, onLoaded = undefined, }) => {
37
37
  const elementRef = (0, react_1.useRef)(null);
38
38
  const [bodyElement, setBodyElement] = (0, react_1.useState)(null); // State to hold the body element
39
39
  const inViewProgress = (0, framer_motion_1.useMotionValue)(0);
@@ -43,6 +43,7 @@ invert = false, id = undefined, }) => {
43
43
  (0, react_1.useEffect)(() => {
44
44
  // Set the body element after the component mounts
45
45
  setBodyElement(document.body);
46
+ onLoaded && onLoaded();
46
47
  }, []);
47
48
  (0, react_1.useEffect)(() => {
48
49
  if (bodyElement) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stianlarsen/react-light-beam",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "A customizable React component that creates a light beam effect using conic gradients. Supports dark mode and various customization options.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://github.com/stianalars1/react-light-beam#readme",
40
40
  "peerDependencies": {
41
- "framer-motion": "^11.3.30",
41
+ "framer-motion": "^11.11.1",
42
42
  "react": "^18",
43
43
  "react-dom": "^18"
44
44
  },
@@ -49,8 +49,7 @@
49
49
  "typescript": "^5.5.4"
50
50
  },
51
51
  "dependencies": {
52
- "framer-motion": "^11.3.30",
53
- "react": "^18",
54
- "react-dom": "^18"
52
+ "@emotion/is-prop-valid": "^1.3.1",
53
+ "framer-motion": "^11.11.1"
55
54
  }
56
55
  }
package/types/types.d.ts CHANGED
@@ -6,4 +6,5 @@ export type LightBeamProps = {
6
6
  maskLightByProgress?: boolean;
7
7
  invert?: boolean;
8
8
  id?: string;
9
+ onLoaded?: () => void;
9
10
  };