@xsolla/xui-b2b-sidebar 0.147.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/web/index.mjs ADDED
@@ -0,0 +1,1783 @@
1
+ // src/Sidebar.tsx
2
+ import styled2 from "styled-components";
3
+ import { useResolvedTheme as useResolvedTheme2 } from "@xsolla/xui-core";
4
+
5
+ // src/SidebarContext.tsx
6
+ import {
7
+ createContext,
8
+ useContext,
9
+ useMemo,
10
+ useState,
11
+ useCallback
12
+ } from "react";
13
+ import { jsx } from "react/jsx-runtime";
14
+ var DefaultLink = ({
15
+ to,
16
+ external,
17
+ target,
18
+ className,
19
+ children,
20
+ dataId,
21
+ onClick
22
+ }) => /* @__PURE__ */ jsx(
23
+ "a",
24
+ {
25
+ href: to,
26
+ className,
27
+ target: external ? target ?? "_blank" : target ?? void 0,
28
+ rel: external ? "noopener noreferrer" : void 0,
29
+ "data-id": dataId,
30
+ onClick,
31
+ children
32
+ }
33
+ );
34
+ var SidebarContext = createContext({
35
+ collapsed: false,
36
+ onCollapsedChange: () => {
37
+ },
38
+ pathname: "",
39
+ LinkComponent: DefaultLink,
40
+ expandedId: null,
41
+ onExpandedIdChange: () => {
42
+ }
43
+ });
44
+ var SidebarProvider = ({
45
+ collapsed: collapsedProp,
46
+ onCollapsedChange,
47
+ pathname = "",
48
+ linkComponent,
49
+ children
50
+ }) => {
51
+ const [internalCollapsed, setInternalCollapsed] = useState(false);
52
+ const [expandedId, setExpandedId] = useState(null);
53
+ const collapsed = collapsedProp ?? internalCollapsed;
54
+ const handleCollapsedChange = useCallback(
55
+ (next) => {
56
+ if (collapsedProp === void 0) setInternalCollapsed(next);
57
+ onCollapsedChange?.(next);
58
+ },
59
+ [collapsedProp, onCollapsedChange]
60
+ );
61
+ const onExpandedIdChange = useCallback((id) => {
62
+ setExpandedId(id);
63
+ }, []);
64
+ const value = useMemo(
65
+ () => ({
66
+ collapsed,
67
+ onCollapsedChange: handleCollapsedChange,
68
+ pathname,
69
+ LinkComponent: linkComponent || DefaultLink,
70
+ expandedId,
71
+ onExpandedIdChange
72
+ }),
73
+ [
74
+ collapsed,
75
+ handleCollapsedChange,
76
+ pathname,
77
+ linkComponent,
78
+ expandedId,
79
+ onExpandedIdChange
80
+ ]
81
+ );
82
+ return /* @__PURE__ */ jsx(SidebarContext.Provider, { value, children });
83
+ };
84
+ var useSidebar = () => useContext(SidebarContext);
85
+
86
+ // src/SidebarCollapsed.tsx
87
+ import {
88
+ useCallback as useCallback2,
89
+ useEffect,
90
+ useLayoutEffect,
91
+ useRef,
92
+ useState as useState2
93
+ } from "react";
94
+ import { createPortal } from "react-dom";
95
+ import styled from "styled-components";
96
+ import { useResolvedTheme } from "@xsolla/xui-core";
97
+ import { Typography } from "@xsolla/xui-typography";
98
+ import { ChatTwoMessages } from "@xsolla/xui-icons-base";
99
+
100
+ // src/HideSidebarIcon.tsx
101
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
102
+ var HideSidebarIcon = ({
103
+ flipped
104
+ }) => /* @__PURE__ */ jsxs(
105
+ "svg",
106
+ {
107
+ width: "18",
108
+ height: "18",
109
+ viewBox: "0 0 18 18",
110
+ fill: "none",
111
+ xmlns: "http://www.w3.org/2000/svg",
112
+ "aria-hidden": "true",
113
+ focusable: "false",
114
+ style: flipped ? { transform: "rotate(180deg)" } : void 0,
115
+ children: [
116
+ /* @__PURE__ */ jsx2(
117
+ "path",
118
+ {
119
+ d: "M10.1519 3.75L10.9674 4.60262L7.33825 8.39704H15.75V9.60296H7.33825L10.9674 13.3974L10.1519 14.25L5.33446 9.21318C5.22185 9.09544 5.22185 8.90456 5.33446 8.78682L10.1519 3.75Z",
120
+ fill: "currentColor"
121
+ }
122
+ ),
123
+ /* @__PURE__ */ jsx2("path", { d: "M2.25 3.75H3.75V15H2.25V3.75Z", fill: "currentColor" })
124
+ ]
125
+ }
126
+ );
127
+
128
+ // src/SidebarCollapsed.tsx
129
+ import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
130
+ var POPOVER_GAP_PX = 12;
131
+ var POPOVER_VIEWPORT_PADDING_PX = 8;
132
+ var POPOVER_CLOSE_DELAY_MS = 150;
133
+ var POPOVER_ITEM_BASE_CLASS = "xui-sb-popover-item";
134
+ var POPOVER_ITEM_ACTIVE_CLASS = "xui-sb-popover-item--active";
135
+ var Outer = styled.div`
136
+ display: flex;
137
+ width: ${(p) => p.$width}px;
138
+ height: 100%;
139
+ max-height: 100%;
140
+ box-sizing: border-box;
141
+ flex-direction: column;
142
+ flex-shrink: 0;
143
+ overflow: hidden;
144
+ background: ${(p) => p.$bg};
145
+ border-radius: ${(p) => p.$radius}px;
146
+
147
+ a {
148
+ text-decoration: none;
149
+ }
150
+ `;
151
+ var MainScroll = styled.div`
152
+ display: flex;
153
+ flex: 1;
154
+ flex-direction: column;
155
+ align-items: center;
156
+ padding: ${(p) => p.$padding}px 0;
157
+ min-height: 0;
158
+ overflow-y: auto;
159
+
160
+ &::-webkit-scrollbar {
161
+ width: 0;
162
+ }
163
+ `;
164
+ var IconBtn = styled.button`
165
+ display: flex;
166
+ width: ${(p) => p.$size}px;
167
+ height: ${(p) => p.$size}px;
168
+ align-items: center;
169
+ justify-content: center;
170
+ border: 0;
171
+ border-radius: ${(p) => p.$radius}px;
172
+ background: ${(p) => p.$active ? p.$hoverBg : "transparent"};
173
+ color: ${(p) => p.$active ? p.$hoverColor : p.$color};
174
+ cursor: pointer;
175
+ padding: 0;
176
+ font: inherit;
177
+ transition:
178
+ background-color 0.15s ease-in-out,
179
+ color 0.15s ease-in-out;
180
+
181
+ ${(p) => p.$active && `
182
+ background-color: ${p.$activeBg};
183
+ outline: 1px solid ${p.$activeOutline};
184
+ outline-offset: -1px;
185
+ `}
186
+
187
+ &:hover {
188
+ background-color: ${(p) => p.$hoverBg};
189
+ color: ${(p) => p.$hoverColor};
190
+ }
191
+
192
+ &:focus-visible {
193
+ outline: ${(p) => p.$focusOutlineWidth}px solid ${(p) => p.$focusOutline};
194
+ outline-offset: -${(p) => p.$focusOutlineWidth}px;
195
+ }
196
+
197
+ & > span {
198
+ display: flex;
199
+ width: ${(p) => p.$iconSize}px;
200
+ height: ${(p) => p.$iconSize}px;
201
+ align-items: center;
202
+ justify-content: center;
203
+
204
+ svg {
205
+ width: ${(p) => p.$iconSize}px;
206
+ height: ${(p) => p.$iconSize}px;
207
+ }
208
+ }
209
+ `;
210
+ var Spacer = styled.div`
211
+ height: 16px;
212
+ flex-shrink: 0;
213
+ `;
214
+ var FixedBottom = styled.div`
215
+ display: flex;
216
+ flex-direction: column;
217
+ align-items: center;
218
+ padding: ${(p) => p.$padding}px 0;
219
+ flex-shrink: 0;
220
+ `;
221
+ var Footer = styled.div`
222
+ display: flex;
223
+ flex-direction: column;
224
+ align-items: center;
225
+ gap: 4px;
226
+ padding: ${(p) => p.$padding}px 0;
227
+ border-top: 1px solid ${(p) => p.$borderColor};
228
+ flex-shrink: 0;
229
+ `;
230
+ var CollapsedChat = styled.button`
231
+ display: flex;
232
+ width: ${(p) => p.$size}px;
233
+ height: ${(p) => p.$size}px;
234
+ align-items: center;
235
+ justify-content: center;
236
+ border: 1px solid ${(p) => p.$border};
237
+ border-radius: ${(p) => p.$radius}px;
238
+ background: ${(p) => p.$bg};
239
+ color: ${(p) => p.$color};
240
+ cursor: pointer;
241
+ position: relative;
242
+ padding: 0;
243
+ font: inherit;
244
+
245
+ &:hover {
246
+ opacity: 0.9;
247
+ }
248
+
249
+ &:focus-visible {
250
+ outline: ${(p) => p.$focusOutlineWidth}px solid ${(p) => p.$focusOutline};
251
+ outline-offset: 2px;
252
+ }
253
+
254
+ svg {
255
+ width: 16px;
256
+ height: 16px;
257
+ }
258
+ `;
259
+ var CollapsedToggle = styled.button`
260
+ display: flex;
261
+ width: ${(p) => p.$size}px;
262
+ height: ${(p) => p.$size}px;
263
+ align-items: center;
264
+ justify-content: center;
265
+ border: 1px solid ${(p) => p.$borderColor};
266
+ border-radius: ${(p) => p.$radius}px;
267
+ background: transparent;
268
+ cursor: pointer;
269
+ color: ${(p) => p.$color};
270
+ padding: 0;
271
+ font: inherit;
272
+
273
+ &:hover {
274
+ background: ${(p) => p.$hoverBg};
275
+ }
276
+
277
+ &:focus-visible {
278
+ outline: ${(p) => p.$focusOutlineWidth}px solid ${(p) => p.$focusOutline};
279
+ outline-offset: 2px;
280
+ }
281
+
282
+ svg {
283
+ width: ${(p) => p.$iconSize}px;
284
+ height: ${(p) => p.$iconSize}px;
285
+ }
286
+ `;
287
+ var ChatBadge = styled.span`
288
+ position: absolute;
289
+ top: -2px;
290
+ right: -2px;
291
+ width: ${(p) => p.$size}px;
292
+ height: ${(p) => p.$size}px;
293
+ background: ${(p) => p.$color};
294
+ border-radius: 999px;
295
+ `;
296
+ var PopoverContainer = styled.div`
297
+ position: fixed;
298
+ z-index: ${(p) => p.$zIndex};
299
+ min-width: ${(p) => p.$minWidth}px;
300
+ max-width: ${(p) => p.$maxWidth}px;
301
+ `;
302
+ var PopoverInner = styled.div`
303
+ min-height: ${(p) => p.$itemHeight}px;
304
+ padding: ${(p) => p.$padding}px;
305
+ background: ${(p) => p.$bg};
306
+ border-radius: ${(p) => p.$radius}px;
307
+ display: flex;
308
+ flex-direction: column;
309
+ gap: 6px;
310
+ box-shadow: ${(p) => p.$shadow};
311
+ `;
312
+ var PopoverTitle = styled.div`
313
+ display: flex;
314
+ height: 20px;
315
+ align-items: center;
316
+ padding: 0 ${(p) => p.$padding}px;
317
+ overflow: hidden;
318
+ `;
319
+ var PopoverDivider = styled.div`
320
+ height: 1px;
321
+ align-self: stretch;
322
+ background: ${(p) => p.$color};
323
+ `;
324
+ var PopoverItems = styled.div`
325
+ display: flex;
326
+ flex-direction: column;
327
+
328
+ & > .${POPOVER_ITEM_BASE_CLASS} {
329
+ display: flex;
330
+ max-height: ${(p) => p.$itemHeight}px;
331
+ align-items: center;
332
+ padding: 12px ${(p) => p.$padding}px;
333
+ border-radius: ${(p) => p.$radius}px;
334
+ color: ${(p) => p.$colorIdle};
335
+ font-weight: 400;
336
+ cursor: pointer;
337
+ transition: background-color 0.15s ease-in-out;
338
+ text-decoration: none;
339
+ }
340
+
341
+ & > .${POPOVER_ITEM_BASE_CLASS}:hover {
342
+ background-color: ${(p) => p.$hoverBg};
343
+ }
344
+
345
+ & > .${POPOVER_ITEM_BASE_CLASS}:focus-visible {
346
+ outline: ${(p) => p.$focusOutlineWidth}px solid ${(p) => p.$focusOutline};
347
+ outline-offset: -${(p) => p.$focusOutlineWidth}px;
348
+ }
349
+
350
+ & > .${POPOVER_ITEM_ACTIVE_CLASS} {
351
+ background-color: ${(p) => p.$activeBg};
352
+ color: ${(p) => p.$colorActive};
353
+ outline: 1px solid ${(p) => p.$activeOutline};
354
+ outline-offset: -1px;
355
+ font-weight: 500;
356
+ }
357
+ `;
358
+ var SinglePopoverPanel = styled.div`
359
+ padding: 4px;
360
+ background: ${(p) => p.$bg};
361
+ border-radius: ${(p) => p.$radius}px;
362
+ display: inline-flex;
363
+ flex-direction: column;
364
+ box-shadow: ${(p) => p.$shadow};
365
+ `;
366
+ var SingleLinkWrap = styled.div`
367
+ display: contents;
368
+
369
+ & > a,
370
+ & > * {
371
+ display: inline-flex;
372
+ max-height: ${(p) => p.$itemHeight}px;
373
+ align-items: center;
374
+ padding: 0 ${(p) => p.$padding}px;
375
+ border-radius: ${(p) => p.$radius}px;
376
+ color: ${(p) => p.$color};
377
+ cursor: pointer;
378
+ font-size: 14px;
379
+ font-weight: 400;
380
+ line-height: 18px;
381
+ white-space: nowrap;
382
+ text-decoration: none;
383
+ }
384
+ `;
385
+ var isChildActive = (item, pathname) => {
386
+ if (!item.children || !pathname) {
387
+ return false;
388
+ }
389
+ const pathWithoutMerchant = pathname.replace(/^\/\d+/, "");
390
+ return item.children.some((child) => {
391
+ if (typeof child.to !== "string") {
392
+ return false;
393
+ }
394
+ return child.exact ? pathWithoutMerchant === child.to : pathWithoutMerchant === child.to || pathWithoutMerchant.startsWith(`${child.to}/`);
395
+ });
396
+ };
397
+ var CollapsedIconItem = ({ item, onPopoverOpen, onPopoverClose, pathname, sizing, colors }) => {
398
+ const ref = useRef(null);
399
+ const hasChildren = Boolean(item.children && item.children.length > 0);
400
+ const isActive = hasChildren && isChildActive(item, pathname);
401
+ const openPopover = useCallback2(() => {
402
+ if (ref.current) {
403
+ onPopoverOpen(item, ref.current.getBoundingClientRect());
404
+ }
405
+ }, [item, onPopoverOpen]);
406
+ const isSimpleActive = !hasChildren && (() => {
407
+ if (!item.to || !pathname) {
408
+ return false;
409
+ }
410
+ const pathWithoutMerchant = pathname.replace(/^\/\d+/, "");
411
+ return item.exact ? pathWithoutMerchant === item.to : pathWithoutMerchant === item.to || pathWithoutMerchant.startsWith(`${item.to}/`);
412
+ })();
413
+ const handleKeyDown = (e) => {
414
+ if (e.key === "Enter" || e.key === " ") {
415
+ e.preventDefault();
416
+ openPopover();
417
+ } else if (e.key === "Escape") {
418
+ onPopoverClose();
419
+ }
420
+ };
421
+ if (!item.icon) {
422
+ return null;
423
+ }
424
+ return /* @__PURE__ */ jsx3(
425
+ IconBtn,
426
+ {
427
+ ref,
428
+ type: "button",
429
+ onMouseEnter: openPopover,
430
+ onMouseLeave: onPopoverClose,
431
+ onFocus: openPopover,
432
+ onBlur: onPopoverClose,
433
+ onKeyDown: handleKeyDown,
434
+ "data-id": item.dataId,
435
+ "aria-haspopup": hasChildren ? "menu" : "false",
436
+ $size: sizing.itemHeight,
437
+ $radius: sizing.radius,
438
+ $iconSize: sizing.iconSize,
439
+ $color: colors.content.tertiary,
440
+ $hoverBg: colors.overlay.mono,
441
+ $hoverColor: colors.content.primary,
442
+ $activeBg: colors.overlay.mono,
443
+ $activeOutline: colors.border.secondary,
444
+ $focusOutline: colors.border.brand,
445
+ $focusOutlineWidth: sizing.focusOutlineWidth,
446
+ $active: isActive || isSimpleActive,
447
+ children: /* @__PURE__ */ jsx3("span", { children: item.icon })
448
+ }
449
+ );
450
+ };
451
+ var CollapsedPopover = ({
452
+ item,
453
+ triggerRect,
454
+ onClose,
455
+ onMouseEnter,
456
+ onMouseLeave,
457
+ sizing,
458
+ colors
459
+ }) => {
460
+ const { LinkComponent } = useSidebar();
461
+ const popoverRef = useRef(null);
462
+ const hasChildren = Boolean(item.children && item.children.length > 0);
463
+ const [position, setPosition] = useState2({
464
+ top: triggerRect.top,
465
+ left: triggerRect.right + POPOVER_GAP_PX
466
+ });
467
+ useLayoutEffect(() => {
468
+ if (!popoverRef.current) {
469
+ return;
470
+ }
471
+ const rect = popoverRef.current.getBoundingClientRect();
472
+ const triggerCenterY = triggerRect.top + triggerRect.height / 2;
473
+ const idealTop = hasChildren ? triggerRect.top : triggerCenterY - rect.height / 2;
474
+ const maxTop = Math.max(
475
+ POPOVER_VIEWPORT_PADDING_PX,
476
+ window.innerHeight - rect.height - POPOVER_VIEWPORT_PADDING_PX
477
+ );
478
+ const top = Math.max(
479
+ POPOVER_VIEWPORT_PADDING_PX,
480
+ Math.min(idealTop, maxTop)
481
+ );
482
+ const left = Math.min(
483
+ triggerRect.right + POPOVER_GAP_PX,
484
+ window.innerWidth - rect.width - POPOVER_VIEWPORT_PADDING_PX
485
+ );
486
+ if (top !== position.top || left !== position.left) {
487
+ setPosition({ top, left });
488
+ }
489
+ }, [
490
+ triggerRect.top,
491
+ triggerRect.right,
492
+ triggerRect.height,
493
+ hasChildren,
494
+ item.dataId,
495
+ position.top,
496
+ position.left
497
+ ]);
498
+ if (!hasChildren) {
499
+ return /* @__PURE__ */ jsx3(
500
+ PopoverContainer,
501
+ {
502
+ ref: popoverRef,
503
+ style: { top: position.top, left: position.left, minWidth: "auto" },
504
+ onMouseEnter,
505
+ onMouseLeave,
506
+ $minWidth: 0,
507
+ $maxWidth: sizing.popoverMaxWidth,
508
+ $zIndex: sizing.popoverZIndex,
509
+ children: /* @__PURE__ */ jsx3(
510
+ SinglePopoverPanel,
511
+ {
512
+ $padding: sizing.padding,
513
+ $itemHeight: sizing.itemHeight,
514
+ $radius: sizing.radius,
515
+ $bg: colors.layer.float,
516
+ $shadow: sizing.popoverShadow,
517
+ children: /* @__PURE__ */ jsx3(
518
+ SingleLinkWrap,
519
+ {
520
+ $itemHeight: sizing.itemHeight,
521
+ $padding: sizing.padding,
522
+ $radius: sizing.radius,
523
+ $color: colors.content.primary,
524
+ children: /* @__PURE__ */ jsx3(
525
+ LinkComponent,
526
+ {
527
+ to: item.to,
528
+ exact: item.exact,
529
+ external: item.external,
530
+ target: item.target,
531
+ dataId: item.dataId,
532
+ onClick: onClose,
533
+ children: /* @__PURE__ */ jsx3(Typography, { variant: "bodySm", color: "primary", children: item.label })
534
+ }
535
+ )
536
+ }
537
+ )
538
+ }
539
+ )
540
+ }
541
+ );
542
+ }
543
+ return /* @__PURE__ */ jsx3(
544
+ PopoverContainer,
545
+ {
546
+ ref: popoverRef,
547
+ role: "menu",
548
+ style: { top: position.top, left: position.left },
549
+ onMouseEnter,
550
+ onMouseLeave,
551
+ $minWidth: sizing.popoverMinWidth,
552
+ $maxWidth: sizing.popoverMaxWidth,
553
+ $zIndex: sizing.popoverZIndex,
554
+ children: /* @__PURE__ */ jsxs2(
555
+ PopoverInner,
556
+ {
557
+ $itemHeight: sizing.itemHeight,
558
+ $padding: sizing.padding,
559
+ $radius: sizing.radius,
560
+ $bg: colors.layer.float,
561
+ $shadow: sizing.popoverShadow,
562
+ children: [
563
+ /* @__PURE__ */ jsx3(PopoverTitle, { $padding: sizing.padding, children: /* @__PURE__ */ jsx3(Typography, { variant: "bodyXs", color: "primary", children: item.label }) }),
564
+ /* @__PURE__ */ jsx3(PopoverDivider, { $color: colors.border.secondary }),
565
+ /* @__PURE__ */ jsx3(
566
+ PopoverItems,
567
+ {
568
+ $itemHeight: sizing.itemHeight,
569
+ $padding: sizing.padding,
570
+ $radius: sizing.radius,
571
+ $colorIdle: colors.content.tertiary,
572
+ $colorActive: colors.content.primary,
573
+ $hoverBg: colors.overlay.mono,
574
+ $activeBg: colors.overlay.mono,
575
+ $activeOutline: colors.border.secondary,
576
+ $focusOutline: colors.border.brand,
577
+ $focusOutlineWidth: sizing.focusOutlineWidth,
578
+ children: (item.children || []).map((child, i) => /* @__PURE__ */ jsx3(
579
+ LinkComponent,
580
+ {
581
+ to: child.to,
582
+ exact: child.exact,
583
+ external: child.external,
584
+ target: child.target,
585
+ className: POPOVER_ITEM_BASE_CLASS,
586
+ activeClassName: POPOVER_ITEM_ACTIVE_CLASS,
587
+ dataId: child.dataId,
588
+ onClick: onClose,
589
+ children: /* @__PURE__ */ jsx3(Typography, { variant: "bodySm", color: "inherit", children: child.label })
590
+ },
591
+ child.dataId || (typeof child.to === "string" ? child.to : `child-${i}`)
592
+ ))
593
+ }
594
+ )
595
+ ]
596
+ }
597
+ )
598
+ }
599
+ );
600
+ };
601
+ var SidebarCollapsed = ({
602
+ items,
603
+ toolItems = [],
604
+ bottomItems = [],
605
+ onToggleCollapse,
606
+ onChatClick,
607
+ showChat = true,
608
+ chatBadge = false
609
+ }) => {
610
+ const { pathname } = useSidebar();
611
+ const { theme } = useResolvedTheme();
612
+ const sizing = theme.sizing.sidebar();
613
+ const colors = theme.colors;
614
+ const [popover, setPopover] = useState2(null);
615
+ const closeTimerRef = useRef(null);
616
+ const cancelCloseTimer = useCallback2(() => {
617
+ if (closeTimerRef.current) {
618
+ clearTimeout(closeTimerRef.current);
619
+ closeTimerRef.current = null;
620
+ }
621
+ }, []);
622
+ const startCloseTimer = useCallback2(() => {
623
+ cancelCloseTimer();
624
+ closeTimerRef.current = setTimeout(() => {
625
+ setPopover(null);
626
+ }, POPOVER_CLOSE_DELAY_MS);
627
+ }, [cancelCloseTimer]);
628
+ useEffect(() => () => cancelCloseTimer(), [cancelCloseTimer]);
629
+ const handlePopoverOpen = useCallback2(
630
+ (item, rect) => {
631
+ cancelCloseTimer();
632
+ setPopover({ item, triggerRect: rect });
633
+ },
634
+ [cancelCloseTimer]
635
+ );
636
+ return /* @__PURE__ */ jsxs2(
637
+ Outer,
638
+ {
639
+ $width: sizing.widthCollapsed,
640
+ $radius: sizing.radius,
641
+ $bg: colors.background.secondary,
642
+ children: [
643
+ /* @__PURE__ */ jsxs2(MainScroll, { $padding: sizing.padding, children: [
644
+ items.map((item, i) => /* @__PURE__ */ jsx3(
645
+ CollapsedIconItem,
646
+ {
647
+ item,
648
+ onPopoverOpen: handlePopoverOpen,
649
+ onPopoverClose: startCloseTimer,
650
+ pathname,
651
+ sizing,
652
+ colors
653
+ },
654
+ item.dataId || `item-${i}`
655
+ )),
656
+ toolItems.length > 0 && /* @__PURE__ */ jsxs2(Fragment, { children: [
657
+ /* @__PURE__ */ jsx3(Spacer, {}),
658
+ toolItems.map((item, i) => /* @__PURE__ */ jsx3(
659
+ CollapsedIconItem,
660
+ {
661
+ item,
662
+ onPopoverOpen: handlePopoverOpen,
663
+ onPopoverClose: startCloseTimer,
664
+ pathname,
665
+ sizing,
666
+ colors
667
+ },
668
+ item.dataId || `tool-${i}`
669
+ ))
670
+ ] })
671
+ ] }),
672
+ /* @__PURE__ */ jsx3(
673
+ FixedBottom,
674
+ {
675
+ $padding: sizing.padding,
676
+ $borderColor: colors.border.secondary,
677
+ children: bottomItems.map((item, i) => /* @__PURE__ */ jsx3(
678
+ CollapsedIconItem,
679
+ {
680
+ item,
681
+ onPopoverOpen: handlePopoverOpen,
682
+ onPopoverClose: startCloseTimer,
683
+ pathname,
684
+ sizing,
685
+ colors
686
+ },
687
+ item.dataId || `bottom-${i}`
688
+ ))
689
+ }
690
+ ),
691
+ /* @__PURE__ */ jsxs2(Footer, { $padding: sizing.padding, $borderColor: colors.border.secondary, children: [
692
+ showChat && /* @__PURE__ */ jsxs2(
693
+ CollapsedChat,
694
+ {
695
+ onClick: onChatClick,
696
+ type: "button",
697
+ "aria-label": "Open chat",
698
+ $size: sizing.itemHeight,
699
+ $radius: sizing.radius,
700
+ $bg: colors.control.brand.primary.bg,
701
+ $border: colors.control.brand.primary.border,
702
+ $color: colors.content.static.dark,
703
+ $focusOutline: colors.border.brand,
704
+ $focusOutlineWidth: sizing.focusOutlineWidth,
705
+ children: [
706
+ /* @__PURE__ */ jsx3(ChatTwoMessages, { size: 16, variant: "line" }),
707
+ chatBadge && /* @__PURE__ */ jsx3(
708
+ ChatBadge,
709
+ {
710
+ $size: sizing.chatBadgeSize,
711
+ $color: colors.background.alert.primary
712
+ }
713
+ )
714
+ ]
715
+ }
716
+ ),
717
+ /* @__PURE__ */ jsx3(
718
+ CollapsedToggle,
719
+ {
720
+ onClick: onToggleCollapse,
721
+ type: "button",
722
+ "aria-label": "Expand sidebar",
723
+ "aria-pressed": true,
724
+ $size: sizing.itemHeight,
725
+ $radius: sizing.radius,
726
+ $iconSize: sizing.iconSize,
727
+ $borderColor: colors.border.secondary,
728
+ $hoverBg: colors.overlay.mono,
729
+ $color: colors.content.tertiary,
730
+ $focusOutline: colors.border.brand,
731
+ $focusOutlineWidth: sizing.focusOutlineWidth,
732
+ children: /* @__PURE__ */ jsx3(HideSidebarIcon, { flipped: true })
733
+ }
734
+ )
735
+ ] }),
736
+ popover && typeof document !== "undefined" && createPortal(
737
+ /* @__PURE__ */ jsx3(
738
+ CollapsedPopover,
739
+ {
740
+ item: popover.item,
741
+ triggerRect: popover.triggerRect,
742
+ onClose: () => setPopover(null),
743
+ onMouseEnter: cancelCloseTimer,
744
+ onMouseLeave: startCloseTimer,
745
+ sizing,
746
+ colors
747
+ }
748
+ ),
749
+ document.body
750
+ )
751
+ ]
752
+ }
753
+ );
754
+ };
755
+
756
+ // src/Sidebar.tsx
757
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
758
+ var Outer2 = styled2.div`
759
+ width: ${(p) => p.$width}px;
760
+ height: 100%;
761
+ max-height: 100%;
762
+ flex-shrink: 0;
763
+ position: relative;
764
+ overflow: hidden;
765
+ border-radius: ${(p) => p.$radius}px;
766
+ background: ${(p) => p.$bg};
767
+ transition: width ${(p) => p.$transition};
768
+
769
+ a {
770
+ text-decoration: none;
771
+ }
772
+ `;
773
+ var ExpandedPane = styled2.div`
774
+ position: absolute;
775
+ top: 0;
776
+ left: 0;
777
+ width: ${(p) => p.$width}px;
778
+ height: 100%;
779
+ display: flex;
780
+ flex-direction: column;
781
+ overflow: hidden;
782
+ opacity: ${(p) => p.$hidden ? 0 : 1};
783
+ pointer-events: ${(p) => p.$hidden ? "none" : "auto"};
784
+ transition: ${(p) => p.$hidden ? p.$fadeOut : p.$fadeIn};
785
+ `;
786
+ var CollapsedPane = styled2.div`
787
+ position: absolute;
788
+ top: 0;
789
+ left: 0;
790
+ width: ${(p) => p.$width}px;
791
+ height: 100%;
792
+ opacity: ${(p) => p.$hidden ? 0 : 1};
793
+ pointer-events: ${(p) => p.$hidden ? "none" : "auto"};
794
+ transition: ${(p) => p.$hidden ? p.$fadeOut : p.$fadeIn};
795
+
796
+ & > div {
797
+ background: transparent;
798
+ border-radius: 0;
799
+ }
800
+ `;
801
+ var Sidebar = ({
802
+ collapsedItems = [],
803
+ collapsedToolItems = [],
804
+ collapsedBottomItems = [],
805
+ showChat = true,
806
+ onChatClick,
807
+ chatBadge = false,
808
+ children
809
+ }) => {
810
+ const { collapsed, onCollapsedChange } = useSidebar();
811
+ const { theme } = useResolvedTheme2();
812
+ const sizing = theme.sizing.sidebar();
813
+ return /* @__PURE__ */ jsxs3(
814
+ Outer2,
815
+ {
816
+ role: "navigation",
817
+ "aria-label": "Sidebar navigation",
818
+ $expanded: sizing.widthExpanded,
819
+ $collapsed: sizing.widthCollapsed,
820
+ $width: collapsed ? sizing.widthCollapsed : sizing.widthExpanded,
821
+ $radius: sizing.radius,
822
+ $bg: theme.colors.background.secondary,
823
+ $transition: sizing.transitionWidth,
824
+ children: [
825
+ /* @__PURE__ */ jsx4(
826
+ ExpandedPane,
827
+ {
828
+ "aria-hidden": collapsed,
829
+ $width: sizing.widthExpanded,
830
+ $hidden: collapsed,
831
+ $fadeIn: sizing.transitionFadeIn,
832
+ $fadeOut: sizing.transitionFadeOut,
833
+ children
834
+ }
835
+ ),
836
+ /* @__PURE__ */ jsx4(
837
+ CollapsedPane,
838
+ {
839
+ "aria-hidden": !collapsed,
840
+ $width: sizing.widthCollapsed,
841
+ $hidden: !collapsed,
842
+ $fadeIn: sizing.transitionFadeIn,
843
+ $fadeOut: sizing.transitionFadeOut,
844
+ children: /* @__PURE__ */ jsx4(
845
+ SidebarCollapsed,
846
+ {
847
+ items: collapsedItems,
848
+ toolItems: collapsedToolItems,
849
+ bottomItems: collapsedBottomItems,
850
+ onToggleCollapse: () => onCollapsedChange(!collapsed),
851
+ showChat,
852
+ onChatClick,
853
+ chatBadge
854
+ }
855
+ )
856
+ }
857
+ )
858
+ ]
859
+ }
860
+ );
861
+ };
862
+
863
+ // src/SidebarContent.tsx
864
+ import styled3 from "styled-components";
865
+ import { useResolvedTheme as useResolvedTheme3 } from "@xsolla/xui-core";
866
+ import { jsx as jsx5 } from "react/jsx-runtime";
867
+ var ScrollableArea = styled3.div`
868
+ flex: 1;
869
+ display: flex;
870
+ flex-direction: column;
871
+ padding: ${(p) => p.$padding}px;
872
+ padding-bottom: 0;
873
+ overflow: hidden auto;
874
+ min-height: 0;
875
+
876
+ &::-webkit-scrollbar {
877
+ width: 4px;
878
+ }
879
+ &::-webkit-scrollbar-track {
880
+ background: none;
881
+ }
882
+ &::-webkit-scrollbar-thumb {
883
+ background-color: ${(p) => p.$thumbColor};
884
+ border-radius: 2px;
885
+ visibility: hidden;
886
+ }
887
+ &:hover::-webkit-scrollbar-thumb {
888
+ visibility: visible;
889
+ }
890
+ `;
891
+ var SidebarContent = ({
892
+ children
893
+ }) => {
894
+ const { theme } = useResolvedTheme3();
895
+ const sizing = theme.sizing.sidebar();
896
+ return /* @__PURE__ */ jsx5(
897
+ ScrollableArea,
898
+ {
899
+ $padding: sizing.padding,
900
+ $thumbColor: theme.colors.content.tertiary,
901
+ children
902
+ }
903
+ );
904
+ };
905
+
906
+ // ../../foundation/primitives-web/src/Box.tsx
907
+ import React4 from "react";
908
+ import styled4 from "styled-components";
909
+
910
+ // ../../foundation/primitives-web/src/filterDOMProps.ts
911
+ import React3 from "react";
912
+
913
+ // ../../../node_modules/@emotion/memoize/dist/memoize.esm.js
914
+ function memoize(fn) {
915
+ var cache = {};
916
+ return function(arg) {
917
+ if (cache[arg] === void 0) cache[arg] = fn(arg);
918
+ return cache[arg];
919
+ };
920
+ }
921
+ var memoize_esm_default = memoize;
922
+
923
+ // ../../../node_modules/@emotion/is-prop-valid/dist/is-prop-valid.esm.js
924
+ var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
925
+ var index = memoize_esm_default(
926
+ function(prop) {
927
+ return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
928
+ }
929
+ /* Z+1 */
930
+ );
931
+ var is_prop_valid_esm_default = index;
932
+
933
+ // ../../foundation/primitives-web/src/filterDOMProps.ts
934
+ var ADDITIONAL_BLOCKED_PROPS = /* @__PURE__ */ new Set([
935
+ // RN-only event handlers (pass isPropValid's on* pattern)
936
+ "onPress",
937
+ "onChangeText",
938
+ "onLayout",
939
+ "onMoveShouldSetResponder",
940
+ "onResponderGrant",
941
+ "onResponderMove",
942
+ "onResponderRelease",
943
+ "onResponderTerminate",
944
+ // SVG attributes that pass isPropValid
945
+ "strokeWidth",
946
+ // CSS properties that pass isPropValid but are used as component props
947
+ "overflow",
948
+ "cursor",
949
+ "fontSize",
950
+ "fontWeight",
951
+ "fontFamily",
952
+ "textDecoration"
953
+ ]);
954
+ function shouldForwardProp(key) {
955
+ if (ADDITIONAL_BLOCKED_PROPS.has(key)) return false;
956
+ return is_prop_valid_esm_default(key);
957
+ }
958
+ function createFilteredElement(defaultTag) {
959
+ const Component = React3.forwardRef(
960
+ ({ children, elementType, ...props }, ref) => {
961
+ const Tag = elementType || defaultTag;
962
+ const htmlProps = {};
963
+ for (const key of Object.keys(props)) {
964
+ if (shouldForwardProp(key)) {
965
+ htmlProps[key] = props[key];
966
+ }
967
+ }
968
+ return React3.createElement(
969
+ Tag,
970
+ { ref, ...htmlProps },
971
+ children
972
+ );
973
+ }
974
+ );
975
+ Component.displayName = `Filtered(${defaultTag})`;
976
+ return Component;
977
+ }
978
+
979
+ // ../../foundation/primitives-web/src/Box.tsx
980
+ import { jsx as jsx6 } from "react/jsx-runtime";
981
+ var FilteredDiv = createFilteredElement("div");
982
+ var StyledBox = styled4(FilteredDiv)`
983
+ display: flex;
984
+ box-sizing: border-box;
985
+ background-color: ${(props) => props.backgroundColor || "transparent"};
986
+ border-color: ${(props) => props.borderColor || "transparent"};
987
+ border-width: ${(props) => typeof props.borderWidth === "number" ? `${props.borderWidth}px` : props.borderWidth || 0};
988
+
989
+ ${(props) => props.borderBottomWidth !== void 0 && `
990
+ border-bottom-width: ${typeof props.borderBottomWidth === "number" ? `${props.borderBottomWidth}px` : props.borderBottomWidth};
991
+ border-bottom-color: ${props.borderBottomColor || props.borderColor || "transparent"};
992
+ border-bottom-style: solid;
993
+ `}
994
+ ${(props) => props.borderTopWidth !== void 0 && `
995
+ border-top-width: ${typeof props.borderTopWidth === "number" ? `${props.borderTopWidth}px` : props.borderTopWidth};
996
+ border-top-color: ${props.borderTopColor || props.borderColor || "transparent"};
997
+ border-top-style: solid;
998
+ `}
999
+ ${(props) => props.borderLeftWidth !== void 0 && `
1000
+ border-left-width: ${typeof props.borderLeftWidth === "number" ? `${props.borderLeftWidth}px` : props.borderLeftWidth};
1001
+ border-left-color: ${props.borderLeftColor || props.borderColor || "transparent"};
1002
+ border-left-style: solid;
1003
+ `}
1004
+ ${(props) => props.borderRightWidth !== void 0 && `
1005
+ border-right-width: ${typeof props.borderRightWidth === "number" ? `${props.borderRightWidth}px` : props.borderRightWidth};
1006
+ border-right-color: ${props.borderRightColor || props.borderColor || "transparent"};
1007
+ border-right-style: solid;
1008
+ `}
1009
+
1010
+ border-style: ${(props) => props.borderStyle || (props.borderWidth || props.borderBottomWidth || props.borderTopWidth || props.borderLeftWidth || props.borderRightWidth ? "solid" : "none")};
1011
+ border-radius: ${(props) => typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius || 0};
1012
+ height: ${(props) => typeof props.height === "number" ? `${props.height}px` : props.height || "auto"};
1013
+ width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
1014
+ min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
1015
+ min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
1016
+ max-width: ${(props) => typeof props.maxWidth === "number" ? `${props.maxWidth}px` : props.maxWidth || "none"};
1017
+ max-height: ${(props) => typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight || "none"};
1018
+
1019
+ padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
1020
+ ${(props) => props.paddingHorizontal && `
1021
+ padding-left: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
1022
+ padding-right: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
1023
+ `}
1024
+ ${(props) => props.paddingVertical && `
1025
+ padding-top: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
1026
+ padding-bottom: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
1027
+ `}
1028
+ ${(props) => props.paddingTop !== void 0 && `padding-top: ${typeof props.paddingTop === "number" ? `${props.paddingTop}px` : props.paddingTop};`}
1029
+ ${(props) => props.paddingBottom !== void 0 && `padding-bottom: ${typeof props.paddingBottom === "number" ? `${props.paddingBottom}px` : props.paddingBottom};`}
1030
+ ${(props) => props.paddingLeft !== void 0 && `padding-left: ${typeof props.paddingLeft === "number" ? `${props.paddingLeft}px` : props.paddingLeft};`}
1031
+ ${(props) => props.paddingRight !== void 0 && `padding-right: ${typeof props.paddingRight === "number" ? `${props.paddingRight}px` : props.paddingRight};`}
1032
+
1033
+ margin: ${(props) => typeof props.margin === "number" ? `${props.margin}px` : props.margin || 0};
1034
+ ${(props) => props.marginTop !== void 0 && `margin-top: ${typeof props.marginTop === "number" ? `${props.marginTop}px` : props.marginTop};`}
1035
+ ${(props) => props.marginBottom !== void 0 && `margin-bottom: ${typeof props.marginBottom === "number" ? `${props.marginBottom}px` : props.marginBottom};`}
1036
+ ${(props) => props.marginLeft !== void 0 && `margin-left: ${typeof props.marginLeft === "number" ? `${props.marginLeft}px` : props.marginLeft};`}
1037
+ ${(props) => props.marginRight !== void 0 && `margin-right: ${typeof props.marginRight === "number" ? `${props.marginRight}px` : props.marginRight};`}
1038
+
1039
+ flex-direction: ${(props) => props.flexDirection || "column"};
1040
+ flex-wrap: ${(props) => props.flexWrap || "nowrap"};
1041
+ align-items: ${(props) => props.alignItems || "stretch"};
1042
+ justify-content: ${(props) => props.justifyContent || "flex-start"};
1043
+ cursor: ${(props) => props.cursor ? props.cursor : props.onClick || props.onPress ? "pointer" : "inherit"};
1044
+ position: ${(props) => props.position || "static"};
1045
+ top: ${(props) => typeof props.top === "number" ? `${props.top}px` : props.top};
1046
+ bottom: ${(props) => typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom};
1047
+ left: ${(props) => typeof props.left === "number" ? `${props.left}px` : props.left};
1048
+ right: ${(props) => typeof props.right === "number" ? `${props.right}px` : props.right};
1049
+ flex: ${(props) => props.flex};
1050
+ flex-shrink: ${(props) => props.flexShrink ?? 1};
1051
+ gap: ${(props) => typeof props.gap === "number" ? `${props.gap}px` : props.gap || 0};
1052
+ align-self: ${(props) => props.alignSelf || "auto"};
1053
+ overflow: ${(props) => props.overflow || "visible"};
1054
+ overflow-x: ${(props) => props.overflowX || "visible"};
1055
+ overflow-y: ${(props) => props.overflowY || "visible"};
1056
+ z-index: ${(props) => props.zIndex};
1057
+ opacity: ${(props) => props.disabled ? 0.5 : 1};
1058
+ pointer-events: ${(props) => props.disabled ? "none" : "auto"};
1059
+
1060
+ &:hover {
1061
+ ${(props) => props.hoverStyle?.backgroundColor && `background-color: ${props.hoverStyle.backgroundColor};`}
1062
+ ${(props) => props.hoverStyle?.borderColor && `border-color: ${props.hoverStyle.borderColor};`}
1063
+ }
1064
+
1065
+ &:active {
1066
+ ${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
1067
+ }
1068
+ `;
1069
+ var Box = React4.forwardRef(
1070
+ ({
1071
+ children,
1072
+ onPress,
1073
+ onKeyDown,
1074
+ onKeyUp,
1075
+ role,
1076
+ "aria-label": ariaLabel,
1077
+ "aria-labelledby": ariaLabelledBy,
1078
+ "aria-current": ariaCurrent,
1079
+ "aria-disabled": ariaDisabled,
1080
+ "aria-live": ariaLive,
1081
+ "aria-busy": ariaBusy,
1082
+ "aria-describedby": ariaDescribedBy,
1083
+ "aria-expanded": ariaExpanded,
1084
+ "aria-haspopup": ariaHasPopup,
1085
+ "aria-pressed": ariaPressed,
1086
+ "aria-controls": ariaControls,
1087
+ tabIndex,
1088
+ as,
1089
+ src,
1090
+ alt,
1091
+ type,
1092
+ disabled,
1093
+ id,
1094
+ testID,
1095
+ "data-testid": dataTestId,
1096
+ ...props
1097
+ }, ref) => {
1098
+ if (as === "img" && src) {
1099
+ return /* @__PURE__ */ jsx6(
1100
+ "img",
1101
+ {
1102
+ src,
1103
+ alt: alt || "",
1104
+ style: {
1105
+ display: "block",
1106
+ objectFit: "cover",
1107
+ width: typeof props.width === "number" ? `${props.width}px` : props.width,
1108
+ height: typeof props.height === "number" ? `${props.height}px` : props.height,
1109
+ borderRadius: typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius,
1110
+ position: props.position,
1111
+ top: typeof props.top === "number" ? `${props.top}px` : props.top,
1112
+ left: typeof props.left === "number" ? `${props.left}px` : props.left,
1113
+ right: typeof props.right === "number" ? `${props.right}px` : props.right,
1114
+ bottom: typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom
1115
+ }
1116
+ }
1117
+ );
1118
+ }
1119
+ return /* @__PURE__ */ jsx6(
1120
+ StyledBox,
1121
+ {
1122
+ ref,
1123
+ elementType: as,
1124
+ id,
1125
+ type: as === "button" ? type || "button" : void 0,
1126
+ disabled: as === "button" ? disabled : void 0,
1127
+ onClick: onPress,
1128
+ onKeyDown,
1129
+ onKeyUp,
1130
+ role,
1131
+ "aria-label": ariaLabel,
1132
+ "aria-labelledby": ariaLabelledBy,
1133
+ "aria-current": ariaCurrent,
1134
+ "aria-disabled": ariaDisabled,
1135
+ "aria-busy": ariaBusy,
1136
+ "aria-describedby": ariaDescribedBy,
1137
+ "aria-expanded": ariaExpanded,
1138
+ "aria-haspopup": ariaHasPopup,
1139
+ "aria-pressed": ariaPressed,
1140
+ "aria-controls": ariaControls,
1141
+ "aria-live": ariaLive,
1142
+ tabIndex: tabIndex !== void 0 ? tabIndex : void 0,
1143
+ "data-testid": dataTestId || testID,
1144
+ ...props,
1145
+ children
1146
+ }
1147
+ );
1148
+ }
1149
+ );
1150
+ Box.displayName = "Box";
1151
+
1152
+ // src/SidebarFooter.tsx
1153
+ import { useResolvedTheme as useResolvedTheme4 } from "@xsolla/xui-core";
1154
+ import { jsx as jsx7 } from "react/jsx-runtime";
1155
+ var SidebarFooter = ({
1156
+ children
1157
+ }) => {
1158
+ const { theme } = useResolvedTheme4();
1159
+ const sizing = theme.sizing.sidebar();
1160
+ return /* @__PURE__ */ jsx7(
1161
+ Box,
1162
+ {
1163
+ flexDirection: "row",
1164
+ alignItems: "flex-end",
1165
+ justifyContent: "space-between",
1166
+ padding: sizing.padding,
1167
+ borderTopWidth: 1,
1168
+ borderTopColor: theme.colors.border.secondary,
1169
+ flexShrink: 0,
1170
+ children
1171
+ }
1172
+ );
1173
+ };
1174
+
1175
+ // src/SidebarTrigger.tsx
1176
+ import styled5 from "styled-components";
1177
+ import { useResolvedTheme as useResolvedTheme5 } from "@xsolla/xui-core";
1178
+ import { jsx as jsx8 } from "react/jsx-runtime";
1179
+ var ToggleButton = styled5.button`
1180
+ display: flex;
1181
+ width: ${(p) => p.$size}px;
1182
+ height: ${(p) => p.$size}px;
1183
+ align-items: center;
1184
+ justify-content: center;
1185
+ border: 1px solid ${(p) => p.$borderColor};
1186
+ border-radius: ${(p) => p.$radius}px;
1187
+ background: transparent;
1188
+ backdrop-filter: blur(30px);
1189
+ cursor: pointer;
1190
+ color: ${(p) => p.$color};
1191
+ padding: 0;
1192
+ font: inherit;
1193
+
1194
+ &:hover {
1195
+ background: ${(p) => p.$hoverBg};
1196
+ }
1197
+
1198
+ &:focus-visible {
1199
+ outline: ${(p) => p.$focusOutlineWidth}px solid ${(p) => p.$focusOutline};
1200
+ outline-offset: 2px;
1201
+ }
1202
+
1203
+ svg {
1204
+ width: ${(p) => p.$iconSize}px;
1205
+ height: ${(p) => p.$iconSize}px;
1206
+ }
1207
+ `;
1208
+ var SidebarTrigger = () => {
1209
+ const { collapsed, onCollapsedChange } = useSidebar();
1210
+ const { theme } = useResolvedTheme5();
1211
+ const sizing = theme.sizing.sidebar();
1212
+ return /* @__PURE__ */ jsx8(
1213
+ ToggleButton,
1214
+ {
1215
+ type: "button",
1216
+ onClick: () => onCollapsedChange(!collapsed),
1217
+ "aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
1218
+ "aria-pressed": collapsed,
1219
+ $size: sizing.itemHeight,
1220
+ $radius: sizing.radius,
1221
+ $iconSize: sizing.iconSize,
1222
+ $borderColor: theme.colors.border.secondary,
1223
+ $hoverBg: theme.colors.overlay.mono,
1224
+ $color: theme.colors.content.tertiary,
1225
+ $focusOutline: theme.colors.border.brand,
1226
+ $focusOutlineWidth: sizing.focusOutlineWidth,
1227
+ children: /* @__PURE__ */ jsx8(HideSidebarIcon, { flipped: collapsed })
1228
+ }
1229
+ );
1230
+ };
1231
+
1232
+ // src/SidebarGroup.tsx
1233
+ import { useResolvedTheme as useResolvedTheme6 } from "@xsolla/xui-core";
1234
+ import { Typography as Typography2 } from "@xsolla/xui-typography";
1235
+ import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1236
+ var SidebarGroup = ({
1237
+ label,
1238
+ dataId,
1239
+ children
1240
+ }) => {
1241
+ const { theme } = useResolvedTheme6();
1242
+ const sizing = theme.sizing.sidebar();
1243
+ return /* @__PURE__ */ jsxs4(
1244
+ Box,
1245
+ {
1246
+ flexDirection: "column",
1247
+ "data-id": dataId,
1248
+ role: label ? "group" : void 0,
1249
+ "aria-label": label,
1250
+ children: [
1251
+ label && /* @__PURE__ */ jsx9(
1252
+ Box,
1253
+ {
1254
+ flexDirection: "row",
1255
+ alignItems: "center",
1256
+ height: sizing.sectionLabelHeight,
1257
+ paddingHorizontal: sizing.padding,
1258
+ marginTop: sizing.padding,
1259
+ children: /* @__PURE__ */ jsx9(Typography2, { variant: "bodyXs", color: "secondary", children: label })
1260
+ }
1261
+ ),
1262
+ children
1263
+ ]
1264
+ }
1265
+ );
1266
+ };
1267
+
1268
+ // src/SidebarMenu.tsx
1269
+ import { jsx as jsx10 } from "react/jsx-runtime";
1270
+ var SidebarMenu = ({
1271
+ children
1272
+ }) => /* @__PURE__ */ jsx10(Box, { flexDirection: "column", alignItems: "stretch", children });
1273
+
1274
+ // src/SidebarMenuItem.tsx
1275
+ import styled6 from "styled-components";
1276
+ import { useResolvedTheme as useResolvedTheme7 } from "@xsolla/xui-core";
1277
+ import { Typography as Typography3 } from "@xsolla/xui-typography";
1278
+ import { Tooltip } from "@xsolla/xui-tooltip";
1279
+ import { OpenIn } from "@xsolla/xui-icons-base";
1280
+
1281
+ // src/constants.ts
1282
+ var ITEM_BASE_CLASS = "xui-sb-item";
1283
+ var ITEM_ACTIVE_CLASS = "xui-sb-item--active";
1284
+
1285
+ // src/SidebarMenuItem.tsx
1286
+ import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
1287
+ var TOOLTIP_TRUNCATE_LENGTH = 20;
1288
+ var ItemWrapper = styled6.div`
1289
+ display: contents;
1290
+
1291
+ & > .${ITEM_BASE_CLASS} {
1292
+ display: flex;
1293
+ height: ${(p) => p.$multiLine ? "auto" : `${p.$itemHeight}px`};
1294
+ max-height: ${(p) => p.$multiLine ? "none" : `${p.$itemHeight}px`};
1295
+ width: 100%;
1296
+ box-sizing: border-box;
1297
+ align-items: ${(p) => p.$multiLine ? "flex-start" : "center"};
1298
+ gap: 8px;
1299
+ padding: 0 ${(p) => p.$padding}px;
1300
+ border-radius: ${(p) => p.$radius}px;
1301
+ color: ${(p) => p.$colorIdle};
1302
+ cursor: pointer;
1303
+ font-size: 14px;
1304
+ font-weight: 500;
1305
+ line-height: 18px;
1306
+ overflow: hidden;
1307
+ transition:
1308
+ background-color 0.15s ease-in-out,
1309
+ color 0.15s ease-in-out;
1310
+ white-space: ${(p) => p.$multiLine ? "normal" : "nowrap"};
1311
+ text-align: left;
1312
+ text-decoration: none;
1313
+ }
1314
+
1315
+ & > .${ITEM_BASE_CLASS}:hover {
1316
+ background-color: ${(p) => p.$hoverBg};
1317
+ }
1318
+
1319
+ & > .${ITEM_BASE_CLASS}:focus-visible {
1320
+ outline: ${(p) => p.$focusOutlineWidth}px solid ${(p) => p.$focusOutline};
1321
+ outline-offset: -${(p) => p.$focusOutlineWidth}px;
1322
+ }
1323
+
1324
+ & > .${ITEM_ACTIVE_CLASS} {
1325
+ background-color: ${(p) => p.$activeBg};
1326
+ outline: 1px solid ${(p) => p.$activeOutline};
1327
+ outline-offset: -1px;
1328
+ color: ${(p) => p.$colorActive};
1329
+ font-weight: 500;
1330
+ }
1331
+ `;
1332
+ var IconBox = styled6.div`
1333
+ display: flex;
1334
+ width: ${(p) => p.$size}px;
1335
+ height: ${(p) => p.$size}px;
1336
+ flex-shrink: 0;
1337
+ align-items: center;
1338
+ justify-content: center;
1339
+ color: inherit;
1340
+
1341
+ svg {
1342
+ width: ${(p) => p.$pin ? "12px" : `${p.$size}px`};
1343
+ height: ${(p) => p.$pin ? "12px" : `${p.$size}px`};
1344
+ }
1345
+ `;
1346
+ var LabelBox = styled6.span`
1347
+ display: flex;
1348
+ flex: 1;
1349
+ gap: 4px;
1350
+ height: 20px;
1351
+ align-items: center;
1352
+ min-width: 0;
1353
+ overflow: hidden;
1354
+ text-overflow: ellipsis;
1355
+ `;
1356
+ var BadgeDot = styled6.span`
1357
+ width: ${(p) => p.$size}px;
1358
+ height: ${(p) => p.$size}px;
1359
+ flex-shrink: 0;
1360
+ background: ${(p) => p.$color};
1361
+ border-radius: 999px;
1362
+ `;
1363
+ var BetaTag = styled6.span`
1364
+ padding: 2px 6px;
1365
+ border-radius: ${(p) => p.$radius}px;
1366
+ background: ${(p) => p.$bg};
1367
+ color: ${(p) => p.$color};
1368
+ font-size: 11px;
1369
+ font-weight: 500;
1370
+ line-height: 14px;
1371
+ flex-shrink: 0;
1372
+ `;
1373
+ var ExternalIconBox = styled6.span`
1374
+ display: flex;
1375
+ width: ${(p) => p.$size}px;
1376
+ height: ${(p) => p.$size}px;
1377
+ flex-shrink: 0;
1378
+ align-items: center;
1379
+ justify-content: center;
1380
+ margin-left: auto;
1381
+ color: ${(p) => p.$color};
1382
+ `;
1383
+ var SidebarMenuItem = ({
1384
+ to,
1385
+ label,
1386
+ icon,
1387
+ exact,
1388
+ external,
1389
+ hasExternalIcon,
1390
+ target,
1391
+ onClick,
1392
+ dataId,
1393
+ isActive,
1394
+ isPinned,
1395
+ showBadge,
1396
+ hasTooltip,
1397
+ beta,
1398
+ multiLine,
1399
+ extra,
1400
+ isNested = false
1401
+ }) => {
1402
+ const { LinkComponent } = useSidebar();
1403
+ const { theme } = useResolvedTheme7();
1404
+ const sizing = theme.sizing.sidebar();
1405
+ const shouldTruncate = Boolean(hasTooltip) && typeof label === "string" && label.length > TOOLTIP_TRUNCATE_LENGTH;
1406
+ const displayLabel = shouldTruncate ? /* @__PURE__ */ jsx11(Tooltip, { content: label, placement: "right", size: "md", children: /* @__PURE__ */ jsx11("span", { children: `${label.slice(0, TOOLTIP_TRUNCATE_LENGTH)}\u2026` }) }) : label;
1407
+ return /* @__PURE__ */ jsx11(
1408
+ ItemWrapper,
1409
+ {
1410
+ $itemHeight: sizing.itemHeight,
1411
+ $iconSize: sizing.iconSize,
1412
+ $padding: sizing.padding,
1413
+ $radius: sizing.radius,
1414
+ $colorIdle: theme.colors.content.tertiary,
1415
+ $colorActive: theme.colors.content.primary,
1416
+ $hoverBg: theme.colors.overlay.mono,
1417
+ $activeBg: theme.colors.overlay.mono,
1418
+ $activeOutline: theme.colors.border.secondary,
1419
+ $focusOutline: theme.colors.border.brand,
1420
+ $focusOutlineWidth: sizing.focusOutlineWidth,
1421
+ $multiLine: multiLine,
1422
+ children: /* @__PURE__ */ jsxs5(
1423
+ LinkComponent,
1424
+ {
1425
+ to,
1426
+ exact,
1427
+ external,
1428
+ target,
1429
+ onClick,
1430
+ isActive,
1431
+ className: ITEM_BASE_CLASS,
1432
+ activeClassName: ITEM_ACTIVE_CLASS,
1433
+ dataId,
1434
+ children: [
1435
+ icon && !isNested && /* @__PURE__ */ jsx11(IconBox, { $size: sizing.iconSize, $pin: isPinned, children: icon }),
1436
+ extra,
1437
+ /* @__PURE__ */ jsxs5(LabelBox, { children: [
1438
+ /* @__PURE__ */ jsx11(
1439
+ Typography3,
1440
+ {
1441
+ variant: isNested ? "bodySm" : "bodySmAccent",
1442
+ color: "inherit",
1443
+ noWrap: !multiLine,
1444
+ children: displayLabel
1445
+ }
1446
+ ),
1447
+ showBadge && /* @__PURE__ */ jsx11(
1448
+ BadgeDot,
1449
+ {
1450
+ $size: sizing.itemBadgeSize,
1451
+ $color: theme.colors.background.alert.primary
1452
+ }
1453
+ )
1454
+ ] }),
1455
+ beta && /* @__PURE__ */ jsx11(
1456
+ BetaTag,
1457
+ {
1458
+ $bg: theme.colors.overlay.mono,
1459
+ $color: theme.colors.content.tertiary,
1460
+ $radius: sizing.radius,
1461
+ children: "Beta"
1462
+ }
1463
+ ),
1464
+ external && hasExternalIcon && /* @__PURE__ */ jsx11(
1465
+ ExternalIconBox,
1466
+ {
1467
+ $size: sizing.externalIconSize,
1468
+ $color: theme.colors.content.secondary,
1469
+ children: /* @__PURE__ */ jsx11(OpenIn, { size: 18, variant: "line" })
1470
+ }
1471
+ )
1472
+ ]
1473
+ }
1474
+ )
1475
+ }
1476
+ );
1477
+ };
1478
+
1479
+ // src/SidebarMenuCollapsible.tsx
1480
+ import { useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2 } from "react";
1481
+ import styled7 from "styled-components";
1482
+ import { useResolvedTheme as useResolvedTheme8 } from "@xsolla/xui-core";
1483
+ import { Typography as Typography4 } from "@xsolla/xui-typography";
1484
+ import { ChevronRight, ChevronUp } from "@xsolla/xui-icons-base";
1485
+ import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
1486
+ var HeaderButton = styled7.button`
1487
+ display: flex;
1488
+ height: ${(p) => p.$itemHeight}px;
1489
+ width: 100%;
1490
+ box-sizing: border-box;
1491
+ align-items: center;
1492
+ gap: 8px;
1493
+ padding: 0 ${(p) => p.$padding}px;
1494
+ border: 0;
1495
+ border-radius: ${(p) => p.$radius}px;
1496
+ background: transparent;
1497
+ color: ${(p) => p.$color};
1498
+ cursor: pointer;
1499
+ font-size: 14px;
1500
+ font-weight: 500;
1501
+ line-height: 18px;
1502
+ font-family: inherit;
1503
+ text-align: left;
1504
+ white-space: nowrap;
1505
+ overflow: hidden;
1506
+ transition:
1507
+ background-color 0.15s ease-in-out,
1508
+ color 0.15s ease-in-out;
1509
+
1510
+ &:hover {
1511
+ background-color: ${(p) => p.$hoverBg};
1512
+ }
1513
+
1514
+ &:focus-visible {
1515
+ outline: ${(p) => p.$focusOutlineWidth}px solid ${(p) => p.$focusOutline};
1516
+ outline-offset: -${(p) => p.$focusOutlineWidth}px;
1517
+ }
1518
+ `;
1519
+ var ExpandRegion = styled7.div`
1520
+ display: grid;
1521
+ grid-template-rows: ${(p) => p.$expanded ? "1fr" : "0fr"};
1522
+ transition: ${(p) => p.$transition};
1523
+
1524
+ & > div {
1525
+ overflow: hidden;
1526
+ }
1527
+
1528
+ & .${ITEM_BASE_CLASS} {
1529
+ position: relative;
1530
+ padding: 0 ${(p) => p.$padding}px 0 ${(p) => p.$nestedPaddingLeft}px;
1531
+ font-weight: 400;
1532
+
1533
+ &::before {
1534
+ content: "";
1535
+ position: absolute;
1536
+ left: ${(p) => p.$railLeft}px;
1537
+ top: 0;
1538
+ bottom: 0;
1539
+ width: 1px;
1540
+ background: ${(p) => p.$railColor};
1541
+ transform: translateX(-50%);
1542
+ }
1543
+ }
1544
+
1545
+ & .${ITEM_ACTIVE_CLASS} {
1546
+ font-weight: 500;
1547
+ color: ${(p) => p.$colorActive};
1548
+ background-color: ${(p) => p.$activeBg};
1549
+ outline: 1px solid ${(p) => p.$activeOutline};
1550
+ outline-offset: -1px;
1551
+ }
1552
+ `;
1553
+ var IconBox2 = styled7.div`
1554
+ display: flex;
1555
+ width: ${(p) => p.$size}px;
1556
+ height: ${(p) => p.$size}px;
1557
+ flex-shrink: 0;
1558
+ align-items: center;
1559
+ justify-content: center;
1560
+ color: inherit;
1561
+
1562
+ svg {
1563
+ width: ${(p) => p.$size}px;
1564
+ height: ${(p) => p.$size}px;
1565
+ }
1566
+ `;
1567
+ var LabelBox2 = styled7.span`
1568
+ display: flex;
1569
+ flex: 1;
1570
+ gap: 4px;
1571
+ height: 20px;
1572
+ align-items: center;
1573
+ min-width: 0;
1574
+ overflow: hidden;
1575
+ text-overflow: ellipsis;
1576
+ `;
1577
+ var ChevronBox = styled7.span`
1578
+ display: flex;
1579
+ width: ${(p) => p.$size}px;
1580
+ height: ${(p) => p.$size}px;
1581
+ flex-shrink: 0;
1582
+ align-items: center;
1583
+ justify-content: center;
1584
+ margin-left: auto;
1585
+ color: inherit;
1586
+
1587
+ svg {
1588
+ width: ${(p) => p.$size}px;
1589
+ height: ${(p) => p.$size}px;
1590
+ }
1591
+ `;
1592
+ var computeRouteMatch = (pathname, matchPaths) => {
1593
+ if (matchPaths.length === 0) {
1594
+ return false;
1595
+ }
1596
+ const pathWithoutMerchant = pathname.replace(/^\/\d+/, "");
1597
+ return matchPaths.some((p) => {
1598
+ if (p === "/") return pathWithoutMerchant === "/";
1599
+ return pathWithoutMerchant === p || pathWithoutMerchant.startsWith(`${p}/`);
1600
+ });
1601
+ };
1602
+ var SidebarMenuCollapsible = ({
1603
+ icon,
1604
+ label,
1605
+ dataId,
1606
+ matchPaths = [],
1607
+ children
1608
+ }) => {
1609
+ const { pathname, expandedId, onExpandedIdChange } = useSidebar();
1610
+ const { theme } = useResolvedTheme8();
1611
+ const sizing = theme.sizing.sidebar();
1612
+ const idRef = useRef2();
1613
+ if (!idRef.current) {
1614
+ idRef.current = dataId || `sb-collapsible-${Math.random().toString(36).slice(2, 10)}`;
1615
+ }
1616
+ const collapsibleId = idRef.current;
1617
+ const contentId = `sidebar-collapsible-${collapsibleId}`;
1618
+ const matchKey = matchPaths.join("|");
1619
+ const isRouteMatch = useMemo2(
1620
+ () => computeRouteMatch(pathname, matchPaths),
1621
+ [pathname, matchKey, matchPaths]
1622
+ );
1623
+ const prevMatchRef = useRef2(isRouteMatch);
1624
+ useEffect2(() => {
1625
+ if (prevMatchRef.current !== isRouteMatch) {
1626
+ prevMatchRef.current = isRouteMatch;
1627
+ if (isRouteMatch) {
1628
+ onExpandedIdChange(collapsibleId);
1629
+ }
1630
+ }
1631
+ }, [isRouteMatch, collapsibleId, onExpandedIdChange]);
1632
+ const mountRef = useRef2(true);
1633
+ useEffect2(() => {
1634
+ if (mountRef.current && isRouteMatch) {
1635
+ onExpandedIdChange(collapsibleId);
1636
+ mountRef.current = false;
1637
+ }
1638
+ }, [isRouteMatch, collapsibleId, onExpandedIdChange]);
1639
+ const isExpanded = expandedId === collapsibleId;
1640
+ const handleToggle = () => {
1641
+ onExpandedIdChange(isExpanded ? null : collapsibleId);
1642
+ };
1643
+ return /* @__PURE__ */ jsxs6(Fragment2, { children: [
1644
+ /* @__PURE__ */ jsxs6(
1645
+ HeaderButton,
1646
+ {
1647
+ type: "button",
1648
+ onClick: handleToggle,
1649
+ "data-id": dataId,
1650
+ "aria-expanded": isExpanded,
1651
+ "aria-controls": contentId,
1652
+ $itemHeight: sizing.itemHeight,
1653
+ $padding: sizing.padding,
1654
+ $radius: sizing.radius,
1655
+ $color: theme.colors.content.tertiary,
1656
+ $hoverBg: theme.colors.control.mono.secondary.bgHover,
1657
+ $focusOutline: theme.colors.border.brand,
1658
+ $focusOutlineWidth: sizing.focusOutlineWidth,
1659
+ children: [
1660
+ icon && /* @__PURE__ */ jsx12(IconBox2, { $size: sizing.iconSize, children: icon }),
1661
+ /* @__PURE__ */ jsx12(LabelBox2, { children: /* @__PURE__ */ jsx12(Typography4, { variant: "bodySmAccent", color: "inherit", noWrap: true, children: label }) }),
1662
+ /* @__PURE__ */ jsx12(ChevronBox, { $size: sizing.chevronSize, children: isExpanded ? /* @__PURE__ */ jsx12(ChevronUp, { size: 14, variant: "solid" }) : /* @__PURE__ */ jsx12(ChevronRight, { size: 14, variant: "solid" }) })
1663
+ ]
1664
+ }
1665
+ ),
1666
+ /* @__PURE__ */ jsx12(
1667
+ ExpandRegion,
1668
+ {
1669
+ id: contentId,
1670
+ role: "region",
1671
+ $expanded: isExpanded,
1672
+ $transition: sizing.transitionRows,
1673
+ $padding: sizing.padding,
1674
+ $nestedPaddingLeft: sizing.nestedItemPaddingLeft,
1675
+ $railLeft: sizing.nestedItemRailLeft,
1676
+ $railColor: theme.colors.border.secondary,
1677
+ $colorActive: theme.colors.content.primary,
1678
+ $activeBg: theme.colors.overlay.mono,
1679
+ $activeOutline: theme.colors.border.secondary,
1680
+ children: /* @__PURE__ */ jsx12("div", { children })
1681
+ }
1682
+ )
1683
+ ] });
1684
+ };
1685
+
1686
+ // src/SidebarMenuSub.tsx
1687
+ import { Fragment as Fragment3, jsx as jsx13 } from "react/jsx-runtime";
1688
+ var SidebarMenuSub = ({
1689
+ children
1690
+ }) => /* @__PURE__ */ jsx13(Fragment3, { children });
1691
+
1692
+ // src/SidebarChatButton.tsx
1693
+ import styled8 from "styled-components";
1694
+ import { useResolvedTheme as useResolvedTheme9 } from "@xsolla/xui-core";
1695
+ import { Typography as Typography5 } from "@xsolla/xui-typography";
1696
+ import { ChatTwoMessages as ChatTwoMessages2 } from "@xsolla/xui-icons-base";
1697
+ import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
1698
+ var ChatButton = styled8.button`
1699
+ display: flex;
1700
+ height: ${(p) => p.$height}px;
1701
+ align-items: center;
1702
+ gap: 8px;
1703
+ padding: 0 ${(p) => p.$padding}px;
1704
+ border: 1px solid ${(p) => p.$border};
1705
+ border-radius: ${(p) => p.$radius}px;
1706
+ background: ${(p) => p.$bg};
1707
+ color: ${(p) => p.$color};
1708
+ cursor: pointer;
1709
+ font: inherit;
1710
+ position: relative;
1711
+
1712
+ &:hover {
1713
+ opacity: 0.9;
1714
+ }
1715
+
1716
+ &:focus-visible {
1717
+ outline: ${(p) => p.$focusOutlineWidth}px solid ${(p) => p.$focusOutline};
1718
+ outline-offset: 2px;
1719
+ }
1720
+
1721
+ svg {
1722
+ width: 16px;
1723
+ height: 16px;
1724
+ }
1725
+ `;
1726
+ var Badge = styled8.span`
1727
+ position: absolute;
1728
+ top: -2px;
1729
+ right: -2px;
1730
+ width: ${(p) => p.$size}px;
1731
+ height: ${(p) => p.$size}px;
1732
+ background: ${(p) => p.$color};
1733
+ border-radius: 999px;
1734
+ `;
1735
+ var SidebarChatButton = ({
1736
+ onClick,
1737
+ badge
1738
+ }) => {
1739
+ const { theme } = useResolvedTheme9();
1740
+ const sizing = theme.sizing.sidebar();
1741
+ return /* @__PURE__ */ jsxs7(
1742
+ ChatButton,
1743
+ {
1744
+ onClick,
1745
+ type: "button",
1746
+ $height: sizing.itemHeight,
1747
+ $padding: sizing.padding,
1748
+ $radius: sizing.radius,
1749
+ $bg: theme.colors.control.brand.primary.bg,
1750
+ $border: theme.colors.control.brand.primary.border,
1751
+ $color: theme.colors.content.static.dark,
1752
+ $focusOutline: theme.colors.border.brand,
1753
+ $focusOutlineWidth: sizing.focusOutlineWidth,
1754
+ children: [
1755
+ /* @__PURE__ */ jsx14(ChatTwoMessages2, { size: 16, variant: "line" }),
1756
+ /* @__PURE__ */ jsx14(Typography5, { variant: "bodySmAccent", color: "inherit", children: "Chat" }),
1757
+ badge && /* @__PURE__ */ jsx14(
1758
+ Badge,
1759
+ {
1760
+ $size: sizing.chatBadgeSize,
1761
+ $color: theme.colors.background.alert.primary
1762
+ }
1763
+ )
1764
+ ]
1765
+ }
1766
+ );
1767
+ };
1768
+ export {
1769
+ Sidebar,
1770
+ SidebarChatButton,
1771
+ SidebarCollapsed,
1772
+ SidebarContent,
1773
+ SidebarFooter,
1774
+ SidebarGroup,
1775
+ SidebarMenu,
1776
+ SidebarMenuCollapsible,
1777
+ SidebarMenuItem,
1778
+ SidebarMenuSub,
1779
+ SidebarProvider,
1780
+ SidebarTrigger,
1781
+ useSidebar
1782
+ };
1783
+ //# sourceMappingURL=index.mjs.map