hotwire_combobox 0.1.36 → 0.1.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +86 -2
- data/app/assets/javascripts/hotwire_combobox.esm.js +1254 -0
- data/app/assets/javascripts/hotwire_combobox.umd.js +1260 -0
- data/app/assets/javascripts/hw_combobox/models/combobox/actors.js +8 -0
- data/app/assets/javascripts/hw_combobox/models/combobox/filtering.js +6 -1
- data/app/assets/javascripts/hw_combobox/models/combobox/selection.js +6 -0
- data/app/assets/stylesheets/hotwire_combobox.css +4 -0
- data/app/presenters/hotwire_combobox/component.rb +15 -16
- data/app/presenters/hotwire_combobox/listbox/option.rb +9 -3
- data/app/views/hotwire_combobox/_next_page.turbo_stream.erb +3 -2
- data/app/views/hotwire_combobox/_paginated_options.turbo_stream.erb +1 -1
- data/app/views/hotwire_combobox/_pagination.html.erb +5 -2
- data/app/views/hotwire_combobox/combobox/_paginated_listbox.html.erb +2 -4
- data/lib/hotwire_combobox/engine.rb +1 -1
- data/lib/hotwire_combobox/helper.rb +89 -20
- data/lib/hotwire_combobox/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8218e50f0e61c4bda1ea76e874cb44b2dd003a49c52965ead080d0ddd6fdb1ba
|
4
|
+
data.tar.gz: 0dfad8d8e83525305406bc4afa0f7c687fa82fe5277e9768f22f9e1638b9b677
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f38007adfe6dd93118590f8207d37c98ff3069bc29846f674e4e4dd18b97a5a60d5f21c0c80f7bc86ff34837ef3cf7eb81683d05cd179f192a3c63182574c9c
|
7
|
+
data.tar.gz: 67d63843c03f7e304cdd11d0646dd245cc07f590af7d4b2593b18a599f4184a64ee483237b369c86697c18a0c7e823a2e424d516fdf26f8c383acdac8aa3a2ae
|
data/README.md
CHANGED
@@ -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
|
|