openproject-primer_view_components 0.27.0 → 0.28.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 625ef28c9bb40b00a14026f72eeb9fb7627c446a69c6735528f8ce5ced1b7ab7
4
- data.tar.gz: 34ef12fb54dde389edc3607367977b6f344341e6f04f98007b8b1abe97d71716
3
+ metadata.gz: 425fcc627a600df1c426fc749d61f9cfd7603c32d254c5dc239db1e786148010
4
+ data.tar.gz: c6d253b436ed440033c986d9b983dedbff4c5878328215550d37a7066ce13a5f
5
5
  SHA512:
6
- metadata.gz: b471b62da42a63ba9df30cb2eafe51fb39a841c2b7e2bf504c758f168bda857529b2d9ace734790d07c65e35a3e83f1bbfad1dcb9cf29e106a38d49b1ab3db8e
7
- data.tar.gz: c72334e36b1107f8f6c2ac9b06026de4d8954d9d3d69413c25e80f24f799cdca0be0c1e4a9b1bd7329455a0d3a2c185dc80fff84f0b0a42b25242e490c52dad4
6
+ metadata.gz: d5dd04c4c19bff3bb928ab156b8b3a45ccb91fda6cdcefc517f0d2f3c1a352749fca021c6286ce38ac822f7c70b81cc2b55dfca2141714e7072d4b49c4462cff
7
+ data.tar.gz: 952bba99b9fc22d9397dba48a7e79a04363c5c6d71c9d942cdc4e2d5504aea432fe4aabc292529c515ce37b1f0d0f69c28cef636a2e26470be4e466a360961da
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.28.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#98](https://github.com/opf/primer_view_components/pull/98) [`7e56211`](https://github.com/opf/primer_view_components/commit/7e562112d65e48d42b1f7d5b2039bede68fc1383) Thanks [@HDinger](https://github.com/HDinger)! - Add a slot for Primer::OpenProject::ZenModeButton to the Primer::OpenProject::PageHeader
8
+
9
+ ### Patch Changes
10
+
11
+ - [#100](https://github.com/opf/primer_view_components/pull/100) [`7d4e6fb`](https://github.com/opf/primer_view_components/commit/7d4e6fbde24069b80e6dae5f2c07fa1fd4538557) Thanks [@HDinger](https://github.com/HDinger)! - Set link target "\_top" as default for breadcrumb items and link actions
12
+
3
13
  ## 0.27.0
4
14
 
5
15
  ### Minor Changes
@@ -71,8 +71,18 @@ module Primer
71
71
 
72
72
  Primer::Beta::Button.new(**system_arguments)
73
73
  },
74
+ zen_mode_button: lambda { |mobile_icon: Primer::OpenProject::ZenModeButton::ZEN_MODE_BUTTON_ICON, mobile_label: Primer::OpenProject::ZenModeButton::ZEN_MODE_BUTTON_LABEL, **system_arguments|
75
+ deny_tag_argument(**system_arguments)
76
+ system_arguments = set_action_arguments(system_arguments, scheme: DEFAULT_ACTION_SCHEME)
77
+ add_option_to_mobile_menu(system_arguments, mobile_icon, mobile_label, DEFAULT_ACTION_SCHEME)
78
+
79
+ Primer::OpenProject::ZenModeButton.new(**system_arguments)
80
+ },
81
+
74
82
  link: lambda { |mobile_icon:, mobile_label:, scheme: DEFAULT_ACTION_SCHEME, **system_arguments|
75
83
  deny_tag_argument(**system_arguments)
84
+ system_arguments[:target] ||= "_top"
85
+
76
86
  system_arguments = set_action_arguments(system_arguments, scheme: scheme)
77
87
  add_option_to_mobile_menu(system_arguments, mobile_icon, mobile_label, scheme)
78
88
 
@@ -151,6 +161,8 @@ module Primer
151
161
 
152
162
  link_arguments[:icon] = fetch_or_fallback(BACK_BUTTON_ICON_OPTIONS, DEFAULT_BACK_BUTTON_ICON)
153
163
  link_arguments[:href] = parsed_parent_item[:href]
164
+ link_arguments[:target] = "_top"
165
+
154
166
  link_arguments[:classes] = class_names(link_arguments[:classes], "PageHeader-parentLink")
155
167
  link_arguments[:display] ||= DEFAULT_PARENT_LINK_DISPLAY
156
168
 
@@ -169,7 +181,7 @@ module Primer
169
181
  if item.is_a?(String)
170
182
  breadcrumbs.with_item(href: "#") { item }
171
183
  else
172
- breadcrumbs.with_item(href: item[:href]) { item[:text] }
184
+ breadcrumbs.with_item(href: item[:href], target: "_top") { item[:text] }
173
185
  end
174
186
  end
175
187
  end
@@ -3,8 +3,8 @@
3
3
  Primer::Beta::IconButton.new(
4
4
  scheme: :default,
5
5
  id: "zenModeButton",
6
- icon: "screen-normal",
7
- aria: { label: I18n.t("zen_mode") },
6
+ icon: ZEN_MODE_BUTTON_ICON,
7
+ aria: { label: ZEN_MODE_BUTTON_LABEL },
8
8
  data: { target: "zen-mode-button.button", action: "click:zen-mode-button#performAction" }
9
9
  )
10
10
  ) %>
@@ -8,6 +8,9 @@ module Primer
8
8
  class ZenModeButton < Primer::Component
9
9
  status :open_project
10
10
 
11
+ ZEN_MODE_BUTTON_LABEL = I18n.t("label_zen_mode")
12
+ ZEN_MODE_BUTTON_ICON = "screen-full"
13
+
11
14
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
12
15
  def initialize(**system_arguments)
13
16
  @system_arguments = system_arguments
@@ -5,7 +5,7 @@ module Primer
5
5
  module ViewComponents
6
6
  module VERSION
7
7
  MAJOR = 0
8
- MINOR = 27
8
+ MINOR = 28
9
9
  PATCH = 0
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
@@ -104,6 +104,22 @@ module Primer
104
104
  end
105
105
  end
106
106
 
107
+ # @label With a ZenModeButton inside the actions
108
+ # The missing label will be resolved automatically when included into the core
109
+ def zen_mode_button_actions
110
+ render(Primer::OpenProject::PageHeader.new) do |component|
111
+ component.with_title { "Great news" }
112
+ component.with_breadcrumbs([{ href: "/foo", text: "Foo" }, { href: "/bar", text: "Bar" }, "Baz"])
113
+
114
+ # The missing label will be resolved automatically when included into the core
115
+ component.with_action_zen_mode_button
116
+ component.with_action_button(mobile_icon: "plus", mobile_label: "Meeting", scheme: :primary) do |button|
117
+ button.with_leading_visual_icon(icon: "plus")
118
+ "Meeting"
119
+ end
120
+ end
121
+ end
122
+
107
123
  # @label With leading action (on wide)
108
124
  # **Leading action** is only shown on **wide screens** by default.
109
125
  # If you want to override that behaviour please use the system_argument: **display**
@@ -1474,6 +1474,8 @@
1474
1474
  "Primer::OpenProject::PageHeader::Menu": {
1475
1475
  },
1476
1476
  "Primer::OpenProject::ZenModeButton": {
1477
+ "ZEN_MODE_BUTTON_ICON": "screen-full",
1478
+ "ZEN_MODE_BUTTON_LABEL": "Translation missing: en.label_zen_mode"
1477
1479
  },
1478
1480
  "Primer::Tooltip": {
1479
1481
  "ALIGN_DEFAULT": "default",
@@ -16631,6 +16631,19 @@
16631
16631
  ]
16632
16632
  }
16633
16633
  },
16634
+ {
16635
+ "preview_path": "primer/open_project/page_header/zen_mode_button_actions",
16636
+ "name": "zen_mode_button_actions",
16637
+ "snapshot": "false",
16638
+ "skip_rules": {
16639
+ "wont_fix": [
16640
+ "region"
16641
+ ],
16642
+ "will_fix": [
16643
+ "color-contrast"
16644
+ ]
16645
+ }
16646
+ },
16634
16647
  {
16635
16648
  "preview_path": "primer/open_project/page_header/leading_action",
16636
16649
  "name": "leading_action",
data/static/previews.json CHANGED
@@ -5222,6 +5222,19 @@
5222
5222
  ]
5223
5223
  }
5224
5224
  },
5225
+ {
5226
+ "preview_path": "primer/open_project/page_header/zen_mode_button_actions",
5227
+ "name": "zen_mode_button_actions",
5228
+ "snapshot": "false",
5229
+ "skip_rules": {
5230
+ "wont_fix": [
5231
+ "region"
5232
+ ],
5233
+ "will_fix": [
5234
+ "color-contrast"
5235
+ ]
5236
+ }
5237
+ },
5225
5238
  {
5226
5239
  "preview_path": "primer/open_project/page_header/leading_action",
5227
5240
  "name": "leading_action",
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.27.0
4
+ version: 0.28.0
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: 2024-04-04 00:00:00.000000000 Z
12
+ date: 2024-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview