openproject-primer_view_components 0.27.0 → 0.28.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 625ef28c9bb40b00a14026f72eeb9fb7627c446a69c6735528f8ce5ced1b7ab7
4
- data.tar.gz: 34ef12fb54dde389edc3607367977b6f344341e6f04f98007b8b1abe97d71716
3
+ metadata.gz: b0fa76eaed82e32a169e106a7c5331e364410a77b3e90f16be74b7393f5f2482
4
+ data.tar.gz: f4ea4ac9f39c7bea4f6d252c6d76f2acb829df24883f7f1c9784a3acd2838d58
5
5
  SHA512:
6
- metadata.gz: b471b62da42a63ba9df30cb2eafe51fb39a841c2b7e2bf504c758f168bda857529b2d9ace734790d07c65e35a3e83f1bbfad1dcb9cf29e106a38d49b1ab3db8e
7
- data.tar.gz: c72334e36b1107f8f6c2ac9b06026de4d8954d9d3d69413c25e80f24f799cdca0be0c1e4a9b1bd7329455a0d3a2c185dc80fff84f0b0a42b25242e490c52dad4
6
+ metadata.gz: a93114a05144027314da5b83f035e087984736a983983da809047e9ddbb46fa46801f39ec3ec84f8cd18e73d21945a4ae477b03a81d1fb4d09c0bcce0e88d2ee
7
+ data.tar.gz: 9ff8e8f2547b22832e5900d9eb19219a1e19a7c7c5d30aa6b36e834f524518ada9f5e7d8ad9bc4524bc19dc01865598d991f835dd58fa4a356c685521d200e60
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.28.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#102](https://github.com/opf/primer_view_components/pull/102) [`b1bd1e2`](https://github.com/opf/primer_view_components/commit/b1bd1e26ef02172fdfb5780d3b109fad9a29bd65) Thanks [@HDinger](https://github.com/HDinger)! - Set target attribute on the actual link element in the Breadcrumb instead of the list element above
8
+
9
+ ## 0.28.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#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
14
+
15
+ ### Patch Changes
16
+
17
+ - [#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
18
+
3
19
  ## 0.27.0
4
20
 
5
21
  ### Minor Changes
@@ -48,8 +48,9 @@ module Primer
48
48
  class Item < Primer::Component
49
49
  attr_accessor :selected, :href
50
50
 
51
- def initialize(href:, **system_arguments)
51
+ def initialize(href:, target: "_self", **system_arguments)
52
52
  @href = href
53
+ @target = target
53
54
  @system_arguments = deny_tag_argument(**system_arguments)
54
55
  @selected = false
55
56
 
@@ -58,7 +59,7 @@ module Primer
58
59
  end
59
60
 
60
61
  def call
61
- link_arguments = { href: @href }
62
+ link_arguments = { href: @href, target: @target }
62
63
 
63
64
  if selected
64
65
  link_arguments[:"aria-current"] = "page"
@@ -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,8 +5,8 @@ module Primer
5
5
  module ViewComponents
6
6
  module VERSION
7
7
  MAJOR = 0
8
- MINOR = 27
9
- PATCH = 0
8
+ MINOR = 28
9
+ PATCH = 1
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -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.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: 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