@yamatozhen/design_system 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +101 -0
- package/package.json +49 -0
- package/scripts/postinstall.js +105 -0
- package/template/app/ClientNav.tsx +310 -0
- package/template/app/globals.css +167 -0
- package/template/app/layout.tsx +128 -0
- package/template/app/themes/dark-mc.css +51 -0
- package/template/app/themes/dark.css +51 -0
- package/template/app/themes/light-mc.css +51 -0
- package/template/app/themes/light.css +51 -0
- package/template/app/themes/theme.css +82 -0
- package/template/components/layout/Lightbox/LightboxCard.tsx +100 -0
- package/template/components/layout/Lightbox/LightboxGallery.module.css +249 -0
- package/template/components/layout/Lightbox/LightboxGallery.tsx +72 -0
- package/template/components/layout/Lightbox/LightboxGrid.tsx +186 -0
- package/template/components/layout/Lightbox/LightboxModal.module.css +395 -0
- package/template/components/layout/Lightbox/LightboxModal.tsx +500 -0
- package/template/components/layout/Lightbox/demo.tsx +412 -0
- package/template/components/layout/Lightbox/index.ts +30 -0
- package/template/components/layout/Lightbox/types.ts +113 -0
- package/template/components/layout/Lightbox/useLightboxFilters.ts +140 -0
- package/template/components/layout/accordion/Accordion.module.css +149 -0
- package/template/components/layout/accordion/Accordion.tsx +114 -0
- package/template/components/layout/button/Button.module.css +305 -0
- package/template/components/layout/button/ButtonGroup.tsx +503 -0
- package/template/components/layout/button/FAB.tsx +118 -0
- package/template/components/layout/button/button.tsx +128 -0
- package/template/components/layout/button/drop.module.css +229 -0
- package/template/components/layout/button/drop.tsx +516 -0
- package/template/components/layout/hero/v1/heroSlideshow.module.css +107 -0
- package/template/components/layout/hero/v1/heroSlideshow.tsx +233 -0
- package/template/components/layout/modals/accessibilityModal/AccessibilityModal.module.css +126 -0
- package/template/components/layout/modals/accessibilityModal/AccessibilityModal.tsx +290 -0
- package/template/components/layout/modals/alert/Alert.tsx +188 -0
- package/template/components/layout/navigation/MioCard.module.css +88 -0
- package/template/components/layout/navigation/MioCard.tsx +266 -0
- package/template/components/layout/navigation/Wrap.tsx +41 -0
- package/template/components/layout/navigation/nav/Nav.module.css +508 -0
- package/template/components/layout/navigation/nav/Nav.tsx +167 -0
- package/template/components/layout/navigation/nav/NavBar.tsx +419 -0
- package/template/components/layout/navigation/nav/NavContext.tsx +259 -0
- package/template/components/layout/navigation/nav/NavItem.tsx +173 -0
- package/template/components/layout/navigation/nav/NavNew.module.css +373 -0
- package/template/components/layout/navigation/nav/NavRail.tsx +315 -0
- package/template/components/layout/navigation/nav/NavSection.tsx +102 -0
- package/template/components/layout/navigation/nav/NavTab.tsx +25 -0
- package/template/components/layout/navigation/nav/navftb/NavFTB.module.css +252 -0
- package/template/components/layout/navigation/nav/navftb/NavFTB.tsx +399 -0
- package/template/components/layout/navigation/nav/navftb/useTabIndicator.ts +484 -0
- package/template/components/layout/navigation/nav/navheader/NavHeader.module.css +59 -0
- package/template/components/layout/navigation/nav/navheader/NavHeader.tsx +478 -0
- package/template/components/layout/pages/loadingScreen.tsx +102 -0
- package/template/components/layout/pages/maintenance/Maintenance.tsx +53 -0
- package/template/components/layout/pages/maintenance/maintenance.module.css +163 -0
- package/template/components/layout/switch/Switch.module.css +102 -0
- package/template/components/layout/switch/Switch.tsx +48 -0
- package/template/components/tools/Divider.tsx +11 -0
- package/template/components/tools/ProgressiveBlur.tsx +73 -0
- package/template/components/tools/ReduceMotionContext.tsx +5 -0
- package/template/components/tools/Sinewave.tsx +199 -0
- package/template/components/tools/SinewaveProgress.tsx +135 -0
- package/template/components/tools/badge/Badge.tsx +28 -0
- package/template/components/tools/flubber.d.ts +7 -0
- package/template/components/tools/icon/SocialIcons.tsx +88 -0
- package/template/components/tools/icon/icon.module.css +0 -0
- package/template/components/tools/icon/icon.tsx +125 -0
- package/template/components/tools/mobileViewProvider.tsx +58 -0
- package/template/components/tools/react-bits/ClickSpark.tsx +177 -0
- package/template/components/tools/react-bits/FadeContent.tsx +90 -0
- package/template/components/tools/react-bits/GlareHover.tsx +73 -0
- package/template/components/tools/react-bits/GradientText/GradientText.css +70 -0
- package/template/components/tools/react-bits/GradientText/GradientText.tsx +44 -0
- package/template/components/tools/react-bits/Magnet.tsx +118 -0
- package/template/components/tools/react-bits/Stepper/Stepper.css +134 -0
- package/template/components/tools/react-bits/Stepper/Stepper.tsx +412 -0
- package/template/components/tools/ripple/ripple.css +41 -0
- package/template/components/tools/ripple/ripple.tsx +53 -0
- package/template/components/tools/shape/ShapeLoader.tsx +101 -0
- package/template/components/tools/shape/ShapeMorph.tsx +190 -0
- package/template/components/tools/shape/ShapePaths.ts +116 -0
- package/template/components/tools/switch/Switch.module.css +102 -0
- package/template/components/tools/switch/Switch.tsx +48 -0
- package/template/components/tools/useBodyScrollLock.tsx +27 -0
- package/template/components/tools/useImageColor.ts +47 -0
- package/template/components/tools/useNavSheetDrag.tsx +196 -0
- package/template/public/fonts/material-symbols/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght.woff2 +0 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, {
|
|
4
|
+
useContext,
|
|
5
|
+
useMemo,
|
|
6
|
+
useState,
|
|
7
|
+
useRef,
|
|
8
|
+
useEffect,
|
|
9
|
+
useCallback,
|
|
10
|
+
} from "react";
|
|
11
|
+
import { useRouter, usePathname } from "next/navigation";
|
|
12
|
+
import styles from "./NavNew.module.css";
|
|
13
|
+
import Icon from "@/components/tools/icon/icon";
|
|
14
|
+
import Button from "../../button/button";
|
|
15
|
+
import {
|
|
16
|
+
NavRailProps,
|
|
17
|
+
NavItemProps,
|
|
18
|
+
NavTabInfo,
|
|
19
|
+
NavRailContext,
|
|
20
|
+
NavRailMenuContext,
|
|
21
|
+
NavRailMenuContextValue,
|
|
22
|
+
useNav,
|
|
23
|
+
useCollapseOnOutsideInteraction,
|
|
24
|
+
} from "./NavContext";
|
|
25
|
+
import NavItem from "./NavItem";
|
|
26
|
+
import FAB from "../../button/FAB";
|
|
27
|
+
|
|
28
|
+
const NavRail: React.FC<NavRailProps> = function NavRail({
|
|
29
|
+
accessibilityAriaLabel,
|
|
30
|
+
accessibilityOnClick,
|
|
31
|
+
themeOnClick,
|
|
32
|
+
theme,
|
|
33
|
+
children,
|
|
34
|
+
isExpanded,
|
|
35
|
+
onToggleExpanded,
|
|
36
|
+
style,
|
|
37
|
+
}) {
|
|
38
|
+
useNav();
|
|
39
|
+
const railCtx = useContext(NavRailContext);
|
|
40
|
+
const isMobileCtx = railCtx?.isMobile ?? false;
|
|
41
|
+
const onCollapseCtx = railCtx?.onCollapse;
|
|
42
|
+
|
|
43
|
+
const router = useRouter();
|
|
44
|
+
const pathname = usePathname();
|
|
45
|
+
|
|
46
|
+
// TypeScript-safe child narrowing — compares against NavItem directly,
|
|
47
|
+
// same reference as Nav.Item after Object.assign in Nav.tsx.
|
|
48
|
+
type NavItemElement = React.ReactElement<NavItemProps, typeof NavItem>;
|
|
49
|
+
|
|
50
|
+
const navItems = useMemo(
|
|
51
|
+
() =>
|
|
52
|
+
React.Children.toArray(
|
|
53
|
+
React.isValidElement(children) && children.type === React.Fragment
|
|
54
|
+
? (children.props as { children: React.ReactNode }).children
|
|
55
|
+
: children,
|
|
56
|
+
).filter(
|
|
57
|
+
(child): child is NavItemElement =>
|
|
58
|
+
React.isValidElement(child) && child.type === NavItem,
|
|
59
|
+
),
|
|
60
|
+
[children],
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
// Derive defaultPath inside useMemo so the hook count is always consistent.
|
|
64
|
+
const defaultPath = useMemo(() => {
|
|
65
|
+
const defaultItems = navItems.filter((item) => item.props.default === true);
|
|
66
|
+
if (process.env.NODE_ENV !== "production") {
|
|
67
|
+
if (defaultItems.length === 0)
|
|
68
|
+
console.error(
|
|
69
|
+
"Nav.Rail: exactly one Nav.Item must have default={true}.",
|
|
70
|
+
);
|
|
71
|
+
else if (defaultItems.length > 1)
|
|
72
|
+
console.error("Nav.Rail: only one Nav.Item may have default={true}.");
|
|
73
|
+
const item = defaultItems[0];
|
|
74
|
+
if (item && !item.props.path)
|
|
75
|
+
console.error(
|
|
76
|
+
"Nav.Rail: the default Nav.Item must have a 'path' prop for root redirect.",
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
return defaultItems[0]?.props.path ?? "";
|
|
80
|
+
}, [navItems]);
|
|
81
|
+
|
|
82
|
+
// Only redirect when landing at root AND the default path is not itself "/",
|
|
83
|
+
// preventing an infinite redirect loop when home IS the root route.
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (pathname === "/" && defaultPath && defaultPath !== "/")
|
|
86
|
+
router.replace(defaultPath);
|
|
87
|
+
}, [pathname, defaultPath, router]);
|
|
88
|
+
|
|
89
|
+
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
90
|
+
// enabled=!isMobileCtx: only register when Rail is actually visible.
|
|
91
|
+
useCollapseOnOutsideInteraction(
|
|
92
|
+
isExpanded,
|
|
93
|
+
onCollapseCtx ?? (() => {}),
|
|
94
|
+
wrapperRef,
|
|
95
|
+
!isMobileCtx,
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
// ── Sub-tab menu state ─────────────────────────────────────────────────
|
|
99
|
+
const [menuState, setMenuState] = useState<{
|
|
100
|
+
activeItemPath: string | null;
|
|
101
|
+
activeMenuItemId: string | null;
|
|
102
|
+
tabs: NavTabInfo[];
|
|
103
|
+
expanded: boolean;
|
|
104
|
+
}>({
|
|
105
|
+
activeItemPath: null,
|
|
106
|
+
activeMenuItemId: null,
|
|
107
|
+
tabs: [],
|
|
108
|
+
expanded: false,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// Stable refs so the callback never captures stale values.
|
|
112
|
+
const menuStateRef = useRef(menuState);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
menuStateRef.current = menuState;
|
|
115
|
+
}, [menuState]);
|
|
116
|
+
|
|
117
|
+
const isExpandedRef = useRef(isExpanded);
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
isExpandedRef.current = isExpanded;
|
|
120
|
+
}, [isExpanded]);
|
|
121
|
+
|
|
122
|
+
const pendingMenuOpenRef = useRef<{
|
|
123
|
+
itemId: string;
|
|
124
|
+
itemPath: string | null;
|
|
125
|
+
tabs: NavTabInfo[];
|
|
126
|
+
} | null>(null);
|
|
127
|
+
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
if (!isExpanded) return;
|
|
130
|
+
const pending = pendingMenuOpenRef.current;
|
|
131
|
+
if (!pending) return;
|
|
132
|
+
|
|
133
|
+
const rafId = window.requestAnimationFrame(() => {
|
|
134
|
+
setMenuState({
|
|
135
|
+
activeItemPath: pending.itemPath,
|
|
136
|
+
activeMenuItemId: pending.itemId,
|
|
137
|
+
tabs: pending.tabs,
|
|
138
|
+
expanded: true,
|
|
139
|
+
});
|
|
140
|
+
pendingMenuOpenRef.current = null;
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
return () => window.cancelAnimationFrame(rafId);
|
|
144
|
+
}, [isExpanded]);
|
|
145
|
+
|
|
146
|
+
// When the rail collapses externally, also close the sub-tab menu.
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
if (!isExpanded) {
|
|
149
|
+
pendingMenuOpenRef.current = null;
|
|
150
|
+
setMenuState((prev) =>
|
|
151
|
+
prev.expanded
|
|
152
|
+
? { ...prev, expanded: false, activeMenuItemId: null }
|
|
153
|
+
: prev,
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
}, [isExpanded]);
|
|
157
|
+
|
|
158
|
+
const onItemActivated = useCallback(
|
|
159
|
+
(itemId: string, itemPath: string | null, tabs: NavTabInfo[]) => {
|
|
160
|
+
if (tabs.length > 0) {
|
|
161
|
+
if (!menuStateRef.current.expanded) {
|
|
162
|
+
// Menu was closed → open it; also expand rail if collapsed.
|
|
163
|
+
if (!isExpandedRef.current) {
|
|
164
|
+
pendingMenuOpenRef.current = { itemId, itemPath, tabs };
|
|
165
|
+
onToggleExpanded();
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
setMenuState({
|
|
169
|
+
activeItemPath: itemPath,
|
|
170
|
+
activeMenuItemId: itemId,
|
|
171
|
+
tabs,
|
|
172
|
+
expanded: true,
|
|
173
|
+
});
|
|
174
|
+
} else {
|
|
175
|
+
// Menu already open → swap tab list only (no CSS transition fires).
|
|
176
|
+
setMenuState({
|
|
177
|
+
activeItemPath: itemPath,
|
|
178
|
+
activeMenuItemId: itemId,
|
|
179
|
+
tabs,
|
|
180
|
+
expanded: true,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
} else {
|
|
184
|
+
// Item carries no tabs → collapse the menu.
|
|
185
|
+
pendingMenuOpenRef.current = null;
|
|
186
|
+
setMenuState({
|
|
187
|
+
activeItemPath: null,
|
|
188
|
+
activeMenuItemId: null,
|
|
189
|
+
tabs: [],
|
|
190
|
+
expanded: false,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
[onToggleExpanded],
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
const railMenuContextValue = useMemo<NavRailMenuContextValue>(
|
|
198
|
+
() => ({
|
|
199
|
+
onItemActivated,
|
|
200
|
+
activeMenuItemId: menuState.activeMenuItemId,
|
|
201
|
+
}),
|
|
202
|
+
[onItemActivated, menuState.activeMenuItemId],
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<NavRailMenuContext.Provider value={railMenuContextValue}>
|
|
207
|
+
<div ref={wrapperRef} style={{ ...style }}>
|
|
208
|
+
<div
|
|
209
|
+
className={`${styles.navRailMenu} ${menuState.expanded ? styles.navRailExpanded : ""}`}
|
|
210
|
+
>
|
|
211
|
+
<ul>
|
|
212
|
+
{menuState.tabs.map((tab) => (
|
|
213
|
+
<li
|
|
214
|
+
key={tab.path}
|
|
215
|
+
className={
|
|
216
|
+
pathname === tab.path ? styles.navTabActive : undefined
|
|
217
|
+
}
|
|
218
|
+
onClick={() => router.push(tab.path)}
|
|
219
|
+
onKeyDown={(e) => {
|
|
220
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
221
|
+
e.preventDefault();
|
|
222
|
+
router.push(tab.path);
|
|
223
|
+
}
|
|
224
|
+
}}
|
|
225
|
+
role="button"
|
|
226
|
+
tabIndex={0}
|
|
227
|
+
>
|
|
228
|
+
{tab.label}
|
|
229
|
+
</li>
|
|
230
|
+
))}
|
|
231
|
+
</ul>
|
|
232
|
+
</div>
|
|
233
|
+
<aside
|
|
234
|
+
className={`${styles.navRail} ${isExpanded ? styles.navRailExpanded : ""}`}
|
|
235
|
+
>
|
|
236
|
+
<div
|
|
237
|
+
style={{
|
|
238
|
+
display: "flex",
|
|
239
|
+
flexDirection: "column",
|
|
240
|
+
gap: 12,
|
|
241
|
+
padding: "0 12px",
|
|
242
|
+
}}
|
|
243
|
+
>
|
|
244
|
+
<div
|
|
245
|
+
className={`${styles.navRailMenuButtonWrapper} ${isExpanded ? styles.navRailExpanded : ""}`}
|
|
246
|
+
>
|
|
247
|
+
<Button
|
|
248
|
+
onClick={onToggleExpanded}
|
|
249
|
+
type="button"
|
|
250
|
+
style={{ width: 44, marginRight: isExpanded ? 0 : 4 }}
|
|
251
|
+
text
|
|
252
|
+
aria-label={
|
|
253
|
+
isExpanded ? "Collapse navigation" : "Expand navigation"
|
|
254
|
+
}
|
|
255
|
+
>
|
|
256
|
+
<Icon systemName={isExpanded ? "menu_open" : "menu"} />
|
|
257
|
+
</Button>
|
|
258
|
+
</div>
|
|
259
|
+
<FAB
|
|
260
|
+
systemName="search"
|
|
261
|
+
label={isExpanded ? "Search" : undefined}
|
|
262
|
+
sm
|
|
263
|
+
primary-bold
|
|
264
|
+
/>
|
|
265
|
+
</div>
|
|
266
|
+
<div
|
|
267
|
+
className={`${styles.navRailScrollContainer} ${isExpanded ? styles.navRailExpanded : ""}`}
|
|
268
|
+
>
|
|
269
|
+
<nav
|
|
270
|
+
className={`${styles.navItemsContainer} ${isExpanded ? styles.navRailExpanded : ""}`}
|
|
271
|
+
>
|
|
272
|
+
{children}
|
|
273
|
+
</nav>
|
|
274
|
+
|
|
275
|
+
<div className={styles.navRailBottomButtons}>
|
|
276
|
+
{accessibilityAriaLabel && accessibilityOnClick && (
|
|
277
|
+
<Button
|
|
278
|
+
outlined
|
|
279
|
+
aria-label={accessibilityAriaLabel}
|
|
280
|
+
onClick={accessibilityOnClick}
|
|
281
|
+
style={{ padding: 6, minWidth: 44, height: 44 }}
|
|
282
|
+
>
|
|
283
|
+
<Icon
|
|
284
|
+
systemName="settings_accessibility"
|
|
285
|
+
label={isExpanded ? "Accessibility" : undefined}
|
|
286
|
+
/>
|
|
287
|
+
</Button>
|
|
288
|
+
)}
|
|
289
|
+
|
|
290
|
+
<Button
|
|
291
|
+
outlined
|
|
292
|
+
aria-label="Light / Dark mode toggle"
|
|
293
|
+
onClick={themeOnClick}
|
|
294
|
+
style={{ padding: 6, minWidth: 44, height: 44 }}
|
|
295
|
+
>
|
|
296
|
+
<Icon
|
|
297
|
+
systemName={theme === "dark" ? "light_mode" : "dark_mode"}
|
|
298
|
+
label={
|
|
299
|
+
isExpanded
|
|
300
|
+
? theme === "dark"
|
|
301
|
+
? "Light mode"
|
|
302
|
+
: "Dark mode"
|
|
303
|
+
: undefined
|
|
304
|
+
}
|
|
305
|
+
/>
|
|
306
|
+
</Button>
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
</aside>
|
|
310
|
+
</div>
|
|
311
|
+
</NavRailMenuContext.Provider>
|
|
312
|
+
);
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
export default NavRail;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, { useContext, useMemo } from "react";
|
|
4
|
+
import styles from "./Nav.module.css";
|
|
5
|
+
import { NavSectionProps, useNav, NavRailContext } from "./NavContext";
|
|
6
|
+
import {
|
|
7
|
+
BREAKPOINTS,
|
|
8
|
+
useBreakpoints,
|
|
9
|
+
useMediaQuery,
|
|
10
|
+
} from "@/components/tools/mobileViewProvider";
|
|
11
|
+
|
|
12
|
+
const NavSection: React.FC<NavSectionProps> = function NavSection({
|
|
13
|
+
children,
|
|
14
|
+
variant = "opaque",
|
|
15
|
+
direction = "column",
|
|
16
|
+
title,
|
|
17
|
+
comment,
|
|
18
|
+
fullWidth = false,
|
|
19
|
+
style,
|
|
20
|
+
}) {
|
|
21
|
+
useNav();
|
|
22
|
+
const railCtx = useContext(NavRailContext);
|
|
23
|
+
const { isMobile, isTablet } = useBreakpoints();
|
|
24
|
+
railCtx?.isMobile ?? false;
|
|
25
|
+
const sectionStyle = useMemo<React.CSSProperties>(() => {
|
|
26
|
+
const baseBorder =
|
|
27
|
+
variant == "bordered" ? "1px solid var(--globalUIBorderCard)" : "none";
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
flexDirection: isMobile ? "column" : direction,
|
|
31
|
+
margin: "24px 0",
|
|
32
|
+
backgroundColor:
|
|
33
|
+
isMobile ||
|
|
34
|
+
variant == "transparent" ||
|
|
35
|
+
variant == "bordered" ||
|
|
36
|
+
variant == "gradient"
|
|
37
|
+
? "transparent"
|
|
38
|
+
: variant == "opaque"
|
|
39
|
+
? "var(--md-sys-color-surface-container-low)"
|
|
40
|
+
: "",
|
|
41
|
+
backgroundImage:
|
|
42
|
+
!isMobile && variant == "gradient"
|
|
43
|
+
? "linear-gradient(to bottom, var(--md-sys-color-surface-container-low) 0%, transparent 100%)"
|
|
44
|
+
: undefined,
|
|
45
|
+
borderTop:
|
|
46
|
+
variant == "gradient" && !isMobile
|
|
47
|
+
? "1px solid var(--md-sys-color-surface-container-high)"
|
|
48
|
+
: baseBorder,
|
|
49
|
+
borderRight: baseBorder,
|
|
50
|
+
borderBottom: baseBorder,
|
|
51
|
+
borderLeft: baseBorder,
|
|
52
|
+
padding: isMobile ? "12px" : isTablet ? "24px" : "60px",
|
|
53
|
+
...style,
|
|
54
|
+
};
|
|
55
|
+
}, [isMobile, isTablet, direction, variant, style]);
|
|
56
|
+
return (
|
|
57
|
+
<>
|
|
58
|
+
{title && (
|
|
59
|
+
<h4
|
|
60
|
+
style={{
|
|
61
|
+
fontWeight: 500,
|
|
62
|
+
width: "100%",
|
|
63
|
+
display: "flex",
|
|
64
|
+
alignItems: "flex-start",
|
|
65
|
+
padding: "36px 36px 0 36px",
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
{title}
|
|
69
|
+
</h4>
|
|
70
|
+
)}
|
|
71
|
+
<div className={styles.navSection} style={sectionStyle}>
|
|
72
|
+
<div
|
|
73
|
+
style={{
|
|
74
|
+
display: "flex",
|
|
75
|
+
flexDirection: "column",
|
|
76
|
+
width: "100%",
|
|
77
|
+
maxWidth: isMobile || fullWidth ? "100%" : "1080px",
|
|
78
|
+
gap: "60px",
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
{children}
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
{comment && (
|
|
85
|
+
<p
|
|
86
|
+
style={{
|
|
87
|
+
width: "100%",
|
|
88
|
+
fontSize: "0.8rem",
|
|
89
|
+
color: "var(--md-sys-color-outline)",
|
|
90
|
+
display: "flex",
|
|
91
|
+
alignItems: "flex-start",
|
|
92
|
+
padding: "0 36px 36px 36px",
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
{comment}
|
|
96
|
+
</p>
|
|
97
|
+
)}
|
|
98
|
+
</>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default NavSection;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { memo, useContext } from "react";
|
|
4
|
+
import { NavItemContext, NavTabProps } from "./NavContext";
|
|
5
|
+
|
|
6
|
+
// Nav.Tab: pure data-carrier. Renders null.
|
|
7
|
+
// Data is lifted by Nav.Item's useMemo and forwarded to Nav.Rail's menu.
|
|
8
|
+
const NavTab = memo(function NavTab({ path, label }: NavTabProps) {
|
|
9
|
+
const ctx = useContext(NavItemContext);
|
|
10
|
+
if (!ctx && process.env.NODE_ENV !== "production") {
|
|
11
|
+
console.error(
|
|
12
|
+
"Nav.Tab must be used within Nav.Item. " +
|
|
13
|
+
"Found a Nav.Tab with no parent Nav.Item context.",
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
if (process.env.NODE_ENV !== "production") {
|
|
17
|
+
if (!path)
|
|
18
|
+
console.warn("Nav.Tab: 'path' prop is required and must not be empty.");
|
|
19
|
+
if (!label)
|
|
20
|
+
console.warn("Nav.Tab: 'label' prop is required and must not be empty.");
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export default NavTab;
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/* ── Sentinel ────────────────────────────────────────────────────────────── */
|
|
2
|
+
.FTBsentinel {
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 0;
|
|
5
|
+
margin: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
user-select: none;
|
|
9
|
+
/* clears the chrome when scrollIntoView fires on tab change. Mirrors
|
|
10
|
+
marginHeader in NavFTB.tsx minus 2px: 12px (no header) or 68px
|
|
11
|
+
(Nav.Header present) — keep the two in sync. Indirected through a
|
|
12
|
+
custom property (rather than a plain [data-header] override) so this
|
|
13
|
+
axis can't out-specificity the mobile media query below. */
|
|
14
|
+
--sentinel-margin: 10px;
|
|
15
|
+
scroll-margin-top: var(--sentinel-margin);
|
|
16
|
+
}
|
|
17
|
+
.FTBsentinel[data-header] {
|
|
18
|
+
--sentinel-margin: 66px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Marks the bottom edge of the whole FTB block, so `elevated` can be measured
|
|
22
|
+
against it and turned back off once the block has scrolled out of view. */
|
|
23
|
+
.FTBendSentinel {
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 0;
|
|
26
|
+
margin: 0;
|
|
27
|
+
padding: 0;
|
|
28
|
+
pointer-events: none;
|
|
29
|
+
user-select: none;
|
|
30
|
+
}
|
|
31
|
+
@media (max-width: 1024px) {
|
|
32
|
+
.FTBsentinel {
|
|
33
|
+
scroll-margin-top: 28px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* ── Root / body ─────────────────────────────────────────────────────────── */
|
|
38
|
+
/* No overflow here so the elevated box-shadow renders; clipping of the
|
|
39
|
+
indicator squash happens on .FTBscroller. Size morph is owned by Framer
|
|
40
|
+
`layout`, so max-width is intentionally NOT in the transition list. */
|
|
41
|
+
.FTBRoot {
|
|
42
|
+
position: sticky;
|
|
43
|
+
/* Mirrors marginHeader in NavFTB.tsx minus 2px: 12px (no header) or 68px
|
|
44
|
+
(Nav.Header present) — keep the two in sync (see .FTBsentinel above). */
|
|
45
|
+
top: 10px;
|
|
46
|
+
z-index: 990;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
width: 100%;
|
|
49
|
+
max-width: 100%;
|
|
50
|
+
height: 72px;
|
|
51
|
+
border-radius: 60px;
|
|
52
|
+
border: 1px solid transparent;
|
|
53
|
+
background-color: var(--md-sys-color-surface-container-low);
|
|
54
|
+
box-shadow: none;
|
|
55
|
+
filter: blur(0px);
|
|
56
|
+
transition:
|
|
57
|
+
background-color var(--transition-expressive-color),
|
|
58
|
+
border-color var(--transition-expressive-color),
|
|
59
|
+
box-shadow var(--transition-expressive-color),
|
|
60
|
+
visibility var(--transition-expressive-color),
|
|
61
|
+
filter var(--transition-expressive-color);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.FTBRoot[data-header] {
|
|
65
|
+
top: 66px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.FTBRoot[data-embedded] {
|
|
69
|
+
position: relative;
|
|
70
|
+
top: 10px;
|
|
71
|
+
border: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* borders: elevated, or a resting in-section bar */
|
|
75
|
+
.FTBRoot[data-elevated],
|
|
76
|
+
.FTBRoot[data-section]:not([data-embedded]) {
|
|
77
|
+
border-color: var(--globalUIBorderCard);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* background: resting in-section desktop bar drops to the lowest surface.
|
|
81
|
+
Elevated outranks this — when both apply, excluding [data-elevated] here
|
|
82
|
+
lets it fall through to the base -low default below instead. inSection on
|
|
83
|
+
mobile also falls through to -low the same way (mobile isn't matched here). */
|
|
84
|
+
.FTBRoot[data-section]:not([data-elevated]):not([data-mobile]):not(
|
|
85
|
+
[data-embedded]
|
|
86
|
+
) {
|
|
87
|
+
background-color: var(--md-sys-color-surface-container-lowest);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* background: the mobile/tablet mirror copy stays transparent — it sits
|
|
91
|
+
inside Nav.Bar's own surface, so it shouldn't paint one of its own. */
|
|
92
|
+
.FTBRoot[data-mobile][data-embedded] {
|
|
93
|
+
background-color: transparent;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* elevated lift */
|
|
97
|
+
.FTBRoot[data-elevated]:not([data-embedded]) {
|
|
98
|
+
box-shadow:
|
|
99
|
+
0 1px 1px rgba(0, 0, 0, 0.1),
|
|
100
|
+
0 2px 2px rgba(0, 0, 0, 0.1),
|
|
101
|
+
0 4px 4px rgba(0, 0, 0, 0.1);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* elevated width: desktop pins to the 1080 platform column; tablet/mobile fill */
|
|
105
|
+
@media (min-width: 1025px) {
|
|
106
|
+
.FTBRoot[data-elevated]:not([data-embedded]) {
|
|
107
|
+
max-width: 1080px;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* mobile elevated → the real bar hides; the NavBar mirror takes over */
|
|
112
|
+
.FTBRoot[data-elevated][data-mobile]:not([data-embedded]) {
|
|
113
|
+
visibility: hidden;
|
|
114
|
+
filter: blur(12px);
|
|
115
|
+
-webkit-filter: blur(12px);
|
|
116
|
+
pointer-events: none;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* ── Scroller (scroll + clip + offsetParent for the engine) ──────────────── */
|
|
120
|
+
.FTBscroller {
|
|
121
|
+
position: relative;
|
|
122
|
+
display: flex;
|
|
123
|
+
flex-direction: row;
|
|
124
|
+
align-items: center;
|
|
125
|
+
box-sizing: border-box;
|
|
126
|
+
margin: 0;
|
|
127
|
+
/* one declaration does scroll + containment: x scrolls, y is clipped, and
|
|
128
|
+
the inherited radius rounds the indicator's squash against the pill. */
|
|
129
|
+
overflow: auto hidden;
|
|
130
|
+
border-radius: inherit;
|
|
131
|
+
touch-action: pan-x;
|
|
132
|
+
/* resting (non-elevated, desktop): bleed 24px wider, shifted -12, so the end
|
|
133
|
+
tabs get symmetric edge area. */
|
|
134
|
+
width: calc(100% + 24px);
|
|
135
|
+
transform: translateX(-12px);
|
|
136
|
+
padding: 7px 19px;
|
|
137
|
+
scrollbar-width: none;
|
|
138
|
+
-ms-overflow-style: none;
|
|
139
|
+
}
|
|
140
|
+
.FTBscroller::-webkit-scrollbar {
|
|
141
|
+
display: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* flush 100% (no bleed) when mobile, embedded, or elevated */
|
|
145
|
+
.FTBRoot[data-mobile] .FTBscroller,
|
|
146
|
+
.FTBRoot[data-embedded] .FTBscroller,
|
|
147
|
+
.FTBRoot[data-elevated]:not([data-embedded]) .FTBscroller {
|
|
148
|
+
width: 100%;
|
|
149
|
+
transform: translateX(0);
|
|
150
|
+
padding: 7px 8px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* ── Indicator (width + transform are written imperatively by the engine) ── */
|
|
154
|
+
.FTBindicator {
|
|
155
|
+
position: absolute;
|
|
156
|
+
top: 7px;
|
|
157
|
+
left: 0;
|
|
158
|
+
height: 56px;
|
|
159
|
+
border-radius: 60px;
|
|
160
|
+
box-sizing: border-box;
|
|
161
|
+
background: var(--md-sys-color-primary-container);
|
|
162
|
+
border: 1px solid var(--globalUIBorderCard);
|
|
163
|
+
pointer-events: none;
|
|
164
|
+
transform-origin: center center;
|
|
165
|
+
will-change: transform;
|
|
166
|
+
z-index: 0;
|
|
167
|
+
filter: brightness(1);
|
|
168
|
+
transition: filter var(--transition-expressive-color);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.FTBscroller:has(.tab[aria-selected="true"]:hover) .FTBindicator,
|
|
172
|
+
.FTBscroller:has(.tab[aria-selected="true"]:active) .FTBindicator {
|
|
173
|
+
filter: var(--filterBrightness);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* ── Tabs (flex-fill; was fixed 126px when elevated) ─────────────────────── */
|
|
177
|
+
.tab {
|
|
178
|
+
position: relative;
|
|
179
|
+
z-index: 1;
|
|
180
|
+
display: flex;
|
|
181
|
+
flex: 1 1 0;
|
|
182
|
+
align-items: center;
|
|
183
|
+
justify-content: center;
|
|
184
|
+
box-sizing: border-box;
|
|
185
|
+
height: 56px;
|
|
186
|
+
min-width: 96px;
|
|
187
|
+
border-radius: 36px;
|
|
188
|
+
cursor: pointer;
|
|
189
|
+
user-select: none;
|
|
190
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
191
|
+
filter: brightness(1);
|
|
192
|
+
transition:
|
|
193
|
+
color 200ms ease,
|
|
194
|
+
filter var(--transition-expressive-color),
|
|
195
|
+
background-color var(--transition-expressive-color);
|
|
196
|
+
}
|
|
197
|
+
.tab[aria-selected="true"] {
|
|
198
|
+
color: var(--md-sys-color-on-primary-container);
|
|
199
|
+
}
|
|
200
|
+
.tab:hover,
|
|
201
|
+
.tab:active {
|
|
202
|
+
filter: var(--filterBrightness);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.FTBRoot[data-mobile] .tab,
|
|
206
|
+
.FTBRoot[data-embedded] .tab {
|
|
207
|
+
min-width: 72px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.tabInactive {
|
|
211
|
+
transition:
|
|
212
|
+
filter var(--transition-expressive-color),
|
|
213
|
+
background-color var(--transition-expressive-color);
|
|
214
|
+
}
|
|
215
|
+
.tabInactive:hover {
|
|
216
|
+
background-color: var(--globalUIBorderCard);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* ── Top fade scrim ──────────────────────────────────────────────────────── */
|
|
220
|
+
.FTBfade {
|
|
221
|
+
position: fixed;
|
|
222
|
+
inset: 0 0 auto 0;
|
|
223
|
+
height: 120px;
|
|
224
|
+
background: linear-gradient(
|
|
225
|
+
to bottom,
|
|
226
|
+
var(--sys-background) 0%,
|
|
227
|
+
transparent 100%
|
|
228
|
+
);
|
|
229
|
+
pointer-events: none;
|
|
230
|
+
z-index: 99;
|
|
231
|
+
opacity: 0;
|
|
232
|
+
transition:
|
|
233
|
+
opacity var(--transition-expressive-color),
|
|
234
|
+
background var(--transition-expressive-color);
|
|
235
|
+
}
|
|
236
|
+
.FTBfade[data-mobile] {
|
|
237
|
+
height: 200px;
|
|
238
|
+
}
|
|
239
|
+
/* Only the desktop, header-less sticky bar needs this scrim: Nav.Header
|
|
240
|
+
already paints its own top gradient, and mobile mirrors into Nav.Bar
|
|
241
|
+
instead of keeping the real bar on screen. */
|
|
242
|
+
.FTBfade[data-elevated]:not([data-header]):not([data-mobile]) {
|
|
243
|
+
opacity: 1;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* ── Accessibility: Show Borders ──────────────────────────────────────────── */
|
|
247
|
+
:global([data-show-borders="true"]) .FTBindicator {
|
|
248
|
+
border: var(--a11y-border) !important;
|
|
249
|
+
}
|
|
250
|
+
:global([data-show-borders="true"]) .FTBRoot:not([data-embedded]) {
|
|
251
|
+
border: var(--a11y-border) !important;
|
|
252
|
+
}
|