@dt-dds/react-app-header 0.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,666 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+
33
+ // src/AppHeader.tsx
34
+ import { useMemo } from "react";
35
+ import { useTheme } from "@emotion/react";
36
+ import { useMedia } from "@dt-dds/react-core";
37
+
38
+ // src/AppHeader.styled.ts
39
+ import styled from "@emotion/styled";
40
+
41
+ // src/constants/index.ts
42
+ var HEADER_HEIGHT = 64;
43
+ var HEADER_HEIGHT_MOBILE = 72;
44
+ var NAVIGATION_HEIGHT = 52;
45
+ var APP_HEADER_Z_INDEX = 1;
46
+ var THIRD_WIDTH = "calc(100% / 3)";
47
+ var LOGO_MAX_HEIGHT = 54;
48
+ var APP_NAME_MAX_WIDTH = 170;
49
+ var APP_NAME_MAX_WIDTH_DESKTOP = 250;
50
+ var APP_NAME_MAX_HEIGHT = 50;
51
+ var COMPOUND_COMPONENT_NAMES = {
52
+ NAVIGATION: "AppHeader.Navigation",
53
+ APP_NAME: "AppHeader.AppName",
54
+ LOGO: "AppHeader.Logo",
55
+ ACTIONS: "AppHeader.Actions"
56
+ };
57
+
58
+ // src/AppHeader.styled.ts
59
+ var AppHeaderStyled = styled.header`
60
+ ${({ theme: theme2, isMobile }) => {
61
+ const paddingHorizontal = theme2.spacing.spacing_60;
62
+ const gap = theme2.spacing.spacing_50;
63
+ return `
64
+ display: flex;
65
+ align-items: center;
66
+ justify-content: flex-start;
67
+ gap: ${gap};
68
+ width: 100%;
69
+ height: ${isMobile ? `${HEADER_HEIGHT_MOBILE}px` : `${HEADER_HEIGHT}px`};
70
+ overflow: hidden;
71
+ padding: 0 ${paddingHorizontal};
72
+ position: fixed;
73
+ top: 0;
74
+ z-index: ${APP_HEADER_Z_INDEX};
75
+ background: ${theme2.palette.surface.contrast};
76
+ `;
77
+ }}
78
+ `;
79
+
80
+ // src/context/AppHeaderContext.tsx
81
+ import { createContext, useContext } from "react";
82
+ import { jsx } from "react/jsx-runtime";
83
+ var AppHeaderContext = createContext(
84
+ null
85
+ );
86
+ var AppHeaderContextProvider = ({
87
+ value,
88
+ children
89
+ }) => {
90
+ return /* @__PURE__ */ jsx(AppHeaderContext.Provider, { value, children });
91
+ };
92
+ var useAppHeaderContext = () => {
93
+ const context = useContext(AppHeaderContext);
94
+ if (!context) {
95
+ throw new Error(
96
+ "AppHeader compound components must be used within AppHeader"
97
+ );
98
+ }
99
+ return context;
100
+ };
101
+
102
+ // src/utils/headerState.ts
103
+ var computeHeaderState = (type, navPosition, appName, hasActionsPositionRight) => ({
104
+ isStandard: type === "standard",
105
+ isCompact: type === "compact",
106
+ isNavCenter: navPosition === "center",
107
+ isNavLeft: navPosition === "left",
108
+ isNavRight: navPosition === "right",
109
+ isNavCompact: type === "compact" || !appName,
110
+ hasAppName: !!appName,
111
+ isActionsPositionRight: hasActionsPositionRight
112
+ });
113
+ var shouldCenterLogo = (type, appName) => {
114
+ return type === "standard" && !!appName;
115
+ };
116
+
117
+ // src/utils/children.ts
118
+ import React, { Children } from "react";
119
+ var getDisplayName = (element) => {
120
+ var _a;
121
+ return (_a = element.type) == null ? void 0 : _a.displayName;
122
+ };
123
+ var findChildRecursive = (children, matcher) => {
124
+ const childrenArray = Children.toArray(children);
125
+ for (const child of childrenArray) {
126
+ if (React.isValidElement(child)) {
127
+ if (matcher(child)) {
128
+ return child;
129
+ }
130
+ const childProps = child.props;
131
+ if (childProps == null ? void 0 : childProps.children) {
132
+ const found = findChildRecursive(childProps.children, matcher);
133
+ if (found) {
134
+ return found;
135
+ }
136
+ }
137
+ }
138
+ }
139
+ return null;
140
+ };
141
+ var findChildByType = (children, type) => {
142
+ return findChildRecursive(
143
+ children,
144
+ (child) => getDisplayName(child) === type
145
+ );
146
+ };
147
+ var findChildByTypeAndProp = (children, type, propName, propValue) => {
148
+ return findChildRecursive(children, (child) => {
149
+ if (getDisplayName(child) !== type) return false;
150
+ const props = child.props;
151
+ return propName in props && props[propName] === propValue;
152
+ });
153
+ };
154
+ var findChildIndexByTypeAndProp = (children, type, propName, propValue) => {
155
+ const childrenArray = Children.toArray(children);
156
+ return childrenArray.findIndex((child) => {
157
+ if (!React.isValidElement(child)) return false;
158
+ const displayName = getDisplayName(child);
159
+ if (displayName !== type) return false;
160
+ const props = child.props;
161
+ return propName in props && props[propName] === propValue;
162
+ });
163
+ };
164
+ var extractProp = (element, propName, defaultValue) => {
165
+ if (!React.isValidElement(element)) {
166
+ return defaultValue;
167
+ }
168
+ const props = element.props;
169
+ return propName in props && props[propName] !== void 0 ? props[propName] : defaultValue;
170
+ };
171
+ var findChildIndices = (children, targetNames) => {
172
+ const indices = {};
173
+ const childrenArray = Children.toArray(children);
174
+ childrenArray.forEach((child, index) => {
175
+ if (React.isValidElement(child)) {
176
+ const displayName = getDisplayName(child);
177
+ if (displayName && targetNames.includes(displayName)) {
178
+ indices[displayName] = index;
179
+ }
180
+ }
181
+ });
182
+ return indices;
183
+ };
184
+
185
+ // src/utils/composition.tsx
186
+ import React2 from "react";
187
+ import { Box } from "@dt-dds/react-box";
188
+ import { theme } from "@dt-dds/themes";
189
+ import { jsxs } from "react/jsx-runtime";
190
+ var areSiblings = (index1, index2) => {
191
+ return Math.abs(index1 - index2) === 1;
192
+ };
193
+ var groupSiblingComponents = (children, componentNames, isMobile, additionalStyles) => {
194
+ const childrenArray = React2.Children.toArray(children);
195
+ const result = [];
196
+ let i = 0;
197
+ while (i < childrenArray.length) {
198
+ const child = childrenArray[i];
199
+ const nextChild = i + 1 < childrenArray.length ? childrenArray[i + 1] : null;
200
+ if (React2.isValidElement(child) && React2.isValidElement(nextChild)) {
201
+ const currentName = getDisplayName(child);
202
+ const nextName = getDisplayName(nextChild);
203
+ const shouldGroup = currentName && nextName && componentNames.includes(currentName) && componentNames.includes(nextName) && areSiblings(i, i + 1);
204
+ if (shouldGroup) {
205
+ result.push(
206
+ /* @__PURE__ */ jsxs(
207
+ Box,
208
+ {
209
+ style: __spreadValues({
210
+ display: "flex",
211
+ flexWrap: "nowrap",
212
+ flexDirection: isMobile ? "column" : "row",
213
+ alignItems: isMobile ? "flex-start" : "center",
214
+ justifyContent: isMobile ? "center" : "flex-start",
215
+ height: isMobile ? "48px" : "auto",
216
+ gap: isMobile ? theme.spacing.spacing_0 : theme.spacing.spacing_30
217
+ }, additionalStyles),
218
+ children: [
219
+ child,
220
+ nextChild
221
+ ]
222
+ },
223
+ `group-${i}`
224
+ )
225
+ );
226
+ i += 2;
227
+ continue;
228
+ }
229
+ }
230
+ result.push(child);
231
+ i++;
232
+ }
233
+ return result;
234
+ };
235
+ var shouldGroupNavigationAndActions = (state) => {
236
+ if (!state.isNavRight || !state.isActionsPositionRight) {
237
+ return false;
238
+ }
239
+ return state.isCompact || state.isStandard && !state.hasAppName;
240
+ };
241
+ var groupNavigationAndActionsIfSiblings = (children, isMobile, themeInstance) => {
242
+ var _a;
243
+ const normalizedChildren = children;
244
+ const indices = findChildIndices(normalizedChildren, [
245
+ COMPOUND_COMPONENT_NAMES.NAVIGATION,
246
+ COMPOUND_COMPONENT_NAMES.ACTIONS
247
+ ]);
248
+ const navIndex = (_a = indices[COMPOUND_COMPONENT_NAMES.NAVIGATION]) != null ? _a : -1;
249
+ const actionsRightIndex = findChildIndexByTypeAndProp(
250
+ normalizedChildren,
251
+ COMPOUND_COMPONENT_NAMES.ACTIONS,
252
+ "position",
253
+ "right"
254
+ );
255
+ const areSiblingsAfterGrouping = navIndex !== -1 && actionsRightIndex !== -1 && areSiblings(navIndex, actionsRightIndex);
256
+ if (!areSiblingsAfterGrouping) {
257
+ return Array.isArray(children) ? children : React2.Children.toArray(children);
258
+ }
259
+ return groupSiblingComponents(
260
+ normalizedChildren,
261
+ [COMPOUND_COMPONENT_NAMES.NAVIGATION, COMPOUND_COMPONENT_NAMES.ACTIONS],
262
+ isMobile,
263
+ {
264
+ position: "fixed",
265
+ right: themeInstance.spacing.spacing_60
266
+ }
267
+ );
268
+ };
269
+
270
+ // src/AppHeader.tsx
271
+ import { jsx as jsx2 } from "react/jsx-runtime";
272
+ var AppHeader = (_a) => {
273
+ var _b = _a, {
274
+ type = "standard",
275
+ style,
276
+ children
277
+ } = _b, rest = __objRest(_b, [
278
+ "type",
279
+ "style",
280
+ "children"
281
+ ]);
282
+ var _a2, _b2;
283
+ const theme2 = useTheme();
284
+ const isMobile = useMedia(`(max-width: ${theme2.breakpoints.mq3}px)`);
285
+ const navPosition = extractProp(
286
+ findChildByType(children, COMPOUND_COMPONENT_NAMES.NAVIGATION),
287
+ "position",
288
+ "center"
289
+ );
290
+ const appName = extractProp(
291
+ findChildByType(children, COMPOUND_COMPONENT_NAMES.APP_NAME),
292
+ "name",
293
+ void 0
294
+ );
295
+ const childIndices = findChildIndices(children, [
296
+ COMPOUND_COMPONENT_NAMES.APP_NAME,
297
+ COMPOUND_COMPONENT_NAMES.LOGO,
298
+ COMPOUND_COMPONENT_NAMES.NAVIGATION,
299
+ COMPOUND_COMPONENT_NAMES.ACTIONS
300
+ ]);
301
+ const appNameIndex = (_a2 = childIndices[COMPOUND_COMPONENT_NAMES.APP_NAME]) != null ? _a2 : -1;
302
+ const logoIndex = (_b2 = childIndices[COMPOUND_COMPONENT_NAMES.LOGO]) != null ? _b2 : -1;
303
+ const shouldCenterLogoValue = shouldCenterLogo(type, appName);
304
+ const hasAppNameAsSibling = appNameIndex !== -1 && logoIndex !== -1 && areSiblings(appNameIndex, logoIndex);
305
+ const hasActionsPositionRight = findChildByTypeAndProp(
306
+ children,
307
+ COMPOUND_COMPONENT_NAMES.ACTIONS,
308
+ "position",
309
+ "right"
310
+ ) !== null;
311
+ const state = computeHeaderState(
312
+ type,
313
+ navPosition,
314
+ appName,
315
+ hasActionsPositionRight
316
+ );
317
+ const contextValue = useMemo(
318
+ () => ({
319
+ state,
320
+ shouldCenterLogo: shouldCenterLogoValue,
321
+ hasAppNameAsSibling,
322
+ isMobile
323
+ }),
324
+ [state, shouldCenterLogoValue, hasAppNameAsSibling, isMobile]
325
+ );
326
+ const processedChildren = useMemo(() => {
327
+ let result = groupSiblingComponents(
328
+ children,
329
+ [COMPOUND_COMPONENT_NAMES.APP_NAME, COMPOUND_COMPONENT_NAMES.LOGO],
330
+ isMobile
331
+ );
332
+ if (shouldGroupNavigationAndActions(state)) {
333
+ result = groupNavigationAndActionsIfSiblings(
334
+ result,
335
+ isMobile,
336
+ theme2
337
+ );
338
+ }
339
+ return result;
340
+ }, [children, state, isMobile, theme2]);
341
+ return /* @__PURE__ */ jsx2(AppHeaderContextProvider, { value: contextValue, children: /* @__PURE__ */ jsx2(AppHeaderStyled, __spreadProps(__spreadValues({ isMobile, style }, rest), { children: processedChildren })) });
342
+ };
343
+
344
+ // src/components/Actions/Actions.tsx
345
+ import { useTheme as useTheme2 } from "@emotion/react";
346
+ import { useMedia as useMedia3 } from "@dt-dds/react-core";
347
+
348
+ // src/components/Actions/Actions.styled.tsx
349
+ import styled2 from "@emotion/styled";
350
+ var getActionsPosition = (position, state) => {
351
+ if (position === "left") {
352
+ return "relative";
353
+ }
354
+ if (state.isNavRight) {
355
+ return state.isStandard && state.hasAppName ? "fixed" : "relative";
356
+ }
357
+ return "fixed";
358
+ };
359
+ var getActionsRight = (theme2, position, state) => {
360
+ if (position === "left") {
361
+ return "auto";
362
+ }
363
+ const defaultRight = theme2.spacing.spacing_60;
364
+ if (state.isNavRight) {
365
+ return state.isStandard && state.hasAppName ? defaultRight : 0;
366
+ }
367
+ return defaultRight;
368
+ };
369
+ var getActionsMinWidth = (state, position) => {
370
+ if (position === "left") {
371
+ return "auto";
372
+ }
373
+ const { isNavLeft, isStandard, hasAppName } = state;
374
+ return isNavLeft && isStandard && !hasAppName ? "auto" : THIRD_WIDTH;
375
+ };
376
+ var ActionsContainer = styled2.div`
377
+ ${({ theme: theme2, state, position = "right" }) => {
378
+ const cssPosition = getActionsPosition(position, state);
379
+ const right = getActionsRight(theme2, position, state);
380
+ const minWidth = getActionsMinWidth(state, position);
381
+ return `
382
+ display: flex;
383
+ align-items: center;
384
+ position: ${cssPosition};
385
+ right: ${right};
386
+ min-width: ${minWidth};
387
+ flex-direction: row;
388
+ justify-content: ${position === "left" ? "flex-start" : "flex-end"};
389
+ gap: ${theme2.spacing.spacing_50};
390
+ `;
391
+ }}
392
+ `;
393
+
394
+ // src/utils/responsive.tsx
395
+ import { useMedia as useMedia2 } from "@dt-dds/react-core";
396
+ import { jsx as jsx3 } from "react/jsx-runtime";
397
+ var withResponsive = (Component) => {
398
+ const ResponsiveComponent = (props) => {
399
+ const hideMatches = useMedia2(props.hide || "(max-width: 0px)");
400
+ const showMatches = useMedia2(props.show || "(max-width: 0px)");
401
+ if (props.hide && hideMatches) return null;
402
+ if (props.show && !showMatches) return null;
403
+ const _a = props, { hide, show } = _a, componentProps = __objRest(_a, ["hide", "show"]);
404
+ return /* @__PURE__ */ jsx3(Component, __spreadValues({}, componentProps));
405
+ };
406
+ ResponsiveComponent.displayName = Component.displayName || Component.name || "Component";
407
+ return ResponsiveComponent;
408
+ };
409
+
410
+ // src/components/Actions/Actions.tsx
411
+ import { jsx as jsx4 } from "react/jsx-runtime";
412
+ var ActionsBase = (_a) => {
413
+ var _b = _a, {
414
+ children,
415
+ position = "right"
416
+ } = _b, rest = __objRest(_b, [
417
+ "children",
418
+ "position"
419
+ ]);
420
+ const theme2 = useTheme2();
421
+ const isMobile = useMedia3(`(max-width: ${theme2.breakpoints.mq3}px)`);
422
+ const { state } = useAppHeaderContext();
423
+ return /* @__PURE__ */ jsx4(
424
+ ActionsContainer,
425
+ __spreadProps(__spreadValues({
426
+ isMobile,
427
+ position,
428
+ state
429
+ }, rest), {
430
+ children
431
+ })
432
+ );
433
+ };
434
+ ActionsBase.displayName = "AppHeader.Actions";
435
+ var Actions = withResponsive(ActionsBase);
436
+
437
+ // src/components/AppName/AppName.tsx
438
+ import { Typography } from "@dt-dds/react-typography";
439
+
440
+ // src/components/AppName/AppName.styled.tsx
441
+ import styled3 from "@emotion/styled";
442
+ var AppNameContainer = styled3.div`
443
+ ${({ theme: theme2, state, isMobile }) => {
444
+ const shouldAlignLeft = isMobile && state.isStandard;
445
+ return `
446
+ display: flex;
447
+ flex-flow: row nowrap;
448
+ align-items: center;
449
+ min-width: auto;
450
+ width: auto;
451
+ max-width: ${APP_NAME_MAX_WIDTH}px;
452
+ max-height: ${APP_NAME_MAX_HEIGHT}px;
453
+
454
+ ${shouldAlignLeft ? "justify-content: flex-start;" : ""}
455
+
456
+ @media screen and (min-width: ${theme2.breakpoints.mq3}px) {
457
+ max-width: ${APP_NAME_MAX_WIDTH_DESKTOP}px;
458
+ }
459
+
460
+ > * {
461
+ white-space: nowrap;
462
+ overflow: hidden;
463
+ text-overflow: ellipsis;
464
+ }
465
+
466
+ `;
467
+ }}
468
+ `;
469
+
470
+ // src/components/AppName/AppName.tsx
471
+ import { jsx as jsx5 } from "react/jsx-runtime";
472
+ var AppNameBase = (_a) => {
473
+ var _b = _a, {
474
+ name,
475
+ children
476
+ } = _b, rest = __objRest(_b, [
477
+ "name",
478
+ "children"
479
+ ]);
480
+ const { state, isMobile } = useAppHeaderContext();
481
+ const isStandardFontStyles = state.isStandard ? "h5" : "h5Bold";
482
+ const fontStyles = !isMobile ? isStandardFontStyles : "h6Bold";
483
+ const content = children != null ? children : name;
484
+ if (!content) {
485
+ return null;
486
+ }
487
+ if (children) {
488
+ return /* @__PURE__ */ jsx5(AppNameContainer, __spreadProps(__spreadValues({ isMobile, state }, rest), { children: content }));
489
+ }
490
+ return /* @__PURE__ */ jsx5(AppNameContainer, __spreadProps(__spreadValues({ isMobile, state }, rest), { children: /* @__PURE__ */ jsx5(
491
+ Typography,
492
+ {
493
+ color: "primary.default",
494
+ element: "span",
495
+ fontStyles,
496
+ children: content
497
+ }
498
+ ) }));
499
+ };
500
+ AppNameBase.displayName = "AppHeader.AppName";
501
+ var AppName = withResponsive(AppNameBase);
502
+
503
+ // src/components/Logo/Logo.styled.tsx
504
+ import styled4 from "@emotion/styled";
505
+ var LogoContainer = styled4.div`
506
+ ${({ shouldCenterLogo: shouldCenterLogo2 }) => {
507
+ const centerLogoStyles = `
508
+ width: auto;
509
+ min-width: auto;
510
+ margin: 0 auto;
511
+ position: absolute;
512
+ left: 50%;
513
+ transform: translateX(-50%);
514
+ `;
515
+ return `
516
+ display: flex;
517
+ flex-flow: row nowrap;
518
+ align-items: center;
519
+ min-width: auto;
520
+ height: auto;
521
+
522
+ img,
523
+ [data-nextjs-image],
524
+ svg,
525
+ > * {
526
+ display: flex;
527
+ max-height: ${LOGO_MAX_HEIGHT}px;
528
+ width: auto;
529
+ height: auto;
530
+ object-fit: contain;
531
+ }
532
+
533
+ ${shouldCenterLogo2 ? centerLogoStyles : ""}
534
+ `;
535
+ }}
536
+ `;
537
+
538
+ // src/components/Logo/Logo.tsx
539
+ import { jsx as jsx6 } from "react/jsx-runtime";
540
+ var LogoBase = (_a) => {
541
+ var _b = _a, {
542
+ children
543
+ } = _b, rest = __objRest(_b, [
544
+ "children"
545
+ ]);
546
+ const { shouldCenterLogo: shouldCenterLogo2, isMobile } = useAppHeaderContext();
547
+ const shouldCenter = shouldCenterLogo2 && !isMobile;
548
+ return /* @__PURE__ */ jsx6(LogoContainer, __spreadProps(__spreadValues({ shouldCenterLogo: shouldCenter }, rest), { children }));
549
+ };
550
+ LogoBase.displayName = "AppHeader.Logo";
551
+ var Logo = withResponsive(LogoBase);
552
+
553
+ // src/components/Navigation/Navigation.styled.ts
554
+ import styled5 from "@emotion/styled";
555
+ var CENTERING_STYLES = {
556
+ absoluteCenter: `
557
+ position: absolute;
558
+ left: 50%;
559
+ top: 50%;
560
+ transform: translate(-50%, -50%);
561
+ width: auto;
562
+ max-width: calc(100% - 400px); // hardcoded value to avoid layout shift
563
+ min-width: 0;
564
+ overflow: hidden;
565
+ `,
566
+ autoMargins: `
567
+ margin-left: auto;
568
+ margin-right: auto;
569
+ `
570
+ };
571
+ var shouldUseAbsoluteCenter = (state) => {
572
+ if (!state.isNavCenter) {
573
+ return false;
574
+ }
575
+ return state.isNavCompact || !state.hasAppName;
576
+ };
577
+ var getNavigationCenteringStyles = (state) => {
578
+ if (!shouldUseAbsoluteCenter(state)) {
579
+ return state.isNavCenter ? CENTERING_STYLES.autoMargins : "";
580
+ }
581
+ return CENTERING_STYLES.absoluteCenter;
582
+ };
583
+ var getJustifyContent = (isAbsoluteCenter, isNavLeft, isNavRight) => {
584
+ if (isAbsoluteCenter) {
585
+ return "center";
586
+ }
587
+ if (isNavLeft) {
588
+ return "flex-start";
589
+ }
590
+ if (isNavRight) {
591
+ return "flex-end";
592
+ }
593
+ return "center";
594
+ };
595
+ var NavigationStyled = styled5.nav`
596
+ ${({ theme: theme2, state }) => {
597
+ const { isStandard, hasAppName, isNavCompact, isNavLeft, isNavRight } = state;
598
+ const isStandardAndHasAppName = isStandard && hasAppName;
599
+ const isAbsoluteCenter = shouldUseAbsoluteCenter(state);
600
+ const basePosition = isStandardAndHasAppName ? "fixed" : "relative";
601
+ const baseTop = isNavCompact ? 0 : `${HEADER_HEIGHT}px`;
602
+ const baseWidth = isNavCompact ? "auto" : "100%";
603
+ const minHeight = isNavCompact ? "auto" : `${NAVIGATION_HEIGHT}px`;
604
+ const position = isAbsoluteCenter ? "absolute" : basePosition;
605
+ const top = isAbsoluteCenter ? "50%" : baseTop;
606
+ const left = isAbsoluteCenter ? "50%" : "0";
607
+ const right = isAbsoluteCenter ? "auto" : "0";
608
+ const width = isAbsoluteCenter ? "auto" : baseWidth;
609
+ const justifyContent = getJustifyContent(
610
+ isAbsoluteCenter,
611
+ isNavLeft,
612
+ isNavRight
613
+ );
614
+ const centeringStyles = getNavigationCenteringStyles(state);
615
+ return `
616
+ position: ${position};
617
+ top: ${top};
618
+ left: ${left};
619
+ right: ${right};
620
+ z-index: ${APP_HEADER_Z_INDEX};
621
+ width: ${width};
622
+ min-height: ${minHeight};
623
+ height: auto;
624
+ background-color: ${theme2.palette.surface.contrast};
625
+ display: flex;
626
+ flex-flow: row nowrap;
627
+ align-items: center;
628
+ justify-content: ${justifyContent};
629
+ padding: 0 ${theme2.spacing.spacing_60};
630
+
631
+ ${centeringStyles}
632
+ `;
633
+ }}
634
+ `;
635
+
636
+ // src/components/Navigation/Navigation.tsx
637
+ import { jsx as jsx7 } from "react/jsx-runtime";
638
+ var NavigationBase = (_a) => {
639
+ var _b = _a, {
640
+ children
641
+ } = _b, rest = __objRest(_b, [
642
+ "children"
643
+ ]);
644
+ const { state } = useAppHeaderContext();
645
+ return /* @__PURE__ */ jsx7(NavigationStyled, __spreadProps(__spreadValues({ state }, rest), { children }));
646
+ };
647
+ NavigationBase.displayName = "AppHeader.Navigation";
648
+ var Navigation = withResponsive(NavigationBase);
649
+
650
+ // src/index.ts
651
+ var AppHeader2 = Object.assign(
652
+ AppHeader,
653
+ {
654
+ Logo,
655
+ AppName,
656
+ Navigation,
657
+ Actions
658
+ }
659
+ );
660
+ export {
661
+ Actions,
662
+ AppHeader2 as AppHeader,
663
+ AppName,
664
+ Logo,
665
+ Navigation
666
+ };