@sproutsocial/seeds-react-tabs 1.4.13 → 1.4.15
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/esm/index.js +168 -49
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +167 -48
- package/dist/index.js.map +1 -1
- package/dist/tabs.css +122 -0
- package/package.json +16 -5
- package/.eslintignore +0 -6
- package/.eslintrc.js +0 -4
- package/.turbo/turbo-build.log +0 -21
- package/CHANGELOG.md +0 -383
- package/jest.config.js +0 -9
- package/src/Tabs.stories.tsx +0 -258
- package/src/Tabs.tsx +0 -284
- package/src/TabsTypes.ts +0 -48
- package/src/__tests__/Tabs.typetest.tsx +0 -20
- package/src/__tests__/tabs.test.tsx +0 -462
- package/src/index.ts +0 -5
- package/src/styled.d.ts +0 -7
- package/src/styles.ts +0 -119
- package/tsconfig.json +0 -9
- package/tsup.config.ts +0 -12
package/CHANGELOG.md
DELETED
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
# @sproutsocial/seeds-react-tabs
|
|
2
|
-
|
|
3
|
-
## 1.4.13
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Updated dependencies [85f9728]
|
|
8
|
-
- Updated dependencies [fa7d859]
|
|
9
|
-
- @sproutsocial/seeds-react-theme@4.2.0
|
|
10
|
-
- @sproutsocial/seeds-react-button@2.2.3
|
|
11
|
-
|
|
12
|
-
## 1.4.12
|
|
13
|
-
|
|
14
|
-
### Patch Changes
|
|
15
|
-
|
|
16
|
-
- Updated dependencies [a13a571]
|
|
17
|
-
- @sproutsocial/seeds-react-theme@4.1.1
|
|
18
|
-
- @sproutsocial/seeds-react-button@2.2.2
|
|
19
|
-
|
|
20
|
-
## 1.4.11
|
|
21
|
-
|
|
22
|
-
### Patch Changes
|
|
23
|
-
|
|
24
|
-
- @sproutsocial/seeds-react-button@2.2.1
|
|
25
|
-
|
|
26
|
-
## 1.4.10
|
|
27
|
-
|
|
28
|
-
### Patch Changes
|
|
29
|
-
|
|
30
|
-
- Updated dependencies [456a20f]
|
|
31
|
-
- Updated dependencies [5892f44]
|
|
32
|
-
- @sproutsocial/seeds-react-button@2.2.0
|
|
33
|
-
- @sproutsocial/seeds-react-system-props@3.1.1
|
|
34
|
-
|
|
35
|
-
## 1.4.9
|
|
36
|
-
|
|
37
|
-
### Patch Changes
|
|
38
|
-
|
|
39
|
-
- Updated dependencies [5114a32]
|
|
40
|
-
- Updated dependencies [a0fe3d3]
|
|
41
|
-
- @sproutsocial/seeds-react-theme@4.1.0
|
|
42
|
-
- @sproutsocial/seeds-react-button@2.1.3
|
|
43
|
-
|
|
44
|
-
## 1.4.8
|
|
45
|
-
|
|
46
|
-
### Patch Changes
|
|
47
|
-
|
|
48
|
-
- Updated dependencies [cb27f07]
|
|
49
|
-
- @sproutsocial/seeds-react-button@2.1.2
|
|
50
|
-
|
|
51
|
-
## 1.4.7
|
|
52
|
-
|
|
53
|
-
### Patch Changes
|
|
54
|
-
|
|
55
|
-
- Updated dependencies [40d2dfe]
|
|
56
|
-
- @sproutsocial/seeds-react-button@2.1.1
|
|
57
|
-
|
|
58
|
-
## 1.4.6
|
|
59
|
-
|
|
60
|
-
### Patch Changes
|
|
61
|
-
|
|
62
|
-
- Updated dependencies [132ef9d]
|
|
63
|
-
- Updated dependencies [132ef9d]
|
|
64
|
-
- Updated dependencies [132ef9d]
|
|
65
|
-
- @sproutsocial/seeds-react-button@2.1.0
|
|
66
|
-
- @sproutsocial/seeds-react-theme@4.0.0
|
|
67
|
-
- @sproutsocial/seeds-react-system-props@3.1.0
|
|
68
|
-
|
|
69
|
-
## 1.4.5
|
|
70
|
-
|
|
71
|
-
### Patch Changes
|
|
72
|
-
|
|
73
|
-
- @sproutsocial/seeds-react-button@2.0.8
|
|
74
|
-
|
|
75
|
-
## 1.4.4
|
|
76
|
-
|
|
77
|
-
### Patch Changes
|
|
78
|
-
|
|
79
|
-
- Updated dependencies [47c62b3]
|
|
80
|
-
- @sproutsocial/seeds-react-theme@3.7.1
|
|
81
|
-
- @sproutsocial/seeds-react-button@2.0.7
|
|
82
|
-
|
|
83
|
-
## 1.4.3
|
|
84
|
-
|
|
85
|
-
### Patch Changes
|
|
86
|
-
|
|
87
|
-
- Updated dependencies [06da9c2]
|
|
88
|
-
- @sproutsocial/seeds-react-theme@3.7.0
|
|
89
|
-
- @sproutsocial/seeds-react-button@2.0.6
|
|
90
|
-
|
|
91
|
-
## 1.4.2
|
|
92
|
-
|
|
93
|
-
### Patch Changes
|
|
94
|
-
|
|
95
|
-
- 9c60744: Fix Safari-only tab collapse not addressed by 1.4.1:
|
|
96
|
-
|
|
97
|
-
Inside a flex parent with `overflow: auto/hidden`, Safari resolves the Container's `min-height: min-content` to `0` when the same element also has `overflow-x: auto; overflow-y: hidden`. Tabs would paint once, then collapse to their `border-bottom` (1px). Adds `flex-shrink: 0` on the Container so the tablist preserves its intrinsic height regardless of how Safari handles `min-content` in that combination. Chrome behavior is unchanged.
|
|
98
|
-
|
|
99
|
-
Reported in [BUGS-28687](https://sprout.atlassian.net/browse/BUGS-28687) across every Profiles-by-Network report.
|
|
100
|
-
|
|
101
|
-
## 1.4.1
|
|
102
|
-
|
|
103
|
-
### Patch Changes
|
|
104
|
-
|
|
105
|
-
- 679806a: Fix layout regression introduced in 1.4.0:
|
|
106
|
-
|
|
107
|
-
- **Tabs no longer collapse to a 1px-tall row inside flex-column parents.** Container's `overflow-x: auto; overflow-y: hidden` was triggering the flex `min-height: auto → 0` override, allowing an ancestor `display: flex; flex-direction: column` with a bounded height (e.g. `ContentWithDrillDown`'s `Content.Body`) to shrink the tablist to its border-bottom. Container now sets `min-height: min-content`, restoring the pre-1.4.0 minimum-size behavior without changing scroll semantics.
|
|
108
|
-
|
|
109
|
-
No API changes.
|
|
110
|
-
|
|
111
|
-
## 1.4.0
|
|
112
|
-
|
|
113
|
-
### Minor Changes
|
|
114
|
-
|
|
115
|
-
- 412cc1e: Tabs now scrolls horizontally when the tab list overflows its container, with a fade indicator at each edge that auto-adapts to the parent's background via CSS `mask-image`. Vertical mouse-wheel input is redirected to horizontal scroll (with release-at-ends behavior so page scrolling isn't trapped), and arrow-key and click activation auto-scroll the selected tab into view. Adds an optional `aria-label` prop that's forwarded to the `role="tablist"` element per the WAI-ARIA Authoring Practices Tabs pattern.
|
|
116
|
-
|
|
117
|
-
Spacing change for non-`fullWidth` Tabs: the inter-tab `margin-right` between adjacent tab buttons has been removed in favor of horizontal padding on each tab button. Visual spacing is preserved (each tab now contributes its own breathing room via padding rather than the previous tab pushing it via margin), and clickable hit-areas are slightly larger. The `fullWidth` case is unchanged. Consumers depending on the exact pixel values of the old margin should re-check their layouts.
|
|
118
|
-
|
|
119
|
-
## 1.3.11
|
|
120
|
-
|
|
121
|
-
### Patch Changes
|
|
122
|
-
|
|
123
|
-
- @sproutsocial/seeds-react-button@2.0.5
|
|
124
|
-
|
|
125
|
-
## 1.3.10
|
|
126
|
-
|
|
127
|
-
### Patch Changes
|
|
128
|
-
|
|
129
|
-
- @sproutsocial/seeds-react-button@2.0.4
|
|
130
|
-
|
|
131
|
-
## 1.3.9
|
|
132
|
-
|
|
133
|
-
### Patch Changes
|
|
134
|
-
|
|
135
|
-
- @sproutsocial/seeds-react-button@2.0.3
|
|
136
|
-
|
|
137
|
-
## 1.3.8
|
|
138
|
-
|
|
139
|
-
### Patch Changes
|
|
140
|
-
|
|
141
|
-
- @sproutsocial/seeds-react-button@2.0.2
|
|
142
|
-
|
|
143
|
-
## 1.3.7
|
|
144
|
-
|
|
145
|
-
### Patch Changes
|
|
146
|
-
|
|
147
|
-
- @sproutsocial/seeds-react-button@2.0.1
|
|
148
|
-
|
|
149
|
-
## 1.3.6
|
|
150
|
-
|
|
151
|
-
### Patch Changes
|
|
152
|
-
|
|
153
|
-
- Updated dependencies [4ba8720]
|
|
154
|
-
- Updated dependencies [df9d751]
|
|
155
|
-
- @sproutsocial/seeds-react-theme@3.6.2
|
|
156
|
-
- @sproutsocial/seeds-react-button@2.0.0
|
|
157
|
-
|
|
158
|
-
## 1.3.5
|
|
159
|
-
|
|
160
|
-
### Patch Changes
|
|
161
|
-
|
|
162
|
-
- Updated dependencies [1f9a473]
|
|
163
|
-
- @sproutsocial/seeds-react-theme@3.6.1
|
|
164
|
-
- @sproutsocial/seeds-react-button@1.4.3
|
|
165
|
-
|
|
166
|
-
## 1.3.4
|
|
167
|
-
|
|
168
|
-
### Patch Changes
|
|
169
|
-
|
|
170
|
-
- @sproutsocial/seeds-react-button@1.4.2
|
|
171
|
-
|
|
172
|
-
## 1.3.3
|
|
173
|
-
|
|
174
|
-
### Patch Changes
|
|
175
|
-
|
|
176
|
-
- @sproutsocial/seeds-react-button@1.4.1
|
|
177
|
-
|
|
178
|
-
## 1.3.2
|
|
179
|
-
|
|
180
|
-
### Patch Changes
|
|
181
|
-
|
|
182
|
-
- Updated dependencies [7d54d67]
|
|
183
|
-
- @sproutsocial/seeds-react-button@1.4.0
|
|
184
|
-
|
|
185
|
-
## 1.3.1
|
|
186
|
-
|
|
187
|
-
### Patch Changes
|
|
188
|
-
|
|
189
|
-
- Updated dependencies [17d4f12]
|
|
190
|
-
- @sproutsocial/seeds-react-theme@3.6.0
|
|
191
|
-
- @sproutsocial/seeds-react-button@1.3.20
|
|
192
|
-
|
|
193
|
-
## 1.3.0
|
|
194
|
-
|
|
195
|
-
### Minor Changes
|
|
196
|
-
|
|
197
|
-
- 651fc1b: Update TabButton structure to correct aria descendents
|
|
198
|
-
|
|
199
|
-
## 1.2.10
|
|
200
|
-
|
|
201
|
-
### Patch Changes
|
|
202
|
-
|
|
203
|
-
- @sproutsocial/seeds-react-button@1.3.19
|
|
204
|
-
|
|
205
|
-
## 1.2.9
|
|
206
|
-
|
|
207
|
-
### Patch Changes
|
|
208
|
-
|
|
209
|
-
- Updated dependencies [118e300]
|
|
210
|
-
- @sproutsocial/seeds-react-theme@3.5.1
|
|
211
|
-
- @sproutsocial/seeds-react-button@1.3.18
|
|
212
|
-
|
|
213
|
-
## 1.2.8
|
|
214
|
-
|
|
215
|
-
### Patch Changes
|
|
216
|
-
|
|
217
|
-
- @sproutsocial/seeds-react-button@1.3.17
|
|
218
|
-
|
|
219
|
-
## 1.2.7
|
|
220
|
-
|
|
221
|
-
### Patch Changes
|
|
222
|
-
|
|
223
|
-
- @sproutsocial/seeds-react-button@1.3.16
|
|
224
|
-
|
|
225
|
-
## 1.2.6
|
|
226
|
-
|
|
227
|
-
### Patch Changes
|
|
228
|
-
|
|
229
|
-
- @sproutsocial/seeds-react-button@1.3.15
|
|
230
|
-
|
|
231
|
-
## 1.2.5
|
|
232
|
-
|
|
233
|
-
### Patch Changes
|
|
234
|
-
|
|
235
|
-
- Updated dependencies [db6ce39]
|
|
236
|
-
- Updated dependencies [20bb01b]
|
|
237
|
-
- @sproutsocial/seeds-react-theme@3.5.0
|
|
238
|
-
- @sproutsocial/seeds-react-button@1.3.14
|
|
239
|
-
|
|
240
|
-
## 1.2.4
|
|
241
|
-
|
|
242
|
-
### Patch Changes
|
|
243
|
-
|
|
244
|
-
- Updated dependencies [7716e16]
|
|
245
|
-
- @sproutsocial/seeds-react-theme@3.4.0
|
|
246
|
-
- @sproutsocial/seeds-react-button@1.3.13
|
|
247
|
-
|
|
248
|
-
## 1.2.3
|
|
249
|
-
|
|
250
|
-
### Patch Changes
|
|
251
|
-
|
|
252
|
-
- @sproutsocial/seeds-react-theme@3.3.2
|
|
253
|
-
- @sproutsocial/seeds-react-button@1.3.12
|
|
254
|
-
|
|
255
|
-
## 1.2.2
|
|
256
|
-
|
|
257
|
-
### Patch Changes
|
|
258
|
-
|
|
259
|
-
- @sproutsocial/seeds-react-button@1.3.11
|
|
260
|
-
|
|
261
|
-
## 1.2.1
|
|
262
|
-
|
|
263
|
-
### Patch Changes
|
|
264
|
-
|
|
265
|
-
- @sproutsocial/seeds-react-theme@3.3.1
|
|
266
|
-
- @sproutsocial/seeds-react-button@1.3.10
|
|
267
|
-
|
|
268
|
-
## 1.2.0
|
|
269
|
-
|
|
270
|
-
### Minor Changes
|
|
271
|
-
|
|
272
|
-
- 2612fec: Add TabPanel to Tabs
|
|
273
|
-
- 2612fec: Remove list semantics from tabs
|
|
274
|
-
|
|
275
|
-
### Patch Changes
|
|
276
|
-
|
|
277
|
-
- Updated dependencies [750d1ea]
|
|
278
|
-
- @sproutsocial/seeds-react-theme@3.3.0
|
|
279
|
-
- @sproutsocial/seeds-react-button@1.3.9
|
|
280
|
-
|
|
281
|
-
## 1.1.12
|
|
282
|
-
|
|
283
|
-
### Patch Changes
|
|
284
|
-
|
|
285
|
-
- @sproutsocial/seeds-react-button@1.3.8
|
|
286
|
-
|
|
287
|
-
## 1.1.11
|
|
288
|
-
|
|
289
|
-
### Patch Changes
|
|
290
|
-
|
|
291
|
-
- @sproutsocial/seeds-react-button@1.3.7
|
|
292
|
-
|
|
293
|
-
## 1.1.10
|
|
294
|
-
|
|
295
|
-
### Patch Changes
|
|
296
|
-
|
|
297
|
-
- Updated dependencies [fa7579a]
|
|
298
|
-
- @sproutsocial/seeds-react-theme@3.2.1
|
|
299
|
-
- @sproutsocial/seeds-react-button@1.3.6
|
|
300
|
-
|
|
301
|
-
## 1.1.9
|
|
302
|
-
|
|
303
|
-
### Patch Changes
|
|
304
|
-
|
|
305
|
-
- @sproutsocial/seeds-react-button@1.3.5
|
|
306
|
-
|
|
307
|
-
## 1.1.8
|
|
308
|
-
|
|
309
|
-
### Patch Changes
|
|
310
|
-
|
|
311
|
-
- Updated dependencies [8f6ba8d]
|
|
312
|
-
- @sproutsocial/seeds-react-theme@3.2.0
|
|
313
|
-
- @sproutsocial/seeds-react-button@1.3.4
|
|
314
|
-
|
|
315
|
-
## 1.1.7
|
|
316
|
-
|
|
317
|
-
### Patch Changes
|
|
318
|
-
|
|
319
|
-
- @sproutsocial/seeds-react-button@1.3.3
|
|
320
|
-
|
|
321
|
-
## 1.1.6
|
|
322
|
-
|
|
323
|
-
### Patch Changes
|
|
324
|
-
|
|
325
|
-
- @sproutsocial/seeds-react-button@1.3.2
|
|
326
|
-
|
|
327
|
-
## 1.1.5
|
|
328
|
-
|
|
329
|
-
### Patch Changes
|
|
330
|
-
|
|
331
|
-
- Updated dependencies [b1c3b44]
|
|
332
|
-
- @sproutsocial/seeds-react-theme@3.1.1
|
|
333
|
-
- @sproutsocial/seeds-react-button@1.3.1
|
|
334
|
-
|
|
335
|
-
## 1.1.4
|
|
336
|
-
|
|
337
|
-
### Patch Changes
|
|
338
|
-
|
|
339
|
-
- Updated dependencies [5ea5457]
|
|
340
|
-
- @sproutsocial/seeds-react-button@1.3.0
|
|
341
|
-
|
|
342
|
-
## 1.1.3
|
|
343
|
-
|
|
344
|
-
### Patch Changes
|
|
345
|
-
|
|
346
|
-
- Updated dependencies [47580c4]
|
|
347
|
-
- @sproutsocial/seeds-react-theme@3.1.0
|
|
348
|
-
- @sproutsocial/seeds-react-button@1.2.3
|
|
349
|
-
|
|
350
|
-
## 1.1.2
|
|
351
|
-
|
|
352
|
-
### Patch Changes
|
|
353
|
-
|
|
354
|
-
- Updated dependencies [22e1111]
|
|
355
|
-
- @sproutsocial/seeds-react-button@1.2.2
|
|
356
|
-
- @sproutsocial/seeds-react-theme@3.0.1
|
|
357
|
-
|
|
358
|
-
## 1.1.1
|
|
359
|
-
|
|
360
|
-
### Patch Changes
|
|
361
|
-
|
|
362
|
-
- 9fd8bac: Update dependencies to use semantic package version instead of wildcards
|
|
363
|
-
- Updated dependencies [9fd8bac]
|
|
364
|
-
- @sproutsocial/seeds-react-system-props@3.0.2
|
|
365
|
-
- @sproutsocial/seeds-react-button@1.2.1
|
|
366
|
-
- @sproutsocial/seeds-react-theme@2.2.1
|
|
367
|
-
|
|
368
|
-
## 1.1.0
|
|
369
|
-
|
|
370
|
-
### Minor Changes
|
|
371
|
-
|
|
372
|
-
- cd61069: Refactors Tabs onSelect prop
|
|
373
|
-
- This should not be a breaking change; at most, type errors may arise.
|
|
374
|
-
- Before: `onSelect: (arg0: string) => void;`
|
|
375
|
-
- After: `onSelect(id: string): void;`
|
|
376
|
-
- By using method syntax when defining the prop's type, we allow users more control over the type of their `onSelect` function.
|
|
377
|
-
- For instance, this allows a function with signature `(id: 'a' | 'b') => void` to be passed
|
|
378
|
-
|
|
379
|
-
## 1.0.0
|
|
380
|
-
|
|
381
|
-
### Major Changes
|
|
382
|
-
|
|
383
|
-
- bd8d03d: Migrate tabs from Racine to seeds-react-tabs
|
package/jest.config.js
DELETED
package/src/Tabs.stories.tsx
DELETED
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import { Button } from "@sproutsocial/seeds-react-button";
|
|
3
|
-
import { Icon, type TypeIconName } from "@sproutsocial/seeds-react-icon";
|
|
4
|
-
import { Tabs } from "./";
|
|
5
|
-
import { Text } from "@sproutsocial/seeds-react-text";
|
|
6
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
7
|
-
import Box from "@sproutsocial/seeds-react-box";
|
|
8
|
-
|
|
9
|
-
interface TypeTabData {
|
|
10
|
-
id: string;
|
|
11
|
-
text: string;
|
|
12
|
-
icon: TypeIconName;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface TypeTabsStoryState {
|
|
16
|
-
selected: string;
|
|
17
|
-
tabs?: TypeTabData[];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const meta: Meta<typeof Tabs> = {
|
|
21
|
-
title: "Components/Tabs",
|
|
22
|
-
component: Tabs,
|
|
23
|
-
args: {
|
|
24
|
-
fullWidth: false,
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default meta;
|
|
29
|
-
|
|
30
|
-
type Story = StoryObj<typeof Tabs>;
|
|
31
|
-
|
|
32
|
-
export const Default: Story = {
|
|
33
|
-
render: (args) => {
|
|
34
|
-
const [selectedId, setSelectedId] = useState("notifications");
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<React.Fragment>
|
|
38
|
-
<Tabs
|
|
39
|
-
selectedId={selectedId}
|
|
40
|
-
onSelect={(selected) => setSelectedId(selected)}
|
|
41
|
-
fullWidth={args.fullWidth}
|
|
42
|
-
>
|
|
43
|
-
<Tabs.Button id="notifications">
|
|
44
|
-
<Icon name="bell-outline" mr="12px" aria-hidden />
|
|
45
|
-
<Text size="300" fontWeight="600">
|
|
46
|
-
Notifications
|
|
47
|
-
</Text>
|
|
48
|
-
</Tabs.Button>
|
|
49
|
-
<Tabs.Button id="issues">
|
|
50
|
-
<Icon name="triangle-exclamation-outline" mr="12px" aria-hidden />
|
|
51
|
-
<Text size="300" fontWeight="600">
|
|
52
|
-
Issues
|
|
53
|
-
</Text>
|
|
54
|
-
</Tabs.Button>
|
|
55
|
-
</Tabs>
|
|
56
|
-
|
|
57
|
-
{selectedId === "notifications" && (
|
|
58
|
-
<Tabs.Panel id="notifications">
|
|
59
|
-
<Text mt="24px">
|
|
60
|
-
Notifications panel content goes here. This panel is properly
|
|
61
|
-
connected to the "Notifications" tab via ARIA attributes for
|
|
62
|
-
accessibility.
|
|
63
|
-
</Text>
|
|
64
|
-
</Tabs.Panel>
|
|
65
|
-
)}
|
|
66
|
-
|
|
67
|
-
{selectedId === "issues" && (
|
|
68
|
-
<Tabs.Panel id="issues">
|
|
69
|
-
<Text mt="24px">
|
|
70
|
-
Issues panel content goes here. Screen readers will announce the
|
|
71
|
-
relationship between tabs and panels.
|
|
72
|
-
</Text>
|
|
73
|
-
</Tabs.Panel>
|
|
74
|
-
)}
|
|
75
|
-
</React.Fragment>
|
|
76
|
-
);
|
|
77
|
-
},
|
|
78
|
-
name: "Default",
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export const FullWidth: Story = {
|
|
82
|
-
render: (args) => {
|
|
83
|
-
const [selectedId, setSelectedId] = useState("notifications");
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<Box width="100%" display="flex" flexDirection="column">
|
|
87
|
-
<Tabs
|
|
88
|
-
selectedId={selectedId}
|
|
89
|
-
onSelect={(selected) => setSelectedId(selected)}
|
|
90
|
-
fullWidth
|
|
91
|
-
>
|
|
92
|
-
<Tabs.Button id="notifications">
|
|
93
|
-
<Icon name="bell-outline" mr="12px" aria-hidden />
|
|
94
|
-
<Text size="300" fontWeight="600">
|
|
95
|
-
Notifications
|
|
96
|
-
</Text>
|
|
97
|
-
</Tabs.Button>
|
|
98
|
-
<Tabs.Button id="issues">
|
|
99
|
-
<Icon name="triangle-exclamation-outline" mr="12px" aria-hidden />
|
|
100
|
-
<Text size="300" fontWeight="600">
|
|
101
|
-
Issues
|
|
102
|
-
</Text>
|
|
103
|
-
</Tabs.Button>
|
|
104
|
-
</Tabs>
|
|
105
|
-
|
|
106
|
-
{selectedId === "notifications" && (
|
|
107
|
-
<Tabs.Panel id="notifications">
|
|
108
|
-
<Text mt="24px">
|
|
109
|
-
Notifications panel content goes here. This panel is properly
|
|
110
|
-
connected to the "Notifications" tab via ARIA attributes for
|
|
111
|
-
accessibility.
|
|
112
|
-
</Text>
|
|
113
|
-
</Tabs.Panel>
|
|
114
|
-
)}
|
|
115
|
-
|
|
116
|
-
{selectedId === "issues" && (
|
|
117
|
-
<Tabs.Panel id="issues">
|
|
118
|
-
<Text mt="24px">
|
|
119
|
-
Issues panel content goes here. Screen readers will announce the
|
|
120
|
-
relationship between tabs and panels.
|
|
121
|
-
</Text>
|
|
122
|
-
</Tabs.Panel>
|
|
123
|
-
)}
|
|
124
|
-
</Box>
|
|
125
|
-
);
|
|
126
|
-
},
|
|
127
|
-
name: "Full width",
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export const Scrollable: Story = {
|
|
131
|
-
render: () => {
|
|
132
|
-
const tabs = [
|
|
133
|
-
"Overview",
|
|
134
|
-
"Notifications",
|
|
135
|
-
"Issues",
|
|
136
|
-
"Pull Requests",
|
|
137
|
-
"Discussions",
|
|
138
|
-
"Actions",
|
|
139
|
-
"Projects",
|
|
140
|
-
"Wiki",
|
|
141
|
-
"Security",
|
|
142
|
-
"Insights",
|
|
143
|
-
];
|
|
144
|
-
const [selectedId, setSelectedId] = useState(tabs[0]);
|
|
145
|
-
|
|
146
|
-
return (
|
|
147
|
-
<>
|
|
148
|
-
<Box width="450px" mb={400}>
|
|
149
|
-
<Tabs
|
|
150
|
-
selectedId={selectedId ?? ""}
|
|
151
|
-
onSelect={(selected) => setSelectedId(selected)}
|
|
152
|
-
aria-label="Repository sections"
|
|
153
|
-
>
|
|
154
|
-
{tabs.map((tab) => (
|
|
155
|
-
<Tabs.Button key={tab} id={tab}>
|
|
156
|
-
<Text size="300" fontWeight="600" flexWrap={"nowrap"}>
|
|
157
|
-
{tab}
|
|
158
|
-
</Text>
|
|
159
|
-
</Tabs.Button>
|
|
160
|
-
))}
|
|
161
|
-
</Tabs>
|
|
162
|
-
</Box>
|
|
163
|
-
|
|
164
|
-
{tabs.map((tab) => {
|
|
165
|
-
if (selectedId !== tab) return null;
|
|
166
|
-
return (
|
|
167
|
-
<Tabs.Panel id={tab}>
|
|
168
|
-
<Text color="text.body">{tab} Panel</Text>
|
|
169
|
-
</Tabs.Panel>
|
|
170
|
-
);
|
|
171
|
-
})}
|
|
172
|
-
</>
|
|
173
|
-
);
|
|
174
|
-
},
|
|
175
|
-
name: "Scrollable",
|
|
176
|
-
parameters: {
|
|
177
|
-
docs: {
|
|
178
|
-
description: {
|
|
179
|
-
story:
|
|
180
|
-
"When the tab list overflows its container, the bar scrolls horizontally and a fade indicator appears at each overflowing edge. Arrow-key and click activation auto-scroll the selected tab fully into view past the fade region. The fade uses CSS `mask-image` so it auto-adapts to any container background — no consumer configuration needed.",
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
export const RemoveATab: Story = {
|
|
187
|
-
render: (args) => {
|
|
188
|
-
const [state, setState] = useState<TypeTabsStoryState>({
|
|
189
|
-
selected: "notifications",
|
|
190
|
-
tabs: [
|
|
191
|
-
{
|
|
192
|
-
id: "notifications",
|
|
193
|
-
text: "Notifications",
|
|
194
|
-
icon: "bell-outline",
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
id: "issues",
|
|
198
|
-
text: "Issues",
|
|
199
|
-
icon: "triangle-exclamation-outline",
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
id: "fun",
|
|
203
|
-
text: "Fun Tab",
|
|
204
|
-
icon: "x-twitter",
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
id: "drafts",
|
|
208
|
-
text: "Drafts",
|
|
209
|
-
icon: "paper-outline",
|
|
210
|
-
},
|
|
211
|
-
],
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
return (
|
|
215
|
-
<React.Fragment>
|
|
216
|
-
<Button
|
|
217
|
-
onClick={() =>
|
|
218
|
-
setState({
|
|
219
|
-
...state,
|
|
220
|
-
tabs: state.tabs?.slice(1),
|
|
221
|
-
})
|
|
222
|
-
}
|
|
223
|
-
>
|
|
224
|
-
Remove a tab <Icon name="x-outline" aria-hidden />
|
|
225
|
-
</Button>
|
|
226
|
-
<Tabs
|
|
227
|
-
selectedId={state.selected}
|
|
228
|
-
onSelect={(selected) =>
|
|
229
|
-
setState({
|
|
230
|
-
...state,
|
|
231
|
-
selected,
|
|
232
|
-
})
|
|
233
|
-
}
|
|
234
|
-
fullWidth={args.fullWidth}
|
|
235
|
-
>
|
|
236
|
-
{state.tabs?.map((tab) => (
|
|
237
|
-
<Tabs.Button key={tab.id} id={tab.id}>
|
|
238
|
-
<Icon name={tab.icon} mr="12px" aria-hidden />
|
|
239
|
-
<Text size="300" fontWeight="600">
|
|
240
|
-
{tab.text}
|
|
241
|
-
</Text>
|
|
242
|
-
</Tabs.Button>
|
|
243
|
-
))}
|
|
244
|
-
</Tabs>
|
|
245
|
-
|
|
246
|
-
{state.tabs?.map(
|
|
247
|
-
(tab) =>
|
|
248
|
-
state.selected === tab.id && (
|
|
249
|
-
<Tabs.Panel key={tab.id} id={tab.id}>
|
|
250
|
-
<Text mt="24px">{tab.text} panel content goes here.</Text>
|
|
251
|
-
</Tabs.Panel>
|
|
252
|
-
)
|
|
253
|
-
)}
|
|
254
|
-
</React.Fragment>
|
|
255
|
-
);
|
|
256
|
-
},
|
|
257
|
-
name: "Remove a tab",
|
|
258
|
-
};
|