@sybilion/uilib 1.3.92 → 1.3.93
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/esm/components/ui/Page/PageTabs/PageTabs.js +2 -2
- package/dist/esm/components/ui/Page/PageXScroll/PageXScroll.js +5 -5
- package/dist/esm/types/src/components/ui/Page/PageTabs/PageTabs.d.ts +3 -1
- package/dist/esm/types/src/components/ui/Page/PageXScroll/PageXScroll.d.ts +8 -3
- package/package.json +1 -1
- package/src/components/ui/Page/PageTabs/PageTabs.tsx +8 -2
- package/src/components/ui/Page/PageXScroll/PageXScroll.tsx +12 -6
|
@@ -15,8 +15,8 @@ function hasTabPanelContent(content) {
|
|
|
15
15
|
return false;
|
|
16
16
|
return true;
|
|
17
17
|
}
|
|
18
|
-
function PageTabs({ className, contentClassName, innerClassName, scrollbarClassName, items, tabsListProps, variant = 'link', ...props }) {
|
|
19
|
-
return (jsxs(Tabs, { className: cn(S.root, S[`variant-${variant}`], className), variant: variant, ...props, children: [jsx(TabsList, { ...tabsListProps, className: cn(S.list, tabsListProps?.withPaddings && S.withPaddings), children: jsx(PageXScroll, { size: "sm", scrollbarClassName: cn(S.scrollbar, scrollbarClassName), innerClassName: cn(
|
|
18
|
+
function PageTabs({ className, contentClassName, innerClassName, scrollbarClassName, items, tabsListProps, variant = 'link', scrollProps, ...props }) {
|
|
19
|
+
return (jsxs(Tabs, { className: cn(S.root, S[`variant-${variant}`], className), variant: variant, ...props, children: [jsx(TabsList, { ...tabsListProps, className: cn(S.list, tabsListProps?.withPaddings && S.withPaddings), children: jsx(PageXScroll, { size: "sm", ...scrollProps, scrollbarClassName: cn(S.scrollbar, scrollbarClassName), innerClassName: cn(S.listInner, innerClassName), children: items.map((item, index) => (jsx(TabsTrigger, { value: item.value, children: item.label }, item.key ?? `${item.value}-${index}`))) }) }), items.map(item => hasTabPanelContent(item.content) ? (jsx(TabsContent, { value: item.value, className: cn(S.content, contentClassName), children: item.content }, item.value)) : null)] }));
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export { PageTabs };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import cn from 'classnames';
|
|
3
2
|
import { useState, useEffect } from 'react';
|
|
4
|
-
import { Scroll } from '@homecode/ui';
|
|
5
3
|
import S from './PageXScroll.styl.js';
|
|
4
|
+
import { Scroll } from '@homecode/ui';
|
|
5
|
+
import cn from 'classnames';
|
|
6
6
|
|
|
7
7
|
const scrollSizeMap = {
|
|
8
8
|
sm: 's',
|
|
9
9
|
md: 'm',
|
|
10
10
|
lg: 'l',
|
|
11
11
|
};
|
|
12
|
-
function PageXScroll({ children, className, innerClassName, scrollbarClassName, fullWidth = false, size = 'md', ...props }) {
|
|
12
|
+
function PageXScroll({ children, className, innerClassName, scrollbarClassName, fullWidth = false, size = 'md', scrollbarOffset, ...props }) {
|
|
13
13
|
const [pageXPadding, setPageXPadding] = useState(24); // Default fallback
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
if (typeof window !== 'undefined') {
|
|
@@ -25,8 +25,8 @@ function PageXScroll({ children, className, innerClassName, scrollbarClassName,
|
|
|
25
25
|
}, []);
|
|
26
26
|
return (jsx(Scroll, { x: true, size: scrollSizeMap[size], fadeSize: "xl", className: cn(className, S.root, fullWidth && S.fullWidth), innerClassName: cn(innerClassName, S.inner), xScrollbarClassName: scrollbarClassName, offset: {
|
|
27
27
|
x: {
|
|
28
|
-
before: pageXPadding,
|
|
29
|
-
after: pageXPadding,
|
|
28
|
+
before: pageXPadding + (scrollbarOffset?.x?.before ?? 0),
|
|
29
|
+
after: pageXPadding + (scrollbarOffset?.x?.after ?? 0),
|
|
30
30
|
},
|
|
31
31
|
}, autoHide: true, ...props, children: children }));
|
|
32
32
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PageXScrollProps } from '#uilib/components/ui/Page/PageXScroll/PageXScroll';
|
|
1
2
|
import { TabsListProps, TabsProps, type TabsVariant } from '#uilib/components/ui/Tabs';
|
|
2
3
|
export type PageTabsItem = {
|
|
3
4
|
value: string;
|
|
@@ -6,13 +7,14 @@ export type PageTabsItem = {
|
|
|
6
7
|
/** React list key when multiple items may share `value`. */
|
|
7
8
|
key?: string;
|
|
8
9
|
};
|
|
9
|
-
export declare function PageTabs({ className, contentClassName, innerClassName, scrollbarClassName, items, tabsListProps, variant, ...props }: {
|
|
10
|
+
export declare function PageTabs({ className, contentClassName, innerClassName, scrollbarClassName, items, tabsListProps, variant, scrollProps, ...props }: {
|
|
10
11
|
items: PageTabsItem[];
|
|
11
12
|
tabsListProps?: TabsListProps & {
|
|
12
13
|
fullWidth?: boolean;
|
|
13
14
|
withPaddings?: boolean;
|
|
14
15
|
};
|
|
15
16
|
variant?: TabsVariant;
|
|
17
|
+
scrollProps?: Partial<PageXScrollProps>;
|
|
16
18
|
} & TabsProps & {
|
|
17
19
|
contentClassName?: string;
|
|
18
20
|
innerClassName?: string;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { Scroll } from '@homecode/ui';
|
|
2
|
-
interface PageXScrollProps extends Omit<React.ComponentProps<typeof Scroll>, 'size'> {
|
|
2
|
+
export interface PageXScrollProps extends Omit<React.ComponentProps<typeof Scroll>, 'size'> {
|
|
3
3
|
size?: 'sm' | 'md' | 'lg';
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
className?: string;
|
|
6
6
|
innerClassName?: string;
|
|
7
7
|
scrollbarClassName?: string;
|
|
8
8
|
fullWidth?: boolean;
|
|
9
|
+
scrollbarOffset?: {
|
|
10
|
+
x?: {
|
|
11
|
+
before?: number;
|
|
12
|
+
after?: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
9
15
|
}
|
|
10
|
-
export declare function PageXScroll({ children, className, innerClassName, scrollbarClassName, fullWidth, size, ...props }: PageXScrollProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export {};
|
|
16
|
+
export declare function PageXScroll({ children, className, innerClassName, scrollbarClassName, fullWidth, size, scrollbarOffset, ...props }: PageXScrollProps): import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import cn from 'classnames';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
PageXScroll,
|
|
5
|
+
PageXScrollProps,
|
|
6
|
+
} from '#uilib/components/ui/Page/PageXScroll/PageXScroll';
|
|
4
7
|
import {
|
|
5
8
|
Tabs,
|
|
6
9
|
TabsContent,
|
|
@@ -37,6 +40,7 @@ export function PageTabs({
|
|
|
37
40
|
items,
|
|
38
41
|
tabsListProps,
|
|
39
42
|
variant = 'link',
|
|
43
|
+
scrollProps,
|
|
40
44
|
...props
|
|
41
45
|
}: {
|
|
42
46
|
items: PageTabsItem[];
|
|
@@ -45,6 +49,7 @@ export function PageTabs({
|
|
|
45
49
|
withPaddings?: boolean;
|
|
46
50
|
};
|
|
47
51
|
variant?: TabsVariant;
|
|
52
|
+
scrollProps?: Partial<PageXScrollProps>;
|
|
48
53
|
} & TabsProps & {
|
|
49
54
|
contentClassName?: string;
|
|
50
55
|
innerClassName?: string;
|
|
@@ -62,8 +67,9 @@ export function PageTabs({
|
|
|
62
67
|
>
|
|
63
68
|
<PageXScroll
|
|
64
69
|
size="sm"
|
|
70
|
+
{...scrollProps}
|
|
65
71
|
scrollbarClassName={cn(S.scrollbar, scrollbarClassName)}
|
|
66
|
-
innerClassName={cn(
|
|
72
|
+
innerClassName={cn(S.listInner, innerClassName)}
|
|
67
73
|
>
|
|
68
74
|
{items.map((item, index) => (
|
|
69
75
|
<TabsTrigger
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import cn from 'classnames';
|
|
2
1
|
import { useEffect, useState } from 'react';
|
|
3
2
|
|
|
4
|
-
import { Scroll } from '@homecode/ui';
|
|
5
|
-
|
|
6
3
|
import S from './PageXScroll.styl';
|
|
4
|
+
import { Scroll } from '@homecode/ui';
|
|
5
|
+
import cn from 'classnames';
|
|
7
6
|
|
|
8
7
|
const scrollSizeMap = {
|
|
9
8
|
sm: 's',
|
|
@@ -11,7 +10,7 @@ const scrollSizeMap = {
|
|
|
11
10
|
lg: 'l',
|
|
12
11
|
} as const;
|
|
13
12
|
|
|
14
|
-
interface PageXScrollProps extends Omit<
|
|
13
|
+
export interface PageXScrollProps extends Omit<
|
|
15
14
|
React.ComponentProps<typeof Scroll>,
|
|
16
15
|
'size'
|
|
17
16
|
> {
|
|
@@ -21,6 +20,12 @@ interface PageXScrollProps extends Omit<
|
|
|
21
20
|
innerClassName?: string;
|
|
22
21
|
scrollbarClassName?: string;
|
|
23
22
|
fullWidth?: boolean;
|
|
23
|
+
scrollbarOffset?: {
|
|
24
|
+
x?: {
|
|
25
|
+
before?: number;
|
|
26
|
+
after?: number;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
export function PageXScroll({
|
|
@@ -30,6 +35,7 @@ export function PageXScroll({
|
|
|
30
35
|
scrollbarClassName,
|
|
31
36
|
fullWidth = false,
|
|
32
37
|
size = 'md',
|
|
38
|
+
scrollbarOffset,
|
|
33
39
|
...props
|
|
34
40
|
}: PageXScrollProps) {
|
|
35
41
|
const [pageXPadding, setPageXPadding] = useState(24); // Default fallback
|
|
@@ -57,8 +63,8 @@ export function PageXScroll({
|
|
|
57
63
|
xScrollbarClassName={scrollbarClassName}
|
|
58
64
|
offset={{
|
|
59
65
|
x: {
|
|
60
|
-
before: pageXPadding,
|
|
61
|
-
after: pageXPadding,
|
|
66
|
+
before: pageXPadding + (scrollbarOffset?.x?.before ?? 0),
|
|
67
|
+
after: pageXPadding + (scrollbarOffset?.x?.after ?? 0),
|
|
62
68
|
},
|
|
63
69
|
}}
|
|
64
70
|
autoHide
|