openproject-primer_view_components 0.84.4 → 0.84.5

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.
@@ -19,6 +19,7 @@ var _ActionMenuElement_instances, _a, _ActionMenuElement_abortController, _Actio
19
19
  var ActionMenuElement_1;
20
20
  import { controller, target } from '@github/catalyst';
21
21
  import '@oddbird/popover-polyfill';
22
+ import AnchoredPositionElement from '../../anchored_position';
22
23
  import { observeMutationsUntilConditionMet } from '../../utils';
23
24
  import { ActionMenuFocusZoneStack } from './action_menu_focus_zone_stack';
24
25
  import { ClipboardCopyElement } from '@github/clipboard-copy-element';
@@ -365,6 +366,9 @@ _ActionMenuElement_handleItemKeyboardEvent = function _ActionMenuElement_handleI
365
366
  };
366
367
  _ActionMenuElement_handleToggleEvent = function _ActionMenuElement_handleToggleEvent(event) {
367
368
  const subMenu = event.target;
369
+ // Ignore toggle events from non-anchored-position elements (e.g. tooltips inside the menu)
370
+ if (!(event.target instanceof AnchoredPositionElement))
371
+ return;
368
372
  if (event.newState === 'open') {
369
373
  // allow tabbing away from primary menu, but trap focus in sub-menus
370
374
  const isPrimaryMenu = subMenu === this.overlay;
@@ -346,6 +346,9 @@ export class ActionMenuElement extends HTMLElement {
346
346
  #handleToggleEvent(event: ToggleEvent) {
347
347
  const subMenu = event.target as AnchoredPositionElement
348
348
 
349
+ // Ignore toggle events from non-anchored-position elements (e.g. tooltips inside the menu)
350
+ if (!(event.target instanceof AnchoredPositionElement)) return
351
+
349
352
  if (event.newState === 'open') {
350
353
  // allow tabbing away from primary menu, but trap focus in sub-menus
351
354
  const isPrimaryMenu = subMenu === this.overlay
@@ -6,7 +6,7 @@ module Primer
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 84
9
- PATCH = 4
9
+ PATCH = 5
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -1,18 +1,18 @@
1
1
  <%= form_with(url: primer_view_components.action_menu_form_action_path(format: route_format)) do |f| %>
2
- <% content = -> (base) do %>
3
- <% base.with_item(label: "Fast forward", data: { value: "fast_forward" }) %>
4
- <% base.with_item(label: "Recursive", data: { value: "recursive" }) %>
5
- <% base.with_item(label: "Ours", data: { value: "ours" }, active: true) %>
6
- <% base.with_item(label: "Resolve") %>
7
- <% end %>
8
2
  <%= render(Primer::Alpha::ActionMenu.new(select_variant: :multiple, dynamic_label: true, dynamic_label_prefix: "Strategy", form_arguments: { builder: f, name: "foo" })) do |menu| %>
9
3
  <% menu.with_show_button { "Strategy" } %>
10
4
  <% if nest_in_sub_menu %>
11
5
  <% menu.with_sub_menu_item(label: "Sub-menu") do |sub_menu| %>
12
- <% content.call(sub_menu) %>
6
+ <% sub_menu.with_item(label: "Fast forward", data: { value: "fast_forward" }) %>
7
+ <% sub_menu.with_item(label: "Recursive", data: { value: "recursive" }) %>
8
+ <% sub_menu.with_item(label: "Ours", data: { value: "ours" }, active: true) %>
9
+ <% sub_menu.with_item(label: "Resolve") %>
13
10
  <% end %>
14
11
  <% else %>
15
- <% content.call(menu) %>
12
+ <% menu.with_item(label: "Fast forward", data: { value: "fast_forward" }) %>
13
+ <% menu.with_item(label: "Recursive", data: { value: "recursive" }) %>
14
+ <% menu.with_item(label: "Ours", data: { value: "ours" }, active: true) %>
15
+ <% menu.with_item(label: "Resolve") %>
16
16
  <% end %>
17
17
  <% end %>
18
18
  <hr>
@@ -1,21 +1,13 @@
1
1
  <%= render(Primer::Alpha::ActionMenu.new) do |component| %>
2
2
  <% component.with_show_button { "Menu" } %>
3
- <% contents = -> (base) do %>
4
- <% base.with_item(label: "Item", tag: :button, value: "") %>
5
- <% base.with_item(
6
- label: "Show dialog",
7
- tag: :button,
8
- content_arguments: { "data-show-dialog-id": "my-dialog" },
9
- value: "",
10
- scheme: :danger
11
- ) %>
12
- <% end %>
13
3
  <% if nest_in_sub_menu %>
14
4
  <% component.with_sub_menu_item(label: "Sub-menu") do |sub_menu_item| %>
15
- <% contents.call(sub_menu_item) %>
5
+ <% sub_menu_item.with_item(label: "Item", tag: :button, value: "") %>
6
+ <% sub_menu_item.with_item(label: "Show dialog", tag: :button, content_arguments: { "data-show-dialog-id": "my-dialog" }, value: "", scheme: :danger) %>
16
7
  <% end %>
17
8
  <% else %>
18
- <% contents.call(component) %>
9
+ <% component.with_item(label: "Item", tag: :button, value: "") %>
10
+ <% component.with_item(label: "Show dialog", tag: :button, content_arguments: { "data-show-dialog-id": "my-dialog" }, value: "", scheme: :danger) %>
19
11
  <% end %>
20
12
  <% end %>
21
13
 
@@ -1,42 +1,12 @@
1
- <% contents = -> (menu) do %>
2
- <% menu.with_item(
3
- label: "Repository",
4
- href: primer_view_components.action_menu_form_action_path(format: route_format),
5
- form_arguments: {
6
- method: :post,
7
- inputs: [{
8
- name: "query",
9
- value: "query"
10
- }, {
11
- name: "foo", # use "foo" here because that's what the controller expects
12
- value: "group-by-repository",
13
- }],
14
- }
15
- ) %>
16
- <% menu.with_item(
17
- label: "Date",
18
- href: primer_view_components.action_menu_form_action_path(format: route_format),
19
- form_arguments: {
20
- method: :post,
21
- inputs: [{
22
- name: "query",
23
- value: "query"
24
- }, {
25
- name: "foo", # use "foo" here because that's what the controller expects
26
- value: "sort-by-date"
27
- }]
28
- }
29
- ) %>
30
- <% end %>
31
-
32
1
  <%= render(Primer::Alpha::ActionMenu.new(select_variant: :single)) do |menu| %>
33
2
  <% menu.with_show_button { "Group By" } %>
34
-
35
3
  <% if nest_in_sub_menu %>
36
4
  <% menu.with_sub_menu_item(label: "Sub-menu") do |sub_menu_item| %>
37
- <% contents.call(sub_menu_item) %>
5
+ <% sub_menu_item.with_item(label: "Repository", href: primer_view_components.action_menu_form_action_path(format: route_format), form_arguments: { method: :post, inputs: [{ name: "query", value: "query" }, { name: "foo", value: "group-by-repository" }] }) %>
6
+ <% sub_menu_item.with_item(label: "Date", href: primer_view_components.action_menu_form_action_path(format: route_format), form_arguments: { method: :post, inputs: [{ name: "query", value: "query" }, { name: "foo", value: "sort-by-date" }] }) %>
38
7
  <% end %>
39
8
  <% else %>
40
- <% contents.call(menu) %>
9
+ <% menu.with_item(label: "Repository", href: primer_view_components.action_menu_form_action_path(format: route_format), form_arguments: { method: :post, inputs: [{ name: "query", value: "query" }, { name: "foo", value: "group-by-repository" }] }) %>
10
+ <% menu.with_item(label: "Date", href: primer_view_components.action_menu_form_action_path(format: route_format), form_arguments: { method: :post, inputs: [{ name: "query", value: "query" }, { name: "foo", value: "sort-by-date" }] }) %>
41
11
  <% end %>
42
12
  <% end %>
@@ -8,24 +8,17 @@
8
8
 
9
9
  <%= render(Primer::Alpha::ActionMenu.new) do |component| %>
10
10
  <% component.with_show_button { "Trigger" } %>
11
- <% contents = -> (base) do %>
12
- <% base.with_item(label: "Alert", tag: :button, id: "alert-item", disabled: disable_items) %>
13
- <% base.with_item(label: "Navigate", tag: :a, content_arguments: { href: primer_view_components.action_menu_landing_path }, disabled: disable_items) %>
14
- <% base.with_item(label: "Copy text", tag: :"clipboard-copy", content_arguments: { value: "Text to copy" }, disabled: disable_items) %>
15
- <% base.with_item(
16
- label: "Submit form",
17
- href: primer_view_components.action_menu_form_action_path(format: route_format),
18
- form_arguments: {
19
- name: "foo", value: "bar", method: :post
20
- },
21
- disabled: disable_items
22
- ) %>
23
- <% end %>
24
11
  <% if nest_in_sub_menu %>
25
12
  <% component.with_sub_menu_item(label: "Sub-menu") do |sub_menu_item| %>
26
- <% contents.call(sub_menu_item) %>
13
+ <% sub_menu_item.with_item(label: "Alert", tag: :button, id: "alert-item", disabled: disable_items) %>
14
+ <% sub_menu_item.with_item(label: "Navigate", tag: :a, content_arguments: { href: primer_view_components.action_menu_landing_path }, disabled: disable_items) %>
15
+ <% sub_menu_item.with_item(label: "Copy text", tag: :"clipboard-copy", content_arguments: { value: "Text to copy" }, disabled: disable_items) %>
16
+ <% sub_menu_item.with_item(label: "Submit form", href: primer_view_components.action_menu_form_action_path(format: route_format), form_arguments: { name: "foo", value: "bar", method: :post }, disabled: disable_items) %>
27
17
  <% end %>
28
18
  <% else %>
29
- <% contents.call(component) %>
19
+ <% component.with_item(label: "Alert", tag: :button, id: "alert-item", disabled: disable_items) %>
20
+ <% component.with_item(label: "Navigate", tag: :a, content_arguments: { href: primer_view_components.action_menu_landing_path }, disabled: disable_items) %>
21
+ <% component.with_item(label: "Copy text", tag: :"clipboard-copy", content_arguments: { value: "Text to copy" }, disabled: disable_items) %>
22
+ <% component.with_item(label: "Submit form", href: primer_view_components.action_menu_form_action_path(format: route_format), form_arguments: { name: "foo", value: "bar", method: :post }, disabled: disable_items) %>
30
23
  <% end %>
31
24
  <% end %>
@@ -155,6 +155,7 @@ module Primer
155
155
  render(Primer::Alpha::ActionMenu.new) do |menu|
156
156
  menu.with_show_button(icon: :star, "aria-label": "Menu")
157
157
  menu.with_item(label: "Does something")
158
+ menu.with_item(label: "Does something else")
158
159
  end
159
160
  end
160
161
 
@@ -1,5 +1,3 @@
1
1
  <%= render(Primer::OpenProject::InlineMessage.new(scheme: scheme, size: size)) do %>
2
- <%= render(Primer::Beta::Text.new(tag: :p)) do %>
3
- <%= render(Primer::Beta::Text.new(tag: :strong).with_content("It is an inline message")) %>
4
- <% end %>
2
+ <%= render(Primer::Beta::Text.new(tag: :strong).with_content("It is an inline message")) %>
5
3
  <% end %>
@@ -6,6 +6,7 @@ module Primer
6
6
  # @label Default
7
7
  # @snapshot
8
8
  def default
9
+ render(Primer::OpenProject::InlineMessage.new(scheme: :warning, size: :medium)) { "Warning message" }
9
10
  end
10
11
 
11
12
  # @label Playground
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.84.4
4
+ version: 0.84.5
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: 2026-04-21 00:00:00.000000000 Z
12
+ date: 2026-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -1282,7 +1282,6 @@ files:
1282
1282
  - previews/primer/open_project/grid_layout_preview.rb
1283
1283
  - previews/primer/open_project/heading_preview.rb
1284
1284
  - previews/primer/open_project/inline_message_preview.rb
1285
- - previews/primer/open_project/inline_message_preview/default.html.erb
1286
1285
  - previews/primer/open_project/inline_message_preview/playground.html.erb
1287
1286
  - previews/primer/open_project/input_group_preview.rb
1288
1287
  - previews/primer/open_project/page_header_preview.rb
@@ -1,5 +0,0 @@
1
- <%= render(Primer::OpenProject::InlineMessage.new(scheme: :warning, size: :small)) do %>
2
- <%= render(Primer::Beta::Text.new(tag: :p)) do %>
3
- <%= render(Primer::Beta::Text.new(tag: :strong).with_content("Warning message")) %>
4
- <% end %>
5
- <% end %>