@yamatozhen/design_system 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +101 -101
  3. package/package.json +50 -50
  4. package/scripts/postinstall.js +91 -91
  5. package/template/app/ClientNav.tsx +258 -310
  6. package/template/app/globals.css +2 -167
  7. package/template/app/layout.tsx +94 -82
  8. package/template/app/themes/dark-mc 2.css +51 -0
  9. package/template/app/themes/dark-mc.css +51 -51
  10. package/template/app/themes/dark.css +51 -51
  11. package/template/app/themes/light 2.css +51 -0
  12. package/template/app/themes/light-mc 2.css +51 -0
  13. package/template/app/themes/light-mc.css +51 -51
  14. package/template/app/themes/light.css +51 -51
  15. package/template/app/themes/theme 2.css +272 -0
  16. package/template/app/themes/theme.css +272 -82
  17. package/template/components/{layout/button → (buttons)}/Button.module.css +351 -305
  18. package/template/components/{layout/button → (buttons)}/ButtonGroup.tsx +414 -503
  19. package/template/components/{layout/button → (buttons)}/FAB.tsx +119 -118
  20. package/template/components/(buttons)/button.tsx +164 -0
  21. package/template/components/(controls)/slider/Slider.module.css +250 -0
  22. package/template/components/(controls)/slider/Slider.tsx +386 -0
  23. package/template/components/(controls)/switch/Switch.module.css +108 -0
  24. package/template/components/(controls)/switch/Switch.tsx +69 -0
  25. package/template/components/(date & time)/calendar/Calendar.module.css +125 -0
  26. package/template/components/(date & time)/calendar/Calendar.tsx +206 -0
  27. package/template/components/(date & time)/dateField/DateField.module.css +25 -0
  28. package/template/components/(date & time)/dateField/DateField.tsx +193 -0
  29. package/template/components/(date & time)/datePicker/DatePicker.tsx +118 -0
  30. package/template/components/(date & time)/dateRangePicker/DateRangePicker.tsx +144 -0
  31. package/template/components/(date & time)/rangeCalendar/RangeCalendar.module.css +203 -0
  32. package/template/components/(date & time)/rangeCalendar/RangeCalendar.tsx +263 -0
  33. package/template/components/(date & time)/shared/dateUtils.ts +107 -0
  34. package/template/components/(date & time)/timeField/TimeField.module.css +39 -0
  35. package/template/components/(date & time)/timeField/TimeField.tsx +158 -0
  36. package/template/components/(feedback)/circularProgress/CircularProgress.tsx +646 -0
  37. package/template/components/(feedback)/linearProgress/LinearProgress.tsx +337 -0
  38. package/template/components/(feedback)/meter/Meter.tsx +111 -0
  39. package/template/components/(feedback)/skeleton/Skeleton.module.css +49 -0
  40. package/template/components/(feedback)/skeleton/Skeleton.tsx +32 -0
  41. package/template/components/(feedback)/spinner/Spinner.module.css +27 -0
  42. package/template/components/(feedback)/spinner/Spinner.tsx +60 -0
  43. package/template/components/(forms)/checkbox/Checkbox.tsx +121 -0
  44. package/template/components/(forms)/checkboxGroup/CheckboxGroup.tsx +83 -0
  45. package/template/components/(forms)/description/Description.tsx +34 -0
  46. package/template/components/(forms)/errorMessage/ErrorMessage.tsx +31 -0
  47. package/template/components/(forms)/fieldError/FieldError.tsx +39 -0
  48. package/template/components/(forms)/fieldset/Fieldset.tsx +51 -0
  49. package/template/components/(forms)/form/Form.tsx +54 -0
  50. package/template/components/(forms)/input/Input.tsx +50 -0
  51. package/template/components/(forms)/inputGroup/InputGroup.tsx +65 -0
  52. package/template/components/(forms)/inputOtp/InputOtp.tsx +139 -0
  53. package/template/components/(forms)/label/Label.tsx +46 -0
  54. package/template/components/(forms)/numberField/NumberField.tsx +292 -0
  55. package/template/components/(forms)/radioGroup/RadioGroup.tsx +175 -0
  56. package/template/components/(forms)/searchField/SearchField.tsx +139 -0
  57. package/template/components/(forms)/shared/field.module.css +75 -0
  58. package/template/components/(forms)/shared/fieldContext.ts +28 -0
  59. package/template/components/(forms)/textArea/TextArea.tsx +55 -0
  60. package/template/components/(forms)/textField/TextField.tsx +91 -0
  61. package/template/components/{layout → (layout)}/Lightbox/LightboxCard.tsx +100 -100
  62. package/template/components/{layout → (layout)}/Lightbox/LightboxGallery.module.css +249 -249
  63. package/template/components/{layout → (layout)}/Lightbox/LightboxGallery.tsx +72 -72
  64. package/template/components/{layout → (layout)}/Lightbox/LightboxGrid.tsx +185 -186
  65. package/template/components/{layout → (layout)}/Lightbox/LightboxModal.module.css +395 -395
  66. package/template/components/{layout → (layout)}/Lightbox/LightboxModal.tsx +498 -500
  67. package/template/components/{layout → (layout)}/Lightbox/demo.tsx +396 -412
  68. package/template/components/{layout → (layout)}/Lightbox/index.ts +30 -30
  69. package/template/components/{layout → (layout)}/Lightbox/types.ts +101 -113
  70. package/template/components/{layout → (layout)}/Lightbox/useLightboxFilters.ts +140 -140
  71. package/template/components/(layout)/accordion/Accordion.module.css +108 -0
  72. package/template/components/(layout)/accordion/Accordion.tsx +251 -0
  73. package/template/components/(layout)/card/Card.module.css +136 -0
  74. package/template/components/(layout)/card/Card.tsx +371 -0
  75. package/template/components/(layout)/list/List.module.css +83 -0
  76. package/template/components/(layout)/list/List.tsx +332 -0
  77. package/template/components/{layout → (layout)}/navigation/Wrap.tsx +41 -41
  78. package/template/components/(layout)/navigation/breadcrumbs/Breadcrumbs.tsx +145 -0
  79. package/template/components/{layout/navigation/nav/Nav.module.css → (layout)/navigation/nav/Nav.module.css.old} +474 -508
  80. package/template/components/{layout → (layout)}/navigation/nav/Nav.tsx +186 -167
  81. package/template/components/{layout → (layout)}/navigation/nav/NavBar.tsx +396 -419
  82. package/template/components/{layout → (layout)}/navigation/nav/NavContext.tsx +259 -259
  83. package/template/components/{layout → (layout)}/navigation/nav/NavItem.tsx +195 -173
  84. package/template/components/{layout → (layout)}/navigation/nav/NavNew.module.css +406 -373
  85. package/template/components/{layout → (layout)}/navigation/nav/NavRail.tsx +317 -315
  86. package/template/components/{layout → (layout)}/navigation/nav/NavSection.tsx +101 -102
  87. package/template/components/{layout → (layout)}/navigation/nav/NavTab.tsx +25 -25
  88. package/template/components/{layout → (layout)}/navigation/nav/navftb/NavFTB.module.css +253 -252
  89. package/template/components/{layout → (layout)}/navigation/nav/navftb/NavFTB.tsx +448 -399
  90. package/template/components/{layout → (layout)}/navigation/nav/navftb/useTabIndicator.ts +498 -484
  91. package/template/components/{layout → (layout)}/navigation/nav/navheader/NavHeader.module.css +59 -59
  92. package/template/components/{layout → (layout)}/navigation/nav/navheader/NavHeader.tsx +465 -473
  93. package/template/components/(layout)/navigation/pagination/Pagination.tsx +261 -0
  94. package/template/components/{layout → (layout)}/pages/loadingScreen.tsx +117 -102
  95. package/template/components/{layout → (layout)}/pages/maintenance/Maintenance.tsx +52 -52
  96. package/template/components/{layout → (layout)}/pages/maintenance/maintenance.module.css +162 -162
  97. package/template/components/(layout)/scrollShadow/ScrollShadow.module.css +81 -0
  98. package/template/components/(layout)/scrollShadow/ScrollShadow.tsx +161 -0
  99. package/template/components/(layout)/scrollShadow/useScrollShadow.ts +130 -0
  100. package/template/components/(layout)/separator/Separator.tsx +112 -0
  101. package/template/components/(overlays)/accessibilityModal/AccessibilityModal.tsx +307 -0
  102. package/template/components/(overlays)/drawer/Drawer.tsx +953 -0
  103. package/template/components/(overlays)/modal/Modal.tsx +654 -0
  104. package/template/components/(overlays)/popover/Popover.tsx +420 -0
  105. package/template/components/(overlays)/toast/Toast.tsx +692 -0
  106. package/template/components/(pickers)/autocomplete/Autocomplete.tsx +24 -0
  107. package/template/components/(pickers)/comboBox/ComboBox.tsx +21 -0
  108. package/template/components/(pickers)/select/Select.tsx +188 -0
  109. package/template/components/(pickers)/shared/FilterableField.tsx +223 -0
  110. package/template/components/(pickers)/shared/PickerItem.ts +13 -0
  111. package/template/components/tools/CustomScrollbar 2.tsx +107 -0
  112. package/template/components/tools/CustomScrollbar.tsx +107 -0
  113. package/template/components/tools/Divider 2.tsx +11 -0
  114. package/template/components/tools/Divider.tsx +11 -11
  115. package/template/components/tools/ReduceMotionContext 2.tsx +5 -0
  116. package/template/components/tools/ReduceMotionContext.tsx +5 -5
  117. package/template/components/tools/Sinewave 2.tsx +206 -0
  118. package/template/components/tools/Sinewave.tsx +396 -199
  119. package/template/components/tools/SinewaveProgress 2.tsx +140 -0
  120. package/template/components/tools/SinewaveProgress.tsx +140 -135
  121. package/template/components/tools/badge/Badge 2.tsx +28 -0
  122. package/template/components/tools/badge/Badge.tsx +28 -28
  123. package/template/components/tools/dropdown/drop.module.css +196 -0
  124. package/template/components/tools/dropdown/drop.tsx +568 -0
  125. package/template/components/tools/easing.ts +118 -0
  126. package/template/components/tools/flubber.d 2.ts +7 -0
  127. package/template/components/tools/flubber.d.ts +6 -6
  128. package/template/components/tools/footer/Footer.tsx +20 -0
  129. package/template/components/tools/input/Input 2.tsx +99 -0
  130. package/template/components/tools/input/Input.module 2.css +45 -0
  131. package/template/components/tools/input/Input.module.css +45 -0
  132. package/template/components/tools/input/Input.tsx +99 -0
  133. package/template/components/tools/label/Icon 2.tsx +39 -0
  134. package/template/components/tools/label/Icon.tsx +39 -0
  135. package/template/components/tools/label/Label 2.tsx +150 -0
  136. package/template/components/tools/label/Label.tsx +156 -0
  137. package/template/components/tools/mobileViewProvider 2.tsx +53 -0
  138. package/template/components/tools/mobileViewProvider.tsx +53 -58
  139. package/template/components/tools/ripple/ripple 2.css +38 -0
  140. package/template/components/tools/ripple/ripple 2.tsx +78 -0
  141. package/template/components/tools/ripple/ripple.css +38 -41
  142. package/template/components/tools/ripple/ripple.tsx +78 -53
  143. package/template/components/tools/shape/{ShapeMorph.tsx → Shape 2.tsx } +313 -190
  144. package/template/components/tools/shape/Shape.module 2.css +21 -0
  145. package/template/components/tools/shape/Shape.module.css +25 -0
  146. package/template/components/tools/shape/Shape.tsx +316 -0
  147. package/template/components/tools/shape/ShapeLoader 2.tsx +104 -0
  148. package/template/components/tools/shape/ShapeLoader.tsx +104 -101
  149. package/template/components/tools/shape/ShapePaths 2.ts +116 -0
  150. package/template/components/tools/shape/ShapePaths.ts +116 -116
  151. package/template/components/{layout/switch/Switch.tsx → tools/switch/Switch 2.tsx } +48 -48
  152. package/template/components/{layout/switch/Switch.module.css → tools/switch/Switch.module 2.css } +102 -102
  153. package/template/components/tools/switch/Switch.module.css +102 -102
  154. package/template/components/tools/switch/Switch.tsx +48 -48
  155. package/template/components/tools/useBodyScrollLock 2.tsx +27 -0
  156. package/template/components/tools/useBodyScrollLock.tsx +27 -27
  157. package/template/components/tools/useImageColor 2.ts +47 -0
  158. package/template/components/tools/useImageColor.ts +47 -47
  159. package/template/components/tools/useNavSheetDrag 2.tsx +196 -0
  160. package/template/components/tools/useNavSheetDrag.tsx +196 -196
  161. package/template/public/fonts/material-symbols/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght 2.woff2 +0 -0
  162. package/template/components/layout/accordion/Accordion.module.css +0 -149
  163. package/template/components/layout/accordion/Accordion.tsx +0 -114
  164. package/template/components/layout/button/button.tsx +0 -128
  165. package/template/components/layout/button/drop.module.css +0 -229
  166. package/template/components/layout/button/drop.tsx +0 -516
  167. package/template/components/layout/hero/v1/heroSlideshow.module.css +0 -107
  168. package/template/components/layout/hero/v1/heroSlideshow.tsx +0 -233
  169. package/template/components/layout/modals/accessibilityModal/AccessibilityModal.module.css +0 -126
  170. package/template/components/layout/modals/accessibilityModal/AccessibilityModal.tsx +0 -290
  171. package/template/components/layout/modals/alert/Alert.tsx +0 -188
  172. package/template/components/layout/navigation/MioCard.module.css +0 -88
  173. package/template/components/layout/navigation/MioCard.tsx +0 -266
  174. package/template/components/tools/ProgressiveBlur.tsx +0 -73
  175. package/template/components/tools/icon/icon.module.css +0 -0
  176. package/template/components/tools/icon/icon.tsx +0 -125
  177. package/template/components/tools/react-bits/ClickSpark.tsx +0 -177
  178. package/template/components/tools/react-bits/FadeContent.tsx +0 -90
  179. package/template/components/tools/react-bits/GlareHover.tsx +0 -73
  180. package/template/components/tools/react-bits/GradientText/GradientText.css +0 -70
  181. package/template/components/tools/react-bits/GradientText/GradientText.tsx +0 -44
  182. package/template/components/tools/react-bits/Magnet.tsx +0 -118
  183. package/template/components/tools/react-bits/Stepper/Stepper.css +0 -134
  184. package/template/components/tools/react-bits/Stepper/Stepper.tsx +0 -412
@@ -1,473 +1,465 @@
1
- "use client";
2
-
3
- import React, {
4
- createContext,
5
- useCallback,
6
- useContext,
7
- useEffect,
8
- useLayoutEffect,
9
- useId,
10
- useMemo,
11
- useRef,
12
- useState,
13
- } from "react";
14
- import { motion, HTMLMotionProps, easeInOut } from "framer-motion";
15
- import styles from "./NavHeader.module.css";
16
- import Icon from "@/components/tools/icon/icon";
17
- import ProgressiveBlur from "@/components/tools/ProgressiveBlur";
18
- import {
19
- NavHeaderOverlayContext,
20
- useNavRail,
21
- useCollapseOnOutsideInteraction,
22
- } from "../NavContext";
23
- import { useBreakpoints } from "@/components/tools/mobileViewProvider";
24
-
25
- export const HEADER_TRANSITION = {
26
- type: "spring",
27
- stiffness: 400,
28
- damping: 30,
29
- background: { ease: easeInOut, duration: 0.3 },
30
- } as const;
31
-
32
- // ── Types ───────────────────────────────────────────────────────────────────
33
- export type NavHeaderBodyProps = {
34
- children?: React.ReactNode;
35
- style?: React.CSSProperties;
36
- className?: string;
37
- /**
38
- * Route(s) on which the header renders in its expanded (hero) state. Defaults
39
- * to the home page. Accepts a single path or several; matching is exact for
40
- * "/" and prefix-based otherwise ("/settings" also covers "/settings/...").
41
- */
42
- expandedPaths?: string | string[];
43
- };
44
-
45
- export type NavHeaderGroupProps = {
46
- /** When true, the group stays visible/interactive while a mega menu is open. */
47
- alwaysVisible?: boolean;
48
- children?: React.ReactNode;
49
- style?: React.CSSProperties;
50
- className?: string;
51
- };
52
-
53
- export type NavHeaderTabProps = {
54
- systemName?: string;
55
- label: string;
56
- /** Route pushed when the tab has no mega-menu children. Also used for active match. */
57
- path?: string;
58
- match?: string | string[];
59
- /** Mega-menu content. Having children turns the tab into a menu opener. */
60
- children?: React.ReactNode;
61
- onClick?: () => void;
62
- style?: React.CSSProperties;
63
- className?: string;
64
- };
65
-
66
- /** Header.Logo behaves like a motion.div; logoWrap class + base layout merged in. */
67
- export type NavHeaderLogoProps = HTMLMotionProps<"div">;
68
-
69
- // MARK: Header State Context (mega/ collapsed,,,)
70
- type HeaderStateValue = { collapsed: boolean; megaOpen: boolean };
71
- const NavHeaderStateContext = createContext<HeaderStateValue>({
72
- collapsed: true,
73
- megaOpen: false,
74
- });
75
- /** Read header collapse / mega-open state (e.g. to size the logo). */
76
- export function useNavHeaderState() {
77
- return useContext(NavHeaderStateContext);
78
- }
79
-
80
- // MARK: Tab activation context
81
- type TabContextValue = {
82
- activeId: string | null;
83
- activate: (id: string, content: React.ReactNode) => void;
84
- close: () => void;
85
- navigate: (path: string) => void;
86
- activePath: string;
87
- };
88
- const NavHeaderTabContext = createContext<TabContextValue | null>(null);
89
-
90
- function matchesRoute(matchers: string[], activePath: string): boolean {
91
- return matchers.some((m) =>
92
- m === "/"
93
- ? activePath === "/"
94
- : activePath === m || activePath.startsWith(m + "/"),
95
- );
96
- }
97
-
98
- //MARK: Header.Logo
99
- // Carries the logoWrap layout (state-aware) as defaults; any passed style wins.
100
- // Only one Header.Logo may exist in the whole header body (dev-checked below).
101
- function NavHeaderLogo({
102
- className,
103
- children,
104
- style,
105
- ...rest
106
- }: NavHeaderLogoProps) {
107
- const { collapsed } = useNavHeaderState();
108
- return (
109
- <motion.div
110
- className={`${styles.logoWrap ?? ""} ${className ?? ""}`}
111
- style={{
112
- ...style,
113
- }}
114
- {...rest}
115
- >
116
- {children}
117
- </motion.div>
118
- );
119
- }
120
-
121
- //MARK: Header.Tab
122
- // Renders its own <li className=headerItem>. `children` are NOT rendered here —
123
- // they're lifted into the mega region by NavHeader when this tab is active.
124
- //
125
- // Active rule (only ever ONE active tab):
126
- // • a mega menu open anywhere → only the opener tab is active (route match
127
- // is suppressed, so Home loses its active state while Projects is open).
128
- // • nothing open → active follows the route (path / match).
129
- function NavHeaderTab({
130
- systemName,
131
- label,
132
- path,
133
- match,
134
- children,
135
- onClick,
136
- style,
137
- className,
138
- }: NavHeaderTabProps) {
139
- const ctx = useContext(NavHeaderTabContext);
140
- const id = useId();
141
- const hasMenu = React.Children.count(children) > 0;
142
-
143
- const someMegaOpen = ctx?.activeId != null;
144
- const isOpen = ctx?.activeId === id;
145
-
146
- const matchers = match
147
- ? Array.isArray(match)
148
- ? match
149
- : [match]
150
- : path
151
- ? [path]
152
- : [];
153
- const routeActive = !!ctx && matchesRoute(matchers, ctx.activePath);
154
-
155
- const isActive = someMegaOpen ? isOpen : routeActive;
156
-
157
- const handleClick = useCallback(() => {
158
- onClick?.();
159
- if (hasMenu) {
160
- // Toggle this tab's mega menu (re-click closes it).
161
- ctx?.activate(id, children);
162
- } else {
163
- // Plain link tab: close any open mega, then route.
164
- ctx?.close();
165
- if (path) ctx?.navigate(path);
166
- }
167
- }, [onClick, hasMenu, ctx, id, children, path]);
168
-
169
- return (
170
- // eslint-disable-next-line jsx-a11y/role-supports-aria-props
171
- <li
172
- className={`${styles.headerItem ?? ""} ${isActive ? (styles.active ?? "") : ""} ${className ?? ""}`}
173
- style={style}
174
- onClick={handleClick}
175
- aria-haspopup={hasMenu || undefined}
176
- aria-expanded={hasMenu ? isOpen : undefined}
177
- >
178
- <Icon
179
- iconBodyStyle={{ margin: hasMenu ? 0 : "0 6px 0 0" }}
180
- label={label}
181
- reverse
182
- systemName={hasMenu ? "keyboard_arrow_down" : undefined}
183
- />
184
- </li>
185
- );
186
- }
187
-
188
- // MARK: Header.Group
189
- // A Header.Logo child is lifted out as a direct flex sibling; every other child
190
- // (Header.Tab / Button / Drop.Menu) is wrapped in a single <ul className=headerMenu>.
191
- // !alwaysVisible groups fade + go inert while a mega menu is open.
192
- function NavHeaderGroup({
193
- alwaysVisible,
194
- children,
195
- style,
196
- className,
197
- }: NavHeaderGroupProps) {
198
- const { megaOpen } = useNavHeaderState();
199
- const hidden = !alwaysVisible && megaOpen;
200
-
201
- const { logo, menuChildren } = useMemo(() => {
202
- let logoEl: React.ReactNode = null;
203
- const rest: React.ReactNode[] = [];
204
- React.Children.forEach(children, (child) => {
205
- if (React.isValidElement(child) && child.type === NavHeaderLogo) {
206
- logoEl = child;
207
- } else {
208
- rest.push(child);
209
- }
210
- });
211
- return { logo: logoEl, menuChildren: rest };
212
- }, [children]);
213
-
214
- return (
215
- <div
216
- aria-hidden={hidden || undefined}
217
- className={`${styles.headerGroup ?? ""} ${className ?? ""}`}
218
- style={{
219
- display: "flex",
220
- alignItems: "flex-start",
221
- opacity: hidden ? 0 : 1,
222
- pointerEvents: hidden ? "none" : "auto",
223
- transition:
224
- "opacity var(--transition-expressive-color), height var(--transition-expressive), width var(--transition-expressive) ",
225
- ...style,
226
- }}
227
- >
228
- {logo}
229
- {menuChildren.length > 0 && (
230
- <ul className={styles.headerMenu ?? ""}>{menuChildren}</ul>
231
- )}
232
- </div>
233
- );
234
- }
235
-
236
- //MARK: Nav.Header
237
- function NavHeaderBody({
238
- children,
239
- style,
240
- className,
241
- expandedPaths,
242
- }: NavHeaderBodyProps) {
243
- const { navigate, activePath } = useNavRail();
244
- const { isTablet } = useBreakpoints();
245
-
246
- // Source of truth for the mega menu. id === null means closed.
247
- const [active, setActive] = useState<{
248
- id: string | null;
249
- content: React.ReactNode;
250
- }>({ id: null, content: null });
251
-
252
- const megaOpen = active.id != null;
253
-
254
- const megaContentRef = useRef<HTMLDivElement>(null);
255
- const [megaHeight, setMegaHeight] = useState(0);
256
-
257
- useLayoutEffect(() => {
258
- if (megaOpen && megaContentRef.current) {
259
- const cap = window.innerHeight * 0.8; // your 50dvh
260
- setMegaHeight(Math.min(megaContentRef.current.scrollHeight, cap));
261
- } else {
262
- setMegaHeight(0);
263
- }
264
- }, [megaOpen, active.content]);
265
-
266
- // Routes that render the header in its expanded (hero) state. Defaults to the
267
- // home page; pass `expandedPaths` to opt in other routes (single or several).
268
- const expandMatchers = useMemo(
269
- () =>
270
- expandedPaths
271
- ? Array.isArray(expandedPaths)
272
- ? expandedPaths
273
- : [expandedPaths]
274
- : ["/"],
275
- [expandedPaths],
276
- );
277
-
278
- // Collapse once the page scrolls past 24px; re-expand the hero only within 4px
279
- // of the very top. The 4–24px range holds the previous state (hysteresis), and
280
- // scrolling while the mega menu is open latches collapsed — so closing the menu
281
- // mid-scroll near the top can't flash the hero back before the 24px threshold
282
- // catches up. Desktop only — the header is hidden on mobile.
283
- const [scrolled, setScrolled] = useState(false);
284
- const megaOpenRef = useRef(megaOpen);
285
- megaOpenRef.current = megaOpen;
286
- useEffect(() => {
287
- if (isTablet) return;
288
- const onScroll = () => {
289
- const y = window.scrollY;
290
- setScrolled((prev) =>
291
- megaOpenRef.current || y > 24 ? true : y < 4 ? false : prev,
292
- );
293
- };
294
- onScroll();
295
- window.addEventListener("scroll", onScroll, { passive: true });
296
- return () => window.removeEventListener("scroll", onScroll);
297
- }, [isTablet]);
298
-
299
- // An open mega menu always forces the collapsed (compact) header — nothing
300
- // overrides it. Otherwise the header expands only on an eligible route while
301
- // still scrolled to the top. Either way the mega region expands directly below
302
- // the header content in the flex column (see render).
303
- const collapsed =
304
- megaOpen || !matchesRoute(expandMatchers, activePath) || scrolled;
305
-
306
- // Closing only clears the id so `active.content` stays mounted through the
307
- // collapse animation; the content is nulled in onAnimationComplete once the
308
- // mega region has finished shrinking to 0 (see render).
309
- const close = useCallback(
310
- () => setActive((prev) => ({ ...prev, id: null })),
311
- [],
312
- );
313
- const activate = useCallback((id: string, content: React.ReactNode) => {
314
- setActive((prev) =>
315
- prev.id === id ? { ...prev, id: null } : { id, content },
316
- );
317
- }, []);
318
-
319
- // Dev-only: only one Header.Logo allowed in the whole body.
320
- if (process.env.NODE_ENV !== "production") {
321
- let logoCount = 0;
322
- const scan = (nodes: React.ReactNode) =>
323
- React.Children.forEach(nodes, (c) => {
324
- if (!React.isValidElement(c)) return;
325
- if (c.type === NavHeaderLogo) logoCount++;
326
- const kids = (c.props as { children?: React.ReactNode }).children;
327
- if (kids) scan(kids);
328
- });
329
- scan(children);
330
- if (logoCount > 1)
331
- console.warn(
332
- "Nav.Header: only one Header.Logo may exist in the header body.",
333
- );
334
- }
335
-
336
- const tabContextValue = useMemo<TabContextValue>(
337
- () => ({ activeId: active.id, activate, close, navigate, activePath }),
338
- [active.id, activate, close, navigate, activePath],
339
- );
340
-
341
- const stateContextValue = useMemo<HeaderStateValue>(
342
- () => ({ collapsed, megaOpen }),
343
- [collapsed, megaOpen],
344
- );
345
-
346
- // Publish open-state + close handler so Nav.Content's dim (in Nav.tsx) reacts.
347
- // setOverlay is a stable useState setter → no feedback loop.
348
- const setOverlay = useContext(NavHeaderOverlayContext)?.setOverlay;
349
- useEffect(() => {
350
- setOverlay?.({ isOpen: megaOpen, close });
351
- }, [megaOpen, close, setOverlay]);
352
- useEffect(() => () => setOverlay?.(null), [setOverlay]);
353
-
354
- // Close on scroll / outside pointerdown — desktop only (header is hidden on
355
- // mobile and must not fight Nav.Bar's listeners).
356
- const headerRef = useRef<HTMLElement>(null);
357
- useCollapseOnOutsideInteraction(megaOpen, close, headerRef, !isTablet);
358
-
359
- return (
360
- <NavHeaderStateContext.Provider value={stateContextValue}>
361
- <NavHeaderTabContext.Provider value={tabContextValue}>
362
- <ProgressiveBlur
363
- snapTo="top"
364
- blur={20}
365
- definition={7}
366
- style={{
367
- position: "fixed",
368
- top: 0,
369
- left: 0,
370
- right: 0,
371
- bottom: "auto",
372
- minHeight: 108,
373
- zIndex: 900,
374
- }}
375
- />
376
- <motion.header
377
- ref={headerRef}
378
- className={`${styles.headerBody ?? ""} ${megaOpen ? (styles.megaMenu ?? "") : ""} ${className ?? ""}`}
379
- style={{
380
- display: "flex",
381
- flexDirection: "column",
382
- alignItems: "flex-start",
383
- position: "fixed",
384
- width: "100%",
385
- zIndex: 1010,
386
- background:
387
- "linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, transparent 100%)",
388
- left: 0,
389
- top: 0,
390
- ...style,
391
- }}
392
- animate={{
393
- borderRadius: megaOpen ? "0px 0px 36px 36px" : "0px 0px 0px 0px",
394
- boxShadow: megaOpen
395
- ? "0 1px 1px rgba(0,0,0,0.1), 0 2px 2px rgba(0,0,0,0.1), 0 4px 4px rgba(0,0,0,0.1)"
396
- : "0 0 0 rgba(0,0,0,0)",
397
- }}
398
- transition={HEADER_TRANSITION}
399
- >
400
- <motion.div
401
- aria-hidden
402
- initial={false}
403
- animate={{ opacity: megaOpen ? 1 : 0 }}
404
- transition={HEADER_TRANSITION.background}
405
- style={{
406
- position: "absolute",
407
- inset: 0,
408
- zIndex: -1,
409
- borderRadius: "inherit",
410
- pointerEvents: "none",
411
- background: "var(--md-sys-color-surface-container-low)",
412
- borderBottom: "1px solid var(--globalUIBorderCard)",
413
- }}
414
- />
415
-
416
- {/* Top row: your Header.Group(s) — space-between */}
417
- <div
418
- className={styles.headerContent ?? ""}
419
- style={{
420
- display: "flex",
421
- height: "fit-content",
422
- width: "100%",
423
- justifyContent: "space-between",
424
- padding: collapsed ? "12px" : "24px",
425
- }}
426
- >
427
- {children}
428
- </div>
429
-
430
- {/* Mega region: the active tab's children render here. */}
431
- <motion.div
432
- className={styles.megamenuContent ?? ""}
433
- style={{
434
- width: "100%",
435
- overflow: "hidden",
436
- paddingLeft: 24,
437
- paddingRight: 24,
438
- }}
439
- initial={false}
440
- animate={{
441
- height: megaHeight,
442
- opacity: megaOpen ? 1 : 0,
443
- paddingTop: megaOpen ? 24 : 0,
444
- paddingBottom: megaOpen ? 24 : 0,
445
- }}
446
- transition={HEADER_TRANSITION}
447
- onAnimationComplete={() =>
448
- setActive((prev) =>
449
- prev.id === null ? { id: null, content: null } : prev,
450
- )
451
- }
452
- >
453
- <div ref={megaContentRef}>{active.content}</div>
454
- </motion.div>
455
- </motion.header>
456
- </NavHeaderTabContext.Provider>
457
- </NavHeaderStateContext.Provider>
458
- );
459
- }
460
-
461
- type NavHeaderComponent = React.FC<NavHeaderBodyProps> & {
462
- Group: React.FC<NavHeaderGroupProps>;
463
- Tab: React.FC<NavHeaderTabProps>;
464
- Logo: React.FC<NavHeaderLogoProps>;
465
- };
466
-
467
- const NavHeader = Object.assign(NavHeaderBody, {
468
- Group: NavHeaderGroup,
469
- Tab: NavHeaderTab,
470
- Logo: NavHeaderLogo,
471
- }) as NavHeaderComponent;
472
-
473
- export default NavHeader;
1
+ "use client";
2
+
3
+ import React, {
4
+ createContext,
5
+ useCallback,
6
+ useContext,
7
+ useEffect,
8
+ useLayoutEffect,
9
+ useId,
10
+ useMemo,
11
+ useRef,
12
+ useState,
13
+ } from "react";
14
+ import { motion, HTMLMotionProps, easeInOut } from "framer-motion";
15
+ import styles from "./NavHeader.module.css";
16
+ import Label from "@/components/tools/label/Label";
17
+ import {
18
+ NavHeaderOverlayContext,
19
+ useNavRail,
20
+ useCollapseOnOutsideInteraction,
21
+ } from "../NavContext";
22
+ import { useBreakpoints } from "@/components/tools/mobileViewProvider";
23
+
24
+ export const HEADER_TRANSITION = {
25
+ type: "spring",
26
+ stiffness: 400,
27
+ damping: 30,
28
+ background: { ease: easeInOut, duration: 0.3 },
29
+ } as const;
30
+
31
+ // ── Types ───────────────────────────────────────────────────────────────────
32
+ export type NavHeaderBodyProps = {
33
+ children?: React.ReactNode;
34
+ style?: React.CSSProperties;
35
+ className?: string;
36
+ /**
37
+ * Route(s) on which the header renders in its expanded (hero) state. Defaults
38
+ * to the home page. Accepts a single path or several; matching is exact for
39
+ * "/" and prefix-based otherwise ("/settings" also covers "/settings/...").
40
+ */
41
+ expandedPaths?: string | string[];
42
+ };
43
+
44
+ export type NavHeaderGroupProps = {
45
+ /** When true, the group stays visible/interactive while a mega menu is open. */
46
+ alwaysVisible?: boolean;
47
+ children?: React.ReactNode;
48
+ style?: React.CSSProperties;
49
+ className?: string;
50
+ };
51
+
52
+ export type NavHeaderTabProps = {
53
+ systemName?: string;
54
+ label: string;
55
+ /** Route pushed when the tab has no mega-menu children. Also used for active match. */
56
+ path?: string;
57
+ match?: string | string[];
58
+ /** Mega-menu content. Having children turns the tab into a menu opener. */
59
+ children?: React.ReactNode;
60
+ onClick?: () => void;
61
+ style?: React.CSSProperties;
62
+ className?: string;
63
+ };
64
+
65
+ /** Header.Logo behaves like a motion.div; logoWrap class + base layout merged in. */
66
+ export type NavHeaderLogoProps = HTMLMotionProps<"div">;
67
+
68
+ // MARK: Header State Context (mega/ collapsed,,,)
69
+ type HeaderStateValue = { collapsed: boolean; megaOpen: boolean };
70
+ const NavHeaderStateContext = createContext<HeaderStateValue>({
71
+ collapsed: true,
72
+ megaOpen: false,
73
+ });
74
+ /** Read header collapse / mega-open state (e.g. to size the logo). */
75
+ export function useNavHeaderState() {
76
+ return useContext(NavHeaderStateContext);
77
+ }
78
+
79
+ // MARK: Tab activation context
80
+ type TabContextValue = {
81
+ activeId: string | null;
82
+ activate: (id: string, content: React.ReactNode) => void;
83
+ close: () => void;
84
+ navigate: (path: string) => void;
85
+ activePath: string;
86
+ };
87
+ const NavHeaderTabContext = createContext<TabContextValue | null>(null);
88
+
89
+ function matchesRoute(matchers: string[], activePath: string): boolean {
90
+ return matchers.some((m) =>
91
+ m === "/"
92
+ ? activePath === "/"
93
+ : activePath === m || activePath.startsWith(m + "/"),
94
+ );
95
+ }
96
+
97
+ //MARK: Header.Logo
98
+ // Carries the logoWrap layout (state-aware) as defaults; any passed style wins.
99
+ // Only one Header.Logo may exist in the whole header body (dev-checked below).
100
+ function NavHeaderLogo({
101
+ className,
102
+ children,
103
+ style,
104
+ ...rest
105
+ }: NavHeaderLogoProps) {
106
+ return (
107
+ <motion.div
108
+ className={`${styles.logoWrap ?? ""} ${className ?? ""}`}
109
+ style={{
110
+ ...style,
111
+ }}
112
+ {...rest}
113
+ >
114
+ {children}
115
+ </motion.div>
116
+ );
117
+ }
118
+
119
+ //MARK: Header.Tab
120
+ // Renders its own <li className=headerItem>. `children` are NOT rendered here —
121
+ // they're lifted into the mega region by NavHeader when this tab is active.
122
+ //
123
+ // Active rule (only ever ONE active tab):
124
+ // • a mega menu open anywhere → only the opener tab is active (route match
125
+ // is suppressed, so Home loses its active state while Projects is open).
126
+ // • nothing open → active follows the route (path / match).
127
+ function NavHeaderTab({
128
+ systemName,
129
+ label,
130
+ path,
131
+ match,
132
+ children,
133
+ onClick,
134
+ style,
135
+ className,
136
+ }: NavHeaderTabProps) {
137
+ const ctx = useContext(NavHeaderTabContext);
138
+ const id = useId();
139
+ const hasMenu = React.Children.count(children) > 0;
140
+
141
+ const someMegaOpen = ctx?.activeId != null;
142
+ const isOpen = ctx?.activeId === id;
143
+
144
+ const matchers = match
145
+ ? Array.isArray(match)
146
+ ? match
147
+ : [match]
148
+ : path
149
+ ? [path]
150
+ : [];
151
+ const routeActive = !!ctx && matchesRoute(matchers, ctx.activePath);
152
+
153
+ const isActive = someMegaOpen ? isOpen : routeActive;
154
+
155
+ const handleClick = useCallback(() => {
156
+ onClick?.();
157
+ if (hasMenu) {
158
+ // Toggle this tab's mega menu (re-click closes it).
159
+ ctx?.activate(id, children);
160
+ } else {
161
+ // Plain link tab: close any open mega, then route.
162
+ ctx?.close();
163
+ if (path) ctx?.navigate(path);
164
+ }
165
+ }, [onClick, hasMenu, ctx, id, children, path]);
166
+
167
+ return (
168
+ // eslint-disable-next-line jsx-a11y/role-supports-aria-props
169
+ <li
170
+ className={`${styles.headerItem ?? ""} ${isActive ? (styles.active ?? "") : ""} ${className ?? ""}`}
171
+ style={style}
172
+ onClick={handleClick}
173
+ aria-haspopup={hasMenu || undefined}
174
+ aria-expanded={hasMenu ? isOpen : undefined}
175
+ >
176
+ <span
177
+ style={{
178
+ display: "inline-flex",
179
+ alignItems: "center",
180
+ margin: hasMenu ? 0 : "0 6px 0 0",
181
+ }}
182
+ >
183
+ <Label
184
+ label={label}
185
+ systemName={hasMenu ? "keyboard_arrow_down" : systemName}
186
+ />
187
+ </span>
188
+ </li>
189
+ );
190
+ }
191
+
192
+ // MARK: Header.Group
193
+ // A Header.Logo child is lifted out as a direct flex sibling; every other child
194
+ // (Header.Tab / Button / Drop.Menu) is wrapped in a single <ul className=headerMenu>.
195
+ // !alwaysVisible groups fade + go inert while a mega menu is open.
196
+ function NavHeaderGroup({
197
+ alwaysVisible,
198
+ children,
199
+ style,
200
+ className,
201
+ }: NavHeaderGroupProps) {
202
+ const { megaOpen } = useNavHeaderState();
203
+ const hidden = !alwaysVisible && megaOpen;
204
+
205
+ const { logo, menuChildren } = useMemo(() => {
206
+ let logoEl: React.ReactNode = null;
207
+ const rest: React.ReactNode[] = [];
208
+ React.Children.forEach(children, (child) => {
209
+ if (React.isValidElement(child) && child.type === NavHeaderLogo) {
210
+ logoEl = child;
211
+ } else {
212
+ rest.push(child);
213
+ }
214
+ });
215
+ return { logo: logoEl, menuChildren: rest };
216
+ }, [children]);
217
+
218
+ return (
219
+ <div
220
+ aria-hidden={hidden || undefined}
221
+ className={`${styles.headerGroup ?? ""} ${className ?? ""}`}
222
+ style={{
223
+ display: "flex",
224
+ alignItems: "flex-start",
225
+ opacity: hidden ? 0 : 1,
226
+ pointerEvents: hidden ? "none" : "auto",
227
+ transition:
228
+ "opacity var(--transition-expressive-color), height var(--transition-expressive), width var(--transition-expressive) ",
229
+ ...style,
230
+ }}
231
+ >
232
+ {logo}
233
+ {menuChildren.length > 0 && (
234
+ <ul className={styles.headerMenu ?? ""}>{menuChildren}</ul>
235
+ )}
236
+ </div>
237
+ );
238
+ }
239
+
240
+ //MARK: Nav.Header
241
+ function NavHeaderBody({
242
+ children,
243
+ style,
244
+ className,
245
+ expandedPaths,
246
+ }: NavHeaderBodyProps) {
247
+ const { navigate, activePath } = useNavRail();
248
+ const { isTablet } = useBreakpoints();
249
+
250
+ // Source of truth for the mega menu. id === null means closed.
251
+ const [active, setActive] = useState<{
252
+ id: string | null;
253
+ content: React.ReactNode;
254
+ }>({ id: null, content: null });
255
+
256
+ const megaOpen = active.id != null;
257
+
258
+ const megaContentRef = useRef<HTMLDivElement>(null);
259
+ const [megaHeight, setMegaHeight] = useState(0);
260
+
261
+ useLayoutEffect(() => {
262
+ if (megaOpen && megaContentRef.current) {
263
+ const cap = window.innerHeight * 0.8; // your 50dvh
264
+ setMegaHeight(Math.min(megaContentRef.current.scrollHeight, cap));
265
+ } else {
266
+ setMegaHeight(0);
267
+ }
268
+ }, [megaOpen, active.content]);
269
+
270
+ // Routes that render the header in its expanded (hero) state. Defaults to the
271
+ // home page; pass `expandedPaths` to opt in other routes (single or several).
272
+ const expandMatchers = useMemo(
273
+ () =>
274
+ expandedPaths
275
+ ? Array.isArray(expandedPaths)
276
+ ? expandedPaths
277
+ : [expandedPaths]
278
+ : ["/"],
279
+ [expandedPaths],
280
+ );
281
+
282
+ // Collapse once the page scrolls past 24px; re-expand the hero only within 4px
283
+ // of the very top. The 4–24px range holds the previous state (hysteresis), and
284
+ // scrolling while the mega menu is open latches collapsed — so closing the menu
285
+ // mid-scroll near the top can't flash the hero back before the 24px threshold
286
+ // catches up. Desktop only — the header is hidden on mobile.
287
+ const [scrolled, setScrolled] = useState(false);
288
+ const megaOpenRef = useRef(megaOpen);
289
+ useLayoutEffect(() => {
290
+ megaOpenRef.current = megaOpen;
291
+ });
292
+ useEffect(() => {
293
+ if (isTablet) return;
294
+ const onScroll = () => {
295
+ const y = window.scrollY;
296
+ setScrolled((prev) =>
297
+ megaOpenRef.current || y > 24 ? true : y < 4 ? false : prev,
298
+ );
299
+ };
300
+ onScroll();
301
+ window.addEventListener("scroll", onScroll, { passive: true });
302
+ return () => window.removeEventListener("scroll", onScroll);
303
+ }, [isTablet]);
304
+
305
+ // An open mega menu always forces the collapsed (compact) header — nothing
306
+ // overrides it. Otherwise the header expands only on an eligible route while
307
+ // still scrolled to the top. Either way the mega region expands directly below
308
+ // the header content in the flex column (see render).
309
+ const collapsed =
310
+ megaOpen || !matchesRoute(expandMatchers, activePath) || scrolled;
311
+
312
+ // Closing only clears the id so `active.content` stays mounted through the
313
+ // collapse animation; the content is nulled in onAnimationComplete once the
314
+ // mega region has finished shrinking to 0 (see render).
315
+ const close = useCallback(
316
+ () => setActive((prev) => ({ ...prev, id: null })),
317
+ [],
318
+ );
319
+ const activate = useCallback((id: string, content: React.ReactNode) => {
320
+ setActive((prev) =>
321
+ prev.id === id ? { ...prev, id: null } : { id, content },
322
+ );
323
+ }, []);
324
+
325
+ // Dev-only: only one Header.Logo allowed in the whole body.
326
+ if (process.env.NODE_ENV !== "production") {
327
+ let logoCount = 0;
328
+ const scan = (nodes: React.ReactNode) =>
329
+ React.Children.forEach(nodes, (c) => {
330
+ if (!React.isValidElement(c)) return;
331
+ if (c.type === NavHeaderLogo) logoCount++;
332
+ const kids = (c.props as { children?: React.ReactNode }).children;
333
+ if (kids) scan(kids);
334
+ });
335
+ scan(children);
336
+ if (logoCount > 1)
337
+ console.warn(
338
+ "Nav.Header: only one Header.Logo may exist in the header body.",
339
+ );
340
+ }
341
+
342
+ const tabContextValue = useMemo<TabContextValue>(
343
+ () => ({ activeId: active.id, activate, close, navigate, activePath }),
344
+ [active.id, activate, close, navigate, activePath],
345
+ );
346
+
347
+ const stateContextValue = useMemo<HeaderStateValue>(
348
+ () => ({ collapsed, megaOpen }),
349
+ [collapsed, megaOpen],
350
+ );
351
+
352
+ // Publish open-state + close handler so Nav.Content's dim (in Nav.tsx) reacts.
353
+ // setOverlay is a stable useState setter → no feedback loop.
354
+ const setOverlay = useContext(NavHeaderOverlayContext)?.setOverlay;
355
+ useEffect(() => {
356
+ setOverlay?.({ isOpen: megaOpen, close });
357
+ }, [megaOpen, close, setOverlay]);
358
+ useEffect(() => () => setOverlay?.(null), [setOverlay]);
359
+
360
+ // Close on scroll / outside pointerdown — desktop only (header is hidden on
361
+ // mobile and must not fight Nav.Bar's listeners).
362
+ const headerRef = useRef<HTMLElement>(null);
363
+ useCollapseOnOutsideInteraction(megaOpen, close, headerRef, !isTablet);
364
+
365
+ return (
366
+ <NavHeaderStateContext.Provider value={stateContextValue}>
367
+ <NavHeaderTabContext.Provider value={tabContextValue}>
368
+ <motion.header
369
+ ref={headerRef}
370
+ className={`${styles.headerBody ?? ""} ${megaOpen ? (styles.megaMenu ?? "") : ""} ${className ?? ""}`}
371
+ style={{
372
+ display: "flex",
373
+ flexDirection: "column",
374
+ alignItems: "flex-start",
375
+ position: "fixed",
376
+ width: "100%",
377
+ zIndex: 1010,
378
+ background:
379
+ "linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, transparent 100%)",
380
+ left: 0,
381
+ top: 0,
382
+ ...style,
383
+ }}
384
+ animate={{
385
+ borderRadius: megaOpen ? "0px 0px 36px 36px" : "0px 0px 0px 0px",
386
+ boxShadow: megaOpen
387
+ ? "0 1px 1px rgba(0,0,0,0.1), 0 2px 2px rgba(0,0,0,0.1), 0 4px 4px rgba(0,0,0,0.1)"
388
+ : "0 0 0 rgba(0,0,0,0)",
389
+ }}
390
+ transition={HEADER_TRANSITION}
391
+ >
392
+ <motion.div
393
+ aria-hidden
394
+ initial={false}
395
+ animate={{ opacity: megaOpen ? 1 : 0 }}
396
+ transition={HEADER_TRANSITION.background}
397
+ style={{
398
+ position: "absolute",
399
+ inset: 0,
400
+ zIndex: -1,
401
+ borderRadius: "inherit",
402
+ pointerEvents: "none",
403
+ background: "var(--md-sys-color-surface-container-low)",
404
+ borderBottom: "1px solid var(--globalUIBorderCard)",
405
+ }}
406
+ />
407
+
408
+ {/* Top row: your Header.Group(s) — space-between */}
409
+ <div
410
+ className={styles.headerContent ?? ""}
411
+ style={{
412
+ display: "flex",
413
+ height: "fit-content",
414
+ width: "100%",
415
+ justifyContent: "space-between",
416
+ padding: collapsed ? "12px" : "24px",
417
+ }}
418
+ >
419
+ {children}
420
+ </div>
421
+
422
+ {/* Mega region: the active tab's children render here. */}
423
+ <motion.div
424
+ className={styles.megamenuContent ?? ""}
425
+ style={{
426
+ width: "100%",
427
+ overflow: "hidden",
428
+ paddingLeft: 24,
429
+ paddingRight: 24,
430
+ }}
431
+ initial={false}
432
+ animate={{
433
+ height: megaHeight,
434
+ opacity: megaOpen ? 1 : 0,
435
+ paddingTop: megaOpen ? 24 : 0,
436
+ paddingBottom: megaOpen ? 24 : 0,
437
+ }}
438
+ transition={HEADER_TRANSITION}
439
+ onAnimationComplete={() =>
440
+ setActive((prev) =>
441
+ prev.id === null ? { id: null, content: null } : prev,
442
+ )
443
+ }
444
+ >
445
+ <div ref={megaContentRef}>{active.content}</div>
446
+ </motion.div>
447
+ </motion.header>
448
+ </NavHeaderTabContext.Provider>
449
+ </NavHeaderStateContext.Provider>
450
+ );
451
+ }
452
+
453
+ type NavHeaderComponent = React.FC<NavHeaderBodyProps> & {
454
+ Group: React.FC<NavHeaderGroupProps>;
455
+ Tab: React.FC<NavHeaderTabProps>;
456
+ Logo: React.FC<NavHeaderLogoProps>;
457
+ };
458
+
459
+ const NavHeader = Object.assign(NavHeaderBody, {
460
+ Group: NavHeaderGroup,
461
+ Tab: NavHeaderTab,
462
+ Logo: NavHeaderLogo,
463
+ }) as NavHeaderComponent;
464
+
465
+ export default NavHeader;