@xsolla/xui-b2c-top-navigation 0.0.0-stage → 0.223.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/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # Temporary Holding Version
1
+ # @xsolla/xui-b2c-top-navigation
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ B2C desktop top navigation. Logo on the left; links, a currencies chip and avatar on the right. The Windows variant keeps the logo and adds back, breadcrumbs and window controls.
@@ -0,0 +1,120 @@
1
+ import React$1, { ReactNode } from 'react';
2
+ import { ThemeOverrideProps } from '@xsolla/xui-core';
3
+
4
+ type TopNavigationPlatform = "web" | "windows";
5
+ /**
6
+ * A link in the navigation bar. Pass `children` to turn the entry into a
7
+ * dropdown trigger; its children render as context-menu entries.
8
+ */
9
+ interface TopNavigationItemData {
10
+ key: string;
11
+ label: string;
12
+ href?: string;
13
+ disabled?: boolean;
14
+ /**
15
+ * Leading icon (20px). Shown only while this item is the active page,
16
+ * matching the Figma Active menu point.
17
+ */
18
+ icon?: ReactNode;
19
+ /** Menu entries — when present the item renders as a dropdown trigger. */
20
+ children?: TopNavigationItemData[];
21
+ accessibilityLabel?: string;
22
+ testID?: string;
23
+ onPress?: () => void;
24
+ }
25
+ interface TopNavigationBreadcrumb {
26
+ key: string;
27
+ label: string;
28
+ href?: string;
29
+ onPress?: () => void;
30
+ }
31
+ /**
32
+ * One balance inside the currencies chip. The bar shows up to two, side by
33
+ * side, matching Figma `.currencies_profile`.
34
+ */
35
+ interface TopNavigationCurrency {
36
+ /** Formatted balance, e.g. `"300"` or `"2k"`. */
37
+ amount: string;
38
+ /** Currency icon rendered at 18px before the amount. */
39
+ icon?: ReactNode;
40
+ /** Accessible name. Falls back to `amount`. */
41
+ accessibilityLabel?: string;
42
+ onPress?: () => void;
43
+ }
44
+ interface TopNavigationUser {
45
+ name: string;
46
+ /** Photo URL. Takes priority over `text` and `icon`. */
47
+ src?: string;
48
+ /**
49
+ * Initials, at most two characters. Used when there is no `src`.
50
+ * When both `src` and `text` are omitted, the user icon is shown.
51
+ */
52
+ text?: string;
53
+ /** Replaces the default user icon when there is no photo or initials. */
54
+ icon?: ReactNode;
55
+ onPress?: () => void;
56
+ }
57
+ interface TopNavigationWindowControls {
58
+ onMinimize?: () => void;
59
+ onMaximize?: () => void;
60
+ onClose?: () => void;
61
+ }
62
+ interface TopNavigationLinkProps {
63
+ item: TopNavigationItemData;
64
+ href?: string;
65
+ isActive: boolean;
66
+ disabled?: boolean;
67
+ onPress: () => void;
68
+ testID?: string;
69
+ children: ReactNode;
70
+ }
71
+ interface TopNavigationLogoContext {
72
+ /** True when the resolved theme is a dark theme. */
73
+ isDark: boolean;
74
+ }
75
+ interface TopNavigationProps extends ThemeOverrideProps {
76
+ /**
77
+ * `web` is logo plus the right-hand menu. `windows` keeps the logo, adds a
78
+ * back control and breadcrumbs beside it, and window controls on the right.
79
+ */
80
+ platform?: TopNavigationPlatform;
81
+ /**
82
+ * Logo slot, shown on both platforms. Pass a node, or a function that
83
+ * receives `{ isDark }` so the logo colour can follow the theme.
84
+ */
85
+ logo?: ReactNode | ((context: TopNavigationLogoContext) => ReactNode);
86
+ /** Primary navigation links. Items with `children` render as dropdowns. */
87
+ items?: TopNavigationItemData[];
88
+ /**
89
+ * Links rendered after a vertical divider (Figma "Extra Links").
90
+ * Dropdown entries are allowed here too.
91
+ */
92
+ extraItems?: TopNavigationItemData[];
93
+ /**
94
+ * Key of the active page. Only that item is drawn in the Active style.
95
+ * A dropdown trigger stays Non Active after an entry is chosen.
96
+ */
97
+ activeKey?: string;
98
+ onItemClick?: (item: TopNavigationItemData) => void;
99
+ linkComponent?: React.ComponentType<TopNavigationLinkProps>;
100
+ /** Show the links area. Defaults to `true`. */
101
+ showMenu?: boolean;
102
+ /** Balances inside the currencies chip. */
103
+ currencies?: TopNavigationCurrency[];
104
+ /** Account avatar beside the currencies chip. */
105
+ user?: TopNavigationUser;
106
+ /** Show the currencies chip and avatar. Defaults to `true`. */
107
+ showAccount?: boolean;
108
+ /** Windows platform: breadcrumb trail. The last entry is the current page. */
109
+ breadcrumbs?: TopNavigationBreadcrumb[];
110
+ /** Windows platform: back control beside the breadcrumbs. Hidden when omitted. */
111
+ onBack?: () => void;
112
+ /** Windows platform: window controls. Hidden when omitted. */
113
+ windowControls?: TopNavigationWindowControls;
114
+ "aria-label"?: string;
115
+ testID?: string;
116
+ }
117
+
118
+ declare const TopNavigation: React$1.FC<TopNavigationProps>;
119
+
120
+ export { TopNavigation, type TopNavigationBreadcrumb, type TopNavigationCurrency, type TopNavigationItemData, type TopNavigationLinkProps, type TopNavigationLogoContext, type TopNavigationPlatform, type TopNavigationProps, type TopNavigationUser, type TopNavigationWindowControls };
@@ -0,0 +1,120 @@
1
+ import React$1, { ReactNode } from 'react';
2
+ import { ThemeOverrideProps } from '@xsolla/xui-core';
3
+
4
+ type TopNavigationPlatform = "web" | "windows";
5
+ /**
6
+ * A link in the navigation bar. Pass `children` to turn the entry into a
7
+ * dropdown trigger; its children render as context-menu entries.
8
+ */
9
+ interface TopNavigationItemData {
10
+ key: string;
11
+ label: string;
12
+ href?: string;
13
+ disabled?: boolean;
14
+ /**
15
+ * Leading icon (20px). Shown only while this item is the active page,
16
+ * matching the Figma Active menu point.
17
+ */
18
+ icon?: ReactNode;
19
+ /** Menu entries — when present the item renders as a dropdown trigger. */
20
+ children?: TopNavigationItemData[];
21
+ accessibilityLabel?: string;
22
+ testID?: string;
23
+ onPress?: () => void;
24
+ }
25
+ interface TopNavigationBreadcrumb {
26
+ key: string;
27
+ label: string;
28
+ href?: string;
29
+ onPress?: () => void;
30
+ }
31
+ /**
32
+ * One balance inside the currencies chip. The bar shows up to two, side by
33
+ * side, matching Figma `.currencies_profile`.
34
+ */
35
+ interface TopNavigationCurrency {
36
+ /** Formatted balance, e.g. `"300"` or `"2k"`. */
37
+ amount: string;
38
+ /** Currency icon rendered at 18px before the amount. */
39
+ icon?: ReactNode;
40
+ /** Accessible name. Falls back to `amount`. */
41
+ accessibilityLabel?: string;
42
+ onPress?: () => void;
43
+ }
44
+ interface TopNavigationUser {
45
+ name: string;
46
+ /** Photo URL. Takes priority over `text` and `icon`. */
47
+ src?: string;
48
+ /**
49
+ * Initials, at most two characters. Used when there is no `src`.
50
+ * When both `src` and `text` are omitted, the user icon is shown.
51
+ */
52
+ text?: string;
53
+ /** Replaces the default user icon when there is no photo or initials. */
54
+ icon?: ReactNode;
55
+ onPress?: () => void;
56
+ }
57
+ interface TopNavigationWindowControls {
58
+ onMinimize?: () => void;
59
+ onMaximize?: () => void;
60
+ onClose?: () => void;
61
+ }
62
+ interface TopNavigationLinkProps {
63
+ item: TopNavigationItemData;
64
+ href?: string;
65
+ isActive: boolean;
66
+ disabled?: boolean;
67
+ onPress: () => void;
68
+ testID?: string;
69
+ children: ReactNode;
70
+ }
71
+ interface TopNavigationLogoContext {
72
+ /** True when the resolved theme is a dark theme. */
73
+ isDark: boolean;
74
+ }
75
+ interface TopNavigationProps extends ThemeOverrideProps {
76
+ /**
77
+ * `web` is logo plus the right-hand menu. `windows` keeps the logo, adds a
78
+ * back control and breadcrumbs beside it, and window controls on the right.
79
+ */
80
+ platform?: TopNavigationPlatform;
81
+ /**
82
+ * Logo slot, shown on both platforms. Pass a node, or a function that
83
+ * receives `{ isDark }` so the logo colour can follow the theme.
84
+ */
85
+ logo?: ReactNode | ((context: TopNavigationLogoContext) => ReactNode);
86
+ /** Primary navigation links. Items with `children` render as dropdowns. */
87
+ items?: TopNavigationItemData[];
88
+ /**
89
+ * Links rendered after a vertical divider (Figma "Extra Links").
90
+ * Dropdown entries are allowed here too.
91
+ */
92
+ extraItems?: TopNavigationItemData[];
93
+ /**
94
+ * Key of the active page. Only that item is drawn in the Active style.
95
+ * A dropdown trigger stays Non Active after an entry is chosen.
96
+ */
97
+ activeKey?: string;
98
+ onItemClick?: (item: TopNavigationItemData) => void;
99
+ linkComponent?: React.ComponentType<TopNavigationLinkProps>;
100
+ /** Show the links area. Defaults to `true`. */
101
+ showMenu?: boolean;
102
+ /** Balances inside the currencies chip. */
103
+ currencies?: TopNavigationCurrency[];
104
+ /** Account avatar beside the currencies chip. */
105
+ user?: TopNavigationUser;
106
+ /** Show the currencies chip and avatar. Defaults to `true`. */
107
+ showAccount?: boolean;
108
+ /** Windows platform: breadcrumb trail. The last entry is the current page. */
109
+ breadcrumbs?: TopNavigationBreadcrumb[];
110
+ /** Windows platform: back control beside the breadcrumbs. Hidden when omitted. */
111
+ onBack?: () => void;
112
+ /** Windows platform: window controls. Hidden when omitted. */
113
+ windowControls?: TopNavigationWindowControls;
114
+ "aria-label"?: string;
115
+ testID?: string;
116
+ }
117
+
118
+ declare const TopNavigation: React$1.FC<TopNavigationProps>;
119
+
120
+ export { TopNavigation, type TopNavigationBreadcrumb, type TopNavigationCurrency, type TopNavigationItemData, type TopNavigationLinkProps, type TopNavigationLogoContext, type TopNavigationPlatform, type TopNavigationProps, type TopNavigationUser, type TopNavigationWindowControls };