polaris_form 0.1.0
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +8 -0
- data/app/assets/config/polaris_form_manifest.js +0 -0
- data/config/routes.rb +2 -0
- data/lib/polaris_form/builder.rb +71 -0
- data/lib/polaris_form/engine.rb +4 -0
- data/lib/polaris_form/helpers/form_helper.rb +133 -0
- data/lib/polaris_form/helpers/form_options_helper.rb +74 -0
- data/lib/polaris_form/helpers.rb +9 -0
- data/lib/polaris_form/railtie.rb +9 -0
- data/lib/polaris_form/tag/base.rb +80 -0
- data/lib/polaris_form/tag/checkable.rb +14 -0
- data/lib/polaris_form/tag/checkbox.rb +60 -0
- data/lib/polaris_form/tag/choice.rb +15 -0
- data/lib/polaris_form/tag/choice_list.rb +16 -0
- data/lib/polaris_form/tag/color_field.rb +28 -0
- data/lib/polaris_form/tag/color_picker.rb +24 -0
- data/lib/polaris_form/tag/date_field.rb +23 -0
- data/lib/polaris_form/tag/date_picker.rb +19 -0
- data/lib/polaris_form/tag/drop_zone.rb +15 -0
- data/lib/polaris_form/tag/email_field.rb +16 -0
- data/lib/polaris_form/tag/money_field.rb +16 -0
- data/lib/polaris_form/tag/number_field.rb +19 -0
- data/lib/polaris_form/tag/option.rb +15 -0
- data/lib/polaris_form/tag/option_group.rb +15 -0
- data/lib/polaris_form/tag/password_field.rb +17 -0
- data/lib/polaris_form/tag/search_field.rb +16 -0
- data/lib/polaris_form/tag/select.rb +38 -0
- data/lib/polaris_form/tag/switch.rb +65 -0
- data/lib/polaris_form/tag/text_area.rb +16 -0
- data/lib/polaris_form/tag/text_field.rb +16 -0
- data/lib/polaris_form/tag/url_field.rb +16 -0
- data/lib/polaris_form/utils.rb +15 -0
- data/lib/polaris_form/version.rb +3 -0
- data/lib/polaris_form.rb +9 -0
- metadata +97 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c34d1faa7d2c20108d6762f5990df9d7b4b26fa72f92329d5ce30f1bcdba1605
|
|
4
|
+
data.tar.gz: e273464371de2caefdd25d83806570d06fdae8361d383652b6c199bfee685404
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 119337c61aecf5fa01b2005c418af45c7b6f671c58dab8bc7306b7d8b5aca9c9acf52f249597743a6424483742dbe7bbec4f07db2f8c5e9afbeb4832faaeb64c
|
|
7
|
+
data.tar.gz: fe4f9532141669c263f689216a9b1fe2d76aee0ea063fcdf8e7e1fd21fcb78cb2f9cf5eeb80ec4d5f42762eec9a8327c11c1682347af692216a87ad0260cc7a9
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright Hopper Gee
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# PolarisForm
|
|
2
|
+
Short description and motivation.
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
How to use my plugin.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
Add this line to your application's Gemfile:
|
|
9
|
+
|
|
10
|
+
```ruby
|
|
11
|
+
gem "polaris_form"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
And then execute:
|
|
15
|
+
```bash
|
|
16
|
+
$ bundle
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
```bash
|
|
21
|
+
$ gem install polaris_form
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Contributing
|
|
25
|
+
Contribution directions go here.
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
File without changes
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
class Builder < ActionView::Helpers::FormBuilder
|
|
3
|
+
def s_checkbox(method, options = {}, checked_value = '1', unchecked_value = '0')
|
|
4
|
+
PolarisForm::Tag::Checkbox.new(@object_name, method, @template, checked_value, unchecked_value, objectify_options(options)).render
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
# def s_choice_list(method, options = {}, &block)
|
|
8
|
+
# @template.s_choice_list_tag(@object_name, method, objectify_options(options), &block)
|
|
9
|
+
# end
|
|
10
|
+
|
|
11
|
+
def s_color_field(method, options = {})
|
|
12
|
+
PolarisForm::Tag::ColorField.new(@object_name, method, @template, objectify_options(options)).render
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def s_color_picker(method, options = {})
|
|
16
|
+
PolarisForm::Tag::ColorPicker.new(@object_name, method, @template, objectify_options(options)).render
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def s_date_field(method, options = {})
|
|
20
|
+
PolarisForm::Tag::DateField.new(@object_name, method, @template, objectify_options(options)).render
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def s_date_picker(method, options = {})
|
|
24
|
+
PolarisForm::Tag::DatePicker.new(@object_name, method, @template, objectify_options(options)).render
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def s_drop_zone(method, options = {})
|
|
28
|
+
PolarisForm::Tag::DropZone.new(@object_name, method, @template, objectify_options(options)).render
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def s_email_field(method, options = {})
|
|
32
|
+
PolarisForm::Tag::EmailField.new(@object_name, method, @template, objectify_options(options)).render
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def s_money_field(method, options = {})
|
|
36
|
+
PolarisForm::Tag::MoneyField.new(@object_name, method, @template, objectify_options(options)).render
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def s_number_field(method, options = {})
|
|
40
|
+
PolarisForm::Tag::NumberField.new(@object_name, method, @template, objectify_options(options)).render
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def s_password_field(method, options = {})
|
|
44
|
+
PolarisForm::Tag::PasswordField.new(@object_name, method, @template, objectify_options(options)).render
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def s_search_field(method, options = {})
|
|
48
|
+
PolarisForm::Tag::SearchField.new(@object_name, method, @template, objectify_options(options)).render
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def s_select(method, choices = nil, options = {}, html_options = {}, &block)
|
|
52
|
+
PolarisForm::Tag::Select.new(@object_name, method, @template, choices, objectify_options(options), html_options).render(&block)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def s_switch(method, options = {}, checked_value = '1', unchecked_value = '0')
|
|
56
|
+
PolarisForm::Tag::Switch.new(@object_name, method, @template, checked_value, unchecked_value, objectify_options(options)).render
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def s_text_area(method, options = {})
|
|
60
|
+
PolarisForm::Tag::TextArea.new(@object_name, method, @template, objectify_options(options)).render
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def s_text_field(method, options = {})
|
|
64
|
+
PolarisForm::Tag::TextField.new(@object_name, method, @template, objectify_options(options)).render
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def s_url_field(method, options = {})
|
|
68
|
+
PolarisForm::Tag::UrlField.new(@object_name, method, @template, objectify_options(options)).render
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
require "polaris_form/tag/base"
|
|
2
|
+
require "polaris_form/tag/checkable"
|
|
3
|
+
require "polaris_form/tag/checkbox"
|
|
4
|
+
require "polaris_form/tag/choice_list"
|
|
5
|
+
require "polaris_form/tag/choice"
|
|
6
|
+
require "polaris_form/tag/color_field"
|
|
7
|
+
require "polaris_form/tag/color_picker"
|
|
8
|
+
require "polaris_form/tag/date_field"
|
|
9
|
+
require "polaris_form/tag/date_picker"
|
|
10
|
+
require "polaris_form/tag/drop_zone"
|
|
11
|
+
require "polaris_form/tag/email_field"
|
|
12
|
+
require "polaris_form/tag/money_field"
|
|
13
|
+
require "polaris_form/tag/number_field"
|
|
14
|
+
require "polaris_form/tag/option_group"
|
|
15
|
+
require "polaris_form/tag/option"
|
|
16
|
+
require "polaris_form/tag/password_field"
|
|
17
|
+
require "polaris_form/tag/search_field"
|
|
18
|
+
require "polaris_form/tag/select"
|
|
19
|
+
require "polaris_form/tag/switch"
|
|
20
|
+
require "polaris_form/tag/text_area"
|
|
21
|
+
require "polaris_form/tag/text_field"
|
|
22
|
+
require "polaris_form/tag/url_field"
|
|
23
|
+
|
|
24
|
+
module PolarisForm
|
|
25
|
+
module Helpers
|
|
26
|
+
module FormHelper
|
|
27
|
+
def polaris_form_with(**options, &block)
|
|
28
|
+
options[:builder] ||= PolarisForm::Builder
|
|
29
|
+
form_with(**options, &block)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def polaris_form_for(record, options = {}, &block)
|
|
33
|
+
options[:builder] ||= PolarisForm::Builder
|
|
34
|
+
form_for(record, options, &block)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def s_checkbox_tag(name, value = "1", checked = false, options = {})
|
|
38
|
+
options[:include_hidden] = false
|
|
39
|
+
options[:checked] = checked
|
|
40
|
+
PolarisForm::Tag::Checkbox.new(nil, name, self, value, nil, options).render
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# def s_choice_list_tag(name, options = {}, &block)
|
|
44
|
+
# PolarisForm::Tag::ChoiceList.new(nil, name, self, options).render(&block)
|
|
45
|
+
# end
|
|
46
|
+
|
|
47
|
+
def s_choice_tag(options = {}, &block)
|
|
48
|
+
PolarisForm::Tag::Choice.new(nil, nil, self, options).render(&block)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def s_color_field_tag(name, value = nil, options = {})
|
|
52
|
+
options[:value] = value
|
|
53
|
+
PolarisForm::Tag::ColorField.new(nil, name, self, options).render
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def s_color_picker_tag(name, value = nil, options = {})
|
|
57
|
+
options[:value] = value
|
|
58
|
+
PolarisForm::Tag::ColorPicker.new(nil, name, self, options).render
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def s_date_field_tag(name, value = nil, options = {})
|
|
62
|
+
options[:value] = value
|
|
63
|
+
PolarisForm::Tag::DateField.new(nil, name, self, options).render
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def s_date_picker_tag(name, value = nil, options = {})
|
|
67
|
+
options[:value] = value
|
|
68
|
+
PolarisForm::Tag::DatePicker.new(nil, name, self, options).render
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def s_drop_zone_tag(name, options = {})
|
|
72
|
+
PolarisForm::Tag::DropZone.new(nil, name, self, options).render
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def s_email_field_tag(name, value = nil, options = {})
|
|
76
|
+
options[:value] = value
|
|
77
|
+
PolarisForm::Tag::EmailField.new(nil, name, self, options).render
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def s_money_field_tag(name, value = nil, options = {})
|
|
81
|
+
options[:value] = value
|
|
82
|
+
PolarisForm::Tag::MoneyField.new(nil, name, self, options).render
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def s_number_field_tag(name, value = nil, options = {})
|
|
86
|
+
PolarisForm::Tag::NumberField.new(nil, name, self, options).render
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def s_option_group_tag(options = {}, &block)
|
|
90
|
+
PolarisForm::Tag::OptionGroup.new(nil, nil, self, options).render(&block)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def s_option_tag(options = {}, &block)
|
|
94
|
+
PolarisForm::Tag::Option.new(nil, nil, self, options).render(&block)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def s_password_field_tag(name, value = nil, options = {})
|
|
98
|
+
options[:value] = value
|
|
99
|
+
PolarisForm::Tag::PasswordField.new(nil, name, self, options).render
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def s_search_field_tag(name, value = nil, options = {})
|
|
103
|
+
options[:value] = value
|
|
104
|
+
PolarisForm::Tag::SearchField.new(nil, name, self, options).render
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# def s_select_tag(name, option_tags = nil, options = {}, &block)
|
|
108
|
+
# PolarisForm::Tag::Select.new(nil, name, self, options).render(&block)
|
|
109
|
+
# end
|
|
110
|
+
|
|
111
|
+
def s_switch_tag(name, value = "1", checked = false, options = {})
|
|
112
|
+
options[:include_hidden] = false
|
|
113
|
+
options[:checked] = checked
|
|
114
|
+
PolarisForm::Tag::Switch.new(nil, name, self, value, nil, options).render
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def s_text_area_tag(name, content = nil, options = {})
|
|
118
|
+
options[:value] = content
|
|
119
|
+
PolarisForm::Tag::TextArea.new(nil, name, self, options).render
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def s_text_field_tag(name, value = nil, options = {})
|
|
123
|
+
options[:value] = value
|
|
124
|
+
PolarisForm::Tag::TextField.new(nil, name, self, options).render
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def s_url_field_tag(name, value = nil, options = {})
|
|
128
|
+
options[:value] = value
|
|
129
|
+
PolarisForm::Tag::UrlField.new(nil, name, self, options).render
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Helpers
|
|
3
|
+
module FormOptionsHelper
|
|
4
|
+
|
|
5
|
+
def s_options_for_select(container, selected = nil)
|
|
6
|
+
return container if String === container
|
|
7
|
+
|
|
8
|
+
selected, disabled = extract_selected_and_disabled(selected).map do |r|
|
|
9
|
+
Array(r).map(&:to_s)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
container.map do |element|
|
|
13
|
+
html_attributes = option_html_attributes(element)
|
|
14
|
+
text, value = option_text_and_value(element).map(&:to_s)
|
|
15
|
+
|
|
16
|
+
html_attributes[:selected] ||= option_value_selected?(value, selected)
|
|
17
|
+
html_attributes[:disabled] ||= disabled && option_value_selected?(value, disabled)
|
|
18
|
+
html_attributes[:value] = value
|
|
19
|
+
|
|
20
|
+
tag_builder.content_tag_string("s-option", text, html_attributes)
|
|
21
|
+
end.join("\n").html_safe
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def s_grouped_options_for_select(grouped_options, selected_key = nil, options = {})
|
|
25
|
+
prompt = options[:prompt]
|
|
26
|
+
divider = options[:divider]
|
|
27
|
+
|
|
28
|
+
body = "".html_safe
|
|
29
|
+
|
|
30
|
+
if prompt
|
|
31
|
+
body.safe_concat content_tag("s-option", prompt_text(prompt), value: "")
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
grouped_options.each do |container|
|
|
35
|
+
html_attributes = option_html_attributes(container)
|
|
36
|
+
|
|
37
|
+
if divider
|
|
38
|
+
label = divider
|
|
39
|
+
else
|
|
40
|
+
label, container = container
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
html_attributes = { label: label }.merge!(html_attributes)
|
|
44
|
+
body.safe_concat content_tag("s-option-group", options_for_select(container, selected_key), html_attributes)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
body
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def s_option_groups_from_collection_for_select(collection, group_method, group_label_method, option_key_method, option_value_method, selected_key = nil)
|
|
51
|
+
collection.map do |group|
|
|
52
|
+
option_tags = options_from_collection_for_select(
|
|
53
|
+
value_for_collection(group, group_method), option_key_method, option_value_method, selected_key)
|
|
54
|
+
|
|
55
|
+
content_tag("s-option-group", option_tags, label: value_for_collection(group, group_label_method))
|
|
56
|
+
end.join.html_safe
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def s_options_from_collection_for_select(collection, value_method, text_method, selected = nil)
|
|
60
|
+
options = collection.map do |element|
|
|
61
|
+
[value_for_collection(element, text_method), value_for_collection(element, value_method), option_html_attributes(element)]
|
|
62
|
+
end
|
|
63
|
+
selected, disabled = extract_selected_and_disabled(selected)
|
|
64
|
+
select_deselect = {
|
|
65
|
+
selected: extract_values_from_collection(collection, value_method, selected),
|
|
66
|
+
disabled: extract_values_from_collection(collection, value_method, disabled)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
s_options_for_select(options, select_deselect)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class Base < ::ActionView::Helpers::Tags::Base
|
|
4
|
+
|
|
5
|
+
include Helpers::FormOptionsHelper
|
|
6
|
+
|
|
7
|
+
def initialize(object_name, method_name, template_object, options = {})
|
|
8
|
+
camelized_options = Utils.camelize_polaris_options(options)
|
|
9
|
+
super(object_name, method_name, template_object, camelized_options)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def tag(type, options, *rest, &block)
|
|
13
|
+
if object_has_errors?
|
|
14
|
+
options["error"] = error_message
|
|
15
|
+
end
|
|
16
|
+
super(type, options, *rest, &block)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def content_tag(name, content_or_options_with_block = nil, options = nil, escape = true, &block)
|
|
20
|
+
if object_has_errors?
|
|
21
|
+
if block_given?
|
|
22
|
+
content_or_options_with_block ||= {}
|
|
23
|
+
content_or_options_with_block["error"] = error_message
|
|
24
|
+
else
|
|
25
|
+
options ||= {}
|
|
26
|
+
options["error"] = error_message
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
super(name, content_or_options_with_block, options, escape, &block)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def empty_content_tag(name, options = nil, escape = true, &block)
|
|
33
|
+
if object_has_errors?
|
|
34
|
+
options["error"] = error_message
|
|
35
|
+
end
|
|
36
|
+
tag_builder.content_tag_string(name, "", options, escape)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def error_wrapping(html_tag)
|
|
40
|
+
html_tag
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def select_content_tag(option_tags, options, html_options)
|
|
44
|
+
html_options = html_options.stringify_keys
|
|
45
|
+
if html_options["label"].blank?
|
|
46
|
+
html_options["label"] = " "
|
|
47
|
+
html_options["labelAccessibilityVisibility"] ||= "exclusive"
|
|
48
|
+
end
|
|
49
|
+
add_default_name_and_id(html_options)
|
|
50
|
+
|
|
51
|
+
if placeholder_required?(html_options)
|
|
52
|
+
raise ArgumentError, "include_blank cannot be false for a required field." if options[:include_blank] == false
|
|
53
|
+
options[:include_blank] ||= true unless options[:prompt]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
value = options.fetch(:selected) { value() }
|
|
57
|
+
html_options["value"] = value
|
|
58
|
+
content_tag("s-select", add_options(option_tags, options, value), html_options)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def add_options(option_tags, options, value = nil)
|
|
62
|
+
if options[:include_blank]
|
|
63
|
+
content = (options[:include_blank] if options[:include_blank].is_a?(String))
|
|
64
|
+
label = (" " unless content)
|
|
65
|
+
option_tags = tag_builder.content_tag_string("s-option", content, value: "", label: label) + "\n" + option_tags
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
if value.blank? && options[:prompt]
|
|
69
|
+
tag_options = { value: "" }.tap do |prompt_opts|
|
|
70
|
+
prompt_opts[:disabled] = true if options[:disabled] == ""
|
|
71
|
+
prompt_opts[:selected] = true if options[:selected] == ""
|
|
72
|
+
end
|
|
73
|
+
option_tags = tag_builder.content_tag_string("s-option", prompt_text(options[:prompt]), tag_options) + "\n" + option_tags
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
option_tags
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class Checkbox < Base
|
|
4
|
+
|
|
5
|
+
include Checkable
|
|
6
|
+
|
|
7
|
+
def initialize(object_name, method_name, template_object, checked_value, unchecked_value, options)
|
|
8
|
+
@checked_value = checked_value
|
|
9
|
+
@unchecked_value = unchecked_value
|
|
10
|
+
super(object_name, method_name, template_object, options)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def render
|
|
14
|
+
options = @options.stringify_keys
|
|
15
|
+
options["value"] = @checked_value
|
|
16
|
+
options["checked"] = "checked" if input_checked?(options)
|
|
17
|
+
|
|
18
|
+
if options["multiple"]
|
|
19
|
+
add_default_name_and_id_for_value(@checked_value, options)
|
|
20
|
+
options.delete("multiple")
|
|
21
|
+
else
|
|
22
|
+
add_default_name_and_id(options)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
include_hidden = options.delete("include_hidden") { true }
|
|
26
|
+
checkbox = empty_content_tag("s-checkbox", options)
|
|
27
|
+
|
|
28
|
+
if include_hidden
|
|
29
|
+
hidden = hidden_field_for_checkbox(options)
|
|
30
|
+
hidden + checkbox
|
|
31
|
+
else
|
|
32
|
+
checkbox
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def checked?(value)
|
|
39
|
+
case value
|
|
40
|
+
when TrueClass, FalseClass
|
|
41
|
+
value == !!@checked_value
|
|
42
|
+
when NilClass
|
|
43
|
+
false
|
|
44
|
+
when String
|
|
45
|
+
value == @checked_value
|
|
46
|
+
else
|
|
47
|
+
if value.respond_to?(:include?)
|
|
48
|
+
value.include?(@checked_value)
|
|
49
|
+
else
|
|
50
|
+
value.to_i == @checked_value.to_i
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def hidden_field_for_checkbox(options)
|
|
56
|
+
@unchecked_value ? tag("input", options.slice("name", "disabled", "form").merge!("type" => "hidden", "value" => @unchecked_value, "autocomplete" => "off")) : "".html_safe
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class Choice < Base
|
|
4
|
+
def render(&block)
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
content = if block_given?
|
|
7
|
+
@template_object.capture(&block)
|
|
8
|
+
else
|
|
9
|
+
nil
|
|
10
|
+
end
|
|
11
|
+
content_tag("s-choice", content, options)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class ChoiceList < Base
|
|
4
|
+
def render(&block)
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
add_default_name_and_id(options)
|
|
7
|
+
content = if block_given?
|
|
8
|
+
@template_object.capture(&block)
|
|
9
|
+
else
|
|
10
|
+
nil
|
|
11
|
+
end
|
|
12
|
+
content_tag("s-choice-list", content, options)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class ColorField < Base
|
|
4
|
+
def render
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
options["value"] ||= validate_color_string(value)
|
|
7
|
+
options["value"] = options.fetch("value") { value_before_type_cast }
|
|
8
|
+
if options["label"].blank?
|
|
9
|
+
options["label"] = " "
|
|
10
|
+
options["labelAccessibilityVisibility"] ||= "exclusive"
|
|
11
|
+
end
|
|
12
|
+
add_default_name_and_id(options)
|
|
13
|
+
empty_content_tag("s-color-field", options)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def validate_color_string(string)
|
|
19
|
+
regex = /#[0-9a-fA-F]{6}/
|
|
20
|
+
if regex.match?(string)
|
|
21
|
+
string.downcase
|
|
22
|
+
else
|
|
23
|
+
"#000000"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class ColorPicker < Base
|
|
4
|
+
def render
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
options["value"] ||= validate_color_string(value)
|
|
7
|
+
options["value"] = options.fetch("value") { value_before_type_cast }
|
|
8
|
+
add_default_name_and_id(options)
|
|
9
|
+
empty_content_tag("s-color-picker", options)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def validate_color_string(string)
|
|
15
|
+
regex = /#[0-9a-fA-F]{6}/
|
|
16
|
+
if regex.match?(string)
|
|
17
|
+
string.downcase
|
|
18
|
+
else
|
|
19
|
+
"#000000"
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class DateField < Base
|
|
4
|
+
def render
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
options["value"] ||= format_date(value)
|
|
7
|
+
options["value"] = options.fetch("value") { value_before_type_cast }
|
|
8
|
+
if options["label"].blank?
|
|
9
|
+
options["label"] = " "
|
|
10
|
+
options["labelAccessibilityVisibility"] ||= "exclusive"
|
|
11
|
+
end
|
|
12
|
+
add_default_name_and_id(options)
|
|
13
|
+
empty_content_tag("s-date-field", options)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def format_date(value)
|
|
19
|
+
value&.strftime("%Y-%m-%d")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class DatePicker < Base
|
|
4
|
+
def render
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
options["value"] ||= format_date(value)
|
|
7
|
+
options["value"] = options.fetch("value") { value_before_type_cast }
|
|
8
|
+
add_default_name_and_id(options)
|
|
9
|
+
empty_content_tag("s-date-picker", options)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def format_date(value)
|
|
15
|
+
value&.strftime("%Y-%m-%d")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class DropZone < Base
|
|
4
|
+
def render
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
if options["label"].blank?
|
|
7
|
+
options["label"] = " "
|
|
8
|
+
options["labelAccessibilityVisibility"] ||= "exclusive"
|
|
9
|
+
end
|
|
10
|
+
add_default_name_and_id(options)
|
|
11
|
+
empty_content_tag("s-drop-zone", options)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class EmailField < Base
|
|
4
|
+
def render
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
options["value"] = options.fetch("value") { value_before_type_cast }
|
|
7
|
+
if options["label"].blank?
|
|
8
|
+
options["label"] = " "
|
|
9
|
+
options["labelAccessibilityVisibility"] ||= "exclusive"
|
|
10
|
+
end
|
|
11
|
+
add_default_name_and_id(options)
|
|
12
|
+
empty_content_tag("s-email-field", options)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class MoneyField < Base
|
|
4
|
+
def render
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
options["value"] = options.fetch("value") { value_before_type_cast }
|
|
7
|
+
if options["label"].blank?
|
|
8
|
+
options["label"] = " "
|
|
9
|
+
options["labelAccessibilityVisibility"] ||= "exclusive"
|
|
10
|
+
end
|
|
11
|
+
add_default_name_and_id(options)
|
|
12
|
+
empty_content_tag("s-money-field", options)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class NumberField < Base
|
|
4
|
+
def render
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
if range = options.delete("in") || options.delete("within")
|
|
7
|
+
options.update("min" => range.min, "max" => range.max)
|
|
8
|
+
end
|
|
9
|
+
options["value"] = options.fetch("value") { value_before_type_cast }
|
|
10
|
+
if options["label"].blank?
|
|
11
|
+
options["label"] = " "
|
|
12
|
+
options["labelAccessibilityVisibility"] ||= "exclusive"
|
|
13
|
+
end
|
|
14
|
+
add_default_name_and_id(options)
|
|
15
|
+
empty_content_tag("s-number-field", options)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class Option < Base
|
|
4
|
+
def render(&block)
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
content = if block_given?
|
|
7
|
+
@template_object.capture(&block)
|
|
8
|
+
else
|
|
9
|
+
nil
|
|
10
|
+
end
|
|
11
|
+
content_tag("s-option", content, options)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class OptionGroup < Base
|
|
4
|
+
def render(&block)
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
content = if block_given?
|
|
7
|
+
@template_object.capture(&block)
|
|
8
|
+
else
|
|
9
|
+
nil
|
|
10
|
+
end
|
|
11
|
+
content_tag("s-option-group", content, options)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class PasswordField < Base
|
|
4
|
+
def render
|
|
5
|
+
@options = { value: nil }.merge!(@options)
|
|
6
|
+
options = @options.stringify_keys
|
|
7
|
+
options["value"] = options.fetch("value") { value_before_type_cast }
|
|
8
|
+
if options["label"].blank?
|
|
9
|
+
options["label"] = " "
|
|
10
|
+
options["labelAccessibilityVisibility"] ||= "exclusive"
|
|
11
|
+
end
|
|
12
|
+
add_default_name_and_id(options)
|
|
13
|
+
empty_content_tag("s-password-field", options)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class SearchField < Base
|
|
4
|
+
def render
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
options["value"] = options.fetch("value") { value_before_type_cast }
|
|
7
|
+
if options["label"].blank?
|
|
8
|
+
options["label"] = " "
|
|
9
|
+
options["labelAccessibilityVisibility"] ||= "exclusive"
|
|
10
|
+
end
|
|
11
|
+
add_default_name_and_id(options)
|
|
12
|
+
empty_content_tag("s-search-field", options)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class Select < Base
|
|
4
|
+
def initialize(object_name, method_name, template_object, choices, options, html_options)
|
|
5
|
+
@choices = block_given? ? template_object.capture { yield || "" } : choices
|
|
6
|
+
@choices = @choices.to_a if @choices.is_a?(Range)
|
|
7
|
+
|
|
8
|
+
@html_options = html_options
|
|
9
|
+
|
|
10
|
+
super(object_name, method_name, template_object, options)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def render
|
|
14
|
+
option_tags_options = {
|
|
15
|
+
selected: @options.fetch(:selected) { value.nil? ? "" : value },
|
|
16
|
+
disabled: @options[:disabled]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
option_tags = if grouped_choices?
|
|
20
|
+
s_grouped_options_for_select(@choices, option_tags_options)
|
|
21
|
+
else
|
|
22
|
+
s_options_for_select(@choices, option_tags_options)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
select_content_tag(option_tags, @options, @html_options)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
# Grouped choices look like this:
|
|
30
|
+
#
|
|
31
|
+
# [nil, []]
|
|
32
|
+
# { nil => [] }
|
|
33
|
+
def grouped_choices?
|
|
34
|
+
!@choices.blank? && @choices.first.respond_to?(:second) && Array === @choices.first.second
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class Switch < Base
|
|
4
|
+
|
|
5
|
+
include Checkable
|
|
6
|
+
|
|
7
|
+
def initialize(object_name, method_name, template_object, checked_value, unchecked_value, options)
|
|
8
|
+
@checked_value = checked_value
|
|
9
|
+
@unchecked_value = unchecked_value
|
|
10
|
+
super(object_name, method_name, template_object, options)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def render
|
|
14
|
+
options = @options.stringify_keys
|
|
15
|
+
options["value"] = @checked_value
|
|
16
|
+
options["checked"] = "checked" if input_checked?(options)
|
|
17
|
+
|
|
18
|
+
if options["multiple"]
|
|
19
|
+
add_default_name_and_id_for_value(@checked_value, options)
|
|
20
|
+
options.delete("multiple")
|
|
21
|
+
else
|
|
22
|
+
add_default_name_and_id(options)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
if options["label"].blank?
|
|
26
|
+
options["label"] = " "
|
|
27
|
+
options["labelAccessibilityVisibility"] ||= "exclusive"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
include_hidden = options.delete("include_hidden") { true }
|
|
31
|
+
checkbox = empty_content_tag("s-switch", options)
|
|
32
|
+
|
|
33
|
+
if include_hidden
|
|
34
|
+
hidden = hidden_field_for_checkbox(options)
|
|
35
|
+
hidden + checkbox
|
|
36
|
+
else
|
|
37
|
+
checkbox
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
def checked?(value)
|
|
44
|
+
case value
|
|
45
|
+
when TrueClass, FalseClass
|
|
46
|
+
value == !!@checked_value
|
|
47
|
+
when NilClass
|
|
48
|
+
false
|
|
49
|
+
when String
|
|
50
|
+
value == @checked_value
|
|
51
|
+
else
|
|
52
|
+
if value.respond_to?(:include?)
|
|
53
|
+
value.include?(@checked_value)
|
|
54
|
+
else
|
|
55
|
+
value.to_i == @checked_value.to_i
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def hidden_field_for_checkbox(options)
|
|
61
|
+
@unchecked_value ? tag("input", options.slice("name", "disabled", "form").merge!("type" => "hidden", "value" => @unchecked_value, "autocomplete" => "off")) : "".html_safe
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class TextArea < Base
|
|
4
|
+
def render
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
options["value"] = options.fetch("value") { value_before_type_cast }
|
|
7
|
+
if options["label"].blank?
|
|
8
|
+
options["label"] = " "
|
|
9
|
+
options["labelAccessibilityVisibility"] ||= "exclusive"
|
|
10
|
+
end
|
|
11
|
+
add_default_name_and_id(options)
|
|
12
|
+
empty_content_tag("s-text-area", options)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class TextField < Base
|
|
4
|
+
def render
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
options["value"] = options.fetch("value") { value_before_type_cast }
|
|
7
|
+
if options["label"].blank?
|
|
8
|
+
options["label"] = " "
|
|
9
|
+
options["labelAccessibilityVisibility"] ||= "exclusive"
|
|
10
|
+
end
|
|
11
|
+
add_default_name_and_id(options)
|
|
12
|
+
empty_content_tag("s-text-field", options)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Tag
|
|
3
|
+
class UrlField < Base
|
|
4
|
+
def render
|
|
5
|
+
options = @options.stringify_keys
|
|
6
|
+
options["value"] = options.fetch("value") { value_before_type_cast }
|
|
7
|
+
if options["label"].blank?
|
|
8
|
+
options["label"] = " "
|
|
9
|
+
options["labelAccessibilityVisibility"] ||= "exclusive"
|
|
10
|
+
end
|
|
11
|
+
add_default_name_and_id(options)
|
|
12
|
+
empty_content_tag("s-url-field", options)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module PolarisForm
|
|
2
|
+
module Utils
|
|
3
|
+
module_function
|
|
4
|
+
|
|
5
|
+
def camelize_polaris_options(options)
|
|
6
|
+
options.transform_keys do |key|
|
|
7
|
+
if key.to_s.in?([ "skip_default_ids", "allow_method_names_outside_object" ])
|
|
8
|
+
key
|
|
9
|
+
else
|
|
10
|
+
key.to_s.camelize(:lower).to_sym
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
data/lib/polaris_form.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: polaris_form
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Hopper Gee
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-01-13 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rails
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '7.0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '7.0'
|
|
27
|
+
description: polaris_form brings Shopify's Polaris design system to Rails forms by
|
|
28
|
+
providing a drop-in form builder that outputs Polaris web components under the hood.
|
|
29
|
+
email:
|
|
30
|
+
- hopper.gee@hey.com
|
|
31
|
+
executables: []
|
|
32
|
+
extensions: []
|
|
33
|
+
extra_rdoc_files: []
|
|
34
|
+
files:
|
|
35
|
+
- MIT-LICENSE
|
|
36
|
+
- README.md
|
|
37
|
+
- Rakefile
|
|
38
|
+
- app/assets/config/polaris_form_manifest.js
|
|
39
|
+
- config/routes.rb
|
|
40
|
+
- lib/polaris_form.rb
|
|
41
|
+
- lib/polaris_form/builder.rb
|
|
42
|
+
- lib/polaris_form/engine.rb
|
|
43
|
+
- lib/polaris_form/helpers.rb
|
|
44
|
+
- lib/polaris_form/helpers/form_helper.rb
|
|
45
|
+
- lib/polaris_form/helpers/form_options_helper.rb
|
|
46
|
+
- lib/polaris_form/railtie.rb
|
|
47
|
+
- lib/polaris_form/tag/base.rb
|
|
48
|
+
- lib/polaris_form/tag/checkable.rb
|
|
49
|
+
- lib/polaris_form/tag/checkbox.rb
|
|
50
|
+
- lib/polaris_form/tag/choice.rb
|
|
51
|
+
- lib/polaris_form/tag/choice_list.rb
|
|
52
|
+
- lib/polaris_form/tag/color_field.rb
|
|
53
|
+
- lib/polaris_form/tag/color_picker.rb
|
|
54
|
+
- lib/polaris_form/tag/date_field.rb
|
|
55
|
+
- lib/polaris_form/tag/date_picker.rb
|
|
56
|
+
- lib/polaris_form/tag/drop_zone.rb
|
|
57
|
+
- lib/polaris_form/tag/email_field.rb
|
|
58
|
+
- lib/polaris_form/tag/money_field.rb
|
|
59
|
+
- lib/polaris_form/tag/number_field.rb
|
|
60
|
+
- lib/polaris_form/tag/option.rb
|
|
61
|
+
- lib/polaris_form/tag/option_group.rb
|
|
62
|
+
- lib/polaris_form/tag/password_field.rb
|
|
63
|
+
- lib/polaris_form/tag/search_field.rb
|
|
64
|
+
- lib/polaris_form/tag/select.rb
|
|
65
|
+
- lib/polaris_form/tag/switch.rb
|
|
66
|
+
- lib/polaris_form/tag/text_area.rb
|
|
67
|
+
- lib/polaris_form/tag/text_field.rb
|
|
68
|
+
- lib/polaris_form/tag/url_field.rb
|
|
69
|
+
- lib/polaris_form/utils.rb
|
|
70
|
+
- lib/polaris_form/version.rb
|
|
71
|
+
homepage: https://github.com/hoppergee/polaris_form
|
|
72
|
+
licenses:
|
|
73
|
+
- MIT
|
|
74
|
+
metadata:
|
|
75
|
+
homepage_uri: https://github.com/hoppergee/polaris_form
|
|
76
|
+
source_code_uri: https://github.com/hoppergee/polaris_form
|
|
77
|
+
changelog_uri: https://github.com/hoppergee/polaris_form/blob/main/CHANGELOG.md
|
|
78
|
+
post_install_message:
|
|
79
|
+
rdoc_options: []
|
|
80
|
+
require_paths:
|
|
81
|
+
- lib
|
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
|
+
requirements:
|
|
84
|
+
- - ">="
|
|
85
|
+
- !ruby/object:Gem::Version
|
|
86
|
+
version: '0'
|
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
|
+
requirements:
|
|
89
|
+
- - ">="
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: '0'
|
|
92
|
+
requirements: []
|
|
93
|
+
rubygems_version: 3.3.7
|
|
94
|
+
signing_key:
|
|
95
|
+
specification_version: 4
|
|
96
|
+
summary: A Rails form builder that renders forms using Shopify Polaris web components
|
|
97
|
+
test_files: []
|