@geneui/components 3.0.0-next-be5e9b9-26062025 → 3.0.0-next-9873985-09072025

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.
@@ -0,0 +1,408 @@
1
+ import React__default, { forwardRef, useState, useRef, useEffect, useContext, cloneElement } from 'react';
2
+ import { c as classNames } from './index-ce02421b.js';
3
+ import { _ as _objectWithoutProperties, a as _extends } from './ActivityRecent-b88e2ba8.js';
4
+ import Button from './Button.js';
5
+ import Divider from './Divider.js';
6
+ import Logo from './Logo.js';
7
+ import { Products, ProductsMainSection, Product, ProductsSecondarySection } from './Products.js';
8
+ import { S as SvgCaretDownFilled, P as Profile } from './index-b3aa52eb.js';
9
+ import Text from './Text.js';
10
+ import Loader from './Loader.js';
11
+ import { P as Popover, a as PopoverBody } from './PopoverBody-989eb114.js';
12
+ import Scrollbar from './Scrollbar.js';
13
+ import { a as useClickOutside } from './index-ead22fa8.js';
14
+ import { s as styleInject } from './style-inject.es-746bb8ed.js';
15
+ import { a as GeneUIDesignSystemContext } from './index-b1807fa4.js';
16
+ import './Badge.js';
17
+ import './index-0b9e90da.js';
18
+ import './index-0409f986.js';
19
+ import './index-a2688a52.js';
20
+ import './CheckMark-34798545.js';
21
+ import './floating-ui.react-a6c3b969.js';
22
+ import 'react-dom';
23
+ import './Info-0f0741e0.js';
24
+ import './X-20da3b4a.js';
25
+ import 'prop-types';
26
+ import './useDebounceCallback-999deae7.js';
27
+
28
+ var _excluded$1 = ["size", "color"];
29
+ var SvgHamburgerMenu = function SvgHamburgerMenu(_ref) {
30
+ var _ref$size = _ref.size,
31
+ size = _ref$size === void 0 ? 24 : _ref$size,
32
+ _ref$color = _ref.color,
33
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
34
+ props = _objectWithoutProperties(_ref, _excluded$1);
35
+ return /*#__PURE__*/React__default.createElement("svg", _extends({
36
+ width: size,
37
+ height: size,
38
+ viewBox: "0 0 24 24",
39
+ fill: color,
40
+ xmlns: "http://www.w3.org/2000/svg"
41
+ }, props), /*#__PURE__*/React__default.createElement("path", {
42
+ d: "M2.75 17.551h18.5c.415 0 .75.325.75.725 0 .366-.282.67-.648.717l-.102.007h-18.5a.738.738 0 0 1-.75-.724c0-.367.283-.67.649-.718l.101-.007h18.5-18.5Zm0-6.274h18.5c.415 0 .75.324.75.724 0 .367-.282.67-.648.718l-.102.007h-18.5a.737.737 0 0 1-.75-.725c0-.366.283-.67.649-.717l.101-.007h18.5-18.5Zm0-6.277h18.5c.414 0 .75.324.75.724 0 .367-.283.67-.649.718l-.101.007h-18.5a.737.737 0 0 1-.75-.725c0-.366.282-.67.648-.717l.102-.007h18.5-18.5Z",
43
+ fill: color
44
+ }));
45
+ };
46
+
47
+ var _excluded = ["size", "color"];
48
+ var SvgQuestionMark = function SvgQuestionMark(_ref) {
49
+ var _ref$size = _ref.size,
50
+ size = _ref$size === void 0 ? 24 : _ref$size,
51
+ _ref$color = _ref.color,
52
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
53
+ props = _objectWithoutProperties(_ref, _excluded);
54
+ return /*#__PURE__*/React__default.createElement("svg", _extends({
55
+ width: size,
56
+ height: size,
57
+ viewBox: "0 0 24 24",
58
+ fill: color,
59
+ xmlns: "http://www.w3.org/2000/svg"
60
+ }, props), /*#__PURE__*/React__default.createElement("path", {
61
+ d: "M12 2c5.523 0 10 4.478 10 10s-4.477 10-10 10-10-4.478-10-10 4.477-10 10-10Zm0 1.667c-4.595 0-8.333 3.738-8.333 8.333 0 4.595 3.738 8.333 8.333 8.333 4.595 0 8.333-3.738 8.333-8.333 0-4.595-3.738-8.333-8.333-8.333Zm0 11.833a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm0-8.75a2.75 2.75 0 0 1 2.75 2.75c0 1.01-.297 1.574-1.051 2.359l-.169.171c-.622.622-.78.886-.78 1.47a.75.75 0 0 1-1.5 0c0-1.01.297-1.574 1.051-2.359l.169-.171c.622-.622.78-.886.78-1.47a1.25 1.25 0 0 0-2.493-.128l-.007.128a.75.75 0 0 1-1.5 0 2.75 2.75 0 0 1 2.75-2.75Z",
62
+ fill: color
63
+ }));
64
+ };
65
+
66
+ const Limit = ({ label = "Limit", limit = "0", isMobile }) => {
67
+ return (React__default.createElement("div", { className: "globalHeader__limit" },
68
+ React__default.createElement(Text, { as: "span", variant: "labelMediumSemibold", className: classNames({ globalHeader__limit_label: isMobile }) }, isMobile ? label : `${label} -`),
69
+ React__default.createElement(Text, { as: "span", variant: "labelMediumSemibold", className: classNames({ globalHeader__limit_limit: isMobile }) }, limit.toString())));
70
+ };
71
+
72
+ const PartnerItem = forwardRef(({ title, onChange, id, selected }, ref) => {
73
+ const handleClick = () => {
74
+ onChange(id);
75
+ };
76
+ return (React__default.createElement("button", { type: "button", className: classNames("partners__partner", { partners__partner_selected: selected }), onClick: handleClick, ref: ref },
77
+ React__default.createElement(Text, { as: "span", className: "partners__partnerName" }, title),
78
+ React__default.createElement(Text, { as: "span", className: "partners__partnerID" }, id.toString())));
79
+ });
80
+
81
+ var css_248z$1 = ".partners__popoverBody{background-color:var(--guit-sem-color-background-neutral-1-nudge);border-radius:var(--guit-ref-radius-2xsmall);padding-block:var(--guit-ref-spacing-3xsmall)}.partners__popoverContent{display:flex;flex-direction:column;height:100%}.partners__loader{height:100%;width:100%}.partners__header{border-bottom:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-neutral-2);display:flex;flex:none;flex-direction:column;padding-bottom:var(--guit-ref-spacing-xsmall);padding-top:var(--guit-ref-spacing-3xsmall);padding-inline:var(--guit-ref-spacing-large);row-gap:var(--guit-ref-spacing-xsmall)}.partners__title{column-gap:var(--guit-ref-spacing-xsmall);display:flex;flex:1;justify-content:space-between}.partners__titleName{color:var(--guit-sem-color-foreground-neutral-2);flex:1}.partners__titleID{color:var(--guit-sem-color-foreground-neutral-1);flex:none}.partners__scrollbar{flex:1;min-height:0}.partners__content{display:flex;flex-direction:column;padding-block:var(--guit-ref-spacing-3xsmall);padding-inline:var(--guit-ref-spacing-xsmall);row-gap:var(--guit-ref-spacing-3xsmall)}.partners__partner{align-items:center;background-color:var(--guit-sem-color-background-neutral-1-nudge);border-radius:var(--guit-ref-radius-3xsmall);display:flex;gap:var(--guit-ref-spacing-xsmall);justify-content:space-between;padding-block:var(--guit-ref-spacing-2xsmall);padding-inline:var(--guit-ref-spacing-medium);width:100%}@media screen and (hover:hover){.partners__partner:hover{background-color:var(--guit-sem-color-background-neutral-1-nudge-hover)}}.partners__partner:disabled{cursor:not-allowed}.partners__partner:disabled .partners__partnerID,.partners__partner:disabled .partners__partnerName{color:var(--guit-sem-color-foreground-disabled)}.partners__partner:active:not(:disabled){background-color:var(--guit-sem-color-background-neutral-1-nudge-pressed)}.partners__partner_selected .partners__partnerID,.partners__partner_selected .partners__partnerName{color:var(--guit-sem-color-foreground-selected)}.partners__partner:not(:disabled):not(.partners__partner_selected) .partners__partnerName{color:var(--guit-sem-color-foreground-neutral-2)}.partners__partner:not(:disabled):not(.partners__partner_selected) .partners__partnerID{color:var(--guit-sem-color-foreground-neutral-1)}.partners__partnerName{flex:1}.partners__partnerID{flex:none}";
82
+ styleInject(css_248z$1);
83
+
84
+ const Partners = ({ onPartnerSelect, partners, loading, searchPlaceholder, loadingText = "Loading", disabled = false, title = "Partner", idName = "ID" }) => {
85
+ const [propsForProductsPopover, setPropsForProductsPopover] = useState({});
86
+ const [mappedPartners, setMappedPartners] = useState([]);
87
+ const [selectedPartner, setSelectedPartner] = useState(null);
88
+ const [hasScrolled, setHasScrolled] = useState(false);
89
+ const selectedPartnerRef = useRef(null);
90
+ const [isProductsOpen, setIsProductsOpen] = useState(false);
91
+ const popoverRef = useRef({
92
+ floatingElement: { current: null },
93
+ referenceElement: { current: null }
94
+ });
95
+ useEffect(() => {
96
+ setMappedPartners(partners || []);
97
+ }, [partners]);
98
+ useEffect(() => {
99
+ if (!partners || partners.length === 0)
100
+ return;
101
+ const selected = partners.find((p) => p.selected) || null;
102
+ setSelectedPartner(selected);
103
+ }, [partners]);
104
+ const assignSelectedRef = (el, id) => {
105
+ if ((selectedPartner === null || selectedPartner === void 0 ? void 0 : selectedPartner.id) === id) {
106
+ selectedPartnerRef.current = el;
107
+ }
108
+ };
109
+ useEffect(() => {
110
+ const currentRef = selectedPartnerRef.current;
111
+ if (isProductsOpen && currentRef && !hasScrolled) {
112
+ currentRef.scrollIntoView();
113
+ }
114
+ }, [selectedPartner, isProductsOpen, selectedPartnerRef.current, assignSelectedRef]);
115
+ useClickOutside(() => {
116
+ setIsProductsOpen(false);
117
+ }, [popoverRef.current.floatingElement, popoverRef.current.referenceElement]);
118
+ const onProductsToggle = () => {
119
+ setHasScrolled(false);
120
+ setIsProductsOpen((prevState) => !prevState);
121
+ };
122
+ const onPartnerItemSelect = (partner) => {
123
+ onPartnerSelect === null || onPartnerSelect === void 0 ? void 0 : onPartnerSelect(partner);
124
+ onProductsToggle();
125
+ };
126
+ const searchHandler = (e) => {
127
+ const value = e.target.value.toLowerCase();
128
+ const partnersSnapshot = (partners === null || partners === void 0 ? void 0 : partners.length) ? partners : [];
129
+ setHasScrolled(true);
130
+ setMappedPartners(() => {
131
+ return partnersSnapshot.filter((partner) => partner.title.toLowerCase().includes(value) || partner.id.toString().includes(value));
132
+ });
133
+ };
134
+ return (React__default.createElement("div", { className: "partners" },
135
+ React__default.createElement(Button, Object.assign({ disabled: disabled, onClick: onProductsToggle, appearance: "inverse", layout: "text", size: "medium", Icon: SvgCaretDownFilled, iconPosition: "after" }, propsForProductsPopover), (selectedPartner === null || selectedPartner === void 0 ? void 0 : selectedPartner.title) || "Partner"),
136
+ React__default.createElement(Popover, { setProps: setPropsForProductsPopover, position: "bottom-right", size: "medium", withArrow: false, open: isProductsOpen, ref: popoverRef },
137
+ React__default.createElement(PopoverBody, { withScrollbar: false, withPadding: false, className: "partners__popoverBody popover_size_small" }, loading ? (React__default.createElement(Loader, { className: "partners__loader", text: loadingText, textPosition: "below" })) : (React__default.createElement("div", { className: "partners__popoverContent" },
138
+ React__default.createElement("div", { className: "partners__header" },
139
+ React__default.createElement("input", { type: "search", onChange: searchHandler, placeholder: searchPlaceholder, "aria-label": "Search partners", role: "searchbox" }),
140
+ React__default.createElement("div", { className: "partners__title" },
141
+ React__default.createElement(Text, { as: "span", className: "partners__titleName" }, title),
142
+ React__default.createElement(Text, { as: "span", className: "partners__titleID" }, idName))),
143
+ React__default.createElement(Scrollbar, { className: "partners__scrollbar" },
144
+ React__default.createElement("div", { className: "partners__content" }, mappedPartners === null || mappedPartners === void 0 ? void 0 : mappedPartners.map((partner) => {
145
+ return (React__default.createElement(PartnerItem, Object.assign({ key: partner.id }, partner, { onChange: () => {
146
+ onPartnerItemSelect(partner);
147
+ }, ref: (el) => {
148
+ return assignSelectedRef(el, partner.id);
149
+ } })));
150
+ })))))))));
151
+ };
152
+
153
+ const Time = ({ timeZone, format = "24h", className }) => {
154
+ const [time, setTime] = useState("");
155
+ useEffect(() => {
156
+ const updateTime = () => {
157
+ const now = new Date();
158
+ const formatter = new Intl.DateTimeFormat("en-US", {
159
+ hour: "2-digit",
160
+ minute: "2-digit",
161
+ second: "2-digit",
162
+ hour12: format === "12h",
163
+ timeZone: timeZone || Intl.DateTimeFormat().resolvedOptions().timeZone
164
+ });
165
+ const formattedTime = formatter.format(now);
166
+ setTime(formattedTime);
167
+ };
168
+ updateTime();
169
+ const interval = setInterval(updateTime, 1000);
170
+ return () => clearInterval(interval);
171
+ }, [timeZone, format]);
172
+ return (React__default.createElement("div", { className: classNames("globalHeader__time", className) },
173
+ React__default.createElement(Text, { as: "span", variant: "labelMediumSemibold" }, format === "12h" ? time.slice(0, -2) : time),
174
+ format === "12h" && (React__default.createElement(Text, { as: "span", variant: "labelMediumSemibold" }, time.slice(-2)))));
175
+ };
176
+
177
+ var css_248z = ".globalHeader{background-color:var(--guit-sem-color-background-neutral-5);color-scheme:light;column-gap:var(--guit-ref-spacing-2xlarge);display:flex;justify-content:space-between;padding-inline:var(--guit-ref-spacing-large)}.globalHeader_mobile{padding-block:var(--guit-ref-spacing-small)}.globalHeader:not(.globalHeader_mobile){padding-block:var(--guit-ref-spacing-medium)}.globalHeader_side_left{align-items:center;column-gap:var(--guit-ref-spacing-large);display:flex}.globalHeader_side_right{align-items:center;column-gap:var(--guit-ref-spacing-xsmall);display:flex}.globalHeader__logo_link{border-radius:.4rem;text-decoration:none}.globalHeader__domain{align-items:center;color:var(--guit-sem-color-foreground-inverse-notheme);display:flex}.globalHeader__text{color:var(--guit-sem-color-foreground-inverse)}.globalHeader__divider{height:var(--guit-sem-dimension-height-small-nudge)}.globalHeader__actions,.globalHeader__item{align-items:center;column-gap:var(--guit-ref-spacing-xsmall);display:flex}.globalHeader__time{align-items:center;color:var(--guit-sem-color-foreground-inverse-notheme);display:flex;gap:.4rem}.globalHeader__time_mobile{color:var(--guit-sem-color-foreground-neutral-2)}.globalHeader__time_text{color:var(--guit-sem-color-foreground-neutral-1)}.globalHeader__limit{align-items:center;color:var(--guit-sem-color-foreground-inverse-notheme);display:flex;gap:var(--guit-ref-spacing-2xsmall)}.globalHeader__limit_label{color:var(--guit-sem-color-foreground-neutral-1)}.globalHeader__limit_limit{color:var(--guit-sem-color-foreground-neutral-2)}";
178
+ styleInject(css_248z);
179
+
180
+ // Utilities
181
+ const idPrefixCreator = (data, prefix) => {
182
+ return (data === null || data === void 0 ? void 0 : data.map((item) => (Object.assign(Object.assign({}, item), { id: `${prefix}_${item.id}` })))) || [];
183
+ };
184
+ const idPrefixRemover = (item, prefix) => {
185
+ if (typeof item.id === "string") {
186
+ return Object.assign(Object.assign({}, item), { id: item.id.replace(`${prefix}_`, "") });
187
+ }
188
+ return Object.assign(Object.assign({}, item), { id: item.id.toString().replace(`${prefix}_`, "") });
189
+ };
190
+ const getItemTypeFromId = (id) => {
191
+ if (id.startsWith("partners_"))
192
+ return "partners";
193
+ if (id.startsWith("languages_"))
194
+ return "languages";
195
+ if (id.startsWith("wallet_"))
196
+ return "wallet";
197
+ if (id.startsWith("currency_"))
198
+ return "currency";
199
+ if (id.includes("currencyConvertor"))
200
+ return "currencyConvertor";
201
+ if (id.includes("activityItem_"))
202
+ return "activityItem";
203
+ return null;
204
+ };
205
+ const mobileData = (isMobileBreakpoint, timeLabel, limitLabel, limitUnit, timeZone, timeFormat) => {
206
+ const limitCheck = limitLabel && limitUnit
207
+ ? {
208
+ title: "limit",
209
+ id: "limit",
210
+ disabled: true,
211
+ divider: true,
212
+ ComponentRender: () => (React__default.createElement("span", { className: "globalHeader__limit" },
213
+ React__default.createElement(Limit, { limit: limitUnit, label: limitLabel, isMobile: isMobileBreakpoint })))
214
+ }
215
+ : null;
216
+ const timeCheck = timeZone || timeFormat || timeLabel
217
+ ? {
218
+ title: "time",
219
+ id: "time",
220
+ disabled: true,
221
+ divider: !limitCheck,
222
+ ComponentRender: () => (React__default.createElement("span", { className: "globalHeader__time" },
223
+ React__default.createElement("span", { className: "globalHeader__time_text" }, timeLabel),
224
+ React__default.createElement(Time, { className: "globalHeader__time_mobile", timeZone: timeZone, format: timeFormat })))
225
+ }
226
+ : null;
227
+ return isMobileBreakpoint ? [...(timeCheck ? [timeCheck] : []), ...(limitCheck ? [limitCheck] : [])] : [];
228
+ };
229
+ /**
230
+ * Global Header component is a persistent navigation element that appears at the top of an application or website. It serves as a central hub for accessing key features and tools, ensuring consistent and intuitive navigation across all pages.
231
+ */
232
+ const GlobalHeader = ({ className, onNavigationButtonClick, logoAs, partners, onPartnerSelect, partnersLoading, partnersLoadingText, partnersSearchPlaceholder, partnersDisabled, partnersName = "Partner", partnersIdName, limitLabel = "Limit", limitUnit, timeZone, timeFormat, products, onProductSelect, timeLabel, logOutText, onProfileItemSelect, myAccountText = "My Account", settingsText = "Settings", languageText = "Language", languages = [], onLanguageSelect, wallet, walletText = "Wallet", onWalletSelect, currency, currencyText = "Reporting Currency", activity, activityText = "Activity", onActivitySelect, onCurrencySelect, currencyConvertorText, onCurrencyConvertorSelect, leftContent = null, onHelpActionSelect, actions }) => {
233
+ var _a, _b, _c;
234
+ const { breakpoint } = useContext(GeneUIDesignSystemContext);
235
+ const { isMobileBreakpoint = false, isDesktopBreakpoint = false } = breakpoint || {};
236
+ const languagesData = idPrefixCreator(languages, "languages");
237
+ const partnersData = idPrefixCreator(partners, "partners");
238
+ const walletData = idPrefixCreator(wallet, "wallet");
239
+ const currencyData = idPrefixCreator(currency, "currency");
240
+ const activityData = idPrefixCreator(activity, "activityItem");
241
+ const onNavigationButtonClickHandler = (e) => {
242
+ if (onNavigationButtonClick) {
243
+ onNavigationButtonClick(e);
244
+ }
245
+ };
246
+ const onProfileItemSelectHandler = (item) => {
247
+ const type = getItemTypeFromId(item.id.toString());
248
+ let changedItem = Object.assign({}, item);
249
+ switch (type) {
250
+ case "partners":
251
+ if (isMobileBreakpoint) {
252
+ changedItem = idPrefixRemover(item, "partners");
253
+ onPartnerSelect === null || onPartnerSelect === void 0 ? void 0 : onPartnerSelect(changedItem);
254
+ }
255
+ break;
256
+ case "languages":
257
+ changedItem = idPrefixRemover(item, "languages");
258
+ onLanguageSelect === null || onLanguageSelect === void 0 ? void 0 : onLanguageSelect(changedItem);
259
+ break;
260
+ case "wallet":
261
+ changedItem = idPrefixRemover(item, "wallet");
262
+ onWalletSelect === null || onWalletSelect === void 0 ? void 0 : onWalletSelect(changedItem);
263
+ break;
264
+ case "currency":
265
+ changedItem = idPrefixRemover(item, "currency");
266
+ onCurrencySelect === null || onCurrencySelect === void 0 ? void 0 : onCurrencySelect(changedItem);
267
+ break;
268
+ case "currencyConvertor":
269
+ onCurrencyConvertorSelect === null || onCurrencyConvertorSelect === void 0 ? void 0 : onCurrencyConvertorSelect(changedItem);
270
+ break;
271
+ case "activityItem":
272
+ changedItem = idPrefixRemover(item, "activityItem");
273
+ onActivitySelect === null || onActivitySelect === void 0 ? void 0 : onActivitySelect(changedItem);
274
+ break;
275
+ default:
276
+ if (actions && actions.some((action) => action.id === item.id)) {
277
+ const foundedAction = actions.find((action) => action.id === item.id);
278
+ if (foundedAction && foundedAction.onActionSelect) {
279
+ foundedAction.onActionSelect(foundedAction);
280
+ }
281
+ }
282
+ break;
283
+ }
284
+ onProfileItemSelect === null || onProfileItemSelect === void 0 ? void 0 : onProfileItemSelect(changedItem);
285
+ };
286
+ const profileData = () => {
287
+ const timeAndLimitForMobile = mobileData(isMobileBreakpoint, timeLabel, limitLabel, limitUnit, timeZone, timeFormat);
288
+ const dynamicTitleCreator = (title, data, needLastElement = false) => {
289
+ const selectedItem = data.find((item) => item.selected);
290
+ if (needLastElement) {
291
+ return `${title}${selectedItem && selectedItem.title ? `: ${selectedItem.title.replace(")", "").replace("(", "").split(" ").at(-1)}` : ""}`;
292
+ }
293
+ return `${title}${selectedItem && selectedItem.title ? `: ${selectedItem.title}` : ""}`;
294
+ };
295
+ const languagesDataCheck = languagesData.length > 0
296
+ ? {
297
+ title: dynamicTitleCreator(languageText, languagesData),
298
+ id: "language",
299
+ divider: true,
300
+ children: languagesData
301
+ }
302
+ : null;
303
+ const walletDataCheck = walletData.length > 0
304
+ ? {
305
+ title: walletText,
306
+ id: "wallet",
307
+ children: walletData,
308
+ divider: activityData.length === 0 && !currencyConvertorText && currencyData.length === 0
309
+ }
310
+ : null;
311
+ const currencyCheck = currencyData.length > 0
312
+ ? {
313
+ title: dynamicTitleCreator(currencyText, currencyData, true),
314
+ id: "currency",
315
+ children: currencyData,
316
+ divider: activityData.length === 0 && !currencyConvertorText
317
+ }
318
+ : null;
319
+ const currencyConvertorCheck = currencyConvertorText
320
+ ? {
321
+ title: currencyConvertorText,
322
+ id: "currencyConvertor",
323
+ divider: activityData.length === 0
324
+ }
325
+ : null;
326
+ const activityCheck = activityData.length > 0
327
+ ? {
328
+ title: dynamicTitleCreator(activityText, activityData),
329
+ id: "activity",
330
+ children: activityData,
331
+ divider: true
332
+ }
333
+ : null;
334
+ const customActionsCheck = actions && actions.length > 0 && !isDesktopBreakpoint
335
+ ? actions.map((action, index) => {
336
+ return {
337
+ title: action.title,
338
+ id: action.id,
339
+ divider: index === actions.length - 1
340
+ };
341
+ })
342
+ : null;
343
+ const constantData = [
344
+ {
345
+ title: myAccountText,
346
+ id: "myAccount"
347
+ },
348
+ {
349
+ title: settingsText,
350
+ id: "settings"
351
+ },
352
+ ...(languagesDataCheck ? [languagesDataCheck] : []),
353
+ ...(walletDataCheck ? [walletDataCheck] : []),
354
+ ...(currencyCheck ? [currencyCheck] : []),
355
+ ...(currencyConvertorCheck ? [currencyConvertorCheck] : []),
356
+ ...(activityCheck ? [activityCheck] : []),
357
+ ...(customActionsCheck || [])
358
+ ];
359
+ const logOut = {
360
+ title: logOutText || "Log out",
361
+ id: "logOut",
362
+ danger: true
363
+ };
364
+ const partnersDataForProfile = isMobileBreakpoint && partners && partners.length > 0
365
+ ? {
366
+ title: partnersName || "Partner",
367
+ id: "teams",
368
+ value: "teams",
369
+ children: partnersData
370
+ }
371
+ : {};
372
+ return ([partnersDataForProfile, ...timeAndLimitForMobile, ...constantData, logOut].filter((item) => item && typeof item === "object" && "id" in item) || []);
373
+ };
374
+ return (React__default.createElement("div", { className: classNames("globalHeader", className, {
375
+ globalHeader_mobile: isMobileBreakpoint
376
+ }) },
377
+ React__default.createElement("div", { className: "globalHeader_side_left" },
378
+ React__default.createElement(Button, { onClick: onNavigationButtonClickHandler, Icon: SvgHamburgerMenu, appearance: "inverse", layout: "text", size: "medium" }),
379
+ logoAs ? (cloneElement(logoAs, {
380
+ className: classNames("globalHeader__logo_link", logoAs.props.className),
381
+ children: (React__default.createElement(Logo, { className: "globalHeader__logo", type: "logomark", appearance: "inverse", size: "small" })),
382
+ "aria-label": "logo"
383
+ })) : (React__default.createElement(Logo, { className: "globalHeader__logo", type: "logomark", appearance: "inverse", size: "small" })),
384
+ isDesktopBreakpoint && leftContent),
385
+ React__default.createElement("div", { className: "globalHeader_side_right" },
386
+ partners && !isMobileBreakpoint && (React__default.createElement("div", { className: "globalHeader__item" },
387
+ React__default.createElement(Partners, { onPartnerSelect: onPartnerSelect, partners: partners, loading: partnersLoading, loadingText: partnersLoadingText, searchPlaceholder: partnersSearchPlaceholder, disabled: partnersDisabled, title: partnersName, idName: partnersIdName }),
388
+ React__default.createElement(Divider, { direction: "vertical", className: "globalHeader__divider" }))),
389
+ (limitLabel || limitUnit) && !isMobileBreakpoint && (React__default.createElement("div", { className: "globalHeader__item" },
390
+ React__default.createElement(Limit, { limit: limitUnit, label: limitLabel }),
391
+ React__default.createElement(Divider, { direction: "vertical", className: "globalHeader__divider" }))),
392
+ !isMobileBreakpoint && (timeZone || timeFormat || timeLabel) && (React__default.createElement("div", { className: "globalHeader__item" },
393
+ React__default.createElement(Time, { timeZone: timeZone, format: timeFormat }),
394
+ React__default.createElement(Divider, { direction: "vertical", className: "globalHeader__divider" }))),
395
+ actions && isDesktopBreakpoint && (React__default.createElement("div", { className: "globalHeader__item" },
396
+ React__default.createElement("div", { className: "globalHeader__actions" }, actions.map((action) => (React__default.createElement(Button, { key: action.id, onClick: () => action.onActionSelect(action), Icon: action.Icon, appearance: "inverse", layout: "text", size: "medium" })))),
397
+ React__default.createElement(Divider, { direction: "vertical", className: "globalHeader__divider" }))),
398
+ React__default.createElement("div", { className: "globalHeader__item" },
399
+ React__default.createElement("div", { className: "globalHeader__actions" },
400
+ onHelpActionSelect && (React__default.createElement(Button, { onClick: onHelpActionSelect, Icon: SvgQuestionMark, appearance: "inverse", layout: "text", size: "medium" })),
401
+ products && (React__default.createElement(Products, { onChange: onProductSelect },
402
+ products.mainSectionData && products.mainSectionData.length > 0 && (React__default.createElement(ProductsMainSection, null, (_a = products.mainSectionData) === null || _a === void 0 ? void 0 : _a.map((product) => (React__default.createElement(Product, Object.assign({ key: product.id }, product)))))),
403
+ products.secondarySectionData && ((_b = products.secondarySectionData) === null || _b === void 0 ? void 0 : _b.length) > 0 && (React__default.createElement(ProductsSecondarySection, null, (_c = products.secondarySectionData) === null || _c === void 0 ? void 0 : _c.map((product) => (React__default.createElement(Product, Object.assign({ key: product.id }, product))))))))),
404
+ React__default.createElement(Divider, { direction: "vertical", className: "globalHeader__divider" })),
405
+ React__default.createElement(Profile, { profileData: profileData(), className: "globalHeader__profile", fullName: "Full Name", onProfileItemSelect: onProfileItemSelectHandler }))));
406
+ };
407
+
408
+ export { GlobalHeader as default };
package/Menu.js CHANGED
@@ -1,9 +1,9 @@
1
- export { M as Menu, a as MenuItem } from './index-9059ca69.js';
1
+ export { M as Menu, a as MenuItem } from './index-0409f986.js';
2
2
  import 'react';
3
3
  import './index-ce02421b.js';
4
4
  import './Loader.js';
5
5
  import './style-inject.es-746bb8ed.js';
6
- import './PopoverBody-24acd45b.js';
6
+ import './PopoverBody-989eb114.js';
7
7
  import './floating-ui.react-a6c3b969.js';
8
8
  import 'react-dom';
9
9
  import './Info-0f0741e0.js';
package/Navigation.js CHANGED
@@ -3,9 +3,9 @@ import { c as classNames } from './index-ce02421b.js';
3
3
  import { _ as _objectWithoutProperties, a as _extends } from './ActivityRecent-b88e2ba8.js';
4
4
  import { S as SvgX } from './X-20da3b4a.js';
5
5
  import Button from './Button.js';
6
- import { P as Popover, a as PopoverBody } from './PopoverBody-24acd45b.js';
6
+ import { P as Popover, a as PopoverBody } from './PopoverBody-989eb114.js';
7
7
  import Scrollbar from './Scrollbar.js';
8
- import { S as SvgChevronRight, M as Menu, a as MenuItem } from './index-9059ca69.js';
8
+ import { S as SvgChevronRight, M as Menu, a as MenuItem } from './index-0409f986.js';
9
9
  import Text from './Text.js';
10
10
  import Tooltip from './Tooltip.js';
11
11
  import { u as useEllipsisDetection } from './useEllipsisDetection-9a842504.js';
@@ -347,13 +347,13 @@ const Navigation = ({ className, open, navigationData = [], activePath, onClick,
347
347
  clonedNavigationData.length > maxVisibleItems && (React__default.createElement(React__default.Fragment, null,
348
348
  React__default.createElement(NavigationColItem, { Icon: SvgThreeDotsHorizontal, title: moreMenuTitle, isVisible: true, propsForPopover: menuPropsForPopover }),
349
349
  React__default.createElement(Menu, { position: "right-bottom", onChange: onMoreMenuItemsClickHandler, setPropsForPopover: setMenuPropsForPopover }, menuData.map(({ Icon, title, disabled }, index) => {
350
- return (React__default.createElement(MenuItem, { id: index, IconBefore: Icon, selected: index === moreMenuDataActiveIndex, disabled: disabled }, title));
350
+ return (React__default.createElement(MenuItem, { key: `menuitem-${title}-${(Icon === null || Icon === void 0 ? void 0 : Icon.displayName) || (Icon === null || Icon === void 0 ? void 0 : Icon.name) || index}`, id: index, IconBefore: Icon, selected: index === moreMenuDataActiveIndex, disabled: disabled }, title));
351
351
  })))),
352
352
  navigationCreateData && (React__default.createElement(React__default.Fragment, null,
353
353
  React__default.createElement(Button, Object.assign({ onClick: () => { }, Icon: isCreateMenuOpen ? SvgX : SvgPlus, size: "large", appearance: "secondary", className: "navigation__addButton" }, propsForCreatePopover)),
354
- React__default.createElement(Menu, { position: "right-bottom", onChange: onNavigationCreateDataClickHandler, setPropsForPopover: setPropsForCreatePopover, onOpenChange: onCreateMenuClickHandler }, navigationCreateData.map((props) => {
354
+ React__default.createElement(Menu, { position: "right-bottom", onChange: onNavigationCreateDataClickHandler, setPropsForPopover: setPropsForCreatePopover, onOpenChange: onCreateMenuClickHandler }, navigationCreateData.map((props, index) => {
355
355
  const { title } = props, rest = __rest(props, ["title"]);
356
- return React__default.createElement(MenuItem, Object.assign({}, rest), title);
356
+ return (React__default.createElement(MenuItem, Object.assign({}, rest, { key: `create-${title}-${props.id || index}` }), title));
357
357
  })))))),
358
358
  forceOpen &&
359
359
  currentDataIndex !== null &&
package/Popover.js CHANGED
@@ -1,4 +1,4 @@
1
- export { P as Popover, a as PopoverBody } from './PopoverBody-24acd45b.js';
1
+ export { P as Popover, a as PopoverBody } from './PopoverBody-989eb114.js';
2
2
  import React__default from 'react';
3
3
  import './floating-ui.react-a6c3b969.js';
4
4
  import 'react-dom';
@@ -291,7 +291,7 @@ const Popover = forwardRef(({ size = "medium", fitReference, position = "bottom-
291
291
  (isMobile ? (React__default.createElement(Spreadsheet, { inset: false, open: isPopoverOpened, onClose: () => {
292
292
  onClose === null || onClose === void 0 ? void 0 : onClose();
293
293
  } },
294
- React__default.createElement("div", { className: classNames("popover__container", "popover__container_height_full") },
294
+ React__default.createElement("div", Object.assign({ className: classNames("popover__container", "popover__container_height_full"), ref: refs.setFloating }, getFloatingProps()),
295
295
  title && (React__default.createElement("div", { className: "popover__header" },
296
296
  React__default.createElement("p", { className: "popover__title" },
297
297
  React__default.createElement(SvgInfo, { className: "popover__title_icon", size: 20 }),
package/Products.js CHANGED
@@ -1,9 +1,10 @@
1
- import React__default, { createContext, useContext, useState, useMemo } from 'react';
1
+ import React__default, { createContext, useContext, useState, useRef, useMemo } from 'react';
2
2
  import { c as classNames } from './index-ce02421b.js';
3
3
  import { _ as _objectWithoutProperties, a as _extends } from './ActivityRecent-b88e2ba8.js';
4
4
  import Button from './Button.js';
5
- import { P as Popover, a as PopoverBody } from './PopoverBody-24acd45b.js';
5
+ import { P as Popover, a as PopoverBody } from './PopoverBody-989eb114.js';
6
6
  import { a as GeneUIDesignSystemContext } from './index-b1807fa4.js';
7
+ import { a as useClickOutside } from './index-ead22fa8.js';
7
8
  import { s as styleInject } from './style-inject.es-746bb8ed.js';
8
9
  import Badge from './Badge.js';
9
10
  import Text from './Text.js';
@@ -13,7 +14,6 @@ import './floating-ui.react-a6c3b969.js';
13
14
  import 'react-dom';
14
15
  import './Info-0f0741e0.js';
15
16
  import './X-20da3b4a.js';
16
- import './index-ead22fa8.js';
17
17
  import './Scrollbar.js';
18
18
  import 'prop-types';
19
19
  import './useDebounceCallback-999deae7.js';
@@ -37,9 +37,10 @@ var SvgAppGrid = function SvgAppGrid(_ref) {
37
37
  }));
38
38
  };
39
39
 
40
- var css_248z = ".products{width:36rem}.products__mobile{height:100%;width:100%}.products__container{display:inline-flex;flex-direction:column;gap:var(--guit-ref-spacing-large);padding-block:var(--guit-ref-spacing-large);padding-inline:var(--guit-ref-spacing-large)}.products__list{grid-gap:var(--guit-ref-spacing-xsmall);display:grid;grid-template-columns:repeat(3,1fr)}.products__item{align-items:center;border-radius:var(--guit-ref-radius-3xsmall);color:var(--guit-sem-color-foreground-neutral-2);cursor:pointer;display:flex;flex-direction:column;gap:var(--guit-ref-spacing-3xsmall);justify-content:flex-start;min-width:0;padding:var(--guit-ref-spacing-xsmall);text-align:center;-webkit-user-select:none;user-select:none;width:100%}.products__item:hover{background-color:var(--guit-sem-color-background-neutral-1-nudge-hover)}.products__item:active{background-color:var(--guit-sem-color-background-neutral-1-pressed)}.products__item_disabled{color:var(--guit-sem-color-foreground-disabled);pointer-events:none}.products__item_logo{align-items:center;display:flex;height:var(--guit-sem-dimension-height-xlarge);justify-content:center;width:var(--guit-sem-dimension-width-xlarge)}.products__item_title{font-family:var(--guit-sem-font-label-medium-default-semibold-font-family);font-size:var(--guit-sem-font-label-medium-default-semibold-font-size);font-weight:var(--guit-sem-font-label-medium-default-semibold-font-weight);line-height:var(--guit-sem-font-label-medium-default-semibold-line-height);overflow-wrap:anywhere}.products__badge{min-width:100%}";
40
+ var css_248z = ".products{width:36rem}.products__mobile{height:100%;width:100%}.products__container{display:inline-flex;flex-direction:column;gap:var(--guit-ref-spacing-large);padding-block:var(--guit-ref-spacing-large);padding-inline:var(--guit-ref-spacing-large);width:100%}.products__list{grid-gap:var(--guit-ref-spacing-xsmall);display:grid;grid-template-columns:repeat(3,1fr)}.products__item{align-items:center;border-radius:var(--guit-ref-radius-3xsmall);color:var(--guit-sem-color-foreground-neutral-2);cursor:pointer;display:flex;flex-direction:column;gap:var(--guit-ref-spacing-3xsmall);justify-content:flex-start;min-width:0;padding:var(--guit-ref-spacing-xsmall);text-align:center;-webkit-user-select:none;user-select:none;width:100%}.products__item:hover{background-color:var(--guit-sem-color-background-neutral-1-nudge-hover)}.products__item:active{background-color:var(--guit-sem-color-background-neutral-1-pressed)}.products__item_selected{background-color:var(--guit-sem-color-background-selected-2);color:var(--guit-sem-color-foreground-inverse);pointer-events:none}.products__item_disabled{color:var(--guit-sem-color-foreground-disabled);pointer-events:none}.products__item_logo{align-items:center;display:flex;height:var(--guit-sem-dimension-height-xlarge);justify-content:center;width:var(--guit-sem-dimension-width-xlarge)}.products__item_title{font-family:var(--guit-sem-font-label-medium-default-semibold-font-family);font-size:var(--guit-sem-font-label-medium-default-semibold-font-size);font-weight:var(--guit-sem-font-label-medium-default-semibold-font-weight);line-height:var(--guit-sem-font-label-medium-default-semibold-line-height);overflow-wrap:anywhere}.products__badge{min-width:100%}";
41
41
  styleInject(css_248z);
42
42
 
43
+ const PRODUCT_GAP_FROM_TARGET = 4;
43
44
  const ProductsContext = createContext({});
44
45
  /**
45
46
  * Products component is a menu-based UI element that allows users to switch between different products or services within an ecosystem.
@@ -47,30 +48,48 @@ const ProductsContext = createContext({});
47
48
  const Products = ({ onChange, children }) => {
48
49
  const { breakpoint } = useContext(GeneUIDesignSystemContext);
49
50
  const [propsForContent, setPropsForContent] = useState({});
51
+ const [popoverOpen, setPopoverOpen] = useState(false);
52
+ const popoverRef = useRef({
53
+ floatingElement: { current: null },
54
+ referenceElement: { current: null }
55
+ });
56
+ useClickOutside(() => {
57
+ setPopoverOpen(false);
58
+ }, [popoverRef.current.floatingElement, popoverRef.current.referenceElement]);
50
59
  const isRTL = document.dir === "rtl";
60
+ const onProductsChange = (product) => {
61
+ onChange === null || onChange === void 0 ? void 0 : onChange(product);
62
+ setPopoverOpen(false);
63
+ };
64
+ const toggleButtonHandler = () => {
65
+ setPopoverOpen((prev) => !prev);
66
+ };
51
67
  const memoizedProductsContextValue = useMemo(() => ({
52
- onChange
68
+ onChange: onProductsChange
53
69
  }), []);
54
70
  return (React__default.createElement(ProductsContext.Provider, { value: memoizedProductsContextValue },
55
- React__default.createElement(Popover, { disableReposition: false, position: `${isRTL ? "bottom-left" : "bottom-right"}`, size: "medium", setProps: setPropsForContent, withArrow: false, margin: 4 },
71
+ React__default.createElement(Popover, { disableReposition: false, position: `${isRTL ? "bottom-left" : "bottom-right"}`, size: "medium", setProps: setPropsForContent, withArrow: false, margin: PRODUCT_GAP_FROM_TARGET, open: popoverOpen, ref: popoverRef },
56
72
  React__default.createElement(PopoverBody, { className: classNames("products", {
57
73
  products__mobile: breakpoint === null || breakpoint === void 0 ? void 0 : breakpoint.isMobileBreakpoint
58
74
  }), withPadding: false },
59
75
  React__default.createElement("div", { className: "products__container" }, children))),
60
- React__default.createElement(Button, Object.assign({ Icon: SvgAppGrid, appearance: "inverse", layout: "text" }, propsForContent))));
76
+ React__default.createElement(Button, Object.assign({ Icon: SvgAppGrid, appearance: "inverse", layout: "text", onClick: toggleButtonHandler }, propsForContent))));
61
77
  };
62
78
 
63
79
  const ProductButton = (props) => {
64
- const { title, Icon, disabled } = props;
80
+ const { title, Icon, disabled, selected } = props;
65
81
  const { onChange } = useContext(ProductsContext);
66
- return (React__default.createElement("button", { type: "button", disabled: disabled, className: classNames("products__item", { products__item_disabled: disabled }), onClick: () => onChange(props) },
82
+ return (React__default.createElement("button", { type: "button", disabled: disabled, className: classNames("products__item", {
83
+ products__item_disabled: disabled,
84
+ products__item_selected: selected
85
+ }), onClick: () => onChange(props) },
67
86
  React__default.createElement("span", { className: "products__item_logo" },
68
87
  React__default.createElement(Icon, { size: 48 })),
69
88
  React__default.createElement(Text, { as: "span", className: "products__item_title", alignment: "center" }, title)));
70
89
  };
71
90
  const Product = (props) => {
72
91
  const { withBadge } = props;
73
- return withBadge ? (React__default.createElement(Badge, { className: "products__badge" },
92
+ return withBadge ? (React__default.createElement(Badge, { className: "products__badge", withBorder: true },
74
93
  React__default.createElement(ProductButton, Object.assign({}, props)))) : (React__default.createElement(ProductButton, Object.assign({}, props)));
75
94
  };
76
95
 
package/Profile.js CHANGED
@@ -1,12 +1,12 @@
1
- import React__default, { useState, useContext } from 'react';
2
- import { c as classNames } from './index-ce02421b.js';
3
- import { _ as _objectWithoutProperties, a as _extends } from './ActivityRecent-b88e2ba8.js';
4
- import { A as Avatar, S as SvgPersonFilled } from './index-0b9e90da.js';
5
- import { M as Menu, a as MenuItem } from './index-9059ca69.js';
6
- import { a as GeneUIDesignSystemContext } from './index-b1807fa4.js';
7
- import { s as styleInject } from './style-inject.es-746bb8ed.js';
1
+ export { P as default } from './index-b3aa52eb.js';
2
+ import 'react';
3
+ import './index-ce02421b.js';
4
+ import './ActivityRecent-b88e2ba8.js';
5
+ import './index-0b9e90da.js';
6
+ import './style-inject.es-746bb8ed.js';
7
+ import './index-0409f986.js';
8
8
  import './Loader.js';
9
- import './PopoverBody-24acd45b.js';
9
+ import './PopoverBody-989eb114.js';
10
10
  import './floating-ui.react-a6c3b969.js';
11
11
  import 'react-dom';
12
12
  import './Info-0f0741e0.js';
@@ -16,63 +16,7 @@ import './index-ead22fa8.js';
16
16
  import './Scrollbar.js';
17
17
  import 'prop-types';
18
18
  import './useDebounceCallback-999deae7.js';
19
+ import './index-b1807fa4.js';
19
20
  import './index-a2688a52.js';
20
21
  import './CheckMark-34798545.js';
21
22
  import './Divider.js';
22
-
23
- var _excluded = ["size", "color"];
24
- var SvgCaretDownFilled = function SvgCaretDownFilled(_ref) {
25
- var _ref$size = _ref.size,
26
- size = _ref$size === void 0 ? 24 : _ref$size,
27
- _ref$color = _ref.color,
28
- color = _ref$color === void 0 ? "currentColor" : _ref$color,
29
- props = _objectWithoutProperties(_ref, _excluded);
30
- return /*#__PURE__*/React__default.createElement("svg", _extends({
31
- width: size,
32
- height: size,
33
- viewBox: "0 0 24 24",
34
- fill: color,
35
- xmlns: "http://www.w3.org/2000/svg"
36
- }, props), /*#__PURE__*/React__default.createElement("path", {
37
- d: "M15.916 9h-7.832a1.083 1.083 0 0 0-.758 1.857l3.921 3.839a1.084 1.084 0 0 0 1.517-.001l3.911-3.838a1.084 1.084 0 0 0-.759-1.857Z",
38
- fill: color
39
- }));
40
- };
41
-
42
- var css_248z = ".profile__button{align-items:center;border-radius:1.6rem;cursor:pointer;display:inline-flex;gap:var(--guit-ref-spacing-2xsmall);height:3.2rem;-webkit-user-select:none;user-select:none;vertical-align:top}.profile__button:hover{background-color:var(--guit-sem-color-background-transparent-inverse-1-hover)}.profile__button:active{background-color:var(--guit-sem-color-background-transparent-inverse-1-pressed)}.profile__button:focus-visible{outline:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-focus);outline-offset:var(--guit-ref-border-width-thin)}.profile__button:has(.profile__content){padding-inline-end:var(--guit-ref-spacing-2xsmall)}.profile__avatar{flex:0 0 auto}.profile__content{align-items:center;color:var(--guit-sem-color-foreground-inverse-notheme);display:flex;gap:var(--guit-ref-spacing-4xsmall)}.profile__text{font-family:var(--guit-sem-font-caption-large-medium-font-family);font-size:var(--guit-sem-font-caption-large-medium-font-size);font-weight:var(--guit-sem-font-caption-large-medium-font-weight);letter-spacing:var(--guit-sem-font-caption-large-medium-letter-spacing);line-height:var(--guit-sem-font-caption-large-medium-line-height)}.profile__icon{flex:0 0 auto}";
43
- styleInject(css_248z);
44
-
45
- const ProfileDataRecursion = (menuData) => {
46
- return menuData.map((el) => {
47
- return (React__default.createElement(MenuItem, { key: el.id, selected: el.selected, title: el.children ? el.title : "", IconBefore: el.IconBefore, IconAfter: el.IconAfter, danger: el.danger, disabled: el.disabled, loading: el.loading, id: el.id, divider: el.divider, loadingText: el.loadingText, emptyText: el.emptyText, ComponentRender: el.ComponentRender }, el.children ? ProfileDataRecursion(el.children) : el.title));
48
- });
49
- };
50
- /**
51
- * Profile component provides users with access to quick actions, including links to settings, personal preferences, and other utility functions such.
52
- */
53
- const Profile = ({ className, onToggle, fullName, src, onProfileItemSelect, profileData }) => {
54
- const [isOpen, setIsOpen] = useState(false);
55
- const [propsForPopover, setPropsForPopover] = useState({});
56
- const { breakpoint } = useContext(GeneUIDesignSystemContext);
57
- const isMobileBreakpoint = breakpoint === null || breakpoint === void 0 ? void 0 : breakpoint.isMobileBreakpoint;
58
- const isRTLMode = document.dir === "rtl";
59
- const onProfileClickHandler = (e) => {
60
- if (onToggle) {
61
- onToggle(e, !isOpen);
62
- }
63
- setIsOpen((prev) => !prev);
64
- };
65
- const onProfileItemSelectHandler = (item) => {
66
- onProfileItemSelect === null || onProfileItemSelect === void 0 ? void 0 : onProfileItemSelect(item);
67
- };
68
- const Elements = ProfileDataRecursion(profileData);
69
- return (React__default.createElement("div", { className: "profile" },
70
- React__default.createElement("button", Object.assign({ type: "button", onClick: onProfileClickHandler, className: classNames("profile__button", className) }, propsForPopover),
71
- React__default.createElement(Avatar, { className: "profile__avatar", fullName: fullName, Icon: SvgPersonFilled, src: src }),
72
- !isMobileBreakpoint && (React__default.createElement("div", { className: "profile__content" },
73
- React__default.createElement("span", { className: "profile__text" }, fullName),
74
- React__default.createElement(SvgCaretDownFilled, { className: "profile__icon", size: 20 })))),
75
- React__default.createElement(Menu, { onChange: onProfileItemSelectHandler, setPropsForPopover: setPropsForPopover, position: isRTLMode ? "bottom-left" : "bottom-right", swappable: true, size: "large" }, Elements)));
76
- };
77
-
78
- export { Profile as default };
@@ -22,6 +22,11 @@ interface IProductProps {
22
22
  * Indicates whether the `Product` is `disabled`, preventing user interaction, focus, click etc...
23
23
  */
24
24
  disabled?: boolean;
25
+ /**
26
+ * Indicates whether the `Product` is currently selected.
27
+ * When `true`, the product will display with a selected visual style.
28
+ */
29
+ selected?: boolean;
25
30
  }
26
31
  declare const Product: FC<IProductProps>;
27
32
  export { IProductProps, Product as default };
@@ -16,7 +16,7 @@ interface IProductsProps {
16
16
  */
17
17
  children: ReactNode;
18
18
  /**
19
- * Fires when the user interact with `Product`. Provides the `Product` `id` as a callback's argument.
19
+ * Fires when the user interact with `Product`. Provides the `Product` as a callback's argument.
20
20
  */
21
21
  onChange?: (event: IProductProps) => void;
22
22
  }
@@ -0,0 +1,212 @@
1
+ import { FC, MouseEvent, ReactElement, ReactNode } from "react";
2
+ import { IconProps } from "@geneui/icons";
3
+ import { IMenuItemProps } from "@components/molecules/Menu";
4
+ import { IProductProps } from "@components/molecules/Products";
5
+ import { IProfileData } from "@components/molecules/Profile";
6
+ import { IPartnerItemData } from "@components/organisms/GlobalHeader/Partners/Partners";
7
+ import "./GlobalHeader.scss";
8
+ export interface IProducts {
9
+ mainSectionData?: IProductProps[];
10
+ secondarySectionData?: IProductProps[];
11
+ }
12
+ export interface IAction {
13
+ title: string;
14
+ Icon: FC<IconProps>;
15
+ id: string;
16
+ onActionSelect: (action: IAction) => void;
17
+ }
18
+ interface IGlobalHeaderProps {
19
+ /**
20
+ * Additional class for the parent element.
21
+ * This prop should be used to set placement properties for the element relative to its parent using BEM conventions.
22
+ */
23
+ className?: string;
24
+ /**
25
+ * Triggered when the navigation button (hamburger menu) is clicked.
26
+ */
27
+ onNavigationButtonClick?: (e: MouseEvent<HTMLButtonElement>) => void;
28
+ /**
29
+ * Optional logo link. You can pass a React Router Link, Next.js Link, or just an <a>.
30
+ * Example: <Link to="/"> or <a href="/">.
31
+ */
32
+ logoAs?: ReactElement;
33
+ /**
34
+ * An array of partner items to display in the partners dropdown.
35
+ */
36
+ partners?: IPartnerItemData[];
37
+ /**
38
+ * Callback function when a partner is selected from the list.
39
+ */
40
+ onPartnerSelect?: (partner: IPartnerItemData | IMenuItemProps) => void;
41
+ /**
42
+ * Whether the partners dropdown should be disabled.
43
+ */
44
+ partnersDisabled?: boolean;
45
+ /**
46
+ * Whether the partners list is currently loading.
47
+ * Displays a loading indicator.
48
+ */
49
+ partnersLoading?: boolean;
50
+ /**
51
+ * Text to display when the partners list is loading.
52
+ */
53
+ partnersLoadingText?: string;
54
+ /**
55
+ * Placeholder text for the partners search input.
56
+ */
57
+ partnersSearchPlaceholder?: string;
58
+ /**
59
+ * The property name use as the label for partner name in the dropdown.
60
+ * The default value is "Partner". This prop is used for internationalization.
61
+ */
62
+ partnersName?: string;
63
+ /**
64
+ * The property id use as the label for partner id in the dropdown.
65
+ */
66
+ partnersIdName?: string;
67
+ /**
68
+ * Label for the limit section (e.g. "Limit").
69
+ */
70
+ limitLabel?: string;
71
+ /**
72
+ * Unit or amount to show next to the limit label (e.g. "100").
73
+ */
74
+ limitUnit?: string | number;
75
+ /**
76
+ * The time zone to display the time in.
77
+ * If not provided, it will use the local time zone of the user's device.
78
+ * example: "America/New_York", "Europe/London"
79
+ */
80
+ timeZone?: string;
81
+ /**
82
+ * The format of the time to display.
83
+ * Possible values: "24h" or "12h"
84
+ * Default is "24h"
85
+ */
86
+ timeFormat?: "24h" | "12h";
87
+ /**
88
+ * Label for the time section, in mobile Breakpoint default is "Time"
89
+ */
90
+ timeLabel?: string;
91
+ /**
92
+ * Configuration object containing product data for main and secondary sections.
93
+ * Used to render the products dropdown in the global header.
94
+ */
95
+ products?: IProducts;
96
+ /**
97
+ * Callback function when a product is selected from the list.
98
+ */
99
+ onProductSelect?: (product: IProductProps) => void;
100
+ /**
101
+ * Callback triggered when a profile menu item is selected.
102
+ * Receives the selected menu item as an argument.
103
+ */
104
+ onProfileItemSelect?: (item: IMenuItemProps) => void;
105
+ /**
106
+ * Callback function triggered when a language is selected from the language dropdown.
107
+ * Receives the selected language item as an argument.
108
+ */
109
+ onLanguageSelect?: (item: IMenuItemProps) => void;
110
+ /**
111
+ * Array of language options to display in the profile dropdown.
112
+ * Each item should have a title, id, and selected state.
113
+ */
114
+ languages?: IProfileData[];
115
+ /**
116
+ * Label text for the language section in the profile dropdown.
117
+ * Default value is "Language". Used for internationalization.
118
+ */
119
+ languageText?: string;
120
+ /**
121
+ * Text to display for the log out menu item.
122
+ * Default value is "Log out". Used for internationalization.
123
+ */
124
+ logOutText?: string;
125
+ /**
126
+ * Text to display for the my account menu item.
127
+ * Default value is "My Account". Used for internationalization.
128
+ */
129
+ myAccountText?: string;
130
+ /**
131
+ * Text to display for the settings menu item.
132
+ * Default value is "Settings". Used for internationalization.
133
+ */
134
+ settingsText?: string;
135
+ /**
136
+ * Array of wallet options to display in the profile dropdown.
137
+ * Each item should have a title, id, and selected state.
138
+ */
139
+ wallet?: IProfileData[];
140
+ /**
141
+ * Label text for the wallet section in the profile dropdown.
142
+ * Default value is "Wallet". Used for internationalization.
143
+ */
144
+ walletText?: string;
145
+ /**
146
+ * Callback function triggered when a wallet option is selected.
147
+ * Receives the selected wallet item as an argument.
148
+ */
149
+ onWalletSelect?: (item: IMenuItemProps) => void;
150
+ /**
151
+ * Array of currency options to display in the profile dropdown.
152
+ * Each item should have a title, id, and selected state.
153
+ */
154
+ currency?: IProfileData[];
155
+ /**
156
+ * Label text for the currency section in the profile dropdown.
157
+ * Default value is "Reporting Currency". Used for internationalization.
158
+ */
159
+ currencyText?: string;
160
+ /**
161
+ * Callback function triggered when a currency option is selected.
162
+ * Receives the selected currency item as an argument.
163
+ */
164
+ onCurrencySelect?: (item: IMenuItemProps) => void;
165
+ /**
166
+ * Array of activity filter options to display in the profile dropdown.
167
+ * Each item should have a title, id, and selected state.
168
+ */
169
+ activity?: IProfileData[];
170
+ /**
171
+ * Label text for the activity section in the profile dropdown.
172
+ * Default value is "Activity". Used for internationalization.
173
+ */
174
+ activityText?: string;
175
+ /**
176
+ * Callback function triggered when an activity filter is selected.
177
+ * Receives the selected activity item as an argument.
178
+ */
179
+ onActivitySelect?: (item: IMenuItemProps) => void;
180
+ /**
181
+ * Text to display for the currency converter menu item.
182
+ * If provided, adds a currency converter option to the profile dropdown.
183
+ */
184
+ currencyConvertorText?: string;
185
+ /**
186
+ * Callback function triggered when the currency converter option is selected.
187
+ * Receives the menu item as an argument.
188
+ */
189
+ onCurrencyConvertorSelect?: (item: IMenuItemProps) => void;
190
+ /**
191
+ * Optional React component or element to display dynamic content in the header's left section,
192
+ * positioned adjacent to the logo. Commonly used for real-time information such as exchange rates,
193
+ * system status, etc.
194
+ */
195
+ leftContent?: ReactNode;
196
+ /**
197
+ * Callback function triggered when the Help button (with the QuestionMark icon) is clicked.
198
+ * If not provided, the Help button will not be displayed in the header.
199
+ */
200
+ onHelpActionSelect?: () => void;
201
+ /**
202
+ * Array of custom action buttons to display in the header.
203
+ * Each action includes a title, icon, id, and callback function.
204
+ * Actions are shown on desktop and moved to profile dropdown on mobile.
205
+ */
206
+ actions?: IAction[];
207
+ }
208
+ /**
209
+ * Global Header component is a persistent navigation element that appears at the top of an application or website. It serves as a central hub for accessing key features and tools, ensuring consistent and intuitive navigation across all pages.
210
+ */
211
+ declare const GlobalHeader: FC<IGlobalHeaderProps>;
212
+ export { IGlobalHeaderProps, GlobalHeader as default };
@@ -0,0 +1,8 @@
1
+ import { FC } from "react";
2
+ interface ILimitProps {
3
+ label?: string;
4
+ limit?: string | number;
5
+ isMobile?: boolean;
6
+ }
7
+ declare const Limit: FC<ILimitProps>;
8
+ export { ILimitProps, Limit as default };
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ export interface IPartnerItemProps {
3
+ title: string;
4
+ id: string | number;
5
+ onChange: (id: string | number) => void;
6
+ selected: boolean;
7
+ }
8
+ declare const PartnerItem: React.ForwardRefExoticComponent<IPartnerItemProps & React.RefAttributes<HTMLButtonElement>>;
9
+ export { PartnerItem as default };
@@ -0,0 +1,16 @@
1
+ import { FC } from "react";
2
+ import { IPartnerItemProps } from "@components/organisms/GlobalHeader/Partners/PartnerItem";
3
+ import "./Partners.scss";
4
+ export type IPartnerItemData = Omit<IPartnerItemProps, "onChange">;
5
+ interface IPartnersProps {
6
+ onPartnerSelect?: (partner: IPartnerItemData) => void;
7
+ partners?: IPartnerItemData[];
8
+ loading?: boolean;
9
+ loadingText?: string;
10
+ searchPlaceholder?: string;
11
+ disabled?: boolean;
12
+ title?: string;
13
+ idName?: string;
14
+ }
15
+ declare const Partners: FC<IPartnersProps>;
16
+ export { IPartnersProps, Partners as default };
@@ -0,0 +1,22 @@
1
+ import { FC } from "react";
2
+ interface ITimeProps {
3
+ /**
4
+ * Additional class for the parent element.
5
+ * This prop should be used to set placement properties for the element relative to its parent using BEM conventions.
6
+ */
7
+ className?: string;
8
+ /**
9
+ * The time zone to display the time in.
10
+ * If not provided, it will use the local time zone of the user's device.
11
+ * example: "America/New_York", "Europe/London"
12
+ */
13
+ timeZone?: string;
14
+ /**
15
+ * The format of the time to display.
16
+ * Possible values: "24h" or "12h"
17
+ * Default is "24h"
18
+ */
19
+ format?: "24h" | "12h";
20
+ }
21
+ declare const Time: FC<ITimeProps>;
22
+ export { ITimeProps, Time as default };
@@ -0,0 +1 @@
1
+ export { IGlobalHeaderProps, IAction, IProducts, default } from "./GlobalHeader";
@@ -1,7 +1,7 @@
1
1
  import React__default, { createContext, useState, useRef, useContext, useEffect, useMemo, Children, cloneElement } from 'react';
2
2
  import { c as classNames } from './index-ce02421b.js';
3
3
  import Loader from './Loader.js';
4
- import { P as Popover, a as PopoverBody } from './PopoverBody-24acd45b.js';
4
+ import { P as Popover, a as PopoverBody } from './PopoverBody-989eb114.js';
5
5
  import Scrollbar from './Scrollbar.js';
6
6
  import { a as GeneUIDesignSystemContext } from './index-b1807fa4.js';
7
7
  import { a as useClickOutside } from './index-ead22fa8.js';
@@ -173,7 +173,7 @@ const Menu = ({ onChange, children, loading, loadingText, swappable, setPropsFor
173
173
  setPaths(currentPath);
174
174
  }
175
175
  if (closeMenu) {
176
- onChange(item);
176
+ onChange(Object.assign(Object.assign({}, item), { title: typeof (item === null || item === void 0 ? void 0 : item.children) === "string" ? item === null || item === void 0 ? void 0 : item.children : item === null || item === void 0 ? void 0 : item.title }));
177
177
  }
178
178
  };
179
179
  const relativeRefsSetter = ({ generatedId, popoverFloatingRef }) => {
@@ -0,0 +1,61 @@
1
+ import React__default, { useState, useContext } from 'react';
2
+ import { c as classNames } from './index-ce02421b.js';
3
+ import { _ as _objectWithoutProperties, a as _extends } from './ActivityRecent-b88e2ba8.js';
4
+ import { A as Avatar, S as SvgPersonFilled } from './index-0b9e90da.js';
5
+ import { M as Menu, a as MenuItem } from './index-0409f986.js';
6
+ import { a as GeneUIDesignSystemContext } from './index-b1807fa4.js';
7
+ import { s as styleInject } from './style-inject.es-746bb8ed.js';
8
+
9
+ var _excluded = ["size", "color"];
10
+ var SvgCaretDownFilled = function SvgCaretDownFilled(_ref) {
11
+ var _ref$size = _ref.size,
12
+ size = _ref$size === void 0 ? 24 : _ref$size,
13
+ _ref$color = _ref.color,
14
+ color = _ref$color === void 0 ? "currentColor" : _ref$color,
15
+ props = _objectWithoutProperties(_ref, _excluded);
16
+ return /*#__PURE__*/React__default.createElement("svg", _extends({
17
+ width: size,
18
+ height: size,
19
+ viewBox: "0 0 24 24",
20
+ fill: color,
21
+ xmlns: "http://www.w3.org/2000/svg"
22
+ }, props), /*#__PURE__*/React__default.createElement("path", {
23
+ d: "M15.916 9h-7.832a1.083 1.083 0 0 0-.758 1.857l3.921 3.839a1.084 1.084 0 0 0 1.517-.001l3.911-3.838a1.084 1.084 0 0 0-.759-1.857Z",
24
+ fill: color
25
+ }));
26
+ };
27
+
28
+ var css_248z = ".profile__button{align-items:center;border-radius:1.6rem;cursor:pointer;display:inline-flex;gap:var(--guit-ref-spacing-2xsmall);height:3.2rem;-webkit-user-select:none;user-select:none;vertical-align:top}.profile__button:hover{background-color:var(--guit-sem-color-background-transparent-inverse-1-hover)}.profile__button:active{background-color:var(--guit-sem-color-background-transparent-inverse-1-pressed)}.profile__button:focus-visible{outline:var(--guit-ref-border-width-thin) var(--guit-ref-border-style-solid) var(--guit-sem-color-border-focus);outline-offset:var(--guit-ref-border-width-thin)}.profile__button:has(.profile__content){padding-inline-end:var(--guit-ref-spacing-2xsmall)}.profile__avatar{flex:0 0 auto}.profile__content{align-items:center;color:var(--guit-sem-color-foreground-inverse-notheme);display:flex;gap:var(--guit-ref-spacing-4xsmall)}.profile__text{font-family:var(--guit-sem-font-caption-large-medium-font-family);font-size:var(--guit-sem-font-caption-large-medium-font-size);font-weight:var(--guit-sem-font-caption-large-medium-font-weight);letter-spacing:var(--guit-sem-font-caption-large-medium-letter-spacing);line-height:var(--guit-sem-font-caption-large-medium-line-height)}.profile__icon{flex:0 0 auto}";
29
+ styleInject(css_248z);
30
+
31
+ const ProfileDataRecursion = (menuData) => {
32
+ return menuData.map((el) => (React__default.createElement(MenuItem, { key: el.id, selected: el.selected, title: el.children ? el.title : "", IconBefore: el.IconBefore, IconAfter: el.IconAfter, danger: el.danger, disabled: el.disabled, loading: el.loading, id: el.id, divider: el.divider, loadingText: el.loadingText, emptyText: el.emptyText, ComponentRender: el.ComponentRender }, el.children ? ProfileDataRecursion(el.children) : el.title)));
33
+ };
34
+ /**
35
+ * Profile component provides users with access to quick actions, including links to settings, personal preferences, and other utility functions such.
36
+ */
37
+ const Profile = ({ className, onToggle, fullName, src, onProfileItemSelect, profileData }) => {
38
+ const [isOpen, setIsOpen] = useState(false);
39
+ const [propsForPopover, setPropsForPopover] = useState({});
40
+ const { breakpoint } = useContext(GeneUIDesignSystemContext);
41
+ const isMobileBreakpoint = breakpoint === null || breakpoint === void 0 ? void 0 : breakpoint.isMobileBreakpoint;
42
+ const isRTLMode = document.dir === "rtl";
43
+ const onProfileClickHandler = (e) => {
44
+ if (onToggle) {
45
+ onToggle(e, !isOpen);
46
+ }
47
+ setIsOpen((prev) => !prev);
48
+ };
49
+ const onProfileItemSelectHandler = (item) => {
50
+ onProfileItemSelect === null || onProfileItemSelect === void 0 ? void 0 : onProfileItemSelect(item);
51
+ };
52
+ return (React__default.createElement("div", { className: "profile" },
53
+ React__default.createElement("button", Object.assign({ type: "button", onClick: onProfileClickHandler, className: classNames("profile__button", className) }, propsForPopover),
54
+ React__default.createElement(Avatar, { className: "profile__avatar", fullName: fullName, Icon: SvgPersonFilled, src: src }),
55
+ !isMobileBreakpoint && (React__default.createElement("div", { className: "profile__content" },
56
+ React__default.createElement("span", { className: "profile__text" }, fullName),
57
+ React__default.createElement(SvgCaretDownFilled, { className: "profile__icon", size: 20 })))),
58
+ React__default.createElement(Menu, { onChange: onProfileItemSelectHandler, setPropsForPopover: setPropsForPopover, position: isRTLMode ? "bottom-left" : "bottom-right", swappable: true, size: "large" }, ProfileDataRecursion(profileData))));
59
+ };
60
+
61
+ export { Profile as P, SvgCaretDownFilled as S };
package/index.js CHANGED
@@ -11,7 +11,7 @@ export { default as Rate } from './Rate.js';
11
11
  export { default as Radio } from './Radio.js';
12
12
  export { default as Text } from './Text.js';
13
13
  export { default as TextLink } from './TextLink.js';
14
- export { P as Popover, a as PopoverBody } from './PopoverBody-24acd45b.js';
14
+ export { P as Popover, a as PopoverBody } from './PopoverBody-989eb114.js';
15
15
  export { PopoverFooter, PopoverFooterActions } from './Popover.js';
16
16
  export { default as Badge } from './Badge.js';
17
17
  export { default as Scrollbar } from './Scrollbar.js';
@@ -27,10 +27,10 @@ export { default as Switch } from './Switch.js';
27
27
  export { TimelinePoint, Timelines } from './Timeline.js';
28
28
  export { default as QRCode } from './QRCode.js';
29
29
  export { Key, KeyValue, Value } from './KeyValue.js';
30
- export { M as Menu, a as MenuItem } from './index-9059ca69.js';
30
+ export { M as Menu, a as MenuItem } from './index-0409f986.js';
31
31
  export { default as Navigation } from './Navigation.js';
32
32
  export { default as Checkbox } from './Checkbox.js';
33
- export { default as Profile } from './Profile.js';
33
+ export { P as Profile } from './index-b3aa52eb.js';
34
34
  export { a as GeneUIDesignSystemContext, G as GeneUIProvider, c as useBreakpoint, b as useDeviceInfo, u as useWindowSize } from './index-b1807fa4.js';
35
35
  export { u as useDebounce } from './useDebounceCallback-999deae7.js';
36
36
  export { u as useEllipsisDetection } from './useEllipsisDetection-9a842504.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@geneui/components",
3
3
  "description": "The Gene UI components library designed for BI tools",
4
- "version": "3.0.0-next-be5e9b9-26062025",
4
+ "version": "3.0.0-next-9873985-09072025",
5
5
  "author": "SoftConstruct",
6
6
  "homepage": "https://github.com/softconstruct/gene-ui-components#readme",
7
7
  "repository": {