openproject-primer_view_components 0.55.0 → 0.56.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/dialog_helper.js +3 -0
- data/app/components/primer/dialog_helper.ts +3 -0
- data/app/components/primer/open_project/side_panel/section.rb +12 -1
- data/lib/primer/view_components/version.rb +2 -2
- data/previews/primer/open_project/side_panel_preview/with_action_menu.html.erb +37 -0
- data/previews/primer/open_project/side_panel_preview.rb +4 -0
- data/static/info_arch.json +13 -0
- data/static/previews.json +13 -0
- metadata +3 -2
@@ -102,6 +102,9 @@ export class DialogHelperElement extends HTMLElement {
|
|
102
102
|
// The click target _must_ be the dialog element itself, and not elements underneath or inside.
|
103
103
|
if (target !== dialog || !dialog?.open)
|
104
104
|
return;
|
105
|
+
// If the dialog contains a form, do not close the dialog when clicking outside of the dialog
|
106
|
+
if (dialog.querySelector('form'))
|
107
|
+
return;
|
105
108
|
const rect = dialog.getBoundingClientRect();
|
106
109
|
const clickWasInsideDialog = rect.top <= event.clientY &&
|
107
110
|
event.clientY <= rect.top + rect.height &&
|
@@ -111,6 +111,9 @@ export class DialogHelperElement extends HTMLElement {
|
|
111
111
|
// The click target _must_ be the dialog element itself, and not elements underneath or inside.
|
112
112
|
if (target !== dialog || !dialog?.open) return
|
113
113
|
|
114
|
+
// If the dialog contains a form, do not close the dialog when clicking outside of the dialog
|
115
|
+
if (dialog.querySelector('form')) return
|
116
|
+
|
114
117
|
const rect = dialog.getBoundingClientRect()
|
115
118
|
const clickWasInsideDialog =
|
116
119
|
rect.top <= event.clientY &&
|
@@ -21,7 +21,18 @@ module Primer
|
|
21
21
|
icon: lambda { |**system_arguments, &block|
|
22
22
|
system_arguments[:scheme] ||= :invisible
|
23
23
|
Primer::Beta::IconButton.new(**system_arguments, &block)
|
24
|
-
}
|
24
|
+
},
|
25
|
+
menu: lambda { |**system_arguments, &block|
|
26
|
+
deny_tag_argument(**system_arguments)
|
27
|
+
|
28
|
+
button_arguments = system_arguments.delete(:button_arguments) || {}
|
29
|
+
button_arguments[:scheme] ||= :invisible
|
30
|
+
raise ArgumentError.new("button_arguments must contain an icon:") if button_arguments[:icon].blank?
|
31
|
+
|
32
|
+
Primer::Alpha::ActionMenu.new(**system_arguments).tap do |menu|
|
33
|
+
menu.with_show_button(**button_arguments)
|
34
|
+
end
|
35
|
+
},
|
25
36
|
}
|
26
37
|
|
27
38
|
renders_one :description, lambda { |**system_arguments, &block|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<%=
|
2
|
+
clazz = Class.new(ViewComponent::Base) do
|
3
|
+
def self.name
|
4
|
+
"CustomComponent"
|
5
|
+
end
|
6
|
+
|
7
|
+
def call
|
8
|
+
render(Primer::OpenProject::SidePanel::Section.new) do |section|
|
9
|
+
section.with_title { "My custom component" }
|
10
|
+
section.with_action_menu(
|
11
|
+
anchor_align: :end,
|
12
|
+
button_arguments: { icon: :gear, 'aria-label': 'Edit' }
|
13
|
+
) do |menu|
|
14
|
+
menu.with_item(label: "Subitem 1") do |item|
|
15
|
+
item.with_leading_visual_icon(icon: :paste)
|
16
|
+
end
|
17
|
+
menu.with_item(label: "Subitem 2") do |item|
|
18
|
+
item.with_leading_visual_icon(icon: :log)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
"Section content"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
render(Primer::Alpha::Layout.new) do |component|
|
28
|
+
component.with_main do
|
29
|
+
"Main content"
|
30
|
+
end
|
31
|
+
component.with_sidebar(row_placement: :start, col_placement: :end) do
|
32
|
+
render(Primer::OpenProject::SidePanel.new) do |panel|
|
33
|
+
panel.with_section(clazz.new)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
%>
|
data/static/info_arch.json
CHANGED
@@ -19175,6 +19175,19 @@
|
|
19175
19175
|
"color-contrast"
|
19176
19176
|
]
|
19177
19177
|
}
|
19178
|
+
},
|
19179
|
+
{
|
19180
|
+
"preview_path": "primer/open_project/side_panel/with_action_menu",
|
19181
|
+
"name": "with_action_menu",
|
19182
|
+
"snapshot": "false",
|
19183
|
+
"skip_rules": {
|
19184
|
+
"wont_fix": [
|
19185
|
+
"region"
|
19186
|
+
],
|
19187
|
+
"will_fix": [
|
19188
|
+
"color-contrast"
|
19189
|
+
]
|
19190
|
+
}
|
19178
19191
|
}
|
19179
19192
|
],
|
19180
19193
|
"subcomponents": [
|
data/static/previews.json
CHANGED
@@ -7007,6 +7007,19 @@
|
|
7007
7007
|
"color-contrast"
|
7008
7008
|
]
|
7009
7009
|
}
|
7010
|
+
},
|
7011
|
+
{
|
7012
|
+
"preview_path": "primer/open_project/side_panel/with_action_menu",
|
7013
|
+
"name": "with_action_menu",
|
7014
|
+
"snapshot": "false",
|
7015
|
+
"skip_rules": {
|
7016
|
+
"wont_fix": [
|
7017
|
+
"region"
|
7018
|
+
],
|
7019
|
+
"will_fix": [
|
7020
|
+
"color-contrast"
|
7021
|
+
]
|
7022
|
+
}
|
7010
7023
|
}
|
7011
7024
|
]
|
7012
7025
|
},
|
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.56.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-
|
12
|
+
date: 2025-03-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionview
|
@@ -1055,6 +1055,7 @@ files:
|
|
1055
1055
|
- previews/primer/open_project/side_panel_preview.rb
|
1056
1056
|
- previews/primer/open_project/side_panel_preview/default.html.erb
|
1057
1057
|
- previews/primer/open_project/side_panel_preview/playground.html.erb
|
1058
|
+
- previews/primer/open_project/side_panel_preview/with_action_menu.html.erb
|
1058
1059
|
- previews/primer/open_project/side_panel_preview/with_component.html.erb
|
1059
1060
|
- previews/primer/open_project/sub_header_preview.rb
|
1060
1061
|
- previews/primer/open_project/sub_header_preview/action_menu_buttons.html.erb
|