@@ -6,14 +6,12 @@ import {
66 useRef ,
77 useState ,
88} from 'react' ;
9- import styled from 'styled-components' ;
109
1110import { Block } from '../../Block' ;
12- import { Action , CubeActionProps } from '../../actions/Action ' ;
11+ import { Action , Button , CubeActionProps } from '../../actions' ;
1312import { Space } from '../../layout/Space' ;
1413import { CubeFlexProps , Flex } from '../../layout/Flex' ;
1514import { Styles , tasty } from '../../../tasty' ;
16- import { Button } from '../../actions' ;
1715import { useLayoutEffect } from '../../../utils/react' ;
1816import { CloseIcon } from '../../../icons' ;
1917
@@ -39,39 +37,31 @@ const FileTabsContext = createContext<FileTabContextValue>({
3937} ) ;
4038
4139const TabsPanelElement = tasty ( Space , {
40+ qa : 'TabsPanel' ,
4241 styles : {
42+ position : 'relative' ,
43+ overflow : 'auto hidden' ,
44+ top : '1bw' ,
4345 gap : '.5x' ,
4446 flexShrink : 0 ,
47+ whiteSpace : 'nowrap' ,
48+ styledScrollbar : true ,
49+ padding : '1ow 1ow 0 1ow' ,
50+ fade : {
51+ '' : false ,
52+ '[data-is-left-fade]' : '3x left' ,
53+ '[data-is-right-fade]' : '3x right' ,
54+ '[data-is-right-fade] & [data-is-left-fade]' : '3x left right' ,
55+ } ,
56+ transition : 'fade' ,
57+ '--scrollbar-radius' : '1ow' ,
58+ '--scrollbar-width' : '.75x' ,
59+ '--scrollbar-outline-width' : '1px' ,
4560 } ,
4661} ) ;
4762
48- const StyledTabsPanelElement = styled ( TabsPanelElement ) `
49- position: relative;
50- overflow: auto hidden;
51- top: 1px;
52- white-space: nowrap;
53-
54- ::-webkit-scrollbar-track {
55- background: var(--grey-light-color);
56- }
57-
58- ::-webkit-scrollbar-thumb {
59- border-radius: 1px;
60- background: var(--dark-04-color);
61- background-clip: padding-box;
62- }
63-
64- ::-webkit-scrollbar-corner {
65- background-color: transparent;
66- }
67-
68- ::-webkit-scrollbar {
69- width: 3px;
70- height: 3px;
71- }
72- ` ;
73-
7463const TabsContainerElement = tasty ( Flex , {
64+ qa : 'TabsContainer' ,
7565 styles : {
7666 flow : 'column' ,
7767 height : 'max 100%' ,
@@ -80,51 +70,6 @@ const TabsContainerElement = tasty(Flex, {
8070 } ,
8171} ) ;
8272
83- const StyledTabsContainerElement = styled ( TabsContainerElement ) `
84- &::before {
85- content: '';
86- display: block;
87- opacity: 0;
88- position: absolute;
89- top: 0;
90- left: 0;
91- pointer-events: none;
92- width: 32px;
93- height: 37px;
94- transition: all 0.15s linear;
95- background-image: linear-gradient(
96- to left,
97- rgba(255, 255, 255, 0),
98- rgba(255, 255, 255, 1)
99- );
100- z-index: 1;
101- }
102-
103- &::after {
104- content: '';
105- display: block;
106- opacity: 0;
107- position: absolute;
108- top: 0;
109- right: 0;
110- width: 32px;
111- height: 37px;
112- pointer-events: none;
113- transition: all 0.15s linear;
114- background-image: linear-gradient(
115- to right,
116- rgba(255, 255, 255, 0),
117- rgba(255, 255, 255, 1)
118- );
119- z-index: 1;
120- }
121-
122- &[data-is-left-fade]::before,
123- &[data-is-right-fade]::after {
124- opacity: 1;
125- }
126- ` ;
127-
12873const DirtyBadge = tasty ( {
12974 element : 'DirtyBadge' ,
13075 styles : {
@@ -266,7 +211,7 @@ export interface CubeFileTabsProps extends CubeFlexProps {
266211 onTabClick ?: ( string ) => void ;
267212 /** Handler that is called when the tab is closed. */
268213 onTabClose ?: ( string ) => void ;
269- /** Styles for the each tab pane */
214+ /** Styles for each tab pane */
270215 paneStyles ?: Styles ;
271216 /** Whether the tabs are closable */
272217 isClosable ?: boolean ;
@@ -407,11 +352,7 @@ export function FileTabs({
407352 }
408353
409354 return (
410- < StyledTabsContainerElement
411- data-is-left-fade = { leftFade || null }
412- data-is-right-fade = { rightFade || null }
413- { ...props }
414- >
355+ < TabsContainerElement { ...props } >
415356 < FileTabsContext . Provider
416357 value = { {
417358 addTab,
@@ -421,7 +362,11 @@ export function FileTabs({
421362 currentTab : activeKey ,
422363 } }
423364 >
424- < StyledTabsPanelElement ref = { tabsRef } >
365+ < TabsPanelElement
366+ ref = { tabsRef }
367+ data-is-left-fade = { leftFade || null }
368+ data-is-right-fade = { rightFade || null }
369+ >
425370 { tabs . map ( ( tab ) => {
426371 return (
427372 < Tab
@@ -436,7 +381,7 @@ export function FileTabs({
436381 </ Tab >
437382 ) ;
438383 } ) }
439- </ StyledTabsPanelElement >
384+ </ TabsPanelElement >
440385 < Flex
441386 flexGrow = { 1 }
442387 border = "top rgb(227, 227, 233)"
@@ -445,7 +390,7 @@ export function FileTabs({
445390 { children }
446391 </ Flex >
447392 </ FileTabsContext . Provider >
448- </ StyledTabsContainerElement >
393+ </ TabsContainerElement >
449394 ) ;
450395}
451396
@@ -481,7 +426,7 @@ FileTabs.TabPane = function FileTabPane(allProps: CubeFileTabProps) {
481426
482427 return (
483428 < Block
484- style = { { display : isCurrent ? 'block' : 'none' } }
429+ style = { { display : isCurrent ? 'block' : 'none' , maxWidth : '100%' } }
485430 flexGrow = { 1 }
486431 { ...props }
487432 >
0 commit comments