hotwire_combobox 0.1.8 → 0.1.9

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: 9cb2abe7ffd7dc81c39b774fb0028f0f9650182978735f3d21a3d375a32a948e
4
- data.tar.gz: a038bd3ce8baff5a47e281be380cc0c4c0b77433cab3161174958a0f135fab08
3
+ metadata.gz: 682b24c423ae14b503b0c018ef7299e89b25fb641057934a835bf615ffd9b999
4
+ data.tar.gz: d588e46d58c757534239d6ccbcd85165e6ba05bfab127a5e315c9f6eb96b5168
5
5
  SHA512:
6
- metadata.gz: 52b14433be746e89f6e0612f42d3a84ed323ebb2931a93d535b90bb9eb1fbde555ea3bf0a3496774b9eb91c30ba0035576e6c3fab7da69e97e7228e927767e69
7
- data.tar.gz: '09662cb44deb6854dca5d7a6919ae6170dff3ebcbbae9cab7ea7b1b368ec85e0db82f823a3471886cb55b9e4a44da6bd7e141bdc0e5948266b118ed96b2873bc'
6
+ metadata.gz: b6b954b089943a78f4cdf1a3cc4833e8ddafcf2fd5f697556c2c0cbd7ba89cf9425d065146b2046b34464c653ba9ba4bc793b349f97b17ef774aca718e721df7
7
+ data.tar.gz: 9499ab225eb5b668361003e3776fa5972d3cfd2ae138b42b51138e1e976863a3aac5921e0a4f91f21a03e897e8a82ae25d2e05cc916c1a7c3b7ae012b8a6b5d7
@@ -47,6 +47,7 @@ export default class extends Controller {
47
47
  if (this.element.contains(target)) return
48
48
 
49
49
  this.close()
50
+ target.focus()
50
51
  }
51
52
 
52
53
  closeOnFocusOutside({ target }) {
@@ -55,6 +56,7 @@ export default class extends Controller {
55
56
  if (target.matches("main")) return
56
57
 
57
58
  this.close()
59
+ target.focus()
58
60
  }
59
61
 
60
62
  // private
@@ -1,8 +1,13 @@
1
1
  module HotwireCombobox
2
2
  module Helper
3
+ class << self
4
+ delegate :bypass_convenience_methods?, to: :HotwireCombobox
5
+ end
6
+
3
7
  def hw_combobox_options(options)
4
8
  options.map { |option| hw_combobox_option(**option) }
5
9
  end
10
+ alias_method :combobox_options, :hw_combobox_options unless bypass_convenience_methods?
6
11
 
7
12
  def hw_combobox_tag(name, value = nil, form: nil, options: [], data: {}, input: {}, **attrs)
8
13
  value_field_attrs = {}.tap do |h|
@@ -23,11 +28,7 @@ module HotwireCombobox
23
28
  listbox_id: hw_combobox_listbox_id(value_field_attrs[:id]),
24
29
  parent_data: default_hw_combobox_parent_data(attrs, data)
25
30
  end
26
-
27
- unless HotwireCombobox.bypass_convenience_methods?
28
- alias_method :combobox_options, :hw_combobox_options
29
- alias_method :combobox_tag, :hw_combobox_tag
30
- end
31
+ alias_method :combobox_tag, :hw_combobox_tag unless bypass_convenience_methods?
31
32
 
32
33
  def hw_listbox_option_id(option)
33
34
  option.try(:id)
@@ -1,3 +1,3 @@
1
1
  module HotwireCombobox
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotwire_combobox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Farias
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-12 00:00:00.000000000 Z
11
+ date: 2023-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails