view_primitives 0.2.0 → 0.2.2

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: cc1d6eea996ab223f1175ccb81a475051e949ee3a7bf1f0c9d9102b5b744a8f8
4
- data.tar.gz: b41ca1269df44e350e40e87d039b5ac2c97385bdf638e37a89da40ed8b463895
3
+ metadata.gz: b7ad50f006f2e848d1ea1286888087965825cbc8177a521bd01e9ec0b63f0e94
4
+ data.tar.gz: 35177906e6b1a0cc9f2f91116b9bc220301c72a9c0a3f2e53cad5f95b61f71cb
5
5
  SHA512:
6
- metadata.gz: 32adf0c91b8b894420a2441b53ea82c25bc0e8fc542e89b33aec7c64cdaa3ef292d0b3550e9fbc83924ec0873560b41686c1d6c6ac4198cacdeadb43b19e3c31
7
- data.tar.gz: 6b669fe4ecb2c66b42f952da057e658a1a6d0f20c71550a10fca288b2af91259f6609d3e2925a901bef0bd3e10f4604496f1c2e0a31a8363e7ea1e0b8b4a3a30
6
+ metadata.gz: a00b47822b358a02788b878742bfac12f272e7cec10dc814d83463d199c0f8eddc233d428d7dbdfd659988cf94134809c08d9f23995727fccf3374da72161216
7
+ data.tar.gz: 406b1c90c6f485a2f6acc6655a993e45cc4466ebf4457fe8af738a3947e763e942328322253c5824d8fde752fde62283684a95257ebd0c12139b5f053002875f
data/CHANGELOG.md CHANGED
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.2] - 2026-07-15
11
+
12
+ ### Fixed
13
+
14
+ - `install` generator respects overwrite prompts for `UI::Styles` and the CSS bundle (same behaviour as `add` and `update`)
15
+ - **Calendar** renders a hidden input when `name` is set but no date is selected — fixes form data loss on clear or initial render
16
+ - **TagsInput** no longer double-appends `[]` when `name` already ends with `[]`
17
+ - **TagsInput** preserves pre-selected values that are missing from the current `options` list (edit forms with stale tags)
18
+
19
+ ## [0.2.1] - 2026-07-15
20
+
21
+ ### Changed
22
+
23
+ - CI: Ruby 3.2 removed from the test matrix; the gem is now tested against Ruby 3.3, 3.4, and 4.0
24
+ - Development and runtime dependency updates (concurrent-ruby 1.3.7, nokogiri 1.19.4, net-imap 0.6.4.1)
25
+
10
26
  ## [0.2.0] - 2026-06-08
11
27
 
12
28
  ### Added
@@ -141,5 +157,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
141
157
  - `view_primitives:add` exits with status 1 on unknown components; prints copy summary
142
158
  - Requires `view_component >= 4.0` and Rails `>= 7.1`
143
159
 
160
+ [0.2.2]: https://github.com/alec-c4/view_primitives/releases/tag/v0.2.2
161
+ [0.2.1]: https://github.com/alec-c4/view_primitives/releases/tag/v0.2.1
144
162
  [0.2.0]: https://github.com/alec-c4/view_primitives/releases/tag/v0.2.0
145
163
  [0.1.0]: https://github.com/alec-c4/view_primitives/releases/tag/v0.1.0
@@ -46,7 +46,7 @@ module UI
46
46
  class: cn(CONTAINER, @extra_class),
47
47
  data: { slot: "calendar", controller: "calendar", calendar_month_value: @month.iso8601 },
48
48
  **@html_attrs) do
49
- concat hidden_input if @name && @selected
49
+ concat hidden_input if @name
50
50
  concat header_row
51
51
  concat day_of_week_row
52
52
  concat day_grid
@@ -56,7 +56,7 @@ module UI
56
56
  class: CHIP,
57
57
  data: {"tags-input-target": "chip", "tags-input-value": opt[:value]}) do
58
58
  concat content_tag(:span, opt[:label], class: CHIP_LABEL)
59
- concat tag.input(type: "hidden", name: "#{@name}[]", value: opt[:value])
59
+ concat tag.input(type: "hidden", name: hidden_input_name, value: opt[:value])
60
60
  concat remove_button(opt[:value])
61
61
  end
62
62
  end
@@ -130,7 +130,13 @@ module UI
130
130
  end
131
131
 
132
132
  def selected_options
133
- normalized_options.select { |o| @values.include?(o[:value]) }
133
+ options_by_value = normalized_options.to_h { |o| [o[:value], o] }
134
+ @values.map { |value| options_by_value.fetch(value, {value: value, label: value}) }
135
+ end
136
+
137
+ def hidden_input_name
138
+ name = @name.to_s
139
+ name.end_with?("[]") ? name : "#{name}[]"
134
140
  end
135
141
  end
136
142
  end
@@ -1,16 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../detector"
4
+ require_relative "../component_copier"
4
5
 
5
6
  module ViewPrimitives
6
7
  module Generators
7
8
  class InstallGenerator < Rails::Generators::Base
8
9
  include Detector
10
+ include ComponentCopier
9
11
 
10
12
  source_root File.expand_path("templates", __dir__)
11
13
 
12
14
  class_option :force, type: :boolean, default: false,
13
- desc: "Overwrite existing ApplicationComponent and CSS files"
15
+ desc: "Overwrite existing ApplicationComponent, UI styles, and CSS files"
14
16
 
15
17
  def verify_ui_inflection
16
18
  return if "ui/button_component".camelize == "UI::ButtonComponent"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ViewPrimitives
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: view_primitives
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Poimtsev
@@ -269,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
269
  - !ruby/object:Gem::Version
270
270
  version: '0'
271
271
  requirements: []
272
- rubygems_version: 4.0.13
272
+ rubygems_version: 4.0.16
273
273
  specification_version: 4
274
274
  summary: Primitive view components and helpers for Rails applications
275
275
  test_files: []