view_primitives 0.2.1 → 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 +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/generators/view_primitives/add/templates/calendar/calendar_component.rb.tt +1 -1
- data/lib/generators/view_primitives/add/templates/tags_input/tags_input_component.rb.tt +8 -2
- data/lib/generators/view_primitives/install/install_generator.rb +3 -1
- data/lib/view_primitives/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b7ad50f006f2e848d1ea1286888087965825cbc8177a521bd01e9ec0b63f0e94
|
|
4
|
+
data.tar.gz: 35177906e6b1a0cc9f2f91116b9bc220301c72a9c0a3f2e53cad5f95b61f71cb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a00b47822b358a02788b878742bfac12f272e7cec10dc814d83463d199c0f8eddc233d428d7dbdfd659988cf94134809c08d9f23995727fccf3374da72161216
|
|
7
|
+
data.tar.gz: 406b1c90c6f485a2f6acc6655a993e45cc4466ebf4457fe8af738a3947e763e942328322253c5824d8fde752fde62283684a95257ebd0c12139b5f053002875f
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ 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
|
+
|
|
10
19
|
## [0.2.1] - 2026-07-15
|
|
11
20
|
|
|
12
21
|
### Changed
|
|
@@ -148,6 +157,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
148
157
|
- `view_primitives:add` exits with status 1 on unknown components; prints copy summary
|
|
149
158
|
- Requires `view_component >= 4.0` and Rails `>= 7.1`
|
|
150
159
|
|
|
160
|
+
[0.2.2]: https://github.com/alec-c4/view_primitives/releases/tag/v0.2.2
|
|
151
161
|
[0.2.1]: https://github.com/alec-c4/view_primitives/releases/tag/v0.2.1
|
|
152
162
|
[0.2.0]: https://github.com/alec-c4/view_primitives/releases/tag/v0.2.0
|
|
153
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
|
|
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:
|
|
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.
|
|
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"
|