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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85fbe2e5c1b8d503be62eceae58650266582ac3428be6558c0af8bb76ec5f03c
4
- data.tar.gz: f13eb27444b1e530391a8058dc6f00a6d46d9df4af75eb2de2cd28a568851f0b
3
+ metadata.gz: 49f81dc7ada4155b100cf7043fbb8b02a10f0e29c636bc1ba4b1f97bb0f3427f
4
+ data.tar.gz: 785782d46ca4d70fc2b8463d0c9812a0d1ea2009c21274469457cf313a4d59b2
5
5
  SHA512:
6
- metadata.gz: 207509d422415ad6684e08b09690b2244f6fde41e3a9f92a6e90ddf7808f1d0a43d1966f48847c52e133e48e8d81d8139dd2883053dd7b44ed5739d7ab2d62fc
7
- data.tar.gz: 184048c9ec147b4d28abf8a3c0d189fa6b73e72a9ef47c6db4c9cf3a595b880287d4e0ddc985d785a38fbce1b9a58279825c46099f800492368ae2cafe349a30
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
- 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
 
@@ -10,6 +10,7 @@ const concerns = [
10
10
  Combobox.AsyncLoading,
11
11
  Combobox.Autocomplete,
12
12
  Combobox.Dialog,
13
+ Combobox.Events,
13
14
  Combobox.Filtering,
14
15
  Combobox.Navigation,
15
16
  Combobox.NewOptions,