Skip to content

Commit c600247

Browse files
authored
Merge branch 'update-v2-react16' into upgrade-react-transition-group
2 parents ced94a4 + 752cdd3 commit c600247

File tree

43 files changed

+769
-361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+769
-361
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# <a href='http://react-toolbox.com'><img src='http://i.imgur.com/VCSElQX.png' height='50'></a>
1+
# <a href='http://react-toolbox.io'><img src='http://i.imgur.com/VCSElQX.png' height='50'></a>
22

33
[![npm version](https://img.shields.io/npm/v/react-toolbox.svg?style=flat-square)](https://www.npmjs.com/package/react-toolbox) [![Build Status](http://img.shields.io/travis/react-toolbox/react-toolbox/master.svg?style=flat-square)](https://travis-ci.org/react-toolbox/react-toolbox) [![NPM Status](http://img.shields.io/npm/dm/react-toolbox.svg?style=flat-square)](https://www.npmjs.org/package/react-toolbox) [![Donate](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square)](https://paypal.me/javivelasco) [![OpenCollective](https://opencollective.com/react-toolbox/backers/badge.svg)](#backers)
44
[![OpenCollective](https://opencollective.com/react-toolbox/sponsors/badge.svg)](#sponsors)

ROADMAP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
This document defines a manifesto and the main Roadmap 🚵 ideas for [React Toolbox](www.react-toolbox.com). It's not a fixed document and of course it's open to change. You can leave your feedback in [this gist](https://gist.github.com/javivelasco/259d2087c2a8c3e8f2c5c720d1fd3f2e) or you can also do it [through an issue](https://github.com/react-toolbox/react-toolbox/issues/new).
1+
This document defines a manifesto and the main Roadmap 🚵 ideas for [React Toolbox](www.react-toolbox.io). It's not a fixed document and of course it's open to change. You can leave your feedback in [this gist](https://gist.github.com/javivelasco/259d2087c2a8c3e8f2c5c720d1fd3f2e) or you can also do it [through an issue](https://github.com/react-toolbox/react-toolbox/issues/new).
22

33
## The Manifesto
44

components/autocomplete/Autocomplete.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ export interface AutocompleteProps extends InputProps {
8888
* Callback function that is fired when component is focused.
8989
*/
9090
onFocus?: Function;
91+
/**
92+
* Callback function that is fired when a key is pressed down.
93+
*/
94+
onKeyDown?: Function;
95+
/**
96+
* Callback function that is fired when a key is lifted up.
97+
*/
98+
onKeyUp?: Function;
9199
/**
92100
* Callback function that is fired when the components's query value changes.
93101
*/

components/autocomplete/Autocomplete.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ const factory = (Chip, Input) => {
3535
onBlur: PropTypes.func,
3636
onChange: PropTypes.func,
3737
onFocus: PropTypes.func,
38+
onKeyDown: PropTypes.func,
39+
onKeyUp: PropTypes.func,
3840
onQueryChange: PropTypes.func,
3941
query: PropTypes.string,
4042
selectedPosition: PropTypes.oneOf(['above', 'below', 'none']),
@@ -132,7 +134,7 @@ const factory = (Chip, Input) => {
132134
};
133135

134136
handleQueryFocus = (event) => {
135-
this.suggestionsNode.scrollTop = 0;
137+
event.target.scrollTop = 0;
136138
this.setState({ active: '', focus: true });
137139
if (this.props.onFocus) this.props.onFocus(event);
138140
};
@@ -148,6 +150,8 @@ const factory = (Chip, Input) => {
148150
if (event.which === 13) {
149151
this.selectOrCreateActiveItem(event);
150152
}
153+
154+
if(this.props.onKeyDown) this.props.onKeyDown(event);
151155
};
152156

153157
handleQueryKeyUp = (event) => {
@@ -160,6 +164,8 @@ const factory = (Chip, Input) => {
160164
if (index >= suggestionsKeys.length) index = 0;
161165
this.setState({ active: suggestionsKeys[index] });
162166
}
167+
168+
if(this.props.onKeyUp) this.props.onKeyUp(event);
163169
};
164170

165171
handleSuggestionHover = (event) => {
@@ -375,7 +381,6 @@ const factory = (Chip, Input) => {
375381
return (
376382
<ul
377383
className={classnames(theme.suggestions, { [theme.up]: this.state.direction === 'up' })}
378-
ref={(node) => { this.suggestionsNode = node; }}
379384
>
380385
{suggestions}
381386
</ul>

components/autocomplete/readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ If you want to provide a theme via context, the component key is `RTAutocomplete
5353
| `multiple` | `Bool` | `true` | If true, component can hold multiple values. |
5454
| `onBlur` | `Function` | | Callback function that is fired when component is blurred. |
5555
| `onChange` | `Function` | | Callback function that is fired when the components's value changes. |
56-
| `onQueryChange` | `Function` | | Callback function that is fired when the components's query input value changes. |
5756
| `onFocus` | `Function` | | Callback function that is fired when component is focused. |
57+
| `onKeyDown` | `Function` | | Callback function that is fired when a key is pressed down. |
58+
| `onKeyUp` | `Function` | | Callback function that is fired when a key is lifted up. |
59+
| `onQueryChange` | `Function` | | Callback function that is fired when the components's query input value changes. |
5860
| `query` | `String` | | This property has to be used in case the `source` is not static and will be changing during search for `multiple={false}` autocomplete, content of the `query` has to be managed by the `onQueryChange` callback. |
5961
| `source` | `Object` or `Array` | | Object of key/values or array representing all items suggested. |
6062
| `selectedPosition` | `String` | `above` | Determines if the selected list is shown above or below input. It can be `above`, `below` or `none`. |

components/avatar/Avatar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const factory = (FontIcon) => {
1010
<div data-react-toolbox="avatar" className={classnames(theme.avatar, className)} {...other}>
1111
{children}
1212
{cover && typeof image === 'string' && <span aria-label={alt} className={theme.image} style={{ backgroundImage: `url(http://github.com/%3Cspan%20class=pl-s1%3E%3Cspan%20class=pl-kos%3E$%7B%3C/span%3E%3Cspan%20class=pl-s1%3Eimage%3C/span%3E%3Cspan%20class=pl-kos%3E%7D%3C/span%3E%3C/span%3E)` }} />}
13-
{!cover && (typeof image === 'string' ? <img alt={alt} className={theme.image} src={image} /> : image)}
13+
{!cover && (typeof image === 'string' ? <img alt={alt} className={theme.image} src={image} title={title} /> : image)}
1414
{typeof icon === 'string' ? <FontIcon className={theme.letter} value={icon} alt={alt} /> : icon}
1515
{title ? <span className={theme.letter}>{title[0]}</span> : null}
1616
</div>

components/button/BrowseButton.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ export interface BrowseButtonProps extends ButtonBaseProps {
3737
* Classnames object defining the component style.
3838
*/
3939
theme?: BrowseButtonTheme;
40+
41+
onChange?: Function;
4042
}
4143

4244
export class BrowseButton extends React.Component<BrowseButtonProps, {}> { }

components/button/Button.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ const factory = (ripple, FontIcon) => {
101101
const element = href ? 'a' : 'button';
102102
const level = this.getLevel();
103103
const shape = this.getShape();
104+
const mouseEvents = {
105+
onMouseUp: this.handleMouseUp,
106+
onMouseLeave: this.handleMouseLeave,
107+
};
104108

105109
const classes = classnames(theme.button, [theme[shape]], {
106110
[theme[level]]: neutral,
@@ -110,21 +114,24 @@ const factory = (ripple, FontIcon) => {
110114

111115
const props = {
112116
...others,
117+
...mouseEvents,
113118
href,
114119
ref: (node) => { this.buttonNode = node; },
115120
className: classes,
116121
disabled: this.props.disabled,
117-
onMouseUp: this.handleMouseUp,
118-
onMouseLeave: this.handleMouseLeave,
119122
type: !href ? type : null,
120123
'data-react-toolbox': 'button',
121124
};
122125

123-
return React.createElement(element, props,
126+
const buttonElement = React.createElement(element, props,
124127
icon ? <FontIcon className={theme.icon} value={icon} /> : null,
125128
label,
126129
children,
127130
);
131+
132+
return others.onMouseEnter && this.props.disabled
133+
? <span {...mouseEvents}>{buttonElement}</span>
134+
: buttonElement;
128135
}
129136
}
130137

components/checkbox/config.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
--checkbox-focus-color: color(var(--color-black) a(1%));
99
--checkbox-focus-size: calc(var(--checkbox-size) * 2.3);
1010
--checkbox-text-color: var(--color-black);
11+
--checkbox-border-color: var(--palette-grey-600);
1112
--checkbox-text-font-size: var(--font-size-small);
1213
--checkbox-total-height: calc(1.8 * var(--unit));
1314
--checkbox-transition-duration: 0.2s;

components/checkbox/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ If you want to provide a theme via context, the component key is `RTCheckbox`.
4747
| `children` | `String`, `Element` or `Array` | | Children to pass through the component. |
4848
| `className` | `String` | `''` | Sets a class to give customized styles to the checkbox field.|
4949
| `disabled` | `Boolean` | `false` | If true, the checkbox shown as disabled and cannot be modified.|
50-
| `label` | `String` of `node` | | Text label to attach next to the checkbox element.|
50+
| `label` | `String` or `node` | | Text label to attach next to the checkbox element.|
5151
| `name` | `String` | `false` | The name of the field to set in the input checkbox.|
5252
| `onBlur` | `Function` | | Callback called when the checkbox is blurred.|
5353
| `onChange` | `Function` | | Callback called when the checkbox value is changed.|

0 commit comments

Comments
 (0)