diff --git a/.gitignore b/.gitignore index 5aba682b..6be2ae85 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ node_modules npm-debug.log .idea .DS_Store +.vscode diff --git a/.travis.yml b/.travis.yml index a2133b95..73da3307 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,5 @@ node_js: script: - npm run lint + - npm run ts - npm test diff --git a/README.md b/README.md index 6287e2da..ccc77ae6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# +# [![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) [![OpenCollective](https://opencollective.com/react-toolbox/sponsors/badge.svg)](#sponsors) diff --git a/ROADMAP.md b/ROADMAP.md index 8e982121..9f09fa3a 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,4 +1,4 @@ -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). +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). ## The Manifesto diff --git a/components/autocomplete/Autocomplete.d.ts b/components/autocomplete/Autocomplete.d.ts index b7d98d82..9eddafa1 100644 --- a/components/autocomplete/Autocomplete.d.ts +++ b/components/autocomplete/Autocomplete.d.ts @@ -88,6 +88,14 @@ export interface AutocompleteProps extends InputProps { * Callback function that is fired when component is focused. */ onFocus?: Function; + /** + * Callback function that is fired when a key is pressed down. + */ + onKeyDown?: Function; + /** + * Callback function that is fired when a key is lifted up. + */ + onKeyUp?: Function; /** * Callback function that is fired when the components's query value changes. */ diff --git a/components/autocomplete/Autocomplete.js b/components/autocomplete/Autocomplete.js index 099a0337..16354852 100644 --- a/components/autocomplete/Autocomplete.js +++ b/components/autocomplete/Autocomplete.js @@ -35,6 +35,8 @@ const factory = (Chip, Input) => { onBlur: PropTypes.func, onChange: PropTypes.func, onFocus: PropTypes.func, + onKeyDown: PropTypes.func, + onKeyUp: PropTypes.func, onQueryChange: PropTypes.func, query: PropTypes.string, selectedPosition: PropTypes.oneOf(['above', 'below', 'none']), @@ -132,7 +134,7 @@ const factory = (Chip, Input) => { }; handleQueryFocus = (event) => { - this.suggestionsNode.scrollTop = 0; + event.target.scrollTop = 0; this.setState({ active: '', focus: true }); if (this.props.onFocus) this.props.onFocus(event); }; @@ -148,6 +150,8 @@ const factory = (Chip, Input) => { if (event.which === 13) { this.selectOrCreateActiveItem(event); } + + if(this.props.onKeyDown) this.props.onKeyDown(event); }; handleQueryKeyUp = (event) => { @@ -160,6 +164,8 @@ const factory = (Chip, Input) => { if (index >= suggestionsKeys.length) index = 0; this.setState({ active: suggestionsKeys[index] }); } + + if(this.props.onKeyUp) this.props.onKeyUp(event); }; handleSuggestionHover = (event) => { @@ -375,7 +381,6 @@ const factory = (Chip, Input) => { return (
extends React.Component
{ props: P & TooltipProps; } -interface TooltippedComponentClass
extends TooltipProps { +declare interface TooltippedComponentClass
extends TooltipProps { new (props?: P, context?: any): TooltipComponent
; } -export function Tooltip
(componentClass: React.ComponentClass
): TooltippedComponentClass
; +declare interface TooltipOptions { + className?: string; + delay?: number; + hideOnClick?: boolean; + passthrough?: boolean; + showOnClick?: boolean; + position?: 'bottom' | 'horizontal' | 'left' | 'right' | 'top' | 'vertical' +} -export default Tooltip; +declare type tooltipHOC
= (componentClass: React.ComponentClass
) => TooltippedComponentClass
+ +export function tooltipFactory
(options?: TooltipOptions): tooltipHOC
; + +export default function Tooltip
(component: React.ReactType): TooltippedComponentClass
;
diff --git a/components/tooltip/readme.md b/components/tooltip/readme.md
index 98c4e3a3..f790bae3 100644
--- a/components/tooltip/readme.md
+++ b/components/tooltip/readme.md
@@ -5,8 +5,9 @@ A Tooltip is useful to show information on hover in any kind of component. We ha
```jsx
import Button from 'react-toolbox/lib/button';
-import Tooltip from 'react-toolbox/lib/tooltip';
+import Input from 'react-toolbox/lib/input';
import Link from 'react-toolbox/lib/link';
+import Tooltip from 'react-toolbox/lib/tooltip';
const TooltipButton = Tooltip(Button);
const TooltipInput = Tooltip(Input);
diff --git a/docs/app/components/layout/main/modules/examples/input_example_1.txt b/docs/app/components/layout/main/modules/examples/input_example_1.txt
index c16db922..89865b2a 100644
--- a/docs/app/components/layout/main/modules/examples/input_example_1.txt
+++ b/docs/app/components/layout/main/modules/examples/input_example_1.txt
@@ -1,5 +1,5 @@
class InputTest extends React.Component {
- state = { name: '', phone: '', multiline: '', email: '', hint: '', label: '' };
+ state = { name: '', phone: '', multiline: '', email: '', hint: '', label: '', error: '' };
handleChange = (value, ev) => {
this.setState({[ev.target.name]: value});
@@ -16,7 +16,7 @@ class InputTest extends React.Component {
{/* Just an example. Defining functions in a property, such as onClick, is a bad idea: */}
- Error!! { e.preventDefault(); console.log('some help'); }}>?} />
+ Error!! { e.preventDefault(); console.log('some help'); }}>?} />
);
}
diff --git a/docs/www/index.html b/docs/www/index.html
index a875ef4b..404bc941 100644
--- a/docs/www/index.html
+++ b/docs/www/index.html
@@ -15,18 +15,18 @@
-
+
-
+
-
+
diff --git a/docs/www/other/CNAME b/docs/www/other/CNAME
index 4c40b7bf..ab3068c5 100644
--- a/docs/www/other/CNAME
+++ b/docs/www/other/CNAME
@@ -1 +1 @@
-react-toolbox.com
+react-toolbox.io
diff --git a/package.json b/package.json
index 4081c22d..dec1a98a 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "react-toolbox",
"description": "A set of React components implementing Google's Material Design specification with the power of CSS Modules.",
- "homepage": "http://www.react-toolbox.com",
+ "homepage": "http://www.react-toolbox.io",
"version": "2.0.0-beta.11",
"main": "./lib",
"module": "./components",
@@ -15,7 +15,7 @@
"url": "git+https://github.com/react-toolbox/react-toolbox.git"
},
"bugs": {
- "email": "issues@react-toolbox.com",
+ "email": "issues@react-toolbox.io",
"url": "https://github.com/react-toolbox/react-toolbox/issues"
},
"keywords": [
@@ -34,6 +34,8 @@
"react-transition-group": "^1.1.3"
},
"devDependencies": {
+ "@types/node": "^7.0.4",
+ "@types/react": "^15.0.0",
"babel-cli": "^6.24.1",
"babel-core": "^6.24.1",
"babel-eslint": "^7.2.3",
@@ -86,10 +88,12 @@
"react-transform-hmr": "^1.0.4",
"redbox-react": "^1.3.6",
"rimraf": "^2.6.1",
+ "sinon": "^2.0.0-pre.2",
"style-loader": "^0.18.1",
"stylelint": "^7.10.1",
"stylelint-config-standard": "^16.0.0",
"stylelint-order": "^0.4.4",
+ "typescript": "^2.1.5",
"webpack": "^2.6.0",
"webpack-dev-middleware": "^1.10.2",
"webpack-hot-middleware": "^2.18.0"
@@ -111,6 +115,8 @@
"prepublish": "npm run build",
"release": "bumped release",
"start": "cross-env NODE_ENV=development UV_THREADPOOL_SIZE=100 node ./server",
+ "ts": "tsc",
+ "tsd": "cpx \"./components/**/*.d.ts\" ./lib",
"test": "jest",
"test:watch": "jest --watch --no-watchman"
},
diff --git a/spec/components/input.js b/spec/components/input.js
index d3e40c41..52e67e99 100644
--- a/spec/components/input.js
+++ b/spec/components/input.js
@@ -30,7 +30,7 @@ class InputTest extends React.Component {
/>
-
+
diff --git a/spec/components/tooltip.js b/spec/components/tooltip.js
index 691df86e..456c8862 100644
--- a/spec/components/tooltip.js
+++ b/spec/components/tooltip.js
@@ -20,6 +20,7 @@ const TooltipTest = () => (
Give information on :hover You can have a multiple or simple autocomplete. Provide an image source or object, a font icon, children or a title to use its first letter. lorem ipsum...
+ Icon Buttons should align in the vertical center, to see this we need to
+ put them next to text or highlight thier background color.
+ You have multiple options for cards. Combine different subcomponents to create your own: Lorem ipsum... Chips can be deletable and have an avatar. lorem ipsum... This message comes from a parent: {this.context.message} You can navigate using a drawer to the left or right. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. lorem ipsum... lorem ipsum... Although a menu can be used indepently with any component, we are providing a common use case with the icon menu. lorem ipsum... lorem ipsum... This list can be used inside a Drawer for a list of options or as navigation. Useful for a list of contacts or similar. It can be used to embed little checkboxes in the list. These behave as checkboxes. Similar to a previous one but only with one text line The most simple list. Using custom components in list item This tabs can be disabled or hidden lorem ipsum... Date pickers and time pickers with Material flavour. Determinate Indeterminate... Circular Circular with custom size Lorem ipsum... Normal slider With steps, initial value and editable Pinned and with snaps Disabled status lorem ipsum... This is more beautiful than the old fashion checkboxes... Organized data. This tabs can be disabled or hidden These tabs fill the given space. These tabs have an inverted theme. Give information on :hover An example with Multiline! Lorem ipsum dolor sit amet,
+ Click this next word to show and hide on click:
+ {' '}
+ Tooltip
AppBar
+
+
+
+
+
+ Autocomplete
+ Avatars
+ Buttons
+ Icon Button Alignment
+ Browse Button
+
+ {children}
;
+const CardListItem: React.SFCCards
+ Checkbox
+ Chips
+ Dialog
+ Drawer
+ Officia deserunt mollit.
+ Dropdown
+ Font Icons
+ Icon Menus
+ Inputs
+ Links
+ With simple text and icons
+
+
+ Two text lines, avatar and right icon
+
+
+ Two line options and checkbox items
+
+
+
+
+ Avatar, single text and icon
+
+
+ Simple with just one text line
+
+
+ List with custom components
+
+
+ Menus
+ Navigation
+ Pickers
+ Progress bars
+ Radio Button
+ Sliders
+ Snackbars & Toasts
+ Switches
+ Table
+
+
+ Tabs
+ Fixed Tabs
+ Inverse Tabs
+ Inverse Tabs with labels and icons
+ Inverse Tabs with icons
+ Tooltip
+