openproject-primer_view_components 0.47.1 → 0.48.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/app/assets/javascripts/app/components/primer/open_project/zen_mode_button.d.ts +1 -0
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/assets/styles/primer_view_components.css +1 -1
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/open_project/page_header/title.rb +1 -1
- data/app/components/primer/open_project/page_header.css +1 -1
- data/app/components/primer/open_project/page_header.css.json +2 -0
- data/app/components/primer/open_project/page_header.css.map +1 -1
- data/app/components/primer/open_project/page_header.html.erb +5 -1
- data/app/components/primer/open_project/page_header.pcss +8 -0
- data/app/components/primer/open_project/page_header.rb +2 -20
- data/app/components/primer/open_project/zen_mode_button.d.ts +1 -0
- data/app/components/primer/open_project/zen_mode_button.js +11 -0
- data/app/components/primer/open_project/zen_mode_button.ts +12 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/previews/primer/open_project/page_header_preview.rb +1 -1
- data/static/classes.json +3 -0
- data/static/info_arch.json +0 -19
- metadata +2 -2
@@ -11,7 +11,7 @@ module Primer
|
|
11
11
|
HEADING_TAG_OPTIONS = [:h1, :h2, :h3, :h4, :h5, :h6].freeze
|
12
12
|
HEADING_TAG_FALLBACK = :h1
|
13
13
|
|
14
|
-
renders_one :editable_form, lambda { |model:
|
14
|
+
renders_one :editable_form, lambda { |model: false, update_path:, cancel_path:, input_name: :title, method: :put, label: I18n.t(:label_title), placeholder: I18n.t(:label_title), **system_arguments|
|
15
15
|
primer_form_with(
|
16
16
|
model: model,
|
17
17
|
method: method,
|
@@ -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(--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}
|
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(--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"]}
|
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"]}
|
@@ -47,6 +47,14 @@
|
|
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
59
|
margin-bottom: var(--base-size-16);
|
52
60
|
}
|
@@ -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] =
|
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,
|
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
|
@@ -10,6 +10,16 @@ let ZenModeButtonElement = class ZenModeButtonElement extends HTMLElement {
|
|
10
10
|
super(...arguments);
|
11
11
|
this.inZenMode = false;
|
12
12
|
}
|
13
|
+
dispatchZenModeStatus() {
|
14
|
+
// Create a new custom event
|
15
|
+
const event = new CustomEvent('zenModeToggled', {
|
16
|
+
detail: {
|
17
|
+
active: this.inZenMode,
|
18
|
+
},
|
19
|
+
});
|
20
|
+
// Dispatch the custom event
|
21
|
+
window.dispatchEvent(event);
|
22
|
+
}
|
13
23
|
deactivateZenMode() {
|
14
24
|
this.inZenMode = false;
|
15
25
|
this.button.setAttribute('aria-pressed', 'false');
|
@@ -31,6 +41,7 @@ let ZenModeButtonElement = class ZenModeButtonElement extends HTMLElement {
|
|
31
41
|
else {
|
32
42
|
this.activateZenMode();
|
33
43
|
}
|
44
|
+
this.dispatchZenModeStatus();
|
34
45
|
}
|
35
46
|
};
|
36
47
|
__decorate([
|
@@ -5,6 +5,17 @@ class ZenModeButtonElement extends HTMLElement {
|
|
5
5
|
@target button: HTMLElement
|
6
6
|
inZenMode = false
|
7
7
|
|
8
|
+
dispatchZenModeStatus() {
|
9
|
+
// Create a new custom event
|
10
|
+
const event = new CustomEvent('zenModeToggled', {
|
11
|
+
detail: {
|
12
|
+
active: this.inZenMode,
|
13
|
+
},
|
14
|
+
})
|
15
|
+
// Dispatch the custom event
|
16
|
+
window.dispatchEvent(event)
|
17
|
+
}
|
18
|
+
|
8
19
|
private deactivateZenMode() {
|
9
20
|
this.inZenMode = false
|
10
21
|
this.button.setAttribute('aria-pressed', 'false')
|
@@ -27,6 +38,7 @@ class ZenModeButtonElement extends HTMLElement {
|
|
27
38
|
} else {
|
28
39
|
this.activateZenMode()
|
29
40
|
}
|
41
|
+
this.dispatchZenModeStatus()
|
30
42
|
}
|
31
43
|
}
|
32
44
|
|
@@ -182,7 +182,7 @@ module Primer
|
|
182
182
|
def non_bold_breadcrumbs
|
183
183
|
breadcrumb_items = [
|
184
184
|
{ href: "/foo", text: "Foo" },
|
185
|
-
|
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
data/static/info_arch.json
CHANGED
@@ -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.
|
4
|
+
version: 0.48.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-
|
12
|
+
date: 2024-10-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionview
|