polaris_view_components 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9104fc7211aff5782480099369c68f1d501b1fa0b928de5e76dde02236e17c91
4
- data.tar.gz: 65f7d2ee26f6b1b248beafbfd1049b15a354f0f20c8c2f26d65f41dcac7d2c34
3
+ metadata.gz: e9f0dda0dd8c18919a32d2db1f85d8f141e6c034d4b01a14a1f3962ccd1b44d5
4
+ data.tar.gz: b852067c8aaf0a6b8227979b8b8e11d8ceaf16835ee750d426a33c9a07753641
5
5
  SHA512:
6
- metadata.gz: c095f4ae076c31a5df33bcbd031371bc815b8735d8fee48027811c3af5d261e1858e2669de44b1459971d073e75c210f51ca066baa097897e0d7bbbee7a76d76
7
- data.tar.gz: 3eefdb4baf96619379e8818fda00ef4bde02f4db030e60218406f6dc84fc68c2097af6f82cb6c765d55c92503182e651ac82300ce9d5f57e36720e0d3324eab1
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
 
@@ -332,7 +332,7 @@ export default class extends Controller {
332
332
  }
333
333
 
334
334
  renderFile (file) {
335
- const validImageTypes = ['image/gif', 'image/jpeg', 'image/png']
335
+ const validImageTypes = ['image/gif', 'image/jpeg', 'image/png', 'image/svg+xml']
336
336
  const clone = this.itemTemplateTarget.content.cloneNode(true)
337
337
  const [icon, thumbnail, content, fileSize] = [
338
338
  clone.querySelector('[data-target="icon"]'),
@@ -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;
@@ -639,7 +639,7 @@ class Dropzone extends Controller {
639
639
  this.element.classList.toggle("Polaris-DropZone--hasError", show);
640
640
  }
641
641
  renderFile(file) {
642
- const validImageTypes = [ "image/gif", "image/jpeg", "image/png" ];
642
+ const validImageTypes = [ "image/gif", "image/jpeg", "image/png", "image/svg+xml" ];
643
643
  const clone = this.itemTemplateTarget.content.cloneNode(true);
644
644
  const [icon, thumbnail, content, fileSize] = [ clone.querySelector('[data-target="icon"]'), clone.querySelector('[data-target="thumbnail"]'), clone.querySelector('[data-target="content"]'), clone.querySelector('[data-target="file-size"]') ];
645
645
  if (validImageTypes.includes(file.type)) {
@@ -38,4 +38,13 @@ html[class~="Polaris-Summer-Editions-2023"] .Polaris-LegacyCard {
38
38
  padding-top: var(--p-space-400);
39
39
  }
40
40
  }
41
+
42
+ &.Polaris-LegacyCard--borderless {
43
+ border: none;
44
+ box-shadow: none;
45
+
46
+ &::before {
47
+ content: none;
48
+ }
49
+ }
41
50
  }
@@ -29,7 +29,7 @@ a.Polaris-Tag__Button {
29
29
 
30
30
  html[class~="Polaris-Summer-Editions-2023"] {
31
31
  .Polaris-LegacyCard__Section--borderTop {
32
- border-top: 0.1rem solid var(--p-color-border-subdued) !important;
32
+ border-top: 1px solid var(--p-color-border-subdued) !important;
33
33
  padding-top: var(--p-space-300) !important;
34
34
  }
35
35
 
@@ -38,7 +38,7 @@ html[class~="Polaris-Summer-Editions-2023"] {
38
38
  }
39
39
 
40
40
  .Polaris-LegacyCard__Section--borderBottom {
41
- border-bottom: 0.1rem solid var(--p-color-border-subdued) !important;
41
+ border-bottom: 1px solid var(--p-color-border-subdued) !important;
42
42
  padding-bottom: var(--p-space-300) !important;
43
43
 
44
44
  & + .Polaris-LegacyCard__Section {
@@ -361,6 +361,11 @@
361
361
  padding-top: var(--p-space-100);
362
362
  }html[class~="Polaris-Summer-Editions-2023"] .Polaris-LegacyCard.Polaris-LegacyCard--withoutTitle .Polaris-LegacyCard__Section:first-child {
363
363
  padding-top: var(--p-space-400);
364
+ }html[class~="Polaris-Summer-Editions-2023"] .Polaris-LegacyCard.Polaris-LegacyCard--borderless {
365
+ border: none;
366
+ box-shadow: none;
367
+ }html[class~="Polaris-Summer-Editions-2023"] .Polaris-LegacyCard.Polaris-LegacyCard--borderless::before {
368
+ content: none;
364
369
  }.Polaris--hidden {
365
370
  display: none !important;
366
371
  }/* Add missing 1/4 section for layout */@media (min-width: 30.625em) {
@@ -375,12 +380,12 @@
375
380
  }/* Card */.Polaris-LegacyCard {
376
381
  overflow: initial;
377
382
  }html[class~="Polaris-Summer-Editions-2023"] .Polaris-LegacyCard__Section--borderTop {
378
- border-top: 0.1rem solid var(--p-color-border-subdued) !important;
383
+ border-top: 1px solid var(--p-color-border-subdued) !important;
379
384
  padding-top: var(--p-space-300) !important;
380
385
  }html[class~="Polaris-Summer-Editions-2023"] .Polaris-LegacyCard__Section:has(+.Polaris-LegacyCard__Section--borderTop) {
381
386
  padding-bottom: var(--p-space-300) !important;
382
387
  }html[class~="Polaris-Summer-Editions-2023"] .Polaris-LegacyCard__Section--borderBottom {
383
- border-bottom: 0.1rem solid var(--p-color-border-subdued) !important;
388
+ border-bottom: 1px solid var(--p-color-border-subdued) !important;
384
389
  padding-bottom: var(--p-space-300) !important;
385
390
  }html[class~="Polaris-Summer-Editions-2023"] .Polaris-LegacyCard__Section--borderBottom + .Polaris-LegacyCard__Section {
386
391
  padding-top: var(--p-space-300) !important;
@@ -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 @name.present? %>
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
@@ -22,6 +22,7 @@ module Polaris
22
22
  actions: [],
23
23
  sectioned: true,
24
24
  subdued: false,
25
+ borders: true,
25
26
  footer_action_alignment: FOOTER_ACTION_ALIGNMENT_DEFAULT,
26
27
  **system_arguments
27
28
  )
@@ -29,6 +30,7 @@ module Polaris
29
30
  @actions = actions
30
31
  @sectioned = sectioned
31
32
  @subdued = subdued
33
+ @borders = borders
32
34
  @footer_action_alignment = footer_action_alignment
33
35
  @system_arguments = system_arguments
34
36
  end
@@ -40,7 +42,8 @@ module Polaris
40
42
  opts[:classes],
41
43
  "Polaris-LegacyCard",
42
44
  "Polaris-LegacyCard--subdued": @subdued,
43
- "Polaris-LegacyCard--withoutTitle": @title.blank?
45
+ "Polaris-LegacyCard--withoutTitle": @title.blank?,
46
+ "Polaris-LegacyCard--borderless": !@borders
44
47
  )
45
48
  end
46
49
  end
@@ -38,6 +38,7 @@ module Polaris
38
38
  **system_arguments
39
39
  )
40
40
  @title = title
41
+ @title_hidden = title_hidden
41
42
  @error = error
42
43
  @form = form
43
44
  @attribute = attribute
@@ -4,7 +4,7 @@
4
4
  <% if image.present? %>
5
5
  <div><%= image %></div>
6
6
  <% end %>
7
- <%= polaris_display_text(size: :small) do %>
7
+ <%= polaris_display_text do %>
8
8
  <%= @title %>
9
9
  <% end %>
10
10
  <% if @description.present? %>
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Polaris
2
2
  module ViewComponents
3
- VERSION = "2.0.0"
3
+ VERSION = "2.1.0"
4
4
  end
5
5
  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.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-03-18 00:00:00.000000000 Z
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.6
937
+ rubygems_version: 3.5.8
938
938
  signing_key:
939
939
  specification_version: 4
940
940
  summary: ViewComponents for Polaris Design System