@solostylist/ui-kit 1.0.103 → 1.0.104
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/hooks/use-scroll-animation.d.ts +52 -0
- package/dist/hooks/use-scroll-animation.js +57 -0
- package/dist/main.d.ts +4 -0
- package/dist/main.js +68 -64
- package/dist/s-blur-text/index.d.ts +2 -0
- package/dist/s-blur-text/index.js +4 -0
- package/dist/s-blur-text/package.json +5 -0
- package/dist/s-blur-text/s-blur-text.d.ts +43 -0
- package/dist/s-blur-text/s-blur-text.js +80 -0
- package/dist/s-scroll-reveal/index.d.ts +2 -0
- package/dist/s-scroll-reveal/index.js +4 -0
- package/dist/s-scroll-reveal/package.json +6 -0
- package/dist/s-scroll-reveal/s-scroll-reveal.d.ts +56 -0
- package/dist/s-scroll-reveal/s-scroll-reveal.js +63 -0
- package/dist/s-typewriter-text/index.d.ts +2 -0
- package/dist/s-typewriter-text/index.js +4 -0
- package/dist/s-typewriter-text/package.json +6 -0
- package/dist/s-typewriter-text/s-typewriter-text.d.ts +12 -0
- package/dist/s-typewriter-text/s-typewriter-text.js +44 -0
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
interface UseScrollAnimationOptions {
|
|
2
|
+
threshold?: number;
|
|
3
|
+
rootMargin?: string;
|
|
4
|
+
delay?: number;
|
|
5
|
+
direction?: 'up' | 'down' | 'left' | 'right';
|
|
6
|
+
distance?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A React hook that provides scroll-triggered animation capabilities using Intersection Observer API.
|
|
10
|
+
*
|
|
11
|
+
* This hook monitors when an element enters the viewport and provides animation state and positioning
|
|
12
|
+
* data that can be used with CSS transitions, Framer Motion, or other animation libraries.
|
|
13
|
+
*
|
|
14
|
+
* @param options - Configuration options for the scroll animation
|
|
15
|
+
* @param options.threshold - A number between 0 and 1 indicating the percentage of the target that must be visible within the root element for the callback to be executed. Defaults to 0.1 (10%)
|
|
16
|
+
* @param options.rootMargin - Margin around the root element (similar to CSS margin). Defaults to '0px'
|
|
17
|
+
* @param options.delay - Delay in milliseconds before triggering the animation. Defaults to 0
|
|
18
|
+
* @param options.direction - The direction from which the element should animate in. Defaults to 'up'
|
|
19
|
+
* @param options.distance - The distance in pixels the element should animate from. Defaults to 50
|
|
20
|
+
*
|
|
21
|
+
* @returns An object containing:
|
|
22
|
+
* - ref: React ref to attach to the target element
|
|
23
|
+
* - isInView: Boolean indicating if the element is currently in view
|
|
24
|
+
* - initialPosition: Object with initial x/y coordinates and opacity for animation
|
|
25
|
+
* - finalPosition: Object with final x/y coordinates and opacity for animation
|
|
26
|
+
* - animate: Boolean indicating if animation should be triggered (same as isInView)
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
export declare function useScrollAnimation(options?: UseScrollAnimationOptions): {
|
|
30
|
+
ref: import('react').RefObject<HTMLElement | null>;
|
|
31
|
+
isInView: boolean;
|
|
32
|
+
initialPosition: {
|
|
33
|
+
y: number;
|
|
34
|
+
opacity: number;
|
|
35
|
+
x?: undefined;
|
|
36
|
+
} | {
|
|
37
|
+
x: number;
|
|
38
|
+
opacity: number;
|
|
39
|
+
y?: undefined;
|
|
40
|
+
};
|
|
41
|
+
finalPosition: {
|
|
42
|
+
y: number;
|
|
43
|
+
opacity: number;
|
|
44
|
+
x?: undefined;
|
|
45
|
+
} | {
|
|
46
|
+
x: number;
|
|
47
|
+
opacity: number;
|
|
48
|
+
y?: undefined;
|
|
49
|
+
};
|
|
50
|
+
animate: boolean;
|
|
51
|
+
};
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useState as m, useRef as f, useEffect as w } from "react";
|
|
2
|
+
function I(p = {}) {
|
|
3
|
+
const { threshold: o = 0.1, rootMargin: s = "0px", delay: i = 0, direction: a = "up", distance: t = 50 } = p, [l, r] = m(!1), c = f(null), e = f(null);
|
|
4
|
+
w(() => {
|
|
5
|
+
if (!c.current) return;
|
|
6
|
+
if (!("IntersectionObserver" in window)) {
|
|
7
|
+
r(!0);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const n = new IntersectionObserver(
|
|
11
|
+
([u]) => {
|
|
12
|
+
u.isIntersecting ? (e.current && (clearTimeout(e.current), e.current = null), i > 0 ? e.current = setTimeout(() => {
|
|
13
|
+
r(!0), n.unobserve(u.target);
|
|
14
|
+
}, i) : (r(!0), n.unobserve(u.target))) : (e.current && (clearTimeout(e.current), e.current = null), r(!1));
|
|
15
|
+
},
|
|
16
|
+
{ threshold: o, rootMargin: s }
|
|
17
|
+
);
|
|
18
|
+
return n.observe(c.current), () => {
|
|
19
|
+
e.current && (clearTimeout(e.current), e.current = null), n.disconnect();
|
|
20
|
+
};
|
|
21
|
+
}, [o, s, i]);
|
|
22
|
+
const y = () => {
|
|
23
|
+
switch (a) {
|
|
24
|
+
case "up":
|
|
25
|
+
return { y: t, opacity: 0 };
|
|
26
|
+
case "down":
|
|
27
|
+
return { y: -t, opacity: 0 };
|
|
28
|
+
case "left":
|
|
29
|
+
return { x: t, opacity: 0 };
|
|
30
|
+
case "right":
|
|
31
|
+
return { x: -t, opacity: 0 };
|
|
32
|
+
default:
|
|
33
|
+
return { y: t, opacity: 0 };
|
|
34
|
+
}
|
|
35
|
+
}, d = () => {
|
|
36
|
+
switch (a) {
|
|
37
|
+
case "up":
|
|
38
|
+
case "down":
|
|
39
|
+
return { y: 0, opacity: 1 };
|
|
40
|
+
case "left":
|
|
41
|
+
case "right":
|
|
42
|
+
return { x: 0, opacity: 1 };
|
|
43
|
+
default:
|
|
44
|
+
return { y: 0, opacity: 1 };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
ref: c,
|
|
49
|
+
isInView: l,
|
|
50
|
+
initialPosition: y(),
|
|
51
|
+
finalPosition: d(),
|
|
52
|
+
animate: l
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
I as useScrollAnimation
|
|
57
|
+
};
|
package/dist/main.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ export { default as SGlowButton } from './s-glow-button/index';
|
|
|
82
82
|
export type { SGlowButtonProps } from './s-glow-button/index';
|
|
83
83
|
export { default as SMovingBorder } from './s-moving-border/index';
|
|
84
84
|
export type { SMovingBorderProps } from './s-moving-border/index';
|
|
85
|
+
export { default as SScrollReveal } from './s-scroll-reveal/index';
|
|
86
|
+
export type { SScrollRevealProps } from './s-scroll-reveal/index';
|
|
85
87
|
export { default as SSpotlightCursor } from './s-spotlight-cursor/index';
|
|
86
88
|
export type { SSpotlightCursorProps, SpotlightConfig } from './s-spotlight-cursor/index';
|
|
87
89
|
export { default as SCopyableText } from './s-copyable-text/index';
|
|
@@ -105,5 +107,7 @@ export { STabs, STab, STabPanel } from './s-tabs/index';
|
|
|
105
107
|
export type { STabsProps, STabItem, STabProps, STabPanelProps } from './s-tabs/index';
|
|
106
108
|
export { default as STextShimmer } from './s-text-shimmer/index';
|
|
107
109
|
export type { STextShimmerProps } from './s-text-shimmer/index';
|
|
110
|
+
export { default as STypewriterText } from './s-typewriter-text/index';
|
|
111
|
+
export type { STypewriterTextProps } from './s-typewriter-text/index';
|
|
108
112
|
export * from './hooks';
|
|
109
113
|
export * from './utils';
|
package/dist/main.js
CHANGED
|
@@ -2,19 +2,19 @@ import { default as t } from "./s-accordion/s-accordion.js";
|
|
|
2
2
|
import { default as f } from "./s-autocomplete/s-autocomplete.js";
|
|
3
3
|
import { default as s } from "./s-avatar/s-avatar.js";
|
|
4
4
|
import { default as p } from "./s-button/s-button.js";
|
|
5
|
-
import { default as
|
|
6
|
-
import { default as
|
|
5
|
+
import { default as d } from "./s-button-link/s-button-link.js";
|
|
6
|
+
import { default as u } from "./s-carousel/s-carousel.js";
|
|
7
7
|
import { default as n } from "./s-chat-input/s-chat-input.js";
|
|
8
8
|
import { default as c } from "./s-chat-message/s-chat-message.js";
|
|
9
9
|
import { default as C } from "./s-text-editor/s-text-editor.js";
|
|
10
10
|
import "./s-text-editor/s-text-editor-toolbar.js";
|
|
11
|
-
import { default as
|
|
11
|
+
import { default as P } from "./s-checkbox/s-checkbox.js";
|
|
12
12
|
import { default as b } from "./s-chip/s-chip.js";
|
|
13
13
|
import { default as I } from "./s-chips/s-chips.js";
|
|
14
14
|
import { default as k } from "./s-data-table/s-data-table.js";
|
|
15
|
-
import { DialogConfirmProvider as
|
|
16
|
-
import { DialogMessageProvider as A, default as E, useDialogMessage as
|
|
17
|
-
import { default as
|
|
15
|
+
import { DialogConfirmProvider as L, default as F, useDialogConfirm as B } from "./s-dialog-confirm/s-dialog-confirm.js";
|
|
16
|
+
import { DialogMessageProvider as A, default as E, useDialogMessage as R } from "./s-dialog-message/s-dialog-message.js";
|
|
17
|
+
import { default as G } from "./s-error/s-error.js";
|
|
18
18
|
import { default as j } from "./s-empty/s-empty.js";
|
|
19
19
|
import { default as V } from "./s-dialog/s-dialog.js";
|
|
20
20
|
import { default as H } from "./s-file-dropzone/s-file-dropzone.js";
|
|
@@ -28,58 +28,60 @@ import { default as te } from "./s-text-field/s-text-field.js";
|
|
|
28
28
|
import { default as fe } from "./s-pagination/s-pagination.js";
|
|
29
29
|
import { default as se } from "./s-select/s-select.js";
|
|
30
30
|
import { default as pe } from "./s-skeleton/s-skeleton.js";
|
|
31
|
-
import { default as
|
|
32
|
-
import { default as
|
|
31
|
+
import { default as de } from "./s-tip/s-tip.js";
|
|
32
|
+
import { default as ue } from "./s-text-truncation/s-text-truncation.js";
|
|
33
33
|
import { default as ne, SnackbarMessageProvider as ge, useSnackbarMessage as ce } from "./s-snackbar-message/s-snackbar-message.js";
|
|
34
34
|
import { default as Ce } from "./s-form/s-form.js";
|
|
35
|
-
import { SSmartTextField as
|
|
35
|
+
import { SSmartTextField as Pe } from "./s-smart-text-field/s-smart-text-field.js";
|
|
36
36
|
import { SCopilotKitProvider as be } from "./s-copilot-kit-provider/s-copilot-kit-provider.js";
|
|
37
|
-
import { SStripeCVC as Ie, SStripeExpiry as he, SStripeNumber as ke, StripeTextField as
|
|
37
|
+
import { SStripeCVC as Ie, SStripeExpiry as he, SStripeNumber as ke, StripeTextField as ye } from "./s-stripe/s-stripe.js";
|
|
38
38
|
import { default as Fe } from "./s-theme-provider/s-theme-provider.js";
|
|
39
39
|
import { default as ze } from "./s-datetime-picker/s-datetime-picker.js";
|
|
40
40
|
import { default as Ee } from "./s-date-picker/s-date-picker.js";
|
|
41
|
-
import { default as
|
|
41
|
+
import { default as we } from "./s-localization-provider/s-localization-provider.js";
|
|
42
42
|
import { default as Ne } from "./s-gradient-icon/s-gradient-icon.js";
|
|
43
43
|
import { default as Ke } from "./s-glow-button/s-glow-button.js";
|
|
44
44
|
import { default as qe } from "./s-moving-border/s-moving-border.js";
|
|
45
|
-
import { default as Je } from "./s-
|
|
46
|
-
import { default as Qe } from "./s-
|
|
47
|
-
import {
|
|
48
|
-
import { default as Ze } from "./s-
|
|
49
|
-
import { default as $e } from "./s-
|
|
50
|
-
import { default as oo } from "./s-image
|
|
51
|
-
import { default as to } from "./s-
|
|
52
|
-
import { default as fo } from "./s-
|
|
53
|
-
import { default as so } from "./s-
|
|
54
|
-
import { default as po } from "./s-
|
|
55
|
-
import { default as
|
|
56
|
-
import { default as io } from "./s-tabs/s-tab
|
|
57
|
-
import { default as go } from "./s-
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
45
|
+
import { default as Je } from "./s-scroll-reveal/s-scroll-reveal.js";
|
|
46
|
+
import { default as Qe } from "./s-spotlight-cursor/s-spotlight-cursor.js";
|
|
47
|
+
import { default as We } from "./s-copyable-text/s-copyable-text.js";
|
|
48
|
+
import { MediaItem as Ye, default as Ze } from "./s-interactive-gallery/s-interactive-gallery.js";
|
|
49
|
+
import { default as $e } from "./s-image-modal/s-image-modal.js";
|
|
50
|
+
import { default as oo } from "./s-lazy-image/s-lazy-image.js";
|
|
51
|
+
import { default as to } from "./s-image-comparison/s-image-comparison.js";
|
|
52
|
+
import { default as fo } from "./s-radial-pulse-animate/s-radial-pulse-animate.js";
|
|
53
|
+
import { default as so } from "./s-rating/s-rating.js";
|
|
54
|
+
import { default as po } from "./s-review/s-review.js";
|
|
55
|
+
import { default as xo } from "./s-tabs/s-tabs.js";
|
|
56
|
+
import { default as io } from "./s-tabs/s-tab.js";
|
|
57
|
+
import { default as go } from "./s-tabs/s-tab-panel.js";
|
|
58
|
+
import { default as To } from "./s-text-shimmer/s-text-shimmer.js";
|
|
59
|
+
import { default as vo } from "./s-typewriter-text/s-typewriter-text.js";
|
|
60
|
+
import { useDialog as Do } from "./hooks/use-dialog.js";
|
|
61
|
+
import { usePopover as Mo } from "./hooks/use-popover.js";
|
|
62
|
+
import { formatDatePosted as ho } from "./utils/dayjs.js";
|
|
63
|
+
import { bytesToSize as yo } from "./utils/bytes-to-size.js";
|
|
64
|
+
import { LogLevel as Fo, Logger as Bo, createLogger as zo, logger as Ao } from "./utils/logger.js";
|
|
65
|
+
import { default as Ro } from "dayjs";
|
|
64
66
|
export {
|
|
65
|
-
|
|
67
|
+
L as DialogConfirmProvider,
|
|
66
68
|
A as DialogMessageProvider,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
Fo as LogLevel,
|
|
70
|
+
Bo as Logger,
|
|
71
|
+
Ye as MediaItem,
|
|
70
72
|
t as SAccordion,
|
|
71
73
|
f as SAutocomplete,
|
|
72
74
|
s as SAvatar,
|
|
73
75
|
p as SButton,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
d as SButtonLink,
|
|
77
|
+
u as SCarousel,
|
|
76
78
|
n as SChatInput,
|
|
77
79
|
c as SChatMessage,
|
|
78
|
-
|
|
80
|
+
P as SCheckbox,
|
|
79
81
|
b as SChip,
|
|
80
82
|
I as SChips,
|
|
81
83
|
be as SCopilotKitProvider,
|
|
82
|
-
|
|
84
|
+
We as SCopyableText,
|
|
83
85
|
k as SDataTable,
|
|
84
86
|
Ee as SDatePicker,
|
|
85
87
|
ze as SDateTimePicker,
|
|
@@ -87,7 +89,7 @@ export {
|
|
|
87
89
|
F as SDialogConfirm,
|
|
88
90
|
E as SDialogMessage,
|
|
89
91
|
j as SEmpty,
|
|
90
|
-
|
|
92
|
+
G as SError,
|
|
91
93
|
H as SFileDropzone,
|
|
92
94
|
O as SFileIcon,
|
|
93
95
|
Ce as SForm,
|
|
@@ -95,46 +97,48 @@ export {
|
|
|
95
97
|
Ne as SGradientIcon,
|
|
96
98
|
U as SI18nProvider,
|
|
97
99
|
X as SIconButton,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
to as SImageComparison,
|
|
101
|
+
$e as SImageModal,
|
|
102
|
+
Ze as SInteractiveGallery,
|
|
101
103
|
Z as SLabel,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
oo as SLazyImage,
|
|
105
|
+
we as SLocalizationProvider,
|
|
104
106
|
qe as SMovingBorder,
|
|
105
107
|
$ as SMultiSelect,
|
|
106
108
|
oe as SNoSsr,
|
|
107
109
|
fe as SPagination,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
fo as SRadialPulseAnimate,
|
|
111
|
+
so as SRating,
|
|
112
|
+
po as SReview,
|
|
113
|
+
Je as SScrollReveal,
|
|
111
114
|
se as SSelect,
|
|
112
115
|
pe as SSkeleton,
|
|
113
|
-
|
|
116
|
+
Pe as SSmartTextField,
|
|
114
117
|
ne as SSnackbarMessage,
|
|
115
|
-
|
|
118
|
+
Qe as SSpotlightCursor,
|
|
116
119
|
Ie as SStripeCVC,
|
|
117
120
|
he as SStripeExpiry,
|
|
118
121
|
ke as SStripeNumber,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
io as STab,
|
|
123
|
+
go as STabPanel,
|
|
124
|
+
xo as STabs,
|
|
122
125
|
C as STextEditor,
|
|
123
126
|
te as STextField,
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
To as STextShimmer,
|
|
128
|
+
ue as STextTruncation,
|
|
126
129
|
Fe as SThemeProvider,
|
|
127
|
-
|
|
130
|
+
de as STip,
|
|
131
|
+
vo as STypewriterText,
|
|
128
132
|
ge as SnackbarMessageProvider,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
ye as StripeTextField,
|
|
134
|
+
yo as bytesToSize,
|
|
135
|
+
zo as createLogger,
|
|
136
|
+
Ro as dayjs,
|
|
137
|
+
ho as formatDatePosted,
|
|
138
|
+
Ao as logger,
|
|
139
|
+
Do as useDialog,
|
|
136
140
|
B as useDialogConfirm,
|
|
137
|
-
|
|
138
|
-
|
|
141
|
+
R as useDialogMessage,
|
|
142
|
+
Mo as usePopover,
|
|
139
143
|
ce as useSnackbarMessage
|
|
140
144
|
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TypographyProps } from '@mui/material';
|
|
3
|
+
export interface SBlurTextProps extends Omit<TypographyProps, 'children'> {
|
|
4
|
+
/** The text content to animate */
|
|
5
|
+
text: string;
|
|
6
|
+
/** Delay between animating each segment in milliseconds */
|
|
7
|
+
delay?: number;
|
|
8
|
+
/** Animation granularity - animate by words or individual letters */
|
|
9
|
+
animateBy?: 'words' | 'letters';
|
|
10
|
+
/** Direction of the blur animation */
|
|
11
|
+
direction?: 'top' | 'bottom';
|
|
12
|
+
/** Intersection observer threshold for triggering animation */
|
|
13
|
+
threshold?: number;
|
|
14
|
+
/** Intersection observer root margin */
|
|
15
|
+
rootMargin?: string;
|
|
16
|
+
/** Custom starting animation state */
|
|
17
|
+
animationFrom?: Record<string, string | number>;
|
|
18
|
+
/** Custom ending animation states (array for multi-step animations) */
|
|
19
|
+
animationTo?: Array<Record<string, string | number>>;
|
|
20
|
+
/** Custom easing function for animation timing */
|
|
21
|
+
easing?: (t: number) => number;
|
|
22
|
+
/** Callback fired when animation completes */
|
|
23
|
+
onAnimationComplete?: () => void;
|
|
24
|
+
/** Duration of each animation step in seconds */
|
|
25
|
+
stepDuration?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A Typography component that animates text with a blur effect when it comes into view.
|
|
29
|
+
* Supports word-by-word or letter-by-letter animation with customizable timing and effects.
|
|
30
|
+
* Built on MUI Typography with full styling support.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <SBlurText
|
|
35
|
+
* text="Hello world, this text will blur in"
|
|
36
|
+
* variant="h1"
|
|
37
|
+
* animateBy="words"
|
|
38
|
+
* delay={150}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
declare const SBlurText: React.FC<SBlurTextProps>;
|
|
43
|
+
export default SBlurText;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { j as y } from "../jsx-runtime-DywqP_6a.js";
|
|
2
|
+
import { useState as R, useRef as V, useEffect as D, useMemo as b } from "react";
|
|
3
|
+
import { Typography as F } from "@mui/material";
|
|
4
|
+
import { motion as M } from "framer-motion";
|
|
5
|
+
const _ = (s, a) => {
|
|
6
|
+
const i = /* @__PURE__ */ new Set([...Object.keys(s), ...a.flatMap((t) => Object.keys(t))]), o = {};
|
|
7
|
+
return i.forEach((t) => {
|
|
8
|
+
o[t] = [s[t], ...a.map((l) => l[t])];
|
|
9
|
+
}), o;
|
|
10
|
+
}, H = ({
|
|
11
|
+
text: s,
|
|
12
|
+
delay: a = 100,
|
|
13
|
+
animateBy: i = "words",
|
|
14
|
+
direction: o = "top",
|
|
15
|
+
threshold: t = 0.1,
|
|
16
|
+
rootMargin: l = "0px",
|
|
17
|
+
animationFrom: h,
|
|
18
|
+
animationTo: d,
|
|
19
|
+
easing: w = (n) => n,
|
|
20
|
+
onAnimationComplete: x,
|
|
21
|
+
stepDuration: j = 0.35,
|
|
22
|
+
variant: g = "body1",
|
|
23
|
+
component: v = "p",
|
|
24
|
+
sx: S,
|
|
25
|
+
...T
|
|
26
|
+
}) => {
|
|
27
|
+
const n = i === "words" ? s.split(" ") : s.split(""), [k, C] = R(!1), c = V(null);
|
|
28
|
+
D(() => {
|
|
29
|
+
if (!c.current) return;
|
|
30
|
+
const r = new IntersectionObserver(
|
|
31
|
+
([e]) => {
|
|
32
|
+
e.isIntersecting && (C(!0), r.unobserve(c.current));
|
|
33
|
+
},
|
|
34
|
+
{ threshold: t, rootMargin: l }
|
|
35
|
+
);
|
|
36
|
+
return r.observe(c.current), () => r.disconnect();
|
|
37
|
+
}, [t, l]);
|
|
38
|
+
const E = b(
|
|
39
|
+
() => o === "top" ? { filter: "blur(10px)", opacity: 0, y: -50 } : { filter: "blur(10px)", opacity: 0, y: 50 },
|
|
40
|
+
[o]
|
|
41
|
+
), I = b(
|
|
42
|
+
() => [
|
|
43
|
+
{
|
|
44
|
+
filter: "blur(5px)",
|
|
45
|
+
opacity: 0.5,
|
|
46
|
+
y: o === "top" ? 5 : -5
|
|
47
|
+
},
|
|
48
|
+
{ filter: "blur(0px)", opacity: 1, y: 0 }
|
|
49
|
+
],
|
|
50
|
+
[o]
|
|
51
|
+
), u = h ?? E, f = d ?? I, p = f.length + 1, O = j * (p - 1), A = Array.from({ length: p }, (r, e) => p === 1 ? 0 : e / (p - 1));
|
|
52
|
+
return /* @__PURE__ */ y.jsx(F, { ref: c, variant: g, component: v, sx: S, ...T, children: n.map((r, e) => {
|
|
53
|
+
const K = _(u, f), m = {
|
|
54
|
+
duration: O,
|
|
55
|
+
times: A,
|
|
56
|
+
delay: e * a / 1e3
|
|
57
|
+
};
|
|
58
|
+
return m.ease = w, /* @__PURE__ */ y.jsxs(
|
|
59
|
+
M.span,
|
|
60
|
+
{
|
|
61
|
+
initial: u,
|
|
62
|
+
animate: k ? K : u,
|
|
63
|
+
transition: m,
|
|
64
|
+
onAnimationComplete: e === n.length - 1 ? x : void 0,
|
|
65
|
+
style: {
|
|
66
|
+
display: "inline-block",
|
|
67
|
+
willChange: "transform, filter, opacity"
|
|
68
|
+
},
|
|
69
|
+
children: [
|
|
70
|
+
r === " " ? " " : r,
|
|
71
|
+
i === "words" && e < n.length - 1 && " "
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
e
|
|
75
|
+
);
|
|
76
|
+
}) });
|
|
77
|
+
};
|
|
78
|
+
export {
|
|
79
|
+
H as default
|
|
80
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BoxProps } from '@mui/material';
|
|
3
|
+
import { Easing } from 'framer-motion';
|
|
4
|
+
export interface SScrollRevealProps extends Omit<BoxProps, 'children'> {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
duration?: number;
|
|
7
|
+
ease?: Easing;
|
|
8
|
+
threshold?: number;
|
|
9
|
+
rootMargin?: string;
|
|
10
|
+
delay?: number;
|
|
11
|
+
direction?: 'up' | 'down' | 'left' | 'right';
|
|
12
|
+
distance?: number;
|
|
13
|
+
scale?: boolean;
|
|
14
|
+
rotate?: boolean;
|
|
15
|
+
stagger?: boolean;
|
|
16
|
+
staggerDelay?: number;
|
|
17
|
+
}
|
|
18
|
+
declare const SScrollReveal: React.FC<SScrollRevealProps>;
|
|
19
|
+
/**
|
|
20
|
+
* SScrollReveal - A container component that reveals its children with smooth animations when they enter the viewport
|
|
21
|
+
*
|
|
22
|
+
* This component uses the Intersection Observer API to detect when elements come into view and applies
|
|
23
|
+
* customizable animation effects including directional movement, scaling, rotation, and staggered animations.
|
|
24
|
+
* Built on MUI Box with full styling support and optimized for performance.
|
|
25
|
+
*
|
|
26
|
+
* Key features:
|
|
27
|
+
* - Scroll-triggered animations with customizable timing
|
|
28
|
+
* - Support for multiple animation directions (up, down, left, right)
|
|
29
|
+
* - Optional scaling and rotation effects
|
|
30
|
+
* - Staggered animations for multiple children
|
|
31
|
+
* - Full MUI Box props support for styling
|
|
32
|
+
* - Performance-optimized with Intersection Observer
|
|
33
|
+
* - Responsive and accessible
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <SScrollReveal direction="up" duration={0.8} stagger={true}>
|
|
38
|
+
* <Typography>This text will slide up</Typography>
|
|
39
|
+
* <Button>This button will follow</Button>
|
|
40
|
+
* </SScrollReveal>
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* <SScrollReveal
|
|
46
|
+
* direction="left"
|
|
47
|
+
* distance={100}
|
|
48
|
+
* scale={false}
|
|
49
|
+
* delay={200}
|
|
50
|
+
* sx={{ padding: 2 }}
|
|
51
|
+
* >
|
|
52
|
+
* <Card>Slides in from the left</Card>
|
|
53
|
+
* </SScrollReveal>
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export default SScrollReveal;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { j as o } from "../jsx-runtime-DywqP_6a.js";
|
|
2
|
+
import B from "react";
|
|
3
|
+
import { Box as e } from "@mui/material";
|
|
4
|
+
import { motion as p } from "framer-motion";
|
|
5
|
+
import { useScrollAnimation as E } from "../hooks/use-scroll-animation.js";
|
|
6
|
+
const F = ({
|
|
7
|
+
children: a,
|
|
8
|
+
duration: h = 0.6,
|
|
9
|
+
ease: v = "easeOut",
|
|
10
|
+
threshold: u,
|
|
11
|
+
rootMargin: x,
|
|
12
|
+
delay: t,
|
|
13
|
+
direction: j,
|
|
14
|
+
distance: R,
|
|
15
|
+
scale: s = !0,
|
|
16
|
+
rotate: r = !1,
|
|
17
|
+
stagger: i = !0,
|
|
18
|
+
staggerDelay: S = 0.1,
|
|
19
|
+
sx: b,
|
|
20
|
+
...y
|
|
21
|
+
}) => {
|
|
22
|
+
const { ref: C, animate: A, initialPosition: l, finalPosition: c } = E({
|
|
23
|
+
threshold: u,
|
|
24
|
+
rootMargin: x,
|
|
25
|
+
delay: t,
|
|
26
|
+
direction: j,
|
|
27
|
+
distance: R
|
|
28
|
+
}), m = s ? { ...l, scale: 0.85 } : l, d = s ? { ...c, scale: 1 } : c, n = r ? { ...m, rotate: -2 } : m, f = r ? { ...d, rotate: 0 } : d, P = {
|
|
29
|
+
hidden: { opacity: 0 },
|
|
30
|
+
visible: {
|
|
31
|
+
opacity: 1,
|
|
32
|
+
transition: {
|
|
33
|
+
staggerChildren: i ? S : 0,
|
|
34
|
+
delayChildren: t ? t / 1e3 : 0
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}, V = {
|
|
38
|
+
hidden: n,
|
|
39
|
+
visible: f
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ o.jsx(e, { sx: { overflow: "hidden", ...b }, ...y, children: /* @__PURE__ */ o.jsx(
|
|
42
|
+
e,
|
|
43
|
+
{
|
|
44
|
+
component: p.div,
|
|
45
|
+
ref: C,
|
|
46
|
+
variants: i ? P : void 0,
|
|
47
|
+
initial: i ? "hidden" : n,
|
|
48
|
+
animate: A ? i ? "visible" : f : i ? "hidden" : n,
|
|
49
|
+
transition: {
|
|
50
|
+
duration: h,
|
|
51
|
+
ease: v,
|
|
52
|
+
type: "spring",
|
|
53
|
+
stiffness: 80,
|
|
54
|
+
damping: 20,
|
|
55
|
+
mass: 0.8
|
|
56
|
+
},
|
|
57
|
+
children: i ? B.Children.toArray(a).map((_, w) => /* @__PURE__ */ o.jsx(e, { component: p.div, variants: V, children: _ }, w)) : a
|
|
58
|
+
}
|
|
59
|
+
) });
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
F as default
|
|
63
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TypographyProps } from '@mui/material';
|
|
2
|
+
export interface STypewriterTextProps extends Omit<TypographyProps, 'children'> {
|
|
3
|
+
text: string | string[];
|
|
4
|
+
speed?: number;
|
|
5
|
+
cursor?: string;
|
|
6
|
+
cursorBlinking?: boolean;
|
|
7
|
+
loop?: boolean;
|
|
8
|
+
deleteSpeed?: number;
|
|
9
|
+
delay?: number;
|
|
10
|
+
}
|
|
11
|
+
declare function STypewriterText({ text, speed, cursor, cursorBlinking, loop, deleteSpeed, delay, ...typographyProps }: STypewriterTextProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default STypewriterText;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { j as y } from "../jsx-runtime-DywqP_6a.js";
|
|
2
|
+
import { useState as n, useEffect as j } from "react";
|
|
3
|
+
import { Typography as k, Box as D } from "@mui/material";
|
|
4
|
+
function B({
|
|
5
|
+
text: r,
|
|
6
|
+
speed: c = 100,
|
|
7
|
+
cursor: T = "|",
|
|
8
|
+
cursorBlinking: g = !0,
|
|
9
|
+
loop: l = !1,
|
|
10
|
+
deleteSpeed: f = 50,
|
|
11
|
+
delay: u = 1500,
|
|
12
|
+
...h
|
|
13
|
+
}) {
|
|
14
|
+
const [s, x] = n(""), [i, m] = n(0), [o, p] = n(!1), [A, I] = n(0), a = Array.isArray(r) ? r : [r], t = a[A] || "";
|
|
15
|
+
return j(() => {
|
|
16
|
+
if (!t) return;
|
|
17
|
+
const d = setTimeout(
|
|
18
|
+
() => {
|
|
19
|
+
o ? s.length > 0 ? x((e) => e.slice(0, -1)) : (p(!1), m(0), I((e) => (e + 1) % a.length)) : i < t.length ? (x((e) => e + t[i]), m((e) => e + 1)) : l && setTimeout(() => p(!0), u);
|
|
20
|
+
},
|
|
21
|
+
o ? f : c
|
|
22
|
+
);
|
|
23
|
+
return () => clearTimeout(d);
|
|
24
|
+
}, [i, o, t, l, c, f, u, s, a.length]), /* @__PURE__ */ y.jsxs(k, { component: "span", ...h, children: [
|
|
25
|
+
s,
|
|
26
|
+
/* @__PURE__ */ y.jsx(
|
|
27
|
+
D,
|
|
28
|
+
{
|
|
29
|
+
component: "span",
|
|
30
|
+
sx: {
|
|
31
|
+
animation: g ? "blink 1s infinite" : "none",
|
|
32
|
+
"@keyframes blink": {
|
|
33
|
+
"0%, 50%": { opacity: 1 },
|
|
34
|
+
"51%, 100%": { opacity: 0 }
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
children: T
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
] });
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
B as default
|
|
44
|
+
};
|