Skip to content

Commit 18e094c

Browse files
ktaborsdannify
andauthored
adding a form story to investigate numberfield width (#2090)
Co-authored-by: Danni <[email protected]>
1 parent 95f560a commit 18e094c

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

packages/@react-spectrum/form/stories/Form.stories.tsx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
import {action} from '@storybook/addon-actions';
1414
import {Button} from '@react-spectrum/button';
1515
import {ButtonGroup} from '@react-spectrum/buttongroup';
16-
import {Checkbox} from '@react-spectrum/checkbox';
16+
import {Checkbox, CheckboxGroup} from '@react-spectrum/checkbox';
1717
import {countries, states} from './data';
1818
import {Flex} from '@react-spectrum/layout';
1919
import {Form} from '../';
2020
import {Item, Picker} from '@react-spectrum/picker';
21+
import {NumberField} from '@react-spectrum/numberfield';
2122
import {Radio, RadioGroup} from '@react-spectrum/radio';
2223
import React, {Key, useState} from 'react';
2324
import {storiesOf} from '@storybook/react';
@@ -107,6 +108,24 @@ storiesOf('Form', module)
107108
.add(
108109
'form with reset',
109110
() => <FormWithControls />
111+
)
112+
.add(
113+
'form with numberfield and locale=ar-AE',
114+
() => (
115+
<Flex gap="size-100">
116+
<NumberField label="Outside form" />
117+
<Form>
118+
<NumberField label="Inside form" />
119+
</Form>
120+
<Form>
121+
<TextField label="First Name" placeholder="John" />
122+
</Form>
123+
<Form>
124+
<TextField label="First Name" placeholder="John" />
125+
<NumberField label="Inside form" />
126+
</Form>
127+
</Flex>
128+
)
110129
);
111130

112131
function render(props: any = {}) {
@@ -116,13 +135,19 @@ function render(props: any = {}) {
116135
<TextField label="Last Name" placeholder="Smith" />
117136
<TextField label="Street Address" placeholder="123 Any Street" />
118137
<TextField label="City" placeholder="San Francisco" />
138+
<NumberField label="Years lived there" />
119139
<Picker label="State" placeholder="Select a state" items={states}>
120140
{item => <Item key={item.abbr}>{item.name}</Item>}
121141
</Picker>
122142
<TextField label="Zip code" placeholder="12345" />
123143
<Picker label="Country" placeholder="Select a country" items={countries}>
124144
{item => <Item key={item.name}>{item.name}</Item>}
125145
</Picker>
146+
<CheckboxGroup defaultValue={['dragons']} label="Pets">
147+
<Checkbox value="dogs">Dogs</Checkbox>
148+
<Checkbox value="cats">Cats</Checkbox>
149+
<Checkbox value="dragons">Dragons</Checkbox>
150+
</CheckboxGroup>
126151
<RadioGroup label="Favorite pet" name="favorite-pet-group">
127152
<Radio value="dogs">Dogs</Radio>
128153
<Radio value="cats">Cats</Radio>

0 commit comments

Comments
 (0)