@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,516 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, {
|
|
4
|
+
createContext,
|
|
5
|
+
useContext,
|
|
6
|
+
useEffect,
|
|
7
|
+
useLayoutEffect,
|
|
8
|
+
useRef,
|
|
9
|
+
useState,
|
|
10
|
+
} from "react";
|
|
11
|
+
import { motion, AnimatePresence, easeInOut } from "framer-motion";
|
|
12
|
+
import Icon from "@/components/tools/icon/icon";
|
|
13
|
+
import styles from "./drop.module.css";
|
|
14
|
+
|
|
15
|
+
// ---------------- motion ----------------
|
|
16
|
+
const EASE_EXPRESSIVE = [0.01, 1.25, 0.23, 1.01] as const;
|
|
17
|
+
const MORPH = { duration: 0.6, ease: EASE_EXPRESSIVE };
|
|
18
|
+
const EASE_EXPRESSIVE_FAST = [0.55, 0.57, 0, 1.58] as const;
|
|
19
|
+
const MORPH_2 = { duration: 0.6, ease: EASE_EXPRESSIVE_FAST };
|
|
20
|
+
|
|
21
|
+
// ---------------- variants (same shape as button.tsx) ----------------
|
|
22
|
+
type Variant =
|
|
23
|
+
| "primary"
|
|
24
|
+
| "secondary"
|
|
25
|
+
| "tertiary"
|
|
26
|
+
| "outlined"
|
|
27
|
+
| "text"
|
|
28
|
+
| "link";
|
|
29
|
+
|
|
30
|
+
type VariantBools = {
|
|
31
|
+
primary?: boolean;
|
|
32
|
+
secondary?: boolean;
|
|
33
|
+
tertiary?: boolean;
|
|
34
|
+
outlined?: boolean;
|
|
35
|
+
text?: boolean;
|
|
36
|
+
link?: boolean;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
function resolveVariant(p: VariantBools): Variant {
|
|
40
|
+
if (p.primary) return "primary";
|
|
41
|
+
if (p.secondary) return "secondary";
|
|
42
|
+
if (p.tertiary) return "tertiary";
|
|
43
|
+
if (p.outlined) return "outlined";
|
|
44
|
+
if (p.text) return "text";
|
|
45
|
+
if (p.link) return "link";
|
|
46
|
+
return "primary";
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// ---------------- types ----------------
|
|
50
|
+
type ItemProps = {
|
|
51
|
+
systemName?: string;
|
|
52
|
+
label?: string;
|
|
53
|
+
href?: string;
|
|
54
|
+
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
55
|
+
/** Makes the item selectable (toggles active instead of closing the menu). */
|
|
56
|
+
toggle?: boolean;
|
|
57
|
+
/** Starts active. In exclusive mode only the first default wins. */
|
|
58
|
+
default?: boolean;
|
|
59
|
+
children?: React.ReactNode;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
type MenuNode = {
|
|
63
|
+
kind: "item" | "raw";
|
|
64
|
+
key: string;
|
|
65
|
+
id: string; // stable path id, used for active tracking across nesting
|
|
66
|
+
element?: React.ReactElement; // for "raw" passthrough (e.g. <Divider/>)
|
|
67
|
+
systemName?: string;
|
|
68
|
+
label?: string;
|
|
69
|
+
href?: string;
|
|
70
|
+
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
71
|
+
toggle?: boolean;
|
|
72
|
+
default?: boolean;
|
|
73
|
+
children: MenuNode[];
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// ---------------- declarative item ----------------
|
|
77
|
+
function Item(_props: ItemProps) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
Item.displayName = "Drop.Item";
|
|
81
|
+
|
|
82
|
+
function buildModel(children: React.ReactNode, prefix = ""): MenuNode[] {
|
|
83
|
+
return React.Children.toArray(children)
|
|
84
|
+
.filter((c): c is React.ReactElement => React.isValidElement(c))
|
|
85
|
+
.map((c, i) => {
|
|
86
|
+
const key = c.key != null ? String(c.key) : String(i);
|
|
87
|
+
const id = prefix ? `${prefix}/${key}` : key;
|
|
88
|
+
|
|
89
|
+
// Anything that isn't a Drop.Item (e.g. <Divider/>) renders in place.
|
|
90
|
+
if (c.type !== Item) {
|
|
91
|
+
return { kind: "raw", key, id, element: c, children: [] };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const p = c.props as ItemProps;
|
|
95
|
+
return {
|
|
96
|
+
kind: "item",
|
|
97
|
+
key,
|
|
98
|
+
id,
|
|
99
|
+
systemName: p.systemName,
|
|
100
|
+
label: p.label,
|
|
101
|
+
href: p.href,
|
|
102
|
+
onClick: p.onClick,
|
|
103
|
+
toggle: p.toggle,
|
|
104
|
+
default: p.default,
|
|
105
|
+
children: buildModel(p.children, id),
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// ---------------- context ----------------
|
|
111
|
+
type MenuContextValue = {
|
|
112
|
+
submenuIcon: string;
|
|
113
|
+
activeIcon: string;
|
|
114
|
+
openSubmenuIndex: number | null;
|
|
115
|
+
openSubmenu: (index: number, el: HTMLElement | null) => void;
|
|
116
|
+
closeSubmenu: () => void;
|
|
117
|
+
closeAll: () => void;
|
|
118
|
+
isActive: (id: string) => boolean;
|
|
119
|
+
toggleActive: (id: string) => void;
|
|
120
|
+
};
|
|
121
|
+
const MenuContext = createContext<MenuContextValue | null>(null);
|
|
122
|
+
|
|
123
|
+
// ---------------- rows ----------------
|
|
124
|
+
function LeafRow({ node }: { node: MenuNode }) {
|
|
125
|
+
const ctx = useContext(MenuContext)!;
|
|
126
|
+
const active = !!node.toggle && ctx.isActive(node.id);
|
|
127
|
+
|
|
128
|
+
const handle = (e: React.MouseEvent<HTMLElement>) => {
|
|
129
|
+
if (node.toggle) {
|
|
130
|
+
ctx.toggleActive(node.id);
|
|
131
|
+
node.onClick?.(e);
|
|
132
|
+
return; // selection — keep the menu open
|
|
133
|
+
}
|
|
134
|
+
node.onClick?.(e);
|
|
135
|
+
ctx.closeAll();
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// Active → swap to (or add) the check icon, and drop the no-icon indent.
|
|
139
|
+
const iconName = active ? ctx.activeIcon : node.systemName;
|
|
140
|
+
const noIcon = active ? false : !node.systemName;
|
|
141
|
+
const inner = <Icon systemName={iconName} label={node.label} />;
|
|
142
|
+
|
|
143
|
+
// Real links navigate; toggles are buttons.
|
|
144
|
+
return node.href && !node.toggle ? (
|
|
145
|
+
<a
|
|
146
|
+
className={styles.row}
|
|
147
|
+
data-noicon={noIcon || undefined}
|
|
148
|
+
data-active={active || undefined}
|
|
149
|
+
href={node.href}
|
|
150
|
+
onClick={handle}
|
|
151
|
+
>
|
|
152
|
+
{inner}
|
|
153
|
+
</a>
|
|
154
|
+
) : (
|
|
155
|
+
<button
|
|
156
|
+
type="button"
|
|
157
|
+
className={styles.row}
|
|
158
|
+
data-noicon={noIcon || undefined}
|
|
159
|
+
data-active={active || undefined}
|
|
160
|
+
aria-pressed={node.toggle ? active : undefined}
|
|
161
|
+
onClick={handle}
|
|
162
|
+
>
|
|
163
|
+
{inner}
|
|
164
|
+
</button>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function SubmenuTriggerRow({ node, index }: { node: MenuNode; index: number }) {
|
|
169
|
+
const ctx = useContext(MenuContext)!;
|
|
170
|
+
const ref = useRef<HTMLButtonElement>(null);
|
|
171
|
+
const isOpen = ctx.openSubmenuIndex === index;
|
|
172
|
+
return (
|
|
173
|
+
<button
|
|
174
|
+
ref={ref}
|
|
175
|
+
type="button"
|
|
176
|
+
className={styles.row}
|
|
177
|
+
data-noicon={!node.systemName || undefined}
|
|
178
|
+
aria-haspopup="menu"
|
|
179
|
+
aria-expanded={isOpen}
|
|
180
|
+
onClick={() => ctx.openSubmenu(index, ref.current)}
|
|
181
|
+
>
|
|
182
|
+
<Icon systemName={node.systemName} label={node.label} />
|
|
183
|
+
<span className={styles.chev}>
|
|
184
|
+
<Icon systemName={ctx.submenuIcon} />
|
|
185
|
+
</span>
|
|
186
|
+
</button>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Static mirror of a row, used only inside the hidden width measurer.
|
|
191
|
+
function MeasureRow({ node, chevIcon }: { node: MenuNode; chevIcon: string }) {
|
|
192
|
+
return (
|
|
193
|
+
<div className={styles.row} data-noicon={!node.systemName || undefined}>
|
|
194
|
+
<Icon systemName={node.systemName} label={node.label} />
|
|
195
|
+
{node.children.length > 0 && (
|
|
196
|
+
<span className={styles.chev}>
|
|
197
|
+
<Icon systemName={chevIcon} />
|
|
198
|
+
</span>
|
|
199
|
+
)}
|
|
200
|
+
</div>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ---------------- Menu ----------------
|
|
205
|
+
type DropMenuProps = {
|
|
206
|
+
systemName?: string;
|
|
207
|
+
label?: string;
|
|
208
|
+
submenuIcon?: string;
|
|
209
|
+
submenuOpenIcon?: string;
|
|
210
|
+
/** Icon shown on active/toggled items (default: check_small). */
|
|
211
|
+
activeIcon?: string;
|
|
212
|
+
/** Only one item active at a time (default true), like ButtonGroup. */
|
|
213
|
+
exclusive?: boolean;
|
|
214
|
+
/** Inverse of exclusive. If both set, this wins. */
|
|
215
|
+
multiSelect?: boolean;
|
|
216
|
+
children: React.ReactNode;
|
|
217
|
+
} & VariantBools;
|
|
218
|
+
|
|
219
|
+
function DropMenu({
|
|
220
|
+
systemName,
|
|
221
|
+
label,
|
|
222
|
+
submenuIcon = "chevron_right",
|
|
223
|
+
submenuOpenIcon = "expand_more",
|
|
224
|
+
activeIcon = "check_small",
|
|
225
|
+
exclusive = true,
|
|
226
|
+
multiSelect,
|
|
227
|
+
children,
|
|
228
|
+
...variantBools
|
|
229
|
+
}: DropMenuProps) {
|
|
230
|
+
const variant = resolveVariant(variantBools);
|
|
231
|
+
const model = buildModel(children);
|
|
232
|
+
const isExclusive = multiSelect !== undefined ? !multiSelect : exclusive;
|
|
233
|
+
|
|
234
|
+
const [open, setOpen] = useState(false);
|
|
235
|
+
const [openSubmenuIndex, setOpenSubmenuIndex] = useState<number | null>(null);
|
|
236
|
+
const [submenuTop, setSubmenuTop] = useState(0);
|
|
237
|
+
|
|
238
|
+
// ---- active / toggle state (keyed by stable id) ----
|
|
239
|
+
const [activeIds, setActiveIds] = useState<Set<string>>(() => {
|
|
240
|
+
const defaults = new Set<string>();
|
|
241
|
+
const walk = (nodes: MenuNode[]) =>
|
|
242
|
+
nodes.forEach((n) => {
|
|
243
|
+
if (n.default && !(isExclusive && defaults.size > 0))
|
|
244
|
+
defaults.add(n.id);
|
|
245
|
+
walk(n.children);
|
|
246
|
+
});
|
|
247
|
+
walk(model);
|
|
248
|
+
return defaults;
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
const isActive = (id: string) => activeIds.has(id);
|
|
252
|
+
const toggleActive = (id: string) => {
|
|
253
|
+
setActiveIds((prev) => {
|
|
254
|
+
const next = new Set(prev);
|
|
255
|
+
const was = next.has(id);
|
|
256
|
+
if (was && isExclusive) return prev; // can't unset the active one in exclusive
|
|
257
|
+
if (was) next.delete(id);
|
|
258
|
+
else {
|
|
259
|
+
if (isExclusive) next.clear();
|
|
260
|
+
next.add(id);
|
|
261
|
+
}
|
|
262
|
+
return next;
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const rootRef = useRef<HTMLDivElement>(null);
|
|
267
|
+
|
|
268
|
+
// ---- width measurement ----
|
|
269
|
+
const closedRef = useRef<HTMLDivElement>(null); // in-flow spacer = collapsed width
|
|
270
|
+
const measureRef = useRef<HTMLDivElement>(null); // offscreen clone = expanded width
|
|
271
|
+
const [closedW, setClosedW] = useState(0);
|
|
272
|
+
const [openW, setOpenW] = useState(0);
|
|
273
|
+
|
|
274
|
+
useLayoutEffect(() => {
|
|
275
|
+
const update = () => {
|
|
276
|
+
if (closedRef.current) setClosedW(closedRef.current.offsetWidth);
|
|
277
|
+
if (measureRef.current) setOpenW(measureRef.current.offsetWidth);
|
|
278
|
+
};
|
|
279
|
+
update();
|
|
280
|
+
const ro = new ResizeObserver(update);
|
|
281
|
+
if (closedRef.current) ro.observe(closedRef.current);
|
|
282
|
+
if (measureRef.current) ro.observe(measureRef.current);
|
|
283
|
+
return () => ro.disconnect();
|
|
284
|
+
}, []);
|
|
285
|
+
|
|
286
|
+
const closeAll = () => {
|
|
287
|
+
setOpenSubmenuIndex(null);
|
|
288
|
+
setOpen(false);
|
|
289
|
+
};
|
|
290
|
+
const closeSubmenu = () => setOpenSubmenuIndex(null);
|
|
291
|
+
|
|
292
|
+
const openSubmenu = (index: number, el: HTMLElement | null) => {
|
|
293
|
+
const root = rootRef.current;
|
|
294
|
+
if (el && root) {
|
|
295
|
+
setSubmenuTop(
|
|
296
|
+
el.getBoundingClientRect().top - root.getBoundingClientRect().top,
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
setOpenSubmenuIndex(index);
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
useEffect(() => {
|
|
303
|
+
if (!open) return;
|
|
304
|
+
const onDown = (e: MouseEvent) => {
|
|
305
|
+
if (rootRef.current && !rootRef.current.contains(e.target as Node))
|
|
306
|
+
closeAll();
|
|
307
|
+
};
|
|
308
|
+
const onKey = (e: KeyboardEvent) => {
|
|
309
|
+
if (e.key !== "Escape") return;
|
|
310
|
+
if (openSubmenuIndex != null) closeSubmenu();
|
|
311
|
+
else closeAll();
|
|
312
|
+
};
|
|
313
|
+
document.addEventListener("mousedown", onDown);
|
|
314
|
+
document.addEventListener("keydown", onKey);
|
|
315
|
+
return () => {
|
|
316
|
+
document.removeEventListener("mousedown", onDown);
|
|
317
|
+
document.removeEventListener("keydown", onKey);
|
|
318
|
+
};
|
|
319
|
+
}, [open, openSubmenuIndex]);
|
|
320
|
+
|
|
321
|
+
const submenuOpen = openSubmenuIndex != null;
|
|
322
|
+
const submenuNode = submenuOpen ? model[openSubmenuIndex!] : null;
|
|
323
|
+
const targetWidth = (open ? openW : closedW) || "max-content";
|
|
324
|
+
|
|
325
|
+
const ctx: MenuContextValue = {
|
|
326
|
+
submenuIcon,
|
|
327
|
+
activeIcon,
|
|
328
|
+
openSubmenuIndex,
|
|
329
|
+
openSubmenu,
|
|
330
|
+
closeSubmenu,
|
|
331
|
+
closeAll,
|
|
332
|
+
isActive,
|
|
333
|
+
toggleActive,
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
return (
|
|
337
|
+
<MenuContext.Provider value={ctx}>
|
|
338
|
+
<div ref={rootRef} className={styles.root}>
|
|
339
|
+
{/* In-flow clone — reserves the collapsed footprint + gives the closed width. */}
|
|
340
|
+
<div
|
|
341
|
+
ref={closedRef}
|
|
342
|
+
className={[styles.pillBox, styles[variant], styles.spacer].join(" ")}
|
|
343
|
+
aria-hidden
|
|
344
|
+
>
|
|
345
|
+
<div className={styles.header}>
|
|
346
|
+
<Icon systemName={systemName} label={label} />
|
|
347
|
+
</div>
|
|
348
|
+
</div>
|
|
349
|
+
|
|
350
|
+
{/* Offscreen clone of the open card — measures the expanded width. */}
|
|
351
|
+
<div
|
|
352
|
+
ref={measureRef}
|
|
353
|
+
className={[styles.pillBox, styles.measure].join(" ")}
|
|
354
|
+
aria-hidden
|
|
355
|
+
>
|
|
356
|
+
<div className={styles.header}>
|
|
357
|
+
<Icon systemName={systemName} label={label} />
|
|
358
|
+
</div>
|
|
359
|
+
<ul className={styles.list}>
|
|
360
|
+
{model.map((node) =>
|
|
361
|
+
node.kind === "raw" ? null : (
|
|
362
|
+
<li key={node.key}>
|
|
363
|
+
<MeasureRow node={node} chevIcon={submenuIcon} />
|
|
364
|
+
</li>
|
|
365
|
+
),
|
|
366
|
+
)}
|
|
367
|
+
</ul>
|
|
368
|
+
</div>
|
|
369
|
+
|
|
370
|
+
{/* The real, absolutely-positioned dropdown: pill ⇄ card. */}
|
|
371
|
+
<motion.div
|
|
372
|
+
className={[styles.pillBox, styles[variant], styles.drop].join(" ")}
|
|
373
|
+
data-open={open}
|
|
374
|
+
animate={{
|
|
375
|
+
width: targetWidth,
|
|
376
|
+
borderRadius: open ? 30 : 84,
|
|
377
|
+
scale: submenuOpen ? 0.95 : 1,
|
|
378
|
+
pointerEvents: submenuOpen ? "none" : "auto",
|
|
379
|
+
background: submenuOpen
|
|
380
|
+
? "var(--md-sys-color-surface-container-low)"
|
|
381
|
+
: open
|
|
382
|
+
? "var(--md-sys-color-surface-container-lowest)"
|
|
383
|
+
: `var(--md-sys-color-${variant}-container)`,
|
|
384
|
+
padding: 6,
|
|
385
|
+
}}
|
|
386
|
+
whileTap={!open ? { borderRadius: 14 } : undefined}
|
|
387
|
+
transition={{
|
|
388
|
+
...MORPH,
|
|
389
|
+
borderRadius: { ...MORPH_2, delay: 0.02 },
|
|
390
|
+
}}
|
|
391
|
+
>
|
|
392
|
+
<button
|
|
393
|
+
type="button"
|
|
394
|
+
className={styles.header}
|
|
395
|
+
style={{
|
|
396
|
+
scale: open ? 0.8 : 1,
|
|
397
|
+
transformOrigin: "left",
|
|
398
|
+
transform: open ? "translateX(-20px)" : "translateX(0px)",
|
|
399
|
+
|
|
400
|
+
transition:
|
|
401
|
+
"scale var(--transition-expressive-color), transform var(--transition-expressive-color)",
|
|
402
|
+
}}
|
|
403
|
+
aria-haspopup="menu"
|
|
404
|
+
aria-expanded={open}
|
|
405
|
+
onClick={() => (open ? closeAll() : setOpen(true))}
|
|
406
|
+
>
|
|
407
|
+
<Icon
|
|
408
|
+
systemName={systemName}
|
|
409
|
+
iconStyle={{
|
|
410
|
+
opacity: open ? 0 : 1,
|
|
411
|
+
transition: "opacity var(--transition-expressive-color)",
|
|
412
|
+
}}
|
|
413
|
+
label={label}
|
|
414
|
+
/>
|
|
415
|
+
</button>
|
|
416
|
+
|
|
417
|
+
<AnimatePresence initial={false}>
|
|
418
|
+
{open && (
|
|
419
|
+
<motion.ul
|
|
420
|
+
className={styles.list}
|
|
421
|
+
style={{ gap: multiSelect || exclusive ? 6 : 0 }}
|
|
422
|
+
initial={{ height: 0, opacity: 0 }}
|
|
423
|
+
animate={{ height: "auto", opacity: submenuOpen ? 0.5 : 1 }}
|
|
424
|
+
exit={{ height: 0, opacity: 0 }}
|
|
425
|
+
transition={{
|
|
426
|
+
...MORPH,
|
|
427
|
+
width: { ...MORPH, delay: 0.8 },
|
|
428
|
+
opacity: { ease: easeInOut, duration: 0.2 },
|
|
429
|
+
}}
|
|
430
|
+
>
|
|
431
|
+
{model.map((node, i) =>
|
|
432
|
+
node.kind === "raw" ? (
|
|
433
|
+
<li
|
|
434
|
+
key={node.key}
|
|
435
|
+
className={styles.dividerRow}
|
|
436
|
+
aria-hidden
|
|
437
|
+
>
|
|
438
|
+
{node.element}
|
|
439
|
+
</li>
|
|
440
|
+
) : node.children.length > 0 ? (
|
|
441
|
+
<li key={node.key}>
|
|
442
|
+
<SubmenuTriggerRow node={node} index={i} />
|
|
443
|
+
</li>
|
|
444
|
+
) : (
|
|
445
|
+
<li key={node.key}>
|
|
446
|
+
<LeafRow node={node} />
|
|
447
|
+
</li>
|
|
448
|
+
),
|
|
449
|
+
)}
|
|
450
|
+
</motion.ul>
|
|
451
|
+
)}
|
|
452
|
+
</AnimatePresence>
|
|
453
|
+
</motion.div>
|
|
454
|
+
|
|
455
|
+
{/* Submenu layer — pops from the trigger row, above the dimmed menu. */}
|
|
456
|
+
<AnimatePresence>
|
|
457
|
+
{submenuNode && (
|
|
458
|
+
<motion.div
|
|
459
|
+
className={`${styles.submenuCard} ${openSubmenuIndex != null ? styles.subMenuOpen : ""}`}
|
|
460
|
+
style={{ top: submenuTop }}
|
|
461
|
+
initial={{ opacity: 0, scale: 1, height: 62, marginTop: "-13px" }}
|
|
462
|
+
animate={{
|
|
463
|
+
opacity: 1,
|
|
464
|
+
scale: 1,
|
|
465
|
+
height: "fit-content",
|
|
466
|
+
marginTop: "-7px",
|
|
467
|
+
}}
|
|
468
|
+
exit={{ opacity: 0, scale: 1, height: 62, marginTop: "-13px" }}
|
|
469
|
+
transition={{
|
|
470
|
+
...MORPH,
|
|
471
|
+
height: { ...MORPH },
|
|
472
|
+
}}
|
|
473
|
+
>
|
|
474
|
+
<button
|
|
475
|
+
type="button"
|
|
476
|
+
className={styles.row}
|
|
477
|
+
data-noicon={!submenuNode.systemName || undefined}
|
|
478
|
+
aria-expanded
|
|
479
|
+
onClick={closeSubmenu}
|
|
480
|
+
>
|
|
481
|
+
<Icon
|
|
482
|
+
systemName={submenuNode.systemName}
|
|
483
|
+
label={submenuNode.label}
|
|
484
|
+
/>
|
|
485
|
+
<span className={styles.chev}>
|
|
486
|
+
<Icon systemName={submenuOpenIcon} />
|
|
487
|
+
</span>
|
|
488
|
+
</button>
|
|
489
|
+
<ul className={styles.submenuList}>
|
|
490
|
+
{submenuNode.children.map((child) =>
|
|
491
|
+
child.kind === "raw" ? (
|
|
492
|
+
<li
|
|
493
|
+
key={child.key}
|
|
494
|
+
className={styles.dividerRow}
|
|
495
|
+
aria-hidden
|
|
496
|
+
>
|
|
497
|
+
{child.element}
|
|
498
|
+
</li>
|
|
499
|
+
) : (
|
|
500
|
+
<li key={child.key}>
|
|
501
|
+
<LeafRow node={child} />
|
|
502
|
+
</li>
|
|
503
|
+
),
|
|
504
|
+
)}
|
|
505
|
+
</ul>
|
|
506
|
+
</motion.div>
|
|
507
|
+
)}
|
|
508
|
+
</AnimatePresence>
|
|
509
|
+
</div>
|
|
510
|
+
</MenuContext.Provider>
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// ---------------- namespace export ----------------
|
|
515
|
+
const Drop = { Menu: DropMenu, Item };
|
|
516
|
+
export default Drop;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
.heroWrap {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 83dvh;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
border: 1px solid var(--globalUIBorderCard);
|
|
7
|
+
border-radius: 36px;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
isolation: isolate;
|
|
10
|
+
will-change: transform;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.slideshow {
|
|
14
|
+
position: absolute;
|
|
15
|
+
inset: 0;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.gradient {
|
|
21
|
+
position: absolute;
|
|
22
|
+
inset: 0;
|
|
23
|
+
pointer-events: none;
|
|
24
|
+
z-index: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.contentCTA {
|
|
28
|
+
position: absolute;
|
|
29
|
+
bottom: 56px;
|
|
30
|
+
left: 32px;
|
|
31
|
+
z-index: 2;
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
gap: 12px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ctaTitle {
|
|
38
|
+
margin: 0;
|
|
39
|
+
text-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.ctaText {
|
|
43
|
+
margin: 0;
|
|
44
|
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.indicators {
|
|
48
|
+
position: absolute;
|
|
49
|
+
bottom: 16px;
|
|
50
|
+
left: 50%;
|
|
51
|
+
translate: -50% 0;
|
|
52
|
+
display: flex;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
align-items: center;
|
|
55
|
+
gap: 8px;
|
|
56
|
+
z-index: 20;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.dot {
|
|
60
|
+
width: 6px;
|
|
61
|
+
height: 6px;
|
|
62
|
+
border-radius: 12px;
|
|
63
|
+
background: rgba(255, 255, 255, 0.243);
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
padding: 0;
|
|
66
|
+
transition:
|
|
67
|
+
background 0.3s ease,
|
|
68
|
+
width var(--transition-expressive);
|
|
69
|
+
}
|
|
70
|
+
.dot:hover {
|
|
71
|
+
width: 12px;
|
|
72
|
+
background-color: white;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.dotActive {
|
|
76
|
+
background: white;
|
|
77
|
+
width: 24px;
|
|
78
|
+
}
|
|
79
|
+
.dotActive:hover {
|
|
80
|
+
width: 28px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.arrowBtn {
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
background: none;
|
|
88
|
+
border: none;
|
|
89
|
+
padding: 0;
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
opacity: 0.6;
|
|
92
|
+
transition: opacity 0.2s ease;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.arrowBtn:hover {
|
|
96
|
+
opacity: 1;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@media screen and (max-width: 812px) {
|
|
100
|
+
.heroWrap {
|
|
101
|
+
height: 64vh;
|
|
102
|
+
border-radius: 36px;
|
|
103
|
+
}
|
|
104
|
+
.arrowBtn {
|
|
105
|
+
display: none;
|
|
106
|
+
}
|
|
107
|
+
}
|