Skip to content

Commit 9224f24

Browse files
authored
Merge pull request #345 from ConsenSys/development
merge v0.9.5 release
2 parents 59962e7 + 7ddbe92 commit 9224f24

File tree

13 files changed

+144
-202
lines changed

13 files changed

+144
-202
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ class Example extends Component {
3535

3636
## Change log
3737

38+
### 0.9.5
39+
40+
- Fixed Select component accepts more options + children.
41+
- Fixed default theme in rimble ThemeProvider.
42+
- Fixed outdated dependencies vulnerability.
43+
- Fixed PublicAddress width property being passed to it's parent Field component.
44+
3845
### 0.9.4
3946

4047
- Added ref forwarding for all components.

example/src/App.js

+28-18
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ const myTheme = {
4343
},
4444
};
4545

46+
const selectOptions = [
47+
{ value: '123', label: 'One Two Three' },
48+
{ value: 'abc', label: 'A B C' },
49+
];
50+
4651
const testComponents = props => (
4752
<React.Fragment>
4853
<Box p={3}>
@@ -81,9 +86,21 @@ const testComponents = props => (
8186
<Avatar size="large" />
8287

8388
<Slider />
84-
<Select
85-
items={['Wandering Thunder', 'Black Wildflower', 'Ancient Paper']}
86-
/>
89+
<Select>
90+
<optgroup label="4-legged pets">
91+
<option value="dog">Dog</option>
92+
<option value="cat">Cat</option>
93+
<option value="hamster" disabled>
94+
Hamster
95+
</option>
96+
</optgroup>
97+
<optgroup label="Flying pets">
98+
<option value="parrot">Parrot</option>
99+
<option value="macaw">Macaw</option>
100+
<option value="albatross">Albatross</option>
101+
</optgroup>
102+
</Select>
103+
<Select options={selectOptions} />
87104
<Progress value={0.5} />
88105
<Heading.h1>Quick zephyrs blow, vexing daft Jim.</Heading.h1>
89106

@@ -145,23 +162,16 @@ const testComponents = props => (
145162
<Checkbox disabled checked label="Checkbox checked disabled" readOnly />
146163
<Box />
147164
<Card />
148-
<Card
149-
mx="auto"
150-
px="4"
151-
color="primary"
152-
>
153-
<Heading mb={3}>
154-
Heading
155-
</Heading>
165+
<Card mx="auto" px="4" color="primary">
166+
<Heading mb={3}>Heading</Heading>
156167
<Text mb={4}>
157-
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ullam autem ratione doloribus quidem neque provident eius error dignissimos delectus architecto nemo quos alias sunt voluptate impedit, facilis sequi tempore. Amet!
168+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ullam autem
169+
ratione doloribus quidem neque provident eius error dignissimos
170+
delectus architecto nemo quos alias sunt voluptate impedit, facilis
171+
sequi tempore. Amet!
158172
</Text>
159-
<Button mr={3}>
160-
Accept
161-
</Button>
162-
<Button.Outline>
163-
Cancel
164-
</Button.Outline>
173+
<Button mr={3}>Accept</Button>
174+
<Button.Outline>Cancel</Button.Outline>
165175
</Card>
166176
<Flex />
167177
<Table />

example/src/stories/PublicAddress/docs.md

-9
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ import { PublicAddress } from 'rimble-ui';
1212

1313
<!-- STORY -->
1414

15-
### Component props
16-
17-
`PublicAddress` will pass any props that are defined on its component and uses the following:
18-
19-
| Prop | Type | Values | Default | Description |
20-
| ----------- | -------- | ------ | ------- | --------------------------------------------------- |
21-
| address | string | | | Sets the address that is displayed in the component |
22-
| handleClick | function | | | Adds an is-copied class to component |
23-
2415
### Styled-system props
2516

2617
`PublicAddress` uses all the style props from [`Box`](https://consensys.github.io/rimble-ui/?path=/story/components-layout-box--documentation).

example/src/stories/PublicAddress/publicaddress.stories.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
Flex,
1616
Card,
1717
Pill,
18-
1918
QR,
2019
Link,
2120
} from 'rimble-ui';
@@ -37,9 +36,9 @@ storiesOf('Components/PublicAddress', module)
3736
<Heading.h4>Changing Label</Heading.h4>
3837
<CodeBlock>
3938
<PublicAddress
39+
width={1}
4040
address={'0x99cb784f0429efd72wu39fn4256n8wud4e01c7d2'}
4141
label={'Wallet Address'}
42-
required
4342
/>
4443
</CodeBlock>
4544
</Box>

example/src/stories/Select/docs.md

+40-15
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,51 @@
11
# Select documentation
22

3-
Use the `Select` component when you want your users to select an option from a list. `Select` provides a styled version of the HTML `<select>`.
3+
`Select` provides a styled version of the HTML `<select>`.
44

5-
_Want to understand best practices for using a `Select` component?_ Read [`Select` design guidelines](https://consensys.github.io/rimble-ui/?path=/story/components-form-select--design-guidelines)
5+
## Component
6+
<!-- STORY -->
7+
8+
## Usage
69

7-
**Import component**
10+
### with options array
811

912
```jsx
13+
import React, { Component } from 'react';
1014
import { Select } from 'rimble-ui';
11-
```
12-
13-
<!-- STORY -->
1415

15-
### Component props
16-
17-
`Select` will pass any props that are defined on its component and uses the following:
16+
const options = [
17+
{ value: 'ETH', label: 'ETH - Ether'},
18+
{ value: 'BTC', label: 'BTC - Bitcoin'},
19+
{ value: 'GNO', label: 'GNO - Gnosis'},
20+
{ value: 'GNT', label: 'GNT - Golem'},
21+
{ value: 'REP', label: 'REP - Augur'},
22+
];
23+
24+
const MyComponent = () => (
25+
<Select options={options} />
26+
);
27+
```
1828

19-
| Name | Type | Default | Description |
20-
| -------- | ---- | ------- | --------------------------------------------------------------------- |
21-
| disabled | bool | true | Sets disabled property of the radio input to prevent user interaction |
22-
| required | bool | true | Ensures that a value is selected |
29+
### or with children
2330

24-
### Styled-system props
31+
```jsx
32+
import React, { Component } from 'react';
33+
import { Select } from 'rimble-ui';
2534

26-
`Select` uses all the style props from [`Box`](https://consensys.github.io/rimble-ui/?path=/story/components-layout-box--documentation).
35+
const MyComponent = () => (
36+
<Select name="pets">
37+
<optgroup label="4-legged pets">
38+
<option value="dog">Dog</option>
39+
<option value="cat">Cat</option>
40+
<option value="hamster" disabled>Hamster</option>
41+
</optgroup>
42+
<optgroup label="Flying pets">
43+
<option value="parrot">Parrot</option>
44+
<option value="macaw">Macaw</option>
45+
<option value="albatross">Albatross</option>
46+
</optgroup>
47+
</Select>
48+
);
49+
```
50+
## Props
51+
<!-- PROPS -->
+12-91
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,21 @@
11
import React from 'react';
22
import { storiesOf } from '@storybook/react';
33
import { withDocs } from 'storybook-readme';
4-
import CodeBlock from '../../components/CodeBlock';
5-
import ContributeBanner from '../../components/ContributeBanner';
64

75
import Documentation from './docs.md';
8-
import Guidelines from './guide.md';
96

10-
import {
11-
Select,
12-
Field,
13-
Box,
14-
Heading,
15-
Text,
16-
Flex,
17-
Card,
18-
Pill,
19-
20-
Radio,
21-
Link,
22-
} from 'rimble-ui';
7+
import { Select } from 'rimble-ui';
238

24-
const items = [
25-
'ETH - Ether',
26-
'BTC - Bitcoin',
27-
'GNO - Gnosis',
28-
'GNT - Golem',
29-
'REP - Augur',
9+
const options = [
10+
{ value: 'ETH', label: 'ETH - Ether'},
11+
{ value: 'BTC', label: 'BTC - Bitcoin'},
12+
{ value: 'GNO', label: 'GNO - Gnosis'},
13+
{ value: 'GNT', label: 'GNT - Golem'},
14+
{ value: 'REP', label: 'REP - Augur'},
3015
];
3116

32-
storiesOf('Components/Form/Select', module)
33-
.add(
34-
'Documentation',
35-
withDocs(Documentation, () => (
36-
<Box mx={3}>
37-
<CodeBlock>
38-
<Field label="Choose your currency">
39-
<Select items={items} required="false" />
40-
</Field>
41-
</CodeBlock>
42-
</Box>
43-
))
44-
)
45-
.add(
46-
'Design guidelines',
47-
withDocs(Guidelines, () => (
48-
<Box mx={3}>
49-
<Box>
50-
<Heading.h3>Design</Heading.h3>
51-
<Text>
52-
Some best practices for using <code>{'Select'}</code> in your
53-
product.
54-
</Text>
55-
</Box>
56-
<Box>
57-
<Heading.h4>It's better to show your options</Heading.h4>
58-
<Text>
59-
Only use the <code>{'Select'}</code> component when you have a lot
60-
of options that would clutter your interface. If you've only got a
61-
few options to choose from it might be better to show them to the
62-
user with a <code>{'Radio'}</code> component.
63-
</Text>
64-
<br />
65-
</Box>
66-
<Flex>
67-
<Card mx={'auto'} my={3} px={4} width="400px">
68-
<Pill mb={3} color={'green'}>
69-
{'Do'}
70-
</Pill>
71-
<br />
72-
<br />
73-
<Select
74-
items={[
75-
'ETH - Ether',
76-
'BTC - Bitcoin',
77-
'GNO - Gnosis',
78-
'GNT - Golem',
79-
'REP - Augur',
80-
]}
81-
/>
82-
<br />
83-
<br />
84-
<Radio label="ETH - Ether" my={2} required="false" />
85-
<Radio label="FIAT e.g. USD" my={2} required="false" />
86-
</Card>
87-
<Card mx={'auto'} my={3} px={4} width="400px">
88-
<Pill mb={3} color={'red'}>
89-
{"Don't"}
90-
</Pill>
91-
<br />
92-
<br />
93-
<Select items={['ETH - Ether', 'FIAT e.g. USD']} />
94-
</Card>
95-
</Flex>
96-
97-
<ContributeBanner />
98-
</Box>
99-
))
100-
);
17+
storiesOf('Components/', module)
18+
.addDecorator(withDocs(Documentation))
19+
.add('Select', () => (
20+
<Select options={options} />
21+
))

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rimble-ui",
3-
"version": "0.9.4",
3+
"version": "0.9.5",
44
"description": "Rimble Design System react component library.",
55
"author": "ConsenSys Design",
66
"homepage": "https://rimble.consensys.design/",

src/PublicAddress/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class PublicAddress extends Component {
8181
label = this.props.label;
8282
}
8383
return (
84-
<Field label={label}>
84+
<Field label={label} {...this.props}>
8585
<StyledWrapper required={true}>
8686
<StyledInput
8787
readOnly

src/Select/Select.test.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,25 @@ import Select from './';
22
import ThemeProvider from '../ThemeProvider';
33
import theme from '../theme';
44

5+
const selectOptions = [
6+
{ value: '123', label: 'One Two Three' },
7+
{ value: 'abc', label: 'A B C' },
8+
];
9+
510
describe('Select component sanity', () => {
611
it('has name', () => {
712
expect(Select.displayName).toBe('Select');
813
});
914

1015
it('matches default snapshot', () => {
11-
const component = shallow(
12-
<Select
13-
items={['Wandering Thunder', 'Black Wildflower', 'Ancient Paper']}
14-
/>
15-
);
16+
const component = shallow(<Select options={selectOptions} />);
1617
expect(component).toMatchSnapshot();
1718
});
1819

1920
it('matches themed snapshot', () => {
2021
const component = render(
2122
<ThemeProvider theme={theme}>
22-
<Select
23-
items={['Wandering Thunder', 'Black Wildflower', 'Ancient Paper']}
24-
/>
23+
<Select items={selectOptions} />
2524
</ThemeProvider>
2625
);
2726
expect(component).toMatchSnapshot();

0 commit comments

Comments
 (0)