polaris_view_components 2.3.1 → 2.4.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 +4 -4
- data/app/assets/javascripts/polaris_view_components/select_controller.js +13 -0
- data/app/assets/javascripts/polaris_view_components.js +11 -0
- data/app/components/polaris/button_component.html.erb +43 -33
- data/app/components/polaris/headless_button.rb +3 -1
- data/app/components/polaris/labelled_component.rb +7 -3
- data/app/components/polaris/select_component.rb +5 -0
- data/lib/polaris/view_components/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afe73c510dcccbc175a32899246cbc0086d7beb9f951badfd6a2f4696ae06932
|
4
|
+
data.tar.gz: ade6fa42a44a20ff391d441fd432ab5d078f565aecf6bae9bd05af2fdc4bb1f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2eeffc04f4f14c24791f8411d38cefb70bb5d55b12e3ea58aa0ede26e1cf503648ebd3945f8a531c0e00cedbcad180036be7a2a6ac689e39d8ca317a241cfc2
|
7
|
+
data.tar.gz: e8c79131fde3961768bece82c91b084d9dc67df9d809665146545e0fdae2fefb0de040e45770d2451eab1029eeef09224bb9ed433e1f1ee7bab40e2cf0427797
|
@@ -11,4 +11,17 @@ export default class extends Controller {
|
|
11
11
|
const option = this.selectTarget.options[this.selectTarget.selectedIndex]
|
12
12
|
this.selectedOptionTarget.innerText = option.text
|
13
13
|
}
|
14
|
+
|
15
|
+
clearErrorMessages() {
|
16
|
+
const polarisSelect = this.selectTarget.closest(".Polaris-Select")
|
17
|
+
const wrapper = polarisSelect.parentElement
|
18
|
+
const inlineError = wrapper.querySelector(".Polaris-InlineError")
|
19
|
+
|
20
|
+
if (polarisSelect) {
|
21
|
+
polarisSelect.classList.remove("Polaris-Select--error")
|
22
|
+
}
|
23
|
+
if (inlineError) {
|
24
|
+
inlineError.remove()
|
25
|
+
}
|
26
|
+
}
|
14
27
|
}
|
@@ -2276,6 +2276,17 @@ class Select extends Controller {
|
|
2276
2276
|
const option = this.selectTarget.options[this.selectTarget.selectedIndex];
|
2277
2277
|
this.selectedOptionTarget.innerText = option.text;
|
2278
2278
|
}
|
2279
|
+
clearErrorMessages() {
|
2280
|
+
const polarisSelect = this.selectTarget.closest(".Polaris-Select");
|
2281
|
+
const wrapper = polarisSelect.parentElement;
|
2282
|
+
const inlineError = wrapper.querySelector(".Polaris-InlineError");
|
2283
|
+
if (polarisSelect) {
|
2284
|
+
polarisSelect.classList.remove("Polaris-Select--error");
|
2285
|
+
}
|
2286
|
+
if (inlineError) {
|
2287
|
+
inlineError.remove();
|
2288
|
+
}
|
2289
|
+
}
|
2279
2290
|
}
|
2280
2291
|
|
2281
2292
|
class TextField extends Controller {
|
@@ -1,39 +1,49 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
<% button_content = capture do %>
|
2
|
+
<%= render Polaris::BaseComponent.new(tag: @tag, **system_arguments) do %>
|
3
|
+
<span class="Polaris-Button__Content">
|
4
|
+
<% if @loading %>
|
5
|
+
<span class="Polaris-Button__Spinner">
|
6
|
+
<%= polaris_spinner(size: :small) %>
|
7
|
+
</span>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% if icon.present? || @icon_name.present? %>
|
11
|
+
<div class="Polaris-Button__Icon">
|
12
|
+
<%= icon.presence || polaris_icon(name: @icon_name) %>
|
13
|
+
</div>
|
14
|
+
<% if content.present? && !@plain %>
|
15
|
+
|
16
|
+
<% end %>
|
17
|
+
<% end %>
|
8
18
|
|
9
|
-
<% if icon.present? || @icon_name.present? %>
|
10
|
-
<div class="Polaris-Button__Icon">
|
11
|
-
<%= icon.presence || polaris_icon(name: @icon_name) %>
|
12
|
-
</div>
|
13
19
|
<% if content.present? %>
|
14
|
-
|
20
|
+
<div class="<%= @text_classes %>">
|
21
|
+
<%= content %>
|
22
|
+
</div>
|
15
23
|
<% end %>
|
16
|
-
<% end %>
|
17
24
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
25
|
+
<% if @disclosure.present? %>
|
26
|
+
<div class="Polaris-Button__Icon">
|
27
|
+
<% case @disclosure %>
|
28
|
+
<% when :down %>
|
29
|
+
<%= polaris_icon(name: "CaretDownIcon") %>
|
30
|
+
<% when :up %>
|
31
|
+
<%= polaris_icon(name: "CaretUpIcon") %>
|
32
|
+
<% when :select %>
|
33
|
+
<%= polaris_icon(name: "SelectIcon") %>
|
34
|
+
<% when :horizontal_dots %>
|
35
|
+
<%= polaris_icon(name: "MenuHorizontalIcon") %>
|
36
|
+
<% end %>
|
37
|
+
</div>
|
38
|
+
<% end %>
|
39
|
+
</span>
|
40
|
+
<% end %>
|
41
|
+
<% end %>
|
23
42
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
<%= polaris_icon(name: "CaretUpIcon") %>
|
31
|
-
<% when :select %>
|
32
|
-
<%= polaris_icon(name: "SelectIcon") %>
|
33
|
-
<% when :horizontal_dots %>
|
34
|
-
<%= polaris_icon(name: "MenuHorizontalIcon") %>
|
35
|
-
<% end %>
|
36
|
-
</div>
|
37
|
-
<% end %>
|
38
|
-
</span>
|
43
|
+
<% if @tooltip.present? %>
|
44
|
+
<%= polaris_tooltip(text: @tooltip) do %>
|
45
|
+
<%= button_content %>
|
46
|
+
<% end %>
|
47
|
+
<% else %>
|
48
|
+
<%= button_content %>
|
39
49
|
<% end %>
|
@@ -43,6 +43,7 @@ module Polaris
|
|
43
43
|
size: SIZE_DEFAULT,
|
44
44
|
text_align: TEXT_ALIGN_DEFAULT,
|
45
45
|
icon_name: nil,
|
46
|
+
tooltip: nil,
|
46
47
|
**system_arguments
|
47
48
|
)
|
48
49
|
@tag = url.present? ? "a" : "button"
|
@@ -50,11 +51,12 @@ module Polaris
|
|
50
51
|
"Polaris-Button__Text",
|
51
52
|
"Polaris-Button--removeUnderline": plain && monochrome && remove_underline
|
52
53
|
)
|
54
|
+
@plain = plain
|
53
55
|
@loading = loading
|
54
56
|
@disclosure = fetch_or_fallback(DISCLOSURE_OPTIONS, disclosure, DISCLOSURE_DEFAULT)
|
55
57
|
@disclosure = :down if @disclosure === true
|
56
58
|
@icon_name = icon_name
|
57
|
-
|
59
|
+
@tooltip = tooltip
|
58
60
|
@system_arguments = system_arguments
|
59
61
|
@system_arguments[:type] = submit ? "submit" : "button"
|
60
62
|
if loading
|
@@ -21,9 +21,13 @@ module Polaris
|
|
21
21
|
@help_text = help_text
|
22
22
|
@error = error
|
23
23
|
|
24
|
-
if label_action
|
25
|
-
|
26
|
-
|
24
|
+
if label_action
|
25
|
+
if label_action[:content].present?
|
26
|
+
label_content = label_action.delete(:content)
|
27
|
+
with_label_action(**label_action) { label_content }
|
28
|
+
elsif label_action[:icon_name].present?
|
29
|
+
with_label_action(**label_action)
|
30
|
+
end
|
27
31
|
end
|
28
32
|
|
29
33
|
@system_arguments = system_arguments
|
@@ -21,6 +21,7 @@ module Polaris
|
|
21
21
|
help_text: nil,
|
22
22
|
error: false,
|
23
23
|
grouped: false,
|
24
|
+
clear_errors_on_focus: false,
|
24
25
|
wrapper_arguments: {},
|
25
26
|
select_options: {},
|
26
27
|
input_options: {},
|
@@ -69,6 +70,7 @@ module Polaris
|
|
69
70
|
error: error
|
70
71
|
}.merge(wrapper_arguments)
|
71
72
|
|
73
|
+
@clear_errors_on_focus = clear_errors_on_focus
|
72
74
|
@select_options = select_options
|
73
75
|
|
74
76
|
@input_options = input_options
|
@@ -77,6 +79,9 @@ module Polaris
|
|
77
79
|
@input_options[:disabled] = disabled
|
78
80
|
@input_options[:data] ||= {}
|
79
81
|
prepend_option(@input_options[:data], :polaris_select_target, "select")
|
82
|
+
if @clear_errors_on_focus
|
83
|
+
prepend_option(@input_options[:data], :action, "click->polaris-select#clearErrorMessages")
|
84
|
+
end
|
80
85
|
prepend_option(@input_options[:data], :action, "polaris-select#update")
|
81
86
|
end
|
82
87
|
|
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.
|
4
|
+
version: 2.4.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: 2025-
|
12
|
+
date: 2025-05-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|