@toptal/picasso-tabs 2.0.9-alpha-cjs-and-esm-publish-test-99555d2ed.1 → 3.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/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/TabLabel/TabLabel.d.ts.map +1 -1
- package/dist-package/src/TabLabel/TabLabel.js +2 -3
- package/dist-package/src/TabLabel/TabLabel.js.map +1 -1
- package/dist-package/src/Tabs/Tabs.d.ts +19 -10
- package/dist-package/src/Tabs/Tabs.d.ts.map +1 -1
- package/dist-package/src/Tabs/Tabs.js +51 -21
- package/dist-package/src/Tabs/Tabs.js.map +1 -1
- package/dist-package/src/Tabs/index.d.ts +3 -2
- package/dist-package/src/Tabs/index.d.ts.map +1 -1
- package/dist-package/src/TabsCompound/index.d.ts +4 -2
- package/dist-package/src/TabsCompound/index.d.ts.map +1 -1
- 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 +100 -21
- package/src/Tab/__snapshots__/test.tsx.snap +91 -37
- package/src/Tab/story/CustomValue.example.tsx +2 -2
- package/src/Tab/test.tsx +9 -1
- package/src/TabLabel/TabLabel.tsx +10 -4
- package/src/Tabs/Tabs.tsx +114 -61
- package/src/Tabs/__snapshots__/test.tsx.snap +61 -76
- package/src/Tabs/index.ts +3 -2
- package/src/Tabs/story/Default.example.tsx +1 -1
- package/src/Tabs/story/FullWidth.example.tsx +1 -1
- package/src/Tabs/story/ScrollButtons.example.tsx +1 -1
- package/src/Tabs/story/Vertical.example.tsx +1 -1
- package/src/Tabs/test.tsx +11 -8
- package/src/index.ts +1 -2
- package/LICENSE +0 -20
- 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,40 +0,0 @@
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
-
var t = {};
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
-
t[p] = s[p];
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
-
t[p[i]] = s[p[i]];
|
9
|
-
}
|
10
|
-
return t;
|
11
|
-
};
|
12
|
-
import cx from 'classnames';
|
13
|
-
import React, { forwardRef } from 'react';
|
14
|
-
import { ButtonBase } from '@material-ui/core';
|
15
|
-
import { makeStyles } from '@material-ui/core/styles';
|
16
|
-
import { BackMinor16, ChevronMinor16 } from '@toptal/picasso-icons';
|
17
|
-
import { Container } from '@toptal/picasso-container';
|
18
|
-
import styles from './styles';
|
19
|
-
const useStyles = makeStyles(styles, {
|
20
|
-
name: 'PicassoTabScrollButton',
|
21
|
-
});
|
22
|
-
export const TabScrollButton = forwardRef(function TabScrollButton(props, ref) {
|
23
|
-
const { className, style, direction, disabled } = props, rest = __rest(props, ["className", "style", "direction", "disabled"]);
|
24
|
-
const classes = useStyles();
|
25
|
-
if (disabled) {
|
26
|
-
return null;
|
27
|
-
}
|
28
|
-
return (React.createElement(Container, Object.assign({}, rest, { ref: ref, className: cx(classes.root, className), style: style }),
|
29
|
-
React.createElement(Container, { className: cx(classes.gradient, {
|
30
|
-
[classes.left]: direction === 'left',
|
31
|
-
[classes.right]: direction === 'right',
|
32
|
-
}) },
|
33
|
-
React.createElement(ButtonBase, { className: cx(classes.button, {
|
34
|
-
[classes.left]: direction === 'left',
|
35
|
-
[classes.right]: direction === 'right',
|
36
|
-
}), "aria-label": `${direction} button`, "data-testid": `tab-scroll-button-${direction}` }, direction === 'left' ? React.createElement(BackMinor16, null) : React.createElement(ChevronMinor16, null)))));
|
37
|
-
});
|
38
|
-
TabScrollButton.displayName = 'TabScrollButton';
|
39
|
-
export default TabScrollButton;
|
40
|
-
//# sourceMappingURL=TabScrollButton.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"TabScrollButton.js","sourceRoot":"","sources":["../../../src/TabScrollButton/TabScrollButton.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAErD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,MAAM,MAAM,UAAU,CAAA;AAW7B,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,EAAE;IACnC,IAAI,EAAE,wBAAwB;CAC/B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CACvC,SAAS,eAAe,CAAC,KAAK,EAAE,GAAG;IACjC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAA1D,+CAAkD,CAAQ,CAAA;IAChE,MAAM,OAAO,GAAG,SAAS,EAAE,CAAA;IAE3B,IAAI,QAAQ,EAAE;QACZ,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,CACL,oBAAC,SAAS,oBACJ,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,EACtC,KAAK,EAAE,KAAK;QAEZ,oBAAC,SAAS,IACR,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE;gBAC9B,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM;gBACpC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,SAAS,KAAK,OAAO;aACvC,CAAC;YAEF,oBAAC,UAAU,IACT,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE;oBAC5B,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM;oBACpC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,SAAS,KAAK,OAAO;iBACvC,CAAC,gBACU,GAAG,SAAS,SAAS,iBACpB,qBAAqB,SAAS,EAAE,IAE5C,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,oBAAC,WAAW,OAAG,CAAC,CAAC,CAAC,oBAAC,cAAc,OAAG,CACjD,CACH,CACF,CACb,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAA;AAE/C,eAAe,eAAe,CAAA"}
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import type { OmitInternalProps } from '@toptal/picasso-shared';
|
2
|
-
import type { Props } from './TabScrollButton';
|
3
|
-
export { default as TabScrollButton } from './TabScrollButton';
|
4
|
-
export declare type TabScrollButtonProps = OmitInternalProps<Props>;
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/TabScrollButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAC9D,oBAAY,oBAAoB,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/TabScrollButton/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/TabScrollButton/styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;sCAGxB,KAAK;AAAlC,wBAgCC"}
|
@@ -1,35 +0,0 @@
|
|
1
|
-
import { createStyles } from '@material-ui/core';
|
2
|
-
import { alpha } from '@toptal/picasso-shared';
|
3
|
-
export default ({ palette }) => {
|
4
|
-
const color = palette.common.white;
|
5
|
-
const colorStops = `${color} 0%, ${color} 50%, ${alpha(color, 0)} 100%`;
|
6
|
-
return createStyles({
|
7
|
-
root: {
|
8
|
-
position: 'relative',
|
9
|
-
},
|
10
|
-
gradient: {
|
11
|
-
position: 'absolute',
|
12
|
-
width: '2.5rem',
|
13
|
-
height: '100%',
|
14
|
-
zIndex: 2,
|
15
|
-
'&$left': {
|
16
|
-
background: `linear-gradient(90deg, ${colorStops})`,
|
17
|
-
},
|
18
|
-
'&$right': {
|
19
|
-
background: `linear-gradient(270deg, ${colorStops})`,
|
20
|
-
},
|
21
|
-
},
|
22
|
-
button: {
|
23
|
-
position: 'absolute',
|
24
|
-
width: '1rem',
|
25
|
-
height: '100%',
|
26
|
-
},
|
27
|
-
left: {
|
28
|
-
left: 0,
|
29
|
-
},
|
30
|
-
right: {
|
31
|
-
right: 0,
|
32
|
-
},
|
33
|
-
});
|
34
|
-
};
|
35
|
-
//# sourceMappingURL=styles.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/TabScrollButton/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE9C,eAAe,CAAC,EAAE,OAAO,EAAS,EAAE,EAAE;IACpC,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAA;IAClC,MAAM,UAAU,GAAG,GAAG,KAAK,QAAQ,KAAK,SAAS,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAA;IAEvE,OAAO,YAAY,CAAC;QAClB,IAAI,EAAE;YACJ,QAAQ,EAAE,UAAU;SACrB;QACD,QAAQ,EAAE;YACR,QAAQ,EAAE,UAAU;YACpB,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,CAAC;YACT,QAAQ,EAAE;gBACR,UAAU,EAAE,0BAA0B,UAAU,GAAG;aACpD;YACD,SAAS,EAAE;gBACT,UAAU,EAAE,2BAA2B,UAAU,GAAG;aACrD;SACF;QACD,MAAM,EAAE;YACN,QAAQ,EAAE,UAAU;YACpB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;SACf;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,CAAC;SACR;QACD,KAAK,EAAE;YACL,KAAK,EAAE,CAAC;SACT;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/Tabs/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;sCA6BxB,KAAK;AAAlC,wBAeI"}
|
@@ -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
|