hotwire_combobox 0.1.37 → 0.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85fbe2e5c1b8d503be62eceae58650266582ac3428be6558c0af8bb76ec5f03c
4
- data.tar.gz: f13eb27444b1e530391a8058dc6f00a6d46d9df4af75eb2de2cd28a568851f0b
3
+ metadata.gz: 8218e50f0e61c4bda1ea76e874cb44b2dd003a49c52965ead080d0ddd6fdb1ba
4
+ data.tar.gz: 0dfad8d8e83525305406bc4afa0f7c687fa82fe5277e9768f22f9e1638b9b677
5
5
  SHA512:
6
- metadata.gz: 207509d422415ad6684e08b09690b2244f6fde41e3a9f92a6e90ddf7808f1d0a43d1966f48847c52e133e48e8d81d8139dd2883053dd7b44ed5739d7ab2d62fc
7
- data.tar.gz: 184048c9ec147b4d28abf8a3c0d189fa6b73e72a9ef47c6db4c9cf3a595b880287d4e0ddc985d785a38fbce1b9a58279825c46099f800492368ae2cafe349a30
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