GithubHelp home page GithubHelp logo

rgarciaseija / autocomplete.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tarekraafat/autocomplete.js

1.0 1.0 0.0 1.39 MB

Simple autocomplete pure vanilla Javascript library.

License: Apache License 2.0

JavaScript 100.00%

autocomplete.js's Introduction

autoComplete.js ✨

License Build Status Size Open Source Love

autoComplete.js Design

Simple autocomplete pure vanilla Javascript library. Demo

autoComplete.js is a simple pure vanilla Javascript library that's built for speed, high versatility and seamless integration with wide range of projects & systems.

Features

  • Simple & Easy to use
  • Pure Vanilla Javascript
  • Zero Dependencies
  • Lightweight
  • Lightning Fast
  • Versatile
  • Customizable
  • First Class Error Reporting

autoComplete.js Code Example

Get Started

Clone:

  • Clone autoComplete.js to your local machine using https://github.com/TarekRaafat/autoComplete.js.git

Setup:

  1. Install Dependencies
$ npm i
  1. Development live server
$ npm start
  1. Build Production Package
$ npm run build

Installation:

  • jsDelivr CDN

CSS

<head>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/TarekRaafat/[email protected]/dist/css/autoComplete.css">

</head>

JS

<body>
	
<script src="https://cdn.jsdelivr.net/gh/TarekRaafat/[email protected]/dist/js/autoComplete.min.js"></script>

</body>
  • HTML Local load
<script src="./autoComplete.js"></script>
  • HTML Local load - ES6 module (Use with Import)
<script src="./index.js" type="module"></script>
  • Import module ES6
import autoComplete from "./autoComplete";
  • Node.js
const autoComplete = require("./autoComplete");

How to use:

HTML file

  1. Assign id="autoComplete" to the input filed
<input id="autoComplete" type="text">

JS file

  1. Create new instance of autoComplete engine
// The app instance creator

new autoComplete({
	dataSrc: grocery,	    // Array data source
	placeHolder: "Try me...",   // Place Holder text
	maxNum: 10,		    // Max number of results
	highlight: true,	    // Highlight matching results
	dataAttribute: {
		tag: "set",	    // Data attribute tag
		value: "value"	    // Data attribute value
    	},
	onSelection: value => {     // Action script onClick event
		document.querySelector(".selection").innerHTML = value.id;
	}
});
  1. That's it, you're ready to go!

Example

For working example of autoComplete.js, visit the Demo.

Or download the Demo files from the /dist folder.


Support

For general questions about autoComplete.js, tweet at @TarekRaafat.

For technical questions, you should post a question on Stack Overflow and tag it with autoComplete.js.


Browser Support

Desktop

  • Chrome
  • Firefox
  • Safari
  • Opera
  • Edge

Mobile

  • Chrome
  • Safari

Versioning

For transparency and insight into the release cycle, releases will be numbered with the following format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

  • Breaking backwards compatibility bumps the major
  • New additions without breaking backwards compatibility bumps the minor
  • Bug fixes and misc changes bump the patch

For more information on semantic versioning, please visit http://semver.org/.


Release History

  • v1.2.0

    • Redesigned the entire search engine for better results
    • Added support for Multi-keyword search
  • v1.1.0

    • Reduced the library size 97% (101KB -> 4KB)
    • Introducing 2 different verions of the library (pure, minified)
    • Replaced webpack with Rollup for better bundling
    • Fixed some bugs caused problems with node apps
  • v1.0.3

    • Refactored & Optimized to reduce size and enhance performance
  • v1.0.2

    • Fixed the library name in the webpack.config.js file
  • v1.0.1

    • Optimizations Reduced the library weigth by 1KB
  • v1.0.0

    • Add customized data attribute tag for generated results
    • Highlight matching results from the results list
    • Set maximum number for shown results
    • Add placeholder text to the input field
    • Placeholder keeps the last selection value saved

Roadmap

Functionality:

  • Add support for different types of data source
    • JS Object
    • JSON
    • Multidimensional Array
    • External data source (Plugin)
  • Multi-keyword Search
  • Navigate results list with keyboard

Interface:

  • New designs for inspiration (Ongoing)
    • Styles
    • Interactions
  • Number of results inside input field (Optional)

Contribution

Contributions are always more than welcome!

If you have any ideas, just open an issue and tell me what you think.

  • Please fork the repository and make changes as you'd like. Pull requests are warmly welcome.

If you'd like to contribute:

  1. Fork it (https://github.com/TarekRaafat/autoComplete.js.git)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Author

Tarek Raafat - [email protected]

Distributed under the Apache 2.0 license. See Apache 2.0 for more information.

https://github.com/TarekRaafat/


License

Apache 2.0 © Tarek Raafat

autocomplete.js's People

Contributors

tarekraafat avatar peritract avatar asyncdeveloper avatar

Stargazers

Rigoberto Garcia avatar

Watchers

Rigoberto Garcia avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.