diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a6fa432 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +# Dependencies +node_modules/ + +# Build output +*.min.js.map + +# OS files +.DS_Store diff --git a/README.md b/README.md index 2d7bc05..5bc8c2f 100644 --- a/README.md +++ b/README.md @@ -26,13 +26,13 @@ The **tail.select** script is back, rewritten in vanilla JavaScript and ready to ## Features -- **Beautiful**. 2 different designs (light and dark) -- **Extensive**. - - Search bar to find options quickly... - - All / None optgroup selection buttons... -- **Translatable**. -- **Zero dependencies**. And written in vanilla JavaScript... -- **Free to use**. Because it's MIT licensed <3 +- **Beautiful**. 2 different designs (light and dark) +- **Extensive**. + - Search bar to find options quickly... + - All / None optgroup selection buttons... +- **Translatable**. +- **Zero dependencies**. And written in vanilla JavaScript... +- **Free to use**. Because it's MIT licensed <3 ## Install & Embed @@ -53,6 +53,23 @@ yarn add tail.select.js --save bower install tail.select.js --save ``` +### ES6 Module Usage + +The library supports ES6 modules and can be imported directly: + +```js +// Import the library +import tail from 'tail.select.js/js/tail.select.js'; + +// Initialize tail.select on elements +tail.select('.tail-select', { + placeholder: 'Select options...', + theme: 'light', + buttonAll: true, + buttonNone: true, +}); +``` + ### Using a CDN You can also use the awesome CDN services from jsDelivr or UNPKG. diff --git a/js/tail.select.js b/js/tail.select.js index 56fa8d5..060cf8f 100644 --- a/js/tail.select.js +++ b/js/tail.select.js @@ -700,3 +700,6 @@ const tail = { }); } }; + +export default tail; + diff --git a/js/tail.select.min.js b/js/tail.select.min.js index 308d577..0a9953f 100644 --- a/js/tail.select.min.js +++ b/js/tail.select.min.js @@ -1 +1,11 @@ - const tail = { select: function (selector, options = {}) { \ No newline at end of file +/** + * tail.select - The vanilla JavaScript solution to make your