@yamatozhen/design_system 1.0.1 → 1.1.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.
- package/LICENSE +201 -201
- package/README.md +101 -101
- package/package.json +50 -50
- package/scripts/postinstall.js +91 -91
- package/template/app/ClientNav.tsx +258 -310
- package/template/app/globals.css +2 -167
- package/template/app/layout.tsx +94 -82
- package/template/app/themes/dark-mc 2.css +51 -0
- package/template/app/themes/dark-mc.css +51 -51
- package/template/app/themes/dark.css +51 -51
- package/template/app/themes/light 2.css +51 -0
- package/template/app/themes/light-mc 2.css +51 -0
- package/template/app/themes/light-mc.css +51 -51
- package/template/app/themes/light.css +51 -51
- package/template/app/themes/theme 2.css +272 -0
- package/template/app/themes/theme.css +272 -82
- package/template/components/{layout/button → (buttons)}/Button.module.css +351 -305
- package/template/components/{layout/button → (buttons)}/ButtonGroup.tsx +414 -503
- package/template/components/{layout/button → (buttons)}/FAB.tsx +119 -118
- package/template/components/(buttons)/button.tsx +164 -0
- package/template/components/(controls)/slider/Slider.module.css +250 -0
- package/template/components/(controls)/slider/Slider.tsx +386 -0
- package/template/components/(controls)/switch/Switch.module.css +108 -0
- package/template/components/(controls)/switch/Switch.tsx +69 -0
- package/template/components/(date & time)/calendar/Calendar.module.css +125 -0
- package/template/components/(date & time)/calendar/Calendar.tsx +206 -0
- package/template/components/(date & time)/dateField/DateField.module.css +25 -0
- package/template/components/(date & time)/dateField/DateField.tsx +193 -0
- package/template/components/(date & time)/datePicker/DatePicker.tsx +118 -0
- package/template/components/(date & time)/dateRangePicker/DateRangePicker.tsx +144 -0
- package/template/components/(date & time)/rangeCalendar/RangeCalendar.module.css +203 -0
- package/template/components/(date & time)/rangeCalendar/RangeCalendar.tsx +263 -0
- package/template/components/(date & time)/shared/dateUtils.ts +107 -0
- package/template/components/(date & time)/timeField/TimeField.module.css +39 -0
- package/template/components/(date & time)/timeField/TimeField.tsx +158 -0
- package/template/components/(feedback)/circularProgress/CircularProgress.tsx +646 -0
- package/template/components/(feedback)/linearProgress/LinearProgress.tsx +337 -0
- package/template/components/(feedback)/meter/Meter.tsx +111 -0
- package/template/components/(feedback)/skeleton/Skeleton.module.css +49 -0
- package/template/components/(feedback)/skeleton/Skeleton.tsx +32 -0
- package/template/components/(feedback)/spinner/Spinner.module.css +27 -0
- package/template/components/(feedback)/spinner/Spinner.tsx +60 -0
- package/template/components/(forms)/checkbox/Checkbox.tsx +121 -0
- package/template/components/(forms)/checkboxGroup/CheckboxGroup.tsx +83 -0
- package/template/components/(forms)/description/Description.tsx +34 -0
- package/template/components/(forms)/errorMessage/ErrorMessage.tsx +31 -0
- package/template/components/(forms)/fieldError/FieldError.tsx +39 -0
- package/template/components/(forms)/fieldset/Fieldset.tsx +51 -0
- package/template/components/(forms)/form/Form.tsx +54 -0
- package/template/components/(forms)/input/Input.tsx +50 -0
- package/template/components/(forms)/inputGroup/InputGroup.tsx +65 -0
- package/template/components/(forms)/inputOtp/InputOtp.tsx +139 -0
- package/template/components/(forms)/label/Label.tsx +46 -0
- package/template/components/(forms)/numberField/NumberField.tsx +292 -0
- package/template/components/(forms)/radioGroup/RadioGroup.tsx +175 -0
- package/template/components/(forms)/searchField/SearchField.tsx +139 -0
- package/template/components/(forms)/shared/field.module.css +75 -0
- package/template/components/(forms)/shared/fieldContext.ts +28 -0
- package/template/components/(forms)/textArea/TextArea.tsx +55 -0
- package/template/components/(forms)/textField/TextField.tsx +91 -0
- package/template/components/{layout → (layout)}/Lightbox/LightboxCard.tsx +100 -100
- package/template/components/{layout → (layout)}/Lightbox/LightboxGallery.module.css +249 -249
- package/template/components/{layout → (layout)}/Lightbox/LightboxGallery.tsx +72 -72
- package/template/components/{layout → (layout)}/Lightbox/LightboxGrid.tsx +185 -186
- package/template/components/{layout → (layout)}/Lightbox/LightboxModal.module.css +395 -395
- package/template/components/{layout → (layout)}/Lightbox/LightboxModal.tsx +498 -500
- package/template/components/{layout → (layout)}/Lightbox/demo.tsx +396 -412
- package/template/components/{layout → (layout)}/Lightbox/index.ts +30 -30
- package/template/components/{layout → (layout)}/Lightbox/types.ts +101 -113
- package/template/components/{layout → (layout)}/Lightbox/useLightboxFilters.ts +140 -140
- package/template/components/(layout)/accordion/Accordion.module.css +108 -0
- package/template/components/(layout)/accordion/Accordion.tsx +251 -0
- package/template/components/(layout)/card/Card.module.css +136 -0
- package/template/components/(layout)/card/Card.tsx +371 -0
- package/template/components/(layout)/list/List.module.css +83 -0
- package/template/components/(layout)/list/List.tsx +332 -0
- package/template/components/{layout → (layout)}/navigation/Wrap.tsx +41 -41
- package/template/components/(layout)/navigation/breadcrumbs/Breadcrumbs.tsx +145 -0
- package/template/components/{layout/navigation/nav/Nav.module.css → (layout)/navigation/nav/Nav.module.css.old} +474 -508
- package/template/components/{layout → (layout)}/navigation/nav/Nav.tsx +186 -167
- package/template/components/{layout → (layout)}/navigation/nav/NavBar.tsx +396 -419
- package/template/components/{layout → (layout)}/navigation/nav/NavContext.tsx +259 -259
- package/template/components/{layout → (layout)}/navigation/nav/NavItem.tsx +195 -173
- package/template/components/{layout → (layout)}/navigation/nav/NavNew.module.css +406 -373
- package/template/components/{layout → (layout)}/navigation/nav/NavRail.tsx +317 -315
- package/template/components/{layout → (layout)}/navigation/nav/NavSection.tsx +101 -102
- package/template/components/{layout → (layout)}/navigation/nav/NavTab.tsx +25 -25
- package/template/components/{layout → (layout)}/navigation/nav/navftb/NavFTB.module.css +253 -252
- package/template/components/{layout → (layout)}/navigation/nav/navftb/NavFTB.tsx +448 -399
- package/template/components/{layout → (layout)}/navigation/nav/navftb/useTabIndicator.ts +498 -484
- package/template/components/{layout → (layout)}/navigation/nav/navheader/NavHeader.module.css +59 -59
- package/template/components/{layout → (layout)}/navigation/nav/navheader/NavHeader.tsx +465 -473
- package/template/components/(layout)/navigation/pagination/Pagination.tsx +261 -0
- package/template/components/{layout → (layout)}/pages/loadingScreen.tsx +117 -102
- package/template/components/{layout → (layout)}/pages/maintenance/Maintenance.tsx +52 -52
- package/template/components/{layout → (layout)}/pages/maintenance/maintenance.module.css +162 -162
- package/template/components/(layout)/scrollShadow/ScrollShadow.module.css +81 -0
- package/template/components/(layout)/scrollShadow/ScrollShadow.tsx +161 -0
- package/template/components/(layout)/scrollShadow/useScrollShadow.ts +130 -0
- package/template/components/(layout)/separator/Separator.tsx +112 -0
- package/template/components/(overlays)/accessibilityModal/AccessibilityModal.tsx +307 -0
- package/template/components/(overlays)/drawer/Drawer.tsx +953 -0
- package/template/components/(overlays)/modal/Modal.tsx +654 -0
- package/template/components/(overlays)/popover/Popover.tsx +420 -0
- package/template/components/(overlays)/toast/Toast.tsx +692 -0
- package/template/components/(pickers)/autocomplete/Autocomplete.tsx +24 -0
- package/template/components/(pickers)/comboBox/ComboBox.tsx +21 -0
- package/template/components/(pickers)/select/Select.tsx +188 -0
- package/template/components/(pickers)/shared/FilterableField.tsx +223 -0
- package/template/components/(pickers)/shared/PickerItem.ts +13 -0
- package/template/components/tools/CustomScrollbar 2.tsx +107 -0
- package/template/components/tools/CustomScrollbar.tsx +107 -0
- package/template/components/tools/Divider 2.tsx +11 -0
- package/template/components/tools/Divider.tsx +11 -11
- package/template/components/tools/ReduceMotionContext 2.tsx +5 -0
- package/template/components/tools/ReduceMotionContext.tsx +5 -5
- package/template/components/tools/Sinewave 2.tsx +206 -0
- package/template/components/tools/Sinewave.tsx +396 -199
- package/template/components/tools/SinewaveProgress 2.tsx +140 -0
- package/template/components/tools/SinewaveProgress.tsx +140 -135
- package/template/components/tools/badge/Badge 2.tsx +28 -0
- package/template/components/tools/badge/Badge.tsx +28 -28
- package/template/components/tools/dropdown/drop.module.css +196 -0
- package/template/components/tools/dropdown/drop.tsx +568 -0
- package/template/components/tools/easing.ts +118 -0
- package/template/components/tools/flubber.d 2.ts +7 -0
- package/template/components/tools/flubber.d.ts +6 -6
- package/template/components/tools/footer/Footer.tsx +20 -0
- package/template/components/tools/input/Input 2.tsx +99 -0
- package/template/components/tools/input/Input.module 2.css +45 -0
- package/template/components/tools/input/Input.module.css +45 -0
- package/template/components/tools/input/Input.tsx +99 -0
- package/template/components/tools/label/Icon 2.tsx +39 -0
- package/template/components/tools/label/Icon.tsx +39 -0
- package/template/components/tools/label/Label 2.tsx +150 -0
- package/template/components/tools/label/Label.tsx +156 -0
- package/template/components/tools/mobileViewProvider 2.tsx +53 -0
- package/template/components/tools/mobileViewProvider.tsx +53 -58
- package/template/components/tools/ripple/ripple 2.css +38 -0
- package/template/components/tools/ripple/ripple 2.tsx +78 -0
- package/template/components/tools/ripple/ripple.css +38 -41
- package/template/components/tools/ripple/ripple.tsx +78 -53
- package/template/components/tools/shape/{ShapeMorph.tsx → Shape 2.tsx } +313 -190
- package/template/components/tools/shape/Shape.module 2.css +21 -0
- package/template/components/tools/shape/Shape.module.css +25 -0
- package/template/components/tools/shape/Shape.tsx +316 -0
- package/template/components/tools/shape/ShapeLoader 2.tsx +104 -0
- package/template/components/tools/shape/ShapeLoader.tsx +104 -101
- package/template/components/tools/shape/ShapePaths 2.ts +116 -0
- package/template/components/tools/shape/ShapePaths.ts +116 -116
- package/template/components/{layout/switch/Switch.tsx → tools/switch/Switch 2.tsx } +48 -48
- package/template/components/{layout/switch/Switch.module.css → tools/switch/Switch.module 2.css } +102 -102
- package/template/components/tools/switch/Switch.module.css +102 -102
- package/template/components/tools/switch/Switch.tsx +48 -48
- package/template/components/tools/useBodyScrollLock 2.tsx +27 -0
- package/template/components/tools/useBodyScrollLock.tsx +27 -27
- package/template/components/tools/useImageColor 2.ts +47 -0
- package/template/components/tools/useImageColor.ts +47 -47
- package/template/components/tools/useNavSheetDrag 2.tsx +196 -0
- package/template/components/tools/useNavSheetDrag.tsx +196 -196
- package/template/public/fonts/material-symbols/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght 2.woff2 +0 -0
- package/template/components/layout/accordion/Accordion.module.css +0 -149
- package/template/components/layout/accordion/Accordion.tsx +0 -114
- package/template/components/layout/button/button.tsx +0 -128
- package/template/components/layout/button/drop.module.css +0 -229
- package/template/components/layout/button/drop.tsx +0 -516
- package/template/components/layout/hero/v1/heroSlideshow.module.css +0 -107
- package/template/components/layout/hero/v1/heroSlideshow.tsx +0 -233
- package/template/components/layout/modals/accessibilityModal/AccessibilityModal.module.css +0 -126
- package/template/components/layout/modals/accessibilityModal/AccessibilityModal.tsx +0 -290
- package/template/components/layout/modals/alert/Alert.tsx +0 -188
- package/template/components/layout/navigation/MioCard.module.css +0 -88
- package/template/components/layout/navigation/MioCard.tsx +0 -266
- package/template/components/tools/ProgressiveBlur.tsx +0 -73
- package/template/components/tools/icon/icon.module.css +0 -0
- package/template/components/tools/icon/icon.tsx +0 -125
- package/template/components/tools/react-bits/ClickSpark.tsx +0 -177
- package/template/components/tools/react-bits/FadeContent.tsx +0 -90
- package/template/components/tools/react-bits/GlareHover.tsx +0 -73
- package/template/components/tools/react-bits/GradientText/GradientText.css +0 -70
- package/template/components/tools/react-bits/GradientText/GradientText.tsx +0 -44
- package/template/components/tools/react-bits/Magnet.tsx +0 -118
- package/template/components/tools/react-bits/Stepper/Stepper.css +0 -134
- package/template/components/tools/react-bits/Stepper/Stepper.tsx +0 -412
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React, { useEffect, useState } from "react";
|
|
3
|
-
import styles from "./icon.module.css";
|
|
4
|
-
|
|
5
|
-
interface IconProps {
|
|
6
|
-
id?: string;
|
|
7
|
-
label?: string;
|
|
8
|
-
systemName?: string;
|
|
9
|
-
className?: string;
|
|
10
|
-
direction?: "row" | "column";
|
|
11
|
-
reverse?: boolean;
|
|
12
|
-
iconStyle?: React.CSSProperties;
|
|
13
|
-
labelStyle?: React.CSSProperties;
|
|
14
|
-
iconBodyStyle?: React.CSSProperties;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default function Icon({
|
|
18
|
-
id,
|
|
19
|
-
label,
|
|
20
|
-
systemName,
|
|
21
|
-
className,
|
|
22
|
-
reverse,
|
|
23
|
-
direction,
|
|
24
|
-
iconStyle,
|
|
25
|
-
labelStyle,
|
|
26
|
-
iconBodyStyle,
|
|
27
|
-
}: IconProps) {
|
|
28
|
-
// Keep the last non-empty label mounted so it can animate out
|
|
29
|
-
const [cachedLabel, setCachedLabel] = useState(label);
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (label) setCachedLabel(label);
|
|
32
|
-
}, [label]);
|
|
33
|
-
|
|
34
|
-
const hasLabel = !!label;
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<div
|
|
38
|
-
className={
|
|
39
|
-
className ? `${className} ${styles.iconBody}` : styles.iconBody
|
|
40
|
-
}
|
|
41
|
-
style={{
|
|
42
|
-
flexDirection:
|
|
43
|
-
direction === "column" ? "column" : reverse ? "row-reverse" : "row",
|
|
44
|
-
display: "inline-flex",
|
|
45
|
-
alignItems: "center",
|
|
46
|
-
justifyContent: "center",
|
|
47
|
-
minWidth: 0,
|
|
48
|
-
|
|
49
|
-
height: "auto",
|
|
50
|
-
padding:
|
|
51
|
-
direction === "column"
|
|
52
|
-
? 0
|
|
53
|
-
: reverse
|
|
54
|
-
? "0 2px 0 8px"
|
|
55
|
-
: hasLabel && systemName
|
|
56
|
-
? "0 8px 0 2px"
|
|
57
|
-
: hasLabel
|
|
58
|
-
? "0 8px"
|
|
59
|
-
: !hasLabel
|
|
60
|
-
? 0
|
|
61
|
-
: 0,
|
|
62
|
-
width: "auto",
|
|
63
|
-
gap: direction === "column" ? 0 : !hasLabel || !systemName ? 0 : 4,
|
|
64
|
-
transition: `padding var(--transition-expressive-slow) ${hasLabel ? "0ms" : "0ms"}, gap var(--transition-expressive-slow) ${hasLabel ? "0ms" : "0ms"}`,
|
|
65
|
-
...iconBodyStyle,
|
|
66
|
-
}}
|
|
67
|
-
>
|
|
68
|
-
{systemName && (
|
|
69
|
-
<span
|
|
70
|
-
id={id}
|
|
71
|
-
className={`${styles.iconStyle} material-symbols-rounded`}
|
|
72
|
-
style={{
|
|
73
|
-
userSelect: "none",
|
|
74
|
-
display: "inline-flex",
|
|
75
|
-
alignItems: "center",
|
|
76
|
-
justifyContent: "center",
|
|
77
|
-
lineHeight: "1",
|
|
78
|
-
verticalAlign: "middle",
|
|
79
|
-
margin: 0,
|
|
80
|
-
padding: 0,
|
|
81
|
-
height: "24px",
|
|
82
|
-
width: "24px",
|
|
83
|
-
...iconStyle,
|
|
84
|
-
}}
|
|
85
|
-
aria-label={label}
|
|
86
|
-
>
|
|
87
|
-
{systemName}
|
|
88
|
-
</span>
|
|
89
|
-
)}
|
|
90
|
-
|
|
91
|
-
{/* Grid wrapper animates 0fr ↔ 1fr */}
|
|
92
|
-
<div
|
|
93
|
-
style={{
|
|
94
|
-
display: "inline-grid",
|
|
95
|
-
gridTemplateColumns: hasLabel ? "1fr" : "0fr",
|
|
96
|
-
transition: `grid-template-columns var(--transition-expressive-slow) ${hasLabel ? "0ms" : "0ms"}`,
|
|
97
|
-
}}
|
|
98
|
-
>
|
|
99
|
-
<label
|
|
100
|
-
className={`${styles.iconLabel} md-label`}
|
|
101
|
-
style={{
|
|
102
|
-
display: "inline-flex",
|
|
103
|
-
alignItems: "center",
|
|
104
|
-
height: "28px",
|
|
105
|
-
justifyContent: "center",
|
|
106
|
-
cursor: "pointer",
|
|
107
|
-
userSelect: "none",
|
|
108
|
-
whiteSpace: "nowrap",
|
|
109
|
-
paddingBottom: "0.1em",
|
|
110
|
-
overflow: "hidden",
|
|
111
|
-
opacity: hasLabel ? 1 : 0,
|
|
112
|
-
transition: "opacity 0.3s ease",
|
|
113
|
-
...labelStyle,
|
|
114
|
-
...(direction === "column"
|
|
115
|
-
? { fontSize: 12, fontWeight: 400 }
|
|
116
|
-
: {}),
|
|
117
|
-
}}
|
|
118
|
-
htmlFor={id}
|
|
119
|
-
>
|
|
120
|
-
{cachedLabel}
|
|
121
|
-
</label>
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
);
|
|
125
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useEffect, useCallback } from "react";
|
|
2
|
-
|
|
3
|
-
interface ClickSparkProps {
|
|
4
|
-
sparkColor?: string;
|
|
5
|
-
sparkSize?: number;
|
|
6
|
-
sparkRadius?: number;
|
|
7
|
-
sparkCount?: number;
|
|
8
|
-
duration?: number;
|
|
9
|
-
easing?: "linear" | "ease-in" | "ease-out" | "ease-in-out";
|
|
10
|
-
extraScale?: number;
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface Spark {
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
angle: number;
|
|
18
|
-
startTime: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const ClickSpark: React.FC<ClickSparkProps> = ({
|
|
22
|
-
sparkColor = "#fff",
|
|
23
|
-
sparkSize = 10,
|
|
24
|
-
sparkRadius = 15,
|
|
25
|
-
sparkCount = 8,
|
|
26
|
-
duration = 400,
|
|
27
|
-
easing = "ease-out",
|
|
28
|
-
extraScale = 1.0,
|
|
29
|
-
children
|
|
30
|
-
}) => {
|
|
31
|
-
const canvasRef = useRef<HTMLCanvasElement>(null);
|
|
32
|
-
const sparksRef = useRef<Spark[]>([]);
|
|
33
|
-
const startTimeRef = useRef<number | null>(null);
|
|
34
|
-
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
const canvas = canvasRef.current;
|
|
37
|
-
if (!canvas) return;
|
|
38
|
-
|
|
39
|
-
const parent = canvas.parentElement;
|
|
40
|
-
if (!parent) return;
|
|
41
|
-
|
|
42
|
-
let resizeTimeout: ReturnType<typeof setTimeout>;
|
|
43
|
-
|
|
44
|
-
const resizeCanvas = () => {
|
|
45
|
-
const { width, height } = parent.getBoundingClientRect();
|
|
46
|
-
if (canvas.width !== width || canvas.height !== height) {
|
|
47
|
-
canvas.width = width;
|
|
48
|
-
canvas.height = height;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const handleResize = () => {
|
|
53
|
-
clearTimeout(resizeTimeout);
|
|
54
|
-
resizeTimeout = setTimeout(resizeCanvas, 100);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const ro = new ResizeObserver(handleResize);
|
|
58
|
-
ro.observe(parent);
|
|
59
|
-
|
|
60
|
-
resizeCanvas();
|
|
61
|
-
|
|
62
|
-
return () => {
|
|
63
|
-
ro.disconnect();
|
|
64
|
-
clearTimeout(resizeTimeout);
|
|
65
|
-
};
|
|
66
|
-
}, []);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const easeFunc = useCallback(
|
|
70
|
-
(t: number) => {
|
|
71
|
-
switch (easing) {
|
|
72
|
-
case "linear":
|
|
73
|
-
return t;
|
|
74
|
-
case "ease-in":
|
|
75
|
-
return t * t;
|
|
76
|
-
case "ease-in-out":
|
|
77
|
-
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
|
78
|
-
default:
|
|
79
|
-
return t * (2 - t);
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
[easing]
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
const canvas = canvasRef.current;
|
|
87
|
-
if (!canvas) return;
|
|
88
|
-
const ctx = canvas.getContext("2d");
|
|
89
|
-
if (!ctx) return;
|
|
90
|
-
|
|
91
|
-
let animationId: number;
|
|
92
|
-
|
|
93
|
-
const draw = (timestamp: number) => {
|
|
94
|
-
if (!startTimeRef.current) {
|
|
95
|
-
startTimeRef.current = timestamp;
|
|
96
|
-
}
|
|
97
|
-
ctx?.clearRect(0, 0, canvas.width, canvas.height);
|
|
98
|
-
|
|
99
|
-
sparksRef.current = sparksRef.current.filter((spark: Spark) => {
|
|
100
|
-
const elapsed = timestamp - spark.startTime;
|
|
101
|
-
if (elapsed >= duration) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const progress = elapsed / duration;
|
|
106
|
-
const eased = easeFunc(progress);
|
|
107
|
-
|
|
108
|
-
const distance = eased * sparkRadius * extraScale;
|
|
109
|
-
const lineLength = sparkSize * (1 - eased);
|
|
110
|
-
|
|
111
|
-
const x1 = spark.x + distance * Math.cos(spark.angle);
|
|
112
|
-
const y1 = spark.y + distance * Math.sin(spark.angle);
|
|
113
|
-
const x2 = spark.x + (distance + lineLength) * Math.cos(spark.angle);
|
|
114
|
-
const y2 = spark.y + (distance + lineLength) * Math.sin(spark.angle);
|
|
115
|
-
|
|
116
|
-
ctx.strokeStyle = sparkColor;
|
|
117
|
-
ctx.lineWidth = 2;
|
|
118
|
-
ctx.beginPath();
|
|
119
|
-
ctx.moveTo(x1, y1);
|
|
120
|
-
ctx.lineTo(x2, y2);
|
|
121
|
-
ctx.stroke();
|
|
122
|
-
|
|
123
|
-
return true;
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
animationId = requestAnimationFrame(draw);
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
animationId = requestAnimationFrame(draw);
|
|
130
|
-
|
|
131
|
-
return () => {
|
|
132
|
-
cancelAnimationFrame(animationId);
|
|
133
|
-
};
|
|
134
|
-
}, [sparkColor, sparkSize, sparkRadius, sparkCount, duration, easeFunc, extraScale]);
|
|
135
|
-
|
|
136
|
-
const handleClick = (e: React.MouseEvent<HTMLDivElement>): void => {
|
|
137
|
-
const canvas = canvasRef.current;
|
|
138
|
-
if (!canvas) return;
|
|
139
|
-
const rect = canvas.getBoundingClientRect();
|
|
140
|
-
const x = e.clientX - rect.left;
|
|
141
|
-
const y = e.clientY - rect.top;
|
|
142
|
-
|
|
143
|
-
const now = performance.now();
|
|
144
|
-
const newSparks: Spark[] = Array.from({length: sparkCount}, (_, i) => ({
|
|
145
|
-
x,
|
|
146
|
-
y,
|
|
147
|
-
angle: (2 * Math.PI * i) / sparkCount,
|
|
148
|
-
startTime: now,
|
|
149
|
-
}));
|
|
150
|
-
|
|
151
|
-
sparksRef.current.push(...newSparks);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
return (
|
|
155
|
-
<div style={{
|
|
156
|
-
width:"100%",
|
|
157
|
-
height:"100%",
|
|
158
|
-
position:"relative"
|
|
159
|
-
}}
|
|
160
|
-
onClick={handleClick}
|
|
161
|
-
>
|
|
162
|
-
<canvas
|
|
163
|
-
ref={canvasRef}
|
|
164
|
-
style={{
|
|
165
|
-
position:"absolute",
|
|
166
|
-
inset:0,
|
|
167
|
-
pointerEvents:"none",
|
|
168
|
-
zIndex: "9999999999",
|
|
169
|
-
mixBlendMode: "difference"
|
|
170
|
-
}}
|
|
171
|
-
/>
|
|
172
|
-
{children}
|
|
173
|
-
</div>
|
|
174
|
-
);
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
export default ClickSpark;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { useRef, useEffect, useState, ReactNode } from "react";
|
|
2
|
-
import { useReduceMotion } from "@/components/tools/ReduceMotionContext";
|
|
3
|
-
|
|
4
|
-
interface FadeContentProps {
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
blur?: boolean;
|
|
7
|
-
duration?: number;
|
|
8
|
-
easing?: string;
|
|
9
|
-
delay?: number;
|
|
10
|
-
threshold?: number;
|
|
11
|
-
initialOpacity?: number;
|
|
12
|
-
className?: string;
|
|
13
|
-
fadeFrom?: "top" | "bottom" | "left" | "right";
|
|
14
|
-
style?: React.CSSProperties;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const FadeContent: React.FC<FadeContentProps> = ({
|
|
18
|
-
fadeFrom = "bottom",
|
|
19
|
-
children,
|
|
20
|
-
blur = false,
|
|
21
|
-
duration = 1000,
|
|
22
|
-
easing = "ease-out",
|
|
23
|
-
delay = 0,
|
|
24
|
-
threshold = 0.1,
|
|
25
|
-
initialOpacity = 0,
|
|
26
|
-
className = "",
|
|
27
|
-
style,
|
|
28
|
-
}) => {
|
|
29
|
-
const [inView, setInView] = useState(false);
|
|
30
|
-
const ref = useRef<HTMLDivElement | null>(null);
|
|
31
|
-
const rm = useReduceMotion();
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
if (rm) {
|
|
35
|
-
setInView(true);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const element = ref.current;
|
|
40
|
-
if (!element) return;
|
|
41
|
-
|
|
42
|
-
const observer = new IntersectionObserver(
|
|
43
|
-
([entry]) => {
|
|
44
|
-
if (entry.isIntersecting) {
|
|
45
|
-
observer.unobserve(element);
|
|
46
|
-
setTimeout(() => {
|
|
47
|
-
setInView(true);
|
|
48
|
-
}, delay);
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
{ threshold },
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
observer.observe(element);
|
|
55
|
-
|
|
56
|
-
return () => observer.disconnect();
|
|
57
|
-
}, [threshold, delay, rm]);
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<div
|
|
61
|
-
ref={ref}
|
|
62
|
-
className={className}
|
|
63
|
-
style={{
|
|
64
|
-
display: "flex",
|
|
65
|
-
flexDirection: "column",
|
|
66
|
-
alignItems: "center",
|
|
67
|
-
width: "100%",
|
|
68
|
-
gap: "12px",
|
|
69
|
-
opacity: inView ? 1 : initialOpacity,
|
|
70
|
-
transition: `opacity ${rm ? 0 : duration}ms ${easing}, filter ${rm ? 0 : duration}ms ${easing}, transform ${rm ? 0 : duration}ms ${easing}`,
|
|
71
|
-
transform: inView
|
|
72
|
-
? "none"
|
|
73
|
-
: fadeFrom === "top"
|
|
74
|
-
? "translateY(-40px)"
|
|
75
|
-
: fadeFrom === "bottom"
|
|
76
|
-
? "translateY(40px)"
|
|
77
|
-
: fadeFrom === "left"
|
|
78
|
-
? "translateX(-40px)"
|
|
79
|
-
: "translateX(40px)",
|
|
80
|
-
filter: blur ? (inView ? "blur(0px)" : "blur(10px)") : "none",
|
|
81
|
-
|
|
82
|
-
...style,
|
|
83
|
-
}}
|
|
84
|
-
>
|
|
85
|
-
{children}
|
|
86
|
-
</div>
|
|
87
|
-
);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export default FadeContent;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import "./GlareHover.css";
|
|
3
|
-
|
|
4
|
-
interface GlareHoverProps {
|
|
5
|
-
width?: string;
|
|
6
|
-
height?: string;
|
|
7
|
-
background?: string;
|
|
8
|
-
borderRadius?: string;
|
|
9
|
-
borderColor?: string;
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
glareColor?: string;
|
|
12
|
-
glareOpacity?: number;
|
|
13
|
-
glareAngle?: number;
|
|
14
|
-
glareSize?: number;
|
|
15
|
-
transitionDuration?: number;
|
|
16
|
-
playOnce?: boolean;
|
|
17
|
-
className?: string;
|
|
18
|
-
style?: React.CSSProperties;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const GlareHover: React.FC<GlareHoverProps> = ({
|
|
22
|
-
width = "500px",
|
|
23
|
-
height = "500px",
|
|
24
|
-
background = "#000",
|
|
25
|
-
borderRadius = "10px",
|
|
26
|
-
borderColor = "#333",
|
|
27
|
-
children,
|
|
28
|
-
glareColor = "#ffffff",
|
|
29
|
-
glareOpacity = 0.5,
|
|
30
|
-
glareAngle = -45,
|
|
31
|
-
glareSize = 250,
|
|
32
|
-
transitionDuration = 650,
|
|
33
|
-
playOnce = false,
|
|
34
|
-
className = "",
|
|
35
|
-
style = {},
|
|
36
|
-
}) => {
|
|
37
|
-
const hex = glareColor.replace("#", "");
|
|
38
|
-
let rgba = glareColor;
|
|
39
|
-
if (/^[0-9A-Fa-f]{6}$/.test(hex)) {
|
|
40
|
-
const r = parseInt(hex.slice(0, 2), 16);
|
|
41
|
-
const g = parseInt(hex.slice(2, 4), 16);
|
|
42
|
-
const b = parseInt(hex.slice(4, 6), 16);
|
|
43
|
-
rgba = `rgba(${r}, ${g}, ${b}, ${glareOpacity})`;
|
|
44
|
-
} else if (/^[0-9A-Fa-f]{3}$/.test(hex)) {
|
|
45
|
-
const r = parseInt(hex[0] + hex[0], 16);
|
|
46
|
-
const g = parseInt(hex[1] + hex[1], 16);
|
|
47
|
-
const b = parseInt(hex[2] + hex[2], 16);
|
|
48
|
-
rgba = `rgba(${r}, ${g}, ${b}, ${glareOpacity})`;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const vars: React.CSSProperties & { [k: string]: string } = {
|
|
52
|
-
"--gh-width": width,
|
|
53
|
-
"--gh-height": height,
|
|
54
|
-
"--gh-bg": background,
|
|
55
|
-
"--gh-br": borderRadius,
|
|
56
|
-
"--gh-angle": `${glareAngle}deg`,
|
|
57
|
-
"--gh-duration": `${transitionDuration}ms`,
|
|
58
|
-
"--gh-size": `${glareSize}%`,
|
|
59
|
-
"--gh-rgba": rgba,
|
|
60
|
-
"--gh-border": borderColor,
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<div
|
|
65
|
-
className={`glare-hover ${playOnce ? 'glare-hover--play-once' : ''} ${className}`}
|
|
66
|
-
style={{ ...vars, ...style } as React.CSSProperties}
|
|
67
|
-
>
|
|
68
|
-
{children}
|
|
69
|
-
</div>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export default GlareHover;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
.animated-gradient-text {
|
|
2
|
-
position: relative;
|
|
3
|
-
margin: 0 8px;
|
|
4
|
-
display: flex;
|
|
5
|
-
min-width: min-content;
|
|
6
|
-
max-width: max-content;
|
|
7
|
-
width: 100%;
|
|
8
|
-
flex-direction: row;
|
|
9
|
-
align-items: center;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
border-radius: 0;
|
|
12
|
-
font-weight: 500;
|
|
13
|
-
backdrop-filter: blur(10px);
|
|
14
|
-
transition: box-shadow 0.5s ease-out;
|
|
15
|
-
overflow: hidden;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.gradient-overlay {
|
|
20
|
-
position: absolute;
|
|
21
|
-
top: 0;
|
|
22
|
-
left: 0;
|
|
23
|
-
right: 0;
|
|
24
|
-
bottom: 0;
|
|
25
|
-
background-size: 300% 100%;
|
|
26
|
-
animation: gradient 2s linear infinite;
|
|
27
|
-
border-radius: inherit;
|
|
28
|
-
z-index: 0;
|
|
29
|
-
pointer-events: none;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.gradient-overlay::before {
|
|
33
|
-
content: "";
|
|
34
|
-
position: absolute;
|
|
35
|
-
left: 0;
|
|
36
|
-
top: 0;
|
|
37
|
-
border-radius: inherit;
|
|
38
|
-
width: calc(100%);
|
|
39
|
-
height: calc(100%);
|
|
40
|
-
left: 50%;
|
|
41
|
-
top: 50%;
|
|
42
|
-
transform: translate(-50%, -50%);
|
|
43
|
-
background-color: var(--sys-background);
|
|
44
|
-
z-index: -1;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@keyframes gradient {
|
|
48
|
-
0% {
|
|
49
|
-
background-position: 0% 50%;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
50% {
|
|
53
|
-
background-position: 50% 50%;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
100% {
|
|
57
|
-
background-position: 100% 50%;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.text-content {
|
|
62
|
-
display: inline-block;
|
|
63
|
-
position: relative;
|
|
64
|
-
z-index: 2;
|
|
65
|
-
background-size: 300% 100%;
|
|
66
|
-
background-clip: text;
|
|
67
|
-
-webkit-background-clip: text;
|
|
68
|
-
color: transparent;
|
|
69
|
-
animation: gradient 2s linear infinite;
|
|
70
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import "./GradientText.css";
|
|
2
|
-
import { ReactNode } from "react";
|
|
3
|
-
|
|
4
|
-
interface GradientTextProps {
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
className?: string;
|
|
7
|
-
animationSpeed?: number;
|
|
8
|
-
showBorder?: boolean;
|
|
9
|
-
fontSize?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default function GradientText({
|
|
13
|
-
fontSize = "",
|
|
14
|
-
children,
|
|
15
|
-
className = "",
|
|
16
|
-
animationSpeed = 8,
|
|
17
|
-
showBorder = false,
|
|
18
|
-
}: GradientTextProps) {
|
|
19
|
-
const colors = [
|
|
20
|
-
"var(--md-sys-color-surface-tint)",
|
|
21
|
-
"var(--md-sys-color-secondary)",
|
|
22
|
-
"var(--md-sys-color-tertiary)",
|
|
23
|
-
"var(--md-sys-color-secondary)",
|
|
24
|
-
"var(--md-sys-color-primary)",
|
|
25
|
-
"var(--md-sys-color-secondary)",
|
|
26
|
-
"var(--md-sys-color-tertiary)",
|
|
27
|
-
];
|
|
28
|
-
const gradientStyle = {
|
|
29
|
-
fontSize: `${fontSize}`,
|
|
30
|
-
backgroundImage: `linear-gradient(to right, ${colors.join(", ")})`,
|
|
31
|
-
animationDuration: `${animationSpeed}s`,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<div className={`animated-gradient-text ${className}`}>
|
|
36
|
-
{showBorder && (
|
|
37
|
-
<div className="gradient-overlay" style={gradientStyle}></div>
|
|
38
|
-
)}
|
|
39
|
-
<div className="text-content" style={gradientStyle}>
|
|
40
|
-
{children}
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
useEffect,
|
|
3
|
-
useRef,
|
|
4
|
-
ReactNode,
|
|
5
|
-
HTMLAttributes,
|
|
6
|
-
} from "react";
|
|
7
|
-
|
|
8
|
-
interface MagnetProps extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
padding?: number;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
magnetStrength?: number;
|
|
13
|
-
activeTransition?: string;
|
|
14
|
-
inactiveTransition?: string;
|
|
15
|
-
wrapperClassName?: string;
|
|
16
|
-
innerClassName?: string;
|
|
17
|
-
style?: React.CSSProperties;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const Magnet: React.FC<MagnetProps> = ({
|
|
21
|
-
children,
|
|
22
|
-
padding = 100,
|
|
23
|
-
disabled = false,
|
|
24
|
-
magnetStrength = 2,
|
|
25
|
-
activeTransition = "transform 0.5s ease-out",
|
|
26
|
-
inactiveTransition = "transform 0.5s ease-in-out",
|
|
27
|
-
wrapperClassName = "",
|
|
28
|
-
innerClassName = "",
|
|
29
|
-
style = {},
|
|
30
|
-
...props
|
|
31
|
-
}) => {
|
|
32
|
-
const magnetRef = useRef<HTMLDivElement>(null);
|
|
33
|
-
const innerRef = useRef<HTMLDivElement>(null);
|
|
34
|
-
// Cached rect — kept fresh by ResizeObserver, never read inside mousemove
|
|
35
|
-
const rectRef = useRef<DOMRect | null>(null);
|
|
36
|
-
const isActiveRef = useRef(false);
|
|
37
|
-
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
const el = magnetRef.current;
|
|
40
|
-
const inner = innerRef.current;
|
|
41
|
-
if (!el || !inner) return;
|
|
42
|
-
|
|
43
|
-
const ro = new ResizeObserver(() => {
|
|
44
|
-
rectRef.current = el.getBoundingClientRect();
|
|
45
|
-
});
|
|
46
|
-
ro.observe(el);
|
|
47
|
-
rectRef.current = el.getBoundingClientRect();
|
|
48
|
-
|
|
49
|
-
// Viewport position changes on scroll — keep the cache current
|
|
50
|
-
const handleScroll = () => {
|
|
51
|
-
rectRef.current = el.getBoundingClientRect();
|
|
52
|
-
};
|
|
53
|
-
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
54
|
-
|
|
55
|
-
const handleMouseMove = (e: MouseEvent) => {
|
|
56
|
-
if (disabled) return;
|
|
57
|
-
const rect = rectRef.current;
|
|
58
|
-
if (!rect) return;
|
|
59
|
-
|
|
60
|
-
const centerX = rect.left + rect.width / 2;
|
|
61
|
-
const centerY = rect.top + rect.height / 2;
|
|
62
|
-
const distX = Math.abs(centerX - e.clientX);
|
|
63
|
-
const distY = Math.abs(centerY - e.clientY);
|
|
64
|
-
|
|
65
|
-
if (distX < rect.width / 2 + padding && distY < rect.height / 2 + padding) {
|
|
66
|
-
const offsetX = (e.clientX - centerX) / magnetStrength;
|
|
67
|
-
const offsetY = (e.clientY - centerY) / magnetStrength;
|
|
68
|
-
if (!isActiveRef.current) {
|
|
69
|
-
isActiveRef.current = true;
|
|
70
|
-
inner.style.transition = activeTransition;
|
|
71
|
-
}
|
|
72
|
-
inner.style.transform = `translate3d(${offsetX}px, ${offsetY}px, 0)`;
|
|
73
|
-
} else if (isActiveRef.current) {
|
|
74
|
-
isActiveRef.current = false;
|
|
75
|
-
inner.style.transition = inactiveTransition;
|
|
76
|
-
inner.style.transform = `translate3d(0px, 0px, 0)`;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
window.addEventListener("mousemove", handleMouseMove);
|
|
81
|
-
return () => {
|
|
82
|
-
ro.disconnect();
|
|
83
|
-
window.removeEventListener("scroll", handleScroll);
|
|
84
|
-
window.removeEventListener("mousemove", handleMouseMove);
|
|
85
|
-
};
|
|
86
|
-
}, [padding, disabled, magnetStrength, activeTransition, inactiveTransition]);
|
|
87
|
-
|
|
88
|
-
// Reset when disabled
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
if (disabled && innerRef.current) {
|
|
91
|
-
innerRef.current.style.transition = inactiveTransition;
|
|
92
|
-
innerRef.current.style.transform = `translate3d(0px, 0px, 0)`;
|
|
93
|
-
}
|
|
94
|
-
}, [disabled, inactiveTransition]);
|
|
95
|
-
|
|
96
|
-
return (
|
|
97
|
-
<div
|
|
98
|
-
ref={magnetRef}
|
|
99
|
-
className={wrapperClassName}
|
|
100
|
-
style={{ position: "fixed", display: "block", ...style }}
|
|
101
|
-
{...props}
|
|
102
|
-
>
|
|
103
|
-
<div
|
|
104
|
-
ref={innerRef}
|
|
105
|
-
className={innerClassName}
|
|
106
|
-
style={{
|
|
107
|
-
transform: "translate3d(0px, 0px, 0)",
|
|
108
|
-
transition: inactiveTransition,
|
|
109
|
-
willChange: "transform",
|
|
110
|
-
}}
|
|
111
|
-
>
|
|
112
|
-
{children}
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export default Magnet;
|