openproject-primer_view_components 0.90.1 → 0.91.1
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/CHANGELOG.md +12 -0
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/components/primer/alpha/action_menu/action_menu_element.js +1 -0
- data/app/components/primer/alpha/action_menu/action_menu_element.ts +1 -0
- data/app/components/primer/alpha/tree_view/sub_tree_node.rb +2 -2
- data/app/controllers/primer/view_components/action_menu_controller.rb +1 -0
- data/app/controllers/primer/view_components/tree_view_items_controller.rb +2 -1
- data/app/views/primer/view_components/tree_view_items/async_alpha.html_fragment.erb +4 -4
- data/lib/primer/view_components/version.rb +1 -1
- data/previews/primer/alpha/action_menu_preview/with_deferred_content_near_bottom_of_viewport.html.erb +10 -0
- data/previews/primer/alpha/action_menu_preview.rb +7 -0
- data/previews/primer/alpha/tree_view_preview/async_alpha.html.erb +2 -2
- data/previews/primer/alpha/tree_view_preview/async_form_input.html.erb +16 -0
- data/previews/primer/alpha/tree_view_preview.rb +13 -2
- data/static/info_arch.json +26 -0
- data/static/previews.json +26 -0
- metadata +3 -1
|
@@ -480,6 +480,7 @@ _ActionMenuElement_handleItemActivated = function _ActionMenuElement_handleItemA
|
|
|
480
480
|
_ActionMenuElement_handleIncludeFragmentReplaced = function _ActionMenuElement_handleIncludeFragmentReplaced() {
|
|
481
481
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "a", _ActionMenuElement_firstItem_get)?.focus();
|
|
482
482
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_softDisableItems).call(this);
|
|
483
|
+
this.overlay?.update();
|
|
483
484
|
// async items have loaded, so component is ready
|
|
484
485
|
this.setAttribute('data-ready', 'true');
|
|
485
486
|
};
|
|
@@ -472,6 +472,7 @@ export class ActionMenuElement extends HTMLElement {
|
|
|
472
472
|
#handleIncludeFragmentReplaced() {
|
|
473
473
|
this.#firstItem?.focus()
|
|
474
474
|
this.#softDisableItems()
|
|
475
|
+
this.overlay?.update()
|
|
475
476
|
|
|
476
477
|
// async items have loaded, so component is ready
|
|
477
478
|
this.setAttribute('data-ready', 'true')
|
|
@@ -185,8 +185,8 @@ module Primer
|
|
|
185
185
|
def render_in(*args, **_kwargs, &block)
|
|
186
186
|
super.tap do
|
|
187
187
|
# check this _after_ rendering so @sub_tree's slots are defined
|
|
188
|
-
if @node.select_variant
|
|
189
|
-
raise ArgumentError, "TreeView does not currently support select
|
|
188
|
+
if @node.select_variant == :multiple && @sub_tree.defer? && @select_strategy != :self
|
|
189
|
+
raise ArgumentError, "TreeView does not currently support the multiple select variant with #{@select_strategy.inspect} select strategy for sub-trees loaded asynchronously."
|
|
190
190
|
end
|
|
191
191
|
end
|
|
192
192
|
end
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
<%= render(Primer::Alpha::TreeView::SubTree.new(path: ["primer"], node_variant: :div)) do |tree| %>
|
|
2
|
-
<% tree.with_sub_tree(label: "alpha") do |sub_tree| %>
|
|
2
|
+
<% tree.with_sub_tree(label: "alpha", select_variant: select_variant, select_strategy: :self) do |sub_tree| %>
|
|
3
3
|
<% sub_tree.with_leading_visual_icons do |icons| %>
|
|
4
4
|
<% icons.with_expanded_icon(icon: :"file-directory-open-fill", color: :accent) %>
|
|
5
5
|
<% icons.with_collapsed_icon(icon: :"file-directory-fill", color: :accent) %>
|
|
6
6
|
<% end %>
|
|
7
7
|
|
|
8
|
-
<% sub_tree.with_sub_tree(label: "action_menu", expanded: action_menu_expanded) do |sub_tree| %>
|
|
8
|
+
<% sub_tree.with_sub_tree(label: "action_menu", expanded: action_menu_expanded, select_variant: select_variant, select_strategy: :self) do |sub_tree| %>
|
|
9
9
|
<% sub_tree.with_leading_visual_icons do |icons| %>
|
|
10
10
|
<% icons.with_expanded_icon(icon: :"file-directory-open-fill", color: :accent) %>
|
|
11
11
|
<% icons.with_collapsed_icon(icon: :"file-directory-fill", color: :accent) %>
|
|
12
12
|
<% end %>
|
|
13
13
|
|
|
14
|
-
<% sub_tree.with_leaf(label: "group.rb") do |item| %>
|
|
14
|
+
<% sub_tree.with_leaf(label: "group.rb", select_variant: select_variant) do |item| %>
|
|
15
15
|
<% item.with_leading_visual_icon(icon: :file) %>
|
|
16
16
|
<% end %>
|
|
17
17
|
|
|
18
|
-
<% sub_tree.with_leaf(label: "heading.rb") do |item| %>
|
|
18
|
+
<% sub_tree.with_leaf(label: "heading.rb", select_variant: select_variant) do |item| %>
|
|
19
19
|
<% item.with_leading_visual_icon(icon: :file) %>
|
|
20
20
|
<% end %>
|
|
21
21
|
<% end %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<%# The invoker is pinned near the bottom of the viewport, leaving enough room for the loading %>
|
|
2
|
+
<%# spinner placeholder to fit below it but not enough for the full deferred content, reproducing %>
|
|
3
|
+
<%# the scenario from DREAM-729. The `delay` param forces the fragment response to arrive after the %>
|
|
4
|
+
<%# overlay has already been positioned using the placeholder's size, instead of racing the fetch %>
|
|
5
|
+
<%# against the initial position calculation. %>
|
|
6
|
+
<div style="position: fixed; bottom: 100px; right: 0;">
|
|
7
|
+
<%= render(Primer::Alpha::ActionMenu.new(menu_id: "deferred-bottom", src: primer_view_components.action_menu_deferred_path(delay: 0.3))) do |menu| %>
|
|
8
|
+
<% menu.with_show_button { "Menu with deferred content" } %>
|
|
9
|
+
<% end %>
|
|
10
|
+
</div>
|
|
@@ -310,6 +310,13 @@ module Primer
|
|
|
310
310
|
render_with_template(locals: { nest_in_sub_menu: nest_in_sub_menu })
|
|
311
311
|
end
|
|
312
312
|
|
|
313
|
+
# @label With deferred content near the bottom of the viewport
|
|
314
|
+
#
|
|
315
|
+
# @hidden
|
|
316
|
+
def with_deferred_content_near_bottom_of_viewport
|
|
317
|
+
render_with_template
|
|
318
|
+
end
|
|
319
|
+
|
|
313
320
|
# @label With deferred preloaded content
|
|
314
321
|
#
|
|
315
322
|
def with_deferred_preloaded_content
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<div style="max-width: 400px">
|
|
2
2
|
<%= render(Primer::Alpha::TreeView.new) do |tree_view| %>
|
|
3
|
-
<% tree_view.with_sub_tree(label: "primer") do |sub_tree| %>
|
|
3
|
+
<% tree_view.with_sub_tree(label: "primer", select_variant: select_variant, select_strategy: :self) do |sub_tree| %>
|
|
4
4
|
<% sub_tree.with_leading_visual_icons do |icons| %>
|
|
5
5
|
<% icons.with_expanded_icon(icon: :"file-directory-open-fill", color: :accent) %>
|
|
6
6
|
<% icons.with_collapsed_icon(icon: :"file-directory-fill", color: :accent) %>
|
|
7
7
|
<% end %>
|
|
8
8
|
|
|
9
|
-
<% sub_tree.with_loading_skeleton(src: primer_view_components.tree_view_items_async_alpha_path(action_menu_expanded: action_menu_expanded)) %>
|
|
9
|
+
<% sub_tree.with_loading_skeleton(src: primer_view_components.tree_view_items_async_alpha_path(action_menu_expanded: action_menu_expanded, select_variant: select_variant)) %>
|
|
10
10
|
<% end %>
|
|
11
11
|
<% end %>
|
|
12
12
|
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<%= form_with(url: primer_view_components.generic_form_submission_path(format: :json)) do |f| %>
|
|
2
|
+
<%= render(Primer::Alpha::Stack.new) do %>
|
|
3
|
+
<%= render(Primer::Alpha::TreeView.new(form_arguments: { builder: f, name: "folder_structure" })) do |tree| %>
|
|
4
|
+
<% tree.with_sub_tree(label: "primer", select_variant: select_variant, select_strategy: :self) do |sub_tree| %>
|
|
5
|
+
<% sub_tree.with_leading_visual_icons do |icons| %>
|
|
6
|
+
<% icons.with_expanded_icon(icon: :"file-directory-open-fill", color: :accent) %>
|
|
7
|
+
<% icons.with_collapsed_icon(icon: :"file-directory-fill", color: :accent) %>
|
|
8
|
+
<% end %>
|
|
9
|
+
|
|
10
|
+
<% sub_tree.with_loading_skeleton(src: primer_view_components.tree_view_items_async_alpha_path(select_variant: select_variant)) %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
14
|
+
<%= render(Primer::Alpha::SubmitButton.new(name: :submit, label: "Submit")) %>
|
|
15
|
+
<% end %>
|
|
16
|
+
<% end %>
|
|
@@ -114,9 +114,11 @@ module Primer
|
|
|
114
114
|
# @label Async alpha
|
|
115
115
|
#
|
|
116
116
|
# @param action_menu_expanded [Boolean] toggle
|
|
117
|
-
|
|
117
|
+
# @param select_variant [Symbol] select [none, single, multiple]
|
|
118
|
+
def async_alpha(action_menu_expanded: false, select_variant: :none)
|
|
118
119
|
render_with_template(locals: {
|
|
119
|
-
action_menu_expanded: coerce_bool(action_menu_expanded)
|
|
120
|
+
action_menu_expanded: coerce_bool(action_menu_expanded),
|
|
121
|
+
select_variant: select_variant.to_sym
|
|
120
122
|
})
|
|
121
123
|
end
|
|
122
124
|
|
|
@@ -197,6 +199,15 @@ module Primer
|
|
|
197
199
|
})
|
|
198
200
|
end
|
|
199
201
|
|
|
202
|
+
# @label Async form input
|
|
203
|
+
# @hidden
|
|
204
|
+
# @param select_variant [Symbol] select [single, multiple]
|
|
205
|
+
def async_form_input(select_variant: :single)
|
|
206
|
+
render_with_template(locals: {
|
|
207
|
+
select_variant: select_variant.to_sym
|
|
208
|
+
})
|
|
209
|
+
end
|
|
210
|
+
|
|
200
211
|
# @label Doubled paths
|
|
201
212
|
# @hidden
|
|
202
213
|
def doubled_path
|
data/static/info_arch.json
CHANGED
|
@@ -1438,6 +1438,19 @@
|
|
|
1438
1438
|
]
|
|
1439
1439
|
}
|
|
1440
1440
|
},
|
|
1441
|
+
{
|
|
1442
|
+
"preview_path": "primer/alpha/action_menu/with_deferred_content_near_bottom_of_viewport",
|
|
1443
|
+
"name": "with_deferred_content_near_bottom_of_viewport",
|
|
1444
|
+
"snapshot": "false",
|
|
1445
|
+
"skip_rules": {
|
|
1446
|
+
"wont_fix": [
|
|
1447
|
+
"region"
|
|
1448
|
+
],
|
|
1449
|
+
"will_fix": [
|
|
1450
|
+
"color-contrast"
|
|
1451
|
+
]
|
|
1452
|
+
}
|
|
1453
|
+
},
|
|
1441
1454
|
{
|
|
1442
1455
|
"preview_path": "primer/alpha/action_menu/with_deferred_preloaded_content",
|
|
1443
1456
|
"name": "with_deferred_preloaded_content",
|
|
@@ -10870,6 +10883,19 @@
|
|
|
10870
10883
|
]
|
|
10871
10884
|
}
|
|
10872
10885
|
},
|
|
10886
|
+
{
|
|
10887
|
+
"preview_path": "primer/alpha/tree_view/async_form_input",
|
|
10888
|
+
"name": "async_form_input",
|
|
10889
|
+
"snapshot": "false",
|
|
10890
|
+
"skip_rules": {
|
|
10891
|
+
"wont_fix": [
|
|
10892
|
+
"region"
|
|
10893
|
+
],
|
|
10894
|
+
"will_fix": [
|
|
10895
|
+
"color-contrast"
|
|
10896
|
+
]
|
|
10897
|
+
}
|
|
10898
|
+
},
|
|
10873
10899
|
{
|
|
10874
10900
|
"preview_path": "primer/alpha/tree_view/doubled_path",
|
|
10875
10901
|
"name": "doubled_path",
|
data/static/previews.json
CHANGED
|
@@ -632,6 +632,19 @@
|
|
|
632
632
|
]
|
|
633
633
|
}
|
|
634
634
|
},
|
|
635
|
+
{
|
|
636
|
+
"preview_path": "primer/alpha/action_menu/with_deferred_content_near_bottom_of_viewport",
|
|
637
|
+
"name": "with_deferred_content_near_bottom_of_viewport",
|
|
638
|
+
"snapshot": "false",
|
|
639
|
+
"skip_rules": {
|
|
640
|
+
"wont_fix": [
|
|
641
|
+
"region"
|
|
642
|
+
],
|
|
643
|
+
"will_fix": [
|
|
644
|
+
"color-contrast"
|
|
645
|
+
]
|
|
646
|
+
}
|
|
647
|
+
},
|
|
635
648
|
{
|
|
636
649
|
"preview_path": "primer/alpha/action_menu/with_deferred_preloaded_content",
|
|
637
650
|
"name": "with_deferred_preloaded_content",
|
|
@@ -4932,6 +4945,19 @@
|
|
|
4932
4945
|
]
|
|
4933
4946
|
}
|
|
4934
4947
|
},
|
|
4948
|
+
{
|
|
4949
|
+
"preview_path": "primer/alpha/tree_view/async_form_input",
|
|
4950
|
+
"name": "async_form_input",
|
|
4951
|
+
"snapshot": "false",
|
|
4952
|
+
"skip_rules": {
|
|
4953
|
+
"wont_fix": [
|
|
4954
|
+
"region"
|
|
4955
|
+
],
|
|
4956
|
+
"will_fix": [
|
|
4957
|
+
"color-contrast"
|
|
4958
|
+
]
|
|
4959
|
+
}
|
|
4960
|
+
},
|
|
4935
4961
|
{
|
|
4936
4962
|
"preview_path": "primer/alpha/tree_view/doubled_path",
|
|
4937
4963
|
"name": "doubled_path",
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: openproject-primer_view_components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.91.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GitHub Open Source
|
|
@@ -985,6 +985,7 @@ files:
|
|
|
985
985
|
- previews/primer/alpha/action_menu_preview/two_menus.html.erb
|
|
986
986
|
- previews/primer/alpha/action_menu_preview/with_actions.html.erb
|
|
987
987
|
- previews/primer/alpha/action_menu_preview/with_deferred_content.html.erb
|
|
988
|
+
- previews/primer/alpha/action_menu_preview/with_deferred_content_near_bottom_of_viewport.html.erb
|
|
988
989
|
- previews/primer/alpha/auto_complete_preview.rb
|
|
989
990
|
- previews/primer/alpha/banner_preview.rb
|
|
990
991
|
- previews/primer/alpha/banner_preview/with_action_button.html.erb
|
|
@@ -1097,6 +1098,7 @@ files:
|
|
|
1097
1098
|
- previews/primer/alpha/tooltip_preview/with_right_most_position.html.erb
|
|
1098
1099
|
- previews/primer/alpha/tree_view_preview.rb
|
|
1099
1100
|
- previews/primer/alpha/tree_view_preview/async_alpha.html.erb
|
|
1101
|
+
- previews/primer/alpha/tree_view_preview/async_form_input.html.erb
|
|
1100
1102
|
- previews/primer/alpha/tree_view_preview/buttons.html.erb
|
|
1101
1103
|
- previews/primer/alpha/tree_view_preview/default.html.erb
|
|
1102
1104
|
- previews/primer/alpha/tree_view_preview/doubled_path.html.erb
|