hotwire_combobox 0.1.30 → 0.1.32

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: 4893ac34075f430aae8ba9b29af13ef5338bf978c55147c661b372e5f19b5d57
4
- data.tar.gz: 38b85aecdc36491ff46d073736dbf8613fc0b6457bd1ef6ed6b3e8819510665f
3
+ metadata.gz: eb06e6c688920de5447b5fbea7fd20c242e228a7d335b8e9841cd07c7df03cb0
4
+ data.tar.gz: 338aad9ff496b0449e509543698c45b7581cbe9d6c13e869b25a86fa8819b726
5
5
  SHA512:
6
- metadata.gz: f8c578b4daeafe222b0b22f8b826ba1600f0b853f4daad6e5bba70374318a32e866975a607c5820dd2c626f3cac383e9aa28b8febead4059bbaba32315653a1d
7
- data.tar.gz: 9591dc2130c1574ee2afd95c0483e172028fa68bc0cbfed88d0dfc8aa3f6c50fdaa53e50dbaa35eac2dac75da85c3e80aaaf8051484bdf4cc08738cd2bdc5836
6
+ metadata.gz: 84e88c954657e5f527ac5b564ff210ddeb42cd8e9dcb33a5ef40a9882d6edabbbe40fd53211a95b46056336399babf728bb11c7e5993dd845e2a8cbc86fe7b47
7
+ data.tar.gz: 9803e31d7244ec3b87d6a6e0dc3532db155f206a540c69d4ee07d586e5e781da0dc5a267e5fa9c8bd4394b006272cfa361d511fb48c29c4d37d7c9a03627107b
@@ -11,10 +11,10 @@ class HotwireCombobox::Component
11
11
  form: nil,
12
12
  id: nil,
13
13
  input: {},
14
+ mobile_at: "640px",
14
15
  name_when_new: nil,
15
16
  open: false,
16
17
  options: [],
17
- mobile_at: "640px",
18
18
  value: nil,
19
19
  **rest
20
20
  @view, @autocomplete, @id, @name, @value, @form, @async_src,
@@ -137,7 +137,7 @@ class HotwireCombobox::Component
137
137
  end
138
138
 
139
139
  def pagination_attrs
140
- { for_id: hidden_field_id, src: async_src }
140
+ { for_id: canonical_id, src: async_src }
141
141
  end
142
142
 
143
143
  private
@@ -153,7 +153,7 @@ class HotwireCombobox::Component
153
153
 
154
154
  def fieldset_data
155
155
  data.reverse_merge \
156
- async_id: hidden_field_id,
156
+ async_id: canonical_id,
157
157
  controller: view.token_list("hw-combobox", data[:controller]),
158
158
  hw_combobox_expanded_value: open,
159
159
  hw_combobox_name_when_new_value: name_when_new,
@@ -186,10 +186,15 @@ class HotwireCombobox::Component
186
186
  end
187
187
 
188
188
 
189
- def hidden_field_id
189
+ def canonical_id
190
190
  id || form&.field_id(name)
191
191
  end
192
192
 
193
+
194
+ def hidden_field_id
195
+ "#{canonical_id}-hw-hidden-field"
196
+ end
197
+
193
198
  def hidden_field_name
194
199
  form&.field_name(name) || name
195
200
  end
@@ -204,7 +209,7 @@ class HotwireCombobox::Component
204
209
 
205
210
 
206
211
  def input_id
207
- "#{hidden_field_id}-hw-combobox"
212
+ canonical_id
208
213
  end
209
214
 
210
215
  def input_type
@@ -220,7 +225,7 @@ class HotwireCombobox::Component
220
225
  click@window->hw-combobox#closeOnClickOutside
221
226
  focusin@window->hw-combobox#closeOnFocusOutside".squish,
222
227
  hw_combobox_target: "combobox",
223
- async_id: hidden_field_id
228
+ async_id: canonical_id
224
229
  end
225
230
 
226
231
  def input_aria
@@ -241,7 +246,7 @@ class HotwireCombobox::Component
241
246
 
242
247
 
243
248
  def listbox_id
244
- "#{hidden_field_id}-hw-listbox"
249
+ "#{canonical_id}-hw-listbox"
245
250
  end
246
251
 
247
252
  def listbox_data
@@ -262,7 +267,7 @@ class HotwireCombobox::Component
262
267
  end
263
268
 
264
269
  def dialog_input_id
265
- "#{hidden_field_id}-hw-dialog-combobox"
270
+ "#{canonical_id}-hw-dialog-combobox"
266
271
  end
267
272
 
268
273
  def dialog_input_data
@@ -284,7 +289,7 @@ class HotwireCombobox::Component
284
289
  end
285
290
 
286
291
  def dialog_listbox_id
287
- "#{hidden_field_id}-hw-dialog-listbox"
292
+ "#{canonical_id}-hw-dialog-listbox"
288
293
  end
289
294
 
290
295
  def dialog_listbox_data
@@ -46,6 +46,9 @@ module HotwireCombobox
46
46
  end
47
47
  hw_alias :hw_paginated_combobox_options
48
48
 
49
+ alias_method :hw_async_combobox_options, :hw_paginated_combobox_options
50
+ hw_alias :hw_async_combobox_options
51
+
49
52
  protected # library use only
50
53
  def hw_listbox_options_id(id)
51
54
  "#{id}-hw-listbox__options"
@@ -55,6 +58,16 @@ module HotwireCombobox
55
58
  "#{id}__hw_combobox_pagination"
56
59
  end
57
60
 
61
+ def hw_combobox_next_page_uri(uri, next_page)
62
+ if next_page
63
+ hw_uri_with_params uri, page: next_page, q: params[:q], format: :turbo_stream
64
+ end
65
+ end
66
+
67
+ def hw_combobox_page_stream_action
68
+ params[:page] ? :append : :update
69
+ end
70
+
58
71
  private
59
72
  def hw_extract_options_and_src(options_or_src, render_in)
60
73
  if options_or_src.is_a? String
@@ -96,15 +109,5 @@ module HotwireCombobox
96
109
  object.public_send method_or_proc
97
110
  end
98
111
  end
99
-
100
- def hw_combobox_next_page_uri(uri, next_page)
101
- if next_page
102
- hw_uri_with_params uri, page: next_page, q: params[:q], format: :turbo_stream
103
- end
104
- end
105
-
106
- def hw_combobox_page_stream_action
107
- params[:page] ? :append : :update
108
- end
109
112
  end
110
113
  end
@@ -1,3 +1,3 @@
1
1
  module HotwireCombobox
2
- VERSION = "0.1.30"
2
+ VERSION = "0.1.32"
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.30
4
+ version: 0.1.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jose Farias
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-07 00:00:00.000000000 Z
11
+ date: 2024-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails