@yamatozhen/design_system 1.0.1 → 1.2.1
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.css +51 -51
- package/template/app/themes/dark.css +51 -51
- package/template/app/themes/light-mc.css +51 -51
- package/template/app/themes/light.css +51 -51
- 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/{layout → (controls)}/switch/Switch.module.css +108 -102
- package/template/components/{layout → (controls)}/switch/Switch.tsx +69 -48
- 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.tsx +107 -0
- package/template/components/tools/Divider.tsx +11 -11
- package/template/components/tools/ReduceMotionContext.tsx +5 -5
- package/template/components/tools/Sinewave.tsx +396 -199
- package/template/components/tools/SinewaveProgress.tsx +140 -135
- 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.ts +6 -6
- package/template/components/tools/footer/Footer.tsx +20 -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.tsx +39 -0
- package/template/components/tools/label/Label.tsx +156 -0
- package/template/components/tools/mobileViewProvider.tsx +53 -58
- package/template/components/tools/ripple/ripple.css +38 -41
- package/template/components/tools/ripple/ripple.tsx +78 -53
- package/template/components/tools/shape/Shape.module.css +25 -0
- package/template/components/tools/shape/{ShapeMorph.tsx → Shape.tsx} +316 -190
- package/template/components/tools/shape/ShapeLoader.tsx +104 -101
- package/template/components/tools/shape/ShapePaths.ts +116 -116
- package/template/components/tools/switch/Switch.module.css +102 -102
- package/template/components/tools/switch/Switch.tsx +48 -48
- package/template/components/tools/useBodyScrollLock.tsx +27 -27
- package/template/components/tools/useImageColor.ts +47 -47
- package/template/components/tools/useNavSheetDrag.tsx +196 -196
- 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
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Icon from "@/components/tools/label/Icon";
|
|
4
|
+
import Button from "@/components/(buttons)/button";
|
|
5
|
+
import Label from "@/components/tools/label/Label";
|
|
6
|
+
|
|
7
|
+
export type PaginationVariant = "primary" | "secondary" | "tertiary";
|
|
8
|
+
|
|
9
|
+
export interface PaginationProps {
|
|
10
|
+
variant?: PaginationVariant;
|
|
11
|
+
page?: number;
|
|
12
|
+
totalPages?: number;
|
|
13
|
+
onChange?: (page: number) => void;
|
|
14
|
+
siblingCount?: number;
|
|
15
|
+
isDisabled?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
withLabels?: { prev?: string; next?: string };
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type PageEntry = number | "ellipsis";
|
|
23
|
+
function getPageRange(
|
|
24
|
+
current: number,
|
|
25
|
+
total: number,
|
|
26
|
+
siblingCount: number,
|
|
27
|
+
): PageEntry[] {
|
|
28
|
+
const totalVisible = siblingCount * 2 + 5;
|
|
29
|
+
if (total <= totalVisible) {
|
|
30
|
+
return Array.from({ length: total }, (_, i) => i + 1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const leftSibling = Math.max(current - siblingCount, 1);
|
|
34
|
+
const rightSibling = Math.min(current + siblingCount, total);
|
|
35
|
+
const showLeftEllipsis = leftSibling > 2;
|
|
36
|
+
const showRightEllipsis = rightSibling < total - 1;
|
|
37
|
+
|
|
38
|
+
if (!showLeftEllipsis && showRightEllipsis) {
|
|
39
|
+
const leftCount = 3 + siblingCount * 2;
|
|
40
|
+
const leftRange = Array.from({ length: leftCount }, (_, i) => i + 1);
|
|
41
|
+
return [...leftRange, "ellipsis", total];
|
|
42
|
+
}
|
|
43
|
+
if (showLeftEllipsis && !showRightEllipsis) {
|
|
44
|
+
const rightCount = 3 + siblingCount * 2;
|
|
45
|
+
const rightRange = Array.from(
|
|
46
|
+
{ length: rightCount },
|
|
47
|
+
(_, i) => total - rightCount + i + 1,
|
|
48
|
+
);
|
|
49
|
+
return [1, "ellipsis", ...rightRange];
|
|
50
|
+
}
|
|
51
|
+
const middleRange = Array.from(
|
|
52
|
+
{ length: rightSibling - leftSibling + 1 },
|
|
53
|
+
(_, i) => leftSibling + i,
|
|
54
|
+
);
|
|
55
|
+
return [1, "ellipsis", ...middleRange, "ellipsis", total];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface PaginationContextValue {
|
|
59
|
+
variant: PaginationVariant;
|
|
60
|
+
isDisabled: boolean;
|
|
61
|
+
}
|
|
62
|
+
const PaginationContext = React.createContext<PaginationContextValue>({
|
|
63
|
+
variant: "secondary",
|
|
64
|
+
isDisabled: false,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
function Pagination({
|
|
68
|
+
variant = "secondary",
|
|
69
|
+
page = 1,
|
|
70
|
+
totalPages = 1,
|
|
71
|
+
onChange,
|
|
72
|
+
siblingCount = 1,
|
|
73
|
+
isDisabled = false,
|
|
74
|
+
className,
|
|
75
|
+
style,
|
|
76
|
+
withLabels,
|
|
77
|
+
children,
|
|
78
|
+
}: PaginationProps) {
|
|
79
|
+
const contextValue = React.useMemo(
|
|
80
|
+
() => ({ variant, isDisabled }),
|
|
81
|
+
[variant, isDisabled],
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const childArray = React.Children.toArray(children);
|
|
85
|
+
const prevTrigger = childArray.find(
|
|
86
|
+
(child): child is React.ReactElement =>
|
|
87
|
+
React.isValidElement(child) && child.type === PaginationPrevTrigger,
|
|
88
|
+
);
|
|
89
|
+
const nextTrigger = childArray.find(
|
|
90
|
+
(child): child is React.ReactElement =>
|
|
91
|
+
React.isValidElement(child) && child.type === PaginationNextTrigger,
|
|
92
|
+
);
|
|
93
|
+
const content = childArray.find(
|
|
94
|
+
(child): child is React.ReactElement =>
|
|
95
|
+
React.isValidElement(child) && child.type === PaginationContent,
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const isFirst = page <= 1;
|
|
99
|
+
const isLast = page >= totalPages;
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<PaginationContext.Provider value={contextValue}>
|
|
103
|
+
<nav
|
|
104
|
+
aria-label="pagination"
|
|
105
|
+
role="navigation"
|
|
106
|
+
className={className}
|
|
107
|
+
style={{
|
|
108
|
+
display: "inline-flex",
|
|
109
|
+
alignItems: "center",
|
|
110
|
+
gap: 4,
|
|
111
|
+
borderRadius: 72,
|
|
112
|
+
padding: 4,
|
|
113
|
+
width: "fit-content",
|
|
114
|
+
...style,
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
{prevTrigger ?? (
|
|
118
|
+
<Button
|
|
119
|
+
variant={`${variant}`}
|
|
120
|
+
type="button"
|
|
121
|
+
aria-label="Previous page"
|
|
122
|
+
disabled={isDisabled || isFirst}
|
|
123
|
+
onClick={() => onChange?.(page - 1)}
|
|
124
|
+
>
|
|
125
|
+
{withLabels?.prev && (
|
|
126
|
+
<Label
|
|
127
|
+
label={withLabels.prev}
|
|
128
|
+
reverse
|
|
129
|
+
systemName="chevron_left"
|
|
130
|
+
/>
|
|
131
|
+
)}
|
|
132
|
+
{!withLabels?.prev && <Icon systemName="chevron_left" />}
|
|
133
|
+
</Button>
|
|
134
|
+
)}
|
|
135
|
+
|
|
136
|
+
{content ?? (
|
|
137
|
+
<PaginationContent>
|
|
138
|
+
{getPageRange(page, totalPages, siblingCount).map((entry, i) =>
|
|
139
|
+
entry === "ellipsis" ? (
|
|
140
|
+
<span
|
|
141
|
+
key={`e${i}`}
|
|
142
|
+
aria-hidden="true"
|
|
143
|
+
style={{
|
|
144
|
+
display: "inline-flex",
|
|
145
|
+
alignItems: "center",
|
|
146
|
+
justifyContent: "center",
|
|
147
|
+
minWidth: 36,
|
|
148
|
+
height: 36,
|
|
149
|
+
color: "var(--md-sys-color-on-surface-variant)",
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
…
|
|
153
|
+
</span>
|
|
154
|
+
) : (
|
|
155
|
+
<PaginationTab
|
|
156
|
+
key={entry}
|
|
157
|
+
isActive={entry === page}
|
|
158
|
+
onClick={() => onChange?.(entry)}
|
|
159
|
+
>
|
|
160
|
+
{entry}
|
|
161
|
+
</PaginationTab>
|
|
162
|
+
),
|
|
163
|
+
)}
|
|
164
|
+
</PaginationContent>
|
|
165
|
+
)}
|
|
166
|
+
|
|
167
|
+
{nextTrigger ?? (
|
|
168
|
+
<Button
|
|
169
|
+
variant={`${variant}`}
|
|
170
|
+
type="button"
|
|
171
|
+
aria-label="Next page"
|
|
172
|
+
disabled={isDisabled || isLast}
|
|
173
|
+
onClick={() => onChange?.(page + 1)}
|
|
174
|
+
>
|
|
175
|
+
{withLabels?.next && (
|
|
176
|
+
<Label label={withLabels.next} systemName="chevron_right" />
|
|
177
|
+
)}
|
|
178
|
+
{!withLabels?.next && <Icon systemName="chevron_right" />}
|
|
179
|
+
</Button>
|
|
180
|
+
)}
|
|
181
|
+
</nav>
|
|
182
|
+
</PaginationContext.Provider>
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function PaginationPrevTrigger({ children }: { children?: React.ReactNode }) {
|
|
187
|
+
return <>{children}</>;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function PaginationNextTrigger({ children }: { children?: React.ReactNode }) {
|
|
191
|
+
return <>{children}</>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function PaginationContent({
|
|
195
|
+
children,
|
|
196
|
+
className,
|
|
197
|
+
style,
|
|
198
|
+
}: {
|
|
199
|
+
children?: React.ReactNode;
|
|
200
|
+
className?: string;
|
|
201
|
+
style?: React.CSSProperties;
|
|
202
|
+
}) {
|
|
203
|
+
return (
|
|
204
|
+
<div
|
|
205
|
+
className={className}
|
|
206
|
+
style={{
|
|
207
|
+
display: "inline-flex",
|
|
208
|
+
alignItems: "center",
|
|
209
|
+
gap: 4,
|
|
210
|
+
...style,
|
|
211
|
+
}}
|
|
212
|
+
>
|
|
213
|
+
{children}
|
|
214
|
+
</div>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function PaginationTab({
|
|
219
|
+
isActive = false,
|
|
220
|
+
onClick,
|
|
221
|
+
children,
|
|
222
|
+
className,
|
|
223
|
+
style,
|
|
224
|
+
}: {
|
|
225
|
+
isActive?: boolean;
|
|
226
|
+
onClick?: () => void;
|
|
227
|
+
children?: React.ReactNode;
|
|
228
|
+
className?: string;
|
|
229
|
+
style?: React.CSSProperties;
|
|
230
|
+
}) {
|
|
231
|
+
const { variant, isDisabled } = React.useContext(PaginationContext);
|
|
232
|
+
return (
|
|
233
|
+
<Button
|
|
234
|
+
variant={isActive ? `${variant}-bold` : "text"}
|
|
235
|
+
type="button"
|
|
236
|
+
aria-current={isActive ? "page" : undefined}
|
|
237
|
+
disabled={isDisabled}
|
|
238
|
+
onClick={onClick}
|
|
239
|
+
className={className}
|
|
240
|
+
style={{
|
|
241
|
+
minWidth: 36,
|
|
242
|
+
minHeight: 36,
|
|
243
|
+
maxHeight: 36,
|
|
244
|
+
padding: 0,
|
|
245
|
+
fontWeight: isActive ? 600 : 400,
|
|
246
|
+
color: isActive ? undefined : "var(--md-sys-color-on-surface)",
|
|
247
|
+
borderRadius: "var(--borderRadius-md)",
|
|
248
|
+
...style,
|
|
249
|
+
}}
|
|
250
|
+
>
|
|
251
|
+
{children}
|
|
252
|
+
</Button>
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export default Object.assign(Pagination, {
|
|
257
|
+
PrevTrigger: PaginationPrevTrigger,
|
|
258
|
+
NextTrigger: PaginationNextTrigger,
|
|
259
|
+
Content: PaginationContent,
|
|
260
|
+
Tab: PaginationTab,
|
|
261
|
+
});
|
|
@@ -1,102 +1,117 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import SinewaveProgress from "@/components/tools/SinewaveProgress";
|
|
4
|
-
import { useBreakpoints } from "@/components/tools/mobileViewProvider";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const [
|
|
11
|
-
const [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
</
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import SinewaveProgress from "@/components/tools/SinewaveProgress";
|
|
4
|
+
import { useBreakpoints } from "@/components/tools/mobileViewProvider";
|
|
5
|
+
import LinearProgress from "@/components/(feedback)/linearProgress/LinearProgress";
|
|
6
|
+
import CircularProgress from "@/components/(feedback)/circularProgress/CircularProgress";
|
|
7
|
+
|
|
8
|
+
export default function LoadingScreen() {
|
|
9
|
+
const { isMobile } = useBreakpoints();
|
|
10
|
+
const [progress, setProgress] = useState(0);
|
|
11
|
+
const [ready, setReady] = useState(false); // real signals resolved
|
|
12
|
+
const [hidden, setHidden] = useState(false); // fade started
|
|
13
|
+
const [gone, setGone] = useState(false); // unmounted
|
|
14
|
+
|
|
15
|
+
// Gate: fonts (incl. Material Symbols) + window load + a minimum on-screen time.
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const MIN = 900;
|
|
18
|
+
const started = performance.now();
|
|
19
|
+
const windowLoaded =
|
|
20
|
+
document.readyState === "complete"
|
|
21
|
+
? Promise.resolve()
|
|
22
|
+
: new Promise<void>((res) =>
|
|
23
|
+
window.addEventListener("load", () => res(), { once: true }),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
let cancelled = false;
|
|
27
|
+
Promise.all([document.fonts.ready, windowLoaded]).then(() => {
|
|
28
|
+
const wait = Math.max(0, MIN - (performance.now() - started));
|
|
29
|
+
setTimeout(() => !cancelled && setReady(true), wait);
|
|
30
|
+
});
|
|
31
|
+
return () => {
|
|
32
|
+
cancelled = true;
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
|
|
36
|
+
// Fixed visual sequence: 20 -> 60 -> 80, each 400ms apart, always runs
|
|
37
|
+
// to completion regardless of `ready`. Only the final 80 -> 100 -> fade
|
|
38
|
+
// step waits on `ready`, so real load state can extend (but never
|
|
39
|
+
// truncate) the animation.
|
|
40
|
+
/* eslint-disable react-hooks/set-state-in-effect */
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
const STEP_DELAY = 400;
|
|
43
|
+
const steps = [10, 20, 20, 20, 21, 77, 79, 79, 80, 80];
|
|
44
|
+
let cancelled = false;
|
|
45
|
+
const timeouts: ReturnType<typeof setTimeout>[] = [];
|
|
46
|
+
|
|
47
|
+
steps.forEach((value, i) => {
|
|
48
|
+
const t = setTimeout(
|
|
49
|
+
() => {
|
|
50
|
+
if (!cancelled) setProgress(value);
|
|
51
|
+
},
|
|
52
|
+
STEP_DELAY * (i + 1),
|
|
53
|
+
);
|
|
54
|
+
timeouts.push(t);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
return () => {
|
|
58
|
+
cancelled = true;
|
|
59
|
+
timeouts.forEach(clearTimeout);
|
|
60
|
+
};
|
|
61
|
+
}, []);
|
|
62
|
+
|
|
63
|
+
// Once both the sequence has reached 80 AND real signals are ready,
|
|
64
|
+
// snap to 100 and fade 400ms later.
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!ready || progress < 80) return;
|
|
67
|
+
setProgress(100);
|
|
68
|
+
const t = setTimeout(() => setHidden(true), 1600);
|
|
69
|
+
return () => clearTimeout(t);
|
|
70
|
+
}, [ready, progress]);
|
|
71
|
+
/* eslint-enable react-hooks/set-state-in-effect */
|
|
72
|
+
|
|
73
|
+
if (gone) return null;
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
aria-hidden
|
|
78
|
+
onTransitionEnd={(e) => {
|
|
79
|
+
if (hidden && e.propertyName === "opacity") setGone(true);
|
|
80
|
+
}}
|
|
81
|
+
style={{
|
|
82
|
+
position: "fixed",
|
|
83
|
+
inset: 0,
|
|
84
|
+
zIndex: 9999,
|
|
85
|
+
display: "flex",
|
|
86
|
+
flexDirection: "column",
|
|
87
|
+
alignItems: "center",
|
|
88
|
+
justifyContent: "center",
|
|
89
|
+
background: "var(--sys-background)",
|
|
90
|
+
opacity: hidden ? 0 : 1,
|
|
91
|
+
transition: "opacity 600ms ease",
|
|
92
|
+
pointerEvents: hidden ? "none" : "auto",
|
|
93
|
+
gap: 48,
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
{/* space in filename → URL-encode */}
|
|
97
|
+
<h2 style={{ color: "var(--md-sys-color-primary)", fontWeight: 600 }}>
|
|
98
|
+
Company Name
|
|
99
|
+
</h2>
|
|
100
|
+
<LinearProgress progress={progress} shape="wavy" width={174} />
|
|
101
|
+
{/* legal footer copy here */}
|
|
102
|
+
<p
|
|
103
|
+
style={{
|
|
104
|
+
color: "var(--md-sys-color-outline-variant)",
|
|
105
|
+
textAlign: "center",
|
|
106
|
+
position: "absolute",
|
|
107
|
+
fontSize: 14,
|
|
108
|
+
bottom: 72,
|
|
109
|
+
padding: isMobile ? 24 : 0,
|
|
110
|
+
}}
|
|
111
|
+
>
|
|
112
|
+
© 2026 <span style={{ color: "red" }}>Company Name</span> — Your company
|
|
113
|
+
Text goes here, <br /> you can add privacy policy and TOA here.
|
|
114
|
+
</p>
|
|
115
|
+
</div>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { Montserrat } from "next/font/google";
|
|
2
|
-
import styles from "./maintenance.module.css";
|
|
3
|
-
|
|
4
|
-
const montserrat = Montserrat({
|
|
5
|
-
subsets: ["latin"],
|
|
6
|
-
variable: "--font-montserrat",
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export default function Maintenance() {
|
|
10
|
-
return (
|
|
11
|
-
<div className={`${styles.root} ${montserrat.variable}`}>
|
|
12
|
-
{/* background ─ pure CSS, no assets */}
|
|
13
|
-
<div className={styles.bg} aria-hidden="true">
|
|
14
|
-
<span className={`${styles.orb} ${styles.orbA}`} />
|
|
15
|
-
<span className={`${styles.orb} ${styles.orbB}`} />
|
|
16
|
-
<span className={`${styles.orb} ${styles.orbC}`} />
|
|
17
|
-
</div>
|
|
18
|
-
<div className={styles.grain} aria-hidden="true" />
|
|
19
|
-
|
|
20
|
-
<main className={styles.wrap}>
|
|
21
|
-
{/* left ─ copy */}
|
|
22
|
-
<div className={styles.copy}>
|
|
23
|
-
<span className={styles.pill}>
|
|
24
|
-
<span className={styles.dot} /> Be right back
|
|
25
|
-
</span>
|
|
26
|
-
<h1 className={styles.title}>
|
|
27
|
-
Under<br /><em>construction</em>
|
|
28
|
-
</h1>
|
|
29
|
-
<p className={styles.subtitle}>
|
|
30
|
-
I'm tinkering behind the scenes — the site's getting a
|
|
31
|
-
few upgrades and will be back to normal very soon. Thanks for
|
|
32
|
-
swinging by.
|
|
33
|
-
</p>
|
|
34
|
-
<p className={styles.sig}>— Yamato Zhen</p>
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
{/* right ─ glass card + shape */}
|
|
38
|
-
<div className={styles.stage}>
|
|
39
|
-
<div className={styles.card}>
|
|
40
|
-
{/* placeholder shape — swap for your mascot SVG when ready */}
|
|
41
|
-
<div className={styles.blob}>
|
|
42
|
-
<svg className={styles.face} viewBox="0 0 100 64" aria-hidden="true">
|
|
43
|
-
<circle className={styles.eye} cx="34" cy="24" r="7" />
|
|
44
|
-
<circle className={styles.eye} cx="66" cy="24" r="7" />
|
|
45
|
-
<path className={styles.mouth} d="M36 42 Q50 54 64 42" />
|
|
46
|
-
</svg>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</main>
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
1
|
+
import { Montserrat } from "next/font/google";
|
|
2
|
+
import styles from "./maintenance.module.css";
|
|
3
|
+
|
|
4
|
+
const montserrat = Montserrat({
|
|
5
|
+
subsets: ["latin"],
|
|
6
|
+
variable: "--font-montserrat",
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export default function Maintenance() {
|
|
10
|
+
return (
|
|
11
|
+
<div className={`${styles.root} ${montserrat.variable}`}>
|
|
12
|
+
{/* background ─ pure CSS, no assets */}
|
|
13
|
+
<div className={styles.bg} aria-hidden="true">
|
|
14
|
+
<span className={`${styles.orb} ${styles.orbA}`} />
|
|
15
|
+
<span className={`${styles.orb} ${styles.orbB}`} />
|
|
16
|
+
<span className={`${styles.orb} ${styles.orbC}`} />
|
|
17
|
+
</div>
|
|
18
|
+
<div className={styles.grain} aria-hidden="true" />
|
|
19
|
+
|
|
20
|
+
<main className={styles.wrap}>
|
|
21
|
+
{/* left ─ copy */}
|
|
22
|
+
<div className={styles.copy}>
|
|
23
|
+
<span className={styles.pill}>
|
|
24
|
+
<span className={styles.dot} /> Be right back
|
|
25
|
+
</span>
|
|
26
|
+
<h1 className={styles.title}>
|
|
27
|
+
Under<br /><em>construction</em>
|
|
28
|
+
</h1>
|
|
29
|
+
<p className={styles.subtitle}>
|
|
30
|
+
I'm tinkering behind the scenes — the site's getting a
|
|
31
|
+
few upgrades and will be back to normal very soon. Thanks for
|
|
32
|
+
swinging by.
|
|
33
|
+
</p>
|
|
34
|
+
<p className={styles.sig}>— Yamato Zhen</p>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
{/* right ─ glass card + shape */}
|
|
38
|
+
<div className={styles.stage}>
|
|
39
|
+
<div className={styles.card}>
|
|
40
|
+
{/* placeholder shape — swap for your mascot SVG when ready */}
|
|
41
|
+
<div className={styles.blob}>
|
|
42
|
+
<svg className={styles.face} viewBox="0 0 100 64" aria-hidden="true">
|
|
43
|
+
<circle className={styles.eye} cx="34" cy="24" r="7" />
|
|
44
|
+
<circle className={styles.eye} cx="66" cy="24" r="7" />
|
|
45
|
+
<path className={styles.mouth} d="M36 42 Q50 54 64 42" />
|
|
46
|
+
</svg>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</main>
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
53
|
}
|