@rovula/ui 0.0.52 → 0.0.53
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/cjs/bundle.css +50 -10
- package/dist/cjs/bundle.js +2 -2
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/Tabs/Tabs.d.ts +14 -1
- package/dist/cjs/types/components/Tabs/Tabs.stories.d.ts +81 -2
- package/dist/cjs/types/components/Tree/Tree.stories.d.ts +3 -0
- package/dist/cjs/types/components/Tree/example-data.d.ts +5 -0
- package/dist/cjs/types/components/Tree/type.d.ts +13 -4
- package/dist/components/Tabs/Tabs.js +35 -18
- package/dist/components/Tabs/Tabs.stories.js +70 -3
- package/dist/components/Tree/Tree.js +6 -4
- package/dist/components/Tree/Tree.stories.js +34 -2090
- package/dist/components/Tree/TreeItem.js +16 -8
- package/dist/components/Tree/example-data.js +2125 -0
- package/dist/esm/bundle.css +50 -10
- package/dist/esm/bundle.js +2 -2
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/Tabs/Tabs.d.ts +14 -1
- package/dist/esm/types/components/Tabs/Tabs.stories.d.ts +81 -2
- package/dist/esm/types/components/Tree/Tree.stories.d.ts +3 -0
- package/dist/esm/types/components/Tree/example-data.d.ts +5 -0
- package/dist/esm/types/components/Tree/type.d.ts +13 -4
- package/dist/index.d.ts +26 -5
- package/dist/src/theme/global.css +36 -13
- package/package.json +6 -1
- package/src/components/Tabs/Tabs.css +21 -0
- package/src/components/Tabs/Tabs.stories.tsx +140 -4
- package/src/components/Tabs/Tabs.tsx +134 -50
- package/src/components/Tree/Tree.stories.tsx +58 -2125
- package/src/components/Tree/Tree.tsx +15 -2
- package/src/components/Tree/TreeItem.tsx +47 -17
- package/src/components/Tree/example-data.ts +2162 -0
- package/src/components/Tree/type.ts +17 -4
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import "./Tabs.css";
|
|
2
3
|
type Tab = {
|
|
3
4
|
label: string;
|
|
4
5
|
startTabContent?: React.ReactElement;
|
|
5
6
|
endTabContent?: React.ReactElement;
|
|
6
7
|
content: React.ReactNode;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
isLoading?: boolean;
|
|
7
10
|
};
|
|
8
11
|
type TabsProps = {
|
|
9
12
|
tabs: Tab[];
|
|
@@ -11,12 +14,22 @@ type TabsProps = {
|
|
|
11
14
|
tabBarSize?: number;
|
|
12
15
|
tabMode?: "start" | "justify";
|
|
13
16
|
enableBorderLine?: boolean;
|
|
17
|
+
enableAddTabButton?: boolean;
|
|
18
|
+
keepIconSpace?: boolean;
|
|
14
19
|
className?: string;
|
|
15
20
|
tabBarClassName?: string;
|
|
21
|
+
tabBarContainerClassName?: string;
|
|
22
|
+
tabBarWrapperClassName?: string;
|
|
16
23
|
tabButtonClassName?: string;
|
|
17
24
|
tabButtonActiveClassName?: string;
|
|
18
25
|
tabContentClassName?: string;
|
|
19
|
-
|
|
26
|
+
addTabButtonWrapperClassName?: string;
|
|
27
|
+
borderSliderClassName?: string;
|
|
28
|
+
leftAction?: React.ReactNode;
|
|
29
|
+
rightAction?: React.ReactNode;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
onAddTab?: () => void;
|
|
32
|
+
onTabChange?: (tabIndex: number) => void;
|
|
20
33
|
};
|
|
21
34
|
declare const Tabs: React.FC<TabsProps>;
|
|
22
35
|
export default Tabs;
|
|
@@ -7,17 +7,29 @@ declare const meta: {
|
|
|
7
7
|
startTabContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
8
8
|
endTabContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
9
9
|
content: React.ReactNode;
|
|
10
|
+
disabled?: boolean | undefined;
|
|
11
|
+
isLoading?: boolean | undefined;
|
|
10
12
|
}[];
|
|
11
13
|
initialTab?: number | undefined;
|
|
12
14
|
tabBarSize?: number | undefined;
|
|
13
15
|
tabMode?: "start" | "justify" | undefined;
|
|
14
16
|
enableBorderLine?: boolean | undefined;
|
|
17
|
+
enableAddTabButton?: boolean | undefined;
|
|
18
|
+
keepIconSpace?: boolean | undefined;
|
|
15
19
|
className?: string | undefined;
|
|
16
20
|
tabBarClassName?: string | undefined;
|
|
21
|
+
tabBarContainerClassName?: string | undefined;
|
|
22
|
+
tabBarWrapperClassName?: string | undefined;
|
|
17
23
|
tabButtonClassName?: string | undefined;
|
|
18
24
|
tabButtonActiveClassName?: string | undefined;
|
|
19
25
|
tabContentClassName?: string | undefined;
|
|
20
|
-
|
|
26
|
+
addTabButtonWrapperClassName?: string | undefined;
|
|
27
|
+
borderSliderClassName?: string | undefined;
|
|
28
|
+
leftAction?: React.ReactNode;
|
|
29
|
+
rightAction?: React.ReactNode;
|
|
30
|
+
disabled?: boolean | undefined;
|
|
31
|
+
onAddTab?: (() => void) | undefined;
|
|
32
|
+
onTabChange?: ((tabIndex: number) => void) | undefined;
|
|
21
33
|
}>;
|
|
22
34
|
tags: string[];
|
|
23
35
|
parameters: {
|
|
@@ -29,17 +41,29 @@ declare const meta: {
|
|
|
29
41
|
startTabContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
30
42
|
endTabContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
31
43
|
content: React.ReactNode;
|
|
44
|
+
disabled?: boolean | undefined;
|
|
45
|
+
isLoading?: boolean | undefined;
|
|
32
46
|
}[];
|
|
33
47
|
initialTab?: number | undefined;
|
|
34
48
|
tabBarSize?: number | undefined;
|
|
35
49
|
tabMode?: "start" | "justify" | undefined;
|
|
36
50
|
enableBorderLine?: boolean | undefined;
|
|
51
|
+
enableAddTabButton?: boolean | undefined;
|
|
52
|
+
keepIconSpace?: boolean | undefined;
|
|
37
53
|
className?: string | undefined;
|
|
38
54
|
tabBarClassName?: string | undefined;
|
|
55
|
+
tabBarContainerClassName?: string | undefined;
|
|
56
|
+
tabBarWrapperClassName?: string | undefined;
|
|
39
57
|
tabButtonClassName?: string | undefined;
|
|
40
58
|
tabButtonActiveClassName?: string | undefined;
|
|
41
59
|
tabContentClassName?: string | undefined;
|
|
42
|
-
|
|
60
|
+
addTabButtonWrapperClassName?: string | undefined;
|
|
61
|
+
borderSliderClassName?: string | undefined;
|
|
62
|
+
leftAction?: React.ReactNode;
|
|
63
|
+
rightAction?: React.ReactNode;
|
|
64
|
+
disabled?: boolean | undefined;
|
|
65
|
+
onAddTab?: (() => void) | undefined;
|
|
66
|
+
onTabChange?: ((tabIndex: number) => void) | undefined;
|
|
43
67
|
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
44
68
|
};
|
|
45
69
|
export default meta;
|
|
@@ -65,3 +89,58 @@ export declare const CustomTab: {
|
|
|
65
89
|
};
|
|
66
90
|
render: (args: {}) => import("react/jsx-runtime").JSX.Element;
|
|
67
91
|
};
|
|
92
|
+
export declare const TabWithLeftRightAction: {
|
|
93
|
+
args: {
|
|
94
|
+
initialTab: number;
|
|
95
|
+
tabs: {
|
|
96
|
+
label: string;
|
|
97
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
98
|
+
}[];
|
|
99
|
+
};
|
|
100
|
+
render: (args: {}) => import("react/jsx-runtime").JSX.Element;
|
|
101
|
+
};
|
|
102
|
+
export declare const AddTabWithScrolling: {
|
|
103
|
+
args: {
|
|
104
|
+
initialTab: number;
|
|
105
|
+
tabs: {
|
|
106
|
+
label: string;
|
|
107
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
108
|
+
}[];
|
|
109
|
+
enableAddTabButton: boolean;
|
|
110
|
+
};
|
|
111
|
+
render: (args: {}) => import("react/jsx-runtime").JSX.Element;
|
|
112
|
+
};
|
|
113
|
+
export declare const KeepIconSpacing: {
|
|
114
|
+
args: {
|
|
115
|
+
initialTab: number;
|
|
116
|
+
tabs: {
|
|
117
|
+
label: string;
|
|
118
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
119
|
+
}[];
|
|
120
|
+
keepIconSpace: boolean;
|
|
121
|
+
};
|
|
122
|
+
render: (args: {}) => import("react/jsx-runtime").JSX.Element;
|
|
123
|
+
};
|
|
124
|
+
export declare const Loading: {
|
|
125
|
+
args: {
|
|
126
|
+
initialTab: number;
|
|
127
|
+
tabs: {
|
|
128
|
+
isLoading: boolean;
|
|
129
|
+
startTabContent: import("react/jsx-runtime").JSX.Element;
|
|
130
|
+
label: string;
|
|
131
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
132
|
+
}[];
|
|
133
|
+
};
|
|
134
|
+
render: (args: {}) => import("react/jsx-runtime").JSX.Element;
|
|
135
|
+
};
|
|
136
|
+
export declare const Disabled: {
|
|
137
|
+
args: {
|
|
138
|
+
initialTab: number;
|
|
139
|
+
tabs: {
|
|
140
|
+
disabled: boolean;
|
|
141
|
+
label: string;
|
|
142
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
143
|
+
}[];
|
|
144
|
+
};
|
|
145
|
+
render: (args: {}) => import("react/jsx-runtime").JSX.Element;
|
|
146
|
+
};
|
|
@@ -11,3 +11,6 @@ export declare const ControlShowExpandButton: StoryObj<typeof Tree>;
|
|
|
11
11
|
export declare const Diabled: StoryObj<typeof Tree>;
|
|
12
12
|
export declare const DiabledEachItem: StoryObj<typeof Tree>;
|
|
13
13
|
export declare const ExpandLoadData: StoryObj<typeof Tree>;
|
|
14
|
+
export declare const MaximumLevel: StoryObj<typeof Tree>;
|
|
15
|
+
export declare const Leaf: StoryObj<typeof Tree>;
|
|
16
|
+
export declare const HideCheckboxMode: StoryObj<typeof Tree>;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from "react";
|
|
2
|
-
export type TreeData = {
|
|
2
|
+
export type TreeData<T = {}> = {
|
|
3
3
|
id: string;
|
|
4
4
|
title: string;
|
|
5
5
|
icon?: ReactNode;
|
|
6
6
|
disabled?: boolean;
|
|
7
|
+
isLeaf?: boolean;
|
|
7
8
|
onClickItem?: (id: string) => void;
|
|
8
|
-
children?: TreeData[];
|
|
9
|
+
children?: TreeData<T>[];
|
|
9
10
|
renderIcon?: (params: {
|
|
10
11
|
id: string;
|
|
11
12
|
expanded: boolean;
|
|
12
13
|
selected: boolean;
|
|
13
14
|
}) => ReactNode;
|
|
14
|
-
};
|
|
15
|
+
} & T;
|
|
15
16
|
export interface TreeItemProps extends TreeData {
|
|
17
|
+
checkable?: boolean;
|
|
16
18
|
isFirstLevel?: boolean;
|
|
17
19
|
isLastItem: boolean;
|
|
18
20
|
disabled?: boolean;
|
|
@@ -23,11 +25,14 @@ export interface TreeItemProps extends TreeData {
|
|
|
23
25
|
horizontalLineWidth?: number;
|
|
24
26
|
expandButtonSize?: number;
|
|
25
27
|
spacing?: number;
|
|
28
|
+
currentLevel: number;
|
|
29
|
+
maxLevel?: number;
|
|
26
30
|
checkIsExpanded: (id: string) => boolean;
|
|
27
31
|
checkIsChecked: (id: string) => boolean;
|
|
28
32
|
checkIsLoading?: (id: string) => void;
|
|
29
33
|
onExpandChange?: (id: string, expanded: boolean) => void;
|
|
30
34
|
onCheckedChange?: (id: string, checked: boolean) => void;
|
|
35
|
+
notifyClickItem?: (id: string) => void;
|
|
31
36
|
renderRightSection?: (params: {
|
|
32
37
|
id: string;
|
|
33
38
|
expanded: boolean;
|
|
@@ -77,8 +82,12 @@ export interface TreeProps extends Pick<TreeItemProps, "renderIcon" | "renderRig
|
|
|
77
82
|
checkedId?: string[];
|
|
78
83
|
loadingId?: string[];
|
|
79
84
|
onExpandChange?: (id: string, expanded: boolean) => void;
|
|
80
|
-
onCheckedChange?: (checkedId: string[]) => void;
|
|
85
|
+
onCheckedChange?: (checkedId: string[], uncheckedId: string[], checkedState: Record<string, boolean>) => void;
|
|
86
|
+
onClickItem?: (id: string) => void;
|
|
87
|
+
onCheckedItem?: (id: string, checked: boolean) => void;
|
|
81
88
|
defaultExpandAll?: boolean;
|
|
82
89
|
defaultCheckAll?: boolean;
|
|
83
90
|
hierarchicalCheck?: boolean;
|
|
91
|
+
checkable?: boolean;
|
|
92
|
+
maxLevel?: number;
|
|
84
93
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -110,6 +110,8 @@ type Tab = {
|
|
|
110
110
|
startTabContent?: React__default.ReactElement;
|
|
111
111
|
endTabContent?: React__default.ReactElement;
|
|
112
112
|
content: React__default.ReactNode;
|
|
113
|
+
disabled?: boolean;
|
|
114
|
+
isLoading?: boolean;
|
|
113
115
|
};
|
|
114
116
|
type TabsProps = {
|
|
115
117
|
tabs: Tab[];
|
|
@@ -117,12 +119,22 @@ type TabsProps = {
|
|
|
117
119
|
tabBarSize?: number;
|
|
118
120
|
tabMode?: "start" | "justify";
|
|
119
121
|
enableBorderLine?: boolean;
|
|
122
|
+
enableAddTabButton?: boolean;
|
|
123
|
+
keepIconSpace?: boolean;
|
|
120
124
|
className?: string;
|
|
121
125
|
tabBarClassName?: string;
|
|
126
|
+
tabBarContainerClassName?: string;
|
|
127
|
+
tabBarWrapperClassName?: string;
|
|
122
128
|
tabButtonClassName?: string;
|
|
123
129
|
tabButtonActiveClassName?: string;
|
|
124
130
|
tabContentClassName?: string;
|
|
125
|
-
|
|
131
|
+
addTabButtonWrapperClassName?: string;
|
|
132
|
+
borderSliderClassName?: string;
|
|
133
|
+
leftAction?: React__default.ReactNode;
|
|
134
|
+
rightAction?: React__default.ReactNode;
|
|
135
|
+
disabled?: boolean;
|
|
136
|
+
onAddTab?: () => void;
|
|
137
|
+
onTabChange?: (tabIndex: number) => void;
|
|
126
138
|
};
|
|
127
139
|
declare const Tabs: React__default.FC<TabsProps>;
|
|
128
140
|
|
|
@@ -601,20 +613,22 @@ declare function useToast(options?: ToastOptions): {
|
|
|
601
613
|
position?: ToasterPosition;
|
|
602
614
|
};
|
|
603
615
|
|
|
604
|
-
type TreeData = {
|
|
616
|
+
type TreeData<T = {}> = {
|
|
605
617
|
id: string;
|
|
606
618
|
title: string;
|
|
607
619
|
icon?: ReactNode;
|
|
608
620
|
disabled?: boolean;
|
|
621
|
+
isLeaf?: boolean;
|
|
609
622
|
onClickItem?: (id: string) => void;
|
|
610
|
-
children?: TreeData[];
|
|
623
|
+
children?: TreeData<T>[];
|
|
611
624
|
renderIcon?: (params: {
|
|
612
625
|
id: string;
|
|
613
626
|
expanded: boolean;
|
|
614
627
|
selected: boolean;
|
|
615
628
|
}) => ReactNode;
|
|
616
|
-
};
|
|
629
|
+
} & T;
|
|
617
630
|
interface TreeItemProps extends TreeData {
|
|
631
|
+
checkable?: boolean;
|
|
618
632
|
isFirstLevel?: boolean;
|
|
619
633
|
isLastItem: boolean;
|
|
620
634
|
disabled?: boolean;
|
|
@@ -625,11 +639,14 @@ interface TreeItemProps extends TreeData {
|
|
|
625
639
|
horizontalLineWidth?: number;
|
|
626
640
|
expandButtonSize?: number;
|
|
627
641
|
spacing?: number;
|
|
642
|
+
currentLevel: number;
|
|
643
|
+
maxLevel?: number;
|
|
628
644
|
checkIsExpanded: (id: string) => boolean;
|
|
629
645
|
checkIsChecked: (id: string) => boolean;
|
|
630
646
|
checkIsLoading?: (id: string) => void;
|
|
631
647
|
onExpandChange?: (id: string, expanded: boolean) => void;
|
|
632
648
|
onCheckedChange?: (id: string, checked: boolean) => void;
|
|
649
|
+
notifyClickItem?: (id: string) => void;
|
|
633
650
|
renderRightSection?: (params: {
|
|
634
651
|
id: string;
|
|
635
652
|
expanded: boolean;
|
|
@@ -679,10 +696,14 @@ interface TreeProps extends Pick<TreeItemProps, "renderIcon" | "renderRightSecti
|
|
|
679
696
|
checkedId?: string[];
|
|
680
697
|
loadingId?: string[];
|
|
681
698
|
onExpandChange?: (id: string, expanded: boolean) => void;
|
|
682
|
-
onCheckedChange?: (checkedId: string[]) => void;
|
|
699
|
+
onCheckedChange?: (checkedId: string[], uncheckedId: string[], checkedState: Record<string, boolean>) => void;
|
|
700
|
+
onClickItem?: (id: string) => void;
|
|
701
|
+
onCheckedItem?: (id: string, checked: boolean) => void;
|
|
683
702
|
defaultExpandAll?: boolean;
|
|
684
703
|
defaultCheckAll?: boolean;
|
|
685
704
|
hierarchicalCheck?: boolean;
|
|
705
|
+
checkable?: boolean;
|
|
706
|
+
maxLevel?: number;
|
|
686
707
|
}
|
|
687
708
|
|
|
688
709
|
declare const Tree: FC<TreeProps>;
|
|
@@ -2244,10 +2244,6 @@ input[type=number] {
|
|
|
2244
2244
|
bottom: 0px;
|
|
2245
2245
|
}
|
|
2246
2246
|
|
|
2247
|
-
.-bottom-\[1px\] {
|
|
2248
|
-
bottom: -1px;
|
|
2249
|
-
}
|
|
2250
|
-
|
|
2251
2247
|
.-top-1 {
|
|
2252
2248
|
top: -0.25rem;
|
|
2253
2249
|
}
|
|
@@ -2256,6 +2252,10 @@ input[type=number] {
|
|
|
2256
2252
|
top: -0.375rem;
|
|
2257
2253
|
}
|
|
2258
2254
|
|
|
2255
|
+
.bottom-0 {
|
|
2256
|
+
bottom: 0px;
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
2259
|
.bottom-\[40px\] {
|
|
2260
2260
|
bottom: 40px;
|
|
2261
2261
|
}
|
|
@@ -2341,6 +2341,11 @@ input[type=number] {
|
|
|
2341
2341
|
margin-right: -0.5rem;
|
|
2342
2342
|
}
|
|
2343
2343
|
|
|
2344
|
+
.mx-4 {
|
|
2345
|
+
margin-left: 1rem;
|
|
2346
|
+
margin-right: 1rem;
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2344
2349
|
.mx-auto {
|
|
2345
2350
|
margin-left: auto;
|
|
2346
2351
|
margin-right: auto;
|
|
@@ -2552,10 +2557,6 @@ input[type=number] {
|
|
|
2552
2557
|
height: 15rem;
|
|
2553
2558
|
}
|
|
2554
2559
|
|
|
2555
|
-
.h-\[1px\] {
|
|
2556
|
-
height: 1px;
|
|
2557
|
-
}
|
|
2558
|
-
|
|
2559
2560
|
.h-\[24px\] {
|
|
2560
2561
|
height: 24px;
|
|
2561
2562
|
}
|
|
@@ -2633,6 +2634,10 @@ input[type=number] {
|
|
|
2633
2634
|
width: 0.5rem;
|
|
2634
2635
|
}
|
|
2635
2636
|
|
|
2637
|
+
.w-3 {
|
|
2638
|
+
width: 0.75rem;
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2636
2641
|
.w-4 {
|
|
2637
2642
|
width: 1rem;
|
|
2638
2643
|
}
|
|
@@ -2685,6 +2690,10 @@ input[type=number] {
|
|
|
2685
2690
|
width: 48px;
|
|
2686
2691
|
}
|
|
2687
2692
|
|
|
2693
|
+
.w-\[500px\] {
|
|
2694
|
+
width: 500px;
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2688
2697
|
.w-\[64px\] {
|
|
2689
2698
|
width: 64px;
|
|
2690
2699
|
}
|
|
@@ -2967,6 +2976,10 @@ input[type=number] {
|
|
|
2967
2976
|
overflow: hidden;
|
|
2968
2977
|
}
|
|
2969
2978
|
|
|
2979
|
+
.overflow-x-auto {
|
|
2980
|
+
overflow-x: auto;
|
|
2981
|
+
}
|
|
2982
|
+
|
|
2970
2983
|
.overflow-y-auto {
|
|
2971
2984
|
overflow-y: auto;
|
|
2972
2985
|
}
|
|
@@ -3276,6 +3289,11 @@ input[type=number] {
|
|
|
3276
3289
|
border-color: color-mix(in srgb, var(--state-color-secondary-default) calc(100% * var(--tw-border-opacity)), transparent);
|
|
3277
3290
|
}
|
|
3278
3291
|
|
|
3292
|
+
.border-state-disable-outline {
|
|
3293
|
+
--tw-border-opacity: 1;
|
|
3294
|
+
border-color: color-mix(in srgb, var(--state-color-disable-outline) calc(100% * var(--tw-border-opacity)), transparent);
|
|
3295
|
+
}
|
|
3296
|
+
|
|
3279
3297
|
.border-success-stroke {
|
|
3280
3298
|
--tw-border-opacity: 1;
|
|
3281
3299
|
border-color: color-mix(in srgb, var(--state-color-success-stroke) calc(100% * var(--tw-border-opacity)), transparent);
|
|
@@ -5045,11 +5063,6 @@ input[type=number] {
|
|
|
5045
5063
|
padding: 2rem;
|
|
5046
5064
|
}
|
|
5047
5065
|
|
|
5048
|
-
.px-1 {
|
|
5049
|
-
padding-left: 0.25rem;
|
|
5050
|
-
padding-right: 0.25rem;
|
|
5051
|
-
}
|
|
5052
|
-
|
|
5053
5066
|
.px-2 {
|
|
5054
5067
|
padding-left: 0.5rem;
|
|
5055
5068
|
padding-right: 0.5rem;
|
|
@@ -5759,6 +5772,16 @@ input[type=number] {
|
|
|
5759
5772
|
color: color-mix(in srgb, var(--secondary-foreground) calc(100% * var(--tw-text-opacity)), transparent);
|
|
5760
5773
|
}
|
|
5761
5774
|
|
|
5775
|
+
.text-state-disable-outline {
|
|
5776
|
+
--tw-text-opacity: 1;
|
|
5777
|
+
color: color-mix(in srgb, var(--state-color-disable-outline) calc(100% * var(--tw-text-opacity)), transparent);
|
|
5778
|
+
}
|
|
5779
|
+
|
|
5780
|
+
.text-state-disable-solid {
|
|
5781
|
+
--tw-text-opacity: 1;
|
|
5782
|
+
color: color-mix(in srgb, var(--state-color-disable-solid) calc(100% * var(--tw-text-opacity)), transparent);
|
|
5783
|
+
}
|
|
5784
|
+
|
|
5762
5785
|
.text-success {
|
|
5763
5786
|
--tw-text-opacity: 1;
|
|
5764
5787
|
color: color-mix(in srgb, var(--state-color-success-default) calc(100% * var(--tw-text-opacity)), transparent);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rovula/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.53",
|
|
4
4
|
"main": "dist/cjs/bundle.js",
|
|
5
5
|
"module": "dist/esm/bundle.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"public": "npm run build:package && npm publish --access=public",
|
|
16
16
|
"storybook:serve-css": "npx tailwindcss -i ./src/theme/global.css -o ./dist/src/theme/global.css",
|
|
17
17
|
"storybook": "storybook dev -p 6006",
|
|
18
|
+
"storybook:docker": "storybook dev -p 6006 --no-open",
|
|
18
19
|
"build-storybook": "storybook build",
|
|
19
20
|
"chromatic": "npx chromatic --project-token=chpt_cee098dd3b9b3ee",
|
|
20
21
|
"deploy-storybook": "npx wrangler pages deploy storybook-static --project-name=rovula-ui --branch=main"
|
|
@@ -105,6 +106,10 @@
|
|
|
105
106
|
"react": "^17.0.0 || ^18.0.0",
|
|
106
107
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
107
108
|
},
|
|
109
|
+
"overrides": {
|
|
110
|
+
"rimraf": "^4.4.1",
|
|
111
|
+
"glob": "^9.3.5"
|
|
112
|
+
},
|
|
108
113
|
"repository": {
|
|
109
114
|
"type": "git",
|
|
110
115
|
"url": ""
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* Scroll bar */
|
|
2
|
+
.tabs-scrollbar::-webkit-scrollbar {
|
|
3
|
+
height: 4px;
|
|
4
|
+
width: 4px;
|
|
5
|
+
background: rgba(0, 0, 0, 0.08);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.tabs-scrollbar::-webkit-scrollbar-thumb {
|
|
9
|
+
border-radius: 4px;
|
|
10
|
+
background: rgba(121, 141, 150, 0.48);
|
|
11
|
+
width: 4px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.tabs-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
15
|
+
background: rgba(251, 252, 253, 0.48);
|
|
16
|
+
cursor: pointer
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.tabs-scrollbar::-webkit-scrollbar-corner {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
3
|
import Tabs from "./Tabs";
|
|
4
4
|
import { ChevronDownIcon, ArchiveBoxIcon } from "@heroicons/react/16/solid";
|
|
5
|
+
import ActionButton from "../ActionButton/ActionButton";
|
|
6
|
+
import Icon from "../Icon/Icon";
|
|
7
|
+
import { useArgs } from "@storybook/preview-api";
|
|
5
8
|
|
|
6
9
|
const meta = {
|
|
7
10
|
title: "Components/Tabs",
|
|
@@ -12,7 +15,7 @@ const meta = {
|
|
|
12
15
|
},
|
|
13
16
|
decorators: [
|
|
14
17
|
(Story) => (
|
|
15
|
-
<div className="p-5 flex w-full">
|
|
18
|
+
<div className="p-5 flex w-full bg-base-bg2">
|
|
16
19
|
<Story />
|
|
17
20
|
</div>
|
|
18
21
|
),
|
|
@@ -58,8 +61,8 @@ export const CustomTab = {
|
|
|
58
61
|
initialTab: 0,
|
|
59
62
|
tabs: tabs.map((tab) => ({
|
|
60
63
|
...tab,
|
|
61
|
-
startTabContent: <ArchiveBoxIcon
|
|
62
|
-
endTabContent: <ChevronDownIcon
|
|
64
|
+
startTabContent: <ArchiveBoxIcon />,
|
|
65
|
+
endTabContent: <ChevronDownIcon />,
|
|
63
66
|
})),
|
|
64
67
|
},
|
|
65
68
|
render: (args) => {
|
|
@@ -73,3 +76,136 @@ export const CustomTab = {
|
|
|
73
76
|
);
|
|
74
77
|
},
|
|
75
78
|
} satisfies StoryObj;
|
|
79
|
+
|
|
80
|
+
// variant="scrollable"
|
|
81
|
+
export const TabWithLeftRightAction = {
|
|
82
|
+
args: {
|
|
83
|
+
initialTab: 0,
|
|
84
|
+
tabs: tabs.map((tab) => ({
|
|
85
|
+
...tab,
|
|
86
|
+
})),
|
|
87
|
+
},
|
|
88
|
+
render: (args) => {
|
|
89
|
+
const props: typeof args = {
|
|
90
|
+
...args,
|
|
91
|
+
};
|
|
92
|
+
return (
|
|
93
|
+
<div className="flex flex-row gap-4 w-full">
|
|
94
|
+
<Tabs
|
|
95
|
+
tabs={tabs}
|
|
96
|
+
{...props}
|
|
97
|
+
tabMode="start"
|
|
98
|
+
leftAction={
|
|
99
|
+
<ActionButton onClick={() => alert("left action")} className="mr-4">
|
|
100
|
+
<Icon name="academic-cap" />
|
|
101
|
+
</ActionButton>
|
|
102
|
+
}
|
|
103
|
+
rightAction={
|
|
104
|
+
<ActionButton
|
|
105
|
+
onClick={() => alert("right action")}
|
|
106
|
+
className="ml-4"
|
|
107
|
+
>
|
|
108
|
+
<Icon name="arrow-down-tray" />
|
|
109
|
+
</ActionButton>
|
|
110
|
+
}
|
|
111
|
+
/>
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
},
|
|
115
|
+
} satisfies StoryObj;
|
|
116
|
+
|
|
117
|
+
export const AddTabWithScrolling = {
|
|
118
|
+
args: {
|
|
119
|
+
initialTab: 0,
|
|
120
|
+
tabs,
|
|
121
|
+
enableAddTabButton: true,
|
|
122
|
+
},
|
|
123
|
+
render: (args) => {
|
|
124
|
+
const props: any = {
|
|
125
|
+
...args,
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const [, setArgs] = useArgs();
|
|
129
|
+
return (
|
|
130
|
+
<div className="flex flex-row gap-4 w-[500px]">
|
|
131
|
+
<Tabs
|
|
132
|
+
tabs={tabs}
|
|
133
|
+
{...props}
|
|
134
|
+
tabMode="start"
|
|
135
|
+
onAddTab={() => {
|
|
136
|
+
setArgs({
|
|
137
|
+
tabs: [
|
|
138
|
+
...props.tabs,
|
|
139
|
+
{
|
|
140
|
+
label: "Tab" + (props.tabs.length + 1),
|
|
141
|
+
content: <p>Tab {props.tabs.length + 1} content</p>,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
});
|
|
145
|
+
}}
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
148
|
+
);
|
|
149
|
+
},
|
|
150
|
+
} satisfies StoryObj;
|
|
151
|
+
|
|
152
|
+
export const KeepIconSpacing = {
|
|
153
|
+
args: {
|
|
154
|
+
initialTab: 0,
|
|
155
|
+
tabs,
|
|
156
|
+
keepIconSpace: true,
|
|
157
|
+
},
|
|
158
|
+
render: (args) => {
|
|
159
|
+
const props: any = {
|
|
160
|
+
...args,
|
|
161
|
+
};
|
|
162
|
+
return (
|
|
163
|
+
<div className="flex flex-row gap-4 w-[500px]">
|
|
164
|
+
<Tabs tabs={tabs} {...props} tabMode="start" />
|
|
165
|
+
</div>
|
|
166
|
+
);
|
|
167
|
+
},
|
|
168
|
+
} satisfies StoryObj;
|
|
169
|
+
|
|
170
|
+
export const Loading = {
|
|
171
|
+
args: {
|
|
172
|
+
initialTab: 0,
|
|
173
|
+
tabs: tabs.map((tab, i) => ({
|
|
174
|
+
...tab,
|
|
175
|
+
isLoading: i !== 0,
|
|
176
|
+
startTabContent: <Icon name="rocket-launch" />,
|
|
177
|
+
})),
|
|
178
|
+
},
|
|
179
|
+
render: (args) => {
|
|
180
|
+
const props: any = {
|
|
181
|
+
...args,
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<div className="flex flex-row gap-4 w-[500px]">
|
|
186
|
+
<Tabs tabs={tabs} {...props} tabMode="start" />
|
|
187
|
+
</div>
|
|
188
|
+
);
|
|
189
|
+
},
|
|
190
|
+
} satisfies StoryObj;
|
|
191
|
+
|
|
192
|
+
export const Disabled = {
|
|
193
|
+
args: {
|
|
194
|
+
initialTab: 0,
|
|
195
|
+
tabs: tabs.map((tab, i) => ({
|
|
196
|
+
...tab,
|
|
197
|
+
disabled: i !== 0,
|
|
198
|
+
})),
|
|
199
|
+
},
|
|
200
|
+
render: (args) => {
|
|
201
|
+
const props: any = {
|
|
202
|
+
...args,
|
|
203
|
+
};
|
|
204
|
+
return (
|
|
205
|
+
<div className="flex flex-row gap-4">
|
|
206
|
+
<Tabs tabs={tabs} {...props} />
|
|
207
|
+
<Tabs tabs={tabs} {...props} disabled />
|
|
208
|
+
</div>
|
|
209
|
+
);
|
|
210
|
+
},
|
|
211
|
+
} satisfies StoryObj;
|