@toptal/picasso-tabs 3.0.2-alpha-fx-null-revert-tabs-96315ad16.40 → 3.0.2-alpha-FX-NULL-fix-checkbox-class-b75438bf7.34
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-package/src/Tab/Tab.d.ts +3 -3
- package/dist-package/src/Tab/Tab.d.ts.map +1 -1
- package/dist-package/src/Tab/Tab.js +62 -14
- package/dist-package/src/Tab/Tab.js.map +1 -1
- package/dist-package/src/Tabs/Tabs.d.ts +11 -5
- package/dist-package/src/Tabs/Tabs.d.ts.map +1 -1
- package/dist-package/src/Tabs/Tabs.js +51 -16
- package/dist-package/src/Tabs/Tabs.js.map +1 -1
- package/dist-package/src/TabsCompound/index.d.ts +2 -2
- package/dist-package/src/index.d.ts +0 -1
- package/dist-package/src/index.d.ts.map +1 -1
- package/dist-package/src/index.js +0 -1
- package/dist-package/src/index.js.map +1 -1
- package/package.json +16 -16
- package/src/Tab/Tab.tsx +99 -21
- package/src/Tab/__snapshots__/test.tsx.snap +35 -50
- package/src/Tabs/Tabs.tsx +90 -34
- package/src/Tabs/__snapshots__/test.tsx.snap +61 -76
- package/src/Tabs/test.tsx +1 -1
- package/src/index.ts +0 -1
- package/dist-package/src/Tab/styles.d.ts +0 -4
- package/dist-package/src/Tab/styles.d.ts.map +0 -1
- package/dist-package/src/Tab/styles.js +0 -94
- package/dist-package/src/Tab/styles.js.map +0 -1
- package/dist-package/src/TabScrollButton/TabScrollButton.d.ts +0 -12
- package/dist-package/src/TabScrollButton/TabScrollButton.d.ts.map +0 -1
- package/dist-package/src/TabScrollButton/TabScrollButton.js +0 -40
- package/dist-package/src/TabScrollButton/TabScrollButton.js.map +0 -1
- package/dist-package/src/TabScrollButton/index.d.ts +0 -5
- package/dist-package/src/TabScrollButton/index.d.ts.map +0 -1
- package/dist-package/src/TabScrollButton/index.js +0 -2
- package/dist-package/src/TabScrollButton/index.js.map +0 -1
- package/dist-package/src/TabScrollButton/styles.d.ts +0 -4
- package/dist-package/src/TabScrollButton/styles.d.ts.map +0 -1
- package/dist-package/src/TabScrollButton/styles.js +0 -35
- package/dist-package/src/TabScrollButton/styles.js.map +0 -1
- package/dist-package/src/Tabs/styles.d.ts +0 -4
- package/dist-package/src/Tabs/styles.d.ts.map +0 -1
- package/dist-package/src/Tabs/styles.js +0 -41
- package/dist-package/src/Tabs/styles.js.map +0 -1
- package/dist-package/src/Tabs/use-tab-action.d.ts +0 -5
- package/dist-package/src/Tabs/use-tab-action.d.ts.map +0 -1
- package/dist-package/src/Tabs/use-tab-action.js +0 -21
- package/dist-package/src/Tabs/use-tab-action.js.map +0 -1
- package/src/Tab/styles.ts +0 -106
- package/src/TabScrollButton/TabScrollButton.tsx +0 -64
- package/src/TabScrollButton/index.ts +0 -6
- package/src/TabScrollButton/styles.ts +0 -37
- package/src/Tabs/styles.ts +0 -45
- package/src/Tabs/use-tab-action.ts +0 -27
@@ -1,41 +0,0 @@
|
|
1
|
-
import { createStyles } from '@material-ui/core/styles';
|
2
|
-
import { PicassoProvider } from '@toptal/picasso-provider';
|
3
|
-
PicassoProvider.override(({ palette }) => ({
|
4
|
-
MuiTabs: {
|
5
|
-
root: {
|
6
|
-
position: 'relative',
|
7
|
-
minHeight: 0,
|
8
|
-
},
|
9
|
-
vertical: {
|
10
|
-
width: 200,
|
11
|
-
margin: 0,
|
12
|
-
'& $scroller': {
|
13
|
-
// We need a bit of padding to allow active tab's shadow to be visible
|
14
|
-
paddingLeft: '0.5em',
|
15
|
-
},
|
16
|
-
'& $indicator': {
|
17
|
-
display: 'none',
|
18
|
-
},
|
19
|
-
},
|
20
|
-
indicator: {
|
21
|
-
backgroundColor: palette.blue.main,
|
22
|
-
zIndex: 1,
|
23
|
-
},
|
24
|
-
},
|
25
|
-
}));
|
26
|
-
export default ({ palette }) => createStyles({
|
27
|
-
horizontal: {
|
28
|
-
'&::after': {
|
29
|
-
position: 'absolute',
|
30
|
-
content: '""',
|
31
|
-
bottom: 0,
|
32
|
-
left: 0,
|
33
|
-
right: 0,
|
34
|
-
height: 1,
|
35
|
-
backgroundColor: palette.grey.main,
|
36
|
-
zIndex: 0,
|
37
|
-
},
|
38
|
-
},
|
39
|
-
vertical: {},
|
40
|
-
});
|
41
|
-
//# sourceMappingURL=styles.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/Tabs/styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE1D,eAAe,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAS,EAAE,EAAE,CAAC,CAAC;IAChD,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,QAAQ,EAAE,UAAU;YACpB,SAAS,EAAE,CAAC;SACb;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,CAAC;YACT,aAAa,EAAE;gBACb,sEAAsE;gBACtE,WAAW,EAAE,OAAO;aACrB;YAED,cAAc,EAAE;gBACd,OAAO,EAAE,MAAM;aAChB;SACF;QACD,SAAS,EAAE;YACT,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI;YAClC,MAAM,EAAE,CAAC;SACV;KACF;CACF,CAAC,CAAC,CAAA;AAEH,eAAe,CAAC,EAAE,OAAO,EAAS,EAAE,EAAE,CACpC,YAAY,CAAC;IACX,UAAU,EAAE;QACV,UAAU,EAAE;YACV,QAAQ,EAAE,UAAU;YACpB,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC;YACT,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI;YAClC,MAAM,EAAE,CAAC;SACV;KACF;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"use-tab-action.d.ts","sourceRoot":"","sources":["../../../src/Tabs/use-tab-action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAOpD,QAAA,MAAM,YAAY,QAAO,IAAI,WAAW,CAevC,CAAA;AAED,eAAe,YAAY,CAAA"}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
2
|
-
/*
|
3
|
-
* MuiTabs break when the size of a tab changes without rendering with React.
|
4
|
-
* This issue happens when the font is loaded after the initial render of the component.
|
5
|
-
* To solve this issue, we imperatively update the indicator and scroll buttons when it happens.
|
6
|
-
*/
|
7
|
-
const useTabAction = () => {
|
8
|
-
const ref = useRef(null);
|
9
|
-
useEffect(() => {
|
10
|
-
const listener = () => {
|
11
|
-
var _a, _b;
|
12
|
-
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.updateIndicator();
|
13
|
-
(_b = ref.current) === null || _b === void 0 ? void 0 : _b.updateScrollButtons();
|
14
|
-
};
|
15
|
-
window.addEventListener('load', listener);
|
16
|
-
return () => window.removeEventListener('load', listener);
|
17
|
-
}, []);
|
18
|
-
return ref;
|
19
|
-
};
|
20
|
-
export default useTabAction;
|
21
|
-
//# sourceMappingURL=use-tab-action.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"use-tab-action.js","sourceRoot":"","sources":["../../../src/Tabs/use-tab-action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAGzC;;;;GAIG;AACH,MAAM,YAAY,GAAG,GAAqB,EAAE;IAC1C,MAAM,GAAG,GAAG,MAAM,CAAc,IAAI,CAAC,CAAA;IAErC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAG,GAAG,EAAE;;YACpB,MAAA,GAAG,CAAC,OAAO,0CAAE,eAAe,EAAE,CAAA;YAC9B,MAAA,GAAG,CAAC,OAAO,0CAAE,mBAAmB,EAAE,CAAA;QACpC,CAAC,CAAA;QAED,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QAEzC,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAC3D,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,eAAe,YAAY,CAAA"}
|
package/src/Tab/styles.ts
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
import type { Theme } from '@material-ui/core/styles'
|
2
|
-
import { createStyles } from '@material-ui/core/styles'
|
3
|
-
import { rem } from '@toptal/picasso-shared'
|
4
|
-
import { PicassoProvider } from '@toptal/picasso-provider'
|
5
|
-
|
6
|
-
PicassoProvider.override(({ breakpoints, palette }: Theme) => ({
|
7
|
-
MuiTab: {
|
8
|
-
root: {
|
9
|
-
minHeight: 0,
|
10
|
-
minWidth: 0,
|
11
|
-
lineHeight: 1,
|
12
|
-
textTransform: 'none',
|
13
|
-
padding: `${rem('9px')} 0 ${rem('7px')}`,
|
14
|
-
overflow: 'initial',
|
15
|
-
|
16
|
-
[breakpoints.up('md')]: {
|
17
|
-
padding: undefined,
|
18
|
-
},
|
19
|
-
|
20
|
-
color: palette.grey.dark,
|
21
|
-
|
22
|
-
[breakpoints.up('md')]: {
|
23
|
-
minWidth: 'auto',
|
24
|
-
fontSize: '1rem',
|
25
|
-
},
|
26
|
-
},
|
27
|
-
labelIcon: {
|
28
|
-
minHeight: 0,
|
29
|
-
paddingRight: '1.5rem',
|
30
|
-
paddingTop: rem('9px'),
|
31
|
-
'& $wrapper > *:first-child': {
|
32
|
-
position: 'absolute',
|
33
|
-
right: 0,
|
34
|
-
marginBottom: 0,
|
35
|
-
},
|
36
|
-
},
|
37
|
-
selected: {
|
38
|
-
color: palette.common.black,
|
39
|
-
},
|
40
|
-
textColorInherit: {
|
41
|
-
'&$disabled': {
|
42
|
-
color: palette.grey.main,
|
43
|
-
},
|
44
|
-
},
|
45
|
-
disabled: {},
|
46
|
-
},
|
47
|
-
}))
|
48
|
-
|
49
|
-
export default ({ sizes, palette, shadows, transitions }: Theme) =>
|
50
|
-
createStyles({
|
51
|
-
horizontal: {
|
52
|
-
'&:not(:last-child)': {
|
53
|
-
marginRight: '2em',
|
54
|
-
},
|
55
|
-
},
|
56
|
-
vertical: {
|
57
|
-
width: '100%',
|
58
|
-
borderRadius: `${sizes.borderRadius.small} 0 0 ${sizes.borderRadius.small}`,
|
59
|
-
margin: '0.25rem 0',
|
60
|
-
overflow: 'hidden',
|
61
|
-
padding: '0.5rem 1rem',
|
62
|
-
transition: `all ${transitions.duration.short}ms ${transitions.easing.easeInOut}`,
|
63
|
-
textAlign: 'left',
|
64
|
-
backgroundColor: palette.grey.lighter,
|
65
|
-
opacity: 1,
|
66
|
-
color: palette.grey.dark,
|
67
|
-
|
68
|
-
'&:first-child': {
|
69
|
-
marginTop: '1rem',
|
70
|
-
},
|
71
|
-
|
72
|
-
'&:last-child': {
|
73
|
-
marginBottom: '1rem',
|
74
|
-
},
|
75
|
-
|
76
|
-
'&:hover': {
|
77
|
-
color: palette.common.black,
|
78
|
-
},
|
79
|
-
|
80
|
-
'&:hover:not($selected)': {
|
81
|
-
backgroundColor: palette.grey.lighter2,
|
82
|
-
},
|
83
|
-
|
84
|
-
'& $wrapper': {
|
85
|
-
display: 'block',
|
86
|
-
},
|
87
|
-
},
|
88
|
-
selected: {
|
89
|
-
'&$vertical': {
|
90
|
-
color: palette.common.black,
|
91
|
-
boxShadow: shadows[1],
|
92
|
-
backgroundColor: palette.grey.lightest,
|
93
|
-
|
94
|
-
'&::before': {
|
95
|
-
content: '""',
|
96
|
-
background: palette.blue.main,
|
97
|
-
position: 'absolute',
|
98
|
-
left: 0,
|
99
|
-
top: 0,
|
100
|
-
bottom: 0,
|
101
|
-
width: '3px',
|
102
|
-
},
|
103
|
-
},
|
104
|
-
},
|
105
|
-
wrapper: {},
|
106
|
-
})
|
@@ -1,64 +0,0 @@
|
|
1
|
-
import cx from 'classnames'
|
2
|
-
import React, { forwardRef } from 'react'
|
3
|
-
import { ButtonBase } from '@material-ui/core'
|
4
|
-
import { makeStyles } from '@material-ui/core/styles'
|
5
|
-
import type { BaseProps } from '@toptal/picasso-shared'
|
6
|
-
import { BackMinor16, ChevronMinor16 } from '@toptal/picasso-icons'
|
7
|
-
import { Container } from '@toptal/picasso-container'
|
8
|
-
|
9
|
-
import styles from './styles'
|
10
|
-
|
11
|
-
type DirectionType = 'left' | 'right'
|
12
|
-
|
13
|
-
export interface Props extends BaseProps {
|
14
|
-
/** The direction the button should indicate. */
|
15
|
-
direction: DirectionType
|
16
|
-
/** If `true`, the component is disabled. */
|
17
|
-
disabled?: boolean
|
18
|
-
}
|
19
|
-
|
20
|
-
const useStyles = makeStyles(styles, {
|
21
|
-
name: 'PicassoTabScrollButton',
|
22
|
-
})
|
23
|
-
|
24
|
-
export const TabScrollButton = forwardRef<HTMLDivElement, Props>(
|
25
|
-
function TabScrollButton(props, ref) {
|
26
|
-
const { className, style, direction, disabled, ...rest } = props
|
27
|
-
const classes = useStyles()
|
28
|
-
|
29
|
-
if (disabled) {
|
30
|
-
return null
|
31
|
-
}
|
32
|
-
|
33
|
-
return (
|
34
|
-
<Container
|
35
|
-
{...rest}
|
36
|
-
ref={ref}
|
37
|
-
className={cx(classes.root, className)}
|
38
|
-
style={style}
|
39
|
-
>
|
40
|
-
<Container
|
41
|
-
className={cx(classes.gradient, {
|
42
|
-
[classes.left]: direction === 'left',
|
43
|
-
[classes.right]: direction === 'right',
|
44
|
-
})}
|
45
|
-
>
|
46
|
-
<ButtonBase
|
47
|
-
className={cx(classes.button, {
|
48
|
-
[classes.left]: direction === 'left',
|
49
|
-
[classes.right]: direction === 'right',
|
50
|
-
})}
|
51
|
-
aria-label={`${direction} button`}
|
52
|
-
data-testid={`tab-scroll-button-${direction}`}
|
53
|
-
>
|
54
|
-
{direction === 'left' ? <BackMinor16 /> : <ChevronMinor16 />}
|
55
|
-
</ButtonBase>
|
56
|
-
</Container>
|
57
|
-
</Container>
|
58
|
-
)
|
59
|
-
}
|
60
|
-
)
|
61
|
-
|
62
|
-
TabScrollButton.displayName = 'TabScrollButton'
|
63
|
-
|
64
|
-
export default TabScrollButton
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import { createStyles } from '@material-ui/core'
|
2
|
-
import type { Theme } from '@material-ui/core/styles'
|
3
|
-
import { alpha } from '@toptal/picasso-shared'
|
4
|
-
|
5
|
-
export default ({ palette }: Theme) => {
|
6
|
-
const color = palette.common.white
|
7
|
-
const colorStops = `${color} 0%, ${color} 50%, ${alpha(color, 0)} 100%`
|
8
|
-
|
9
|
-
return createStyles({
|
10
|
-
root: {
|
11
|
-
position: 'relative',
|
12
|
-
},
|
13
|
-
gradient: {
|
14
|
-
position: 'absolute',
|
15
|
-
width: '2.5rem',
|
16
|
-
height: '100%',
|
17
|
-
zIndex: 2,
|
18
|
-
'&$left': {
|
19
|
-
background: `linear-gradient(90deg, ${colorStops})`,
|
20
|
-
},
|
21
|
-
'&$right': {
|
22
|
-
background: `linear-gradient(270deg, ${colorStops})`,
|
23
|
-
},
|
24
|
-
},
|
25
|
-
button: {
|
26
|
-
position: 'absolute',
|
27
|
-
width: '1rem',
|
28
|
-
height: '100%',
|
29
|
-
},
|
30
|
-
left: {
|
31
|
-
left: 0,
|
32
|
-
},
|
33
|
-
right: {
|
34
|
-
right: 0,
|
35
|
-
},
|
36
|
-
})
|
37
|
-
}
|
package/src/Tabs/styles.ts
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
import type { Theme } from '@material-ui/core/styles'
|
2
|
-
import { createStyles } from '@material-ui/core/styles'
|
3
|
-
import { PicassoProvider } from '@toptal/picasso-provider'
|
4
|
-
|
5
|
-
PicassoProvider.override(({ palette }: Theme) => ({
|
6
|
-
MuiTabs: {
|
7
|
-
root: {
|
8
|
-
position: 'relative',
|
9
|
-
minHeight: 0,
|
10
|
-
},
|
11
|
-
vertical: {
|
12
|
-
width: 200,
|
13
|
-
margin: 0,
|
14
|
-
'& $scroller': {
|
15
|
-
// We need a bit of padding to allow active tab's shadow to be visible
|
16
|
-
paddingLeft: '0.5em',
|
17
|
-
},
|
18
|
-
|
19
|
-
'& $indicator': {
|
20
|
-
display: 'none',
|
21
|
-
},
|
22
|
-
},
|
23
|
-
indicator: {
|
24
|
-
backgroundColor: palette.blue.main,
|
25
|
-
zIndex: 1,
|
26
|
-
},
|
27
|
-
},
|
28
|
-
}))
|
29
|
-
|
30
|
-
export default ({ palette }: Theme) =>
|
31
|
-
createStyles({
|
32
|
-
horizontal: {
|
33
|
-
'&::after': {
|
34
|
-
position: 'absolute',
|
35
|
-
content: '""',
|
36
|
-
bottom: 0,
|
37
|
-
left: 0,
|
38
|
-
right: 0,
|
39
|
-
height: 1,
|
40
|
-
backgroundColor: palette.grey.main,
|
41
|
-
zIndex: 0,
|
42
|
-
},
|
43
|
-
},
|
44
|
-
vertical: {},
|
45
|
-
})
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import type { Ref } from 'react'
|
2
|
-
import { useEffect, useRef } from 'react'
|
3
|
-
import type { TabsActions } from '@material-ui/core'
|
4
|
-
|
5
|
-
/*
|
6
|
-
* MuiTabs break when the size of a tab changes without rendering with React.
|
7
|
-
* This issue happens when the font is loaded after the initial render of the component.
|
8
|
-
* To solve this issue, we imperatively update the indicator and scroll buttons when it happens.
|
9
|
-
*/
|
10
|
-
const useTabAction = (): Ref<TabsActions> => {
|
11
|
-
const ref = useRef<TabsActions>(null)
|
12
|
-
|
13
|
-
useEffect(() => {
|
14
|
-
const listener = () => {
|
15
|
-
ref.current?.updateIndicator()
|
16
|
-
ref.current?.updateScrollButtons()
|
17
|
-
}
|
18
|
-
|
19
|
-
window.addEventListener('load', listener)
|
20
|
-
|
21
|
-
return () => window.removeEventListener('load', listener)
|
22
|
-
}, [])
|
23
|
-
|
24
|
-
return ref
|
25
|
-
}
|
26
|
-
|
27
|
-
export default useTabAction
|