polaris_view_components 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/polaris_view_components/dropzone_controller.js +1 -1
- data/app/assets/javascripts/polaris_view_components.js +1 -1
- data/app/components/polaris/autocomplete_component.html.erb +3 -1
- data/app/components/polaris/autocomplete_component.rb +7 -3
- data/app/components/polaris/choice_list_component.rb +1 -0
- data/app/helpers/polaris/form_builder.rb +8 -0
- data/lib/polaris/view_components/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9f0dda0dd8c18919a32d2db1f85d8f141e6c034d4b01a14a1f3962ccd1b44d5
|
4
|
+
data.tar.gz: b852067c8aaf0a6b8227979b8b8e11d8ceaf16835ee750d426a33c9a07753641
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34ad4b65aaeab109d00e2220c6df2276c53d6b549858aaf177bf80d042522334f5633e53c678df3d7f8b891656e906318180259dd705c5664d91584383c2f470
|
7
|
+
data.tar.gz: 2e5eddc9bf78ad83546587ff76e59f1c3419ab19b9c7a2679e1a8234e6f4e9355d25e172a07d6ddbd5adea8374898897837590a73cbc4a54eecc958a93009630
|
@@ -94,9 +94,9 @@ export default class extends Controller {
|
|
94
94
|
this.stopEvent(e)
|
95
95
|
if (this.disabled) return
|
96
96
|
|
97
|
+
const fileList = getDataTransferFiles(e)
|
97
98
|
this.clearFiles()
|
98
99
|
|
99
|
-
const fileList = getDataTransferFiles(e)
|
100
100
|
const { files, acceptedFiles, rejectedFiles } = this.getValidatedFiles(fileList)
|
101
101
|
this.dragTargets = []
|
102
102
|
|
@@ -451,8 +451,8 @@ class Dropzone extends Controller {
|
|
451
451
|
onChange(e) {
|
452
452
|
this.stopEvent(e);
|
453
453
|
if (this.disabled) return;
|
454
|
-
this.clearFiles();
|
455
454
|
const fileList = getDataTransferFiles(e);
|
455
|
+
this.clearFiles();
|
456
456
|
const {files: files, acceptedFiles: acceptedFiles, rejectedFiles: rejectedFiles} = this.getValidatedFiles(fileList);
|
457
457
|
this.dragTargets = [];
|
458
458
|
this.files = files;
|
@@ -2,7 +2,9 @@
|
|
2
2
|
<%= render(Polaris::PopoverComponent.new(**popover_arguments)) do |popover| %>
|
3
3
|
<% popover.with_activator do %>
|
4
4
|
<%= text_field %>
|
5
|
-
<% if @
|
5
|
+
<% if @form.present? && @attribute.present? %>
|
6
|
+
<%= @form.hidden_field @attribute, data: {polaris_autocomplete_target: "hiddenInput"} %>
|
7
|
+
<% else %>
|
6
8
|
<%= hidden_field_tag @name, nil, data: {polaris_autocomplete_target: "hiddenInput"} %>
|
7
9
|
<% end %>
|
8
10
|
<% end %>
|
@@ -11,7 +11,7 @@ module Polaris
|
|
11
11
|
system_arguments[:input_options][:data] ||= {}
|
12
12
|
system_arguments[:input_options][:data][:polaris_autocomplete_target] = "input"
|
13
13
|
|
14
|
-
TextFieldComponent.new(**system_arguments)
|
14
|
+
TextFieldComponent.new(form: @form, attribute: @attribute, name: @name, **system_arguments)
|
15
15
|
end
|
16
16
|
renders_many :sections, ->(**system_arguments) do
|
17
17
|
Autocomplete::SectionComponent.new(multiple: @multiple, **system_arguments)
|
@@ -22,16 +22,20 @@ module Polaris
|
|
22
22
|
renders_one :empty_state
|
23
23
|
|
24
24
|
def initialize(
|
25
|
+
form: nil,
|
26
|
+
attribute: nil,
|
27
|
+
name: nil,
|
25
28
|
multiple: false,
|
26
29
|
url: nil,
|
27
|
-
name: nil,
|
28
30
|
selected: [],
|
29
31
|
popover_arguments: {},
|
30
32
|
**system_arguments
|
31
33
|
)
|
34
|
+
@form = form
|
35
|
+
@attribute = attribute
|
36
|
+
@name = name
|
32
37
|
@multiple = multiple
|
33
38
|
@url = url
|
34
|
-
@name = name
|
35
39
|
@selected = selected
|
36
40
|
@popover_arguments = popover_arguments
|
37
41
|
@system_arguments = system_arguments
|
@@ -117,5 +117,13 @@ module Polaris
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
end
|
120
|
+
|
121
|
+
def polaris_autocomplete(method, **options, &block)
|
122
|
+
options[:error] ||= error_for(method)
|
123
|
+
if options[:error_hidden] && options[:error]
|
124
|
+
options[:error] = !!options[:error]
|
125
|
+
end
|
126
|
+
render Polaris::AutocompleteComponent.new(form: self, attribute: method, name: method, **options), &block
|
127
|
+
end
|
120
128
|
end
|
121
129
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polaris_view_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Gamble
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-05-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -934,7 +934,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
934
934
|
- !ruby/object:Gem::Version
|
935
935
|
version: '0'
|
936
936
|
requirements: []
|
937
|
-
rubygems_version: 3.5.
|
937
|
+
rubygems_version: 3.5.8
|
938
938
|
signing_key:
|
939
939
|
specification_version: 4
|
940
940
|
summary: ViewComponents for Polaris Design System
|