@@ -8,7 +8,7 @@ import { Stack } from '../../Layout'
8
8
import { TabBar } from '../TabBar'
9
9
import { TabItem } from '../TabItem'
10
10
11
- import type { StoryObj } from '@storybook/react'
11
+ import type { Meta , StoryObj } from '@storybook/react'
12
12
13
13
export default {
14
14
title : 'Navigation(ナビゲーション)/TabBar/VRT' ,
@@ -20,84 +20,71 @@ export default {
20
20
* true false true なし あり
21
21
* true true false あり あり
22
22
* true false false なし なし */
23
- render : ( args : any ) => (
24
- < Stack { ...args } >
25
- < TabBar bordered = { false } >
26
- < TabItem id = "tab1" onClick = { action ( 'clicked' ) } suffix = { < Badge count = { 100 } /> } >
27
- タブ1
28
- </ TabItem >
29
- < TabItem
30
- id = "tab2"
31
- onClick = { action ( 'clicked' ) }
32
- selected
33
- disabled
34
- disabledDetail = { { message : 'タブが無効な理由' } }
35
- >
36
- タブ2
37
- </ TabItem >
38
- </ TabBar >
39
- < TabBar >
40
- < TabItem
41
- id = "tab3"
42
- onClick = { action ( 'clicked' ) }
43
- selected
44
- disabled
45
- suffix = { < Badge count = { 100 } /> }
46
- >
47
- タブ3
48
- </ TabItem >
49
- < TabItem
50
- id = "tab4"
51
- onClick = { action ( 'clicked' ) }
52
- disabled
53
- disabledDetail = { { message : 'タブが無効な理由' } }
54
- >
55
- タブ4
56
- </ TabItem >
57
- < TabItem
58
- id = "tab5"
59
- onClick = { action ( 'clicked' ) }
60
- selected
61
- suffix = { < FaCircleExclamationIcon color = "DANGER" /> }
62
- disabledDetail = { { message : 'タブが無効な理由' } }
63
- >
64
- タブ5
65
- </ TabItem >
66
- < TabItem id = "tab6" onClick = { action ( 'clicked' ) } >
67
- タブ6
68
- </ TabItem >
69
- </ TabBar >
23
+ render : ( args ) => (
24
+ < Stack >
25
+ { [ undefined , 'hover' , 'focus-visible' ] . map ( ( variant ) => (
26
+ < Stack id = { variant } key = { variant } >
27
+ < TabBar { ...args } bordered = { false } >
28
+ < TabItem id = "tab1" onClick = { action ( 'clicked' ) } suffix = { < Badge count = { 100 } /> } >
29
+ タブ1
30
+ </ TabItem >
31
+ < TabItem
32
+ id = "tab2"
33
+ onClick = { action ( 'clicked' ) }
34
+ selected
35
+ disabled
36
+ disabledDetail = { { message : 'タブが無効な理由' } }
37
+ >
38
+ タブ2
39
+ </ TabItem >
40
+ </ TabBar >
41
+ < TabBar >
42
+ < TabItem
43
+ id = "tab3"
44
+ onClick = { action ( 'clicked' ) }
45
+ selected
46
+ disabled
47
+ suffix = { < Badge count = { 100 } /> }
48
+ >
49
+ タブ3
50
+ </ TabItem >
51
+ < TabItem
52
+ id = "tab4"
53
+ onClick = { action ( 'clicked' ) }
54
+ disabled
55
+ disabledDetail = { { message : 'タブが無効な理由' } }
56
+ >
57
+ タブ4
58
+ </ TabItem >
59
+ < TabItem
60
+ id = "tab5"
61
+ onClick = { action ( 'clicked' ) }
62
+ selected
63
+ suffix = { < FaCircleExclamationIcon color = "DANGER" /> }
64
+ disabledDetail = { { message : 'タブが無効な理由' } }
65
+ >
66
+ タブ5
67
+ </ TabItem >
68
+ < TabItem id = "tab6" onClick = { action ( 'clicked' ) } >
69
+ タブ6
70
+ </ TabItem >
71
+ </ TabBar >
72
+ </ Stack >
73
+ ) ) }
70
74
</ Stack >
71
75
) ,
72
76
parameters : {
73
77
chromatic : { disableSnapshot : false } ,
74
78
} ,
75
79
tags : [ '!autodocs' ] ,
76
- }
77
-
78
- export const VRT = { }
80
+ } satisfies Meta < typeof TabBar >
79
81
80
- export const VRTHover = {
81
- ...VRT ,
82
- args : {
83
- id : 'hover' ,
84
- } ,
82
+ export const VRT = {
85
83
parameters : {
86
84
pseudo : {
87
85
hover : [ '#hover .smarthr-ui-TabItem' ] ,
86
+ focusVisible : [ '#focus-visible .smarthr-ui-TabItem' ] ,
88
87
} ,
89
- // MEMO: VRT として機能していないので、解決するまでスナップショットを無効化
90
- chromatic : { disableSnapshot : true } ,
91
- } ,
92
- }
93
-
94
- export const VRTKeyboardFocus : StoryObj = {
95
- ...VRT ,
96
- play : async ( { canvasElement } ) => {
97
- const canvas = within ( canvasElement )
98
- const tabs = canvas . getAllByRole ( 'tab' )
99
- // bordered で disabledDetail が存在するアイテムにフォーカス
100
- tabs [ 3 ] . focus ( )
101
88
} ,
102
89
}
103
90
0 commit comments