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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 446cd3c4beeb66029cab7cd6b92ac04c2a8c7a1f08ffd874728da2a3e605ead7
4
- data.tar.gz: 9783eb83824ebeff3fa55536002c24e129fc66ed0b9d82e33c808a8d65c6c3ee
3
+ metadata.gz: 8218e50f0e61c4bda1ea76e874cb44b2dd003a49c52965ead080d0ddd6fdb1ba
4
+ data.tar.gz: 0dfad8d8e83525305406bc4afa0f7c687fa82fe5277e9768f22f9e1638b9b677
5
5
  SHA512:
6
- metadata.gz: a4d5e3d5fddd0017fc6bb6e838a60550d0e7dc2da3fac8999befa092ad9a8a7d35753cc785271fdfb8fe43e63edc535dc97f441594c8be2a3eece394622b97d6
7
- data.tar.gz: 1d60ba35f6f043b9698d7b9bd48aadd702e67c00cb626068e797890ebcc3cfd370af14c33479da153f57096c1015c062f7539676da55aac559d76b38234a4d24
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
- Add this line to your application's Gemfile and run `bundle install`:
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
- Only apps that use importmaps are currently supported. Suport for other JS solutions is in progress.
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