@cloudscape-design/components 3.0.674 → 3.0.676
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/i18n/messages/all.all.js +1 -1
- package/i18n/messages/all.all.json +1 -1
- package/i18n/messages/all.de.js +1 -1
- package/i18n/messages/all.de.json +1 -1
- package/i18n/messages/all.en-GB.js +1 -1
- package/i18n/messages/all.en-GB.json +1 -1
- package/i18n/messages/all.en.js +1 -1
- package/i18n/messages/all.en.json +1 -1
- package/i18n/messages/all.es.js +1 -1
- package/i18n/messages/all.es.json +1 -1
- package/i18n/messages/all.fr.js +1 -1
- package/i18n/messages/all.fr.json +1 -1
- package/i18n/messages/all.id.js +1 -1
- package/i18n/messages/all.id.json +1 -1
- package/i18n/messages/all.it.js +1 -1
- package/i18n/messages/all.it.json +1 -1
- package/i18n/messages/all.ja.js +1 -1
- package/i18n/messages/all.ja.json +1 -1
- package/i18n/messages/all.ko.js +1 -1
- package/i18n/messages/all.ko.json +1 -1
- package/i18n/messages/all.pt-BR.js +1 -1
- package/i18n/messages/all.pt-BR.json +1 -1
- package/i18n/messages/all.tr.js +1 -1
- package/i18n/messages/all.tr.json +1 -1
- package/i18n/messages/all.zh-CN.js +1 -1
- package/i18n/messages/all.zh-CN.json +1 -1
- package/i18n/messages/all.zh-TW.js +1 -1
- package/i18n/messages/all.zh-TW.json +1 -1
- package/i18n/messages-types.d.ts +1 -0
- package/i18n/messages-types.d.ts.map +1 -1
- package/i18n/messages-types.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/manifest.json +1 -1
- package/internal/utils/scrollable-containers.js +3 -2
- package/internal/utils/scrollable-containers.js.map +1 -1
- package/package.json +1 -1
- package/popover/use-popover-position.js +3 -2
- package/popover/use-popover-position.js.map +1 -1
- package/tabs/interfaces.d.ts +36 -0
- package/tabs/interfaces.d.ts.map +1 -1
- package/tabs/interfaces.js.map +1 -1
- package/tabs/styles.css.js +25 -22
- package/tabs/styles.scoped.css +107 -77
- package/tabs/styles.selectors.js +25 -22
- package/tabs/tab-header-bar.d.ts.map +1 -1
- package/tabs/tab-header-bar.js +106 -17
- package/tabs/tab-header-bar.js.map +1 -1
- package/test-utils/dom/tabs/index.d.ts +38 -1
- package/test-utils/dom/tabs/index.js +53 -2
- package/test-utils/dom/tabs/index.js.map +1 -1
- package/test-utils/selectors/tabs/index.d.ts +38 -1
- package/test-utils/selectors/tabs/index.js +53 -2
- package/test-utils/selectors/tabs/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
package/tabs/styles.scoped.css
CHANGED
|
@@ -191,7 +191,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
191
191
|
SPDX-License-Identifier: Apache-2.0
|
|
192
192
|
*/
|
|
193
193
|
/* stylelint-disable selector-max-type */
|
|
194
|
-
.awsui_tabs-
|
|
194
|
+
.awsui_tabs-header_14rmt_8vbks_194:not(#\9) {
|
|
195
195
|
margin-block: 0;
|
|
196
196
|
margin-inline: 0;
|
|
197
197
|
padding-block: 0;
|
|
@@ -199,7 +199,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
199
199
|
display: flex;
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
.awsui_tabs-header-
|
|
202
|
+
.awsui_tabs-header-list_14rmt_8vbks_202:not(#\9) {
|
|
203
203
|
margin-block: 0;
|
|
204
204
|
margin-inline: 0;
|
|
205
205
|
padding-block: 0;
|
|
@@ -212,33 +212,33 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
212
212
|
-ms-overflow-style: none; /* Internet Explorer 10+ */
|
|
213
213
|
scrollbar-width: none; /* Firefox */
|
|
214
214
|
}
|
|
215
|
-
.awsui_tabs-header-
|
|
215
|
+
.awsui_tabs-header-list_14rmt_8vbks_202:not(#\9)::-webkit-scrollbar {
|
|
216
216
|
display: none; /* Safari and Chrome */
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
.awsui_pagination-
|
|
219
|
+
.awsui_pagination-button_14rmt_8vbks_219:not(#\9) {
|
|
220
220
|
margin-block: var(--space-scaled-s-aqzyko, 12px);
|
|
221
221
|
margin-inline: 0;
|
|
222
222
|
padding-block: 0;
|
|
223
223
|
padding-inline: var(--space-xxs-p8yyaw, 4px);
|
|
224
224
|
display: flex;
|
|
225
225
|
}
|
|
226
|
-
.awsui_pagination-button-
|
|
226
|
+
.awsui_pagination-button-left_14rmt_8vbks_226:not(#\9) {
|
|
227
227
|
border-inline-end: var(--border-divider-section-width-1061zr, 1px) solid var(--color-border-control-disabled-bv2kkn, #d1d5db);
|
|
228
228
|
}
|
|
229
|
-
.awsui_pagination-button-left-
|
|
229
|
+
.awsui_pagination-button-left-scrollable_14rmt_8vbks_229:not(#\9) {
|
|
230
230
|
z-index: 1;
|
|
231
231
|
box-shadow: 5px 0px 4px -3px var(--color-border-tabs-shadow-w5xpb4, rgba(0, 7, 22, 0.12)), 1px 0px 0px 0px var(--color-border-tabs-shadow-w5xpb4, rgba(0, 7, 22, 0.12));
|
|
232
232
|
}
|
|
233
|
-
.awsui_pagination-button-
|
|
233
|
+
.awsui_pagination-button-right_14rmt_8vbks_233:not(#\9) {
|
|
234
234
|
border-inline-start: var(--border-divider-section-width-1061zr, 1px) solid var(--color-border-control-disabled-bv2kkn, #d1d5db);
|
|
235
235
|
}
|
|
236
|
-
.awsui_pagination-button-right-
|
|
236
|
+
.awsui_pagination-button-right-scrollable_14rmt_8vbks_236:not(#\9) {
|
|
237
237
|
z-index: 1;
|
|
238
238
|
box-shadow: -5px 0px 4px -3px var(--color-border-tabs-shadow-w5xpb4, rgba(0, 7, 22, 0.12)), -1px 0px 0px 0 var(--color-border-tabs-shadow-w5xpb4, rgba(0, 7, 22, 0.12));
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
.awsui_tabs-
|
|
241
|
+
.awsui_tabs-tab_14rmt_8vbks_241:not(#\9) {
|
|
242
242
|
list-style: none;
|
|
243
243
|
padding-block: 0;
|
|
244
244
|
padding-inline: 0;
|
|
@@ -246,34 +246,92 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
246
246
|
display: flex;
|
|
247
247
|
max-inline-size: calc(90% - var(--space-l-t419sm, 20px));
|
|
248
248
|
}
|
|
249
|
-
.awsui_tabs-tab_14rmt_jrbtu_241 > button:not(#\9) {
|
|
250
|
-
background-color: transparent;
|
|
251
|
-
}
|
|
252
249
|
|
|
253
|
-
.awsui_tabs-tab-
|
|
250
|
+
.awsui_tabs-tab-label_14rmt_8vbks_250:not(#\9) {
|
|
254
251
|
display: flex;
|
|
255
252
|
align-items: center;
|
|
253
|
+
padding-inline: var(--space-xs-zb16t3, 8px);
|
|
256
254
|
padding-block: var(--space-scaled-2x-xxs-7v8ivz, 4px);
|
|
257
|
-
padding-inline: var(--space-l-t419sm, 20px);
|
|
258
255
|
text-align: start;
|
|
259
256
|
position: relative;
|
|
260
257
|
min-inline-size: 0;
|
|
261
258
|
word-break: break-word;
|
|
262
259
|
}
|
|
263
260
|
|
|
264
|
-
.awsui_tabs-
|
|
261
|
+
.awsui_tabs-tab-dismiss_14rmt_8vbks_261:not(#\9),
|
|
262
|
+
.awsui_tabs-tab-action_14rmt_8vbks_262:not(#\9) {
|
|
263
|
+
/* Used as a selector for tests */
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.awsui_tabs-tab-header-container_14rmt_8vbks_266:not(#\9) {
|
|
267
|
+
position: relative;
|
|
268
|
+
border-block: var(--border-divider-section-width-1061zr, 1px) solid transparent;
|
|
269
|
+
border-inline: var(--border-divider-section-width-1061zr, 1px) solid transparent;
|
|
270
|
+
padding-inline: var(--space-xs-zb16t3, 8px);
|
|
271
|
+
display: flex;
|
|
272
|
+
align-items: stretch;
|
|
273
|
+
}
|
|
274
|
+
.awsui_tabs-tab-header-container_14rmt_8vbks_266:not(#\9), .awsui_tabs-tab-header-container_14rmt_8vbks_266 > button:not(#\9) {
|
|
275
|
+
background-color: transparent;
|
|
276
|
+
}
|
|
277
|
+
.awsui_tabs-tab-header-container_14rmt_8vbks_266 > .awsui_tabs-tab-dismiss_14rmt_8vbks_261:not(#\9), .awsui_tabs-tab-header-container_14rmt_8vbks_266 > .awsui_tabs-tab-action_14rmt_8vbks_262:not(#\9) {
|
|
278
|
+
display: flex;
|
|
279
|
+
align-items: center;
|
|
280
|
+
}
|
|
281
|
+
.awsui_tabs-tab-header-container_14rmt_8vbks_266.awsui_refresh_14rmt_8vbks_281 > span:not(#\9):first-of-type {
|
|
282
|
+
margin-inline-start: calc(-1 * var(--space-scaled-xs-26e2du, 8px));
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.awsui_tabs-tab-header-container_14rmt_8vbks_266:not(#\9):not(.awsui_tabs-tab-disabled_14rmt_8vbks_285):after {
|
|
286
|
+
content: "";
|
|
287
|
+
position: absolute;
|
|
288
|
+
inset-inline-start: 0;
|
|
289
|
+
inline-size: calc(100% - 1px);
|
|
290
|
+
inset-block-end: calc(-1 * var(--border-divider-section-width-1061zr, 1px));
|
|
291
|
+
block-size: var(--border-active-width-9dmqf4, 4px);
|
|
292
|
+
border-start-start-radius: var(--border-radius-tabs-focus-ring-1q0rjo, 20px);
|
|
293
|
+
border-start-end-radius: var(--border-radius-tabs-focus-ring-1q0rjo, 20px);
|
|
294
|
+
border-end-start-radius: var(--border-radius-tabs-focus-ring-1q0rjo, 20px);
|
|
295
|
+
border-end-end-radius: var(--border-radius-tabs-focus-ring-1q0rjo, 20px);
|
|
296
|
+
background: var(--color-border-tabs-underline-f1qo5r, #0972d3);
|
|
297
|
+
opacity: 0;
|
|
298
|
+
}
|
|
299
|
+
.awsui_tabs-tab-header-container_14rmt_8vbks_266:not(#\9):not(.awsui_tabs-tab-disabled_14rmt_8vbks_285).awsui_refresh_14rmt_8vbks_281:after {
|
|
300
|
+
transition: opacity var(--motion-duration-refresh-only-medium-nf6485, 165ms) var(--motion-easing-refresh-only-c-vg1m9h, cubic-bezier(0.84, 0, 0.16, 1));
|
|
301
|
+
}
|
|
302
|
+
@media (prefers-reduced-motion: reduce) {
|
|
303
|
+
.awsui_tabs-tab-header-container_14rmt_8vbks_266:not(#\9):not(.awsui_tabs-tab-disabled_14rmt_8vbks_285).awsui_refresh_14rmt_8vbks_281:after {
|
|
304
|
+
animation: none;
|
|
305
|
+
transition: none;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
.awsui-motion-disabled .awsui_tabs-tab-header-container_14rmt_8vbks_266:not(#\9):not(.awsui_tabs-tab-disabled_14rmt_8vbks_285).awsui_refresh_14rmt_8vbks_281:after, .awsui-mode-entering .awsui_tabs-tab-header-container_14rmt_8vbks_266:not(#\9):not(.awsui_tabs-tab-disabled_14rmt_8vbks_285).awsui_refresh_14rmt_8vbks_281:after {
|
|
309
|
+
animation: none;
|
|
310
|
+
transition: none;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.awsui_tabs-tab_14rmt_8vbks_241:not(#\9):not(:last-child) > .awsui_tabs-tab-header-container_14rmt_8vbks_266 {
|
|
265
314
|
margin-inline-end: calc(-1 * var(--border-divider-section-width-1061zr, 1px));
|
|
315
|
+
}
|
|
316
|
+
.awsui_tabs-tab_14rmt_8vbks_241:not(#\9):not(:last-child) > .awsui_tabs-tab-header-container_14rmt_8vbks_266:before {
|
|
317
|
+
content: "";
|
|
318
|
+
position: absolute;
|
|
266
319
|
border-inline-end: var(--border-divider-section-width-1061zr, 1px) solid var(--color-border-tabs-divider-6vpso4, #b6bec9);
|
|
320
|
+
inset: calc(var(--space-scaled-s-aqzyko, 12px)) 0;
|
|
321
|
+
opacity: 1;
|
|
322
|
+
}
|
|
323
|
+
.awsui_tabs-tab_14rmt_8vbks_241:not(#\9):not(:last-child) > .awsui_tabs-tab-header-container_14rmt_8vbks_266.awsui_refresh_14rmt_8vbks_281:before {
|
|
324
|
+
inset: calc(var(--space-scaled-s-aqzyko, 12px) - var(--border-active-width-9dmqf4, 4px)) 0;
|
|
267
325
|
}
|
|
268
326
|
|
|
269
|
-
.awsui_tabs-tab-
|
|
327
|
+
.awsui_tabs-tab-link_14rmt_8vbks_327:not(#\9) {
|
|
270
328
|
position: relative;
|
|
271
329
|
display: flex;
|
|
272
330
|
align-items: stretch;
|
|
273
331
|
text-decoration: none;
|
|
274
332
|
cursor: pointer;
|
|
275
|
-
padding-block-start: calc(var(--space-scaled-s-aqzyko, 12px) -
|
|
276
|
-
padding-block-end: var(--space-scaled-s-aqzyko, 12px);
|
|
333
|
+
padding-block-start: calc(var(--space-scaled-s-aqzyko, 12px) - 2px);
|
|
334
|
+
padding-block-end: calc(var(--space-scaled-s-aqzyko, 12px) - 1px);
|
|
277
335
|
padding-inline: 0;
|
|
278
336
|
margin-block-start: 1px;
|
|
279
337
|
border-block: var(--border-divider-section-width-1061zr, 1px) solid transparent;
|
|
@@ -282,29 +340,32 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
282
340
|
line-height: var(--font-tabs-line-height-dzo7k3, 20px);
|
|
283
341
|
font-weight: var(--font-wayfinding-link-active-weight-rbmzei, 700);
|
|
284
342
|
color: var(--color-text-interactive-default-lnx6lk, #414d5c);
|
|
343
|
+
padding-inline-start: calc(var(--space-xxs-p8yyaw, 4px) - 1px);
|
|
344
|
+
padding-inline-end: var(--space-xxs-p8yyaw, 4px);
|
|
285
345
|
-webkit-font-smoothing: var(--font-smoothing-webkit-m8nc84, antialiased);
|
|
286
346
|
-moz-osx-font-smoothing: var(--font-smoothing-moz-osx-foywby, grayscale);
|
|
287
347
|
}
|
|
288
|
-
.awsui_tabs-tab-
|
|
348
|
+
.awsui_tabs-tab-link_14rmt_8vbks_327.awsui_refresh_14rmt_8vbks_281:not(#\9) {
|
|
289
349
|
padding-block-start: calc(var(--space-static-xs-7sfb63, 8px) - 1px);
|
|
290
|
-
padding-block-end: var(--space-static-xs-7sfb63, 8px);
|
|
291
|
-
|
|
350
|
+
padding-block-end: calc(var(--space-static-xs-7sfb63, 8px) - 1px);
|
|
351
|
+
margin-block-start: 0;
|
|
292
352
|
}
|
|
293
|
-
.awsui_tabs-tab-
|
|
353
|
+
.awsui_tabs-tab-link_14rmt_8vbks_327:not(#\9):hover {
|
|
294
354
|
color: var(--color-text-accent-n2acxv, #0972d3);
|
|
295
355
|
}
|
|
296
|
-
.awsui_tabs-tab-
|
|
356
|
+
.awsui_tabs-tab-link_14rmt_8vbks_327:not(#\9):focus {
|
|
297
357
|
outline: none;
|
|
298
358
|
}
|
|
299
|
-
body[data-awsui-focus-visible=true] .awsui_tabs-tab-
|
|
359
|
+
body[data-awsui-focus-visible=true] .awsui_tabs-tab-link_14rmt_8vbks_327:not(#\9):focus {
|
|
300
360
|
z-index: 1;
|
|
301
361
|
position: relative;
|
|
362
|
+
border-inline-end-color: transparent;
|
|
302
363
|
}
|
|
303
|
-
body[data-awsui-focus-visible=true] .awsui_tabs-tab-
|
|
364
|
+
body[data-awsui-focus-visible=true] .awsui_tabs-tab-link_14rmt_8vbks_327:not(#\9):focus {
|
|
304
365
|
outline: 2px dotted transparent;
|
|
305
366
|
outline-offset: calc(var(--space-tabs-focus-outline-gutter-xm37ly, -8px) - 1px);
|
|
306
367
|
}
|
|
307
|
-
body[data-awsui-focus-visible=true] .awsui_tabs-tab-
|
|
368
|
+
body[data-awsui-focus-visible=true] .awsui_tabs-tab-link_14rmt_8vbks_327:not(#\9):focus::before {
|
|
308
369
|
content: " ";
|
|
309
370
|
display: block;
|
|
310
371
|
position: absolute;
|
|
@@ -318,75 +379,44 @@ body[data-awsui-focus-visible=true] .awsui_tabs-tab-link_14rmt_jrbtu_269:not(#\9
|
|
|
318
379
|
border-end-end-radius: var(--border-radius-control-default-focus-ring-u8zbsz, 4px);
|
|
319
380
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-b2ntyl, #0972d3);
|
|
320
381
|
}
|
|
321
|
-
body[data-awsui-focus-visible=true] .awsui_tabs-tab-link_14rmt_jrbtu_269:not(#\9):focus > a > .awsui_tabs-tab-label_14rmt_jrbtu_253, body[data-awsui-focus-visible=true] .awsui_tabs-tab-link_14rmt_jrbtu_269:not(#\9):focus > button > .awsui_tabs-tab-label_14rmt_jrbtu_253 {
|
|
322
|
-
border-inline-end-color: transparent;
|
|
323
|
-
}
|
|
324
382
|
|
|
325
|
-
.awsui_tabs-
|
|
383
|
+
.awsui_tabs-tab_14rmt_8vbks_241:not(#\9):first-child {
|
|
326
384
|
margin-inline-start: 1px;
|
|
327
385
|
}
|
|
328
|
-
.awsui_tabs-
|
|
329
|
-
padding-inline-start: calc(var(--space-
|
|
386
|
+
.awsui_tabs-tab_14rmt_8vbks_241:not(#\9):first-child > .awsui_tabs-tab-header-container_14rmt_8vbks_266 {
|
|
387
|
+
padding-inline-start: calc(var(--space-xs-zb16t3, 8px) - 1px);
|
|
330
388
|
}
|
|
331
389
|
|
|
332
|
-
.awsui_tabs-
|
|
390
|
+
.awsui_tabs-tab_14rmt_8vbks_241:not(#\9):last-child {
|
|
333
391
|
margin-inline-end: 1px;
|
|
334
392
|
}
|
|
335
|
-
.awsui_tabs-
|
|
336
|
-
padding-inline-end: calc(var(--space-
|
|
393
|
+
.awsui_tabs-tab_14rmt_8vbks_241:not(#\9):last-child > .awsui_tabs-tab-header-container_14rmt_8vbks_266 {
|
|
394
|
+
padding-inline-end: calc(var(--space-xs-zb16t3, 8px) - 1px);
|
|
337
395
|
}
|
|
338
396
|
|
|
339
|
-
.awsui_tabs-tab-
|
|
397
|
+
.awsui_tabs-tab-disabled_14rmt_8vbks_285:not(#\9), .awsui_tabs-tab-disabled_14rmt_8vbks_285:not(#\9):hover {
|
|
340
398
|
pointer-events: none;
|
|
341
399
|
cursor: default;
|
|
342
400
|
color: var(--color-text-interactive-disabled-z7a3t4, #9ba7b6);
|
|
343
401
|
font-weight: var(--font-tabs-disabled-weight-1xcs5l, 700);
|
|
344
402
|
}
|
|
345
403
|
|
|
346
|
-
.awsui_tabs-tab-
|
|
347
|
-
content: "";
|
|
348
|
-
position: absolute;
|
|
349
|
-
inset-inline-start: 0;
|
|
350
|
-
inline-size: 100%;
|
|
351
|
-
inset-block-end: calc(-1 * var(--border-divider-section-width-1061zr, 1px));
|
|
352
|
-
block-size: var(--border-active-width-9dmqf4, 4px);
|
|
353
|
-
border-start-start-radius: var(--border-radius-tabs-focus-ring-1q0rjo, 20px);
|
|
354
|
-
border-start-end-radius: var(--border-radius-tabs-focus-ring-1q0rjo, 20px);
|
|
355
|
-
border-end-start-radius: var(--border-radius-tabs-focus-ring-1q0rjo, 20px);
|
|
356
|
-
border-end-end-radius: var(--border-radius-tabs-focus-ring-1q0rjo, 20px);
|
|
357
|
-
background: var(--color-border-tabs-underline-f1qo5r, #0972d3);
|
|
358
|
-
opacity: 0;
|
|
359
|
-
}
|
|
360
|
-
.awsui_tabs-tab-link_14rmt_jrbtu_269:not(#\9):not(.awsui_tabs-tab-disabled_14rmt_jrbtu_339).awsui_refresh_14rmt_jrbtu_288:after {
|
|
361
|
-
transition: opacity var(--motion-duration-refresh-only-medium-nf6485, 165ms) var(--motion-easing-refresh-only-c-vg1m9h, cubic-bezier(0.84, 0, 0.16, 1));
|
|
362
|
-
}
|
|
363
|
-
@media (prefers-reduced-motion: reduce) {
|
|
364
|
-
.awsui_tabs-tab-link_14rmt_jrbtu_269:not(#\9):not(.awsui_tabs-tab-disabled_14rmt_jrbtu_339).awsui_refresh_14rmt_jrbtu_288:after {
|
|
365
|
-
animation: none;
|
|
366
|
-
transition: none;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
.awsui-motion-disabled .awsui_tabs-tab-link_14rmt_jrbtu_269:not(#\9):not(.awsui_tabs-tab-disabled_14rmt_jrbtu_339).awsui_refresh_14rmt_jrbtu_288:after, .awsui-mode-entering .awsui_tabs-tab-link_14rmt_jrbtu_269:not(#\9):not(.awsui_tabs-tab-disabled_14rmt_jrbtu_339).awsui_refresh_14rmt_jrbtu_288:after {
|
|
370
|
-
animation: none;
|
|
371
|
-
transition: none;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
.awsui_tabs-tab-active_14rmt_jrbtu_374:not(#\9):not(.awsui_tabs-tab-disabled_14rmt_jrbtu_339) {
|
|
404
|
+
.awsui_tabs-tab-active_14rmt_8vbks_404:not(#\9):not(.awsui_tabs-tab-disabled_14rmt_8vbks_285) {
|
|
375
405
|
color: var(--color-text-accent-n2acxv, #0972d3);
|
|
376
406
|
}
|
|
377
|
-
.awsui_tabs-tab-
|
|
407
|
+
.awsui_tabs-tab-active_14rmt_8vbks_404:not(#\9):not(.awsui_tabs-tab-disabled_14rmt_8vbks_285):after {
|
|
378
408
|
opacity: 1;
|
|
379
409
|
}
|
|
380
410
|
|
|
381
|
-
.awsui_tabs-header-with-
|
|
411
|
+
.awsui_tabs-header-with-divider_14rmt_8vbks_411:not(#\9) {
|
|
382
412
|
border-block-end: var(--border-divider-section-width-1061zr, 1px) solid var(--color-border-tabs-divider-6vpso4, #b6bec9);
|
|
383
413
|
}
|
|
384
414
|
|
|
385
|
-
.
|
|
415
|
+
.awsui_root_14rmt_8vbks_415:not(#\9) {
|
|
386
416
|
/* used in test-utils or tests */
|
|
387
417
|
}
|
|
388
418
|
|
|
389
|
-
.
|
|
419
|
+
.awsui_tabs_14rmt_8vbks_194:not(#\9) {
|
|
390
420
|
border-collapse: separate;
|
|
391
421
|
border-spacing: 0;
|
|
392
422
|
box-sizing: border-box;
|
|
@@ -424,21 +454,21 @@ body[data-awsui-focus-visible=true] .awsui_tabs-tab-link_14rmt_jrbtu_269:not(#\9
|
|
|
424
454
|
inline-size: 100%;
|
|
425
455
|
}
|
|
426
456
|
|
|
427
|
-
.awsui_tabs-
|
|
457
|
+
.awsui_tabs-content_14rmt_8vbks_456:not(#\9) {
|
|
428
458
|
display: none;
|
|
429
459
|
}
|
|
430
460
|
|
|
431
|
-
.awsui_fit-
|
|
461
|
+
.awsui_fit-height_14rmt_8vbks_460:not(#\9) {
|
|
432
462
|
display: flex;
|
|
433
463
|
flex-direction: column;
|
|
434
464
|
block-size: 100%;
|
|
435
465
|
}
|
|
436
466
|
|
|
437
|
-
.awsui_tabs-content-
|
|
467
|
+
.awsui_tabs-content-active_14rmt_8vbks_466:not(#\9) {
|
|
438
468
|
display: block;
|
|
439
469
|
flex: 1;
|
|
440
470
|
}
|
|
441
|
-
body[data-awsui-focus-visible=true] .awsui_tabs-content-
|
|
471
|
+
body[data-awsui-focus-visible=true] .awsui_tabs-content-active_14rmt_8vbks_466:not(#\9):focus {
|
|
442
472
|
outline: 2px dotted transparent;
|
|
443
473
|
outline-offset: 2px;
|
|
444
474
|
border-start-start-radius: var(--border-radius-container-wqv1zi, 16px);
|
|
@@ -448,23 +478,23 @@ body[data-awsui-focus-visible=true] .awsui_tabs-content-active_14rmt_jrbtu_436:n
|
|
|
448
478
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-b2ntyl, #0972d3);
|
|
449
479
|
}
|
|
450
480
|
|
|
451
|
-
.awsui_tabs-content-
|
|
481
|
+
.awsui_tabs-content-wrapper_14rmt_8vbks_480.awsui_with-paddings_14rmt_8vbks_480 > .awsui_tabs-content_14rmt_8vbks_456:not(#\9) {
|
|
452
482
|
padding-block: var(--space-scaled-m-mo5yse, 16px);
|
|
453
483
|
padding-inline: 0;
|
|
454
484
|
}
|
|
455
|
-
.awsui_fit-
|
|
485
|
+
.awsui_fit-height_14rmt_8vbks_460 > .awsui_tabs-content-wrapper_14rmt_8vbks_480:not(#\9) {
|
|
456
486
|
flex: 1;
|
|
457
487
|
display: flex;
|
|
458
488
|
flex-direction: column;
|
|
459
489
|
overflow: auto;
|
|
460
490
|
}
|
|
461
491
|
|
|
462
|
-
.awsui_fit-
|
|
492
|
+
.awsui_fit-height_14rmt_8vbks_460 > .awsui_tabs-content-wrapper_14rmt_8vbks_480 > .awsui_tabs-container-content-wrapper_14rmt_8vbks_491:not(#\9) {
|
|
463
493
|
block-size: 100%;
|
|
464
494
|
display: flex;
|
|
465
495
|
flex-direction: column;
|
|
466
496
|
}
|
|
467
|
-
.awsui_tabs-container-content-
|
|
497
|
+
.awsui_tabs-container-content-wrapper_14rmt_8vbks_491.awsui_with-paddings_14rmt_8vbks_480 > .awsui_tabs-content_14rmt_8vbks_456:not(#\9) {
|
|
468
498
|
padding-block-start: var(--space-tabs-content-top-dedu0k, 12px);
|
|
469
499
|
padding-block-end: var(--space-scaled-l-0hpmd7, 20px);
|
|
470
500
|
padding-inline: var(--space-container-horizontal-wfukh3, 20px);
|
package/tabs/styles.selectors.js
CHANGED
|
@@ -2,27 +2,30 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"tabs-header": "awsui_tabs-
|
|
6
|
-
"tabs-header-list": "awsui_tabs-header-
|
|
7
|
-
"pagination-button": "awsui_pagination-
|
|
8
|
-
"pagination-button-left": "awsui_pagination-button-
|
|
9
|
-
"pagination-button-left-scrollable": "awsui_pagination-button-left-
|
|
10
|
-
"pagination-button-right": "awsui_pagination-button-
|
|
11
|
-
"pagination-button-right-scrollable": "awsui_pagination-button-right-
|
|
12
|
-
"tabs-tab": "awsui_tabs-
|
|
13
|
-
"tabs-tab-label": "awsui_tabs-tab-
|
|
14
|
-
"tabs-tab-
|
|
15
|
-
"
|
|
16
|
-
"tabs-tab-
|
|
17
|
-
"
|
|
18
|
-
"tabs-
|
|
19
|
-
"
|
|
20
|
-
"tabs": "
|
|
21
|
-
"tabs-
|
|
22
|
-
"
|
|
23
|
-
"tabs
|
|
24
|
-
"tabs-content
|
|
25
|
-
"
|
|
26
|
-
"tabs-
|
|
5
|
+
"tabs-header": "awsui_tabs-header_14rmt_8vbks_194",
|
|
6
|
+
"tabs-header-list": "awsui_tabs-header-list_14rmt_8vbks_202",
|
|
7
|
+
"pagination-button": "awsui_pagination-button_14rmt_8vbks_219",
|
|
8
|
+
"pagination-button-left": "awsui_pagination-button-left_14rmt_8vbks_226",
|
|
9
|
+
"pagination-button-left-scrollable": "awsui_pagination-button-left-scrollable_14rmt_8vbks_229",
|
|
10
|
+
"pagination-button-right": "awsui_pagination-button-right_14rmt_8vbks_233",
|
|
11
|
+
"pagination-button-right-scrollable": "awsui_pagination-button-right-scrollable_14rmt_8vbks_236",
|
|
12
|
+
"tabs-tab": "awsui_tabs-tab_14rmt_8vbks_241",
|
|
13
|
+
"tabs-tab-label": "awsui_tabs-tab-label_14rmt_8vbks_250",
|
|
14
|
+
"tabs-tab-dismiss": "awsui_tabs-tab-dismiss_14rmt_8vbks_261",
|
|
15
|
+
"tabs-tab-action": "awsui_tabs-tab-action_14rmt_8vbks_262",
|
|
16
|
+
"tabs-tab-header-container": "awsui_tabs-tab-header-container_14rmt_8vbks_266",
|
|
17
|
+
"refresh": "awsui_refresh_14rmt_8vbks_281",
|
|
18
|
+
"tabs-tab-disabled": "awsui_tabs-tab-disabled_14rmt_8vbks_285",
|
|
19
|
+
"tabs-tab-link": "awsui_tabs-tab-link_14rmt_8vbks_327",
|
|
20
|
+
"tabs-tab-active": "awsui_tabs-tab-active_14rmt_8vbks_404",
|
|
21
|
+
"tabs-header-with-divider": "awsui_tabs-header-with-divider_14rmt_8vbks_411",
|
|
22
|
+
"root": "awsui_root_14rmt_8vbks_415",
|
|
23
|
+
"tabs": "awsui_tabs_14rmt_8vbks_194",
|
|
24
|
+
"tabs-content": "awsui_tabs-content_14rmt_8vbks_456",
|
|
25
|
+
"fit-height": "awsui_fit-height_14rmt_8vbks_460",
|
|
26
|
+
"tabs-content-active": "awsui_tabs-content-active_14rmt_8vbks_466",
|
|
27
|
+
"tabs-content-wrapper": "awsui_tabs-content-wrapper_14rmt_8vbks_480",
|
|
28
|
+
"with-paddings": "awsui_with-paddings_14rmt_8vbks_480",
|
|
29
|
+
"tabs-container-content-wrapper": "awsui_tabs-container-content-wrapper_14rmt_8vbks_491"
|
|
27
30
|
};
|
|
28
31
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-header-bar.d.ts","sourceRoot":"","sources":["../../../src/tabs/tab-header-bar.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"tab-header-bar.d.ts","sourceRoot":"","sources":["../../../src/tabs/tab-header-bar.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AA8CzC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC,YAAY,KAAK,IAAI,CAAC;IACzD,WAAW,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IACtC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACxB,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC;CACrC;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,OAAO,EACP,WAAW,EACX,SAAS,EACT,cAAc,EACd,WAAW,GACZ,EAAE,iBAAiB,eA6XnB;AAqBD,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,UAEzF"}
|
package/tabs/tab-header-bar.js
CHANGED
|
@@ -14,8 +14,11 @@ import { useContainerQuery } from '@cloudscape-design/component-toolkit';
|
|
|
14
14
|
import { SingleTabStopNavigationProvider, useSingleTabStopNavigation, } from '../internal/context/single-tab-stop-navigation-context';
|
|
15
15
|
import { useMergeRefs } from '../internal/hooks/use-merge-refs';
|
|
16
16
|
import { getAllFocusables } from '../internal/components/focus-lock/utils';
|
|
17
|
-
|
|
18
|
-
const
|
|
17
|
+
import { nodeBelongs } from '../internal/utils/node-belongs';
|
|
18
|
+
const tabSelector = `.${styles['tabs-tab-link']}`;
|
|
19
|
+
function dismissButton(dismissLabel, dismissDisabled, onDismiss) {
|
|
20
|
+
return (React.createElement(InternalButton, { onClick: onDismiss, variant: "icon", iconName: "close", formAction: "none", ariaLabel: dismissLabel, disabled: dismissDisabled }));
|
|
21
|
+
}
|
|
19
22
|
export function TabHeaderBar({ onChange, activeTabId, tabs, variant, idNamespace, ariaLabel, ariaLabelledby, i18nStrings, }) {
|
|
20
23
|
const headerBarRef = useRef(null);
|
|
21
24
|
const activeTabHeaderRef = useRef(null);
|
|
@@ -29,6 +32,16 @@ export function TabHeaderBar({ onChange, activeTabId, tabs, variant, idNamespace
|
|
|
29
32
|
const [horizontalOverflow, setHorizontalOverflow] = useState(false);
|
|
30
33
|
const [inlineStartOverflow, setInlineStartOverflow] = useState(false);
|
|
31
34
|
const [inlineEndOverflow, setInlineEndOverflow] = useState(false);
|
|
35
|
+
const [previousActiveTabId, setPreviousActiveTabId] = useState(activeTabId);
|
|
36
|
+
const hasActionOrDismissible = tabs.some(tab => tab.action || tab.dismissible);
|
|
37
|
+
const tabActionAttributes = hasActionOrDismissible
|
|
38
|
+
? {
|
|
39
|
+
role: 'application',
|
|
40
|
+
'aria-roledescription': i18n('i18nStrings.tabsWithActionsAriaRoleDescription', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.tabsWithActionsAriaRoleDescription),
|
|
41
|
+
}
|
|
42
|
+
: {
|
|
43
|
+
role: 'tablist',
|
|
44
|
+
};
|
|
32
45
|
useEffect(() => {
|
|
33
46
|
if (headerBarRef.current) {
|
|
34
47
|
setHorizontalOverflow(hasHorizontalOverflow(headerBarRef.current, inlineStartOverflowButton));
|
|
@@ -41,8 +54,8 @@ export function TabHeaderBar({ onChange, activeTabId, tabs, variant, idNamespace
|
|
|
41
54
|
return;
|
|
42
55
|
}
|
|
43
56
|
const activeTabRef = tabRefs.current.get(activeTabId);
|
|
44
|
-
if (activeTabRef &&
|
|
45
|
-
scrollIntoView(activeTabRef
|
|
57
|
+
if (activeTabRef && headerBarRef.current) {
|
|
58
|
+
scrollIntoView(activeTabRef, headerBarRef.current, smooth);
|
|
46
59
|
}
|
|
47
60
|
};
|
|
48
61
|
useEffect(() => {
|
|
@@ -99,8 +112,23 @@ export function TabHeaderBar({ onChange, activeTabId, tabs, variant, idNamespace
|
|
|
99
112
|
return null;
|
|
100
113
|
}
|
|
101
114
|
const tabElements = Array.from(containerObjectRef.current.querySelectorAll(tabSelector));
|
|
115
|
+
const tabAriaSelector = hasActionOrDismissible ? '[aria-expanded="true"]' : '[aria-selected="true"]';
|
|
116
|
+
const activeTabSelector = `${tabSelector}${tabAriaSelector}`;
|
|
102
117
|
return (_b = (_a = tabElements.find(tab => tab.matches(activeTabSelector))) !== null && _a !== void 0 ? _a : tabElements.find(tab => !tab.disabled)) !== null && _b !== void 0 ? _b : null;
|
|
103
118
|
}
|
|
119
|
+
function onUnregisterFocusable(focusableElement) {
|
|
120
|
+
const isUnregisteringFocusedNode = nodeBelongs(focusableElement, document.activeElement);
|
|
121
|
+
const isFocusableActionOrDismissible = !focusableElement.classList.contains(styles['tabs-tab-link']);
|
|
122
|
+
if (isUnregisteringFocusedNode && !isFocusableActionOrDismissible) {
|
|
123
|
+
// Wait for unmounted node to get removed from the DOM.
|
|
124
|
+
requestAnimationFrame(() => {
|
|
125
|
+
var _a;
|
|
126
|
+
const nextFocusTarget = (_a = navigationAPI.current) === null || _a === void 0 ? void 0 : _a.getFocusTarget();
|
|
127
|
+
const tabLinkButton = nextFocusTarget === null || nextFocusTarget === void 0 ? void 0 : nextFocusTarget.querySelector(`.${styles['tabs-tab-link']}`);
|
|
128
|
+
tabLinkButton === null || tabLinkButton === void 0 ? void 0 : tabLinkButton.focus();
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
104
132
|
useEffect(() => {
|
|
105
133
|
var _a;
|
|
106
134
|
(_a = navigationAPI.current) === null || _a === void 0 ? void 0 : _a.updateFocusTarget();
|
|
@@ -114,9 +142,19 @@ export function TabHeaderBar({ onChange, activeTabId, tabs, variant, idNamespace
|
|
|
114
142
|
(_a = navigationAPI.current) === null || _a === void 0 ? void 0 : _a.updateFocusTarget();
|
|
115
143
|
}
|
|
116
144
|
function onKeyDown(event) {
|
|
117
|
-
|
|
118
|
-
const focusTarget = (_a = navigationAPI.current) === null || _a === void 0 ? void 0 : _a.getFocusTarget();
|
|
145
|
+
const focusTarget = document.activeElement;
|
|
119
146
|
const specialKeys = [KeyCode.right, KeyCode.left, KeyCode.end, KeyCode.home, KeyCode.pageUp, KeyCode.pageDown];
|
|
147
|
+
const isActionOpen = document.querySelector(`.${styles['tabs-tab-action']} [aria-expanded="true"]`);
|
|
148
|
+
const isDismissOrActionFocused = !(focusTarget === null || focusTarget === void 0 ? void 0 : focusTarget.classList.contains(styles['tabs-tab-link']));
|
|
149
|
+
if (isActionOpen) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (event.key === 'Tab' && !event.shiftKey && isDismissOrActionFocused) {
|
|
153
|
+
event.preventDefault();
|
|
154
|
+
const panelId = `${idNamespace}-${activeTabId}-panel`;
|
|
155
|
+
const panel = document.getElementById(panelId);
|
|
156
|
+
panel === null || panel === void 0 ? void 0 : panel.focus();
|
|
157
|
+
}
|
|
120
158
|
if (hasModifierKeys(event) || specialKeys.indexOf(event.keyCode) === -1) {
|
|
121
159
|
return;
|
|
122
160
|
}
|
|
@@ -125,7 +163,7 @@ export function TabHeaderBar({ onChange, activeTabId, tabs, variant, idNamespace
|
|
|
125
163
|
}
|
|
126
164
|
event.preventDefault();
|
|
127
165
|
const focusables = getFocusablesFrom(containerObjectRef.current);
|
|
128
|
-
const activeIndex = focusables.indexOf(
|
|
166
|
+
const activeIndex = document.activeElement instanceof HTMLElement ? focusables.indexOf(document.activeElement) : -1;
|
|
129
167
|
handleKey(event, {
|
|
130
168
|
onHome: () => focusElement(focusables[0]),
|
|
131
169
|
onEnd: () => focusElement(focusables[focusables.length - 1]),
|
|
@@ -140,8 +178,10 @@ export function TabHeaderBar({ onChange, activeTabId, tabs, variant, idNamespace
|
|
|
140
178
|
element.focus();
|
|
141
179
|
// If focusable element is a tab - fire the onChange for it.
|
|
142
180
|
const tabsById = tabs.reduce((map, tab) => map.set(tab.id, tab), new Map());
|
|
143
|
-
for (const [tabId,
|
|
144
|
-
|
|
181
|
+
for (const [tabId, focusTargetTabTriggerElement] of tabRefs.current.entries()) {
|
|
182
|
+
const focusTargetTabLabelElement = focusTargetTabTriggerElement === null || focusTargetTabTriggerElement === void 0 ? void 0 : focusTargetTabTriggerElement.querySelector(`.${styles['tabs-tab-link']}`);
|
|
183
|
+
if (tabId !== activeTabId && focusTargetTabLabelElement === element) {
|
|
184
|
+
setPreviousActiveTabId(tabId);
|
|
145
185
|
onChange({ activeTabId: tabId, activeTabHref: (_a = tabsById.get(tabId)) === null || _a === void 0 ? void 0 : _a.href });
|
|
146
186
|
break;
|
|
147
187
|
}
|
|
@@ -155,22 +195,25 @@ export function TabHeaderBar({ onChange, activeTabId, tabs, variant, idNamespace
|
|
|
155
195
|
}
|
|
156
196
|
function isElementDisabled(element) {
|
|
157
197
|
if (element instanceof HTMLButtonElement) {
|
|
158
|
-
return element.disabled
|
|
198
|
+
return element.disabled || element.closest(`.${styles['tabs-tab-disabled']}`);
|
|
159
199
|
}
|
|
160
200
|
return false;
|
|
161
201
|
}
|
|
162
202
|
return getAllFocusables(target).filter(el => isElementRegistered(el) && !isElementDisabled(el));
|
|
163
203
|
}
|
|
204
|
+
const TabList = hasActionOrDismissible ? 'div' : 'ul';
|
|
164
205
|
return (
|
|
165
206
|
//converted span to div as list should not be a child of span for HTML validation
|
|
166
207
|
React.createElement("div", { className: classes, ref: containerRef },
|
|
167
208
|
horizontalOverflow && (React.createElement("span", { ref: inlineStartOverflowButton, className: leftButtonClasses },
|
|
168
209
|
React.createElement(InternalButton, { formAction: "none", variant: "icon", iconName: "angle-left", disabled: !inlineStartOverflow, __focusable: true, onClick: () => onPaginationClick(headerBarRef, 'backward'), ariaLabel: i18n('i18nStrings.scrollLeftAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.scrollLeftAriaLabel) }))),
|
|
169
|
-
React.createElement(SingleTabStopNavigationProvider, { ref: navigationAPI, navigationActive: true, getNextFocusTarget: getNextFocusTarget },
|
|
170
|
-
React.createElement(
|
|
210
|
+
React.createElement(SingleTabStopNavigationProvider, { ref: navigationAPI, navigationActive: true, getNextFocusTarget: getNextFocusTarget, onUnregisterFocusable: onUnregisterFocusable },
|
|
211
|
+
React.createElement(TabList, Object.assign({}, tabActionAttributes, { className: styles['tabs-header-list'], "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, ref: headerBarRef, onScroll: onScroll, onKeyDown: onKeyDown, onFocus: onFocus, onBlur: onBlur }), tabs.map(renderTabHeader))),
|
|
171
212
|
horizontalOverflow && (React.createElement("span", { className: rightButtonClasses },
|
|
172
213
|
React.createElement(InternalButton, { formAction: "none", variant: "icon", iconName: "angle-right", disabled: !inlineEndOverflow, __focusable: true, onClick: () => onPaginationClick(headerBarRef, 'forward'), ariaLabel: i18n('i18nStrings.scrollRightAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.scrollRightAriaLabel) })))));
|
|
173
214
|
function renderTabHeader(tab) {
|
|
215
|
+
const { dismissible, dismissLabel, dismissDisabled, action, onDismiss } = tab;
|
|
216
|
+
const isActive = activeTabId === tab.id && !tab.disabled;
|
|
174
217
|
const clickTab = (event) => {
|
|
175
218
|
if (tab.disabled) {
|
|
176
219
|
event.preventDefault();
|
|
@@ -194,23 +237,45 @@ export function TabHeaderBar({ onChange, activeTabId, tabs, variant, idNamespace
|
|
|
194
237
|
if (tab.id === activeTabId) {
|
|
195
238
|
return;
|
|
196
239
|
}
|
|
240
|
+
setPreviousActiveTabId(tab.id);
|
|
197
241
|
onChange({ activeTabId: tab.id, activeTabHref: tab.href });
|
|
198
242
|
};
|
|
199
243
|
const classes = clsx({
|
|
200
244
|
[styles['tabs-tab-link']]: true,
|
|
201
245
|
[styles.refresh]: isVisualRefresh,
|
|
202
|
-
[styles['tabs-tab-active']]:
|
|
246
|
+
[styles['tabs-tab-active']]: isActive,
|
|
247
|
+
[styles['tabs-tab-disabled']]: tab.disabled,
|
|
248
|
+
});
|
|
249
|
+
const tabHeaderContainerClasses = clsx({
|
|
250
|
+
[styles['tabs-tab-header-container']]: true,
|
|
251
|
+
[styles.refresh]: isVisualRefresh,
|
|
252
|
+
[styles['tabs-tab-active']]: isActive,
|
|
203
253
|
[styles['tabs-tab-disabled']]: tab.disabled,
|
|
204
254
|
});
|
|
255
|
+
const tabActionClasses = clsx({
|
|
256
|
+
[styles['tabs-tab-action']]: true,
|
|
257
|
+
[styles['tabs-tab-active']]: isActive,
|
|
258
|
+
});
|
|
205
259
|
const commonProps = {
|
|
206
260
|
className: classes,
|
|
207
|
-
role: 'tab',
|
|
208
|
-
'aria-selected': tab.id === activeTabId,
|
|
209
261
|
'aria-controls': `${idNamespace}-${tab.id}-panel`,
|
|
210
262
|
'data-testid': tab.id,
|
|
211
263
|
id: getTabElementId({ namespace: idNamespace, tabId: tab.id }),
|
|
212
264
|
children: React.createElement("span", { className: styles['tabs-tab-label'] }, tab.label),
|
|
213
265
|
};
|
|
266
|
+
const tabHeaderContainerAriaProps = hasActionOrDismissible
|
|
267
|
+
? {
|
|
268
|
+
role: 'group',
|
|
269
|
+
'aria-labelledby': commonProps.id,
|
|
270
|
+
}
|
|
271
|
+
: {};
|
|
272
|
+
if (!hasActionOrDismissible) {
|
|
273
|
+
commonProps['aria-selected'] = activeTabId === tab.id;
|
|
274
|
+
commonProps.role = 'tab';
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
commonProps['aria-expanded'] = activeTabId === tab.id;
|
|
278
|
+
}
|
|
214
279
|
if (tab.disabled) {
|
|
215
280
|
commonProps['aria-disabled'] = 'true';
|
|
216
281
|
}
|
|
@@ -223,8 +288,32 @@ export function TabHeaderBar({ onChange, activeTabId, tabs, variant, idNamespace
|
|
|
223
288
|
}
|
|
224
289
|
tabRefs.current.set(tab.id, tabElement);
|
|
225
290
|
};
|
|
226
|
-
|
|
227
|
-
|
|
291
|
+
const handleDismiss = event => {
|
|
292
|
+
if (!containerObjectRef.current || !onDismiss) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const tabElements = getFocusablesFrom(containerObjectRef.current).filter(el => el.classList.contains(styles['tabs-tab-link']));
|
|
296
|
+
const activeTabIndex = tabElements.findIndex(el => el.dataset.testid === tab.id);
|
|
297
|
+
tabElements.splice(activeTabIndex, 1);
|
|
298
|
+
let nextActive;
|
|
299
|
+
if (previousActiveTabId && previousActiveTabId !== tab.id) {
|
|
300
|
+
nextActive = tabElements.find(el => el.dataset.testid === previousActiveTabId);
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
nextActive = tabElements[Math.min(tabElements.length - 1, activeTabIndex)];
|
|
304
|
+
}
|
|
305
|
+
if (nextActive && nextActive.dataset.testid) {
|
|
306
|
+
onChange({ activeTabId: nextActive.dataset.testid });
|
|
307
|
+
nextActive.focus();
|
|
308
|
+
}
|
|
309
|
+
onDismiss(event);
|
|
310
|
+
};
|
|
311
|
+
const TabItem = hasActionOrDismissible ? 'div' : 'li';
|
|
312
|
+
return (React.createElement(TabItem, { ref: (element) => tabRefs.current.set(tab.id, element), className: styles['tabs-tab'], role: "presentation", key: tab.id },
|
|
313
|
+
React.createElement("div", Object.assign({ className: tabHeaderContainerClasses }, tabHeaderContainerAriaProps),
|
|
314
|
+
React.createElement(TabTrigger, { ref: setElement, tab: tab, elementProps: commonProps }),
|
|
315
|
+
action && React.createElement("span", { className: tabActionClasses }, action),
|
|
316
|
+
dismissible && (React.createElement("span", { className: styles['tabs-tab-dismiss'] }, dismissButton(dismissLabel, dismissDisabled, handleDismiss))))));
|
|
228
317
|
}
|
|
229
318
|
}
|
|
230
319
|
const TabTrigger = forwardRef(({ tab, elementProps, }, ref) => {
|