polaris_view_components 0.10.1 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -62
- data/app/assets/javascripts/polaris_view_components/autocomplete_controller.js +9 -3
- data/app/assets/javascripts/polaris_view_components/dropzone_controller.js +18 -8
- data/app/assets/javascripts/polaris_view_components/popover_controller.js +39 -13
- data/app/assets/javascripts/polaris_view_components.js +112 -59
- data/app/assets/stylesheets/polaris_view_components/custom.css +27 -8
- data/app/assets/stylesheets/polaris_view_components.css +21 -9
- data/app/components/polaris/autocomplete_component.html.erb +3 -0
- data/app/components/polaris/autocomplete_component.rb +3 -0
- data/app/components/polaris/button_component.html.erb +2 -0
- data/app/components/polaris/card/header_component.html.erb +4 -2
- data/app/components/polaris/data_table/column_component.rb +2 -1
- data/app/components/polaris/data_table_component.html.erb +6 -2
- data/app/components/polaris/data_table_component.rb +10 -0
- data/app/components/polaris/dropzone_component.html.erb +38 -32
- data/app/components/polaris/dropzone_component.rb +4 -1
- data/app/components/polaris/empty_search_results_component.html.erb +15 -0
- data/app/components/polaris/empty_search_results_component.rb +21 -0
- data/app/components/polaris/headless_button.html.erb +2 -0
- data/app/components/polaris/headless_button.rb +1 -1
- data/app/components/polaris/index_table/column_component.rb +2 -1
- data/app/components/polaris/index_table_component.html.erb +3 -5
- data/app/components/polaris/index_table_component.rb +10 -0
- data/app/components/polaris/page_component.html.erb +4 -4
- data/app/components/polaris/page_component.rb +7 -2
- data/app/components/polaris/popover_component.html.erb +26 -16
- data/app/components/polaris/popover_component.rb +6 -1
- data/app/components/polaris/resource_item/shortcut_actions_component.html.erb +21 -0
- data/app/components/polaris/resource_item/shortcut_actions_component.rb +88 -0
- data/app/components/polaris/resource_item_component.html.erb +3 -0
- data/app/components/polaris/resource_item_component.rb +11 -1
- data/app/components/polaris/resource_list_component.html.erb +11 -0
- data/app/components/polaris/resource_list_component.rb +21 -0
- data/app/components/polaris/skeleton_page_component.html.erb +23 -0
- data/app/components/polaris/skeleton_page_component.rb +22 -0
- data/app/helpers/polaris/url_helper.rb +37 -0
- data/app/helpers/polaris/view_helper.rb +2 -0
- data/lib/install/install.rb +57 -0
- data/lib/polaris/view_components/version.rb +1 -1
- data/lib/tasks/polaris_view_components_tasks.rake +6 -0
- metadata +10 -6
- data/lib/generators/polaris_view_components/USAGE +0 -5
- data/lib/generators/polaris_view_components/install_generator.rb +0 -35
- data/lib/generators/polaris_view_components/templates/README +0 -14
- data/lib/generators/polaris_view_components/templates/stimulus_index.js +0 -6
@@ -36,15 +36,16 @@ a.Polaris-Tag__Button {
|
|
36
36
|
font-size: 1.25rem;
|
37
37
|
}
|
38
38
|
|
39
|
-
/* Remove
|
40
|
-
.Polaris-Button
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
/* Remove focus styles for non-keyboard focus from buttons and links */
|
40
|
+
.Polaris-Button, .Polaris-Breadcrumbs__Breadcrumb {
|
41
|
+
&:focus:not(:focus-visible)::after {
|
42
|
+
box-shadow: none !important;
|
43
|
+
}
|
44
44
|
}
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
.Polaris-Tabs__Tab {
|
46
|
+
&:focus:not(:focus-visible) > .Polaris-Tabs__Title::after {
|
47
|
+
box-shadow: none !important;
|
48
|
+
}
|
48
49
|
}
|
49
50
|
|
50
51
|
/* ResourceItem */
|
@@ -176,3 +177,21 @@ a.Polaris-Tag__Button {
|
|
176
177
|
display: none;
|
177
178
|
}
|
178
179
|
}
|
180
|
+
|
181
|
+
/* EmptySearchResults */
|
182
|
+
.Polaris-EmptySearchResults {
|
183
|
+
padding: 84px 0;
|
184
|
+
|
185
|
+
&__Content {
|
186
|
+
display: flex;
|
187
|
+
flex-direction: column;
|
188
|
+
align-items: center;
|
189
|
+
text-align: center;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
/* ActionList */
|
194
|
+
|
195
|
+
.Polaris-ActionList__Item {
|
196
|
+
border: none !important;
|
197
|
+
}
|
@@ -2268,15 +2268,13 @@ a.Polaris-Tag__Button {
|
|
2268
2268
|
.Polaris-TextStyle--sizeSmall {
|
2269
2269
|
font-size: 1.25rem;
|
2270
2270
|
}
|
2271
|
-
/* Remove
|
2272
|
-
.Polaris-Button::after,
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2277
|
-
|
2278
|
-
box-shadow: none !important;
|
2279
|
-
}
|
2271
|
+
/* Remove focus styles for non-keyboard focus from buttons and links */
|
2272
|
+
.Polaris-Button:focus:not(:focus-visible)::after, .Polaris-Breadcrumbs__Breadcrumb:focus:not(:focus-visible)::after {
|
2273
|
+
box-shadow: none !important;
|
2274
|
+
}
|
2275
|
+
.Polaris-Tabs__Tab:focus:not(:focus-visible) > .Polaris-Tabs__Title::after {
|
2276
|
+
box-shadow: none !important;
|
2277
|
+
}
|
2280
2278
|
/* ResourceItem */
|
2281
2279
|
.Polaris-ResourceItem__Owned--offset {
|
2282
2280
|
padding-left: 2rem;
|
@@ -2373,3 +2371,17 @@ a.Polaris-Tag__Button {
|
|
2373
2371
|
display: none;
|
2374
2372
|
}
|
2375
2373
|
}
|
2374
|
+
/* EmptySearchResults */
|
2375
|
+
.Polaris-EmptySearchResults {
|
2376
|
+
padding: 84px 0;
|
2377
|
+
}
|
2378
|
+
.Polaris-EmptySearchResults__Content {
|
2379
|
+
display: flex;
|
2380
|
+
flex-direction: column;
|
2381
|
+
align-items: center;
|
2382
|
+
text-align: center;
|
2383
|
+
}
|
2384
|
+
/* ActionList */
|
2385
|
+
.Polaris-ActionList__Item {
|
2386
|
+
border: none !important;
|
2387
|
+
}
|
@@ -2,6 +2,9 @@
|
|
2
2
|
<%= render(Polaris::PopoverComponent.new(**popover_arguments)) do |popover| %>
|
3
3
|
<% popover.activator do %>
|
4
4
|
<%= text_field %>
|
5
|
+
<% if @name.present? %>
|
6
|
+
<%= hidden_field_tag @name, nil, data: {polaris_autocomplete_target: "hiddenInput"} %>
|
7
|
+
<% end %>
|
5
8
|
<% end %>
|
6
9
|
|
7
10
|
<% if empty_state.present? %>
|
@@ -24,11 +24,13 @@ module Polaris
|
|
24
24
|
def initialize(
|
25
25
|
multiple: false,
|
26
26
|
url: nil,
|
27
|
+
name: nil,
|
27
28
|
selected: [],
|
28
29
|
**system_arguments
|
29
30
|
)
|
30
31
|
@multiple = multiple
|
31
32
|
@url = url
|
33
|
+
@name = name
|
32
34
|
@selected = selected
|
33
35
|
@system_arguments = system_arguments
|
34
36
|
end
|
@@ -42,6 +44,7 @@ module Polaris
|
|
42
44
|
opts[:data][:polaris_autocomplete_url_value] = @url
|
43
45
|
end
|
44
46
|
opts[:data][:polaris_autocomplete_selected_value] = @selected
|
47
|
+
opts[:data][:polaris_autocomplete_multiple_value] = @multiple if @multiple.present?
|
45
48
|
end
|
46
49
|
end
|
47
50
|
|
@@ -2,7 +2,7 @@ class Polaris::DataTable::ColumnComponent < Polaris::Component
|
|
2
2
|
SORT_DEFAULT = false
|
3
3
|
SORT_OPTIONS = [false, :asc, :desc]
|
4
4
|
|
5
|
-
attr_reader :title, :numeric, :total, :sorted, :sort_url
|
5
|
+
attr_reader :title, :numeric, :total, :sorted, :sort_url, :system_arguments
|
6
6
|
|
7
7
|
def initialize(title, numeric: false, total: nil, sorted: SORT_DEFAULT, sort_url: nil, **system_arguments, &block)
|
8
8
|
@title = title
|
@@ -11,6 +11,7 @@ class Polaris::DataTable::ColumnComponent < Polaris::Component
|
|
11
11
|
@sorted = fetch_or_fallback(SORT_OPTIONS, sorted, SORT_DEFAULT)
|
12
12
|
@sort_url = sort_url
|
13
13
|
@block = block
|
14
|
+
@system_arguments = system_arguments
|
14
15
|
end
|
15
16
|
|
16
17
|
def call(row)
|
@@ -12,6 +12,7 @@
|
|
12
12
|
header: true,
|
13
13
|
sort_url: column.sort_url,
|
14
14
|
sorted: column.sorted,
|
15
|
+
**column.system_arguments
|
15
16
|
) do %>
|
16
17
|
<%= column.title %>
|
17
18
|
<% end %>
|
@@ -26,6 +27,7 @@
|
|
26
27
|
tag: (index.zero? ? "th" : "td"),
|
27
28
|
scope: ("row" if index.zero?),
|
28
29
|
total: true,
|
30
|
+
**column.system_arguments
|
29
31
|
) do %>
|
30
32
|
<%= column.total %>
|
31
33
|
<% end %>
|
@@ -35,18 +37,19 @@
|
|
35
37
|
</thead>
|
36
38
|
<tbody>
|
37
39
|
<% @data.each do |row| %>
|
38
|
-
|
40
|
+
<%= render Polaris::BaseComponent.new(**row_arguments(row)) do %>
|
39
41
|
<% columns.each_with_index do |column, index| %>
|
40
42
|
<%= render_cell(
|
41
43
|
first: index.zero?,
|
42
44
|
numeric: column.numeric,
|
43
45
|
tag: (index.zero? ? "th" : "td"),
|
44
46
|
scope: ("row" if index.zero?),
|
47
|
+
**column.system_arguments
|
45
48
|
) do %>
|
46
49
|
<%= column.call(row) %>
|
47
50
|
<% end %>
|
48
51
|
<% end %>
|
49
|
-
|
52
|
+
<% end %>
|
50
53
|
<% end %>
|
51
54
|
</tbody>
|
52
55
|
<% if @totals_in_footer %>
|
@@ -60,6 +63,7 @@
|
|
60
63
|
scope: ("row" if index.zero?),
|
61
64
|
total: true,
|
62
65
|
total_footer: true,
|
66
|
+
**column.system_arguments
|
63
67
|
) do %>
|
64
68
|
<%= column.total %>
|
65
69
|
<% end %>
|
@@ -35,6 +35,16 @@ module Polaris
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
def row_arguments(row)
|
39
|
+
{tag: "tr"}.tap do |args|
|
40
|
+
args[:classes] = class_names(
|
41
|
+
"Polaris-DataTable__TableRow",
|
42
|
+
"Polaris-DataTable--hoverable": @hoverable
|
43
|
+
)
|
44
|
+
args[:id] = dom_id(row) if row.respond_to?(:to_key)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
38
48
|
def render_cell(**arguments, &block)
|
39
49
|
render(DataTable::CellComponent.new(vertical_alignment: @vertical_alignment, **arguments), &block)
|
40
50
|
end
|
@@ -30,48 +30,54 @@
|
|
30
30
|
|
31
31
|
<div class="Polaris-DropZone__Container" data-polaris-dropzone-target="container">
|
32
32
|
<%= render Polaris::BaseComponent.new(**file_upload_arguments) do %>
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
<% if content.present? %>
|
34
|
+
<%= content %>
|
35
|
+
<% else %>
|
36
|
+
<%= render Polaris::StackComponent.new(vertical: true, spacing: :tight) do |stack| %>
|
37
|
+
<% unless @size == :medium %>
|
38
|
+
<% stack.item do %>
|
39
|
+
<img width="<%= @size == :small ? 20 : 40 %>" src="data:image/svg+xml,%3csvg fill='none' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M20 10a10 10 0 11-20 0 10 10 0 0120 0zM5.3 8.3l4-4a1 1 0 011.4 0l4 4a1 1 0 01-1.4 1.4L11 7.4V15a1 1 0 11-2 0V7.4L6.7 9.7a1 1 0 01-1.4-1.4z' fill='%235C5F62'/%3e%3c/svg%3e" alt="">
|
40
|
+
<% end %>
|
37
41
|
<% end %>
|
38
|
-
<% end %>
|
39
42
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
43
|
+
<% unless @size == :small %>
|
44
|
+
<% stack.item do %>
|
45
|
+
<% if @size == :medium %>
|
46
|
+
<div class="Polaris-DropZone-FileUpload__ActionTitle">
|
47
|
+
<%= @file_upload_button %>
|
48
|
+
</div>
|
49
|
+
<% else %>
|
50
|
+
<div class="Polaris-DropZone-FileUpload__Button">
|
51
|
+
<%= @file_upload_button %>
|
52
|
+
</div>
|
53
|
+
<% end %>
|
50
54
|
<% end %>
|
51
55
|
<% end %>
|
52
|
-
<% end %>
|
53
56
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
<% unless @size == :small %>
|
58
|
+
<% stack.item do %>
|
59
|
+
<% help_text = capture do %>
|
60
|
+
<%= render Polaris::TextStyleComponent.new(variation: :subdued) do %>
|
61
|
+
<%= @file_upload_help %>
|
62
|
+
<% end %>
|
59
63
|
<% end %>
|
60
|
-
<% end %>
|
61
64
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
65
|
+
<% if @size == :medium %>
|
66
|
+
<%= polaris_caption { help_text } %>
|
67
|
+
<% else %>
|
68
|
+
<%= help_text %>
|
69
|
+
<% end %>
|
66
70
|
<% end %>
|
67
71
|
<% end %>
|
68
72
|
<% end %>
|
69
73
|
<% end %>
|
70
74
|
<% end %>
|
71
75
|
|
72
|
-
|
73
|
-
|
74
|
-
|
76
|
+
<% if @preview %>
|
77
|
+
<div class="Polaris-DropZone__Loader Polaris--hidden" data-polaris-dropzone-target="loader">
|
78
|
+
<%= polaris_spinner(size: (@size == :small) ? :small : :large) %>
|
79
|
+
</div>
|
80
|
+
<% end %>
|
75
81
|
</div>
|
76
82
|
|
77
83
|
<%= render Polaris::VisuallyHiddenComponent.new do %>
|
@@ -85,12 +91,12 @@
|
|
85
91
|
<template data-polaris-dropzone-target="previewTemplate">
|
86
92
|
<%= tag.div(
|
87
93
|
data: { polaris_dropzone_target: "preview" },
|
88
|
-
class:
|
89
|
-
"Polaris-DropZone__Preview",
|
94
|
+
class: {
|
95
|
+
"Polaris-DropZone__Preview": true,
|
90
96
|
"Polaris-DropZone__Preview--singleFile": !@multiple,
|
91
97
|
"Polaris-DropZone__Preview--sizeMedium": @size == :medium,
|
92
98
|
"Polaris-DropZone__Preview--sizeSmall": @size == :small,
|
93
|
-
|
99
|
+
}
|
94
100
|
) do %>
|
95
101
|
<% if @size.in?(%i[small]) %>
|
96
102
|
<span class="target"></span>
|
@@ -37,6 +37,7 @@ module Polaris
|
|
37
37
|
label_action: nil,
|
38
38
|
disabled: false,
|
39
39
|
error: false,
|
40
|
+
remove_previews_after_upload: true,
|
40
41
|
file_upload_button: nil,
|
41
42
|
file_upload_help: "or drop files to upload",
|
42
43
|
file_upload_arguments: {},
|
@@ -62,6 +63,7 @@ module Polaris
|
|
62
63
|
@label_action = label_action
|
63
64
|
@disabled = disabled
|
64
65
|
@error = error
|
66
|
+
@remove_previews_after_upload = remove_previews_after_upload
|
65
67
|
@file_upload_button = file_upload_button
|
66
68
|
@file_upload_button ||= "Add #{multiple ? "files" : "file"}"
|
67
69
|
@file_upload_help = file_upload_help
|
@@ -82,7 +84,8 @@ module Polaris
|
|
82
84
|
polaris_dropzone_focused_value: "false",
|
83
85
|
polaris_dropzone_drop_on_page_value: @drop_on_page,
|
84
86
|
polaris_dropzone_render_preview_value: @preview,
|
85
|
-
polaris_dropzone_size_value: @size
|
87
|
+
polaris_dropzone_size_value: @size,
|
88
|
+
polaris_dropzone_remove_previews_after_upload_value: @remove_previews_after_upload
|
86
89
|
}
|
87
90
|
}.deep_merge(@system_arguments).tap do |opts|
|
88
91
|
prepend_option(opts[:data], :controller, "polaris-dropzone")
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= render Polaris::BaseComponent.new(**system_arguments) do %>
|
2
|
+
<div class="Polaris-EmptySearchResults__Content">
|
3
|
+
<%= polaris_text_container do %>
|
4
|
+
<% if image.present? %>
|
5
|
+
<div><%= image %></div>
|
6
|
+
<% end %>
|
7
|
+
<%= polaris_display_text(size: :small) do %>
|
8
|
+
<%= @title %>
|
9
|
+
<% end %>
|
10
|
+
<% if @description.present? %>
|
11
|
+
<div><%= polaris_text_subdued { @description } %></div>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Polaris
|
2
|
+
class EmptySearchResultsComponent < Polaris::Component
|
3
|
+
renders_one :image
|
4
|
+
|
5
|
+
def initialize(title:, description: nil, **system_arguments)
|
6
|
+
@title = title
|
7
|
+
@description = description
|
8
|
+
@system_arguments = system_arguments
|
9
|
+
end
|
10
|
+
|
11
|
+
def system_arguments
|
12
|
+
@system_arguments.tap do |args|
|
13
|
+
args[:tag] = "div"
|
14
|
+
args[:classes] = class_names(
|
15
|
+
args[:classes],
|
16
|
+
"Polaris-EmptySearchResults"
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -20,7 +20,7 @@ module Polaris
|
|
20
20
|
TEXT_ALIGN_OPTIONS = TEXT_ALIGN_MAPPINGS.keys
|
21
21
|
|
22
22
|
DISCLOSURE_DEFAULT = false
|
23
|
-
DISCLOSURE_OPTIONS = [true, false, :down, :up, :select]
|
23
|
+
DISCLOSURE_OPTIONS = [true, false, :down, :up, :select, :horizontal_dots]
|
24
24
|
|
25
25
|
renders_one :icon, IconComponent
|
26
26
|
|
@@ -1,10 +1,11 @@
|
|
1
1
|
class Polaris::IndexTable::ColumnComponent < Polaris::Component
|
2
|
-
attr_reader :title, :flush
|
2
|
+
attr_reader :title, :flush, :system_arguments
|
3
3
|
|
4
4
|
def initialize(title, flush: false, **system_arguments, &block)
|
5
5
|
@title = title
|
6
6
|
@flush = flush
|
7
7
|
@block = block
|
8
|
+
@system_arguments = system_arguments
|
8
9
|
end
|
9
10
|
|
10
11
|
def call(row)
|
@@ -12,15 +12,13 @@
|
|
12
12
|
</thead>
|
13
13
|
<tbody>
|
14
14
|
<% @data.each do |row| %>
|
15
|
-
|
15
|
+
<%= render Polaris::BaseComponent.new(**row_arguments(row)) do %>
|
16
16
|
<% columns.each_with_index do |column, index| %>
|
17
|
-
<%= render_cell(
|
18
|
-
flush: column.flush,
|
19
|
-
) do %>
|
17
|
+
<%= render_cell(flush: column.flush, **column.system_arguments) do %>
|
20
18
|
<%= column.call(row) %>
|
21
19
|
<% end %>
|
22
20
|
<% end %>
|
23
|
-
|
21
|
+
<% end %>
|
24
22
|
<% end %>
|
25
23
|
</tbody>
|
26
24
|
</table>
|
@@ -18,6 +18,16 @@ module Polaris
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
def row_arguments(row)
|
22
|
+
{tag: "tr"}.tap do |args|
|
23
|
+
args[:classes] = class_names(
|
24
|
+
"Polaris-IndexTable__TableRow",
|
25
|
+
"Polaris-IndexTable__TableRow--unclickable"
|
26
|
+
)
|
27
|
+
args[:id] = dom_id(row) if row.respond_to?(:to_key)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
21
31
|
def render_cell(**arguments, &block)
|
22
32
|
render(IndexTable::CellComponent.new(**arguments), &block)
|
23
33
|
end
|
@@ -46,13 +46,13 @@
|
|
46
46
|
<% end %>
|
47
47
|
</div>
|
48
48
|
|
49
|
-
<% if @secondary_actions.any? || action_group.present? ||
|
49
|
+
<% if @secondary_actions.any? || action_group.present? || render_primary_action? || has_pagination? %>
|
50
50
|
<div class="Polaris-Page-Header__RightAlign">
|
51
51
|
<div class="Polaris-Page-Header__Actions">
|
52
52
|
<% if @secondary_actions.any? || action_group.present? %>
|
53
53
|
<div class="Polaris-ActionMenu Polaris-ActionMenu--mobile">
|
54
54
|
<div class="Polaris-ActionMenu-RollupActions__RollupActivator">
|
55
|
-
<%= polaris_popover do |popover| %>
|
55
|
+
<%= polaris_popover(position: :below, alignment: :right) do |popover| %>
|
56
56
|
<% popover.button do |button| %>
|
57
57
|
<% button.icon(name: "HorizontalDotsMinor") %>
|
58
58
|
<% end %>
|
@@ -98,9 +98,9 @@
|
|
98
98
|
</div>
|
99
99
|
</div>
|
100
100
|
<% end %>
|
101
|
-
<% if
|
101
|
+
<% if render_primary_action? %>
|
102
102
|
<div class="Polaris-Page-Header__PrimaryActionWrapper">
|
103
|
-
<%= primary_action %>
|
103
|
+
<%= primary_action || custom_primary_action %>
|
104
104
|
</div>
|
105
105
|
<% end %>
|
106
106
|
<% if has_pagination? %>
|
@@ -7,6 +7,7 @@ module Polaris
|
|
7
7
|
renders_one :primary_action, ->(primary: true, **system_arguments) do
|
8
8
|
Polaris::ButtonComponent.new(primary: primary, **system_arguments)
|
9
9
|
end
|
10
|
+
renders_one :custom_primary_action
|
10
11
|
renders_one :action_group, "ActionGroupComponent"
|
11
12
|
|
12
13
|
def initialize(
|
@@ -81,7 +82,11 @@ module Polaris
|
|
81
82
|
end
|
82
83
|
|
83
84
|
def render_header?
|
84
|
-
@title.present? || @subtitle.present? || @back_url.present? ||
|
85
|
+
@title.present? || @subtitle.present? || @back_url.present? || render_primary_action?
|
86
|
+
end
|
87
|
+
|
88
|
+
def render_primary_action?
|
89
|
+
primary_action.present? || custom_primary_action.present?
|
85
90
|
end
|
86
91
|
|
87
92
|
def has_pagination?
|
@@ -98,7 +103,7 @@ module Polaris
|
|
98
103
|
end
|
99
104
|
|
100
105
|
def call
|
101
|
-
render(Polaris::PopoverComponent.new) do |popover|
|
106
|
+
render(Polaris::PopoverComponent.new(position: :below)) do |popover|
|
102
107
|
popover.button(disclosure: true) { @title }
|
103
108
|
|
104
109
|
polaris_action_list do |list|
|
@@ -7,25 +7,35 @@
|
|
7
7
|
<% end %>
|
8
8
|
</div>
|
9
9
|
|
10
|
-
|
11
|
-
<%= render Polaris::BaseComponent.new(**
|
12
|
-
|
13
|
-
|
14
|
-
<div
|
15
|
-
|
16
|
-
|
17
|
-
<% panes.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
<%=
|
10
|
+
<% popover = capture do %>
|
11
|
+
<%= render Polaris::BaseComponent.new(**system_arguments) do %>
|
12
|
+
<%= render Polaris::BaseComponent.new(**popover_arguments) do %>
|
13
|
+
<div class="Polaris-Popover__FocusTracker" tabindex="0"></div>
|
14
|
+
<div style="">
|
15
|
+
<div class="Polaris-Popover__Wrapper">
|
16
|
+
<%= render Polaris::BaseComponent.new(**content_arguments) do %>
|
17
|
+
<% if panes.present? %>
|
18
|
+
<% panes.each do |pane| %>
|
19
|
+
<%= pane %>
|
20
|
+
<% end %>
|
21
|
+
<% else %>
|
22
|
+
<%= render Polaris::Popover::PaneComponent.new(sectioned: @sectioned) do %>
|
23
|
+
<%= content %>
|
24
|
+
<% end %>
|
23
25
|
<% end %>
|
24
26
|
<% end %>
|
25
|
-
|
27
|
+
</div>
|
26
28
|
</div>
|
27
|
-
|
28
|
-
|
29
|
+
<div class="Polaris-Popover__FocusTracker" tabindex="0"></div>
|
30
|
+
<% end %>
|
29
31
|
<% end %>
|
30
32
|
<% end %>
|
33
|
+
|
34
|
+
<% if @append_to_body %>
|
35
|
+
<template data-polaris-popover-target="template">
|
36
|
+
<%= popover %>
|
37
|
+
</template>
|
38
|
+
<% else %>
|
39
|
+
<%= popover %>
|
40
|
+
<% end %>
|
31
41
|
<% end %>
|
@@ -24,6 +24,7 @@ module Polaris
|
|
24
24
|
sectioned: false,
|
25
25
|
alignment: ALIGNMENT_DEFAULT,
|
26
26
|
position: POSITION_DEFAULT,
|
27
|
+
append_to_body: false,
|
27
28
|
wrapper_arguments: {},
|
28
29
|
**system_arguments
|
29
30
|
)
|
@@ -36,6 +37,7 @@ module Polaris
|
|
36
37
|
@sectioned = sectioned
|
37
38
|
@alignment = fetch_or_fallback(ALIGNMENT_OPTIONS, alignment, ALIGNMENT_DEFAULT)
|
38
39
|
@position = fetch_or_fallback(POSITION_OPTIONS, position, POSITION_DEFAULT)
|
40
|
+
@append_to_body = append_to_body
|
39
41
|
@wrapper_arguments = wrapper_arguments
|
40
42
|
@system_arguments = system_arguments
|
41
43
|
@popover_arguments = {}
|
@@ -47,6 +49,7 @@ module Polaris
|
|
47
49
|
opts[:tag] = "div"
|
48
50
|
opts[:data] ||= {}
|
49
51
|
prepend_option(opts[:data], :controller, "polaris-popover")
|
52
|
+
opts[:data][:polaris_popover_append_to_body_value] = @append_to_body
|
50
53
|
opts[:data][:polaris_popover_active_value] = @active
|
51
54
|
opts[:data][:polaris_popover_placement_value] = popperjs_placement
|
52
55
|
opts[:data][:polaris_popover_open_class] = "Polaris-Popover__PopoverOverlay--open"
|
@@ -61,7 +64,9 @@ module Polaris
|
|
61
64
|
@system_arguments.tap do |opts|
|
62
65
|
opts[:tag] = "div"
|
63
66
|
opts[:data] ||= {}
|
64
|
-
|
67
|
+
unless @append_to_body
|
68
|
+
opts[:data]["polaris_popover_target"] = "popover"
|
69
|
+
end
|
65
70
|
opts[:classes] = class_names(
|
66
71
|
@system_arguments[:classes],
|
67
72
|
"Polaris-PositionedOverlay",
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= render(Polaris::BaseComponent.new(**wrapper_arguments)) do %>
|
2
|
+
<%= render(Polaris::ButtonGroupComponent.new(**system_arguments)) do |group| %>
|
3
|
+
<% buttons.each do |button| %>
|
4
|
+
<% group.button(**button.system_arguments) { button.content } %>
|
5
|
+
<% end %>
|
6
|
+
<% end %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<% if @persist_actions %>
|
10
|
+
<%= render(Polaris::BaseComponent.new(**disclosure_arguments)) do %>
|
11
|
+
<%= render(Polaris::PopoverComponent.new(**popover_arguments)) do |popover| %>
|
12
|
+
<% popover.button(disclosure: :horizontal_dots, plain: true) %>
|
13
|
+
|
14
|
+
<%= render(Polaris::ActionListComponent.new) do |action_list| %>
|
15
|
+
<% buttons.each do |button| %>
|
16
|
+
<% action_list.item(**button.action_list_item_arguments) { button.content } %>
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
21
|
+
<% end %>
|