phlex-forms 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +70 -0
- data/README.md +229 -52
- data/lib/forms/base.rb +100 -0
- data/lib/forms/field.rb +39 -21
- data/lib/forms/fields_for_builder.rb +19 -6
- data/lib/forms/form.rb +38 -10
- data/lib/forms/group.rb +23 -0
- data/lib/forms/live/field.rb +22 -0
- data/lib/forms/live.rb +179 -0
- data/lib/forms/plain/checkbox.rb +17 -0
- data/lib/forms/plain/control.rb +23 -0
- data/lib/forms/plain/field_error.rb +15 -0
- data/lib/forms/plain/field_hint.rb +14 -0
- data/lib/forms/plain/file_input.rb +14 -0
- data/lib/forms/plain/group.rb +15 -0
- data/lib/forms/plain/input.rb +13 -0
- data/lib/forms/plain/label.rb +19 -0
- data/lib/forms/plain/radio.rb +14 -0
- data/lib/forms/plain/row.rb +13 -0
- data/lib/forms/plain/select.rb +22 -0
- data/lib/forms/plain/submit.rb +15 -0
- data/lib/forms/plain/textarea.rb +14 -0
- data/lib/forms/plain/wrapped_input.rb +34 -0
- data/lib/forms/row.rb +34 -0
- data/lib/phlex_forms/builder.rb +51 -18
- data/lib/phlex_forms/configuration.rb +28 -0
- data/lib/phlex_forms/delegated_field.rb +17 -0
- data/lib/phlex_forms/engine.rb +7 -0
- data/lib/phlex_forms/inference.rb +238 -0
- data/lib/phlex_forms/theme.rb +80 -0
- data/lib/phlex_forms/version.rb +1 -1
- data/lib/phlex_forms.rb +26 -1
- metadata +37 -18
data/lib/phlex_forms.rb
CHANGED
|
@@ -2,11 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
require "date" # Phlex's attribute serializer references Date; ensure it's loaded.
|
|
4
4
|
require "active_support/core_ext/object/blank" # blank?/present?/presence
|
|
5
|
+
require "active_support/core_ext/enumerable" # exclude?
|
|
6
|
+
require "active_support/core_ext/string" # underscore/pluralize/humanize (scope/url/label derivation)
|
|
5
7
|
require "phlex"
|
|
6
|
-
require "daisy_ui"
|
|
7
8
|
require "glyphs"
|
|
8
9
|
require "zeitwerk"
|
|
9
10
|
|
|
11
|
+
begin
|
|
12
|
+
require "daisy_ui"
|
|
13
|
+
rescue LoadError
|
|
14
|
+
# daisyui is a soft dependency: without it the Plain theme is the default.
|
|
15
|
+
# The daisy leaf components only reference DaisyUI inside view_template, so
|
|
16
|
+
# they load fine — they just must not be rendered (Theme.daisy raises).
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
begin
|
|
20
|
+
require "phlex/reactive"
|
|
21
|
+
rescue LoadError
|
|
22
|
+
# phlex-reactive is a soft dependency: without it the `live` server-truth
|
|
23
|
+
# validation macro raises a FeatureUnavailable pointing here, and the live
|
|
24
|
+
# files are excluded from autoloading below (they include
|
|
25
|
+
# Phlex::Reactive::Component at class level, so they must not load).
|
|
26
|
+
end
|
|
27
|
+
|
|
10
28
|
require_relative "phlex_forms/version"
|
|
11
29
|
|
|
12
30
|
# phlex-forms exposes its components under the `Forms::` namespace (Form, Input,
|
|
@@ -72,6 +90,13 @@ loader.ignore("#{__dir__}/phlex_forms/rubocop.rb") # cop entry point (RuboCop::
|
|
|
72
90
|
# Rails), so it must not be autoloaded/eager-loaded by Zeitwerk.
|
|
73
91
|
loader.ignore("#{__dir__}/phlex_forms/engine.rb")
|
|
74
92
|
|
|
93
|
+
# The live-validation layer includes Phlex::Reactive::Component at class level,
|
|
94
|
+
# so it can only load when the phlex-reactive soft dependency is present.
|
|
95
|
+
unless defined?(Phlex::Reactive)
|
|
96
|
+
loader.ignore("#{__dir__}/forms/live.rb")
|
|
97
|
+
loader.ignore("#{__dir__}/forms/live")
|
|
98
|
+
end
|
|
99
|
+
|
|
75
100
|
loader.setup
|
|
76
101
|
|
|
77
102
|
# Optional Rails integration (Stimulus controllers via importmap/assets, and
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: phlex-forms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mikael Henriksson
|
|
@@ -16,6 +16,9 @@ dependencies:
|
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
18
|
version: '7.0'
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '9'
|
|
19
22
|
type: :runtime
|
|
20
23
|
prerelease: false
|
|
21
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -23,34 +26,29 @@ dependencies:
|
|
|
23
26
|
- - ">="
|
|
24
27
|
- !ruby/object:Gem::Version
|
|
25
28
|
version: '7.0'
|
|
26
|
-
-
|
|
27
|
-
name: daisyui
|
|
28
|
-
requirement: !ruby/object:Gem::Requirement
|
|
29
|
-
requirements:
|
|
30
|
-
- - "~>"
|
|
29
|
+
- - "<"
|
|
31
30
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
33
|
-
type: :runtime
|
|
34
|
-
prerelease: false
|
|
35
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
-
requirements:
|
|
37
|
-
- - "~>"
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: '1.2'
|
|
31
|
+
version: '9'
|
|
40
32
|
- !ruby/object:Gem::Dependency
|
|
41
33
|
name: glyphs
|
|
42
34
|
requirement: !ruby/object:Gem::Requirement
|
|
43
35
|
requirements:
|
|
44
36
|
- - ">="
|
|
45
37
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 0.
|
|
38
|
+
version: 0.2.0
|
|
39
|
+
- - "<"
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '1'
|
|
47
42
|
type: :runtime
|
|
48
43
|
prerelease: false
|
|
49
44
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
45
|
requirements:
|
|
51
46
|
- - ">="
|
|
52
47
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 0.
|
|
48
|
+
version: 0.2.0
|
|
49
|
+
- - "<"
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: '1'
|
|
54
52
|
- !ruby/object:Gem::Dependency
|
|
55
53
|
name: phlex
|
|
56
54
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -114,6 +112,7 @@ files:
|
|
|
114
112
|
- config/locales/en.yml
|
|
115
113
|
- config/locales/sv.yml
|
|
116
114
|
- config/rubocop.yml
|
|
115
|
+
- lib/forms/base.rb
|
|
117
116
|
- lib/forms/checkbox.rb
|
|
118
117
|
- lib/forms/choices_select.rb
|
|
119
118
|
- lib/forms/collection_check_box.rb
|
|
@@ -127,12 +126,30 @@ files:
|
|
|
127
126
|
- lib/forms/file_input.rb
|
|
128
127
|
- lib/forms/form.rb
|
|
129
128
|
- lib/forms/form_control.rb
|
|
129
|
+
- lib/forms/group.rb
|
|
130
130
|
- lib/forms/input.rb
|
|
131
131
|
- lib/forms/label.rb
|
|
132
|
+
- lib/forms/live.rb
|
|
133
|
+
- lib/forms/live/field.rb
|
|
132
134
|
- lib/forms/password_field.rb
|
|
135
|
+
- lib/forms/plain/checkbox.rb
|
|
136
|
+
- lib/forms/plain/control.rb
|
|
137
|
+
- lib/forms/plain/field_error.rb
|
|
138
|
+
- lib/forms/plain/field_hint.rb
|
|
139
|
+
- lib/forms/plain/file_input.rb
|
|
140
|
+
- lib/forms/plain/group.rb
|
|
141
|
+
- lib/forms/plain/input.rb
|
|
142
|
+
- lib/forms/plain/label.rb
|
|
143
|
+
- lib/forms/plain/radio.rb
|
|
144
|
+
- lib/forms/plain/row.rb
|
|
145
|
+
- lib/forms/plain/select.rb
|
|
146
|
+
- lib/forms/plain/submit.rb
|
|
147
|
+
- lib/forms/plain/textarea.rb
|
|
148
|
+
- lib/forms/plain/wrapped_input.rb
|
|
133
149
|
- lib/forms/radio.rb
|
|
134
150
|
- lib/forms/range.rb
|
|
135
151
|
- lib/forms/rich_textarea.rb
|
|
152
|
+
- lib/forms/row.rb
|
|
136
153
|
- lib/forms/select.rb
|
|
137
154
|
- lib/forms/submit.rb
|
|
138
155
|
- lib/forms/textarea.rb
|
|
@@ -148,8 +165,10 @@ files:
|
|
|
148
165
|
- lib/phlex_forms/configuration.rb
|
|
149
166
|
- lib/phlex_forms/delegated_field.rb
|
|
150
167
|
- lib/phlex_forms/engine.rb
|
|
168
|
+
- lib/phlex_forms/inference.rb
|
|
151
169
|
- lib/phlex_forms/inline_icons.rb
|
|
152
170
|
- lib/phlex_forms/rubocop.rb
|
|
171
|
+
- lib/phlex_forms/theme.rb
|
|
153
172
|
- lib/phlex_forms/version.rb
|
|
154
173
|
- lib/rubocop/phlex_forms/cop/legacy_form_method.rb
|
|
155
174
|
- lib/rubocop/phlex_forms/cop/raw_form.rb
|
|
@@ -168,14 +187,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
168
187
|
requirements:
|
|
169
188
|
- - ">="
|
|
170
189
|
- !ruby/object:Gem::Version
|
|
171
|
-
version: '3.
|
|
190
|
+
version: '3.4'
|
|
172
191
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
192
|
requirements:
|
|
174
193
|
- - ">="
|
|
175
194
|
- !ruby/object:Gem::Version
|
|
176
195
|
version: '0'
|
|
177
196
|
requirements: []
|
|
178
|
-
rubygems_version:
|
|
197
|
+
rubygems_version: 3.6.9
|
|
179
198
|
specification_version: 4
|
|
180
199
|
summary: A model-bound, DaisyUI-styled form builder for Phlex
|
|
181
200
|
test_files: []
|