@cloud-ru/ds-tabs 1.0.0
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/CHANGELOG.md +8 -0
- package/LICENSE +201 -0
- package/README.md +300 -0
- package/dist/cjs/components/ScrollButton/ScrollButton.d.ts +8 -0
- package/dist/cjs/components/ScrollButton/ScrollButton.js +19 -0
- package/dist/cjs/components/ScrollButton/index.d.ts +1 -0
- package/dist/cjs/components/ScrollButton/index.js +17 -0
- package/dist/cjs/components/ScrollButton/styles.module.css +50 -0
- package/dist/cjs/components/Tab/Tab.d.ts +25 -0
- package/dist/cjs/components/Tab/Tab.js +78 -0
- package/dist/cjs/components/Tab/index.d.ts +1 -0
- package/dist/cjs/components/Tab/index.js +17 -0
- package/dist/cjs/components/Tab/styles.module.css +105 -0
- package/dist/cjs/components/TabBar/TabBar.d.ts +30 -0
- package/dist/cjs/components/TabBar/TabBar.js +119 -0
- package/dist/cjs/components/TabBar/hooks.d.ts +18 -0
- package/dist/cjs/components/TabBar/hooks.js +103 -0
- package/dist/cjs/components/TabBar/index.d.ts +1 -0
- package/dist/cjs/components/TabBar/index.js +17 -0
- package/dist/cjs/components/TabBar/styles.module.css +187 -0
- package/dist/cjs/components/TabContent/TabContent.d.ts +8 -0
- package/dist/cjs/components/TabContent/TabContent.js +14 -0
- package/dist/cjs/components/TabContent/index.d.ts +1 -0
- package/dist/cjs/components/TabContent/index.js +17 -0
- package/dist/cjs/components/Tabs/Tabs.d.ts +21 -0
- package/dist/cjs/components/Tabs/Tabs.js +39 -0
- package/dist/cjs/components/Tabs/index.d.ts +1 -0
- package/dist/cjs/components/Tabs/index.js +17 -0
- package/dist/cjs/components/Tabs/styles.module.css +21 -0
- package/dist/cjs/components/index.d.ts +5 -0
- package/dist/cjs/components/index.js +21 -0
- package/dist/cjs/constants.d.ts +32 -0
- package/dist/cjs/constants.js +35 -0
- package/dist/cjs/context.d.ts +17 -0
- package/dist/cjs/context.js +12 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/style.css +363 -0
- package/dist/cjs/types.d.ts +17 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/utils.d.ts +1 -0
- package/dist/cjs/utils.js +6 -0
- package/dist/esm/components/ScrollButton/ScrollButton.d.ts +8 -0
- package/dist/esm/components/ScrollButton/ScrollButton.js +13 -0
- package/dist/esm/components/ScrollButton/index.d.ts +1 -0
- package/dist/esm/components/ScrollButton/index.js +1 -0
- package/dist/esm/components/ScrollButton/styles.module.css +50 -0
- package/dist/esm/components/Tab/Tab.d.ts +25 -0
- package/dist/esm/components/Tab/Tab.js +72 -0
- package/dist/esm/components/Tab/index.d.ts +1 -0
- package/dist/esm/components/Tab/index.js +1 -0
- package/dist/esm/components/Tab/styles.module.css +105 -0
- package/dist/esm/components/TabBar/TabBar.d.ts +30 -0
- package/dist/esm/components/TabBar/TabBar.js +113 -0
- package/dist/esm/components/TabBar/hooks.d.ts +18 -0
- package/dist/esm/components/TabBar/hooks.js +99 -0
- package/dist/esm/components/TabBar/index.d.ts +1 -0
- package/dist/esm/components/TabBar/index.js +1 -0
- package/dist/esm/components/TabBar/styles.module.css +187 -0
- package/dist/esm/components/TabContent/TabContent.d.ts +8 -0
- package/dist/esm/components/TabContent/TabContent.js +11 -0
- package/dist/esm/components/TabContent/index.d.ts +1 -0
- package/dist/esm/components/TabContent/index.js +1 -0
- package/dist/esm/components/Tabs/Tabs.d.ts +21 -0
- package/dist/esm/components/Tabs/Tabs.js +33 -0
- package/dist/esm/components/Tabs/index.d.ts +1 -0
- package/dist/esm/components/Tabs/index.js +1 -0
- package/dist/esm/components/Tabs/styles.module.css +21 -0
- package/dist/esm/components/index.d.ts +5 -0
- package/dist/esm/components/index.js +5 -0
- package/dist/esm/constants.d.ts +32 -0
- package/dist/esm/constants.js +32 -0
- package/dist/esm/context.d.ts +17 -0
- package/dist/esm/context.js +7 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/style.css +363 -0
- package/dist/esm/types.d.ts +17 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/utils.d.ts +1 -0
- package/dist/esm/utils.js +3 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +48 -0
- package/src/components/ScrollButton/ScrollButton.tsx +42 -0
- package/src/components/ScrollButton/index.ts +1 -0
- package/src/components/ScrollButton/styles.module.scss +46 -0
- package/src/components/Tab/Tab.tsx +151 -0
- package/src/components/Tab/index.ts +1 -0
- package/src/components/Tab/styles.module.scss +135 -0
- package/src/components/TabBar/TabBar.tsx +269 -0
- package/src/components/TabBar/hooks.ts +139 -0
- package/src/components/TabBar/index.ts +1 -0
- package/src/components/TabBar/styles.module.scss +241 -0
- package/src/components/TabContent/TabContent.tsx +34 -0
- package/src/components/TabContent/index.ts +1 -0
- package/src/components/Tabs/Tabs.tsx +61 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Tabs/styles.module.scss +25 -0
- package/src/components/index.ts +5 -0
- package/src/constants.ts +35 -0
- package/src/context.tsx +13 -0
- package/src/index.ts +5 -0
- package/src/types.ts +21 -0
- package/src/utils.ts +3 -0
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
.scrollButton{
|
|
2
|
+
position:absolute;
|
|
3
|
+
display:flex;
|
|
4
|
+
align-items:center;
|
|
5
|
+
justify-content:center;
|
|
6
|
+
}
|
|
7
|
+
.scrollButton[data-size=m][data-direction=left]{
|
|
8
|
+
padding-left:var(--sn-tabs-anatomy-size-m-control-forward-padding, var(--sn-primitive-dimension-2, 2px));
|
|
9
|
+
}
|
|
10
|
+
.scrollButton[data-size=m][data-direction=right]{
|
|
11
|
+
padding-right:var(--sn-tabs-anatomy-size-m-control-forward-padding, var(--sn-primitive-dimension-2, 2px));
|
|
12
|
+
}
|
|
13
|
+
.scrollButton[data-size=m][data-direction=top]{
|
|
14
|
+
padding-top:var(--sn-tabs-anatomy-size-m-control-forward-padding, var(--sn-primitive-dimension-2, 2px));
|
|
15
|
+
}
|
|
16
|
+
.scrollButton[data-size=m][data-direction=bottom]{
|
|
17
|
+
padding-bottom:var(--sn-tabs-anatomy-size-m-control-forward-padding, var(--sn-primitive-dimension-2, 2px));
|
|
18
|
+
}
|
|
19
|
+
.scrollButton[data-size=l][data-direction=left]{
|
|
20
|
+
padding-left:var(--sn-tabs-anatomy-size-l-control-forward-padding, var(--sn-primitive-dimension-4, 4px));
|
|
21
|
+
}
|
|
22
|
+
.scrollButton[data-size=l][data-direction=right]{
|
|
23
|
+
padding-right:var(--sn-tabs-anatomy-size-l-control-forward-padding, var(--sn-primitive-dimension-4, 4px));
|
|
24
|
+
}
|
|
25
|
+
.scrollButton[data-size=l][data-direction=top]{
|
|
26
|
+
padding-top:var(--sn-tabs-anatomy-size-l-control-forward-padding, var(--sn-primitive-dimension-4, 4px));
|
|
27
|
+
}
|
|
28
|
+
.scrollButton[data-size=l][data-direction=bottom]{
|
|
29
|
+
padding-bottom:var(--sn-tabs-anatomy-size-l-control-forward-padding, var(--sn-primitive-dimension-4, 4px));
|
|
30
|
+
}
|
|
31
|
+
.scrollButton[data-direction=left]{
|
|
32
|
+
top:0;
|
|
33
|
+
bottom:0;
|
|
34
|
+
left:0;
|
|
35
|
+
}
|
|
36
|
+
.scrollButton[data-direction=right]{
|
|
37
|
+
top:0;
|
|
38
|
+
right:0;
|
|
39
|
+
bottom:0;
|
|
40
|
+
}
|
|
41
|
+
.scrollButton[data-direction=top]{
|
|
42
|
+
top:0;
|
|
43
|
+
right:0;
|
|
44
|
+
left:0;
|
|
45
|
+
}
|
|
46
|
+
.scrollButton[data-direction=bottom]{
|
|
47
|
+
right:0;
|
|
48
|
+
bottom:0;
|
|
49
|
+
left:0;
|
|
50
|
+
}
|
|
51
|
+
.tab{
|
|
52
|
+
cursor:pointer;
|
|
53
|
+
position:relative;
|
|
54
|
+
display:inline-flex;
|
|
55
|
+
flex-direction:row;
|
|
56
|
+
align-items:center;
|
|
57
|
+
box-sizing:border-box;
|
|
58
|
+
padding:0;
|
|
59
|
+
border-width:0;
|
|
60
|
+
color:var(--sn-theme-color-available-version-textSecondary, var(--sn-brand-color-text-version-secondary, rgba(65, 66, 78, 0.8)));
|
|
61
|
+
background-color:transparent;
|
|
62
|
+
outline:none;
|
|
63
|
+
}
|
|
64
|
+
.tab[data-orientation=horizontal][data-size=m]{
|
|
65
|
+
min-height:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-minHeight, var(--sn-density-size-m, var(--sn-primitive-dimension-56, 56px)));
|
|
66
|
+
padding-left:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-horizontalPadding, var(--sn-primitive-dimension-0, 0));
|
|
67
|
+
padding-right:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-horizontalPadding, var(--sn-primitive-dimension-0, 0));
|
|
68
|
+
}
|
|
69
|
+
.tab[data-orientation=horizontal][data-size=m] .container{
|
|
70
|
+
padding-left:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-m, var(--sn-primitive-dimension-8, 8px)));
|
|
71
|
+
padding-right:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-m, var(--sn-primitive-dimension-8, 8px)));
|
|
72
|
+
border-radius:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-textWrapper-borderRadius, var(--sn-brand-anatomy-radius-button-m, var(--sn-primitive-dimension-2, 2px)));
|
|
73
|
+
min-width:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-textWrapper-minWidth, var(--sn-density-size-m, var(--sn-primitive-dimension-56, 56px)));
|
|
74
|
+
gap:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-textWrapper-gap, var(--sn-density-spacing-control-wrapper-horizontal-m, var(--sn-primitive-dimension-8, 8px)));
|
|
75
|
+
min-height:var(--sn-tabs-anatomy-size-m-tabsHorizontal-tabContainer-textWrapper-minHeight, var(--sn-density-size-s, var(--sn-primitive-dimension-48, 48px)));
|
|
76
|
+
}
|
|
77
|
+
.tab[data-orientation=vertical][data-size=m]{
|
|
78
|
+
padding-left:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-horizontalPadding, var(--sn-density-spacing-interval-m, var(--sn-primitive-dimension-16, 16px)));
|
|
79
|
+
padding-right:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-horizontalPadding, var(--sn-density-spacing-interval-m, var(--sn-primitive-dimension-16, 16px)));
|
|
80
|
+
min-height:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-minHeight, var(--sn-density-size-m, var(--sn-primitive-dimension-56, 56px)));
|
|
81
|
+
}
|
|
82
|
+
.tab[data-orientation=vertical][data-size=m] .container{
|
|
83
|
+
min-width:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-textWrapper-minWidth, var(--sn-primitive-dimension-0, 0));
|
|
84
|
+
gap:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-textWrapper-gap, var(--sn-density-spacing-control-wrapper-horizontal-m, var(--sn-primitive-dimension-8, 8px)));
|
|
85
|
+
min-height:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-textWrapper-minHeight, var(--sn-density-size-s, var(--sn-primitive-dimension-48, 48px)));
|
|
86
|
+
border-radius:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-textWrapper-borderRadius, var(--sn-brand-anatomy-radius-button-m, var(--sn-primitive-dimension-2, 2px)));
|
|
87
|
+
padding-left:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-m, var(--sn-primitive-dimension-8, 8px)));
|
|
88
|
+
padding-right:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-m, var(--sn-primitive-dimension-8, 8px)));
|
|
89
|
+
}
|
|
90
|
+
.tab[data-orientation=horizontal][data-size=l]{
|
|
91
|
+
min-height:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-minHeight, var(--sn-density-size-l, var(--sn-primitive-dimension-64, 64px)));
|
|
92
|
+
padding-left:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-horizontalPadding, var(--sn-density-spacing-control-container-horizontal-l, var(--sn-primitive-dimension-20, 20px)));
|
|
93
|
+
padding-right:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-horizontalPadding, var(--sn-density-spacing-control-container-horizontal-l, var(--sn-primitive-dimension-20, 20px)));
|
|
94
|
+
}
|
|
95
|
+
.tab[data-orientation=horizontal][data-size=l] .container{
|
|
96
|
+
min-width:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-textWrapper-minWidth, var(--sn-density-size-l, var(--sn-primitive-dimension-64, 64px)));
|
|
97
|
+
min-height:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-textWrapper-minHeight, var(--sn-density-size-m, var(--sn-primitive-dimension-56, 56px)));
|
|
98
|
+
gap:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-textWrapper-gap, var(--sn-density-spacing-control-wrapper-horizontal-l, var(--sn-primitive-dimension-12, 12px)));
|
|
99
|
+
border-radius:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-textWrapper-borderRadius, var(--sn-brand-anatomy-radius-button-l, var(--sn-primitive-dimension-2, 2px)));
|
|
100
|
+
padding-left:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-l, var(--sn-primitive-dimension-12, 12px)));
|
|
101
|
+
padding-right:var(--sn-tabs-anatomy-size-l-tabsHorizontal-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-l, var(--sn-primitive-dimension-12, 12px)));
|
|
102
|
+
}
|
|
103
|
+
.tab[data-orientation=vertical][data-size=l]{
|
|
104
|
+
padding-left:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-horizontalPadding, var(--sn-density-spacing-control-container-horizontal-l, var(--sn-primitive-dimension-20, 20px)));
|
|
105
|
+
padding-right:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-horizontalPadding, var(--sn-density-spacing-control-container-horizontal-l, var(--sn-primitive-dimension-20, 20px)));
|
|
106
|
+
min-height:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-minHeight, var(--sn-density-size-l, var(--sn-primitive-dimension-64, 64px)));
|
|
107
|
+
}
|
|
108
|
+
.tab[data-orientation=vertical][data-size=l] .container{
|
|
109
|
+
min-width:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-textWrapper-minWidth, var(--sn-density-size-l, var(--sn-primitive-dimension-64, 64px)));
|
|
110
|
+
padding-left:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-l, var(--sn-primitive-dimension-12, 12px)));
|
|
111
|
+
padding-right:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-textWrapper-horizontalPadding, var(--sn-density-spacing-control-wrapper-horizontal-l, var(--sn-primitive-dimension-12, 12px)));
|
|
112
|
+
border-radius:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-textWrapper-borderRadius, var(--sn-brand-anatomy-radius-button-l, var(--sn-primitive-dimension-2, 2px)));
|
|
113
|
+
gap:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-textWrapper-gap, var(--sn-density-spacing-control-wrapper-horizontal-l, var(--sn-primitive-dimension-12, 12px)));
|
|
114
|
+
min-height:var(--sn-tabs-anatomy-size-l-tabsVertical-tabContainer-textWrapper-minHeight, var(--sn-density-size-m, var(--sn-primitive-dimension-56, 56px)));
|
|
115
|
+
}
|
|
116
|
+
.tab[data-orientation=vertical][data-size=l]{
|
|
117
|
+
padding-right:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-horizontalPadding, var(--sn-density-spacing-interval-m, var(--sn-primitive-dimension-16, 16px)));
|
|
118
|
+
padding-left:var(--sn-tabs-anatomy-size-m-tabsVertical-tabContainer-horizontalPadding, var(--sn-density-spacing-interval-m, var(--sn-primitive-dimension-16, 16px)));
|
|
119
|
+
}
|
|
120
|
+
.tab[data-selected=true], .tab:focus-visible, .tab:hover{
|
|
121
|
+
color:var(--sn-theme-color-available-version-textMain, var(--sn-brand-color-text-version-main, #41424e));
|
|
122
|
+
}
|
|
123
|
+
.tab[data-disabled]{
|
|
124
|
+
cursor:not-allowed;
|
|
125
|
+
opacity:var(--sn-theme-effect-opacity-disabled, 0.4);
|
|
126
|
+
}
|
|
127
|
+
.tab .container > [data-state-layer]{
|
|
128
|
+
position:absolute;
|
|
129
|
+
inset:0;
|
|
130
|
+
border-radius:inherit;
|
|
131
|
+
}
|
|
132
|
+
.tab .container > [data-state-layer][data-state=emptyNeutralOnBackground]{
|
|
133
|
+
background:var(--sn-theme-color-material-stateLayer-neutral-onBackground-defaultEmpty-filled, var(--sn-brand-color-state-neutral-forLightMode-default-background, rgba(120, 123, 138, 0)));
|
|
134
|
+
}
|
|
135
|
+
@media (hover: hover){
|
|
136
|
+
.tab:hover:not([data-disabled], [data-loading]) .container > [data-state-layer][data-state=emptyNeutralOnBackground]{
|
|
137
|
+
background:var(--sn-theme-color-material-stateLayer-neutral-onBackground-hovered-filled, var(--sn-brand-color-state-neutral-forLightMode-hovered-background, rgba(188, 195, 220, 0.1490196078)));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
.tab{
|
|
141
|
+
}
|
|
142
|
+
.tab[data-loading] .container > [data-state-layer][data-state=emptyNeutralOnBackground], .tab:active:not([data-disabled], [data-loading]) .container > [data-state-layer][data-state=emptyNeutralOnBackground]{
|
|
143
|
+
background:var(--sn-theme-color-material-stateLayer-neutral-onBackground-pressed-filled, var(--sn-brand-color-state-neutral-forLightMode-pressed-background, rgba(188, 195, 220, 0.3019607843)));
|
|
144
|
+
}
|
|
145
|
+
.tab .container{
|
|
146
|
+
position:relative;
|
|
147
|
+
display:flex;
|
|
148
|
+
align-items:center;
|
|
149
|
+
justify-content:center;
|
|
150
|
+
box-sizing:border-box;
|
|
151
|
+
}
|
|
152
|
+
.tab:focus-visible .container{
|
|
153
|
+
outline:var(--sn-primitive-strokeWeight-strokeSemiBold, 2px) solid var(--sn-theme-color-available-complementary, #000000);
|
|
154
|
+
outline-offset:calc(0px - var(--sn-primitive-strokeWeight-strokeSemiBold, 2px));
|
|
155
|
+
}
|
|
156
|
+
.tabBar{
|
|
157
|
+
position:relative;
|
|
158
|
+
display:flex;
|
|
159
|
+
box-sizing:border-box;
|
|
160
|
+
}
|
|
161
|
+
.tabBar[data-orientation=vertical]{
|
|
162
|
+
flex-direction:column;
|
|
163
|
+
align-items:stretch;
|
|
164
|
+
height:100%;
|
|
165
|
+
min-height:0;
|
|
166
|
+
}
|
|
167
|
+
.tabBar[data-orientation=horizontal]{
|
|
168
|
+
flex-direction:row;
|
|
169
|
+
align-items:center;
|
|
170
|
+
}
|
|
171
|
+
.tabBar[data-size=l][data-orientation=horizontal]{
|
|
172
|
+
gap:var(--sn-tabs-anatomy-size-l-tabsHorizontal-actionSlot-gap, var(--sn-primitive-dimension-16, 16px));
|
|
173
|
+
}
|
|
174
|
+
.tabBar[data-size=l][data-orientation=vertical]{
|
|
175
|
+
gap:var(--sn-tabs-anatomy-size-l-tabsVertical-actionSlot-gap, var(--sn-primitive-dimension-16, 16px));
|
|
176
|
+
}
|
|
177
|
+
.tabBar[data-size=m][data-orientation=horizontal]{
|
|
178
|
+
gap:var(--sn-tabs-anatomy-size-m-tabsHorizontal-actionSlot-gap, var(--sn-primitive-dimension-16, 16px));
|
|
179
|
+
}
|
|
180
|
+
.tabBar[data-size=m][data-orientation=vertical]{
|
|
181
|
+
gap:var(--sn-tabs-anatomy-size-m-tabsVertical-actionSlot-gap, var(--sn-primitive-dimension-16, 16px));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.tabListWrapper{
|
|
185
|
+
position:relative;
|
|
186
|
+
display:flex;
|
|
187
|
+
box-sizing:border-box;
|
|
188
|
+
min-width:0;
|
|
189
|
+
min-height:0;
|
|
190
|
+
}
|
|
191
|
+
.tabListWrapper[data-orientation=horizontal]{
|
|
192
|
+
flex:1;
|
|
193
|
+
flex-direction:row;
|
|
194
|
+
align-items:center;
|
|
195
|
+
}
|
|
196
|
+
.tabListWrapper[data-orientation=vertical]{
|
|
197
|
+
flex:1;
|
|
198
|
+
flex-direction:column;
|
|
199
|
+
align-items:stretch;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.tabBarScrollZone{
|
|
203
|
+
position:relative;
|
|
204
|
+
overflow:visible;
|
|
205
|
+
display:flex;
|
|
206
|
+
box-sizing:border-box;
|
|
207
|
+
min-width:0;
|
|
208
|
+
min-height:0;
|
|
209
|
+
}
|
|
210
|
+
.tabBarScrollZone[data-orientation=horizontal]{
|
|
211
|
+
flex:1;
|
|
212
|
+
flex-direction:row;
|
|
213
|
+
align-items:center;
|
|
214
|
+
}
|
|
215
|
+
.tabBarScrollZone[data-orientation=vertical]{
|
|
216
|
+
flex:1;
|
|
217
|
+
flex-direction:column;
|
|
218
|
+
align-items:stretch;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.tabBarMain{
|
|
222
|
+
position:relative;
|
|
223
|
+
display:flex;
|
|
224
|
+
box-sizing:border-box;
|
|
225
|
+
min-width:0;
|
|
226
|
+
min-height:0;
|
|
227
|
+
}
|
|
228
|
+
.tabBarMain[data-orientation=horizontal]{
|
|
229
|
+
flex-direction:row;
|
|
230
|
+
align-items:center;
|
|
231
|
+
}
|
|
232
|
+
.tabBarMain[data-orientation=horizontal] .scrollArea{
|
|
233
|
+
flex:1;
|
|
234
|
+
min-width:0;
|
|
235
|
+
}
|
|
236
|
+
.tabBarMain[data-orientation=vertical]{
|
|
237
|
+
flex:1;
|
|
238
|
+
flex-direction:column;
|
|
239
|
+
align-items:stretch;
|
|
240
|
+
min-height:0;
|
|
241
|
+
}
|
|
242
|
+
.tabBarMain[data-orientation=vertical] .scrollArea{
|
|
243
|
+
flex:1;
|
|
244
|
+
min-height:0;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.horizontalScrollContainer{
|
|
248
|
+
overflow:scroll visible;
|
|
249
|
+
max-width:100%;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.verticalScrollContainer{
|
|
253
|
+
overflow:visible scroll;
|
|
254
|
+
max-height:100%;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.tabsRow{
|
|
258
|
+
position:relative;
|
|
259
|
+
overflow:hidden;
|
|
260
|
+
display:flex;
|
|
261
|
+
width:-moz-fit-content;
|
|
262
|
+
width:fit-content;
|
|
263
|
+
white-space:nowrap;
|
|
264
|
+
}
|
|
265
|
+
.tabsRow[data-size=l][data-orientation=horizontal]{
|
|
266
|
+
gap:var(--sn-tabs-anatomy-size-l-tabsHorizontal-gap, var(--sn-primitive-dimension-0, 0));
|
|
267
|
+
}
|
|
268
|
+
.tabsRow[data-size=l][data-orientation=vertical]{
|
|
269
|
+
gap:var(--sn-tabs-anatomy-size-l-tabsVertical-gap, var(--sn-primitive-dimension-0, 0));
|
|
270
|
+
}
|
|
271
|
+
.tabsRow[data-size=m][data-orientation=horizontal]{
|
|
272
|
+
gap:var(--sn-tabs-anatomy-size-m-tabsHorizontal-gap, var(--sn-density-spacing-interval-l, var(--sn-primitive-dimension-24, 24px)));
|
|
273
|
+
}
|
|
274
|
+
.tabsRow[data-size=m][data-orientation=vertical]{
|
|
275
|
+
gap:var(--sn-tabs-anatomy-size-m-tabsVertical-gap, var(--sn-primitive-dimension-0, 0));
|
|
276
|
+
}
|
|
277
|
+
.tabsRow[data-orientation=vertical]{
|
|
278
|
+
flex-direction:column;
|
|
279
|
+
width:auto;
|
|
280
|
+
min-height:-moz-min-content;
|
|
281
|
+
min-height:min-content;
|
|
282
|
+
}
|
|
283
|
+
.tabsRow[data-orientation=horizontal]{
|
|
284
|
+
flex-direction:row;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.marker{
|
|
288
|
+
position:absolute;
|
|
289
|
+
background-color:var(--sn-theme-color-primary-accent, var(--sn-brand-color-primary-55, var(--sn-brandRole-color-brandA-55, var(--sn-primitive-color-brandA-55, #389f74))));
|
|
290
|
+
transition:left 0.1s ease, width 0.1s ease, top 0.1s ease, height 0.1s ease;
|
|
291
|
+
}
|
|
292
|
+
.marker[data-orientation=horizontal]{
|
|
293
|
+
bottom:0;
|
|
294
|
+
height:var(--sn-tabs-anatomy-size-l-tabsHorizontal-selected-height, var(--sn-primitive-dimension-2, 2px));
|
|
295
|
+
border-radius:var(--sn-tabs-anatomy-size-l-tabsHorizontal-selected-borderRadius, var(--sn-brand-anatomy-radius-button-l, var(--sn-primitive-dimension-2, 2px)));
|
|
296
|
+
}
|
|
297
|
+
.marker[data-orientation=vertical]{
|
|
298
|
+
right:0;
|
|
299
|
+
width:var(--sn-tabs-anatomy-size-l-tabsVertical-selected-height, var(--sn-primitive-dimension-2, 2px));
|
|
300
|
+
border-radius:var(--sn-tabs-anatomy-size-l-tabsVertical-selected-borderRadius, var(--sn-brand-anatomy-radius-button-l, var(--sn-primitive-dimension-2, 2px)));
|
|
301
|
+
}
|
|
302
|
+
.marker[data-position=before]{
|
|
303
|
+
top:0;
|
|
304
|
+
left:0;
|
|
305
|
+
}
|
|
306
|
+
.marker[data-position=after]{
|
|
307
|
+
right:0;
|
|
308
|
+
bottom:0;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.tabsRow[data-size=m] .marker[data-orientation=horizontal]{
|
|
312
|
+
height:var(--sn-tabs-anatomy-size-m-tabsHorizontal-selected-height, var(--sn-primitive-dimension-2, 2px));
|
|
313
|
+
border-radius:var(--sn-tabs-anatomy-size-m-tabsHorizontal-selected-borderRadius, var(--sn-brand-anatomy-radius-button-m, var(--sn-primitive-dimension-2, 2px)));
|
|
314
|
+
}
|
|
315
|
+
.tabsRow[data-size=m] .marker[data-orientation=vertical]{
|
|
316
|
+
width:var(--sn-tabs-anatomy-size-m-tabsVertical-selected-height, var(--sn-primitive-dimension-2, 2px));
|
|
317
|
+
border-radius:var(--sn-tabs-anatomy-size-m-tabsVertical-selected-borderRadius, var(--sn-brand-anatomy-radius-button-m, var(--sn-primitive-dimension-2, 2px)));
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.divider{
|
|
321
|
+
position:absolute;
|
|
322
|
+
}
|
|
323
|
+
.divider[data-position=before]{
|
|
324
|
+
top:0;
|
|
325
|
+
left:0;
|
|
326
|
+
}
|
|
327
|
+
.divider[data-position=after]{
|
|
328
|
+
right:0;
|
|
329
|
+
bottom:0;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.tabBar[data-orientation=horizontal] .divider{
|
|
333
|
+
width:100%;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.tabBar[data-orientation=vertical] .divider{
|
|
337
|
+
height:100%;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.tabBarAfter[data-orientation=vertical][data-size=l], .tabBarAfter[data-orientation=vertical][data-size=m]{
|
|
341
|
+
min-height:auto;
|
|
342
|
+
}
|
|
343
|
+
.root{
|
|
344
|
+
display:flex;
|
|
345
|
+
flex-direction:column;
|
|
346
|
+
min-width:0;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.rootVertical{
|
|
350
|
+
display:flex;
|
|
351
|
+
flex-direction:row;
|
|
352
|
+
align-items:stretch;
|
|
353
|
+
min-height:0;
|
|
354
|
+
}
|
|
355
|
+
.rootVertical [role=tablist]{
|
|
356
|
+
flex:0 1 auto;
|
|
357
|
+
min-height:0;
|
|
358
|
+
max-height:100%;
|
|
359
|
+
}
|
|
360
|
+
.rootVertical [role=tabpanel]{
|
|
361
|
+
flex:1;
|
|
362
|
+
min-width:0;
|
|
363
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ValueOf } from '@cloud-ru/ds-utils';
|
|
2
|
+
import { MARKER_POSITION, ORIENTATION, SIZE } from './constants';
|
|
3
|
+
export type Size = ValueOf<typeof SIZE>;
|
|
4
|
+
export type Orientation = ValueOf<typeof ORIENTATION>;
|
|
5
|
+
export type MarkerPosition = ValueOf<typeof MARKER_POSITION>;
|
|
6
|
+
export type Direction = 'left' | 'right' | 'top' | 'bottom';
|
|
7
|
+
export type TabsContextValue = {
|
|
8
|
+
selectedTab?: string;
|
|
9
|
+
setSelectedTab(id: string): void;
|
|
10
|
+
};
|
|
11
|
+
export type TabBarContextValue = Partial<{
|
|
12
|
+
size: Size;
|
|
13
|
+
orientation: Orientation;
|
|
14
|
+
focusedTab: string;
|
|
15
|
+
onSelect(element: HTMLButtonElement): void;
|
|
16
|
+
onFocus(element: HTMLElement, id: string): void;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getTabContentId(id: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Direction, Orientation, Size } from '../../types.js';
|
|
2
|
+
export type ScrollButtonProps = {
|
|
3
|
+
size: Size;
|
|
4
|
+
direction: Direction;
|
|
5
|
+
orientation: Orientation;
|
|
6
|
+
onClick(): void;
|
|
7
|
+
};
|
|
8
|
+
export declare function ScrollButton({ size, onClick, direction, orientation }: ScrollButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from '@cloud-ru/ds-button';
|
|
3
|
+
import { ChevronDownSVG, ChevronLeftSVG, ChevronRightSVG, ChevronUpSVG } from '@cloud-ru/ds-icons/interface/system';
|
|
4
|
+
import styles from './styles.module.css';
|
|
5
|
+
const MAP_DIRECTION_TO_ICON = {
|
|
6
|
+
left: _jsx(ChevronLeftSVG, {}),
|
|
7
|
+
right: _jsx(ChevronRightSVG, {}),
|
|
8
|
+
top: _jsx(ChevronUpSVG, {}),
|
|
9
|
+
bottom: _jsx(ChevronDownSVG, {}),
|
|
10
|
+
};
|
|
11
|
+
export function ScrollButton({ size, onClick, direction, orientation }) {
|
|
12
|
+
return (_jsx("div", { className: styles.scrollButton, "data-direction": direction, "data-size": size, "data-orientation": orientation, "data-testid": `tabs__scroll-button-${direction}`, children: _jsx(Button, { tabIndex: -1, icon: MAP_DIRECTION_TO_ICON[direction], size: 's', view: 'elevated', appearance: 'neutral', onClick: onClick, "aria-label": `Scroll ${direction}` }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ScrollButton.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ScrollButton.js';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
.scrollButton{
|
|
2
|
+
position:absolute;
|
|
3
|
+
display:flex;
|
|
4
|
+
align-items:center;
|
|
5
|
+
justify-content:center;
|
|
6
|
+
}
|
|
7
|
+
.scrollButton[data-size=m][data-direction=left]{
|
|
8
|
+
padding-left:var(--sn-tabs-anatomy-size-m-control-forward-padding, var(--sn-primitive-dimension-2, 2px));
|
|
9
|
+
}
|
|
10
|
+
.scrollButton[data-size=m][data-direction=right]{
|
|
11
|
+
padding-right:var(--sn-tabs-anatomy-size-m-control-forward-padding, var(--sn-primitive-dimension-2, 2px));
|
|
12
|
+
}
|
|
13
|
+
.scrollButton[data-size=m][data-direction=top]{
|
|
14
|
+
padding-top:var(--sn-tabs-anatomy-size-m-control-forward-padding, var(--sn-primitive-dimension-2, 2px));
|
|
15
|
+
}
|
|
16
|
+
.scrollButton[data-size=m][data-direction=bottom]{
|
|
17
|
+
padding-bottom:var(--sn-tabs-anatomy-size-m-control-forward-padding, var(--sn-primitive-dimension-2, 2px));
|
|
18
|
+
}
|
|
19
|
+
.scrollButton[data-size=l][data-direction=left]{
|
|
20
|
+
padding-left:var(--sn-tabs-anatomy-size-l-control-forward-padding, var(--sn-primitive-dimension-4, 4px));
|
|
21
|
+
}
|
|
22
|
+
.scrollButton[data-size=l][data-direction=right]{
|
|
23
|
+
padding-right:var(--sn-tabs-anatomy-size-l-control-forward-padding, var(--sn-primitive-dimension-4, 4px));
|
|
24
|
+
}
|
|
25
|
+
.scrollButton[data-size=l][data-direction=top]{
|
|
26
|
+
padding-top:var(--sn-tabs-anatomy-size-l-control-forward-padding, var(--sn-primitive-dimension-4, 4px));
|
|
27
|
+
}
|
|
28
|
+
.scrollButton[data-size=l][data-direction=bottom]{
|
|
29
|
+
padding-bottom:var(--sn-tabs-anatomy-size-l-control-forward-padding, var(--sn-primitive-dimension-4, 4px));
|
|
30
|
+
}
|
|
31
|
+
.scrollButton[data-direction=left]{
|
|
32
|
+
top:0;
|
|
33
|
+
bottom:0;
|
|
34
|
+
left:0;
|
|
35
|
+
}
|
|
36
|
+
.scrollButton[data-direction=right]{
|
|
37
|
+
top:0;
|
|
38
|
+
right:0;
|
|
39
|
+
bottom:0;
|
|
40
|
+
}
|
|
41
|
+
.scrollButton[data-direction=top]{
|
|
42
|
+
top:0;
|
|
43
|
+
right:0;
|
|
44
|
+
left:0;
|
|
45
|
+
}
|
|
46
|
+
.scrollButton[data-direction=bottom]{
|
|
47
|
+
right:0;
|
|
48
|
+
bottom:0;
|
|
49
|
+
left:0;
|
|
50
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CounterProps } from '@cloud-ru/ds-counter';
|
|
2
|
+
import { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
3
|
+
import { MouseEvent } from 'react';
|
|
4
|
+
export type TabProps = WithSupportProps<{
|
|
5
|
+
/** Value вкладки */
|
|
6
|
+
value: string;
|
|
7
|
+
/** Заголовок вкладки */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Деактивирована ли вкладка */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** CSS-класс */
|
|
12
|
+
className?: string;
|
|
13
|
+
/** Счетчик, отображающийся внутри кнопки переключения */
|
|
14
|
+
counter?: {
|
|
15
|
+
/** Значение счетчика */
|
|
16
|
+
label: number;
|
|
17
|
+
/** Внешний вид */
|
|
18
|
+
appearance?: CounterProps['appearance'];
|
|
19
|
+
/** Роль, в которой применяется `appearance` счётчика */
|
|
20
|
+
roleAppearance?: CounterProps['roleAppearance'];
|
|
21
|
+
};
|
|
22
|
+
/** Колбек клика по кнопке переключения */
|
|
23
|
+
onClick?(event: MouseEvent<HTMLButtonElement>): void;
|
|
24
|
+
}>;
|
|
25
|
+
export declare function Tab({ label, value, disabled, className, onClick, counter, ...otherProps }: TabProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Counter } from '@cloud-ru/ds-counter';
|
|
3
|
+
import { Typography } from '@cloud-ru/ds-typography';
|
|
4
|
+
import { extractSupportProps } from '@cloud-ru/ds-utils';
|
|
5
|
+
import cn from 'classnames';
|
|
6
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
7
|
+
import { SIZE } from '../../constants.js';
|
|
8
|
+
import { useTabBarContext, useTabsContext } from '../../context.js';
|
|
9
|
+
import { getTabContentId } from '../../utils.js';
|
|
10
|
+
import styles from './styles.module.css';
|
|
11
|
+
const MAP_SIZE_TO_PROPS = {
|
|
12
|
+
[SIZE.L]: {
|
|
13
|
+
typographyProps: {
|
|
14
|
+
variant: 'title',
|
|
15
|
+
size: 'm',
|
|
16
|
+
},
|
|
17
|
+
counterProps: {
|
|
18
|
+
size: 's',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
[SIZE.M]: {
|
|
22
|
+
typographyProps: {
|
|
23
|
+
variant: 'title',
|
|
24
|
+
size: 's',
|
|
25
|
+
},
|
|
26
|
+
counterProps: {
|
|
27
|
+
size: 'xs',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export function Tab({ label, value, disabled = false, className, onClick, counter, ...otherProps }) {
|
|
32
|
+
const ref = useRef(null);
|
|
33
|
+
const { onSelect, size, orientation, focusedTab, onFocus } = useTabBarContext();
|
|
34
|
+
const { selectedTab, setSelectedTab } = useTabsContext();
|
|
35
|
+
const selected = value === selectedTab;
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const { current } = ref;
|
|
38
|
+
if (selected && current) {
|
|
39
|
+
onSelect?.(current);
|
|
40
|
+
}
|
|
41
|
+
}, [selected, onSelect]);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
const { current } = ref;
|
|
44
|
+
if (focusedTab === value && current) {
|
|
45
|
+
current.focus();
|
|
46
|
+
}
|
|
47
|
+
}, [value, focusedTab]);
|
|
48
|
+
const handleClick = useCallback((e) => {
|
|
49
|
+
if (disabled) {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
setSelectedTab(value);
|
|
54
|
+
onClick?.(e);
|
|
55
|
+
}, [disabled, value, onClick, setSelectedTab]);
|
|
56
|
+
const clickByEnterOrSpaceKey = useCallback((e) => {
|
|
57
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
if (disabled)
|
|
60
|
+
return;
|
|
61
|
+
ref.current?.click();
|
|
62
|
+
}
|
|
63
|
+
}, [disabled]);
|
|
64
|
+
const onFocusHandler = useCallback((e) => {
|
|
65
|
+
onFocus?.(e.target, value);
|
|
66
|
+
}, [onFocus, value]);
|
|
67
|
+
if (!size) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const { typographyProps, counterProps } = MAP_SIZE_TO_PROPS[size];
|
|
71
|
+
return (_jsx("button", { type: 'button', role: 'tab', "data-testid": `tabs__tab-${value}`, ...extractSupportProps(otherProps), id: value, ref: ref, "aria-disabled": disabled, "data-disabled": disabled || undefined, className: cn(styles.tab, className), "aria-controls": getTabContentId(value), "aria-selected": selected, "data-selected": selected || undefined, "data-size": size, "data-orientation": orientation, onClick: handleClick, onFocus: onFocusHandler, onKeyDown: clickByEnterOrSpaceKey, children: _jsxs(Typography, { className: styles.container, as: 'div', ...typographyProps, children: [label, counter && (_jsx(Counter, { appearance: counter.appearance, roleAppearance: counter.roleAppearance, value: counter.label, "data-testid": `tabs__tab-counter-${value}`, ...counterProps })), _jsx("span", { "data-state-layer": true, "aria-hidden": true, "data-state": 'emptyNeutralOnBackground' })] }) }));
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Tab.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Tab.js';
|