@orcestr/ui 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AppShell/AppShell.d.ts +11 -0
- package/dist/components/AppShell/AppShell.d.ts.map +1 -1
- package/dist/components/AppShell/AppShell.js +8 -6
- package/dist/components/AppSidebar/AppSidebar.d.ts.map +1 -1
- package/dist/components/AppSidebar/AppSidebar.js +71 -7
- package/dist/components/Collapse/Collapse.d.ts.map +1 -1
- package/dist/components/Collapse/Collapse.js +5 -25
- package/dist/components/CopyButton/CopyButton.d.ts +24 -0
- package/dist/components/CopyButton/CopyButton.d.ts.map +1 -0
- package/dist/components/CopyButton/CopyButton.js +81 -0
- package/dist/components/Drawer/Drawer.d.ts +2 -1
- package/dist/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.js +2 -2
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +15 -4
- package/dist/components/Toast/Toast.d.ts +0 -4
- package/dist/components/Toast/Toast.d.ts.map +1 -1
- package/dist/components/Toast/Toast.js +60 -36
- package/dist/example/CodePreview.d.ts +2 -1
- package/dist/example/CodePreview.d.ts.map +1 -1
- package/dist/example/CodePreview.js +13 -48
- package/dist/example/ExampleActionsSection.d.ts.map +1 -1
- package/dist/example/ExampleActionsSection.js +2 -2
- package/dist/example/ExampleApplicationSection.d.ts.map +1 -1
- package/dist/example/ExampleApplicationSection.js +27 -7
- package/dist/example/ExampleBasicsSections.d.ts +1 -1
- package/dist/example/ExampleBasicsSections.d.ts.map +1 -1
- package/dist/example/ExampleBasicsSections.js +12 -6
- package/dist/example/ExampleOverlaysSection.d.ts.map +1 -1
- package/dist/example/ExampleOverlaysSection.js +15 -28
- package/dist/example/ExampleStateSection.d.ts.map +1 -1
- package/dist/example/ExampleStateSection.js +12 -11
- package/dist/example/ExampleThemePlayground.d.ts +1 -1
- package/dist/example/ExampleThemePlayground.d.ts.map +1 -1
- package/dist/example/ExampleThemePlayground.js +10 -7
- package/dist/example/UiExamplePage.d.ts.map +1 -1
- package/dist/example/UiExamplePage.js +34 -43
- package/dist/example/codeSamples.d.ts +1 -1
- package/dist/example/codeSamples.d.ts.map +1 -1
- package/dist/example/codeSamples.js +171 -69
- package/dist/example/exampleData.d.ts.map +1 -1
- package/dist/example/exampleData.js +3 -9
- package/dist/example/styles.css +79 -119
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/styles/orcestr-ui.css +395 -138
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/ThemeProvider.js +19 -17
- package/dist/theme/defaultTheme.d.ts.map +1 -1
- package/dist/theme/defaultTheme.js +42 -37
- package/dist/theme/themeTypes.d.ts +23 -18
- package/dist/theme/themeTypes.d.ts.map +1 -1
- package/package.json +4 -1
|
@@ -11,13 +11,18 @@ export type AppShellNavItem = {
|
|
|
11
11
|
href?: string;
|
|
12
12
|
onSelect?: () => void;
|
|
13
13
|
};
|
|
14
|
+
export type AppShellSide = 'left' | 'right';
|
|
14
15
|
export type AppShellProps = ComponentPropsWithoutRef<'div'> & SystemProps & {
|
|
15
16
|
sidebar: ReactNode;
|
|
16
17
|
header?: ReactNode;
|
|
17
18
|
sidebarMode?: 'auto' | 'desktop' | 'mobile';
|
|
19
|
+
sidebarSide?: AppShellSide;
|
|
18
20
|
sidebarOpen?: boolean;
|
|
21
|
+
desktopSidebarOpen?: boolean;
|
|
19
22
|
onSidebarOpenChange?: (open: boolean) => void;
|
|
20
23
|
sidebarWidth?: number | string;
|
|
24
|
+
headerHeight?: number | string;
|
|
25
|
+
mobileBreakpoint?: number;
|
|
21
26
|
maxWidth?: number | string;
|
|
22
27
|
contentInset?: number | string;
|
|
23
28
|
testId?: string;
|
|
@@ -26,9 +31,13 @@ export declare const AppShell: import("react").ForwardRefExoticComponent<Omit<im
|
|
|
26
31
|
sidebar: ReactNode;
|
|
27
32
|
header?: ReactNode;
|
|
28
33
|
sidebarMode?: "auto" | "desktop" | "mobile";
|
|
34
|
+
sidebarSide?: AppShellSide;
|
|
29
35
|
sidebarOpen?: boolean;
|
|
36
|
+
desktopSidebarOpen?: boolean;
|
|
30
37
|
onSidebarOpenChange?: (open: boolean) => void;
|
|
31
38
|
sidebarWidth?: number | string;
|
|
39
|
+
headerHeight?: number | string;
|
|
40
|
+
mobileBreakpoint?: number;
|
|
32
41
|
maxWidth?: number | string;
|
|
33
42
|
contentInset?: number | string;
|
|
34
43
|
testId?: string;
|
|
@@ -39,6 +48,7 @@ export type AppShellHeaderProps = Omit<ComponentPropsWithoutRef<'header'>, 'titl
|
|
|
39
48
|
sidebarOpen?: boolean;
|
|
40
49
|
onSidebarOpenChange?: (open: boolean) => void;
|
|
41
50
|
navigationLabel?: string;
|
|
51
|
+
navigationVisibility?: 'always' | 'mobile';
|
|
42
52
|
visibility?: 'always' | 'mobile';
|
|
43
53
|
testId?: string;
|
|
44
54
|
};
|
|
@@ -48,6 +58,7 @@ export declare const AppShellHeader: import("react").ForwardRefExoticComponent<O
|
|
|
48
58
|
sidebarOpen?: boolean;
|
|
49
59
|
onSidebarOpenChange?: (open: boolean) => void;
|
|
50
60
|
navigationLabel?: string;
|
|
61
|
+
navigationVisibility?: "always" | "mobile";
|
|
51
62
|
visibility?: "always" | "mobile";
|
|
52
63
|
testId?: string;
|
|
53
64
|
} & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIH,KAAK,wBAAwB,EAE7B,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAmB,KAAK,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAS3E,MAAM,MAAM,eAAe,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,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AM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,eAAO,MAAM,eAAe;aAJX,OAAO;aACP,MAAM;kDA2CtB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,KAAK,CAAC,GAC1D,WAAW,GAAG;IACV,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,eAAO,MAAM,WAAW;WANT,eAAe,EAAE;iBACX,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI;YACpC,MAAM;aACL,MAAM;+CAsCtB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,wBAAwB,CAAC,KAAK,CAAC,GAC7D,WAAW,GAAG;IACV,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,eAAO,MAAM,cAAc;WAPZ,SAAS;cACN,SAAS;aACV,SAAS;YACV,SAAS;aACR,MAAM;kDA4BtB,CAAC"}
|
|
@@ -11,12 +11,14 @@ import { IconButton } from '../IconButton/IconButton';
|
|
|
11
11
|
import { ScrollArea } from '../ScrollArea/ScrollArea';
|
|
12
12
|
import { Separator } from '../Separator/Separator';
|
|
13
13
|
import { Text } from '../Text/Text';
|
|
14
|
-
export const AppShell = forwardRef(function AppShell({ className, style, sidebar, header, sidebarMode = 'auto', sidebarOpen = false, onSidebarOpenChange, sidebarWidth = 260, maxWidth = 1440, contentInset = 28, children, testId, ...props }, ref) {
|
|
14
|
+
export const AppShell = forwardRef(function AppShell({ className, style, sidebar, header, sidebarMode = 'auto', sidebarSide = 'left', sidebarOpen = false, desktopSidebarOpen = true, onSidebarOpenChange, sidebarWidth = 260, headerHeight = 56, mobileBreakpoint = 860, maxWidth = 1440, contentInset = 28, children, testId, ...props }, ref) {
|
|
15
15
|
const [autoDrawerMode, setAutoDrawerMode] = useState(false);
|
|
16
|
+
const [drawerPortalContainer, setDrawerPortalContainer] = useState(null);
|
|
16
17
|
const { systemStyle, restProps } = splitSystemProps(props);
|
|
17
18
|
const drawerMode = sidebarMode === 'auto' ? autoDrawerMode : sidebarMode === 'mobile';
|
|
18
19
|
const shellStyle = {
|
|
19
20
|
'--oui-app-shell-sidebar-width': shellSizeValue(sidebarWidth),
|
|
21
|
+
'--oui-app-shell-header-h': shellSizeValue(headerHeight),
|
|
20
22
|
'--oui-app-shell-max-width': shellSizeValue(maxWidth),
|
|
21
23
|
'--oui-app-shell-inset': shellSizeValue(contentInset),
|
|
22
24
|
...systemStyle,
|
|
@@ -25,20 +27,20 @@ export const AppShell = forwardRef(function AppShell({ className, style, sidebar
|
|
|
25
27
|
useEffect(() => {
|
|
26
28
|
if (sidebarMode !== 'auto')
|
|
27
29
|
return;
|
|
28
|
-
const media = window.matchMedia(
|
|
30
|
+
const media = window.matchMedia(`(max-width: ${mobileBreakpoint}px)`);
|
|
29
31
|
const update = () => setAutoDrawerMode(media.matches);
|
|
30
32
|
update();
|
|
31
33
|
media.addEventListener('change', update);
|
|
32
34
|
return () => media.removeEventListener('change', update);
|
|
33
|
-
}, [sidebarMode]);
|
|
34
|
-
return (_jsxs("div", { ref: ref, className: cn('oui-app-shell', className), "data-sidebar-open": sidebarOpen ? 'true' : 'false', "data-testid": testId, style: shellStyle, ...restProps, children: [
|
|
35
|
+
}, [mobileBreakpoint, sidebarMode]);
|
|
36
|
+
return (_jsxs("div", { ref: ref, className: cn('oui-app-shell', className), "data-sidebar-open": sidebarOpen ? 'true' : 'false', "data-desktop-sidebar-open": desktopSidebarOpen ? 'true' : 'false', "data-sidebar-side": sidebarSide, "data-sidebar-mode": drawerMode ? 'mobile' : 'desktop', "data-has-header": header ? 'true' : undefined, "data-testid": testId, style: shellStyle, ...restProps, children: [_jsxs("div", { className: 'oui-app-shell-frame', children: [!drawerMode ? (_jsx("div", { className: 'oui-app-shell-sidebar-desktop', children: sidebar })) : null, drawerMode && drawerPortalContainer ? (_jsx(Drawer, { open: sidebarOpen, onOpenChange: (nextOpen) => onSidebarOpenChange?.(nextOpen), side: sidebarSide, size: sidebarWidth, lockScroll: false, portalContainer: drawerPortalContainer, showCloseButton: false, backdropClassName: 'oui-app-shell-sidebar-drawer-overlay', panelClassName: 'oui-app-shell-sidebar-drawer-panel', bodyClassName: 'oui-app-shell-sidebar-drawer-body', testId: testId ? `${testId}-sidebar-drawer` : undefined, children: sidebar })) : null, _jsxs("main", { className: 'oui-app-shell-main', children: [header, children] })] }), drawerMode ? (_jsx("div", { ref: setDrawerPortalContainer, className: 'oui-app-shell-drawer-root' })) : null] }));
|
|
35
37
|
});
|
|
36
|
-
export const AppShellHeader = forwardRef(function AppShellHeader({ className, style, title, actions, sidebarOpen = false, onSidebarOpenChange, navigationLabel, visibility = 'always', children, testId, ...props }, ref) {
|
|
38
|
+
export const AppShellHeader = forwardRef(function AppShellHeader({ className, style, title, actions, sidebarOpen = false, onSidebarOpenChange, navigationLabel, navigationVisibility = 'always', visibility = 'always', children, testId, ...props }, ref) {
|
|
37
39
|
const { copy } = useOrcestrUiLocale();
|
|
38
40
|
const actualNavigationLabel = navigationLabel ??
|
|
39
41
|
(sidebarOpen ? copy.common.closeNavigation : copy.common.openNavigation);
|
|
40
42
|
const { systemStyle, restProps } = splitSystemProps(props);
|
|
41
|
-
return (_jsxs("header", { ref: ref, className: cn('oui-app-shell-header', className), "data-visibility": visibility, "data-testid": testId, style: { ...systemStyle, ...style }, ...restProps, children: [onSidebarOpenChange ? (_jsx(IconButton, { v: 'pad', icon: sidebarOpen ? _jsx(LuX, { size: 19 }) : _jsx(LuMenu, { size: 19 }), "aria-label": actualNavigationLabel, "aria-expanded": sidebarOpen, onClick: () => onSidebarOpenChange(!sidebarOpen) })) : null, title ? _jsx("div", { className: 'oui-app-shell-header-title', children: title }) : null, children, actions ? _jsx("div", { className: 'oui-app-shell-header-actions', children: actions }) : null] }));
|
|
43
|
+
return (_jsxs("header", { ref: ref, className: cn('oui-app-shell-header', className), "data-visibility": visibility, "data-testid": testId, style: { ...systemStyle, ...style }, ...restProps, children: [onSidebarOpenChange ? (_jsx(IconButton, { className: 'oui-app-shell-header-nav-button', v: 'pad', icon: sidebarOpen ? _jsx(LuX, { size: 19 }) : _jsx(LuMenu, { size: 19 }), "aria-label": actualNavigationLabel, "aria-expanded": sidebarOpen, "data-navigation-visibility": navigationVisibility, onClick: () => onSidebarOpenChange(!sidebarOpen) })) : null, title ? _jsx("div", { className: 'oui-app-shell-header-title', children: title }) : null, children, actions ? _jsx("div", { className: 'oui-app-shell-header-actions', children: actions }) : null] }));
|
|
42
44
|
});
|
|
43
45
|
export const AppShellSidebar = forwardRef(function AppShellSidebar({ className, style, title, description, footer, onClose, closeLabel, children, testId, ...props }, ref) {
|
|
44
46
|
const { copy } = useOrcestrUiLocale();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppSidebar.d.ts","sourceRoot":"","sources":["../../../src/components/AppSidebar/AppSidebar.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"AppSidebar.d.ts","sourceRoot":"","sources":["../../../src/components/AppSidebar/AppSidebar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKH,KAAK,wBAAwB,EAE7B,KAAK,WAAW,EAChB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAmB,KAAK,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAK3E,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9C,MAAM,MAAM,cAAc,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAC1E,WAAW,GAAG;IACV,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IACnC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,eAAO,MAAM,UAAU;aATN,SAAS;YACV,SAAS,eAAe,EAAE;aACzB,SAAS;WACX,cAAc;YACb,MAAM;iBACD,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI;aAClC,MAAM;+CA0JrB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef, useLayoutEffect, useRef, } from 'react';
|
|
3
|
+
import { forwardRef, useCallback, useLayoutEffect, useRef, } from 'react';
|
|
4
4
|
import { splitSystemProps } from '../../theme/systemProps';
|
|
5
5
|
import { cn } from '../../utils/cn';
|
|
6
6
|
import { ScrollArea } from '../ScrollArea/ScrollArea';
|
|
@@ -8,6 +8,8 @@ import { Separator } from '../Separator/Separator';
|
|
|
8
8
|
export const AppSidebar = forwardRef(function AppSidebar({ className, style, header, groups, footer, side = 'left', itemH = 40, onNavigate, testId, ...props }, ref) {
|
|
9
9
|
const contentRef = useRef(null);
|
|
10
10
|
const indicatorRef = useRef(null);
|
|
11
|
+
const indicatorPlacedRef = useRef(false);
|
|
12
|
+
const transitionFrameRef = useRef(0);
|
|
11
13
|
const activeKey = groups
|
|
12
14
|
.flatMap((group) => group.items)
|
|
13
15
|
.find((item) => item.active)?.key;
|
|
@@ -17,7 +19,7 @@ export const AppSidebar = forwardRef(function AppSidebar({ className, style, hea
|
|
|
17
19
|
...systemStyle,
|
|
18
20
|
...style,
|
|
19
21
|
};
|
|
20
|
-
|
|
22
|
+
const updateActiveIndicator = useCallback((animate = true) => {
|
|
21
23
|
const root = contentRef.current;
|
|
22
24
|
const indicator = indicatorRef.current;
|
|
23
25
|
const activeItem = root?.querySelector('[data-sidebar-active="true"]');
|
|
@@ -26,14 +28,76 @@ export const AppSidebar = forwardRef(function AppSidebar({ className, style, hea
|
|
|
26
28
|
indicator.style.opacity = '0';
|
|
27
29
|
return;
|
|
28
30
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const itemHeight = activeItem.offsetHeight;
|
|
32
|
+
if (itemHeight <= 0) {
|
|
33
|
+
indicator.style.opacity = '0';
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const skipTransition = !indicatorPlacedRef.current || !animate;
|
|
37
|
+
if (skipTransition) {
|
|
38
|
+
cancelAnimationFrame(transitionFrameRef.current);
|
|
39
|
+
indicator.style.transition = 'none';
|
|
40
|
+
}
|
|
41
|
+
indicator.style.height = `${itemHeight}px`;
|
|
42
|
+
indicator.style.transform = `translateY(${sidebarItemOffsetTop(root, activeItem)}px)`;
|
|
33
43
|
indicator.style.opacity = '1';
|
|
34
|
-
|
|
44
|
+
if (skipTransition) {
|
|
45
|
+
indicatorPlacedRef.current = true;
|
|
46
|
+
indicator.getBoundingClientRect();
|
|
47
|
+
transitionFrameRef.current = requestAnimationFrame(() => {
|
|
48
|
+
indicator.style.transition = '';
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}, []);
|
|
52
|
+
useLayoutEffect(() => {
|
|
53
|
+
const root = contentRef.current;
|
|
54
|
+
const indicator = indicatorRef.current;
|
|
55
|
+
if (!root || !indicator) {
|
|
56
|
+
if (indicator)
|
|
57
|
+
indicator.style.opacity = '0';
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (!indicatorPlacedRef.current) {
|
|
61
|
+
updateActiveIndicator(false);
|
|
62
|
+
}
|
|
63
|
+
let frame = 0;
|
|
64
|
+
let nextFrame = 0;
|
|
65
|
+
const scheduleUpdate = () => {
|
|
66
|
+
cancelAnimationFrame(frame);
|
|
67
|
+
cancelAnimationFrame(nextFrame);
|
|
68
|
+
frame = requestAnimationFrame(() => {
|
|
69
|
+
nextFrame = requestAnimationFrame(() => updateActiveIndicator());
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
scheduleUpdate();
|
|
73
|
+
let resizeObserver = null;
|
|
74
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
75
|
+
resizeObserver = new ResizeObserver(scheduleUpdate);
|
|
76
|
+
resizeObserver.observe(root);
|
|
77
|
+
const activeItem = root.querySelector('[data-sidebar-active="true"]');
|
|
78
|
+
if (activeItem)
|
|
79
|
+
resizeObserver.observe(activeItem);
|
|
80
|
+
}
|
|
81
|
+
window.addEventListener('resize', scheduleUpdate);
|
|
82
|
+
return () => {
|
|
83
|
+
cancelAnimationFrame(frame);
|
|
84
|
+
cancelAnimationFrame(nextFrame);
|
|
85
|
+
cancelAnimationFrame(transitionFrameRef.current);
|
|
86
|
+
resizeObserver?.disconnect();
|
|
87
|
+
window.removeEventListener('resize', scheduleUpdate);
|
|
88
|
+
};
|
|
89
|
+
}, [activeKey, groups, updateActiveIndicator]);
|
|
35
90
|
return (_jsxs("aside", { ref: ref, className: cn('oui-app-sidebar', className), "data-side": side, "data-testid": testId, style: sidebarStyle, ...restProps, children: [header ? _jsx("div", { className: 'oui-app-sidebar-head', children: header }) : null, _jsx(ScrollArea, { type: 'auto', scrollbars: 'vertical', className: 'oui-app-sidebar-scroll', children: _jsxs("div", { ref: contentRef, className: 'oui-app-sidebar-content', children: [_jsx("div", { ref: indicatorRef, className: 'oui-app-sidebar-indicator' }), _jsx("div", { className: 'oui-app-sidebar-groups', children: groups.map((group, index) => (_jsxs("div", { className: 'oui-app-sidebar-group', children: [index > 0 ? (_jsx(Separator, { className: 'oui-app-sidebar-separator' })) : null, _jsx("nav", { className: 'oui-app-sidebar-nav', children: group.items.map((item) => (_jsx(AppSidebarNavItem, { item: item, onNavigate: onNavigate }, item.key))) })] }, group.key))) })] }) }), footer ? (_jsxs(_Fragment, { children: [_jsx(Separator, { className: 'oui-app-sidebar-footer-separator' }), _jsx("div", { className: 'oui-app-sidebar-footer', children: footer })] })) : null] }));
|
|
36
91
|
});
|
|
92
|
+
function sidebarItemOffsetTop(root, item) {
|
|
93
|
+
let top = 0;
|
|
94
|
+
let node = item;
|
|
95
|
+
while (node && node !== root) {
|
|
96
|
+
top += node.offsetTop;
|
|
97
|
+
node = node.offsetParent;
|
|
98
|
+
}
|
|
99
|
+
return node === root ? top : item.offsetTop;
|
|
100
|
+
}
|
|
37
101
|
function AppSidebarNavItem({ item, onNavigate, }) {
|
|
38
102
|
const content = (_jsxs(_Fragment, { children: [item.icon ? _jsx("span", { className: 'oui-app-sidebar-item-icon', children: item.icon }) : null, _jsx("span", { className: 'oui-app-sidebar-item-label', children: item.label })] }));
|
|
39
103
|
const commonProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapse.d.ts","sourceRoot":"","sources":["../../../src/components/Collapse/Collapse.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"Collapse.d.ts","sourceRoot":"","sources":["../../../src/components/Collapse/Collapse.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,aAAa,EAAE,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAIzD,MAAM,MAAM,aAAa,GAAG;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,EACrB,IAAI,EACJ,QAAQ,EACR,OAAc,EACd,SAAS,EACT,KAAK,EACL,MAAM,GACT,EAAE,aAAa,2CAoBf"}
|
|
@@ -1,33 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import {} from 'react';
|
|
4
4
|
import { cn } from '../../utils/cn';
|
|
5
5
|
export function Collapse({ open, children, animate = true, className, style, testId, }) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const measure = useCallback(() => {
|
|
9
|
-
const element = contentRef.current;
|
|
10
|
-
if (!element)
|
|
11
|
-
return;
|
|
12
|
-
const nextHeight = element.scrollHeight;
|
|
13
|
-
setContentHeight((current) => (current === nextHeight ? current : nextHeight));
|
|
14
|
-
}, []);
|
|
15
|
-
useLayoutEffect(() => {
|
|
16
|
-
measure();
|
|
17
|
-
}, [children, measure, open]);
|
|
18
|
-
useLayoutEffect(() => {
|
|
19
|
-
const element = contentRef.current;
|
|
20
|
-
if (!element || typeof ResizeObserver === 'undefined')
|
|
21
|
-
return;
|
|
22
|
-
const observer = new ResizeObserver(() => measure());
|
|
23
|
-
observer.observe(element);
|
|
24
|
-
return () => observer.disconnect();
|
|
25
|
-
}, [measure]);
|
|
26
|
-
return (_jsx("div", { className: cn('oui-collapse', className), "data-state": open ? 'open' : 'closed', "data-testid": testId, style: {
|
|
27
|
-
height: open ? (contentHeight ?? undefined) : 0,
|
|
6
|
+
return (_jsx("div", { className: cn('oui-collapse', className), "data-state": open ? 'open' : 'closed', "data-animate": animate ? 'true' : 'false', "data-testid": testId, style: {
|
|
7
|
+
gridTemplateRows: open ? '1fr' : '0fr',
|
|
28
8
|
transition: animate
|
|
29
|
-
? '
|
|
9
|
+
? 'grid-template-rows 220ms cubic-bezier(0.22, 1, 0.36, 1)'
|
|
30
10
|
: 'none',
|
|
31
11
|
...style,
|
|
32
|
-
}, children: _jsx("div", {
|
|
12
|
+
}, children: _jsx("div", { className: 'oui-collapse-content', children: children }) }));
|
|
33
13
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ButtonProps } from '../Button/Button';
|
|
2
|
+
import { type IconButtonProps } from '../IconButton/IconButton';
|
|
3
|
+
export type CopyButtonProps = Omit<ButtonProps, 'children' | 'leftIcon' | 'loading' | 'onClick'> & {
|
|
4
|
+
text: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
copiedLabel?: string;
|
|
7
|
+
successMessage?: string;
|
|
8
|
+
errorMessage?: string;
|
|
9
|
+
resetMs?: number;
|
|
10
|
+
onCopied?: () => void;
|
|
11
|
+
onCopyError?: (error: unknown) => void;
|
|
12
|
+
};
|
|
13
|
+
export type CopyIconButtonProps = Omit<IconButtonProps, 'children' | 'icon' | 'loading' | 'onClick'> & {
|
|
14
|
+
text: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
successMessage?: string;
|
|
17
|
+
errorMessage?: string;
|
|
18
|
+
resetMs?: number;
|
|
19
|
+
onCopied?: () => void;
|
|
20
|
+
onCopyError?: (error: unknown) => void;
|
|
21
|
+
};
|
|
22
|
+
export declare function CopyButton({ text, label, copiedLabel, successMessage, errorMessage, resetMs, onCopied, onCopyError, className, disabled, ...props }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare function CopyIconButton({ text, label, successMessage, errorMessage, resetMs, onCopied, onCopyError, className, disabled, ...props }: CopyIconButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=CopyButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyButton.d.ts","sourceRoot":"","sources":["../../../src/components/CopyButton/CopyButton.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAS,KAAK,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,0BAA0B,CAAC;AAG1E,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC,GAAG;IAC/F,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC,GAAG;IACnG,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACvB,IAAI,EACJ,KAAc,EACd,WAAsB,EACtB,cAAyB,EACzB,YAA4B,EAC5B,OAAc,EACd,QAAQ,EACR,WAAW,EACX,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACX,EAAE,eAAe,2CAsBjB;AAED,wBAAgB,cAAc,CAAC,EAC3B,IAAI,EACJ,KAAc,EACd,cAAyB,EACzB,YAA4B,EAC5B,OAAc,EACd,QAAQ,EACR,WAAW,EACX,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACX,EAAE,mBAAmB,2CAqBrB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { LuCheck, LuCopy } from 'react-icons/lu';
|
|
5
|
+
import { cn } from '../../utils/cn';
|
|
6
|
+
import { Button } from '../Button/Button';
|
|
7
|
+
import { IconButton } from '../IconButton/IconButton';
|
|
8
|
+
import { useToast } from '../Toast/Toast';
|
|
9
|
+
export function CopyButton({ text, label = 'Copy', copiedLabel = 'Copied', successMessage = 'Copied', errorMessage = 'Copy failed', resetMs = 1400, onCopied, onCopyError, className, disabled, ...props }) {
|
|
10
|
+
const { copied, pending, copy } = useCopyAction({
|
|
11
|
+
text,
|
|
12
|
+
successMessage,
|
|
13
|
+
errorMessage,
|
|
14
|
+
resetMs,
|
|
15
|
+
onCopied,
|
|
16
|
+
onCopyError,
|
|
17
|
+
});
|
|
18
|
+
return (_jsx(Button, { ...props, className: cn('oui-copy-button', className), disabled: disabled || pending, loading: pending, leftIcon: copied ? _jsx(LuCheck, { size: 15 }) : _jsx(LuCopy, { size: 15 }), onClick: copy, children: copied ? copiedLabel : label }));
|
|
19
|
+
}
|
|
20
|
+
export function CopyIconButton({ text, label = 'Copy', successMessage = 'Copied', errorMessage = 'Copy failed', resetMs = 1400, onCopied, onCopyError, className, disabled, ...props }) {
|
|
21
|
+
const { copied, pending, copy } = useCopyAction({
|
|
22
|
+
text,
|
|
23
|
+
successMessage,
|
|
24
|
+
errorMessage,
|
|
25
|
+
resetMs,
|
|
26
|
+
onCopied,
|
|
27
|
+
onCopyError,
|
|
28
|
+
});
|
|
29
|
+
return (_jsx(IconButton, { ...props, className: cn('oui-copy-icon-button', className), disabled: disabled || pending, loading: pending, icon: copied ? _jsx(LuCheck, { size: 15 }) : _jsx(LuCopy, { size: 15 }), "aria-label": label, onClick: copy }));
|
|
30
|
+
}
|
|
31
|
+
function useCopyAction({ text, successMessage, errorMessage, resetMs, onCopied, onCopyError, }) {
|
|
32
|
+
const toast = useToast();
|
|
33
|
+
const timerRef = useRef(null);
|
|
34
|
+
const [pending, setPending] = useState(false);
|
|
35
|
+
const [copied, setCopied] = useState(false);
|
|
36
|
+
useEffect(() => () => {
|
|
37
|
+
if (timerRef.current !== null)
|
|
38
|
+
window.clearTimeout(timerRef.current);
|
|
39
|
+
}, []);
|
|
40
|
+
async function copy(event) {
|
|
41
|
+
event.stopPropagation();
|
|
42
|
+
setPending(true);
|
|
43
|
+
try {
|
|
44
|
+
await writeClipboardText(text);
|
|
45
|
+
setCopied(true);
|
|
46
|
+
onCopied?.();
|
|
47
|
+
if (successMessage)
|
|
48
|
+
toast.success(successMessage);
|
|
49
|
+
if (timerRef.current !== null)
|
|
50
|
+
window.clearTimeout(timerRef.current);
|
|
51
|
+
timerRef.current = window.setTimeout(() => setCopied(false), resetMs);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
onCopyError?.(error);
|
|
55
|
+
if (errorMessage)
|
|
56
|
+
toast.error(errorMessage);
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
setPending(false);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return { copied, pending, copy };
|
|
63
|
+
}
|
|
64
|
+
async function writeClipboardText(text) {
|
|
65
|
+
if (navigator.clipboard?.writeText) {
|
|
66
|
+
await navigator.clipboard.writeText(text);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const field = document.createElement('textarea');
|
|
70
|
+
field.value = text;
|
|
71
|
+
field.setAttribute('readonly', '');
|
|
72
|
+
field.style.position = 'fixed';
|
|
73
|
+
field.style.top = '-9999px';
|
|
74
|
+
field.style.left = '-9999px';
|
|
75
|
+
document.body.append(field);
|
|
76
|
+
field.select();
|
|
77
|
+
const copied = document.execCommand('copy');
|
|
78
|
+
field.remove();
|
|
79
|
+
if (!copied)
|
|
80
|
+
throw new Error('Clipboard copy failed');
|
|
81
|
+
}
|
|
@@ -21,10 +21,11 @@ export type DrawerProps = {
|
|
|
21
21
|
panelClassName?: string;
|
|
22
22
|
bodyClassName?: string;
|
|
23
23
|
backdropClassName?: string;
|
|
24
|
+
portalContainer?: HTMLElement | null;
|
|
24
25
|
style?: CSSProperties;
|
|
25
26
|
panelStyle?: CSSProperties;
|
|
26
27
|
backdropStyle?: CSSProperties;
|
|
27
28
|
testId?: string;
|
|
28
29
|
};
|
|
29
|
-
export declare function Drawer({ open, defaultOpen, onOpenChange, side, size, title, description, children, footer, modal, trapFocus, lockScroll, closeOnBackdropClick, closeOnEscape, showBackdrop, showCloseButton, className, panelClassName, bodyClassName, backdropClassName, style, panelStyle, backdropStyle, testId, }: DrawerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
30
|
+
export declare function Drawer({ open, defaultOpen, onOpenChange, side, size, title, description, children, footer, modal, trapFocus, lockScroll, closeOnBackdropClick, closeOnEscape, showBackdrop, showCloseButton, className, panelClassName, bodyClassName, backdropClassName, portalContainer, style, panelStyle, backdropStyle, testId, }: DrawerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
30
31
|
//# sourceMappingURL=Drawer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,aAAa,EAClB,KAAK,SAAS,EACjB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WAAW,GAAG,IAAI,CAAC;IACrC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,MAAM,CAAC,EACnB,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,IAAc,EACd,IAAI,EACJ,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,KAAY,EACZ,SAAiB,EACjB,UAAkB,EAClB,oBAA2B,EAC3B,aAAoB,EACpB,YAAoB,EACpB,eAAsB,EACtB,SAAS,EACT,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,KAAK,EACL,UAAU,EACV,aAAa,EACb,MAAM,GACT,EAAE,WAAW,kDAqHb"}
|
|
@@ -11,7 +11,7 @@ import { cn } from '../../utils/cn';
|
|
|
11
11
|
import { IconButton } from '../IconButton/IconButton';
|
|
12
12
|
import { lockOverlayScroll, overlayLayerZIndex, useOverlayContext, useOverlayLayerIndex, } from '../Overlay/OverlayProvider';
|
|
13
13
|
import { Portal } from '../Portal/Portal';
|
|
14
|
-
export function Drawer({ open, defaultOpen, onOpenChange, side = 'right', size, title, description, children, footer, modal = true, trapFocus = modal, lockScroll = modal, closeOnBackdropClick = true, closeOnEscape = true, showBackdrop = modal, showCloseButton = true, className, panelClassName, bodyClassName, backdropClassName, style, panelStyle, backdropStyle, testId, }) {
|
|
14
|
+
export function Drawer({ open, defaultOpen, onOpenChange, side = 'right', size, title, description, children, footer, modal = true, trapFocus = modal, lockScroll = modal, closeOnBackdropClick = true, closeOnEscape = true, showBackdrop = modal, showCloseButton = true, className, panelClassName, bodyClassName, backdropClassName, portalContainer, style, panelStyle, backdropStyle, testId, }) {
|
|
15
15
|
const { copy } = useOrcestrUiLocale();
|
|
16
16
|
const themeContext = useContext(OrcestrThemeContext);
|
|
17
17
|
const overlay = useOverlayContext();
|
|
@@ -54,7 +54,7 @@ export function Drawer({ open, defaultOpen, onOpenChange, side = 'right', size,
|
|
|
54
54
|
}, [lockScroll, present]);
|
|
55
55
|
if (!present)
|
|
56
56
|
return null;
|
|
57
|
-
return (_jsx(Portal, { children: _jsxs("div", { className: cn('oui-drawer-layer', className), "data-state": state, "data-side": side, "data-modal": modal ? 'true' : undefined, "data-testid": testId, style: drawerStyle, children: [showBackdrop ? (_jsx("button", { type: 'button', "aria-label": copy.common.close, className: cn('oui-drawer-backdrop', backdropClassName), "data-state": state, "data-testid": testId ? `${testId}-backdrop` : undefined, style: backdropStyle, onClick: () => {
|
|
57
|
+
return (_jsx(Portal, { container: portalContainer, children: _jsxs("div", { className: cn('oui-drawer-layer', className), "data-state": state, "data-side": side, "data-modal": modal ? 'true' : undefined, "data-testid": testId, style: drawerStyle, children: [showBackdrop ? (_jsx("button", { type: 'button', "aria-label": copy.common.close, className: cn('oui-drawer-backdrop', backdropClassName), "data-state": state, "data-testid": testId ? `${testId}-backdrop` : undefined, style: backdropStyle, onClick: () => {
|
|
58
58
|
if (closeOnBackdropClick)
|
|
59
59
|
setOpen(false);
|
|
60
60
|
} })) : null, _jsxs("div", { ref: panelRef, role: modal ? 'dialog' : 'complementary', "aria-modal": modal ? 'true' : undefined, "aria-labelledby": title ? titleId : undefined, "aria-describedby": description ? descriptionId : undefined, className: cn('oui-drawer-panel', panelClassName), "data-state": state, "data-side": side, "data-testid": testId ? `${testId}-panel` : undefined, style: panelStyle, children: [title || description || showCloseButton ? (_jsxs("div", { className: 'oui-drawer-header', children: [_jsxs("div", { className: 'oui-drawer-title-wrap', children: [title ? (_jsx("h2", { id: titleId, className: 'oui-drawer-title', children: title })) : null, description ? (_jsx("p", { id: descriptionId, className: 'oui-drawer-description', children: description })) : null] }), showCloseButton ? (_jsx(IconButton, { v: 'ghost', icon: _jsx(LuX, { size: 18 }), "aria-label": copy.common.close, onClick: () => setOpen(false) })) : null] })) : null, _jsx("div", { className: cn('oui-drawer-body', bodyClassName), children: children }), footer ? _jsx("div", { className: 'oui-drawer-footer', children: footer }) : null] })] }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,wBAAwB,EAU7B,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAOf,MAAM,MAAM,OAAO,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,wBAAwB,EAU7B,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAOf,MAAM,MAAM,OAAO,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAsBF,iBAAS,QAAQ,CAAC,EACd,KAAK,EACL,KAAK,EACL,aAAa,EACb,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,MAAM,GACT,EAAE;IACC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;C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CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,iBAAS,OAAO,CAAC,EACb,KAAK,EACL,QAAQ,EACR,SAAS,EACT,aAAqB,EACrB,GAAG,KAAK,EACX,EAAE,YAAY,2CA4Bd;AAoBD,eAAO,MAAM,IAAI;;;;;CAKf,CAAC"}
|
|
@@ -5,6 +5,17 @@ import { LuChevronLeft, LuChevronRight } from 'react-icons/lu';
|
|
|
5
5
|
import { cn } from '../../utils/cn';
|
|
6
6
|
import { Collapse } from '../Collapse/Collapse';
|
|
7
7
|
import { IconButton } from '../IconButton/IconButton';
|
|
8
|
+
function stableTabRect(current, next) {
|
|
9
|
+
if (!current || !next)
|
|
10
|
+
return next;
|
|
11
|
+
if (current.left === next.left &&
|
|
12
|
+
current.top === next.top &&
|
|
13
|
+
current.width === next.width &&
|
|
14
|
+
current.height === next.height) {
|
|
15
|
+
return current;
|
|
16
|
+
}
|
|
17
|
+
return next;
|
|
18
|
+
}
|
|
8
19
|
function ItemTabs({ items, value, onValueChange, className, listClassName, contentClassName, testId, }) {
|
|
9
20
|
const active = items.find((item) => item.value === value) ?? items[0];
|
|
10
21
|
const listRef = useRef(null);
|
|
@@ -30,9 +41,9 @@ function ItemTabs({ items, value, onValueChange, className, listClassName, conte
|
|
|
30
41
|
height: trigger.offsetHeight,
|
|
31
42
|
};
|
|
32
43
|
};
|
|
33
|
-
setActiveRect(readRect(active?.value));
|
|
44
|
+
setActiveRect((current) => stableTabRect(current, readRect(active?.value)));
|
|
34
45
|
const nextHoverRect = readRect(hoveredValue);
|
|
35
|
-
setHoverRect((current) => nextHoverRect
|
|
46
|
+
setHoverRect((current) => (nextHoverRect ? stableTabRect(current, nextHoverRect) : current));
|
|
36
47
|
setHoverVisible(Boolean(hoveredValue && nextHoverRect && hoveredValue !== active?.value));
|
|
37
48
|
}, [active?.value, hoveredValue]);
|
|
38
49
|
const moveFocus = (currentValue, direction) => {
|
|
@@ -169,9 +180,9 @@ function List({ children, indicatorPaddingY = 4, className, style, ...props }) {
|
|
|
169
180
|
if (nextValue === ctx.activeValue)
|
|
170
181
|
active = rect;
|
|
171
182
|
});
|
|
172
|
-
setHoverRect((current) => hover
|
|
183
|
+
setHoverRect((current) => (hover ? stableTabRect(current, hover) : current));
|
|
173
184
|
setHoverVisible(Boolean(hover && ctx.hoveredValue !== ctx.activeValue));
|
|
174
|
-
setActiveRect(active);
|
|
185
|
+
setActiveRect((current) => stableTabRect(current, active));
|
|
175
186
|
setCanScrollLeft(list.scrollLeft > 1);
|
|
176
187
|
setCanScrollRight(list.scrollLeft + list.clientWidth < list.scrollWidth - 1);
|
|
177
188
|
}, [ctx.activeValue, ctx.hoveredValue]);
|
|
@@ -12,10 +12,6 @@ export type ToastOptions = {
|
|
|
12
12
|
tone?: ToastTone;
|
|
13
13
|
icon?: ReactNode | false;
|
|
14
14
|
position?: ToastPosition;
|
|
15
|
-
background?: string;
|
|
16
|
-
blur?: number | string | false;
|
|
17
|
-
borderColor?: string;
|
|
18
|
-
shadow?: string;
|
|
19
15
|
progressColor?: string;
|
|
20
16
|
action?: ToastAction;
|
|
21
17
|
duration?: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.tsx"],"names":[],"mappings":"AAEA,OAAO,EASH,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AASf,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAClE,MAAM,MAAM,aAAa,GACnB,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,eAAe,GACf,cAAc,CAAC;AAErB,MAAM,MAAM,WAAW,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACvB,KAAK,EAAE,SAAS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