shoelace-rails 0.3.0 → 0.4.0

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: 6bf02de3fbe6ef35ad4c464e666bd7ace7bf0c2e673b0767afea4d6b87522749
4
- data.tar.gz: 73abb906c86ffc3f4a945f73f3a97e3cd335c1cb4245b82362cf53c3587619d5
3
+ metadata.gz: 4d765c426ef9b3551956028e292d1fe312f04c85b5e1184d2f44193c348809ae
4
+ data.tar.gz: 662389bc95dc73c15851d9343304da787d70b6f93bff4dcb16124d42fa8fb7c6
5
5
  SHA512:
6
- metadata.gz: 1e7a5bca7b14951f97b54c9de1be69698ceebb63a421be912cc8f692ebec8ed075ebdf58a4fbc9d9200c296e3150ae63f41f6a6a40f62fc368c1a54044905a9b
7
- data.tar.gz: 5d09b9294065025cb30762a152c3b037739790a8b16ff5e2178bcb98afc0592756447ba0273967450783e11fbfd9863be5e11027a61074ed622e35d380a95dc5
6
+ metadata.gz: 21e95f106d6c8cff0b8edb1cdfec3d3e5d11e1a477a7ba2eff509035194666cdecadeef43465d8f426ea22082b4ce174fb3e47d82e8f7f9be4aa7e257e4a0e76
7
+ data.tar.gz: 4eeb6447fb6c65179fd0514e58171ca45045069b87835cb993c8935aa4011e267b308308fffebca5fbe2409013d78548904defba33d8f28716d7370569c19b0b
data/CHANGELOG.md CHANGED
@@ -1,28 +1,38 @@
1
- ## v0.3.0
1
+ ## v0.4.0
2
2
 
3
- _<sup>released at 2023-01-05 08:47:12 UTC</sup>_
3
+ #### 🚨 Breaking Changes
4
+
5
+ - No longer works with 2.0.0-beta.88 and below.
6
+
7
+ #### ⭐️ Features
8
+
9
+ - Support Shoelace.style 2.0.0-beta.88
10
+
11
+ ## [v0.3.0](https://github.com/yuki24/shoelace-rails/tree/v0.3.0)
12
+
13
+ _<sup>released at 2023-01-05 08:49:23 UTC</sup>_
4
14
 
5
15
  #### Features
6
16
 
7
- - No longer requires the `sl-form` component (`4fdbfa15`)
8
- - The `#text_area` method now accepts a block (`5092dc1c`)
9
- - Allow overriding the value attribute for `<sl-select>` (`1f38be73`)
10
- - Auto-display labels whenever possible (`c1e3a950`)
11
- - `<sl-select>` now always has a label by default (`f9fb5f0c`)
12
- - Support Ruby 3.2 (`b286cbc1`)
13
- - Add `#sl_button_to` (`e1bdedba`)
14
- - Add `#sl_icon_tag` (`8a2187a2`)
15
- - Add `#sl_avatar_tag` (`77dccdb2`)
16
- - Allow using the `Shoelace::FormBuilder` in a cleaner way (`43dea330`)
17
+ - No longer requires the `sl-form` component ([<tt>4fdbfa1</tt>](https://github.com/yuki24/shoelace-rails/commit/4fdbfa15fa10db9e7240378ca34ebcc494d18f1a))
18
+ - The `#text_area` method now accepts a block ([<tt>5092dc1</tt>](https://github.com/yuki24/shoelace-rails/commit/5092dc1cbc7e8e74552451450804baa378ab1f11))
19
+ - Allow overriding the value attribute for `<sl-select>` ([<tt>1f38be7</tt>](https://github.com/yuki24/shoelace-rails/commit/1f38be73e3335c10e846393ebcf5155d155b00b2))
20
+ - Auto-display labels whenever possible ([<tt>c1e3a95</tt>](https://github.com/yuki24/shoelace-rails/commit/c1e3a950c3e8ac4238ed3e83e4d87467a68eb91f))
21
+ - `<sl-select>` now always has a label by default ([<tt>f9fb5f0</tt>](https://github.com/yuki24/shoelace-rails/commit/f9fb5f0cd74d179241be51510fa1c306481946c9))
22
+ - Support Ruby 3.2 ([<tt>b286cbc</tt>](https://github.com/yuki24/shoelace-rails/commit/b286cbc18930218ab5c82bd8648a51e9c6ce53db))
23
+ - Add `#sl_button_to` ([<tt>e1bdedb</tt>](https://github.com/yuki24/shoelace-rails/commit/e1bdedba4656d89a82c78641644490085da1fa37))
24
+ - Add `#sl_icon_tag` ([<tt>8a2187a</tt>](https://github.com/yuki24/shoelace-rails/commit/8a2187a2800771512fccf2c8231378a77be59df4))
25
+ - Add `#sl_avatar_tag` ([<tt>77dccdb</tt>](https://github.com/yuki24/shoelace-rails/commit/77dccdb24cfc014bd997ffb66ad89ff95afb3ef7))
26
+ - Allow using the `Shoelace::FormBuilder` in a cleaner way ([<tt>43dea33</tt>](https://github.com/yuki24/shoelace-rails/commit/43dea3309c3e0cf9d9b43b6957f6e54ad9497c9f))
17
27
 
18
28
  #### Bug Fixes
19
29
 
20
- - Fixes a bug where the gem rake tasks are not loaded (`115bfb3d`)
21
- - Fixes a bug where values are not properly passed in to `<sl-textarea>` (`3d163845`)
22
- - Make sure yarn install is always executed before copying shoelace assets (`98018a27`)
23
- - Fixes a bug where the `@object` needs to respond to `#errors` (`bb981ed0`)
24
- - Fixes a bug where the `size` attr is ignored by the `#text_area` method (`8bc4c378`)
25
- - Fixes a bug where unchecked checkbox values are not captured (`dc658bea`)
30
+ - Fixes a bug where the gem rake tasks are not loaded ([<tt>115bfb3</tt>](https://github.com/yuki24/shoelace-rails/commit/115bfb3d81ca19b5b922a5fb32f46adb1d6e8544))
31
+ - Fixes a bug where values are not properly passed in to `<sl-textarea>` ([<tt>3d16384</tt>](https://github.com/yuki24/shoelace-rails/commit/3d16384554bd4a6143e28e483f8d6bee8fb2e073))
32
+ - Make sure yarn install is always executed before copying shoelace assets ([<tt>98018a2</tt>](https://github.com/yuki24/shoelace-rails/commit/98018a27a29ddc9ff2c2fa066bbe986709803a1d))
33
+ - Fixes a bug where the `@object` needs to respond to `#errors` ([<tt>bb981ed</tt>](https://github.com/yuki24/shoelace-rails/commit/bb981ed05825707cef89d70a7d1699c12cd0ba9b))
34
+ - Fixes a bug where the `size` attr is ignored by the `#text_area` method ([<tt>8bc4c37</tt>](https://github.com/yuki24/shoelace-rails/commit/8bc4c3784a458e7fc9c18a143578b2cbf588e9e7))
35
+ - Fixes a bug where unchecked checkbox values are not captured ([<tt>dc658be</tt>](https://github.com/yuki24/shoelace-rails/commit/dc658bea9fc4d4205dacdfe133b091c5a5edf14c))
26
36
 
27
37
  ## [v0.2.0](https://github.com/yuki24/shoelace-rails/tree/v0.2.0)
28
38
 
data/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  The `shoelace-rails` gem adds useful helper methods for [Shoelace.style](https://shoelace.style), the design system.
4
4
 
5
+ ## Compatibility with Shoelace
6
+
7
+ * **For Shoelace version >= 2.0.0-beta.88, use the gem version `0.4.0` or above**.
8
+ * For Shoelace version <= 2.0.0-beta.87, use the gem version `0.3.0`.
9
+
5
10
  ## Installation
6
11
 
7
12
  Add this line to your application's Gemfile:
@@ -274,7 +274,7 @@ module Shoelace
274
274
  content_tag('sl-input', '', { "type" => "text", "name" => name, "id" => sanitize_to_id(name), "value" => value }.update(options.stringify_keys), &block)
275
275
  end
276
276
 
277
- # Returns a string of +<sl-menu-item>+ tags, like +options_for_select+, but prepends a +<sl-menu-label>+ tag to
277
+ # Returns a string of +<sl-option>+ tags, like +options_for_select+, but prepends a +<small>+ tag to
278
278
  # each group.
279
279
  def grouped_sl_options_for_select(grouped_options, options)
280
280
  body = "".html_safe
@@ -283,14 +283,14 @@ module Shoelace
283
283
  label, values = container
284
284
 
285
285
  body.safe_concat(DIVIDER_TAG) if index > 0
286
- body.safe_concat(content_tag("sl-menu-label", label)) if label.present?
286
+ body.safe_concat(content_tag("small", label)) if label.present?
287
287
  body.safe_concat(sl_options_for_select(values, options))
288
288
  end
289
289
 
290
290
  body
291
291
  end
292
292
 
293
- # Accepts an enumerable (hash, array, enumerable, your type) and returns a string of +sl-menu-item+ tags. Given
293
+ # Accepts an enumerable (hash, array, enumerable, your type) and returns a string of +sl-option+ tags. Given
294
294
  # an enumerable where the elements respond to +first+ and +last+ (such as a two-element array), the “lasts” serve
295
295
  # as option values and the “firsts” as option text.
296
296
  def sl_options_for_select(enumerable, options = nil)
@@ -306,11 +306,11 @@ module Shoelace
306
306
  html_attributes[:disabled] ||= disabled.include?(value)
307
307
  html_attributes[:value] = value
308
308
 
309
- tag_builder.content_tag_string('sl-menu-item', text, html_attributes)
309
+ tag_builder.content_tag_string('sl-option', text, html_attributes)
310
310
  end.join("\n").html_safe
311
311
  end
312
312
 
313
- # Returns a string of +<sl-menu-item>+ tags compiled by iterating over the collection and assigning the result of
313
+ # Returns a string of +<sl-option>+ tags compiled by iterating over the collection and assigning the result of
314
314
  # a call to the +value_method+ as the option value and the +text_method+ as the option text.
315
315
  def sl_options_from_collection_for_select(collection, value_method, text_method, selected = nil)
316
316
  options = collection.map do |element|
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Shoelace
4
4
  module Rails
5
- VERSION = "0.3.0"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  end
@@ -7,7 +7,7 @@ module Shoelace
7
7
  select_element.click
8
8
 
9
9
  within select_element do
10
- find('sl-menu-item', text: option_text).click
10
+ find('sl-option', text: option_text).click
11
11
  end
12
12
 
13
13
  select_element
@@ -19,7 +19,7 @@ module Shoelace
19
19
  select_element.click
20
20
  within select_element do
21
21
  options_to_select.each do |option_text|
22
- find('sl-menu-item', text: option_text).click
22
+ find('sl-option', text: option_text).click
23
23
  end
24
24
  end
25
25
 
@@ -21,8 +21,8 @@
21
21
  }
22
22
  </style>
23
23
 
24
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.0.0-beta.87/dist/themes/light.css">
25
- <script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.0.0-beta.87/dist/shoelace.js"></script>
24
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.0.0-beta.88/dist/themes/light.css">
25
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.0.0-beta.88/dist/shoelace.js"></script>
26
26
 
27
27
  <% if request.path.include?("hotwire") %>
28
28
  <%= javascript_pack_tag 'hotwire' %>
@@ -282,9 +282,9 @@ class FormHelperTest < ActionView::TestCase
282
282
  sl_form_for(User.new, url: "/") do |form|
283
283
  assert_dom_equal <<~HTML, form.select(:name, users)
284
284
  <sl-select label="Name" name="user[name]" id="user_name">
285
- <sl-menu-item value="1">Yuki Nishijima</sl-menu-item>
286
- <sl-menu-item value="2">Matz</sl-menu-item>
287
- <sl-menu-item value="3">Koichi Sasada</sl-menu-item>
285
+ <sl-option value="1">Yuki Nishijima</sl-option>
286
+ <sl-option value="2">Matz</sl-option>
287
+ <sl-option value="3">Koichi Sasada</sl-option>
288
288
  </sl-select>
289
289
  HTML
290
290
  end
@@ -300,9 +300,9 @@ class FormHelperTest < ActionView::TestCase
300
300
  sl_form_for(User.new, url: "/") do |form|
301
301
  assert_dom_equal <<~HTML, form.select(:name, users, {}, { value: 3 })
302
302
  <sl-select label="Name" value="3" name="user[name]" id="user_name">
303
- <sl-menu-item value="1">Yuki Nishijima</sl-menu-item>
304
- <sl-menu-item value="2">Matz</sl-menu-item>
305
- <sl-menu-item value="3">Koichi Sasada</sl-menu-item>
303
+ <sl-option value="1">Yuki Nishijima</sl-option>
304
+ <sl-option value="2">Matz</sl-option>
305
+ <sl-option value="3">Koichi Sasada</sl-option>
306
306
  </sl-select>
307
307
  HTML
308
308
  end
@@ -318,9 +318,9 @@ class FormHelperTest < ActionView::TestCase
318
318
  sl_form_for(User.new, url: "/") do |form|
319
319
  assert_dom_equal <<~HTML, form.select(:name, users, selected: 3, disabled: 1)
320
320
  <sl-select label="Name" name="user[name]" id="user_name">
321
- <sl-menu-item value="1" disabled="disabled">Yuki Nishijima</sl-menu-item>
322
- <sl-menu-item value="2">Matz</sl-menu-item>
323
- <sl-menu-item value="3" checked="checked">Koichi Sasada</sl-menu-item>
321
+ <sl-option value="1" disabled="disabled">Yuki Nishijima</sl-option>
322
+ <sl-option value="2">Matz</sl-option>
323
+ <sl-option value="3" checked="checked">Koichi Sasada</sl-option>
324
324
  </sl-select>
325
325
  HTML
326
326
  end
@@ -336,9 +336,9 @@ class FormHelperTest < ActionView::TestCase
336
336
  sl_form_for(User.new, url: "/") do |form|
337
337
  assert_dom_equal <<~HTML, form.select(:name, users, {}, { multiple: true })
338
338
  <sl-select label="Name" name="user[name][]" id="user_name" multiple="multiple">
339
- <sl-menu-item value="1">Yuki Nishijima</sl-menu-item>
340
- <sl-menu-item value="2">Matz</sl-menu-item>
341
- <sl-menu-item value="3">Koichi Sasada</sl-menu-item>
339
+ <sl-option value="1">Yuki Nishijima</sl-option>
340
+ <sl-option value="2">Matz</sl-option>
341
+ <sl-option value="3">Koichi Sasada</sl-option>
342
342
  </sl-select>
343
343
  HTML
344
344
  end
@@ -358,12 +358,12 @@ class FormHelperTest < ActionView::TestCase
358
358
  sl_form_for(User.new, url: "/") do |form|
359
359
  assert_dom_equal <<~HTML, form.select(:name, users)
360
360
  <sl-select label="Name" name="user[name]" id="user_name">
361
- <sl-menu-label>Main maintainers</sl-menu-label>
362
- <sl-menu-item value="2">Matz</sl-menu-item>
363
- <sl-menu-item value="3">Koichi Sasada</sl-menu-item>
361
+ <small>Main maintainers</small>
362
+ <sl-option value="2">Matz</sl-option>
363
+ <sl-option value="3">Koichi Sasada</sl-option>
364
364
  <sl-divider></sl-divider>
365
- <sl-menu-label>Default gem maintainers</sl-menu-label>
366
- <sl-menu-item value="1">Yuki Nishijima</sl-menu-item>
365
+ <small>Default gem maintainers</small>
366
+ <sl-option value="1">Yuki Nishijima</sl-option>
367
367
  </sl-select>
368
368
  HTML
369
369
  end
@@ -383,12 +383,12 @@ class FormHelperTest < ActionView::TestCase
383
383
  sl_form_for(User.new(name: 2), url: "/") do |form|
384
384
  assert_dom_equal <<~HTML, form.select(:name, users)
385
385
  <sl-select label="Name" name="user[name]" id="user_name" value="2">
386
- <sl-menu-label>Main maintainers</sl-menu-label>
387
- <sl-menu-item value="2" checked="checked">Matz</sl-menu-item>
388
- <sl-menu-item value="3">Koichi Sasada</sl-menu-item>
386
+ <small>Main maintainers</small>
387
+ <sl-option value="2" checked="checked">Matz</sl-option>
388
+ <sl-option value="3">Koichi Sasada</sl-option>
389
389
  <sl-divider></sl-divider>
390
- <sl-menu-label>Default gem maintainers</sl-menu-label>
391
- <sl-menu-item value="1">Yuki Nishijima</sl-menu-item>
390
+ <small>Default gem maintainers</small>
391
+ <sl-option value="1">Yuki Nishijima</sl-option>
392
392
  </sl-select>
393
393
  HTML
394
394
  end
@@ -404,9 +404,9 @@ class FormHelperTest < ActionView::TestCase
404
404
  sl_form_for(User.new, url: "/") do |form|
405
405
  assert_dom_equal <<~HTML, form.collection_select(:name, users, :first, :last)
406
406
  <sl-select label="Name" name="user[name]" id="user_name">
407
- <sl-menu-item value="1">Yuki Nishijima</sl-menu-item>
408
- <sl-menu-item value="2">Matz</sl-menu-item>
409
- <sl-menu-item value="3">Koichi Sasada</sl-menu-item>
407
+ <sl-option value="1">Yuki Nishijima</sl-option>
408
+ <sl-option value="2">Matz</sl-option>
409
+ <sl-option value="3">Koichi Sasada</sl-option>
410
410
  </sl-select>
411
411
  HTML
412
412
  end
@@ -422,9 +422,9 @@ class FormHelperTest < ActionView::TestCase
422
422
  sl_form_for(User.new(name: "2"), url: "/") do |form|
423
423
  assert_dom_equal <<~HTML, form.collection_select(:name, users, :first, :last)
424
424
  <sl-select label="Name" name="user[name]" id="user_name" value="2">
425
- <sl-menu-item value="1">Yuki Nishijima</sl-menu-item>
426
- <sl-menu-item value="2" checked="checked">Matz</sl-menu-item>
427
- <sl-menu-item value="3">Koichi Sasada</sl-menu-item>
425
+ <sl-option value="1">Yuki Nishijima</sl-option>
426
+ <sl-option value="2" checked="checked">Matz</sl-option>
427
+ <sl-option value="3">Koichi Sasada</sl-option>
428
428
  </sl-select>
429
429
  HTML
430
430
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoelace-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Nishijima
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-05 00:00:00.000000000 Z
11
+ date: 2023-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  requirements: []
196
- rubygems_version: 3.4.1
196
+ rubygems_version: 3.4.2
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: Rails view helpers Shoelace.style, the design system.