1
1
import { Template as Menu } from "@spectrum-css/menu/stories/template.js" ;
2
- import { Sizes , withDownStateDimensionCapture } from "@spectrum-css/preview/decorators" ;
2
+ import {
3
+ Sizes ,
4
+ withDownStateDimensionCapture ,
5
+ } from "@spectrum-css/preview/decorators" ;
3
6
import { disableDefaultModes } from "@spectrum-css/preview/modes" ;
4
- import { isDisabled , isFocused , isHovered , isInvalid , isKeyboardFocused , isLoading , isOpen , isReadOnly , size } from "@spectrum-css/preview/types" ;
7
+ import {
8
+ isDisabled ,
9
+ isFocused ,
10
+ isHovered ,
11
+ isInvalid ,
12
+ isKeyboardFocused ,
13
+ isLoading ,
14
+ isOpen ,
15
+ isReadOnly ,
16
+ size ,
17
+ } from "@spectrum-css/preview/types" ;
5
18
import { within } from "@storybook/test" ;
6
19
import metadata from "../dist/metadata.json" ;
7
20
import packageJson from "../package.json" ;
@@ -141,33 +154,36 @@ export default {
141
154
helpText : "" ,
142
155
value : "Ballard" ,
143
156
content : [
144
- ( passthroughs , context ) => Menu ( {
145
- role : "listbox" ,
146
- subrole : "option" ,
147
- selectionMode : "single" ,
148
- hasDividers : true ,
149
- items : [
157
+ ( passthroughs , context ) =>
158
+ Menu (
150
159
{
151
- label : "Ballard" ,
152
- isSelected : true ,
153
- isChecked : true ,
160
+ role : "listbox" ,
161
+ selectionMode : "single" ,
162
+ hasDividers : true ,
163
+ items : [
164
+ {
165
+ label : "Ballard" ,
166
+ isSelected : true ,
167
+ isChecked : true ,
168
+ } ,
169
+ {
170
+ label : "Fremont" ,
171
+ } ,
172
+ {
173
+ label : "Greenwood" ,
174
+ } ,
175
+ {
176
+ type : "divider" ,
177
+ } ,
178
+ {
179
+ label : "United States of America" ,
180
+ isDisabled : true ,
181
+ } ,
182
+ ] ,
183
+ ...passthroughs ,
154
184
} ,
155
- {
156
- label : "Fremont" ,
157
- } ,
158
- {
159
- label : "Greenwood" ,
160
- } ,
161
- {
162
- type : "divider" ,
163
- } ,
164
- {
165
- label : "United States of America" ,
166
- isDisabled : true ,
167
- } ,
168
- ] ,
169
- ...passthroughs ,
170
- } , context ) ,
185
+ context ,
186
+ ) ,
171
187
] ,
172
188
} ,
173
189
parameters : {
@@ -185,9 +201,7 @@ export default {
185
201
} ,
186
202
} ,
187
203
tags : [ "migrated" ] ,
188
- decorators : [
189
- withDownStateDimensionCapture ,
190
- ] ,
204
+ decorators : [ withDownStateDimensionCapture ] ,
191
205
play : async ( { canvasElement } ) => {
192
206
const canvas = within ( canvasElement ) ;
193
207
@@ -199,7 +213,7 @@ export default {
199
213
export const Default = ComboBoxGroup . bind ( { } ) ;
200
214
Default . tags = [ "!autodocs" ] ;
201
215
Default . parameters = {
202
- chromatic : { delay : 1000 }
216
+ chromatic : { delay : 1000 } ,
203
217
} ;
204
218
205
219
// ********* DOCS ONLY ********* //
@@ -227,28 +241,31 @@ HelpText.args = {
227
241
helpText : "This is a help text. Select an option" ,
228
242
} ;
229
243
230
-
231
244
/**
232
245
* Comboboxes have a read-only option for when content in the disabled state still needs to be shown. This allows for content to be copied, but not interacted with or changed. A combobox does not have a read-only option if no selection has been made. To enable this feature, add the `.is-readOnly` class to the combobox. To enable this feature, add the `.is-readOnly` class to the combobox. Then within the nested textfield component, add the `.is-readOnly class and readonly attribute to the `input` element.
233
- */
246
+ */
234
247
export const ReadOnly = Template . bind ( { } ) ;
235
248
ReadOnly . tags = [ "!dev" ] ;
236
249
ReadOnly . args = {
237
250
isReadOnly : true ,
238
- value : "Ballard"
251
+ value : "Ballard" ,
239
252
} ;
240
253
ReadOnly . parameters = {
241
- chromatic : { disableSnapshot : true }
254
+ chromatic : { disableSnapshot : true } ,
242
255
} ;
243
256
244
257
ReadOnly . storyName = "Read-only" ;
245
258
246
- export const Sizing = ( args , context ) => Sizes ( {
247
- Template,
248
- withBorder : false ,
249
- withHeading : false ,
250
- ...args ,
251
- } , context ) ;
259
+ export const Sizing = ( args , context ) =>
260
+ Sizes (
261
+ {
262
+ Template,
263
+ withBorder : false ,
264
+ withHeading : false ,
265
+ ...args ,
266
+ } ,
267
+ context ,
268
+ ) ;
252
269
Sizing . tags = [ "!dev" ] ;
253
270
Sizing . parameters = {
254
271
chromatic : { disableSnapshot : true } ,
@@ -260,6 +277,6 @@ WithForcedColors.tags = ["!autodocs", "!dev"];
260
277
WithForcedColors . parameters = {
261
278
chromatic : {
262
279
forcedColors : "active" ,
263
- modes : disableDefaultModes
280
+ modes : disableDefaultModes ,
264
281
} ,
265
282
} ;
0 commit comments