polaris_view_components 0.5.0 → 0.6.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/button_controller.js +48 -0
- data/app/assets/javascripts/polaris_view_components/index.js +11 -1
- data/app/assets/javascripts/polaris_view_components/modal_controller.js +25 -0
- data/app/assets/javascripts/polaris_view_components/polaris_controller.js +24 -0
- data/app/assets/javascripts/polaris_view_components/popover_controller.js +45 -0
- data/app/assets/javascripts/polaris_view_components/scrollable_controller.js +60 -0
- data/app/assets/javascripts/polaris_view_components.js +1533 -1
- data/app/assets/stylesheets/polaris_view_components/custom.css +26 -1
- data/app/assets/stylesheets/polaris_view_components.css +21 -1
- data/app/components/polaris/action.rb +3 -3
- data/app/components/polaris/action_list/item_component.html.erb +35 -0
- data/app/components/polaris/action_list/item_component.rb +41 -0
- data/app/components/polaris/action_list/section_component.html.erb +16 -0
- data/app/components/polaris/action_list/section_component.rb +26 -0
- data/app/components/polaris/action_list_component.html.erb +13 -0
- data/app/components/polaris/action_list_component.rb +25 -0
- data/app/components/polaris/application_component.rb +19 -19
- data/app/components/polaris/avatar_component.rb +1 -1
- data/app/components/polaris/badge_component.rb +1 -1
- data/app/components/polaris/banner_component.rb +6 -6
- data/app/components/polaris/base_button.rb +1 -1
- data/app/components/polaris/button_component.html.erb +13 -0
- data/app/components/polaris/button_group_component.rb +5 -5
- data/app/components/polaris/callout_card_component.rb +5 -5
- data/app/components/polaris/caption_component.rb +2 -2
- data/app/components/polaris/card/header_component.rb +1 -1
- data/app/components/polaris/card/section_component.rb +2 -2
- data/app/components/polaris/card_component.html.erb +4 -0
- data/app/components/polaris/card_component.rb +5 -4
- data/app/components/polaris/character_count.rb +10 -10
- data/app/components/polaris/checkbox_component.rb +4 -4
- data/app/components/polaris/choice_component.rb +1 -1
- data/app/components/polaris/choice_list_component.rb +4 -4
- data/app/components/polaris/data_table/cell_component.rb +3 -3
- data/app/components/polaris/data_table_component.rb +3 -3
- data/app/components/polaris/description_list_component.rb +3 -3
- data/app/components/polaris/display_text_component.rb +2 -2
- data/app/components/polaris/dropzone/component.rb +36 -36
- data/app/components/polaris/empty_state_component.rb +3 -3
- data/app/components/polaris/exception_list/item_component.rb +2 -2
- data/app/components/polaris/exception_list_component.rb +1 -1
- data/app/components/polaris/filters_component.rb +2 -2
- data/app/components/polaris/footer_help_component.rb +1 -1
- data/app/components/polaris/form_layout/group_component.rb +3 -3
- data/app/components/polaris/form_layout/item_component.rb +1 -1
- data/app/components/polaris/form_layout_component.rb +3 -3
- data/app/components/polaris/heading_component.rb +1 -1
- data/app/components/polaris/headless_button.html.erb +13 -0
- data/app/components/polaris/headless_button.rb +17 -5
- data/app/components/polaris/icon_component.rb +2 -2
- data/app/components/polaris/index_table/cell_component.rb +2 -2
- data/app/components/polaris/index_table_component.rb +3 -3
- data/app/components/polaris/inline_error_component.rb +1 -1
- data/app/components/polaris/label_component.rb +2 -2
- data/app/components/polaris/labelled_component.rb +2 -2
- data/app/components/polaris/layout/annotated_section.rb +1 -1
- data/app/components/polaris/layout/section.rb +1 -1
- data/app/components/polaris/layout_component.rb +3 -3
- data/app/components/polaris/link_component.rb +3 -3
- data/app/components/polaris/list_component.rb +3 -3
- data/app/components/polaris/modal/section_component.rb +19 -0
- data/app/components/polaris/modal_component.html.erb +79 -0
- data/app/components/polaris/modal_component.rb +98 -0
- data/app/components/polaris/page_actions_component.rb +8 -7
- data/app/components/polaris/page_component.rb +4 -4
- data/app/components/polaris/pagination_component.rb +1 -5
- data/app/components/polaris/popover/pane_component.html.erb +25 -0
- data/app/components/polaris/popover/pane_component.rb +20 -0
- data/app/components/polaris/popover/section_component.rb +19 -0
- data/app/components/polaris/popover_component.html.erb +38 -0
- data/app/components/polaris/popover_component.rb +90 -0
- data/app/components/polaris/progress_bar_component.rb +5 -5
- data/app/components/polaris/radio_button_component.rb +3 -3
- data/app/components/polaris/resource_item_component.html.erb +16 -6
- data/app/components/polaris/resource_item_component.rb +42 -9
- data/app/components/polaris/resource_list_component.rb +2 -2
- data/app/components/polaris/scrollable_component.html.erb +5 -0
- data/app/components/polaris/scrollable_component.rb +48 -0
- data/app/components/polaris/select_component.rb +3 -3
- data/app/components/polaris/setting_toggle_component.html.erb +10 -0
- data/app/components/polaris/setting_toggle_component.rb +24 -0
- data/app/components/polaris/shopify_navigation_component.rb +6 -6
- data/app/components/polaris/skeleton_body_text_component.rb +1 -1
- data/app/components/polaris/spacer_component.rb +3 -3
- data/app/components/polaris/spinner_component.rb +2 -2
- data/app/components/polaris/stack_component.rb +5 -5
- data/app/components/polaris/subheading_component.rb +1 -1
- data/app/components/polaris/tabs/tab_component.html.erb +10 -0
- data/app/components/polaris/tabs/tab_component.rb +34 -0
- data/app/components/polaris/tabs_component.html.erb +7 -0
- data/app/components/polaris/tabs_component.rb +37 -0
- data/app/components/polaris/tag_component.rb +1 -1
- data/app/components/polaris/text_container_component.rb +2 -2
- data/app/components/polaris/text_field_component.rb +8 -8
- data/app/components/polaris/text_style_component.rb +4 -4
- data/app/components/polaris/thumbnail_component.rb +2 -2
- data/app/helpers/polaris/form_builder.rb +4 -2
- data/app/helpers/polaris/url_helper.rb +3 -3
- data/app/helpers/polaris/view_helper.rb +11 -3
- data/app/validators/type_validator.rb +2 -2
- data/lib/generators/polaris_view_components/install_generator.rb +5 -5
- data/lib/polaris/view_components/engine.rb +6 -0
- data/lib/polaris/view_components/version.rb +1 -1
- data/lib/polaris_view_components.rb +1 -1
- metadata +30 -3
@@ -1,3 +1,7 @@
|
|
1
|
+
.Polaris--hidden {
|
2
|
+
display: none;
|
3
|
+
}
|
4
|
+
|
1
5
|
/* Add missing 1/4 section for layout */
|
2
6
|
@media (min-width: 30.625em) {
|
3
7
|
.Polaris-Layout__Section--oneFourth {
|
@@ -38,6 +42,27 @@ a.Polaris-Tag__Button {
|
|
38
42
|
}
|
39
43
|
|
40
44
|
/* Remove box-shadow from buttons and links */
|
41
|
-
.Polaris-Button::after,
|
45
|
+
.Polaris-Button::after,
|
46
|
+
.Polaris-Button:focus::after,
|
47
|
+
.Polaris-Breadcrumbs__Breadcrumb::after {
|
48
|
+
box-shadow: none !important;
|
49
|
+
}
|
50
|
+
|
51
|
+
.Polaris-Tabs__Tab:focus > .Polaris-Tabs__Title::after {
|
42
52
|
box-shadow: none !important;
|
43
53
|
}
|
54
|
+
|
55
|
+
/* ResourceItem */
|
56
|
+
.Polaris-ResourceItem__Owned--offset {
|
57
|
+
padding-left: 2rem;
|
58
|
+
}
|
59
|
+
|
60
|
+
/* Popover */
|
61
|
+
.Polaris-Popover {
|
62
|
+
margin: 0;
|
63
|
+
}
|
64
|
+
|
65
|
+
.Polaris-Popover__PopoverOverlay--closed {
|
66
|
+
visibility: hidden;
|
67
|
+
pointer-events: none;
|
68
|
+
}
|
@@ -2177,6 +2177,9 @@ html, body{ min-height:100%; height:100%; }
|
|
2177
2177
|
.Polaris-Spacer--horizontalSpacingExtraLoose {
|
2178
2178
|
width: 32px;
|
2179
2179
|
}
|
2180
|
+
.Polaris--hidden {
|
2181
|
+
display: none;
|
2182
|
+
}
|
2180
2183
|
/* Add missing 1/4 section for layout */
|
2181
2184
|
@media (min-width: 30.625em) {
|
2182
2185
|
.Polaris-Layout__Section--oneFourth {
|
@@ -2209,6 +2212,23 @@ a.Polaris-Tag__Button {
|
|
2209
2212
|
font-size: 1.25rem;
|
2210
2213
|
}
|
2211
2214
|
/* Remove box-shadow from buttons and links */
|
2212
|
-
.Polaris-Button::after,
|
2215
|
+
.Polaris-Button::after,
|
2216
|
+
.Polaris-Button:focus::after,
|
2217
|
+
.Polaris-Breadcrumbs__Breadcrumb::after {
|
2218
|
+
box-shadow: none !important;
|
2219
|
+
}
|
2220
|
+
.Polaris-Tabs__Tab:focus > .Polaris-Tabs__Title::after {
|
2213
2221
|
box-shadow: none !important;
|
2214
2222
|
}
|
2223
|
+
/* ResourceItem */
|
2224
|
+
.Polaris-ResourceItem__Owned--offset {
|
2225
|
+
padding-left: 2rem;
|
2226
|
+
}
|
2227
|
+
/* Popover */
|
2228
|
+
.Polaris-Popover {
|
2229
|
+
margin: 0;
|
2230
|
+
}
|
2231
|
+
.Polaris-Popover__PopoverOverlay--closed {
|
2232
|
+
visibility: hidden;
|
2233
|
+
pointer-events: none;
|
2234
|
+
}
|
@@ -5,9 +5,9 @@ module Polaris
|
|
5
5
|
def initialize(
|
6
6
|
content:,
|
7
7
|
url:,
|
8
|
-
accessibility_label:
|
8
|
+
accessibility_label: "",
|
9
9
|
external: false,
|
10
|
-
id:
|
10
|
+
id: "",
|
11
11
|
data: {}
|
12
12
|
)
|
13
13
|
@content = content
|
@@ -25,7 +25,7 @@ module Polaris
|
|
25
25
|
external: @external,
|
26
26
|
id: @id,
|
27
27
|
url: @url,
|
28
|
-
data: @data
|
28
|
+
data: @data
|
29
29
|
}
|
30
30
|
end
|
31
31
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<li>
|
2
|
+
<%= render Polaris::BaseComponent.new(**system_arguments) do %>
|
3
|
+
<div class="Polaris-ActionList__Content">
|
4
|
+
<% if @icon.present? %>
|
5
|
+
<span class="Polaris-ActionList__Prefix">
|
6
|
+
<%= polaris_icon(name: @icon) %>
|
7
|
+
</span>
|
8
|
+
<% end %>
|
9
|
+
<% if prefix.present? %>
|
10
|
+
<span class="Polaris-ActionList__Prefix">
|
11
|
+
<%= prefix %>
|
12
|
+
</span>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<span class="Polaris-ActionList__Text">
|
16
|
+
<% if @help_text.present? %>
|
17
|
+
<span class="Polaris-ActionList__ContentBlock">
|
18
|
+
<span class="Polaris-ActionList__ContentBlockInner">
|
19
|
+
<%= content %>
|
20
|
+
</span>
|
21
|
+
<%= polaris_text_subdued { @help_text } %>
|
22
|
+
</span>
|
23
|
+
<% else %>
|
24
|
+
<%= content %>
|
25
|
+
<% end %>
|
26
|
+
</span>
|
27
|
+
|
28
|
+
<% if suffix.present? %>
|
29
|
+
<span class="Polaris-ActionList__Suffix">
|
30
|
+
<%= suffix %>
|
31
|
+
</span>
|
32
|
+
<% end %>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
35
|
+
</li>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class Polaris::ActionList::ItemComponent < Polaris::NewComponent
|
2
|
+
renders_one :prefix
|
3
|
+
renders_one :suffix
|
4
|
+
|
5
|
+
def initialize(
|
6
|
+
url: nil,
|
7
|
+
icon: nil,
|
8
|
+
help_text: nil,
|
9
|
+
active: false,
|
10
|
+
destructive: false,
|
11
|
+
external: false,
|
12
|
+
**system_arguments
|
13
|
+
)
|
14
|
+
@url = url
|
15
|
+
@icon = icon
|
16
|
+
@help_text = help_text
|
17
|
+
@active = active
|
18
|
+
@destructive = destructive
|
19
|
+
@external = external
|
20
|
+
@system_arguments = system_arguments
|
21
|
+
end
|
22
|
+
|
23
|
+
def system_arguments
|
24
|
+
@system_arguments.tap do |opts|
|
25
|
+
if @url.present?
|
26
|
+
opts[:tag] = "a"
|
27
|
+
opts[:href] = @url
|
28
|
+
opts[:target] = "_blank" if @external
|
29
|
+
else
|
30
|
+
opts[:tag] = "button"
|
31
|
+
opts[:type] = "button"
|
32
|
+
end
|
33
|
+
opts[:classes] = class_names(
|
34
|
+
@system_arguments[:classes],
|
35
|
+
"Polaris-ActionList__Item",
|
36
|
+
"Polaris-ActionList--active": @active,
|
37
|
+
"Polaris-ActionList--destructive": @destructive
|
38
|
+
)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= render Polaris::BaseComponent.new(**system_arguments) do %>
|
2
|
+
<% if @title.present? %>
|
3
|
+
<p class="<%= title_classes %>">
|
4
|
+
<%= @title %>
|
5
|
+
</p>
|
6
|
+
<% end %>
|
7
|
+
<ul class="Polaris-ActionList__Actions">
|
8
|
+
<% if items.present? %>
|
9
|
+
<% items.each do |item| %>
|
10
|
+
<%= item %>
|
11
|
+
<% end %>
|
12
|
+
<% else %>
|
13
|
+
<%= content %>
|
14
|
+
<% end %>
|
15
|
+
</ul>
|
16
|
+
<% end %>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class Polaris::ActionList::SectionComponent < Polaris::NewComponent
|
2
|
+
renders_many :items, Polaris::ActionList::ItemComponent
|
3
|
+
|
4
|
+
def initialize(position: 1, title: nil, **system_arguments)
|
5
|
+
@position = position
|
6
|
+
@title = title
|
7
|
+
@system_arguments = system_arguments
|
8
|
+
end
|
9
|
+
|
10
|
+
def system_arguments
|
11
|
+
@system_arguments.tap do |opts|
|
12
|
+
opts[:tag] = "div"
|
13
|
+
opts[:classes] = class_names(
|
14
|
+
@system_arguments[:classes],
|
15
|
+
"Polaris-ActionList__Section--withoutTitle": @title.blank?
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def title_classes
|
21
|
+
class_names(
|
22
|
+
"Polaris-ActionList__Title",
|
23
|
+
"Polaris-ActionList--firstSectionWithTitle": @position == 1
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= render Polaris::BaseComponent.new(**system_arguments) do %>
|
2
|
+
<% if sections.present? %>
|
3
|
+
<% sections.each do |section| %>
|
4
|
+
<%= section %>
|
5
|
+
<% end %>
|
6
|
+
<% else %>
|
7
|
+
<%= render Polaris::ActionList::SectionComponent.new do %>
|
8
|
+
<% items.each do |item| %>
|
9
|
+
<%= item %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Polaris
|
2
|
+
class ActionListComponent < Polaris::NewComponent
|
3
|
+
renders_many :items, Polaris::ActionList::ItemComponent
|
4
|
+
renders_many :sections, ->(**system_arguments) do
|
5
|
+
@counter += 1
|
6
|
+
|
7
|
+
Polaris::ActionList::SectionComponent.new(position: @counter, **system_arguments)
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize(**system_arguments)
|
11
|
+
@counter = 0
|
12
|
+
@system_arguments = system_arguments
|
13
|
+
end
|
14
|
+
|
15
|
+
def system_arguments
|
16
|
+
@system_arguments.tap do |opts|
|
17
|
+
opts[:tag] = "div"
|
18
|
+
opts[:classes] = class_names(
|
19
|
+
@system_arguments[:classes],
|
20
|
+
"Polaris-ActionList"
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -9,27 +9,27 @@ class Polaris::ApplicationComponent < ViewComponent::Base
|
|
9
9
|
|
10
10
|
private
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
def classes
|
13
|
+
[]
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
def additional_data
|
17
|
+
{}
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
def additional_aria
|
21
|
+
{}
|
22
|
+
end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
def content_tag_options
|
25
|
+
{
|
26
|
+
class: classes.compact,
|
27
|
+
data: @data.merge(additional_data),
|
28
|
+
aria: @aria.merge(additional_aria)
|
29
|
+
}.merge(@html_options)
|
30
|
+
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
def before_render
|
33
|
+
validate!
|
34
|
+
end
|
35
35
|
end
|
@@ -44,7 +44,7 @@ module Polaris
|
|
44
44
|
"Polaris-Badge",
|
45
45
|
PROGRESS_MAPPINGS[fetch_or_fallback(PROGRESS_OPTIONS, progress, PROGRESS_DEFAULT)],
|
46
46
|
SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, SIZE_DEFAULT)],
|
47
|
-
STATUS_MAPPINGS[fetch_or_fallback(STATUS_OPTIONS, status, STATUS_DEFAULT)]
|
47
|
+
STATUS_MAPPINGS[fetch_or_fallback(STATUS_OPTIONS, status, STATUS_DEFAULT)]
|
48
48
|
)
|
49
49
|
end
|
50
50
|
end
|
@@ -8,14 +8,14 @@ module Polaris
|
|
8
8
|
:success => "Polaris-Banner--statusSuccess",
|
9
9
|
:info => "Polaris-Banner--statusInfo",
|
10
10
|
:warning => "Polaris-Banner--statusWarning",
|
11
|
-
:critical => "Polaris-Banner--statusCritical"
|
11
|
+
:critical => "Polaris-Banner--statusCritical"
|
12
12
|
}
|
13
13
|
STATUS_OPTIONS = STATUS_MAPPINGS.keys
|
14
14
|
|
15
15
|
WITHIN_DEFAULT = :page
|
16
16
|
WITHIN_MAPPINGS = {
|
17
17
|
page: "Polaris-Banner--withinPage",
|
18
|
-
container: "Polaris-Banner--withinContentContainer"
|
18
|
+
container: "Polaris-Banner--withinContentContainer"
|
19
19
|
}
|
20
20
|
WITHIN_OPTIONS = WITHIN_MAPPINGS.keys
|
21
21
|
|
@@ -24,14 +24,14 @@ module Polaris
|
|
24
24
|
success: :success,
|
25
25
|
info: :highlight,
|
26
26
|
warning: :warning,
|
27
|
-
critical: :critical
|
27
|
+
critical: :critical
|
28
28
|
}
|
29
29
|
|
30
|
-
renders_one :action, ->
|
30
|
+
renders_one :action, ->(**system_arguments) do
|
31
31
|
Polaris::ButtonComponent.new(classes: "Polaris-Banner__Button", **system_arguments)
|
32
32
|
end
|
33
33
|
renders_one :secondary_action, "SecondaryAction"
|
34
|
-
renders_one :dismiss_button, ->
|
34
|
+
renders_one :dismiss_button, ->(**system_arguments) do
|
35
35
|
render Polaris::ButtonComponent.new(plain: true, **system_arguments) do |button|
|
36
36
|
button.icon(name: "CancelSmallMinor")
|
37
37
|
end
|
@@ -55,7 +55,7 @@ module Polaris
|
|
55
55
|
@system_arguments[:classes],
|
56
56
|
"Polaris-Banner",
|
57
57
|
STATUS_MAPPINGS[fetch_or_fallback(STATUS_OPTIONS, status, STATUS_DEFAULT)],
|
58
|
-
WITHIN_MAPPINGS[fetch_or_fallback(WITHIN_OPTIONS, within, WITHIN_DEFAULT)]
|
58
|
+
WITHIN_MAPPINGS[fetch_or_fallback(WITHIN_OPTIONS, within, WITHIN_DEFAULT)]
|
59
59
|
)
|
60
60
|
end
|
61
61
|
|
@@ -20,5 +20,18 @@
|
|
20
20
|
<%= content %>
|
21
21
|
</div>
|
22
22
|
<% end %>
|
23
|
+
|
24
|
+
<% if @disclosure.present? %>
|
25
|
+
<div class="Polaris-Button__Icon">
|
26
|
+
<% case @disclosure %>
|
27
|
+
<% when :down %>
|
28
|
+
<%= polaris_icon(name: "CaretDownMinor") %>
|
29
|
+
<% when :up %>
|
30
|
+
<%= polaris_icon(name: "CaretUpMinor") %>
|
31
|
+
<% when :select %>
|
32
|
+
<%= polaris_icon(name: "SelectMinor") %>
|
33
|
+
<% end %>
|
34
|
+
</div>
|
35
|
+
<% end %>
|
23
36
|
</span>
|
24
37
|
<% end %>
|
@@ -7,17 +7,17 @@ module Polaris
|
|
7
7
|
SPACING_DEFAULT => "",
|
8
8
|
:extra_tight => "Polaris-ButtonGroup--extraTight",
|
9
9
|
:tight => "Polaris-ButtonGroup--tight",
|
10
|
-
:loose => "Polaris-ButtonGroup--loose"
|
10
|
+
:loose => "Polaris-ButtonGroup--loose"
|
11
11
|
}
|
12
12
|
SPACING_OPTIONS = SPACING_MAPPINGS.keys
|
13
13
|
|
14
|
-
renders_many :buttons, ->
|
14
|
+
renders_many :buttons, ->(**system_arguments) do
|
15
15
|
@counter += 1
|
16
16
|
|
17
17
|
ButtonGroupItemButtonComponent.new(position: @counter, **system_arguments)
|
18
18
|
end
|
19
19
|
|
20
|
-
renders_many :items, ->
|
20
|
+
renders_many :items, ->(**system_arguments) do
|
21
21
|
@counter += 1
|
22
22
|
|
23
23
|
ButtonGroupItemComponent.new(position: @counter, **system_arguments)
|
@@ -47,7 +47,7 @@ module Polaris
|
|
47
47
|
"Polaris-ButtonGroup",
|
48
48
|
SPACING_MAPPINGS[fetch_or_fallback(SPACING_OPTIONS, spacing, SPACING_DEFAULT)],
|
49
49
|
"Polaris-ButtonGroup--fullWidth": full_width,
|
50
|
-
"Polaris-ButtonGroup--segmented": segmented
|
50
|
+
"Polaris-ButtonGroup--segmented": segmented
|
51
51
|
)
|
52
52
|
end
|
53
53
|
|
@@ -97,7 +97,7 @@ module Polaris
|
|
97
97
|
@system_arguments[:tag] = :div
|
98
98
|
@system_arguments[:classes] = class_names(
|
99
99
|
@system_arguments[:classes],
|
100
|
-
"Polaris-ButtonGroup__Item"
|
100
|
+
"Polaris-ButtonGroup__Item"
|
101
101
|
)
|
102
102
|
end
|
103
103
|
|
@@ -3,10 +3,10 @@
|
|
3
3
|
module Polaris
|
4
4
|
class CalloutCardComponent < Polaris::NewComponent
|
5
5
|
renders_one :primary_action, Polaris::ButtonComponent
|
6
|
-
renders_one :secondary_action, ->
|
6
|
+
renders_one :secondary_action, ->(plain: true, **system_arguments) do
|
7
7
|
Polaris::ButtonComponent.new(plain: plain, **system_arguments)
|
8
8
|
end
|
9
|
-
renders_one :dismiss_button, ->
|
9
|
+
renders_one :dismiss_button, ->(**system_arguments) do
|
10
10
|
render Polaris::ButtonComponent.new(plain: true, **system_arguments) do |button|
|
11
11
|
button.icon(name: "CancelSmallMinor")
|
12
12
|
end
|
@@ -24,21 +24,21 @@ module Polaris
|
|
24
24
|
@system_arguments[:tag] = "div"
|
25
25
|
@system_arguments[:classes] = class_names(
|
26
26
|
@system_arguments[:classes],
|
27
|
-
"Polaris-Card"
|
27
|
+
"Polaris-Card"
|
28
28
|
)
|
29
29
|
end
|
30
30
|
|
31
31
|
def container_classes
|
32
32
|
class_names(
|
33
33
|
"Polaris-CalloutCard__Container",
|
34
|
-
"Polaris-CalloutCard--hasDismiss": dismiss_button.present
|
34
|
+
"Polaris-CalloutCard--hasDismiss": dismiss_button.present?
|
35
35
|
)
|
36
36
|
end
|
37
37
|
|
38
38
|
def image_classes
|
39
39
|
class_names(
|
40
40
|
"Polaris-CalloutCard__Image",
|
41
|
-
"Polaris-CalloutCard__DismissImage": dismiss_button.present
|
41
|
+
"Polaris-CalloutCard__DismissImage": dismiss_button.present?
|
42
42
|
)
|
43
43
|
end
|
44
44
|
end
|
@@ -4,10 +4,10 @@ module Polaris
|
|
4
4
|
class CaptionComponent < Polaris::NewComponent
|
5
5
|
def initialize(**system_arguments)
|
6
6
|
@system_arguments = system_arguments
|
7
|
-
@system_arguments[:tag] =
|
7
|
+
@system_arguments[:tag] = "p"
|
8
8
|
@system_arguments[:classes] = class_names(
|
9
9
|
@system_arguments[:classes],
|
10
|
-
"Polaris-Caption"
|
10
|
+
"Polaris-Caption"
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
@@ -21,7 +21,7 @@ class Polaris::Card::SectionComponent < Polaris::NewComponent
|
|
21
21
|
"Polaris-Card__Section--subdued": subdued,
|
22
22
|
"Polaris-Card__Section--fullWidth": full_width,
|
23
23
|
"Polaris-Card__Section--borderTop": border_top,
|
24
|
-
"Polaris-Card__Section--borderBottom": border_bottom
|
24
|
+
"Polaris-Card__Section--borderBottom": border_bottom
|
25
25
|
)
|
26
26
|
|
27
27
|
@title = title
|
@@ -34,7 +34,7 @@ class Polaris::Card::SectionComponent < Polaris::NewComponent
|
|
34
34
|
@system_arguments[:tag] = :div
|
35
35
|
@system_arguments[:classes] = class_names(
|
36
36
|
@system_arguments[:classes],
|
37
|
-
"Polaris-Card__Subsection"
|
37
|
+
"Polaris-Card__Subsection"
|
38
38
|
)
|
39
39
|
end
|
40
40
|
|
@@ -5,13 +5,14 @@ module Polaris
|
|
5
5
|
FOOTER_ACTION_ALIGNMENT_DEFAULT = :right
|
6
6
|
FOOTER_ACTION_ALIGNMENT_MAPPINGS = {
|
7
7
|
FOOTER_ACTION_ALIGNMENT_DEFAULT => "",
|
8
|
-
:left => "Polaris-Card__LeftJustified"
|
8
|
+
:left => "Polaris-Card__LeftJustified"
|
9
9
|
}
|
10
10
|
FOOTER_ACTION_ALIGNMENT_OPTIONS = FOOTER_ACTION_ALIGNMENT_MAPPINGS.keys
|
11
11
|
|
12
|
+
renders_one :tabs, Polaris::TabsComponent
|
12
13
|
renders_one :header, Polaris::Card::HeaderComponent
|
13
14
|
renders_many :sections, Polaris::Card::SectionComponent
|
14
|
-
renders_one :primary_footer_action, ->
|
15
|
+
renders_one :primary_footer_action, ->(primary: true, **system_arguments) do
|
15
16
|
Polaris::ButtonComponent.new(primary: primary, **system_arguments)
|
16
17
|
end
|
17
18
|
renders_many :secondary_footer_actions, Polaris::ButtonComponent
|
@@ -34,7 +35,7 @@ module Polaris
|
|
34
35
|
@system_arguments[:classes] = class_names(
|
35
36
|
@system_arguments[:classes],
|
36
37
|
"Polaris-Card",
|
37
|
-
"Polaris-Card--subdued": subdued
|
38
|
+
"Polaris-Card--subdued": subdued
|
38
39
|
)
|
39
40
|
end
|
40
41
|
|
@@ -45,7 +46,7 @@ module Polaris
|
|
45
46
|
def footer_classes
|
46
47
|
class_names(
|
47
48
|
"Polaris-Card__Footer",
|
48
|
-
FOOTER_ACTION_ALIGNMENT_MAPPINGS[fetch_or_fallback(FOOTER_ACTION_ALIGNMENT_OPTIONS, @footer_action_alignment, FOOTER_ACTION_ALIGNMENT_DEFAULT)]
|
49
|
+
FOOTER_ACTION_ALIGNMENT_MAPPINGS[fetch_or_fallback(FOOTER_ACTION_ALIGNMENT_OPTIONS, @footer_action_alignment, FOOTER_ACTION_ALIGNMENT_DEFAULT)]
|
49
50
|
)
|
50
51
|
end
|
51
52
|
end
|
@@ -16,7 +16,7 @@ module Polaris
|
|
16
16
|
def text
|
17
17
|
return "#{count}/#{@max_length}" if max_length?
|
18
18
|
|
19
|
-
|
19
|
+
count.to_s
|
20
20
|
end
|
21
21
|
|
22
22
|
def label_template
|
@@ -35,16 +35,16 @@ module Polaris
|
|
35
35
|
|
36
36
|
private
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
def max_length?
|
39
|
+
@max_length.present?
|
40
|
+
end
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
def normalized_value
|
43
|
+
@text_field.value.to_s || ""
|
44
|
+
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
def count
|
47
|
+
normalized_value.length
|
48
|
+
end
|
49
49
|
end
|
50
50
|
end
|
@@ -6,7 +6,7 @@ module Polaris
|
|
6
6
|
|
7
7
|
attr_reader :checked
|
8
8
|
|
9
|
-
validates :checked, inclusion: {
|
9
|
+
validates :checked, inclusion: {in: [true, false, :indeterminate]}
|
10
10
|
|
11
11
|
def initialize(
|
12
12
|
form: nil,
|
@@ -37,7 +37,7 @@ module Polaris
|
|
37
37
|
@system_arguments[:classes],
|
38
38
|
"Polaris-Checkbox",
|
39
39
|
"Polaris-Checkbox--labelHidden": label_hidden,
|
40
|
-
"Polaris-Checkbox--error": error.present
|
40
|
+
"Polaris-Checkbox--error": error.present?
|
41
41
|
)
|
42
42
|
|
43
43
|
@wrapper_arguments = {
|
@@ -45,7 +45,7 @@ module Polaris
|
|
45
45
|
label_hidden: label_hidden,
|
46
46
|
disabled: disabled,
|
47
47
|
help_text: help_text,
|
48
|
-
error: error
|
48
|
+
error: error
|
49
49
|
}.merge(wrapper_arguments)
|
50
50
|
|
51
51
|
@input_options = input_options
|
@@ -59,7 +59,7 @@ module Polaris
|
|
59
59
|
@input_options[:class] = class_names(
|
60
60
|
@input_options[:classes],
|
61
61
|
"Polaris-Checkbox__Input",
|
62
|
-
"Polaris-Checkbox__Input--indeterminate": indeterminate
|
62
|
+
"Polaris-Checkbox__Input--indeterminate": indeterminate?
|
63
63
|
)
|
64
64
|
end
|
65
65
|
|