plutonium 0.22.0 → 0.23.1

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.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plutonium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.0
4
+ version: 0.23.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Froelich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-05-10 00:00:00.000000000 Z
11
+ date: 2025-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -66,34 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '9.0'
69
- - !ruby/object:Gem::Dependency
70
- name: simple_form
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '5.3'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '5.3'
83
- - !ruby/object:Gem::Dependency
84
- name: dry-initializer
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.1'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '3.1'
97
69
  - !ruby/object:Gem::Dependency
98
70
  name: rabl
99
71
  requirement: !ruby/object:Gem::Requirement
@@ -192,62 +164,76 @@ dependencies:
192
164
  - - ">="
193
165
  - !ruby/object:Gem::Version
194
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: phlexi-field
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 0.2.0
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 0.2.0
195
181
  - !ruby/object:Gem::Dependency
196
182
  name: phlexi-form
197
183
  requirement: !ruby/object:Gem::Requirement
198
184
  requirements:
199
185
  - - "~>"
200
186
  - !ruby/object:Gem::Version
201
- version: 0.9.0
187
+ version: 0.10.0
202
188
  type: :runtime
203
189
  prerelease: false
204
190
  version_requirements: !ruby/object:Gem::Requirement
205
191
  requirements:
206
192
  - - "~>"
207
193
  - !ruby/object:Gem::Version
208
- version: 0.9.0
194
+ version: 0.10.0
209
195
  - !ruby/object:Gem::Dependency
210
196
  name: phlexi-table
211
197
  requirement: !ruby/object:Gem::Requirement
212
198
  requirements:
213
199
  - - "~>"
214
200
  - !ruby/object:Gem::Version
215
- version: 0.1.0
201
+ version: 0.2.0
216
202
  type: :runtime
217
203
  prerelease: false
218
204
  version_requirements: !ruby/object:Gem::Requirement
219
205
  requirements:
220
206
  - - "~>"
221
207
  - !ruby/object:Gem::Version
222
- version: 0.1.0
208
+ version: 0.2.0
223
209
  - !ruby/object:Gem::Dependency
224
210
  name: phlexi-display
225
211
  requirement: !ruby/object:Gem::Requirement
226
212
  requirements:
227
213
  - - "~>"
228
214
  - !ruby/object:Gem::Version
229
- version: 0.1.0
215
+ version: 0.2.0
230
216
  type: :runtime
231
217
  prerelease: false
232
218
  version_requirements: !ruby/object:Gem::Requirement
233
219
  requirements:
234
220
  - - "~>"
235
221
  - !ruby/object:Gem::Version
236
- version: 0.1.0
222
+ version: 0.2.0
237
223
  - !ruby/object:Gem::Dependency
238
224
  name: phlexi-menu
239
225
  requirement: !ruby/object:Gem::Requirement
240
226
  requirements:
241
227
  - - "~>"
242
228
  - !ruby/object:Gem::Version
243
- version: 0.3.0
229
+ version: 0.4.0
244
230
  type: :runtime
245
231
  prerelease: false
246
232
  version_requirements: !ruby/object:Gem::Requirement
247
233
  requirements:
248
234
  - - "~>"
249
235
  - !ruby/object:Gem::Version
250
- version: 0.3.0
236
+ version: 0.4.0
251
237
  - !ruby/object:Gem::Dependency
252
238
  name: tailwind_merge
253
239
  requirement: !ruby/object:Gem::Requirement
@@ -266,16 +252,16 @@ dependencies:
266
252
  name: phlex-slotable
267
253
  requirement: !ruby/object:Gem::Requirement
268
254
  requirements:
269
- - - ">="
255
+ - - "~>"
270
256
  - !ruby/object:Gem::Version
271
- version: '0'
257
+ version: 1.0.0
272
258
  type: :runtime
273
259
  prerelease: false
274
260
  version_requirements: !ruby/object:Gem::Requirement
275
261
  requirements:
276
- - - ">="
262
+ - - "~>"
277
263
  - !ruby/object:Gem::Version
278
- version: '0'
264
+ version: 1.0.0
279
265
  - !ruby/object:Gem::Dependency
280
266
  name: redcarpet
281
267
  requirement: !ruby/object:Gem::Requirement
@@ -502,7 +488,7 @@ files:
502
488
  - config/initializers/hotwire_turbo_monkey_patches.rb
503
489
  - config/initializers/pagy.rb
504
490
  - config/initializers/rabl.rb
505
- - config/initializers/simple_form.rb
491
+ - config/initializers/sqlite_json_alias.rb
506
492
  - docs/.vitepress/config.ts
507
493
  - docs/.vitepress/theme/custom.css
508
494
  - docs/.vitepress/theme/index.ts
@@ -799,8 +785,6 @@ files:
799
785
  - lib/plutonium/routing/mapper_extensions.rb
800
786
  - lib/plutonium/routing/resource_registration.rb
801
787
  - lib/plutonium/routing/route_set_extensions.rb
802
- - lib/plutonium/simple_form/attachment_component.rb
803
- - lib/plutonium/simple_form/input_group_component.rb
804
788
  - lib/plutonium/support/parameters.rb
805
789
  - lib/plutonium/ui.rb
806
790
  - lib/plutonium/ui/action_button.rb
@@ -811,6 +795,7 @@ files:
811
795
  - lib/plutonium/ui/component/behaviour.rb
812
796
  - lib/plutonium/ui/component/kit.rb
813
797
  - lib/plutonium/ui/component/methods.rb
798
+ - lib/plutonium/ui/component/tokens.rb
814
799
  - lib/plutonium/ui/display/base.rb
815
800
  - lib/plutonium/ui/display/components/association.rb
816
801
  - lib/plutonium/ui/display/components/attachment.rb
@@ -1,74 +0,0 @@
1
- require "simple_form"
2
-
3
- # Register components
4
- Dir.glob(Plutonium.lib_root.join("form_component", "*.rb")) { |component| load component }
5
-
6
- # Use this setup block to configure all options available in SimpleForm.
7
- SimpleForm.setup do |config|
8
- # Disable country select
9
- # TODO: handle this in plutonium
10
- config.input_mappings = {/country/ => :select}
11
-
12
- config.wrappers :default_resource_form, class: "flex flex-col md:flex-row items-start space-y-2 md:space-y-0 md:space-x-2 mb-4" do |b|
13
- b.use :html5
14
- b.use :placeholder
15
- b.use :maxlength
16
- b.use :minlength
17
- b.optional :pattern
18
- b.use :min_max
19
- b.optional :readonly
20
-
21
- b.use :label, class: "md:w-1/6 mt-2 text-sm font-medium"
22
-
23
- b.wrapper tag: :div, html: {class: "md:w-5/6 w-full"} do |ba|
24
- ba.use :input, class: "w-full p-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary-500 focus:border-primary-500 font-medium text-sm dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white",
25
- error_class: "bg-red-50 border border-red-500 text-red-900 placeholder-red-700 rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500",
26
- valid_class: "bg-green-50 border border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 rounded-lg focus:ring-green-500 focus:border-green-500 dark:bg-gray-700 dark:border-green-500"
27
- ba.use :full_error, wrap_with: {tag: "p", class: "mt-2 text-sm text-red-600 dark:text-red-500"}
28
- ba.use :hint, wrap_with: {tag: "p", class: "mt-2 text-sm text-gray-500 dark:text-gray-200"}
29
- end
30
- end
31
-
32
- # vertical multi select
33
- config.wrappers :resource_multi_select, class: "flex flex-col md:flex-row items-start space-y-2 md:space-y-0 md:space-x-2 mb-4" do |b|
34
- b.use :html5
35
- b.use :placeholder
36
- b.use :maxlength
37
- b.use :minlength
38
- b.optional :pattern
39
- b.use :min_max
40
- b.optional :readonly
41
-
42
- b.use :label, class: "md:w-1/6 mt-2 text-sm font-medium"
43
-
44
- b.wrapper tag: :div, html: {class: "md:w-5/6 w-full"} do |ba|
45
- ba.wrapper tag: :div, html: {class: "flex gap-2 flex-col md:flex-row items-center"} do |bc|
46
- bc.use :input, class: "w-full p-2 border border-gray-300 rounded-md shadow-sm focus:ring-primary-500 focus:border-primary-500 font-medium text-sm dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white",
47
- error_class: "bg-red-50 border border-red-500 text-red-900 placeholder-red-700 rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500",
48
- valid_class: "bg-green-50 border border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 rounded-lg focus:ring-green-500 focus:border-green-500 dark:bg-gray-700 dark:border-green-500"
49
- end
50
- ba.use :full_error, wrap_with: {tag: "p", class: "mt-2 text-sm text-red-600 dark:text-red-500"}
51
- ba.use :hint, wrap_with: {tag: "p", class: "mt-2 text-sm text-gray-500 dark:text-gray-200"}
52
- end
53
- end
54
-
55
- config.wrappers :resource_checkbox, class: "flex flex-col md:flex-row items-start space-y-2 md:space-y-0 md:space-x-2 mb-4" do |b|
56
- b.use :html5
57
- b.use :placeholder
58
- b.use :maxlength
59
- b.use :minlength
60
- b.optional :pattern
61
- b.use :min_max
62
- b.optional :readonly
63
-
64
- b.use :label, class: "md:w-1/6 mt-2 text-sm font-medium"
65
-
66
- b.wrapper tag: :div, html: {class: "md:w-5/6 w-full"} do |ba|
67
- ba.use :input, class: "w-4 h-4 text-primary-600 bg-gray-100 border-gray-300 rounded focus:ring-primary-500 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",
68
- error_class: "bg-red-50 border border-red-500 text-red-900 placeholder-red-700 rounded focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500",
69
- valid_class: "bg-green-50 border border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 rounded focus:ring-green-500 focus:border-green-500 dark:bg-gray-700 dark:border-green-500"
70
- ba.use :full_error, wrap_with: {tag: "p", class: "mt-2 text-sm text-red-600 dark:text-red-500"}
71
- ba.use :hint, wrap_with: {tag: "p", class: "mt-2 text-sm text-gray-500 dark:text-gray-200"}
72
- end
73
- end
74
- end
@@ -1,85 +0,0 @@
1
- require "simple_form"
2
-
3
- module Plutonium
4
- module SimpleForm
5
- module AttachmentComponent
6
- def attachment(_wrapper_options = nil)
7
- maybe_setup_direct_uploads
8
-
9
- template.content_tag :div, class: "attachment-input-previews" do
10
- # This is a hack to support the removal of has_one_attached attachments
11
- # Usually, no hidden field is inserted for these
12
- # By inserting one, with a value of nil, when the form is submitted,
13
- # the autogenerated setter will remove the attachment for us.
14
- template.concat @builder.hidden_field(attribute_name, value: nil, multiple: multiple?)
15
-
16
- next if value.nil?
17
-
18
- template.concat begin
19
- template.display_attachment_value value, identity_class: input_class, caption: caption? do |attachment|
20
- [
21
- # These hidden fields allow us to preserve the already uploaded files.
22
- # For has_one_attached, it overrides the hidden field previously added
23
- # (if the same input exists, the more recent one wins)
24
- #
25
- # For has_many_attached, the generated setter replaces all the existing files when the form is submitted
26
- # By adding hidden fields for the existing files, it allows us to append the new files
27
- @builder.hidden_field(attribute_name, multiple: multiple?, value: attachment.signed_id),
28
-
29
- # By removing this component, the hidden field is gone, which allows us to remove the files from active storage
30
- template.content_tag(:p, class: "text-danger m-0", role: :button,
31
- data: {action: "click->attachment-preview#remove"}) do
32
- template.content_tag :span, " Delete", class: "bi bi-trash"
33
- end
34
- ]
35
- end
36
- end
37
- end
38
- end
39
-
40
- private
41
-
42
- def value
43
- @value ||= object.public_send(attribute_name) if object&.respond_to?(attribute_name)
44
- end
45
-
46
- def multiple?
47
- options[:input_html] && options[:input_html][:multiple]
48
- end
49
-
50
- def caption?
51
- options.key?(:caption) ? options[:caption] : true
52
- end
53
-
54
- def maybe_setup_direct_uploads
55
- return unless options[:direct_upload]
56
-
57
- direct_upload_options = {
58
- data: {
59
- controller: :"attachment-input",
60
- attachment_input_identifier_value: input_class,
61
- attachment_input_attachment_preview_outlet: ".#{input_class}.attachment-preview",
62
- attachment_input_attachment_preview_container_outlet: ".#{input_class}.attachment-preview-container"
63
- }
64
- }
65
-
66
- {
67
- max_file_size: nil,
68
- min_file_size: nil,
69
- max_total_size: nil,
70
- max_file_num: multiple? ? nil : 1,
71
- min_file_num: nil,
72
- allowed_file_types: nil,
73
- required_meta_fields: nil
74
- }.each do |key, default_value|
75
- value = options.key?(key) ? options.delete(key) : default_value
76
- direct_upload_options[:data][:"attachment_input_#{key}_value"] = value
77
- end
78
-
79
- input_html_options.merge! direct_upload_options
80
- end
81
- end
82
- end
83
- end
84
- # Register with simple_form
85
- SimpleForm.include_component(Plutonium::SimpleForm::AttachmentComponent)
@@ -1,17 +0,0 @@
1
- require "simple_form"
2
-
3
- module Plutonium
4
- module SimpleForm
5
- module InputGroupComponent
6
- def prepend(_wrapper_options = nil)
7
- template.content_tag(:span, options[:prepend], class: "input-group-text")
8
- end
9
-
10
- def append(_wrapper_options = nil)
11
- template.content_tag(:span, options[:append], class: "input-group-text")
12
- end
13
- end
14
- end
15
- end
16
- # Register with simple_form
17
- SimpleForm.include_component(Plutonium::SimpleForm::InputGroupComponent)