superform 0.4.3 → 0.4.4

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: f0023768360f3864f5d40be3db143795445ab5f31aca7d166fd09294deaa8f1e
4
- data.tar.gz: 5a611e254153c2d32705302220581c41b376db5c7eb4eab289049a1cfe654e81
3
+ metadata.gz: 2db21420ecfac1a9133026933f8b05a9a7512bbc35c60ebf605abe88eda05d5b
4
+ data.tar.gz: 33761bcb89952fc6926f4ef798bb3c6665d2b4ce4528b7f451e58a103f9014bb
5
5
  SHA512:
6
- metadata.gz: 7392079da126e3a623ba0dc95e52872c1a04f2995ac2236100ae93f33f8470ed336140449e83e19c294ab8024ed56a8ee9a85f5f0ed9018901cc7dd12cb05e7f
7
- data.tar.gz: 633cdeb0536d1a44bdd4943ef71e88f5acc13d6555a28f2bc026cabf44318f925eda333218c2591a42ffca26b8f49602f2fe8f4dea94332295f9f261b11980e2
6
+ metadata.gz: 77158970877d1a26538636bb30a4c1949c35d69058e0576bed151f3fb3aa18bc7503a2a1ed6ee7651cc28bdf29244f74a3e15197fe4599cdde4096da8cfb1c90
7
+ data.tar.gz: 6edc1b33b36048b6d3be87eb860b4b7e96595bcda869fa57e5dad390a18e2f8bf7498b75fd46449ce156a85d3f15c606be2856ae725edfa0a1444ddb1915591d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- superform (0.4.2)
4
+ superform (0.4.4)
5
5
  phlex-rails (~> 1.0)
6
6
  zeitwerk (~> 2.6)
7
7
 
@@ -118,6 +118,7 @@ GEM
118
118
  marcel (1.0.2)
119
119
  method_source (1.0.0)
120
120
  mini_mime (1.1.2)
121
+ mini_portile2 (2.8.5)
121
122
  minitest (5.18.1)
122
123
  nenv (0.3.0)
123
124
  net-imap (0.3.6)
@@ -130,9 +131,8 @@ GEM
130
131
  net-smtp (0.3.3)
131
132
  net-protocol
132
133
  nio4r (2.5.9)
133
- nokogiri (1.15.3-arm64-darwin)
134
- racc (~> 1.4)
135
- nokogiri (1.15.3-x86_64-linux)
134
+ nokogiri (1.15.3)
135
+ mini_portile2 (~> 2.8.2)
136
136
  racc (~> 1.4)
137
137
  notiffany (0.1.3)
138
138
  nenv (~> 0.1)
@@ -209,6 +209,7 @@ GEM
209
209
 
210
210
  PLATFORMS
211
211
  arm64-darwin-22
212
+ arm64-darwin-23
212
213
  x86_64-linux
213
214
 
214
215
  DEPENDENCIES
@@ -54,6 +54,10 @@ module Superform
54
54
  Components::InputComponent.new(self, attributes: attributes)
55
55
  end
56
56
 
57
+ def checkbox(**attributes)
58
+ Components::CheckboxComponent.new(self, attributes: attributes)
59
+ end
60
+
57
61
  def label(**attributes)
58
62
  Components::LabelComponent.new(self, attributes: attributes)
59
63
  end
@@ -245,6 +249,19 @@ module Superform
245
249
  end
246
250
  end
247
251
 
252
+ class CheckboxComponent < FieldComponent
253
+ def template(&)
254
+ # Rails has a hidden and checkbox input to deal with sending back a value
255
+ # to the server regardless of if the input is checked or not.
256
+ input(name: dom.name, type: :hidden, value: "0")
257
+ input(**attributes)
258
+ end
259
+
260
+ def field_attributes
261
+ { id: dom.id, name: dom.name, value: "1", checked: field.value, type: :checkbox }
262
+ end
263
+ end
264
+
248
265
  class InputComponent < FieldComponent
249
266
  def template(&)
250
267
  input(**attributes)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Superform
4
- VERSION = "0.4.3"
4
+ VERSION = "0.4.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-25 00:00:00.000000000 Z
11
+ date: 2024-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phlex-rails