Skip to content

Commit b83122e

Browse files
authored
fix(FileTabs): limit the max width (#504)
1 parent 136cc92 commit b83122e

File tree

7 files changed

+50
-86
lines changed

7 files changed

+50
-86
lines changed

.changeset/angry-ways-switch.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@cube-dev/ui-kit': patch
3+
---
4+
5+
Add support for dark schema for Underlay.

.changeset/lazy-bees-repeat.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@cube-dev/ui-kit': patch
3+
---
4+
5+
Fix FileTabs Pane max size.

.changeset/nasty-drinks-roll.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@cube-dev/ui-kit': patch
3+
---
4+
5+
Fix typings for SearchInput to support onSubmit and onClear callbacks.

src/components/forms/SearchInput/SearchInput.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { forwardRef, useRef } from 'react';
2-
import { useSearchFieldState } from 'react-stately';
2+
import { SearchFieldProps, useSearchFieldState } from 'react-stately';
33
import { useSearchField } from 'react-aria';
44

55
import {
@@ -16,7 +16,9 @@ import {
1616
import { tasty } from '../../../tasty';
1717
import { CloseIcon, SearchIcon } from '../../../icons';
1818

19-
export interface CubeSearchInputProps extends CubeTextInputBaseProps {
19+
export interface CubeSearchInputProps
20+
extends CubeTextInputBaseProps,
21+
SearchFieldProps {
2022
/** Whether the search input is clearable using ESC keyboard button or clear button inside the input */
2123
isClearable?: boolean;
2224
}

src/components/organisms/FileTabs/FileTabs.tsx

+29-84
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ import {
66
useRef,
77
useState,
88
} from 'react';
9-
import styled from 'styled-components';
109

1110
import { Block } from '../../Block';
12-
import { Action, CubeActionProps } from '../../actions/Action';
11+
import { Action, Button, CubeActionProps } from '../../actions';
1312
import { Space } from '../../layout/Space';
1413
import { CubeFlexProps, Flex } from '../../layout/Flex';
1514
import { Styles, tasty } from '../../../tasty';
16-
import { Button } from '../../actions';
1715
import { useLayoutEffect } from '../../../utils/react';
1816
import { CloseIcon } from '../../../icons';
1917

@@ -39,39 +37,31 @@ const FileTabsContext = createContext<FileTabContextValue>({
3937
});
4038

4139
const 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-
7463
const 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-
12873
const 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
>

src/components/overlays/Modal/Underlay.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { TransitionState } from './types';
66

77
const UnderlayElement = tasty({
88
qa: 'Underlay',
9+
'data-type': 'primary',
910
styles: {
1011
position: 'fixed',
1112
top: 0,

src/tasty/styles/transition.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { parseStyle } from '../utils/styles';
22

33
const MAP = {
4+
fade: ['mask'],
45
move: ['transform'],
56
rotate: ['transform'],
67
scale: ['transform'],

0 commit comments

Comments
 (0)