hotwire_combobox 0.1.37 → 0.1.39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +87 -3
- data/app/assets/javascripts/controllers/hw_combobox_controller.js +1 -0
- data/app/assets/javascripts/hotwire_combobox.esm.js +1329 -0
- data/app/assets/javascripts/hotwire_combobox.umd.js +1335 -0
- data/app/assets/javascripts/hw_combobox/helpers.js +17 -0
- data/app/assets/javascripts/hw_combobox/models/combobox/dialog.js +10 -0
- data/app/assets/javascripts/hw_combobox/models/combobox/events.js +17 -0
- data/app/assets/javascripts/hw_combobox/models/combobox/filtering.js +12 -2
- data/app/assets/javascripts/hw_combobox/models/combobox/options.js +7 -0
- data/app/assets/javascripts/hw_combobox/models/combobox/selection.js +15 -1
- data/app/assets/javascripts/hw_combobox/models/combobox/toggle.js +1 -1
- data/app/assets/javascripts/hw_combobox/models/combobox/validity.js +17 -11
- data/app/assets/javascripts/hw_combobox/models/combobox.js +1 -0
- data/app/assets/stylesheets/hotwire_combobox.css +4 -0
- data/app/presenters/hotwire_combobox/component.rb +15 -7
- data/app/presenters/hotwire_combobox/listbox/option.rb +7 -3
- data/app/views/hotwire_combobox/_next_page.turbo_stream.erb +1 -1
- data/lib/hotwire_combobox/engine.rb +1 -1
- data/lib/hotwire_combobox/helper.rb +83 -18
- data/lib/hotwire_combobox/version.rb +1 -1
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49f81dc7ada4155b100cf7043fbb8b02a10f0e29c636bc1ba4b1f97bb0f3427f
|
4
|
+
data.tar.gz: 785782d46ca4d70fc2b8463d0c9812a0d1ea2009c21274469457cf313a4d59b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dac85e0c02124f5e1c6aee86fa3f06bda5b9434b2df5953e6992bc7df70ddaec4e4e252ce16ac7140a9d09edb9d1cb257c364f26cf21b41bf500a544614cb27
|
7
|
+
data.tar.gz: 8e63361787fac58a9a624bccd4a14e6939d26b95d18d87a5852016ff13d8e3afa7c217bc9d4b1e8ada89a3b0aa0935f8b006f845c54ce82531b069563db28353
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
<img src="docs/assets/images/logo.png" height=150>
|
3
3
|
</p>
|
4
4
|
|
5
|
-
# Easy Autocomplete for Ruby on Rails
|
5
|
+
# Easy and Accessible Autocomplete for Ruby on Rails
|
6
6
|
|
7
7
|
[![CI Tests](https://github.com/josefarias/hotwire_combobox/actions/workflows/ci_tests.yml/badge.svg)](https://github.com/josefarias/hotwire_combobox/actions/workflows/ci_tests.yml) [![Gem Version](https://badge.fury.io/rb/hotwire_combobox.svg)](https://badge.fury.io/rb/hotwire_combobox)
|
8
8
|
|
@@ -12,13 +12,97 @@
|
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
15
|
-
|
15
|
+
First, make sure [Turbo](https://github.com/hotwired/turbo-rails) and [Stimulus](https://github.com/hotwired/stimulus-rails) are configured and running properly on your app.
|
16
|
+
|
17
|
+
Then, add this line to your application's Gemfile and run `bundle install`:
|
16
18
|
|
17
19
|
```ruby
|
18
20
|
gem "hotwire_combobox"
|
19
21
|
```
|
20
22
|
|
21
|
-
|
23
|
+
Finally, configure your assets:
|
24
|
+
|
25
|
+
### Configuring JS
|
26
|
+
|
27
|
+
Before continuing, you should know whether your app is using importmaps or JS bundling in your asset pipeline.
|
28
|
+
|
29
|
+
#### Importmaps
|
30
|
+
|
31
|
+
Most apps using importmaps won't need any configuration. If things aren't working for you, read on.
|
32
|
+
|
33
|
+
In `app/javascript/controllers/index.js` you should have one of the following:
|
34
|
+
|
35
|
+
Either,
|
36
|
+
|
37
|
+
```js
|
38
|
+
import { application } from "controllers/application" // or equivalent
|
39
|
+
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
|
40
|
+
|
41
|
+
eagerLoadControllersFrom("controllers", application)
|
42
|
+
```
|
43
|
+
|
44
|
+
Or,
|
45
|
+
|
46
|
+
```js
|
47
|
+
import { application } from "controllers/application" // or equivalent
|
48
|
+
import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
|
49
|
+
|
50
|
+
lazyLoadControllersFrom("controllers", application)
|
51
|
+
```
|
52
|
+
|
53
|
+
Or,
|
54
|
+
|
55
|
+
```js
|
56
|
+
import { application } from "controllers/application" // or equivalent
|
57
|
+
|
58
|
+
import HwComboboxController from "controllers/hw_combobox_controller"
|
59
|
+
application.register("hw-combobox", HwComboboxController)
|
60
|
+
```
|
61
|
+
|
62
|
+
#### JS bundling (esbuild, rollup, etc)
|
63
|
+
|
64
|
+
First, install the JS portion of HotwireCombobox from npm with one of the following:
|
65
|
+
|
66
|
+
```bash
|
67
|
+
yarn add @josefarias/hotwire_combobox
|
68
|
+
```
|
69
|
+
|
70
|
+
```bash
|
71
|
+
npm install @josefarias/hotwire_combobox
|
72
|
+
```
|
73
|
+
|
74
|
+
Then, register the library's stimulus controller in `app/javascript/controllers/index.js` as follows:
|
75
|
+
|
76
|
+
```js
|
77
|
+
import { application } from "./application" // or equivalent
|
78
|
+
|
79
|
+
import HwComboboxController from "@josefarias/hotwire_combobox"
|
80
|
+
application.register("hw-combobox", HwComboboxController)
|
81
|
+
```
|
82
|
+
|
83
|
+
### Configuring CSS
|
84
|
+
|
85
|
+
This library comes with optional default styles. Follow the instructions below to include them in your app.
|
86
|
+
|
87
|
+
Read the [docs section](#Docs) for instructions on styling the combobox yourself.
|
88
|
+
|
89
|
+
#### Default
|
90
|
+
|
91
|
+
This approach works for all setups. Simply add the stylesheet to your layout (this would go in your document's `<head>`):
|
92
|
+
|
93
|
+
```erb
|
94
|
+
<%= combobox_style_tag %>
|
95
|
+
```
|
96
|
+
|
97
|
+
This helper accepts any of the options you can pass to `stylesheet_link_tag`.
|
98
|
+
|
99
|
+
#### Sprockets
|
100
|
+
|
101
|
+
Require the styles in `app/assets/stylesheets/application.css`:
|
102
|
+
|
103
|
+
```erb
|
104
|
+
*= require hotwire_combobox
|
105
|
+
```
|
22
106
|
|
23
107
|
## Docs
|
24
108
|
|