openproject-primer_view_components 0.47.0 → 0.48.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- .PageHeader{border-bottom:var(--borderWidth-thin) solid var(--borderColor-muted);display:flex;flex-flow:column;margin-bottom:var(--stack-gap-normal);padding-bottom:var(--stack-padding-condensed)}.PageHeader--withTabNav{border-bottom:none;margin-bottom:0;padding-bottom:0}.PageHeader-contextBar,.PageHeader-titleBar{align-items:center;display:flex;flex-flow:row;justify-content:flex-end;margin-bottom:var(--base-size-8)}.PageHeader-title{flex:1 1 auto;font-size:var(--text-title-size-medium);font-weight:var(--base-text-weight-normal)}.PageHeader-title--large{font-size:var(--text-title-size-large)}.PageHeader-description{color:var(--fgColor-muted);flex:1 100%;font-size:var(--text-body-size-medium)}.PageHeader--withTabNav .PageHeader-description{margin-bottom:var(--space-xlarge)}.PageHeader-actions{align-items:center;display:flex;justify-content:flex-end}.PageHeader-breadcrumbs{display:block;width:100%}.PageHeader-leadingAction{margin-right:var(--base-size-4);margin-top:2px}.PageHeader-parentLink{flex:1 1 auto}
1
+ .PageHeader{border-bottom:var(--borderWidth-thin) solid var(--borderColor-muted);display:flex;flex-flow:column;margin-bottom:var(--stack-gap-normal);padding-bottom:var(--stack-padding-condensed)}.PageHeader--withTabNav{border-bottom:none;margin-bottom:0;padding-bottom:0}.PageHeader-contextBar,.PageHeader-titleBar{align-items:center;display:flex;flex-flow:row;justify-content:flex-end;margin-bottom:var(--base-size-8)}.PageHeader-title{flex:1 1 auto;font-size:var(--text-title-size-medium);font-weight:var(--base-text-weight-normal)}.PageHeader-title--large{font-size:var(--text-title-size-large)}.PageHeader-description{color:var(--fgColor-muted);flex:1 100%;font-size:var(--text-body-size-medium)}.PageHeader-tabNavBar{overflow:auto}.PageHeader-tabNavBar .PageHeader-tabNav{min-width:max-content}.PageHeader--withTabNav .PageHeader-description{margin-bottom:var(--base-size-16)}.PageHeader-actions{align-items:center;display:flex;justify-content:flex-end}.PageHeader-breadcrumbs{display:block;width:100%}.PageHeader-leadingAction{margin-right:var(--base-size-4);margin-top:2px}.PageHeader-parentLink{flex:1 1 auto}
@@ -8,6 +8,8 @@
8
8
  ".PageHeader-title",
9
9
  ".PageHeader-title--large",
10
10
  ".PageHeader-description",
11
+ ".PageHeader-tabNavBar",
12
+ ".PageHeader-tabNavBar .PageHeader-tabNav",
11
13
  ".PageHeader--withTabNav .PageHeader-description",
12
14
  ".PageHeader-actions",
13
15
  ".PageHeader-breadcrumbs",
@@ -1 +1 @@
1
- {"version":3,"sources":["page_header.pcss"],"names":[],"mappings":"AAEA,YAIE,oEAAqE,CAHrE,YAAa,CAIb,gBAAiB,CAFjB,qCAAsC,CADtC,6CAIF,CAEA,wBACE,kBAAmB,CAEnB,eAAgB,CADhB,gBAEF,CAUA,4CAIE,kBAAmB,CAHnB,YAAa,CACb,aAAc,CACd,wBAAyB,CAEzB,gCACF,CAEA,kBAGE,aAAc,CAFd,uCAAwC,CACxC,0CAEF,CAEA,yBACE,sCACF,CAGA,wBAEE,0BAA2B,CAC3B,WAAY,CAFZ,sCAGF,CAEA,gDACE,iCACF,CAEA,oBAGE,kBAAmB,CADnB,YAAa,CADb,wBAGF,CAEA,wBACE,aAAc,CACd,UACF,CAEA,0BAEE,+BAAgC,CADhC,cAEF,CAEA,uBACE,aACF","file":"page_header.css","sourcesContent":["/* OP PageHeader */\n\n.PageHeader {\n display: flex;\n padding-bottom: var(--stack-padding-condensed);\n margin-bottom: var(--stack-gap-normal);\n border-bottom: var(--borderWidth-thin) solid var(--borderColor-muted);\n flex-flow: column;\n}\n\n.PageHeader--withTabNav {\n border-bottom: none;\n padding-bottom: 0;\n margin-bottom: 0;\n}\n\n.PageHeader-contextBar {\n display: flex;\n flex-flow: row;\n justify-content: flex-end;\n align-items: center;\n margin-bottom: var(--base-size-8);\n}\n\n.PageHeader-titleBar {\n display: flex;\n flex-flow: row;\n justify-content: flex-end;\n align-items: center; /* Keep back button vertically aligned. */\n margin-bottom: var(--base-size-8);\n}\n\n.PageHeader-title {\n font-size: var(--text-title-size-medium);\n font-weight: var(--base-text-weight-normal);\n flex: 1 1 auto;\n}\n\n.PageHeader-title--large {\n font-size: var(--text-title-size-large);\n}\n\n/* One-liner of supporting text */\n.PageHeader-description {\n font-size: var(--text-body-size-medium);\n color: var(--fgColor-muted);\n flex: 1 100%;\n}\n\n.PageHeader--withTabNav .PageHeader-description {\n margin-bottom: var(--space-xlarge);\n}\n\n.PageHeader-actions {\n justify-content: flex-end;\n display: flex;\n align-items: center;\n}\n\n.PageHeader-breadcrumbs {\n display: block;\n width: 100%;\n}\n\n.PageHeader-leadingAction {\n margin-top: 2px; /* to center align with label */\n margin-right: var(--base-size-4);\n}\n\n.PageHeader-parentLink {\n flex: 1 1 auto;\n}\n"]}
1
+ {"version":3,"sources":["page_header.pcss"],"names":[],"mappings":"AAEA,YAIE,oEAAqE,CAHrE,YAAa,CAIb,gBAAiB,CAFjB,qCAAsC,CADtC,6CAIF,CAEA,wBACE,kBAAmB,CAEnB,eAAgB,CADhB,gBAEF,CAUA,4CAIE,kBAAmB,CAHnB,YAAa,CACb,aAAc,CACd,wBAAyB,CAEzB,gCACF,CAEA,kBAGE,aAAc,CAFd,uCAAwC,CACxC,0CAEF,CAEA,yBACE,sCACF,CAGA,wBAEE,0BAA2B,CAC3B,WAAY,CAFZ,sCAGF,CAEA,sBACE,aACF,CAEA,yCACE,qBACF,CAEA,gDACE,iCACF,CAEA,oBAGE,kBAAmB,CADnB,YAAa,CADb,wBAGF,CAEA,wBACE,aAAc,CACd,UACF,CAEA,0BAEE,+BAAgC,CADhC,cAEF,CAEA,uBACE,aACF","file":"page_header.css","sourcesContent":["/* OP PageHeader */\n\n.PageHeader {\n display: flex;\n padding-bottom: var(--stack-padding-condensed);\n margin-bottom: var(--stack-gap-normal);\n border-bottom: var(--borderWidth-thin) solid var(--borderColor-muted);\n flex-flow: column;\n}\n\n.PageHeader--withTabNav {\n border-bottom: none;\n padding-bottom: 0;\n margin-bottom: 0;\n}\n\n.PageHeader-contextBar {\n display: flex;\n flex-flow: row;\n justify-content: flex-end;\n align-items: center;\n margin-bottom: var(--base-size-8);\n}\n\n.PageHeader-titleBar {\n display: flex;\n flex-flow: row;\n justify-content: flex-end;\n align-items: center; /* Keep back button vertically aligned. */\n margin-bottom: var(--base-size-8);\n}\n\n.PageHeader-title {\n font-size: var(--text-title-size-medium);\n font-weight: var(--base-text-weight-normal);\n flex: 1 1 auto;\n}\n\n.PageHeader-title--large {\n font-size: var(--text-title-size-large);\n}\n\n/* One-liner of supporting text */\n.PageHeader-description {\n font-size: var(--text-body-size-medium);\n color: var(--fgColor-muted);\n flex: 1 100%;\n}\n\n.PageHeader-tabNavBar {\n overflow: auto;\n}\n\n.PageHeader-tabNavBar .PageHeader-tabNav {\n min-width: max-content;\n}\n\n.PageHeader--withTabNav .PageHeader-description {\n margin-bottom: var(--base-size-16);\n}\n\n.PageHeader-actions {\n justify-content: flex-end;\n display: flex;\n align-items: center;\n}\n\n.PageHeader-breadcrumbs {\n display: block;\n width: 100%;\n}\n\n.PageHeader-leadingAction {\n margin-top: 2px; /* to center align with label */\n margin-right: var(--base-size-4);\n}\n\n.PageHeader-parentLink {\n flex: 1 1 auto;\n}\n"]}
@@ -30,5 +30,9 @@
30
30
  </div>
31
31
 
32
32
  <%= description %>
33
- <%= tab_nav %>
33
+ <% if tab_nav %>
34
+ <div class="PageHeader-tabNavBar">
35
+ <%= tab_nav %>
36
+ </div>
37
+ <% end %>
34
38
  <% end %>
@@ -47,8 +47,16 @@
47
47
  flex: 1 100%;
48
48
  }
49
49
 
50
+ .PageHeader-tabNavBar {
51
+ overflow: auto;
52
+ }
53
+
54
+ .PageHeader-tabNavBar .PageHeader-tabNav {
55
+ min-width: max-content;
56
+ }
57
+
50
58
  .PageHeader--withTabNav .PageHeader-description {
51
- margin-bottom: var(--space-xlarge);
59
+ margin-bottom: var(--base-size-16);
52
60
  }
53
61
 
54
62
  .PageHeader-actions {
@@ -190,10 +190,9 @@ module Primer
190
190
  if items.length > 1
191
191
  link_arguments = {}
192
192
  parent_item = items[items.length - 2]
193
- parsed_parent_item = anchor_tag_string?(parent_item) ? anchor_string_to_object(parent_item) : parent_item
194
193
 
195
194
  link_arguments[:icon] = fetch_or_fallback(BACK_BUTTON_ICON_OPTIONS, DEFAULT_BACK_BUTTON_ICON)
196
- link_arguments[:href] = parsed_parent_item[:href]
195
+ link_arguments[:href] = parent_item[:href]
197
196
  link_arguments[:target] = "_top"
198
197
 
199
198
  link_arguments[:classes] = class_names(link_arguments[:classes], "PageHeader-parentLink")
@@ -203,14 +202,12 @@ module Primer
203
202
  render(Primer::Beta::Octicon.new(icon: "arrow-left",
204
203
  "aria-label": I18n.t("button_back"),
205
204
  mr: 2)
206
- ) + content_tag(:span, parsed_parent_item[:text])
205
+ ) + content_tag(:span, parent_item[:text])
207
206
  end
208
207
  end
209
208
 
210
209
  render(Primer::Beta::Breadcrumbs.new(**system_arguments)) do |breadcrumbs|
211
210
  items.each do |item|
212
- item = anchor_string_to_object(item) if anchor_tag_string?(item)
213
-
214
211
  if item.is_a?(String)
215
212
  breadcrumbs.with_item(href: "#", font_weight: selected_item_font_weight) { item }
216
213
  else
@@ -331,21 +328,6 @@ module Primer
331
328
  @mobile_action_block = block
332
329
  end
333
330
  end
334
-
335
- # transform anchor tag strings to {href, text} objects
336
- # e.g "\u003ca href=\"/admin\"\u003eAdministration\u003c/a\u003e"
337
- def anchor_string_to_object(html_string)
338
- # Parse the HTML
339
- doc = Nokogiri::HTML.fragment(html_string)
340
- # Extract href and text
341
- anchor = doc.at("a")
342
- { href: anchor["href"], text: anchor.text }
343
- end
344
-
345
- # Check if the item is an anchor tag string e.g "\u003ca href=\"/admin\"\u003eAdministration\u003c/a\u003e"
346
- def anchor_tag_string?(item)
347
- item.is_a?(String) && item.start_with?("\u003c")
348
- end
349
331
  end
350
332
  end
351
333
  end
@@ -5,7 +5,7 @@ module Primer
5
5
  module ViewComponents
6
6
  module VERSION
7
7
  MAJOR = 0
8
- MINOR = 47
8
+ MINOR = 48
9
9
  PATCH = 0
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
@@ -182,7 +182,7 @@ module Primer
182
182
  def non_bold_breadcrumbs
183
183
  breadcrumb_items = [
184
184
  { href: "/foo", text: "Foo" },
185
- "\u003ca href=\"/foo/bar\"\u003eBar\u003c/a\u003e",
185
+ { href: "/foo/bar", text: "Bar" },
186
186
  "Test: <b>Baz</b>".html_safe
187
187
  ]
188
188
  render(Primer::OpenProject::PageHeader.new) do |header|
data/static/classes.json CHANGED
@@ -483,6 +483,9 @@
483
483
  "PageHeader-parentLink": [
484
484
  "Primer::OpenProject::PageHeader"
485
485
  ],
486
+ "PageHeader-tabNavBar": [
487
+ "Primer::OpenProject::PageHeader"
488
+ ],
486
489
  "PageHeader-title": [
487
490
  "Primer::OpenProject::PageHeader"
488
491
  ],
@@ -18076,26 +18076,7 @@
18076
18076
  }
18077
18077
  ],
18078
18078
  "methods": [
18079
- {
18080
- "name": "anchor_string_to_object",
18081
- "description": "transform anchor tag strings to {href, text} objects\ne.g \"\\u003ca href=\\\"/admin\\\"\\u003eAdministration\\u003c/a\\u003e\"",
18082
- "parameters": [
18083
-
18084
- ],
18085
- "return_types": [
18086
18079
 
18087
- ]
18088
- },
18089
- {
18090
- "name": "anchor_tag_string?",
18091
- "description": "Check if the item is an anchor tag string e.g \"\\u003ca href=\\\"/admin\\\"\\u003eAdministration\\u003c/a\\u003e\"",
18092
- "parameters": [
18093
-
18094
- ],
18095
- "return_types": [
18096
- "Boolean"
18097
- ]
18098
- }
18099
18080
  ],
18100
18081
  "previews": [
18101
18082
  {
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.47.0
4
+ version: 0.48.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-09-13 00:00:00.000000000 Z
12
+ date: 2024-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview