2.1.2 • Published 7 years ago

@streammedev/hermes v2.1.2

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

Hermes

NPM Version NPM Downloads js-happiness-style

Messages like you have never seen them before

Hermes Example

Install

$ npm install --save @streammedev/hermes

Basic Usage

var ReactDom = require('react-dom');
var Hermes = require('@streammedev/hermes');

ReactDom.render(<Hermes
	autoFocus
	placeHolder="Get your message across..."
	suggestions={[/* your array of suggestions, updated when loadSuggestions is called */]}
	loadSuggestions={function (term, fullText) {
		// Get from your server,
		// or whereever you get them,
		// term is the current word
		// fullText is the full input value
	}}
	clearSuggestions={function () {
		// clear your suggestion list
	}}
/>, document.getElementById('app'));

Options

Prop NameDefaultDescription
className"hermes"The container classname
placeholderundefinedPlaceholder text to insert
contentClassName"hermes-content"Classname for the contenteditable
emptyClassName"hermes-empty"A classname added when the field is empty
flyoutClassName""A classname to add to the suggestions flyout
flyoutElement"ol"A classname to add to the suggestions flyout
childrenundefinedChildren to add inside the container
autoFocusfalseAutofocus the field on render
value""The initial input value
formatValue""A function which formats the value display (see example)
preventNewLinesfalseWill prevent new lines in the input
suggestionsnullAn array of suggestions to show the user
loadSuggestionsundefinedA function to load suggestions
clearSuggestionsundefinedA function to clear the suggestions
renderSuggestionundefinedA function to custom render the suggestions items
getSuggestionTextidentity functionA function to get the suggestion text from the selected suggestion item
onSelectSuggestionundefinedA function to call when a suggestion is selected
onChangeValueundefinedA function to call when the value changes
storeundefinedA redux compatible store like @streammedev/flux-store

Example

There is a working example, picutred in the gif above. Here is how to run it:

$ git clone git@github.com:StreamMeDev/hermes.git && cd hermes/examples/basic
$ npm install
$ node index.js

Then visit http://localhost:1337.

Advanced Usage

The package exposes all of the internal parts, so you can compose them together in your application however you like.

More to come on this.

Contributing

Contributions are welcome. Please see our guidelines in CONTRIBUTING.md

2.1.2

7 years ago

2.1.1

7 years ago

2.1.0

8 years ago

2.1.0-BETA-1

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.5.0-BETA-3

8 years ago

1.5.0-BETA-2

8 years ago

1.4.4

8 years ago

1.5.0-BETA-1

8 years ago

1.4.3

8 years ago

1.4.2

8 years ago

1.4.1

8 years ago

1.4.0

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.1

9 years ago