@yamatozhen/design_system 1.0.0 → 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 -49
- package/scripts/postinstall.js +91 -105
- package/template/app/ClientNav.tsx +258 -310
- package/template/app/globals.css +2 -167
- package/template/app/layout.tsx +94 -128
- 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 -478
- 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/SocialIcons.tsx +0 -88
- 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,233 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import Image from "next/image";
|
|
3
|
-
import styles from "./heroSlideshow.module.css";
|
|
4
|
-
import { useState, useRef } from "react";
|
|
5
|
-
import { getColorSync } from "colorthief";
|
|
6
|
-
import Icon from "@/components/tools/icon/icon";
|
|
7
|
-
import {
|
|
8
|
-
BREAKPOINTS,
|
|
9
|
-
useBreakpoints,
|
|
10
|
-
useMediaQuery,
|
|
11
|
-
} from "@/components/tools/mobileViewProvider";
|
|
12
|
-
import Button from "../../button/button";
|
|
13
|
-
import Link from "next/link";
|
|
14
|
-
|
|
15
|
-
interface HeroSlideshowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
16
|
-
tabs: {
|
|
17
|
-
alt?: string;
|
|
18
|
-
src: string;
|
|
19
|
-
style?: React.CSSProperties;
|
|
20
|
-
cta?: {
|
|
21
|
-
title: string;
|
|
22
|
-
text: string;
|
|
23
|
-
href: string;
|
|
24
|
-
btn: string;
|
|
25
|
-
icon: string;
|
|
26
|
-
};
|
|
27
|
-
}[];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default function HeroSlideshow({ tabs, ...rest }: HeroSlideshowProps) {
|
|
31
|
-
const [activeTab, setActiveTab] = useState(0);
|
|
32
|
-
const [colors, setColors] = useState<(string | null)[]>(() =>
|
|
33
|
-
Array(tabs.length).fill(null),
|
|
34
|
-
);
|
|
35
|
-
const [hues, setHues] = useState<(number | null)[]>(() =>
|
|
36
|
-
Array(tabs.length).fill(null),
|
|
37
|
-
);
|
|
38
|
-
const { isMobile, isTablet } = useBreakpoints();
|
|
39
|
-
useMediaQuery("(max-width: 767px)");
|
|
40
|
-
const touchStartX = useRef<number | null>(null);
|
|
41
|
-
const prevActiveRef = useRef<number>(0);
|
|
42
|
-
|
|
43
|
-
// Records the current slide before switching so only the entering and leaving slides animate.
|
|
44
|
-
const navigate = (next: number) => {
|
|
45
|
-
prevActiveRef.current = activeTab;
|
|
46
|
-
setActiveTab(next);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// Extracts the dominant hue from a loaded image via colorthief and stores it as an HSL color string.
|
|
50
|
-
const extractColor = (img: HTMLImageElement, index: number) => {
|
|
51
|
-
try {
|
|
52
|
-
const result = getColorSync(img);
|
|
53
|
-
if (result) {
|
|
54
|
-
const { h } = result.hsl();
|
|
55
|
-
setColors((prev) => {
|
|
56
|
-
const next = [...prev];
|
|
57
|
-
next[index] = `hsl(${h}, 40%, 40%)`;
|
|
58
|
-
return next;
|
|
59
|
-
});
|
|
60
|
-
setHues((prev) => {
|
|
61
|
-
const next = [...prev];
|
|
62
|
-
next[index] = h;
|
|
63
|
-
return next;
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
} catch {
|
|
67
|
-
// CORS or extraction failure — skip
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
// Returns the shortest-path offset (in slide widths) from the active slide to slide i,
|
|
72
|
-
// wrapping around the ends so navigation always travels the shortest visual direction.
|
|
73
|
-
const slideOffset = (i: number) => {
|
|
74
|
-
let offset = i - activeTab;
|
|
75
|
-
if (offset > tabs.length / 2) offset -= tabs.length;
|
|
76
|
-
if (offset < -tabs.length / 2) offset += tabs.length;
|
|
77
|
-
return offset;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// Records the X position where a touch begins.
|
|
81
|
-
const handleTouchStart = (e: React.TouchEvent) => {
|
|
82
|
-
touchStartX.current = e.touches[0].clientX;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// Navigates to the next or previous slide if the horizontal swipe distance exceeds 50px.
|
|
86
|
-
const handleTouchEnd = (e: React.TouchEvent) => {
|
|
87
|
-
if (touchStartX.current === null) return;
|
|
88
|
-
const diff = touchStartX.current - e.changedTouches[0].clientX;
|
|
89
|
-
if (Math.abs(diff) > 50) {
|
|
90
|
-
navigate(
|
|
91
|
-
diff > 0
|
|
92
|
-
? (activeTab + 1) % tabs.length
|
|
93
|
-
: (activeTab - 1 + tabs.length) % tabs.length,
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
touchStartX.current = null;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
return (
|
|
100
|
-
<div
|
|
101
|
-
className={styles.heroWrap}
|
|
102
|
-
onTouchStart={handleTouchStart}
|
|
103
|
-
onTouchEnd={handleTouchEnd}
|
|
104
|
-
{...rest}
|
|
105
|
-
>
|
|
106
|
-
<div className={styles.slideshow}>
|
|
107
|
-
{tabs.map((tab, i) => (
|
|
108
|
-
<div
|
|
109
|
-
key={i}
|
|
110
|
-
className={styles.slide}
|
|
111
|
-
style={
|
|
112
|
-
isMobile
|
|
113
|
-
? {
|
|
114
|
-
position: "absolute",
|
|
115
|
-
inset: 0,
|
|
116
|
-
width: "100%",
|
|
117
|
-
height: "100%",
|
|
118
|
-
transform: `translateX(${slideOffset(i) * 100}%)`,
|
|
119
|
-
transition:
|
|
120
|
-
i === activeTab || i === prevActiveRef.current
|
|
121
|
-
? "transform 0.6s ease"
|
|
122
|
-
: "none",
|
|
123
|
-
}
|
|
124
|
-
: {
|
|
125
|
-
position: "absolute",
|
|
126
|
-
inset: 0,
|
|
127
|
-
width: "100%",
|
|
128
|
-
height: "100%",
|
|
129
|
-
opacity: i === activeTab ? 1 : 0,
|
|
130
|
-
transition: "opacity 0.6s ease",
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
>
|
|
134
|
-
<Image
|
|
135
|
-
src={tab.src}
|
|
136
|
-
alt={tab.alt ?? ""}
|
|
137
|
-
fill
|
|
138
|
-
style={{ objectFit: "cover" }}
|
|
139
|
-
priority={i === 0}
|
|
140
|
-
crossOrigin="anonymous"
|
|
141
|
-
onLoad={(e) =>
|
|
142
|
-
extractColor(e.currentTarget as HTMLImageElement, i)
|
|
143
|
-
}
|
|
144
|
-
/>
|
|
145
|
-
</div>
|
|
146
|
-
))}
|
|
147
|
-
</div>
|
|
148
|
-
|
|
149
|
-
{tabs.map((_, i) => (
|
|
150
|
-
<div
|
|
151
|
-
key={i}
|
|
152
|
-
className={styles.gradient}
|
|
153
|
-
style={{
|
|
154
|
-
background: `linear-gradient(to top, ${colors[i] ?? "transparent"} 0%, transparent 100%)`,
|
|
155
|
-
opacity: i === activeTab ? 1 : 0,
|
|
156
|
-
transition: "opacity 0.6s ease",
|
|
157
|
-
}}
|
|
158
|
-
/>
|
|
159
|
-
))}
|
|
160
|
-
|
|
161
|
-
{tabs.map((tab, i) =>
|
|
162
|
-
tab.cta ? (
|
|
163
|
-
<div
|
|
164
|
-
key={i}
|
|
165
|
-
className={styles.contentCTA}
|
|
166
|
-
style={{
|
|
167
|
-
opacity: i === activeTab ? 1 : 0,
|
|
168
|
-
pointerEvents: i === activeTab ? "auto" : "none",
|
|
169
|
-
transition: "opacity 0.6s ease",
|
|
170
|
-
}}
|
|
171
|
-
>
|
|
172
|
-
<h1>{tab.cta.title}</h1>
|
|
173
|
-
<h4 className={styles.ctaText}>{tab.cta.text}</h4>
|
|
174
|
-
<Link href={tab.cta.href} style={{ textDecoration: "none" }}>
|
|
175
|
-
<Button
|
|
176
|
-
text
|
|
177
|
-
rippleColor={
|
|
178
|
-
hues[i] !== null ? `hsl(${hues[i]}, 90%, 20%)` : undefined
|
|
179
|
-
}
|
|
180
|
-
style={
|
|
181
|
-
{
|
|
182
|
-
background:
|
|
183
|
-
hues[i] !== null
|
|
184
|
-
? `linear-gradient(135deg, hsl(${hues[i]}, 80%, 80%), color-mix(in srgb, hsl(${hues[i]}, 80%, 80%) 50%, white))`
|
|
185
|
-
: undefined,
|
|
186
|
-
color:
|
|
187
|
-
hues[i] !== null
|
|
188
|
-
? `hsl(${hues[i]}, 90%, 20%)`
|
|
189
|
-
: undefined,
|
|
190
|
-
boxShadow: "0 2px 4px rgba(0,0,0,0.2)",
|
|
191
|
-
} as React.CSSProperties
|
|
192
|
-
}
|
|
193
|
-
>
|
|
194
|
-
<Icon systemName={tab.cta.icon} label={tab.cta.btn} />
|
|
195
|
-
</Button>
|
|
196
|
-
</Link>
|
|
197
|
-
</div>
|
|
198
|
-
) : null,
|
|
199
|
-
)}
|
|
200
|
-
|
|
201
|
-
<div className={styles.indicators}>
|
|
202
|
-
<button
|
|
203
|
-
className={styles.arrowBtn}
|
|
204
|
-
onClick={() => navigate((activeTab - 1 + tabs.length) % tabs.length)}
|
|
205
|
-
aria-label="Previous slide"
|
|
206
|
-
>
|
|
207
|
-
<Icon
|
|
208
|
-
iconStyle={{ color: "white" }}
|
|
209
|
-
systemName="keyboard_arrow_left"
|
|
210
|
-
/>
|
|
211
|
-
</button>
|
|
212
|
-
{tabs.map((_, i) => (
|
|
213
|
-
<button
|
|
214
|
-
key={i}
|
|
215
|
-
className={`${styles.dot} ${i === activeTab ? styles.dotActive : ""}`}
|
|
216
|
-
onClick={() => navigate(i)}
|
|
217
|
-
aria-label={`Slide ${i + 1}`}
|
|
218
|
-
/>
|
|
219
|
-
))}
|
|
220
|
-
<button
|
|
221
|
-
className={styles.arrowBtn}
|
|
222
|
-
onClick={() => navigate((activeTab + 1) % tabs.length)}
|
|
223
|
-
aria-label="Next slide"
|
|
224
|
-
>
|
|
225
|
-
<Icon
|
|
226
|
-
iconStyle={{ color: "white" }}
|
|
227
|
-
systemName="keyboard_arrow_right"
|
|
228
|
-
/>
|
|
229
|
-
</button>
|
|
230
|
-
</div>
|
|
231
|
-
</div>
|
|
232
|
-
);
|
|
233
|
-
}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/* ── Accessibility: Show Borders ──────────────────────────────────────── */
|
|
2
|
-
:global([data-show-borders="true"]) .accModLi {
|
|
3
|
-
border: var(--a11y-border) !important;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.accModLi {
|
|
7
|
-
display: flex;
|
|
8
|
-
justify-content: space-between;
|
|
9
|
-
align-items: center;
|
|
10
|
-
padding: 12px 0 12px 10px;
|
|
11
|
-
overflow: hidden;
|
|
12
|
-
transition: padding var(--transition-expressive-fast);
|
|
13
|
-
&:not(:last-child) {
|
|
14
|
-
border-bottom: 1px solid var(--globalUIBorder);
|
|
15
|
-
}
|
|
16
|
-
&.hidden {
|
|
17
|
-
padding: 0;
|
|
18
|
-
transition: padding var(--transition-expressive-fast);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.accModSettings {
|
|
23
|
-
list-style: none;
|
|
24
|
-
padding: 0 12px;
|
|
25
|
-
margin: 0;
|
|
26
|
-
display: flex;
|
|
27
|
-
border-radius: 24px;
|
|
28
|
-
flex-direction: column;
|
|
29
|
-
background-color: var(--md-sys-color-surface-container-lowest);
|
|
30
|
-
overflow: hidden;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/* ── Font-size slider row ────────────────────────────── */
|
|
34
|
-
.fontSizeSliderRow {
|
|
35
|
-
display: flex;
|
|
36
|
-
flex-direction: row;
|
|
37
|
-
align-items: center;
|
|
38
|
-
justify-content: flex-start;
|
|
39
|
-
gap: 16px;
|
|
40
|
-
width: 100%;
|
|
41
|
-
max-height: 74px;
|
|
42
|
-
opacity: 1;
|
|
43
|
-
pointer-events: auto;
|
|
44
|
-
transition:
|
|
45
|
-
opacity var(--transition-expressive-fast),
|
|
46
|
-
max-height var(--transition-expressive-fast);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.hidden .fontSizeSliderRow {
|
|
50
|
-
max-height: 0;
|
|
51
|
-
opacity: 0;
|
|
52
|
-
pointer-events: none;
|
|
53
|
-
transition:
|
|
54
|
-
opacity var(--transition-expressive-fast),
|
|
55
|
-
max-height var(--transition-expressive-fast);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.hidden {
|
|
59
|
-
border-bottom: 1px solid transparent;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.fontSizeALg {
|
|
63
|
-
font-size: 1.25rem;
|
|
64
|
-
font-weight: 600;
|
|
65
|
-
color: var(--md-sys-color-outline);
|
|
66
|
-
line-height: 1;
|
|
67
|
-
flex-shrink: 0;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.fontSizeSliderWrap {
|
|
71
|
-
flex: 1;
|
|
72
|
-
display: flex;
|
|
73
|
-
flex-direction: column;
|
|
74
|
-
gap: 4px;
|
|
75
|
-
padding-top: 24px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.fontSizeSlider {
|
|
79
|
-
-webkit-appearance: none;
|
|
80
|
-
appearance: none;
|
|
81
|
-
width: 100%;
|
|
82
|
-
height: 4px;
|
|
83
|
-
border-radius: 99px;
|
|
84
|
-
background: var(--md-sys-color-surface-container-highest);
|
|
85
|
-
outline: none;
|
|
86
|
-
cursor: pointer;
|
|
87
|
-
accent-color: var(--md-sys-color-primary);
|
|
88
|
-
}
|
|
89
|
-
.fontSizeSlider::-webkit-slider-thumb {
|
|
90
|
-
-webkit-appearance: none;
|
|
91
|
-
appearance: none;
|
|
92
|
-
width: 24px;
|
|
93
|
-
transform-origin: center;
|
|
94
|
-
height: 16px;
|
|
95
|
-
border-radius: 50px;
|
|
96
|
-
background: var(--md-sys-color-primary);
|
|
97
|
-
cursor: pointer;
|
|
98
|
-
transition: transform var(--transition-expressive-fast);
|
|
99
|
-
}
|
|
100
|
-
.fontSizeSlider::-webkit-slider-thumb:hover,
|
|
101
|
-
.fontSizeSlider::-webkit-slider-thumb:active {
|
|
102
|
-
transform: scale(1.5);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.fontSizeSlider::-moz-range-thumb {
|
|
106
|
-
width: 20px;
|
|
107
|
-
height: 20px;
|
|
108
|
-
border: none;
|
|
109
|
-
border-radius: 50%;
|
|
110
|
-
background: var(--md-sys-color-primary);
|
|
111
|
-
cursor: pointer;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.fontSizeLabels {
|
|
115
|
-
display: flex;
|
|
116
|
-
justify-content: space-between;
|
|
117
|
-
font-size: 0.65rem;
|
|
118
|
-
color: var(--md-sys-color-outline);
|
|
119
|
-
padding: 0 0.2rem 0 0.4rem;
|
|
120
|
-
user-select: none;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.fontSizeLabelActive {
|
|
124
|
-
color: var(--md-sys-color-primary);
|
|
125
|
-
font-weight: 600;
|
|
126
|
-
}
|
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React, { useState, useEffect, useCallback } from "react";
|
|
3
|
-
import Alert from "../alert/Alert";
|
|
4
|
-
import Icon from "@/components/tools/icon/icon";
|
|
5
|
-
import styles from "./AccessibilityModal.module.css";
|
|
6
|
-
import Switch from "../../../tools/switch/Switch";
|
|
7
|
-
|
|
8
|
-
// Defined outside the component — same array reference across all renders.
|
|
9
|
-
const STOPS = [16, 18, 20, 24] as const;
|
|
10
|
-
type FontSize = (typeof STOPS)[number];
|
|
11
|
-
|
|
12
|
-
interface AccModProps {
|
|
13
|
-
isOpen: boolean;
|
|
14
|
-
onSave?: (data: {
|
|
15
|
-
contrast: "none" | "medium";
|
|
16
|
-
largerText: boolean;
|
|
17
|
-
fontSize: FontSize;
|
|
18
|
-
reduceMotion: boolean;
|
|
19
|
-
showBorders: boolean;
|
|
20
|
-
disableBrightness: boolean;
|
|
21
|
-
}) => void;
|
|
22
|
-
onCancel?: () => void;
|
|
23
|
-
contrast?: "none" | "medium";
|
|
24
|
-
largerText?: boolean;
|
|
25
|
-
fontSize?: FontSize;
|
|
26
|
-
reduceMotion?: boolean;
|
|
27
|
-
showBorders?: boolean;
|
|
28
|
-
disableBrightness?: boolean;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default function AccessibilityModal({
|
|
32
|
-
isOpen,
|
|
33
|
-
onSave,
|
|
34
|
-
onCancel,
|
|
35
|
-
contrast = "none",
|
|
36
|
-
largerText = false,
|
|
37
|
-
fontSize = 16,
|
|
38
|
-
reduceMotion = false,
|
|
39
|
-
showBorders = false,
|
|
40
|
-
disableBrightness = false,
|
|
41
|
-
}: AccModProps) {
|
|
42
|
-
const [draftContrast, setDraftContrast] = useState<"none" | "medium">(
|
|
43
|
-
contrast,
|
|
44
|
-
);
|
|
45
|
-
const [draftLargerText, setDraftLargerText] = useState(largerText);
|
|
46
|
-
const [draftReduceMotion, setDraftReduceMotion] = useState(reduceMotion);
|
|
47
|
-
const [draftShowBorders, setDraftShowBorders] = useState(showBorders);
|
|
48
|
-
const [draftDisableBrightness, setDraftDisableBrightness] =
|
|
49
|
-
useState(disableBrightness);
|
|
50
|
-
const [localIndex, setLocalIndex] = useState<number>(
|
|
51
|
-
Math.max(0, STOPS.indexOf(fontSize)),
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
// Re-sync draft state from committed props every time the modal opens.
|
|
55
|
-
// All prop values are included in the dependency array — no eslint suppression needed.
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
if (!isOpen) return;
|
|
58
|
-
setDraftContrast(contrast);
|
|
59
|
-
setDraftLargerText(largerText);
|
|
60
|
-
setDraftReduceMotion(reduceMotion);
|
|
61
|
-
setDraftShowBorders(showBorders);
|
|
62
|
-
setDraftDisableBrightness(disableBrightness);
|
|
63
|
-
setLocalIndex(Math.max(0, STOPS.indexOf(fontSize)));
|
|
64
|
-
document.documentElement.style.setProperty(
|
|
65
|
-
"--font-size-base",
|
|
66
|
-
`${fontSize}px`,
|
|
67
|
-
);
|
|
68
|
-
}, [
|
|
69
|
-
isOpen,
|
|
70
|
-
contrast,
|
|
71
|
-
largerText,
|
|
72
|
-
reduceMotion,
|
|
73
|
-
showBorders,
|
|
74
|
-
disableBrightness,
|
|
75
|
-
fontSize,
|
|
76
|
-
]);
|
|
77
|
-
|
|
78
|
-
const handleSliderChange = useCallback(
|
|
79
|
-
(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
80
|
-
const idx = Number(e.target.value);
|
|
81
|
-
setLocalIndex(idx);
|
|
82
|
-
document.documentElement.style.setProperty(
|
|
83
|
-
"--font-size-base",
|
|
84
|
-
`${STOPS[idx]}px`,
|
|
85
|
-
);
|
|
86
|
-
},
|
|
87
|
-
[],
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
const handleLargerTextChange = useCallback(
|
|
91
|
-
(on: boolean) => {
|
|
92
|
-
setDraftLargerText(on);
|
|
93
|
-
document.documentElement.style.setProperty(
|
|
94
|
-
"--font-size-base",
|
|
95
|
-
on ? `${STOPS[localIndex]}px` : `${fontSize}px`,
|
|
96
|
-
);
|
|
97
|
-
},
|
|
98
|
-
[localIndex, fontSize],
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
const handleContrastChange = useCallback((on: boolean) => {
|
|
102
|
-
setDraftContrast(on ? "medium" : "none");
|
|
103
|
-
}, []);
|
|
104
|
-
|
|
105
|
-
const handleSave = useCallback(() => {
|
|
106
|
-
onSave?.({
|
|
107
|
-
contrast: draftContrast,
|
|
108
|
-
largerText: draftLargerText,
|
|
109
|
-
fontSize: draftLargerText ? STOPS[localIndex] : 16,
|
|
110
|
-
reduceMotion: draftReduceMotion,
|
|
111
|
-
showBorders: draftShowBorders,
|
|
112
|
-
disableBrightness: draftDisableBrightness,
|
|
113
|
-
});
|
|
114
|
-
}, [
|
|
115
|
-
onSave,
|
|
116
|
-
draftContrast,
|
|
117
|
-
draftLargerText,
|
|
118
|
-
localIndex,
|
|
119
|
-
draftReduceMotion,
|
|
120
|
-
draftShowBorders,
|
|
121
|
-
draftDisableBrightness,
|
|
122
|
-
]);
|
|
123
|
-
|
|
124
|
-
const handleCancel = useCallback(() => {
|
|
125
|
-
document.documentElement.style.setProperty(
|
|
126
|
-
"--font-size-base",
|
|
127
|
-
`${fontSize}px`,
|
|
128
|
-
);
|
|
129
|
-
onCancel?.();
|
|
130
|
-
}, [onCancel, fontSize]);
|
|
131
|
-
|
|
132
|
-
return (
|
|
133
|
-
<Alert
|
|
134
|
-
title=""
|
|
135
|
-
submit={{ label: "Save settings" }}
|
|
136
|
-
cancel={{ label: "Cancel" }}
|
|
137
|
-
onSubmit={handleSave}
|
|
138
|
-
onCancel={handleCancel}
|
|
139
|
-
isPresented={isOpen}
|
|
140
|
-
padding={4}
|
|
141
|
-
style={{
|
|
142
|
-
background:
|
|
143
|
-
"linear-gradient(to bottom, color-mix(var(--md-sys-color-secondary-container) 50%, var(--md-sys-color-surface-container-lowest) 50%) 0%, var(--md-sys-color-surface-container-low) 100%)",
|
|
144
|
-
}}
|
|
145
|
-
>
|
|
146
|
-
<div style={{ display: "flex", flexDirection: "column", gap: "12px" }}>
|
|
147
|
-
<span
|
|
148
|
-
style={{
|
|
149
|
-
borderRadius: "24px",
|
|
150
|
-
padding: "14px 18px",
|
|
151
|
-
backgroundColor: "var(--md-sys-color-secondary-container)",
|
|
152
|
-
border: "1px solid var(--globalUIBorderCard)",
|
|
153
|
-
color: "var(--md-sys-color-on-surface-variant)",
|
|
154
|
-
}}
|
|
155
|
-
>
|
|
156
|
-
<span
|
|
157
|
-
style={{
|
|
158
|
-
backgroundColor: "var(--md-sys-color-surface-container-lowest)",
|
|
159
|
-
color: "var(--md-sys-color-secondary)",
|
|
160
|
-
display: "flex",
|
|
161
|
-
alignItems: "center",
|
|
162
|
-
justifyContent: "center",
|
|
163
|
-
width: "60px",
|
|
164
|
-
height: "60px",
|
|
165
|
-
margin: "4px 0 12px 0",
|
|
166
|
-
borderRadius: "50%",
|
|
167
|
-
}}
|
|
168
|
-
>
|
|
169
|
-
<Icon
|
|
170
|
-
systemName="accessibility_new"
|
|
171
|
-
iconStyle={{ fontSize: "36px" }}
|
|
172
|
-
/>
|
|
173
|
-
</span>
|
|
174
|
-
<h3
|
|
175
|
-
style={{
|
|
176
|
-
fontWeight: 600,
|
|
177
|
-
color: "var(--md-sys-color-on-surface)",
|
|
178
|
-
}}
|
|
179
|
-
>
|
|
180
|
-
Accessibility
|
|
181
|
-
</h3>
|
|
182
|
-
Personalise your experience in ways that work best for you with
|
|
183
|
-
accessibility settings for vision and motion.
|
|
184
|
-
</span>
|
|
185
|
-
<div>
|
|
186
|
-
<p
|
|
187
|
-
style={{
|
|
188
|
-
fontWeight: 500,
|
|
189
|
-
padding: "8px 0 0 20px",
|
|
190
|
-
color: "var(--md-sys-color-outline)",
|
|
191
|
-
}}
|
|
192
|
-
>
|
|
193
|
-
Vision
|
|
194
|
-
</p>
|
|
195
|
-
<ul className={styles.accModSettings}>
|
|
196
|
-
<li className={styles.accModLi}>
|
|
197
|
-
Increase contrast
|
|
198
|
-
<Switch
|
|
199
|
-
checked={draftContrast === "medium"}
|
|
200
|
-
onChange={handleContrastChange}
|
|
201
|
-
/>
|
|
202
|
-
</li>
|
|
203
|
-
<li className={styles.accModLi}>
|
|
204
|
-
Show borders
|
|
205
|
-
<Switch
|
|
206
|
-
checked={draftShowBorders}
|
|
207
|
-
onChange={setDraftShowBorders}
|
|
208
|
-
/>
|
|
209
|
-
</li>
|
|
210
|
-
<li className={styles.accModLi}>
|
|
211
|
-
Disable brightness effect
|
|
212
|
-
<Switch
|
|
213
|
-
checked={draftDisableBrightness}
|
|
214
|
-
onChange={setDraftDisableBrightness}
|
|
215
|
-
/>
|
|
216
|
-
</li>
|
|
217
|
-
</ul>
|
|
218
|
-
</div>
|
|
219
|
-
<ul className={styles.accModSettings}>
|
|
220
|
-
<li
|
|
221
|
-
style={{
|
|
222
|
-
borderBottom: !draftLargerText
|
|
223
|
-
? "1px solid transparent"
|
|
224
|
-
: undefined,
|
|
225
|
-
}}
|
|
226
|
-
className={styles.accModLi}
|
|
227
|
-
>
|
|
228
|
-
Larger text
|
|
229
|
-
<Switch
|
|
230
|
-
checked={draftLargerText}
|
|
231
|
-
onChange={handleLargerTextChange}
|
|
232
|
-
/>
|
|
233
|
-
</li>
|
|
234
|
-
<li
|
|
235
|
-
className={`${styles.accModLi} ${!draftLargerText ? styles.hidden : ""}`}
|
|
236
|
-
>
|
|
237
|
-
<div className={styles.fontSizeSliderRow}>
|
|
238
|
-
<Icon className="textIcon" systemName="text_decrease" />
|
|
239
|
-
<div className={styles.fontSizeSliderWrap}>
|
|
240
|
-
<input
|
|
241
|
-
type="range"
|
|
242
|
-
min={0}
|
|
243
|
-
max={4}
|
|
244
|
-
step={1}
|
|
245
|
-
value={localIndex}
|
|
246
|
-
onChange={handleSliderChange}
|
|
247
|
-
className={styles.fontSizeSlider}
|
|
248
|
-
aria-label="Font size"
|
|
249
|
-
/>
|
|
250
|
-
<div className={styles.fontSizeLabels}>
|
|
251
|
-
{STOPS.map((s, i) => (
|
|
252
|
-
<span
|
|
253
|
-
key={s}
|
|
254
|
-
className={
|
|
255
|
-
localIndex === i ? styles.fontSizeLabelActive : ""
|
|
256
|
-
}
|
|
257
|
-
>
|
|
258
|
-
{s}
|
|
259
|
-
</span>
|
|
260
|
-
))}
|
|
261
|
-
</div>
|
|
262
|
-
</div>
|
|
263
|
-
<Icon className="textIcon" systemName="text_increase" />
|
|
264
|
-
</div>
|
|
265
|
-
</li>
|
|
266
|
-
</ul>
|
|
267
|
-
<div>
|
|
268
|
-
<p
|
|
269
|
-
style={{
|
|
270
|
-
fontWeight: 500,
|
|
271
|
-
padding: "8px 0 0 20px",
|
|
272
|
-
color: "var(--md-sys-color-outline)",
|
|
273
|
-
}}
|
|
274
|
-
>
|
|
275
|
-
Motion
|
|
276
|
-
</p>
|
|
277
|
-
<ul className={styles.accModSettings}>
|
|
278
|
-
<li className={styles.accModLi}>
|
|
279
|
-
Reduce motion
|
|
280
|
-
<Switch
|
|
281
|
-
checked={draftReduceMotion}
|
|
282
|
-
onChange={setDraftReduceMotion}
|
|
283
|
-
/>
|
|
284
|
-
</li>
|
|
285
|
-
</ul>
|
|
286
|
-
</div>
|
|
287
|
-
</div>
|
|
288
|
-
</Alert>
|
|
289
|
-
);
|
|
290
|
-
}
|