@enact-ui/backgrounds 1.0.0

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.
@@ -0,0 +1,21 @@
1
+ import { type MotionPreset } from "@enact-ui/animate";
2
+ import { type FC } from "react";
3
+ export interface BackgroundPathsProps {
4
+ /** Motion preset - controls animation speed and intensity (required) */
5
+ preset: MotionPreset;
6
+ }
7
+ /**
8
+ * BackgroundPaths Component
9
+ *
10
+ * Renders animated SVG paths for ambient background effects.
11
+ * Uses the motion preset system for theme-aware, configurable animations.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * <BackgroundPaths preset="medium" />
16
+ * <BackgroundPaths preset="slow" />
17
+ * <BackgroundPaths preset="fast" />
18
+ * ```
19
+ */
20
+ export declare const BackgroundPaths: FC<BackgroundPathsProps>;
21
+ //# sourceMappingURL=background-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"background-paths.d.ts","sourceRoot":"","sources":["../../src/components/background-paths.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAE,KAAK,EAAE,EAAW,MAAM,OAAO,CAAC;AAiFzC,MAAM,WAAW,oBAAoB;IACjC,wEAAwE;IACxE,MAAM,EAAE,YAAY,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAyBpD,CAAC"}
@@ -0,0 +1,55 @@
1
+ // Copyright (c) 2025 Amsterdam Data Labs
2
+ "use client";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { useMotionPreset } from "@enact-ui/animate";
5
+ import { motion } from "motion/react";
6
+ import { useMemo } from "react";
7
+ function FloatingPaths({ position, baseDuration, opacity, ease, durationVariation, prefersReducedMotion }) {
8
+ // Memoize path calculations and random values to prevent regeneration on re-render
9
+ const paths = useMemo(() => Array.from({ length: 36 }, (_, i) => {
10
+ // Generate stable random variations per path
11
+ const durationRandom = Math.random();
12
+ return {
13
+ id: i,
14
+ d: `M-${380 - i * 5 * position} -${189 + i * 6}C-${380 - i * 5 * position} -${189 + i * 6} -${312 - i * 5 * position} ${216 - i * 6} ${152 - i * 5 * position} ${343 - i * 6}C${616 - i * 5 * position} ${470 - i * 6} ${684 - i * 5 * position} ${875 - i * 6} ${684 - i * 5 * position} ${875 - i * 6}`,
15
+ color: `rgba(15,23,42,${0.1 + i * 0.03})`,
16
+ width: 0.5 + i * 0.03,
17
+ durationRandom,
18
+ };
19
+ }), [position]);
20
+ // If reduced motion is preferred, render static paths
21
+ if (prefersReducedMotion) {
22
+ return (_jsx("div", { className: "pointer-events-none absolute inset-0", children: _jsxs("svg", { className: "text-muted h-full w-full", viewBox: "0 0 696 316", fill: "none", "aria-hidden": "true", children: [_jsx("title", { children: "Background Paths" }), paths.map((path) => (_jsx("path", { d: path.d, stroke: "currentColor", strokeWidth: path.width, strokeOpacity: opacity[1] }, path.id)))] }) }));
23
+ }
24
+ return (_jsx("div", { className: "pointer-events-none absolute inset-0", children: _jsxs("svg", { className: "text-muted h-full w-full", viewBox: "0 0 696 316", fill: "none", "aria-hidden": "true", children: [_jsx("title", { children: "Background Paths" }), paths.map((path) => {
25
+ // Calculate duration with preset-based variation
26
+ const duration = baseDuration + baseDuration * durationVariation * path.durationRandom;
27
+ return (_jsx(motion.path, { d: path.d, stroke: "currentColor", strokeWidth: path.width, strokeOpacity: 0.1 + path.id * 0.03, initial: { pathLength: 0.3, opacity: opacity[0] }, animate: {
28
+ pathLength: 1,
29
+ opacity: opacity,
30
+ pathOffset: [0, 1, 0],
31
+ }, transition: {
32
+ duration,
33
+ repeat: Number.POSITIVE_INFINITY,
34
+ ease,
35
+ } }, path.id));
36
+ })] }) }));
37
+ }
38
+ /**
39
+ * BackgroundPaths Component
40
+ *
41
+ * Renders animated SVG paths for ambient background effects.
42
+ * Uses the motion preset system for theme-aware, configurable animations.
43
+ *
44
+ * @example
45
+ * ```tsx
46
+ * <BackgroundPaths preset="medium" />
47
+ * <BackgroundPaths preset="slow" />
48
+ * <BackgroundPaths preset="fast" />
49
+ * ```
50
+ */
51
+ export const BackgroundPaths = ({ preset }) => {
52
+ const motionConfig = useMotionPreset("paths", preset);
53
+ return (_jsx("div", { className: "pointer-events-none relative flex h-full w-full items-center justify-center overflow-hidden", "aria-hidden": "true", children: _jsxs("div", { className: "absolute inset-0", children: [_jsx(FloatingPaths, { position: 1, baseDuration: motionConfig.baseDuration, opacity: motionConfig.opacity, ease: motionConfig.ease, durationVariation: motionConfig.durationVariation, prefersReducedMotion: motionConfig.prefersReducedMotion }), _jsx(FloatingPaths, { position: -1, baseDuration: motionConfig.baseDuration, opacity: motionConfig.opacity, ease: motionConfig.ease, durationVariation: motionConfig.durationVariation, prefersReducedMotion: motionConfig.prefersReducedMotion })] }) }));
54
+ };
55
+ //# sourceMappingURL=background-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"background-paths.js","sourceRoot":"","sources":["../../src/components/background-paths.tsx"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,YAAY,CAAC;;AAEb,OAAO,EAAqB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAW,OAAO,EAAE,MAAM,OAAO,CAAC;AAWzC,SAAS,aAAa,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,oBAAoB,EAAsB;IACzH,mFAAmF;IACnF,MAAM,KAAK,GAAG,OAAO,CACjB,GAAG,EAAE,CACD,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAChC,6CAA6C;QAC7C,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACrC,OAAO;YACH,EAAE,E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kBAAkB,aAC7B,KAAC,aAAa,IACV,QAAQ,EAAE,CAAC,EACX,YAAY,EAAE,YAAY,CAAC,YAAY,EACvC,OAAO,EAAE,YAAY,CAAC,OAAO,EAC7B,IAAI,EAAE,YAAY,CAAC,IAAI,EACvB,iBAAiB,EAAE,YAAY,CAAC,iBAAiB,EACjD,oBAAoB,EAAE,YAAY,CAAC,oBAAoB,GACzD,EACF,KAAC,aAAa,IACV,QAAQ,EAAE,CAAC,CAAC,EACZ,YAAY,EAAE,YAAY,CAAC,YAAY,EACvC,OAAO,EAAE,YAAY,CAAC,OAAO,EAC7B,IAAI,EAAE,YAAY,CAAC,IAAI,EACvB,iBAAiB,EAAE,YAAY,CAAC,iBAAiB,EACjD,oBAAoB,EAAE,YAAY,CAAC,oBAAoB,GACzD,IACA,GACJ,CACT,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Meta, StoryObj } from "@storybook/nextjs-vite";
2
+ import { type BackgroundPathsProps } from "./background-paths";
3
+ declare const meta: Meta<BackgroundPathsProps>;
4
+ export default meta;
5
+ type Story = StoryObj<BackgroundPathsProps>;
6
+ export declare const Default: Story;
7
+ export declare const Slow: Story;
8
+ export declare const Medium: Story;
9
+ export declare const Fast: Story;
10
+ export declare const WithDarkBackground: Story;
11
+ //# sourceMappingURL=background-paths.story.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"background-paths.story.d.ts","sourceRoot":"","sources":["../../src/components/background-paths.story.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEhF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,oBAAoB,CAuBpC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,oBAAoB,CAAC,CAAC;AAE5C,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAWlB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAWpB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAWlB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAkBhC,CAAC"}
@@ -0,0 +1,80 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { BackgroundPaths } from "./background-paths";
3
+ const meta = {
4
+ title: "Backgrounds/BackgroundPaths",
5
+ component: BackgroundPaths,
6
+ parameters: {
7
+ layout: "fullscreen",
8
+ },
9
+ decorators: [
10
+ (Story) => (_jsx("div", { className: "relative h-screen w-full bg-bg-primary", children: _jsx(Story, {}) })),
11
+ ],
12
+ argTypes: {
13
+ preset: {
14
+ control: "select",
15
+ options: ["slow", "medium", "fast"],
16
+ description: "Motion preset speed - controls animation duration and intensity",
17
+ table: {
18
+ type: { summary: '"slow" | "medium" | "fast"' },
19
+ },
20
+ },
21
+ },
22
+ };
23
+ export default meta;
24
+ export const Default = {
25
+ args: {
26
+ preset: "medium",
27
+ },
28
+ };
29
+ export const Slow = {
30
+ args: {
31
+ preset: "slow",
32
+ },
33
+ parameters: {
34
+ docs: {
35
+ description: {
36
+ story: "Slow preset: Longer animation duration (30s base), subtle opacity (0.2-0.4), perfect for calm backgrounds.",
37
+ },
38
+ },
39
+ },
40
+ };
41
+ export const Medium = {
42
+ args: {
43
+ preset: "medium",
44
+ },
45
+ parameters: {
46
+ docs: {
47
+ description: {
48
+ story: "Medium preset: Balanced animation duration (20s base), moderate opacity (0.3-0.6), suitable for most use cases.",
49
+ },
50
+ },
51
+ },
52
+ };
53
+ export const Fast = {
54
+ args: {
55
+ preset: "fast",
56
+ },
57
+ parameters: {
58
+ docs: {
59
+ description: {
60
+ story: "Fast preset: Quick animation duration (12s base), higher opacity (0.4-0.8), creates a more dynamic feel.",
61
+ },
62
+ },
63
+ },
64
+ };
65
+ export const WithDarkBackground = {
66
+ args: {
67
+ preset: "medium",
68
+ },
69
+ decorators: [
70
+ (Story) => (_jsx("div", { className: "relative h-screen w-full bg-gray-900", children: _jsx(Story, {}) })),
71
+ ],
72
+ parameters: {
73
+ docs: {
74
+ description: {
75
+ story: "BackgroundPaths on a dark background - paths adapt to the contrast.",
76
+ },
77
+ },
78
+ },
79
+ };
80
+ //# sourceMappingURL=background-paths.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"background-paths.story.js","sourceRoot":"","sources":["../../src/components/background-paths.story.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAA6B,MAAM,oBAAoB,CAAC;AAEhF,MAAM,IAAI,GAA+B;IACrC,KAAK,EAAE,6BAA6B;IACpC,SAAS,EAAE,eAAe;IAC1B,UAAU,EAAE;QACR,MAAM,EAAE,YAAY;KACvB;IACD,UAAU,EAAE;QACR,CAAC,KAAK,EAAE,EAAE,CAAC,CACP,cAAK,SAAS,EAAC,wCAAwC,YACnD,KAAC,KAAK,KAAG,GACP,CACT;KACJ;IACD,QAAQ,EAAE;QACN,MAAM,EAAE;YACJ,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC;YACnC,WAAW,EAAE,iEAAiE;YAC9E,KAAK,EAAE;gBACH,IAAI,EAAE,EAAE,OAAO,EAAE,4BAA4B,EAAE;aAClD;SACJ;KACJ;CACJ,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC1B,IAAI,EAAE;QACF,MAAM,EAAE,QAAQ;KACnB;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAU;IACvB,IAAI,EAAE;QACF,MAAM,EAAE,MAAM;KACjB;IACD,UAAU,EAAE;QACR,IAAI,EAAE;YACF,WAAW,EAAE;gBACT,KAAK,EAAE,4GAA4G;aACtH;SACJ;KACJ;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAU;IACzB,IAAI,EAAE;QACF,MAAM,EAAE,QAAQ;KACnB;IACD,UAAU,EAAE;QACR,IAAI,EAAE;YACF,WAAW,EAAE;gBACT,KAAK,EAAE,iHAAiH;aAC3H;SACJ;KACJ;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAU;IACvB,IAAI,EAAE;QACF,MAAM,EAAE,MAAM;KACjB;IACD,UAAU,EAAE;QACR,IAAI,EAAE;YACF,WAAW,EAAE;gBACT,KAAK,EAAE,0GAA0G;aACpH;SACJ;KACJ;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAU;IACrC,IAAI,EAAE;QACF,MAAM,EAAE,QAAQ;KACnB;IACD,UAAU,EAAE;QACR,CAAC,KAAK,EAAE,EAAE,CAAC,CACP,cAAK,SAAS,EAAC,sCAAsC,YACjD,KAAC,KAAK,KAAG,GACP,CACT;KACJ;IACD,UAAU,EAAE;QACR,IAAI,EAAE;YACF,WAAW,EAAE;gBACT,KAAK,EAAE,qEAAqE;aAC/E;SACJ;KACJ;CACJ,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { type MotionPreset } from "@enact-ui/animate";
2
+ import { type FC } from "react";
3
+ /**
4
+ * LightRays Component
5
+ *
6
+ * Adapted from MagicUI (MIT Licensed)
7
+ * Original source: https://github.com/magicuidesign/magicui/blob/main/apps/www/registry/magicui/light-rays.tsx
8
+ * Reference files: references/magicui-lightrays/
9
+ *
10
+ * Creates animated light rays that shine from above, perfect for ambient background effects.
11
+ * Uses CSS gradients and motion animations - no Three.js dependencies required.
12
+ *
13
+ * Uses the motion preset system for theme-aware, configurable animations.
14
+ */
15
+ export interface LightRaysProps extends React.HTMLAttributes<HTMLDivElement> {
16
+ ref?: React.Ref<HTMLDivElement>;
17
+ /** Motion preset - controls animation speed and intensity (required) */
18
+ preset: MotionPreset;
19
+ /** Number of light rays to render */
20
+ count?: number;
21
+ /** Color of the light rays (CSS color value) */
22
+ color?: string;
23
+ /** Blur amount in pixels */
24
+ blur?: number;
25
+ /** Length of the rays (CSS length value) */
26
+ length?: string;
27
+ }
28
+ /**
29
+ * LightRays Component
30
+ *
31
+ * Creates animated light rays that shine from above, perfect for ambient background effects.
32
+ * Uses the motion preset system for theme-aware, configurable animations.
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * <LightRays preset="medium" />
37
+ * <LightRays preset="slow" count={5} color="rgba(160, 210, 255, 0.3)" />
38
+ * <LightRays preset="fast" blur={48} length="80vh" />
39
+ * ```
40
+ */
41
+ export declare const LightRays: FC<LightRaysProps>;
42
+ //# sourceMappingURL=light-rays.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"light-rays.d.ts","sourceRoot":"","sources":["../../src/components/light-rays.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,mBAAmB,CAAC;AAGvE,OAAO,EAAsB,KAAK,EAAE,EAAW,MAAM,OAAO,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACxE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,wEAAwE;IACxE,MAAM,EAAE,YAAY,CAAC;IACrB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AA6FD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CA8DxC,CAAC"}
@@ -0,0 +1,86 @@
1
+ // Copyright (c) 2025 Amsterdam Data Labs
2
+ "use client";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { useMotionPreset } from "@enact-ui/animate";
5
+ import { cx } from "@enact-ui/react";
6
+ import { motion } from "motion/react";
7
+ import { useMemo } from "react";
8
+ const createRays = (count, swingVariation) => {
9
+ if (count <= 0)
10
+ return [];
11
+ return Array.from({ length: count }, (_, index) => {
12
+ const left = 8 + Math.random() * 84;
13
+ const rotate = -28 + Math.random() * 56;
14
+ const width = 160 + Math.random() * 160;
15
+ const swing = 0.8 + Math.random() * swingVariation;
16
+ const delay = Math.random();
17
+ const durationMultiplier = 0.75 + Math.random() * 0.5;
18
+ const intensityMultiplier = 0.6 + Math.random() * 0.5;
19
+ return {
20
+ id: `${index}-${Math.round(left * 10)}`,
21
+ left,
22
+ rotate,
23
+ width,
24
+ swing,
25
+ delay,
26
+ durationMultiplier,
27
+ intensityMultiplier,
28
+ };
29
+ });
30
+ };
31
+ const Ray = ({ left, rotate, width, swing, delay, durationMultiplier, intensityMultiplier, cycleDuration, intensity, prefersReducedMotion }) => {
32
+ const computedIntensity = intensity * intensityMultiplier;
33
+ const computedDuration = cycleDuration * durationMultiplier;
34
+ const computedDelay = delay * cycleDuration;
35
+ // If reduced motion is preferred, render static ray
36
+ if (prefersReducedMotion) {
37
+ return (_jsx("div", { className: "pointer-events-none absolute -top-[12%] left-[var(--ray-left)] h-[var(--light-rays-length)] w-[var(--ray-width)] origin-top -translate-x-1/2 rounded-full bg-gradient-to-b from-[color-mix(in_srgb,var(--light-rays-color)_70%,transparent)] to-transparent opacity-[var(--ray-opacity)] mix-blend-screen blur-[var(--light-rays-blur)]", style: {
38
+ "--ray-left": `${left}%`,
39
+ "--ray-width": `${width}px`,
40
+ "--ray-opacity": computedIntensity * 0.5,
41
+ transform: `rotate(${rotate}deg)`,
42
+ }, "aria-hidden": "true" }));
43
+ }
44
+ return (_jsx(motion.div, { className: "pointer-events-none absolute -top-[12%] left-[var(--ray-left)] h-[var(--light-rays-length)] w-[var(--ray-width)] origin-top -translate-x-1/2 rounded-full bg-gradient-to-b from-[color-mix(in_srgb,var(--light-rays-color)_70%,transparent)] to-transparent opacity-0 mix-blend-screen blur-[var(--light-rays-blur)]", style: {
45
+ "--ray-left": `${left}%`,
46
+ "--ray-width": `${width}px`,
47
+ }, initial: { rotate: rotate }, animate: {
48
+ opacity: [0, computedIntensity, 0],
49
+ rotate: [rotate - swing, rotate + swing, rotate - swing],
50
+ }, transition: {
51
+ duration: computedDuration,
52
+ repeat: Number.POSITIVE_INFINITY,
53
+ ease: "easeInOut",
54
+ delay: computedDelay,
55
+ repeatDelay: computedDuration * 0.1,
56
+ }, "aria-hidden": "true" }));
57
+ };
58
+ /**
59
+ * LightRays Component
60
+ *
61
+ * Creates animated light rays that shine from above, perfect for ambient background effects.
62
+ * Uses the motion preset system for theme-aware, configurable animations.
63
+ *
64
+ * @example
65
+ * ```tsx
66
+ * <LightRays preset="medium" />
67
+ * <LightRays preset="slow" count={5} color="rgba(160, 210, 255, 0.3)" />
68
+ * <LightRays preset="fast" blur={48} length="80vh" />
69
+ * ```
70
+ */
71
+ export const LightRays = ({ className, style, preset, count = 7, color = "rgba(160, 210, 255, 0.2)", blur = 36, length = "70vh", ref, ...props }) => {
72
+ const motionConfig = useMotionPreset("rays", preset);
73
+ // Memoize rays creation based on count and swingVariation
74
+ const rays = useMemo(() => createRays(count, motionConfig.swingVariation), [count, motionConfig.swingVariation]);
75
+ return (_jsx("div", { ref: ref, className: cx("pointer-events-none absolute inset-0 isolate overflow-hidden rounded-[inherit]", className), style: {
76
+ "--light-rays-color": color,
77
+ "--light-rays-blur": `${blur}px`,
78
+ "--light-rays-length": length,
79
+ ...style,
80
+ }, "aria-hidden": "true", ...props, children: _jsxs("div", { className: "absolute inset-0 overflow-hidden", children: [_jsx("div", { "aria-hidden": "true", className: "absolute inset-0 opacity-60", style: {
81
+ background: "radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--light-rays-color) 45%, transparent), transparent 70%)",
82
+ } }), _jsx("div", { "aria-hidden": "true", className: "absolute inset-0 opacity-60", style: {
83
+ background: "radial-gradient(circle at 80% 10%, color-mix(in srgb, var(--light-rays-color) 35%, transparent), transparent 75%)",
84
+ } }), rays.map((ray) => (_jsx(Ray, { ...ray, cycleDuration: motionConfig.cycleDuration, intensity: motionConfig.intensity, prefersReducedMotion: motionConfig.prefersReducedMotion }, ray.id)))] }) }));
85
+ };
86
+ //# sourceMappingURL=light-rays.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"light-rays.js","sourceRoot":"","sources":["../../src/components/light-rays.tsx"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,YAAY,CAAC;;AAEb,OAAO,EAAqB,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAoB,MAAM,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAA+B,OAAO,EAAE,MAAM,OAAO,CAAC;AAuC7D,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,cAAsB,EAAc,EAAE;IACrE,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAE1B,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QAC9C,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC;QACpC,MAAM,MAAM,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;QACxC,MAAM,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,cAAc,CAAC;QACnD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC5B,MAAM,kBAAkB,GAAG,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;QACtD,MAAM,mBA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,6BAA6B,EACvC,KAAK,EACD;wBACI,UAAU,EAAE,mHAAmH;qBACjH,GAExB,EACD,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACf,KAAC,GAAG,OAEI,GAAG,EACP,aAAa,EAAE,YAAY,CAAC,aAAa,EACzC,SAAS,EAAE,YAAY,CAAC,SAAS,EACjC,oBAAoB,EAAE,YAAY,CAAC,oBAAoB,IAJlD,GAAG,CAAC,EAAE,CAKb,CACL,CAAC,IACA,GACJ,CACT,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Meta, StoryObj } from "@storybook/nextjs-vite";
2
+ import { type LightRaysProps } from "./light-rays";
3
+ declare const meta: Meta<LightRaysProps>;
4
+ export default meta;
5
+ type Story = StoryObj<LightRaysProps>;
6
+ export declare const Default: Story;
7
+ export declare const Slow: Story;
8
+ export declare const Medium: Story;
9
+ export declare const Fast: Story;
10
+ export declare const WarmColors: Story;
11
+ export declare const CoolColors: Story;
12
+ export declare const IntenseRays: Story;
13
+ //# sourceMappingURL=light-rays.story.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"light-rays.story.d.ts","sourceRoot":"","sources":["../../src/components/light-rays.story.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,cAAc,CAmD9B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;AAEtC,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAYlB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAYpB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAYlB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAcxB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAexB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAsBzB,CAAC"}
@@ -0,0 +1,150 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { LightRays } from "./light-rays";
3
+ const meta = {
4
+ title: "Backgrounds/LightRays",
5
+ component: LightRays,
6
+ parameters: {
7
+ layout: "fullscreen",
8
+ },
9
+ decorators: [
10
+ (Story) => (_jsx("div", { className: "relative h-screen w-full bg-gray-900", children: _jsx(Story, {}) })),
11
+ ],
12
+ argTypes: {
13
+ preset: {
14
+ control: "select",
15
+ options: ["slow", "medium", "fast"],
16
+ description: "Motion preset speed - controls animation cycle duration and intensity",
17
+ table: {
18
+ type: { summary: '"slow" | "medium" | "fast"' },
19
+ },
20
+ },
21
+ count: {
22
+ control: { type: "range", min: 1, max: 15, step: 1 },
23
+ description: "Number of light rays to render",
24
+ table: {
25
+ defaultValue: { summary: "7" },
26
+ },
27
+ },
28
+ color: {
29
+ control: "color",
30
+ description: "Color of the light rays (CSS color value)",
31
+ table: {
32
+ defaultValue: { summary: "rgba(160, 210, 255, 0.2)" },
33
+ },
34
+ },
35
+ blur: {
36
+ control: { type: "range", min: 0, max: 100, step: 4 },
37
+ description: "Blur amount in pixels",
38
+ table: {
39
+ defaultValue: { summary: "36" },
40
+ },
41
+ },
42
+ length: {
43
+ control: "text",
44
+ description: "Length of the rays (CSS length value)",
45
+ table: {
46
+ defaultValue: { summary: "70vh" },
47
+ },
48
+ },
49
+ },
50
+ };
51
+ export default meta;
52
+ export const Default = {
53
+ args: {
54
+ preset: "medium",
55
+ count: 7,
56
+ color: "rgba(160, 210, 255, 0.2)",
57
+ blur: 36,
58
+ length: "70vh",
59
+ },
60
+ };
61
+ export const Slow = {
62
+ args: {
63
+ preset: "slow",
64
+ count: 5,
65
+ },
66
+ parameters: {
67
+ docs: {
68
+ description: {
69
+ story: "Slow preset: Longer animation cycles (20s), subtle intensity (0.3), wider swing variation. Perfect for calm, ambient backgrounds.",
70
+ },
71
+ },
72
+ },
73
+ };
74
+ export const Medium = {
75
+ args: {
76
+ preset: "medium",
77
+ count: 7,
78
+ },
79
+ parameters: {
80
+ docs: {
81
+ description: {
82
+ story: "Medium preset: Balanced animation cycles (14s), moderate intensity (0.5). Suitable for most use cases.",
83
+ },
84
+ },
85
+ },
86
+ };
87
+ export const Fast = {
88
+ args: {
89
+ preset: "fast",
90
+ count: 9,
91
+ },
92
+ parameters: {
93
+ docs: {
94
+ description: {
95
+ story: "Fast preset: Quick animation cycles (8s), higher intensity (0.7), tighter swing variation. Creates a more dynamic, energetic feel.",
96
+ },
97
+ },
98
+ },
99
+ };
100
+ export const WarmColors = {
101
+ args: {
102
+ preset: "medium",
103
+ count: 7,
104
+ color: "rgba(255, 180, 120, 0.25)",
105
+ blur: 40,
106
+ },
107
+ parameters: {
108
+ docs: {
109
+ description: {
110
+ story: "LightRays with warm orange/amber color for a sunset-like atmosphere.",
111
+ },
112
+ },
113
+ },
114
+ };
115
+ export const CoolColors = {
116
+ args: {
117
+ preset: "slow",
118
+ count: 6,
119
+ color: "rgba(100, 200, 255, 0.3)",
120
+ blur: 48,
121
+ length: "80vh",
122
+ },
123
+ parameters: {
124
+ docs: {
125
+ description: {
126
+ story: "LightRays with cool blue color and extended length for a calm, oceanic effect.",
127
+ },
128
+ },
129
+ },
130
+ };
131
+ export const IntenseRays = {
132
+ args: {
133
+ preset: "fast",
134
+ count: 12,
135
+ color: "rgba(200, 220, 255, 0.35)",
136
+ blur: 24,
137
+ length: "90vh",
138
+ },
139
+ decorators: [
140
+ (Story) => (_jsx("div", { className: "relative h-screen w-full bg-black", children: _jsx(Story, {}) })),
141
+ ],
142
+ parameters: {
143
+ docs: {
144
+ description: {
145
+ story: "High intensity configuration with many rays, less blur, and longer length for dramatic effect.",
146
+ },
147
+ },
148
+ },
149
+ };
150
+ //# sourceMappingURL=light-rays.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"light-rays.story.js","sourceRoot":"","sources":["../../src/components/light-rays.story.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAC;AAE9D,MAAM,IAAI,GAAyB;IAC/B,KAAK,EAAE,uBAAuB;IAC9B,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE;QACR,MAAM,EAAE,YAAY;KACvB;IACD,UAAU,EAAE;QACR,CAAC,KAAK,EAAE,EAAE,CAAC,CACP,cAAK,SAAS,EAAC,sCAAsC,YACjD,KAAC,KAAK,KAAG,GACP,CACT;KACJ;IACD,QAAQ,EAAE;QACN,MAAM,EAAE;YACJ,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC;YACnC,WAAW,EAAE,uEAAuE;YACpF,KAAK,EAAE;gBACH,IAAI,EAAE,EAAE,OAAO,EAAE,4BAA4B,EAAE;aAClD;SACJ;QACD,KAAK,EAAE;YACH,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;YACpD,WAAW,EAAE,gCAAgC;YAC7C,KAAK,EAAE;gBACH,YAAY,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;aACjC;SACJ;QACD,KAAK,EAAE;YACH,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,2CAA2C;YACxD,KAAK,EAAE;gBACH,YAAY,EAAE,EAAE,OAAO,EAAE,0BAA0B,EAAE;aACxD;SACJ;QACD,IAAI,EAAE;YACF,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE;YACrD,WAAW,EAAE,uBAAuB;YACpC,KAAK,EAAE;gBACH,YAAY,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;aAClC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AAE;gBACT,KAAK,EAAE,sEAAsE;aAChF;SACJ;KACJ;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAU;IAC7B,IAAI,EAAE;QACF,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,0BAA0B;QACjC,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,MAAM;KACjB;IACD,UAAU,EAAE;QACR,IAAI,EAAE;YACF,WAAW,EAAE;gBACT,KAAK,EAAE,gFAAgF;aAC1F;SACJ;KACJ;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAU;IAC9B,IAAI,EAAE;QACF,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,2BAA2B;QAClC,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,MAAM;KACjB;IACD,UAAU,EAAE;QACR,CAAC,KAAK,EAAE,EAAE,CAAC,CACP,cAAK,SAAS,EAAC,mCAAmC,YAC9C,KAAC,KAAK,KAAG,GACP,CACT;KACJ;IACD,UAAU,EAAE;QACR,IAAI,EAAE;YACF,WAAW,EAAE;gBACT,KAAK,EAAE,gGAAgG;aAC1G;SACJ;KACJ;CACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type React from "react";
2
+ /**
3
+ * LiquidGlassBackground Component
4
+ *
5
+ * Provides a subtle animated background for the liquid glass theme.
6
+ * Features floating gradient orbs with gentle movements that showcase
7
+ * glassmorphism effects without being distracting.
8
+ */
9
+ export declare const LiquidGlassBackground: React.FC;
10
+ export default LiquidGlassBackground;
11
+ //# sourceMappingURL=liquid-glass-background.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"liquid-glass-background.d.ts","sourceRoot":"","sources":["../../src/components/liquid-glass-background.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAgGzC,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,79 @@
1
+ // Copyright (c) 2025 Amsterdam Data Labs
2
+ "use client";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { motion } from "motion/react";
5
+ import { useEffect, useState } from "react";
6
+ /**
7
+ * LiquidGlassBackground Component
8
+ *
9
+ * Provides a subtle animated background for the liquid glass theme.
10
+ * Features floating gradient orbs with gentle movements that showcase
11
+ * glassmorphism effects without being distracting.
12
+ */
13
+ export const LiquidGlassBackground = () => {
14
+ const [isDarkMode, setIsDarkMode] = useState(false);
15
+ useEffect(() => {
16
+ // Check for dark mode class on document element
17
+ const checkDarkMode = () => {
18
+ setIsDarkMode(document.documentElement.classList.contains("dark-mode"));
19
+ };
20
+ checkDarkMode();
21
+ // Watch for dark mode changes
22
+ const observer = new MutationObserver(checkDarkMode);
23
+ observer.observe(document.documentElement, {
24
+ attributes: true,
25
+ attributeFilter: ["class"],
26
+ });
27
+ return () => observer.disconnect();
28
+ }, []);
29
+ // Color gradients for light and dark modes
30
+ const lightModeColors = [
31
+ "rgba(0, 212, 255, 0.15)", // Bright cyan
32
+ "rgba(173, 230, 255, 0.12)", // Light cyan
33
+ "rgba(102, 178, 255, 0.1)", // Soft blue
34
+ "rgba(0, 153, 204, 0.08)", // Deeper cyan
35
+ ];
36
+ const darkModeColors = [
37
+ "rgba(0, 102, 255, 0.2)", // Deep blue
38
+ "rgba(51, 153, 255, 0.15)", // Bright blue
39
+ "rgba(102, 178, 255, 0.12)", // Light blue
40
+ "rgba(0, 51, 204, 0.1)", // Dark blue
41
+ ];
42
+ const colors = isDarkMode ? darkModeColors : lightModeColors;
43
+ // Check for reduced motion preference
44
+ const prefersReducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
45
+ // Animation variants - more pronounced movement for visible distortion
46
+ const orbVariants = {
47
+ animate: {
48
+ x: prefersReducedMotion ? 0 : [0, 100, -80, 60, -40, 0],
49
+ y: prefersReducedMotion ? 0 : [0, -80, 60, -50, 40, 0],
50
+ scale: prefersReducedMotion ? 1 : [1, 1.3, 0.8, 1.2, 0.9, 1],
51
+ },
52
+ };
53
+ const transition = {
54
+ duration: prefersReducedMotion ? 0 : 12,
55
+ repeat: Infinity,
56
+ ease: "easeInOut",
57
+ };
58
+ return (_jsxs("div", { className: "pointer-events-none fixed inset-0 -z-10 overflow-hidden", "aria-hidden": "true", children: [colors.map((color, index) => {
59
+ const size = 400 + index * 120;
60
+ const initialX = 10 + index * 30;
61
+ const initialY = 20 + index * 25;
62
+ return (_jsx(motion.div, { className: "absolute rounded-full blur-3xl", style: {
63
+ width: `${size}px`,
64
+ height: `${size}px`,
65
+ background: `radial-gradient(circle, ${color} 0%, transparent 70%)`,
66
+ left: `${initialX}%`,
67
+ top: `${initialY}%`,
68
+ }, variants: orbVariants, animate: "animate", transition: {
69
+ ...transition,
70
+ delay: index * 1.5,
71
+ } }, color));
72
+ }), _jsx("div", { className: "absolute inset-0 opacity-30", style: {
73
+ background: isDarkMode
74
+ ? "radial-gradient(circle at 50% 50%, rgba(0, 102, 255, 0.1) 0%, transparent 70%)"
75
+ : "radial-gradient(circle at 50% 50%, rgba(0, 212, 255, 0.08) 0%, transparent 70%)",
76
+ } })] }));
77
+ };
78
+ export default LiquidGlassBackground;
79
+ //# sourceMappingURL=liquid-glass-background.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"liquid-glass-background.js","sourceRoot":"","sources":["../../src/components/liquid-glass-background.tsx"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAa,GAAG,EAAE;IAChD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CA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AAK,EAAE,KAAK,GAAG,GAAG;qBACrB,IAdI,KAAK,CAeZ,CACL,CAAC;YACN,CAAC,CAAC,EAGF,cACI,SAAS,EAAC,6BAA6B,EACvC,KAAK,EAAE;oBACH,UAAU,EAAE,UAAU;wBAClB,CAAC,CAAC,gFAAgF;wBAClF,CAAC,CAAC,iFAAiF;iBAC1F,GACH,IACA,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @enact-ui/backgrounds
3
+ *
4
+ * Decorative background effects for ENACT UI.
5
+ * Purely cosmetic - can be removed without functional impact.
6
+ *
7
+ * Requires: @enact-ui/react (for cx utility)
8
+ * Requires: @enact-ui/animate (for motion presets)
9
+ * Requires: motion/react (for animations)
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ export { BackgroundPaths, type BackgroundPathsProps } from "./components/background-paths";
14
+ export { LightRays, type LightRaysProps } from "./components/light-rays";
15
+ export { LiquidGlassBackground } from "./components/liquid-glass-background";
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AAKH,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC"}