@toptal/picasso-tabs 5.0.15-alpha-allow-to-pass-class-names-in-modal-package-7c2827b69.2 → 5.0.15-alpha-ff-7-tabs-17eb872bb.13

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 +5 -8
  2. package/dist-package/src/Tab/Tab.d.ts.map +1 -1
  3. package/dist-package/src/Tab/Tab.js +61 -16
  4. package/dist-package/src/Tab/Tab.js.map +1 -1
  5. package/dist-package/src/Tabs/Tabs.d.ts +12 -9
  6. package/dist-package/src/Tabs/Tabs.d.ts.map +1 -1
  7. package/dist-package/src/Tabs/Tabs.js +68 -16
  8. package/dist-package/src/Tabs/Tabs.js.map +1 -1
  9. package/dist-package/src/Tabs/TabsContext.d.ts +11 -0
  10. package/dist-package/src/Tabs/TabsContext.d.ts.map +1 -0
  11. package/dist-package/src/Tabs/TabsContext.js +15 -0
  12. package/dist-package/src/Tabs/TabsContext.js.map +1 -0
  13. package/dist-package/src/Tabs/index.d.ts +3 -2
  14. package/dist-package/src/Tabs/index.d.ts.map +1 -1
  15. package/dist-package/src/Tabs/index.js.map +1 -1
  16. package/dist-package/src/TabsCompound/index.d.ts +2 -4
  17. package/dist-package/src/TabsCompound/index.d.ts.map +1 -1
  18. package/dist-package/src/index.d.ts +0 -1
  19. package/dist-package/src/index.d.ts.map +1 -1
  20. package/dist-package/src/index.js +0 -1
  21. package/dist-package/src/index.js.map +1 -1
  22. package/package.json +13 -13
  23. package/src/Tab/Tab.tsx +121 -51
  24. package/src/Tab/__snapshots__/test.tsx.snap +29 -45
  25. package/src/Tab/story/IconOrBadge.example.tsx +8 -3
  26. package/src/Tabs/Tabs.tsx +125 -42
  27. package/src/Tabs/TabsContext.tsx +27 -0
  28. package/src/Tabs/__snapshots__/test.tsx.snap +45 -76
  29. package/src/Tabs/index.ts +3 -2
  30. package/src/Tabs/story/Default.example.tsx +4 -2
  31. package/src/Tabs/test.tsx +4 -4
  32. package/src/index.ts +0 -1
  33. package/dist-package/src/Tab/styles.d.ts +0 -4
  34. package/dist-package/src/Tab/styles.d.ts.map +0 -1
  35. package/dist-package/src/Tab/styles.js +0 -95
  36. package/dist-package/src/Tab/styles.js.map +0 -1
  37. package/dist-package/src/TabScrollButton/TabScrollButton.d.ts +0 -12
  38. package/dist-package/src/TabScrollButton/TabScrollButton.d.ts.map +0 -1
  39. package/dist-package/src/TabScrollButton/TabScrollButton.js +0 -30
  40. package/dist-package/src/TabScrollButton/TabScrollButton.js.map +0 -1
  41. package/dist-package/src/TabScrollButton/index.d.ts +0 -5
  42. package/dist-package/src/TabScrollButton/index.d.ts.map +0 -1
  43. package/dist-package/src/TabScrollButton/index.js +0 -2
  44. package/dist-package/src/TabScrollButton/index.js.map +0 -1
  45. package/dist-package/src/Tabs/styles.d.ts +0 -4
  46. package/dist-package/src/Tabs/styles.d.ts.map +0 -1
  47. package/dist-package/src/Tabs/styles.js +0 -41
  48. package/dist-package/src/Tabs/styles.js.map +0 -1
  49. package/dist-package/src/Tabs/use-tab-action.d.ts +0 -5
  50. package/dist-package/src/Tabs/use-tab-action.d.ts.map +0 -1
  51. package/dist-package/src/Tabs/use-tab-action.js +0 -21
  52. package/dist-package/src/Tabs/use-tab-action.js.map +0 -1
  53. package/src/Tab/styles.ts +0 -107
  54. package/src/TabScrollButton/TabScrollButton.tsx +0 -59
  55. package/src/TabScrollButton/index.ts +0 -6
  56. package/src/Tabs/styles.ts +0 -45
  57. package/src/Tabs/use-tab-action.ts +0 -27
@@ -6,31 +6,28 @@ exports[`Tabs renders 1`] = `
6
6
  class="Picasso-root"
7
7
  >
8
8
  <div
9
- class="MuiTabs-root Tabs-horizontal"
9
+ aria-orientation="horizontal"
10
+ class="relative min-h flex overflow-hidden overflow-x"
10
11
  data-component-type="tabs"
11
12
  >
12
13
  <div
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;"
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"
19
15
  >
20
16
  <div
21
- class="MuiTabs-flexContainer"
17
+ class="flex"
22
18
  role="tablist"
19
+ tabindex="-1"
23
20
  >
24
21
  <button
25
22
  aria-selected="false"
26
- class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit"
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"
27
24
  data-testid="tab-1"
28
25
  role="tab"
29
26
  tabindex="0"
30
27
  type="button"
31
28
  >
32
29
  <span
33
- class="MuiTab-wrapper PicassoTab-wrapper"
30
+ class="w-full inline-flex flex-row items-center justify-center"
34
31
  >
35
32
  <div
36
33
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -41,14 +38,14 @@ exports[`Tabs renders 1`] = `
41
38
  </button>
42
39
  <button
43
40
  aria-selected="false"
44
- class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit"
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"
45
42
  data-testid="tab-2"
46
43
  role="tab"
47
44
  tabindex="0"
48
45
  type="button"
49
46
  >
50
47
  <span
51
- class="MuiTab-wrapper PicassoTab-wrapper"
48
+ class="w-full inline-flex flex-row items-center justify-center"
52
49
  >
53
50
  <div
54
51
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -58,10 +55,6 @@ exports[`Tabs renders 1`] = `
58
55
  </span>
59
56
  </button>
60
57
  </div>
61
- <span
62
- class="PrivateTabIndicator-root PrivateTabIndicator-colorSecondary MuiTabs-indicator"
63
- style="left: 0px; width: 0px;"
64
- />
65
58
  </div>
66
59
  </div>
67
60
  </div>
@@ -74,27 +67,28 @@ exports[`Tabs renders in full width 1`] = `
74
67
  class="Picasso-root"
75
68
  >
76
69
  <div
77
- class="MuiTabs-root Tabs-horizontal"
70
+ aria-orientation="horizontal"
71
+ class="relative min-h flex overflow-hidden"
78
72
  data-component-type="tabs"
79
73
  >
80
74
  <div
81
- class="MuiTabs-scroller MuiTabs-fixed"
82
- style="overflow: hidden;"
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"
83
76
  >
84
77
  <div
85
- class="MuiTabs-flexContainer"
78
+ class="flex"
86
79
  role="tablist"
80
+ tabindex="-1"
87
81
  >
88
82
  <button
89
83
  aria-selected="false"
90
- class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit MuiTab-fullWidth"
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"
91
85
  data-testid="tab-1"
92
86
  role="tab"
93
87
  tabindex="0"
94
88
  type="button"
95
89
  >
96
90
  <span
97
- class="MuiTab-wrapper PicassoTab-wrapper"
91
+ class="w-full inline-flex flex-row items-center justify-center"
98
92
  >
99
93
  <div
100
94
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -105,14 +99,14 @@ exports[`Tabs renders in full width 1`] = `
105
99
  </button>
106
100
  <button
107
101
  aria-selected="false"
108
- class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit MuiTab-fullWidth"
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"
109
103
  data-testid="tab-2"
110
104
  role="tab"
111
105
  tabindex="0"
112
106
  type="button"
113
107
  >
114
108
  <span
115
- class="MuiTab-wrapper PicassoTab-wrapper"
109
+ class="w-full inline-flex flex-row items-center justify-center"
116
110
  >
117
111
  <div
118
112
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -122,10 +116,6 @@ exports[`Tabs renders in full width 1`] = `
122
116
  </span>
123
117
  </button>
124
118
  </div>
125
- <span
126
- class="PrivateTabIndicator-root PrivateTabIndicator-colorSecondary MuiTabs-indicator"
127
- style="left: 0px; width: 0px;"
128
- />
129
119
  </div>
130
120
  </div>
131
121
  </div>
@@ -138,31 +128,28 @@ exports[`Tabs renders in vertical orientation 1`] = `
138
128
  class="Picasso-root"
139
129
  >
140
130
  <div
141
- class="MuiTabs-root Tabs-vertical MuiTabs-vertical"
131
+ aria-orientation="vertical"
132
+ class="relative min-h flex overflow-hidden w-[200px] m-0 flex-col overflow-x"
142
133
  data-component-type="tabs"
143
134
  >
144
135
  <div
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;"
136
+ class="pl-2 flex-auto inline-block relative whitespace-nowrap"
151
137
  >
152
138
  <div
153
- class="MuiTabs-flexContainer MuiTabs-flexContainerVertical"
139
+ class="flex flex-col"
154
140
  role="tablist"
141
+ tabindex="-1"
155
142
  >
156
143
  <button
157
144
  aria-selected="false"
158
- class="MuiButtonBase-root MuiTab-root PicassoTab-vertical MuiTab-textColorInherit"
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"
159
146
  data-testid="tab-1"
160
147
  role="tab"
161
148
  tabindex="0"
162
149
  type="button"
163
150
  >
164
151
  <span
165
- class="MuiTab-wrapper PicassoTab-wrapper"
152
+ class="w-full block"
166
153
  >
167
154
  <div
168
155
  class="m-0 text-md text-inherit font-semibold whitespace-nowrap overflow-ellipsis [-webkit-box overflow-hidden text-ellipsis pr-[0.9px] block"
@@ -173,14 +160,14 @@ exports[`Tabs renders in vertical orientation 1`] = `
173
160
  </button>
174
161
  <button
175
162
  aria-selected="false"
176
- class="MuiButtonBase-root MuiTab-root PicassoTab-vertical MuiTab-textColorInherit"
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"
177
164
  data-testid="tab-2"
178
165
  role="tab"
179
166
  tabindex="0"
180
167
  type="button"
181
168
  >
182
169
  <span
183
- class="MuiTab-wrapper PicassoTab-wrapper"
170
+ class="w-full block"
184
171
  >
185
172
  <div
186
173
  class="m-0 text-md text-inherit font-semibold whitespace-nowrap overflow-ellipsis [-webkit-box overflow-hidden text-ellipsis pr-[0.9px] block"
@@ -190,10 +177,6 @@ exports[`Tabs renders in vertical orientation 1`] = `
190
177
  </span>
191
178
  </button>
192
179
  </div>
193
- <span
194
- class="PrivateTabIndicator-root PrivateTabIndicator-colorSecondary MuiTabs-indicator PrivateTabIndicator-vertical"
195
- style="top: 0px; height: 0px;"
196
- />
197
180
  </div>
198
181
  </div>
199
182
  </div>
@@ -206,31 +189,28 @@ exports[`Tabs renders with a pre-selected option 1`] = `
206
189
  class="Picasso-root"
207
190
  >
208
191
  <div
209
- class="MuiTabs-root Tabs-horizontal"
192
+ aria-orientation="horizontal"
193
+ class="relative min-h flex overflow-hidden overflow-x"
210
194
  data-component-type="tabs"
211
195
  >
212
196
  <div
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;"
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"
219
198
  >
220
199
  <div
221
- class="MuiTabs-flexContainer"
200
+ class="flex"
222
201
  role="tablist"
202
+ tabindex="-1"
223
203
  >
224
204
  <button
225
205
  aria-selected="false"
226
- class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit"
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"
227
207
  data-testid="tab-1"
228
208
  role="tab"
229
209
  tabindex="0"
230
210
  type="button"
231
211
  >
232
212
  <span
233
- class="MuiTab-wrapper PicassoTab-wrapper"
213
+ class="w-full inline-flex flex-row items-center justify-center"
234
214
  >
235
215
  <div
236
216
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -241,14 +221,14 @@ exports[`Tabs renders with a pre-selected option 1`] = `
241
221
  </button>
242
222
  <button
243
223
  aria-selected="true"
244
- class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit Mui-selected PicassoTab-selected"
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"
245
225
  data-testid="tab-2"
246
226
  role="tab"
247
227
  tabindex="0"
248
228
  type="button"
249
229
  >
250
230
  <span
251
- class="MuiTab-wrapper PicassoTab-wrapper"
231
+ class="w-full inline-flex flex-row items-center justify-center"
252
232
  >
253
233
  <div
254
234
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -258,10 +238,6 @@ exports[`Tabs renders with a pre-selected option 1`] = `
258
238
  </span>
259
239
  </button>
260
240
  </div>
261
- <span
262
- class="PrivateTabIndicator-root PrivateTabIndicator-colorSecondary MuiTabs-indicator"
263
- style="left: 0px; width: 0px;"
264
- />
265
241
  </div>
266
242
  </div>
267
243
  <div
@@ -281,31 +257,28 @@ exports[`Tabs renders with a pre-selected option using custom value 1`] = `
281
257
  class="Picasso-root"
282
258
  >
283
259
  <div
284
- class="MuiTabs-root Tabs-horizontal"
260
+ aria-orientation="horizontal"
261
+ class="relative min-h flex overflow-hidden overflow-x"
285
262
  data-component-type="tabs"
286
263
  >
287
264
  <div
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;"
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"
294
266
  >
295
267
  <div
296
- class="MuiTabs-flexContainer"
268
+ class="flex"
297
269
  role="tablist"
270
+ tabindex="-1"
298
271
  >
299
272
  <button
300
273
  aria-selected="true"
301
- class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit Mui-selected PicassoTab-selected"
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"
302
275
  data-testid="tab-1"
303
276
  role="tab"
304
277
  tabindex="0"
305
278
  type="button"
306
279
  >
307
280
  <span
308
- class="MuiTab-wrapper PicassoTab-wrapper"
281
+ class="w-full inline-flex flex-row items-center justify-center"
309
282
  >
310
283
  <div
311
284
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -316,14 +289,14 @@ exports[`Tabs renders with a pre-selected option using custom value 1`] = `
316
289
  </button>
317
290
  <button
318
291
  aria-selected="false"
319
- class="MuiButtonBase-root MuiTab-root PicassoTab-horizontal MuiTab-textColorInherit"
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"
320
293
  data-testid="tab-2"
321
294
  role="tab"
322
295
  tabindex="0"
323
296
  type="button"
324
297
  >
325
298
  <span
326
- class="MuiTab-wrapper PicassoTab-wrapper"
299
+ class="w-full inline-flex flex-row items-center justify-center"
327
300
  >
328
301
  <div
329
302
  class="m-0 text-sm text-inherit font-semibold leading-[1.1rem]"
@@ -333,10 +306,6 @@ exports[`Tabs renders with a pre-selected option using custom value 1`] = `
333
306
  </span>
334
307
  </button>
335
308
  </div>
336
- <span
337
- class="PrivateTabIndicator-root PrivateTabIndicator-colorSecondary MuiTabs-indicator"
338
- style="left: 0px; width: 0px;"
339
- />
340
309
  </div>
341
310
  </div>
342
311
  <div
package/src/Tabs/index.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { OmitInternalProps } from '@toptal/picasso-shared'
2
2
 
3
- import type { Props, TabsValueType } from './Tabs'
3
+ import type { Props } from './Tabs'
4
+ import type { TabsValueType } from './TabsContext'
4
5
 
5
6
  export { default as Tabs } from './Tabs'
6
7
  export type TabsProps = OmitInternalProps<Props<TabsValueType>>
7
- export type { TabsValueType } from './Tabs'
8
+ export type { TabsValueType } from './TabsContext'
@@ -2,10 +2,12 @@ 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
+
5
7
  const Example = () => {
6
- const [value, setValue] = React.useState(0)
8
+ const [value, setValue] = React.useState<TabsValueType>(0)
7
9
 
8
- const handleChange = (_: React.ChangeEvent<{}> | null, newValue: number) => {
10
+ const handleChange = (_: React.ChangeEvent<{}>, newValue: TabsValueType) => {
9
11
  setValue(newValue)
10
12
  }
11
13
 
package/src/Tabs/test.tsx CHANGED
@@ -60,7 +60,7 @@ describe('Tabs', () => {
60
60
  const { container, queryByTestId } = renderTabs(
61
61
  [{ label: 'Tab 1' }, { label: 'Tab 2' }],
62
62
  {
63
- value: false,
63
+ value: null,
64
64
  }
65
65
  )
66
66
 
@@ -73,7 +73,7 @@ describe('Tabs', () => {
73
73
  it('renders in vertical orientation', () => {
74
74
  const { container } = renderTabs(
75
75
  [{ label: 'Tab 1' }, { label: 'Tab 2' }],
76
- { value: false },
76
+ { value: null },
77
77
  'vertical'
78
78
  )
79
79
 
@@ -116,7 +116,7 @@ describe('Tabs', () => {
116
116
  const { getByTestId } = renderTabs(
117
117
  [{ label: 'Tab 1' }, { label: 'Tab 2' }],
118
118
  {
119
- value: 1,
119
+ value: 0,
120
120
  onChange,
121
121
  }
122
122
  )
@@ -159,7 +159,7 @@ describe('Tabs', () => {
159
159
 
160
160
  it('renders in full width', () => {
161
161
  const { container } = renderTabs([{ label: 'Tab 1' }, { label: 'Tab 2' }], {
162
- value: false,
162
+ value: null,
163
163
  variant: 'fullWidth',
164
164
  })
165
165
 
package/src/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from './TabScrollButton'
2
1
  export * from './Tabs'
3
2
  export * from './Tab'
4
3
  export * from './TabDescription'
@@ -1,4 +0,0 @@
1
- import type { Theme } from '@material-ui/core/styles';
2
- declare const _default: ({ sizes, palette, shadows, transitions }: Theme) => import("@material-ui/styles").StyleRules<{}, "selected" | "horizontal" | "vertical" | "wrapper">;
3
- export default _default;
4
- //# sourceMappingURL=styles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/Tab/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;mEAgDK,KAAK;AAA/D,wBA0DI"}
@@ -1,95 +0,0 @@
1
- import { createStyles } from '@material-ui/core/styles';
2
- import { rem } from '@toptal/picasso-shared';
3
- import { PicassoProvider } from '@toptal/picasso-provider';
4
- PicassoProvider.override(({ breakpoints, palette }) => ({
5
- MuiTab: {
6
- root: {
7
- minHeight: 0,
8
- minWidth: 0,
9
- lineHeight: 1,
10
- textTransform: 'none',
11
- padding: `${rem('9px')} 0 ${rem('7px')}`,
12
- overflow: 'initial',
13
- [breakpoints.up('md')]: {
14
- padding: undefined,
15
- },
16
- color: palette.grey.dark,
17
- [breakpoints.up('md')]: {
18
- minWidth: 'auto',
19
- fontSize: '1rem',
20
- },
21
- },
22
- labelIcon: {
23
- minHeight: 0,
24
- paddingRight: '1.5rem',
25
- paddingTop: rem('9px'),
26
- '& $wrapper > *:first-child': {
27
- position: 'absolute',
28
- right: 0,
29
- marginBottom: 0,
30
- },
31
- },
32
- selected: {
33
- color: palette.common.black,
34
- },
35
- textColorInherit: {
36
- '&$disabled': {
37
- color: palette.grey.main,
38
- },
39
- },
40
- disabled: {},
41
- },
42
- }));
43
- export default ({ sizes, palette, shadows, transitions }) => createStyles({
44
- horizontal: {
45
- paddingTop: 0,
46
- '&:not(:last-child)': {
47
- marginRight: '2em',
48
- },
49
- },
50
- vertical: {
51
- width: '100%',
52
- borderRadius: `${sizes.borderRadius.small} 0 0 ${sizes.borderRadius.small}`,
53
- margin: '0.25rem 0',
54
- overflow: 'hidden',
55
- padding: '0.5rem 1rem',
56
- transition: `all ${transitions.duration.short}ms ${transitions.easing.easeInOut}`,
57
- textAlign: 'left',
58
- backgroundColor: palette.grey.lighter,
59
- opacity: 1,
60
- color: palette.grey.dark,
61
- '&:first-child': {
62
- marginTop: '1rem',
63
- },
64
- '&:last-child': {
65
- marginBottom: '1rem',
66
- },
67
- '&:hover': {
68
- color: palette.common.black,
69
- },
70
- '&:hover:not($selected)': {
71
- backgroundColor: palette.grey.lighter2,
72
- },
73
- '& $wrapper': {
74
- display: 'block',
75
- },
76
- },
77
- selected: {
78
- '&$vertical': {
79
- color: palette.common.black,
80
- boxShadow: shadows[1],
81
- backgroundColor: palette.grey.lightest,
82
- '&::before': {
83
- content: '""',
84
- background: palette.blue.main,
85
- position: 'absolute',
86
- left: 0,
87
- top: 0,
88
- bottom: 0,
89
- width: '3px',
90
- },
91
- },
92
- },
93
- wrapper: {},
94
- });
95
- //# sourceMappingURL=styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/Tab/styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,wBAA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CACZ,CAAC,CAAA"}
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { BaseProps } from '@toptal/picasso-shared';
3
- declare type DirectionType = 'left' | 'right';
4
- export interface Props extends BaseProps {
5
- /** The direction the button should indicate. */
6
- direction: DirectionType;
7
- /** If `true`, the component is disabled. */
8
- disabled?: boolean;
9
- }
10
- export declare const TabScrollButton: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
11
- export default TabScrollButton;
12
- //# sourceMappingURL=TabScrollButton.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TabScrollButton.d.ts","sourceRoot":"","sources":["../../../src/TabScrollButton/TabScrollButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAKvD,aAAK,aAAa,GAAG,MAAM,GAAG,OAAO,CAAA;AAErC,MAAM,WAAW,KAAM,SAAQ,SAAS;IACtC,gDAAgD;IAChD,SAAS,EAAE,aAAa,CAAA;IACxB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,eAAO,MAAM,eAAe,8EAsC3B,CAAA;AAID,eAAe,eAAe,CAAA"}
@@ -1,30 +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 React, { forwardRef } from 'react';
13
- import { ButtonBase } from '@material-ui/core';
14
- import { BackMinor16, ChevronMinor16 } from '@toptal/picasso-icons';
15
- import { Container } from '@toptal/picasso-container';
16
- import { twMerge } from '@toptal/picasso-tailwind-merge';
17
- export const TabScrollButton = forwardRef(function TabScrollButton(props, ref) {
18
- const { className, style, direction, disabled } = props, rest = __rest(props, ["className", "style", "direction", "disabled"]);
19
- if (disabled) {
20
- return null;
21
- }
22
- return (React.createElement(Container, Object.assign({}, rest, { ref: ref, className: twMerge('relative', className), style: style }),
23
- React.createElement(Container, { className: twMerge('absolute w-10 h-full z-10', direction === 'left'
24
- ? 'bg-gradient-to-r from-white via-white to-transparent'
25
- : 'bg-gradient-to-l from-white via-white to-transparent', direction === 'left' ? 'left-0' : 'right-0') },
26
- React.createElement(ButtonBase, { className: twMerge('absolute w-4 h-full', direction === 'left' ? 'left-0' : 'right-0'), "aria-label": `${direction} button`, "data-testid": `tab-scroll-button-${direction}` }, direction === 'left' ? React.createElement(BackMinor16, null) : React.createElement(ChevronMinor16, null)))));
27
- });
28
- TabScrollButton.displayName = 'TabScrollButton';
29
- export default TabScrollButton;
30
- //# sourceMappingURL=TabScrollButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TabScrollButton.js","sourceRoot":"","sources":["../../../src/TabScrollButton/TabScrollButton.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAWxD,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;IAEhE,IAAI,QAAQ,EAAE;QACZ,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,CACL,oBAAC,SAAS,oBACJ,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC,EACzC,KAAK,EAAE,KAAK;QAEZ,oBAAC,SAAS,IACR,SAAS,EAAE,OAAO,CAChB,2BAA2B,EAC3B,SAAS,KAAK,MAAM;gBAClB,CAAC,CAAC,sDAAsD;gBACxD,CAAC,CAAC,sDAAsD,EAC1D,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAC5C;YAED,oBAAC,UAAU,IACT,SAAS,EAAE,OAAO,CAChB,qBAAqB,EACrB,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAC5C,gBACW,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,2 +0,0 @@
1
- export { default as TabScrollButton } from './TabScrollButton';
2
- //# sourceMappingURL=index.js.map
@@ -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,4 +0,0 @@
1
- import type { Theme } from '@material-ui/core/styles';
2
- declare const _default: ({ palette }: Theme) => import("@material-ui/styles").StyleRules<{}, "horizontal" | "vertical">;
3
- export default _default;
4
- //# sourceMappingURL=styles.d.ts.map
@@ -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"}