@toptal/picasso-tabs 5.0.15-alpha-ff-7-tabs-17eb872bb.13 → 5.0.15-alpha-bill-root-ref-context-42c3d2541.6

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.
Files changed (57) hide show
  1. package/dist-package/src/Tab/Tab.d.ts +8 -5
  2. package/dist-package/src/Tab/Tab.d.ts.map +1 -1
  3. package/dist-package/src/Tab/Tab.js +16 -61
  4. package/dist-package/src/Tab/Tab.js.map +1 -1
  5. package/dist-package/src/Tab/styles.d.ts +4 -0
  6. package/dist-package/src/Tab/styles.d.ts.map +1 -0
  7. package/dist-package/src/Tab/styles.js +95 -0
  8. package/dist-package/src/Tab/styles.js.map +1 -0
  9. package/dist-package/src/TabScrollButton/TabScrollButton.d.ts +12 -0
  10. package/dist-package/src/TabScrollButton/TabScrollButton.d.ts.map +1 -0
  11. package/dist-package/src/TabScrollButton/TabScrollButton.js +30 -0
  12. package/dist-package/src/TabScrollButton/TabScrollButton.js.map +1 -0
  13. package/dist-package/src/TabScrollButton/index.d.ts +5 -0
  14. package/dist-package/src/TabScrollButton/index.d.ts.map +1 -0
  15. package/dist-package/src/TabScrollButton/index.js +2 -0
  16. package/dist-package/src/TabScrollButton/index.js.map +1 -0
  17. package/dist-package/src/Tabs/Tabs.d.ts +9 -12
  18. package/dist-package/src/Tabs/Tabs.d.ts.map +1 -1
  19. package/dist-package/src/Tabs/Tabs.js +16 -68
  20. package/dist-package/src/Tabs/Tabs.js.map +1 -1
  21. package/dist-package/src/Tabs/index.d.ts +2 -3
  22. package/dist-package/src/Tabs/index.d.ts.map +1 -1
  23. package/dist-package/src/Tabs/index.js.map +1 -1
  24. package/dist-package/src/Tabs/styles.d.ts +4 -0
  25. package/dist-package/src/Tabs/styles.d.ts.map +1 -0
  26. package/dist-package/src/Tabs/styles.js +41 -0
  27. package/dist-package/src/Tabs/styles.js.map +1 -0
  28. package/dist-package/src/Tabs/use-tab-action.d.ts +5 -0
  29. package/dist-package/src/Tabs/use-tab-action.d.ts.map +1 -0
  30. package/dist-package/src/Tabs/use-tab-action.js +21 -0
  31. package/dist-package/src/Tabs/use-tab-action.js.map +1 -0
  32. package/dist-package/src/TabsCompound/index.d.ts +4 -2
  33. package/dist-package/src/TabsCompound/index.d.ts.map +1 -1
  34. package/dist-package/src/index.d.ts +1 -0
  35. package/dist-package/src/index.d.ts.map +1 -1
  36. package/dist-package/src/index.js +1 -0
  37. package/dist-package/src/index.js.map +1 -1
  38. package/package.json +13 -13
  39. package/src/Tab/Tab.tsx +51 -121
  40. package/src/Tab/__snapshots__/test.tsx.snap +45 -29
  41. package/src/Tab/story/IconOrBadge.example.tsx +3 -8
  42. package/src/Tab/styles.ts +107 -0
  43. package/src/TabScrollButton/TabScrollButton.tsx +59 -0
  44. package/src/TabScrollButton/index.ts +6 -0
  45. package/src/Tabs/Tabs.tsx +42 -125
  46. package/src/Tabs/__snapshots__/test.tsx.snap +76 -45
  47. package/src/Tabs/index.ts +2 -3
  48. package/src/Tabs/story/Default.example.tsx +2 -4
  49. package/src/Tabs/styles.ts +45 -0
  50. package/src/Tabs/test.tsx +4 -4
  51. package/src/Tabs/use-tab-action.ts +27 -0
  52. package/src/index.ts +1 -0
  53. package/dist-package/src/Tabs/TabsContext.d.ts +0 -11
  54. package/dist-package/src/Tabs/TabsContext.d.ts.map +0 -1
  55. package/dist-package/src/Tabs/TabsContext.js +0 -15
  56. package/dist-package/src/Tabs/TabsContext.js.map +0 -1
  57. package/src/Tabs/TabsContext.tsx +0 -27
@@ -0,0 +1,59 @@
1
+ import React, { forwardRef } from 'react'
2
+ import { ButtonBase } from '@material-ui/core'
3
+ import type { BaseProps } from '@toptal/picasso-shared'
4
+ import { BackMinor16, ChevronMinor16 } from '@toptal/picasso-icons'
5
+ import { Container } from '@toptal/picasso-container'
6
+ import { twMerge } from '@toptal/picasso-tailwind-merge'
7
+
8
+ type DirectionType = 'left' | 'right'
9
+
10
+ export interface Props extends BaseProps {
11
+ /** The direction the button should indicate. */
12
+ direction: DirectionType
13
+ /** If `true`, the component is disabled. */
14
+ disabled?: boolean
15
+ }
16
+
17
+ export const TabScrollButton = forwardRef<HTMLDivElement, Props>(
18
+ function TabScrollButton(props, ref) {
19
+ const { className, style, direction, disabled, ...rest } = props
20
+
21
+ if (disabled) {
22
+ return null
23
+ }
24
+
25
+ return (
26
+ <Container
27
+ {...rest}
28
+ ref={ref}
29
+ className={twMerge('relative', className)}
30
+ style={style}
31
+ >
32
+ <Container
33
+ className={twMerge(
34
+ 'absolute w-10 h-full z-10',
35
+ direction === 'left'
36
+ ? 'bg-gradient-to-r from-white via-white to-transparent'
37
+ : 'bg-gradient-to-l from-white via-white to-transparent',
38
+ direction === 'left' ? 'left-0' : 'right-0'
39
+ )}
40
+ >
41
+ <ButtonBase
42
+ className={twMerge(
43
+ 'absolute w-4 h-full',
44
+ direction === 'left' ? 'left-0' : 'right-0'
45
+ )}
46
+ aria-label={`${direction} button`}
47
+ data-testid={`tab-scroll-button-${direction}`}
48
+ >
49
+ {direction === 'left' ? <BackMinor16 /> : <ChevronMinor16 />}
50
+ </ButtonBase>
51
+ </Container>
52
+ </Container>
53
+ )
54
+ }
55
+ )
56
+
57
+ TabScrollButton.displayName = 'TabScrollButton'
58
+
59
+ export default TabScrollButton
@@ -0,0 +1,6 @@
1
+ import type { OmitInternalProps } from '@toptal/picasso-shared'
2
+
3
+ import type { Props } from './TabScrollButton'
4
+
5
+ export { default as TabScrollButton } from './TabScrollButton'
6
+ export type TabScrollButtonProps = OmitInternalProps<Props>
package/src/Tabs/Tabs.tsx CHANGED
@@ -1,21 +1,24 @@
1
- import type { ReactNode, ChangeEvent } from 'react'
2
- import React, { forwardRef, useMemo, useCallback } from 'react'
1
+ import type { ForwardedRef, ReactNode } from 'react'
2
+ import React, { forwardRef } from 'react'
3
+ import type { Theme } from '@material-ui/core/styles'
4
+ import { makeStyles } from '@material-ui/core/styles'
5
+ import { Tabs as MUITabs } from '@material-ui/core'
3
6
  import type { BaseProps } from '@toptal/picasso-shared'
4
- import { twJoin, twMerge } from '@toptal/picasso-tailwind-merge'
5
7
 
6
- import { TabsContext, type TabsValueType } from './TabsContext'
8
+ import { TabScrollButton } from '../TabScrollButton'
9
+ import styles from './styles'
10
+ import useTabAction from './use-tab-action'
11
+
12
+ export type TabsValueType = string | number | false
7
13
 
8
14
  export interface Props<V extends TabsValueType> extends BaseProps {
9
15
  /** Tabs content containing Tab components */
10
16
  children: ReactNode
11
17
 
12
18
  /** Callback fired when the value changes. */
13
- onChange?: (event: ChangeEvent<{}>, value: V) => void
19
+ onChange?: (event: React.ChangeEvent<{}> | null, value: V) => void
14
20
 
15
- /**
16
- * The value of the currently selected Tab.
17
- * If you don't want any selected Tab, you can set this property to null.
18
- */
21
+ /** The value of the currently selected Tab. If you don't want any selected Tab, you can set this property to false. */
19
22
  value: V
20
23
 
21
24
  /** The tabs orientation (layout flow direction). */
@@ -23,140 +26,54 @@ export interface Props<V extends TabsValueType> extends BaseProps {
23
26
 
24
27
  /** Determines additional display behavior of the tabs */
25
28
  variant?: 'scrollable' | 'fullWidth'
26
-
27
- /** The default value. Use when the component is not controlled. */
28
- defaultValue?: V
29
-
30
- /** The direction of the text. */
31
- direction?: 'ltr' | 'rtl'
32
29
  }
33
30
 
34
- const indicatorClasses = [
35
- 'after:absolute',
36
- 'after:content-[""]',
37
- 'after:bottom-0',
38
- 'after:left-0',
39
- 'after:right-0',
40
- 'after:h-[1px]',
41
- 'after:bg-gray-500',
42
- 'after:z-0',
43
- ]
44
-
45
- const classesByOrientation = {
46
- vertical: {
47
- root: 'w-[200px] m-0 flex-col',
48
- scroller: 'pl-2',
49
- },
50
- horizontal: {
51
- root: '',
52
- scroller: indicatorClasses,
53
- },
54
- }
31
+ const useStyles = makeStyles<Theme>(styles, {
32
+ name: 'Tabs',
33
+ })
55
34
 
56
- const classesByVariant = {
57
- scrollable: {
58
- root: 'overflow-x-auto',
59
- scroller: '',
60
- },
61
- fullWidth: {
62
- root: '',
63
- scroller: 'w-full overflow-hidden',
64
- },
65
- }
35
+ export const TabsOrientationContext = React.createContext<
36
+ 'horizontal' | 'vertical'
37
+ >('horizontal')
66
38
 
67
- export const Tabs = forwardRef<HTMLDivElement, Props<TabsValueType>>(
68
- function Tabs(props, ref) {
39
+ export const Tabs = forwardRef(
40
+ <V extends TabsValueType = TabsValueType>(
41
+ props: Props<V>,
42
+ ref: ForwardedRef<HTMLButtonElement>
43
+ ) => {
69
44
  const {
70
45
  children,
71
46
  orientation = 'horizontal',
72
47
  onChange,
73
- value: valueProp,
74
- defaultValue,
48
+ value,
75
49
  variant = 'scrollable',
76
- direction = 'ltr',
77
- className,
78
50
  ...rest
79
51
  } = props
80
-
81
- const [value, setValue] = React.useState<TabsValueType>(
82
- defaultValue ?? null
83
- )
84
- const isControlled = valueProp !== undefined
85
- const currentValue = isControlled ? valueProp : value
86
-
87
- const handleChange = useCallback(
88
- (event: ChangeEvent<{}>, newValue: TabsValueType) => {
89
- if (!isControlled) {
90
- setValue(newValue)
91
- }
92
- onChange?.(event, newValue as TabsValueType)
93
- },
94
- [isControlled, onChange]
95
- )
96
-
97
- const contextValue = useMemo(
98
- () => ({
99
- value: currentValue,
100
- onChange: handleChange,
101
- orientation,
102
- variant,
103
- direction,
104
- }),
105
- [currentValue, handleChange, orientation, variant, direction]
106
- )
107
-
108
- const isVertical = orientation === 'vertical'
109
-
110
- const childrenWithIndex = React.Children.map(children, (child, idx) => {
111
- if (
112
- React.isValidElement(child) &&
113
- // @ts-expect-error: type check for Picasso Tab
114
- (child.type.displayName === 'Tab' || child.type.name === 'Tab') &&
115
- child.props.value === undefined
116
- ) {
117
- return React.cloneElement(child as React.ReactElement<any>, {
118
- value: idx,
119
- })
120
- }
121
-
122
- return child
123
- })
52
+ const classes = useStyles(props)
53
+ const action = useTabAction()
124
54
 
125
55
  return (
126
- <TabsContext.Provider value={contextValue}>
127
- <div
56
+ <TabsOrientationContext.Provider value={orientation}>
57
+ <MUITabs
128
58
  {...rest}
59
+ classes={{ root: classes[orientation] }}
129
60
  ref={ref}
61
+ onChange={onChange}
62
+ value={value}
63
+ action={action}
64
+ scrollButtons='auto'
65
+ ScrollButtonComponent={TabScrollButton}
66
+ orientation={orientation}
67
+ variant={variant}
130
68
  data-component-type='tabs'
131
- className={twMerge(
132
- 'relative min-h-0 flex overflow-hidden',
133
- classesByOrientation[orientation].root,
134
- classesByVariant[variant].root,
135
- className
136
- )}
137
- aria-orientation={orientation}
138
69
  >
139
- <div
140
- className={twJoin(
141
- classesByVariant[variant].scroller,
142
- classesByOrientation[orientation].scroller,
143
- 'flex-auto inline-block relative whitespace-nowrap'
144
- )}
145
- >
146
- <div
147
- className={twJoin('flex', isVertical && 'flex-col')}
148
- role='tablist'
149
- tabIndex={-1}
150
- >
151
- {childrenWithIndex}
152
- </div>
153
- </div>
154
- </div>
155
- </TabsContext.Provider>
70
+ {children}
71
+ </MUITabs>
72
+ </TabsOrientationContext.Provider>
156
73
  )
157
74
  }
158
- )
159
-
160
- Tabs.displayName = 'Tabs'
75
+ ) as <V extends TabsValueType = TabsValueType>(
76
+ props: Props<V> & { ref?: ForwardedRef<HTMLDivElement> }
77
+ ) => ReturnType<typeof MUITabs>
161
78
 
162
79
  export default Tabs
@@ -6,28 +6,31 @@ exports[`Tabs renders 1`] = `
6
6
  class="Picasso-root"
7
7
  >
8
8
  <div
9
- aria-orientation="horizontal"
10
- class="relative min-h flex overflow-hidden overflow-x"
9
+ class="MuiTabs-root Tabs-horizontal"
11
10
  data-component-type="tabs"
12
11
  >
13
12
  <div
14
- class="after:absolute after:content-[""] after:bottom-0 after:left-0 after:right-0 after:h-[1px] after:bg-gray after:z-0 flex-auto inline-block relative whitespace-nowrap"
13
+ class="MuiTabs-scrollable"
14
+ style="width: 99px; height: 99px; position: absolute; top: -9999px; overflow: scroll;"
15
+ />
16
+ <div
17
+ class="MuiTabs-scroller MuiTabs-scrollable"
18
+ style="margin-bottom: 0px;"
15
19
  >
16
20
  <div
17
- class="flex"
21
+ class="MuiTabs-flexContainer"
18
22
  role="tablist"
19
- tabindex="-1"
20
23
  >
21
24
  <button
22
25
  aria-selected="false"
23
- class="opacity-70 m-0 [&:not(:last-child)]:mr-8 pt-0 pb-[0.4375rem] px-0 text-center bg-transparent transition-shadow z-10 rounded-none text-black shrink-0 max-w min-w sm:min-w md:min-w border-0 cursor-pointer inline-flex outline-none items-center select-none align-middle appearance-none justify-center no-underline [-webkit-tap-highlight normal-case whitespace-normal leading-4 relative"
26
+ class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit"
24
27
  data-testid="tab-1"
25
28
  role="tab"
26
29
  tabindex="0"
27
30
  type="button"
28
31
  >
29
32
  <span
30
- class="w-full inline-flex flex-row items-center justify-center"
33
+ class="MuiTab-wrapper PicassoTab-wrapper"
31
34
  >
32
35
  <div
33
36
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -38,14 +41,14 @@ exports[`Tabs renders 1`] = `
38
41
  </button>
39
42
  <button
40
43
  aria-selected="false"
41
- class="opacity-70 m-0 [&:not(:last-child)]:mr-8 pt-0 pb-[0.4375rem] px-0 text-center bg-transparent transition-shadow z-10 rounded-none text-black shrink-0 max-w min-w sm:min-w md:min-w border-0 cursor-pointer inline-flex outline-none items-center select-none align-middle appearance-none justify-center no-underline [-webkit-tap-highlight normal-case whitespace-normal leading-4 relative"
44
+ class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit"
42
45
  data-testid="tab-2"
43
46
  role="tab"
44
47
  tabindex="0"
45
48
  type="button"
46
49
  >
47
50
  <span
48
- class="w-full inline-flex flex-row items-center justify-center"
51
+ class="MuiTab-wrapper PicassoTab-wrapper"
49
52
  >
50
53
  <div
51
54
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -55,6 +58,10 @@ exports[`Tabs renders 1`] = `
55
58
  </span>
56
59
  </button>
57
60
  </div>
61
+ <span
62
+ class="PrivateTabIndicator-root PrivateTabIndicator-colorSecondary MuiTabs-indicator"
63
+ style="left: 0px; width: 0px;"
64
+ />
58
65
  </div>
59
66
  </div>
60
67
  </div>
@@ -67,28 +74,27 @@ exports[`Tabs renders in full width 1`] = `
67
74
  class="Picasso-root"
68
75
  >
69
76
  <div
70
- aria-orientation="horizontal"
71
- class="relative min-h flex overflow-hidden"
77
+ class="MuiTabs-root Tabs-horizontal"
72
78
  data-component-type="tabs"
73
79
  >
74
80
  <div
75
- class="w-full overflow-hidden after:absolute after:content-[""] after:bottom-0 after:left-0 after:right-0 after:h-[1px] after:bg-gray after:z-0 flex-auto inline-block relative whitespace-nowrap"
81
+ class="MuiTabs-scroller MuiTabs-fixed"
82
+ style="overflow: hidden;"
76
83
  >
77
84
  <div
78
- class="flex"
85
+ class="MuiTabs-flexContainer"
79
86
  role="tablist"
80
- tabindex="-1"
81
87
  >
82
88
  <button
83
89
  aria-selected="false"
84
- class="opacity-70 m-0 [&:not(:last-child)]:mr-8 pt-0 pb-[0.4375rem] px-0 text-center bg-transparent transition-shadow z-10 rounded-none text-black shrink flex-grow basis-0 min-w sm:min-w md:min-w border-0 cursor-pointer inline-flex outline-none items-center select-none align-middle appearance-none justify-center no-underline [-webkit-tap-highlight normal-case whitespace-normal leading-4 relative"
90
+ class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit MuiTab-fullWidth"
85
91
  data-testid="tab-1"
86
92
  role="tab"
87
93
  tabindex="0"
88
94
  type="button"
89
95
  >
90
96
  <span
91
- class="w-full inline-flex flex-row items-center justify-center"
97
+ class="MuiTab-wrapper PicassoTab-wrapper"
92
98
  >
93
99
  <div
94
100
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -99,14 +105,14 @@ exports[`Tabs renders in full width 1`] = `
99
105
  </button>
100
106
  <button
101
107
  aria-selected="false"
102
- class="opacity-70 m-0 [&:not(:last-child)]:mr-8 pt-0 pb-[0.4375rem] px-0 text-center bg-transparent transition-shadow z-10 rounded-none text-black shrink flex-grow basis-0 min-w sm:min-w md:min-w border-0 cursor-pointer inline-flex outline-none items-center select-none align-middle appearance-none justify-center no-underline [-webkit-tap-highlight normal-case whitespace-normal leading-4 relative"
108
+ class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit MuiTab-fullWidth"
103
109
  data-testid="tab-2"
104
110
  role="tab"
105
111
  tabindex="0"
106
112
  type="button"
107
113
  >
108
114
  <span
109
- class="w-full inline-flex flex-row items-center justify-center"
115
+ class="MuiTab-wrapper PicassoTab-wrapper"
110
116
  >
111
117
  <div
112
118
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -116,6 +122,10 @@ exports[`Tabs renders in full width 1`] = `
116
122
  </span>
117
123
  </button>
118
124
  </div>
125
+ <span
126
+ class="PrivateTabIndicator-root PrivateTabIndicator-colorSecondary MuiTabs-indicator"
127
+ style="left: 0px; width: 0px;"
128
+ />
119
129
  </div>
120
130
  </div>
121
131
  </div>
@@ -128,28 +138,31 @@ exports[`Tabs renders in vertical orientation 1`] = `
128
138
  class="Picasso-root"
129
139
  >
130
140
  <div
131
- aria-orientation="vertical"
132
- class="relative min-h flex overflow-hidden w-[200px] m-0 flex-col overflow-x"
141
+ class="MuiTabs-root Tabs-vertical MuiTabs-vertical"
133
142
  data-component-type="tabs"
134
143
  >
135
144
  <div
136
- class="pl-2 flex-auto inline-block relative whitespace-nowrap"
145
+ class="MuiTabs-scrollable"
146
+ style="width: 99px; height: 99px; position: absolute; top: -9999px; overflow: scroll;"
147
+ />
148
+ <div
149
+ class="MuiTabs-scroller MuiTabs-scrollable"
150
+ style="margin-bottom: 0px;"
137
151
  >
138
152
  <div
139
- class="flex flex-col"
153
+ class="MuiTabs-flexContainer MuiTabs-flexContainerVertical"
140
154
  role="tablist"
141
- tabindex="-1"
142
155
  >
143
156
  <button
144
157
  aria-selected="false"
145
- class="opacity-100 first:mt-4 last:mb-4 my-1 mx-0 py-2 px-4 text-left rounded-l rounded-r transition-all w-full overflow-hidden bg-gray hover:bg-gray text-graphite hover:text-black shrink-0 max-w min-w sm:min-w md:min-w border-0 cursor-pointer inline-flex outline-none items-center select-none align-middle appearance-none justify-center no-underline [-webkit-tap-highlight normal-case whitespace-normal leading-4 relative"
158
+ class="MuiButtonBase-root MuiTab-root PicassoTab-vertical MuiTab-textColorInherit"
146
159
  data-testid="tab-1"
147
160
  role="tab"
148
161
  tabindex="0"
149
162
  type="button"
150
163
  >
151
164
  <span
152
- class="w-full block"
165
+ class="MuiTab-wrapper PicassoTab-wrapper"
153
166
  >
154
167
  <div
155
168
  class="m-0 text-md text-inherit font-semibold whitespace-nowrap overflow-ellipsis [-webkit-box overflow-hidden text-ellipsis pr-[0.9px] block"
@@ -160,14 +173,14 @@ exports[`Tabs renders in vertical orientation 1`] = `
160
173
  </button>
161
174
  <button
162
175
  aria-selected="false"
163
- class="opacity-100 first:mt-4 last:mb-4 my-1 mx-0 py-2 px-4 text-left rounded-l rounded-r transition-all w-full overflow-hidden bg-gray hover:bg-gray text-graphite hover:text-black shrink-0 max-w min-w sm:min-w md:min-w border-0 cursor-pointer inline-flex outline-none items-center select-none align-middle appearance-none justify-center no-underline [-webkit-tap-highlight normal-case whitespace-normal leading-4 relative"
176
+ class="MuiButtonBase-root MuiTab-root PicassoTab-vertical MuiTab-textColorInherit"
164
177
  data-testid="tab-2"
165
178
  role="tab"
166
179
  tabindex="0"
167
180
  type="button"
168
181
  >
169
182
  <span
170
- class="w-full block"
183
+ class="MuiTab-wrapper PicassoTab-wrapper"
171
184
  >
172
185
  <div
173
186
  class="m-0 text-md text-inherit font-semibold whitespace-nowrap overflow-ellipsis [-webkit-box overflow-hidden text-ellipsis pr-[0.9px] block"
@@ -177,6 +190,10 @@ exports[`Tabs renders in vertical orientation 1`] = `
177
190
  </span>
178
191
  </button>
179
192
  </div>
193
+ <span
194
+ class="PrivateTabIndicator-root PrivateTabIndicator-colorSecondary MuiTabs-indicator PrivateTabIndicator-vertical"
195
+ style="top: 0px; height: 0px;"
196
+ />
180
197
  </div>
181
198
  </div>
182
199
  </div>
@@ -189,28 +206,31 @@ exports[`Tabs renders with a pre-selected option 1`] = `
189
206
  class="Picasso-root"
190
207
  >
191
208
  <div
192
- aria-orientation="horizontal"
193
- class="relative min-h flex overflow-hidden overflow-x"
209
+ class="MuiTabs-root Tabs-horizontal"
194
210
  data-component-type="tabs"
195
211
  >
196
212
  <div
197
- class="after:absolute after:content-[""] after:bottom-0 after:left-0 after:right-0 after:h-[1px] after:bg-gray after:z-0 flex-auto inline-block relative whitespace-nowrap"
213
+ class="MuiTabs-scrollable"
214
+ style="width: 99px; height: 99px; position: absolute; top: -9999px; overflow: scroll;"
215
+ />
216
+ <div
217
+ class="MuiTabs-scroller MuiTabs-scrollable"
218
+ style="margin-bottom: 0px;"
198
219
  >
199
220
  <div
200
- class="flex"
221
+ class="MuiTabs-flexContainer"
201
222
  role="tablist"
202
- tabindex="-1"
203
223
  >
204
224
  <button
205
225
  aria-selected="false"
206
- class="opacity-70 m-0 [&:not(:last-child)]:mr-8 pt-0 pb-[0.4375rem] px-0 text-center bg-transparent transition-shadow z-10 rounded-none text-black shrink-0 max-w min-w sm:min-w md:min-w border-0 cursor-pointer inline-flex outline-none items-center select-none align-middle appearance-none justify-center no-underline [-webkit-tap-highlight normal-case whitespace-normal leading-4 relative"
226
+ class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit"
207
227
  data-testid="tab-1"
208
228
  role="tab"
209
229
  tabindex="0"
210
230
  type="button"
211
231
  >
212
232
  <span
213
- class="w-full inline-flex flex-row items-center justify-center"
233
+ class="MuiTab-wrapper PicassoTab-wrapper"
214
234
  >
215
235
  <div
216
236
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -221,14 +241,14 @@ exports[`Tabs renders with a pre-selected option 1`] = `
221
241
  </button>
222
242
  <button
223
243
  aria-selected="true"
224
- class="opacity-100 m-0 [&:not(:last-child)]:mr-8 pt-0 pb-[0.4375rem] px-0 text-center bg-transparent transition-shadow z-10 rounded-none text-black shadow-blue shadow-[inset_0_-2px_0] shrink-0 max-w min-w sm:min-w md:min-w border-0 cursor-pointer inline-flex outline-none items-center select-none align-middle appearance-none justify-center no-underline [-webkit-tap-highlight normal-case whitespace-normal leading-4 relative"
244
+ class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit Mui-selected PicassoTab-selected"
225
245
  data-testid="tab-2"
226
246
  role="tab"
227
247
  tabindex="0"
228
248
  type="button"
229
249
  >
230
250
  <span
231
- class="w-full inline-flex flex-row items-center justify-center"
251
+ class="MuiTab-wrapper PicassoTab-wrapper"
232
252
  >
233
253
  <div
234
254
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -238,6 +258,10 @@ exports[`Tabs renders with a pre-selected option 1`] = `
238
258
  </span>
239
259
  </button>
240
260
  </div>
261
+ <span
262
+ class="PrivateTabIndicator-root PrivateTabIndicator-colorSecondary MuiTabs-indicator"
263
+ style="left: 0px; width: 0px;"
264
+ />
241
265
  </div>
242
266
  </div>
243
267
  <div
@@ -257,28 +281,31 @@ exports[`Tabs renders with a pre-selected option using custom value 1`] = `
257
281
  class="Picasso-root"
258
282
  >
259
283
  <div
260
- aria-orientation="horizontal"
261
- class="relative min-h flex overflow-hidden overflow-x"
284
+ class="MuiTabs-root Tabs-horizontal"
262
285
  data-component-type="tabs"
263
286
  >
264
287
  <div
265
- class="after:absolute after:content-[""] after:bottom-0 after:left-0 after:right-0 after:h-[1px] after:bg-gray after:z-0 flex-auto inline-block relative whitespace-nowrap"
288
+ class="MuiTabs-scrollable"
289
+ style="width: 99px; height: 99px; position: absolute; top: -9999px; overflow: scroll;"
290
+ />
291
+ <div
292
+ class="MuiTabs-scroller MuiTabs-scrollable"
293
+ style="margin-bottom: 0px;"
266
294
  >
267
295
  <div
268
- class="flex"
296
+ class="MuiTabs-flexContainer"
269
297
  role="tablist"
270
- tabindex="-1"
271
298
  >
272
299
  <button
273
300
  aria-selected="true"
274
- class="opacity-100 m-0 [&:not(:last-child)]:mr-8 pt-0 pb-[0.4375rem] px-0 text-center bg-transparent transition-shadow z-10 rounded-none text-black shadow-blue shadow-[inset_0_-2px_0] shrink-0 max-w min-w sm:min-w md:min-w border-0 cursor-pointer inline-flex outline-none items-center select-none align-middle appearance-none justify-center no-underline [-webkit-tap-highlight normal-case whitespace-normal leading-4 relative"
301
+ class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit Mui-selected PicassoTab-selected"
275
302
  data-testid="tab-1"
276
303
  role="tab"
277
304
  tabindex="0"
278
305
  type="button"
279
306
  >
280
307
  <span
281
- class="w-full inline-flex flex-row items-center justify-center"
308
+ class="MuiTab-wrapper PicassoTab-wrapper"
282
309
  >
283
310
  <div
284
311
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -289,14 +316,14 @@ exports[`Tabs renders with a pre-selected option using custom value 1`] = `
289
316
  </button>
290
317
  <button
291
318
  aria-selected="false"
292
- class="opacity-70 m-0 [&:not(:last-child)]:mr-8 pt-0 pb-[0.4375rem] px-0 text-center bg-transparent transition-shadow z-10 rounded-none text-black shrink-0 max-w min-w sm:min-w md:min-w border-0 cursor-pointer inline-flex outline-none items-center select-none align-middle appearance-none justify-center no-underline [-webkit-tap-highlight normal-case whitespace-normal leading-4 relative"
319
+ class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit"
293
320
  data-testid="tab-2"
294
321
  role="tab"
295
322
  tabindex="0"
296
323
  type="button"
297
324
  >
298
325
  <span
299
- class="w-full inline-flex flex-row items-center justify-center"
326
+ class="MuiTab-wrapper PicassoTab-wrapper"
300
327
  >
301
328
  <div
302
329
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -306,6 +333,10 @@ exports[`Tabs renders with a pre-selected option using custom value 1`] = `
306
333
  </span>
307
334
  </button>
308
335
  </div>
336
+ <span
337
+ class="PrivateTabIndicator-root PrivateTabIndicator-colorSecondary MuiTabs-indicator"
338
+ style="left: 0px; width: 0px;"
339
+ />
309
340
  </div>
310
341
  </div>
311
342
  <div
package/src/Tabs/index.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import type { OmitInternalProps } from '@toptal/picasso-shared'
2
2
 
3
- import type { Props } from './Tabs'
4
- import type { TabsValueType } from './TabsContext'
3
+ import type { Props, TabsValueType } from './Tabs'
5
4
 
6
5
  export { default as Tabs } from './Tabs'
7
6
  export type TabsProps = OmitInternalProps<Props<TabsValueType>>
8
- export type { TabsValueType } from './TabsContext'
7
+ export type { TabsValueType } from './Tabs'
@@ -2,12 +2,10 @@ import React from 'react'
2
2
  import { Container, Tabs } from '@toptal/picasso'
3
3
  import { SPACING_4 } from '@toptal/picasso-utils'
4
4
 
5
- import type { TabsValueType } from '../TabsContext'
6
-
7
5
  const Example = () => {
8
- const [value, setValue] = React.useState<TabsValueType>(0)
6
+ const [value, setValue] = React.useState(0)
9
7
 
10
- const handleChange = (_: React.ChangeEvent<{}>, newValue: TabsValueType) => {
8
+ const handleChange = (_: React.ChangeEvent<{}> | null, newValue: number) => {
11
9
  setValue(newValue)
12
10
  }
13
11