openproject-primer_view_components 0.13.1 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/app/assets/javascripts/app/components/primer/primer.d.ts +0 -1
- 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/alpha/action_menu/action_menu_element.js +8 -6
- data/app/components/primer/alpha/action_menu/action_menu_element.ts +9 -6
- data/app/components/primer/alpha/overlay.css +1 -1
- data/app/components/primer/alpha/overlay.css.json +0 -1
- data/app/components/primer/alpha/overlay.css.map +1 -1
- data/app/components/primer/alpha/overlay.pcss +0 -12
- data/app/components/primer/open_project/page_header.css +1 -1
- data/app/components/primer/open_project/page_header.css.json +4 -1
- data/app/components/primer/open_project/page_header.css.map +1 -1
- data/app/components/primer/open_project/page_header.html.erb +6 -2
- data/app/components/primer/open_project/page_header.pcss +19 -6
- data/app/components/primer/open_project/page_header.rb +70 -0
- data/app/components/primer/primer.d.ts +0 -1
- data/app/components/primer/primer.js +0 -1
- data/app/components/primer/primer.pcss +0 -2
- data/app/components/primer/primer.ts +0 -1
- data/lib/primer/static/generate_info_arch.rb +6 -1
- data/lib/primer/view_components/version.rb +2 -2
- data/previews/primer/open_project/page_header_preview.rb +39 -1
- data/static/classes.json +9 -0
- data/static/constants.json +12 -0
- data/static/info_arch.json +87 -6
- data/static/previews.json +26 -0
- metadata +2 -2
@@ -151,13 +151,15 @@ let ActionMenuElement = class ActionMenuElement extends HTMLElement {
|
|
151
151
|
}
|
152
152
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_activateItem).call(this, event, item);
|
153
153
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_handleItemActivated).call(this, event, item);
|
154
|
-
// Pressing the space key on a button will cause the page to scroll unless preventDefault()
|
155
|
-
// is called.
|
156
|
-
// code below therefore only calls preventDefault() if the button
|
157
|
-
//
|
158
|
-
if (
|
154
|
+
// Pressing the space key on a button or link will cause the page to scroll unless preventDefault()
|
155
|
+
// is called. While calling preventDefault() appears to have no effect on link navigation, it skips
|
156
|
+
// form submission. The code below therefore only calls preventDefault() if the button has been
|
157
|
+
// activated by the space key, and manually submits the form if the button is a submit button.
|
158
|
+
if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isKeyboardActivationViaSpace).call(this, event)) {
|
159
159
|
event.preventDefault();
|
160
|
-
(
|
160
|
+
if (item.getAttribute('type') === 'submit') {
|
161
|
+
(_b = item.closest('form')) === null || _b === void 0 ? void 0 : _b.submit();
|
162
|
+
}
|
161
163
|
}
|
162
164
|
return;
|
163
165
|
}
|
@@ -216,13 +216,16 @@ export class ActionMenuElement extends HTMLElement {
|
|
216
216
|
this.#activateItem(event, item)
|
217
217
|
this.#handleItemActivated(event, item)
|
218
218
|
|
219
|
-
// Pressing the space key on a button will cause the page to scroll unless preventDefault()
|
220
|
-
// is called.
|
221
|
-
// code below therefore only calls preventDefault() if the button
|
222
|
-
//
|
223
|
-
if (
|
219
|
+
// Pressing the space key on a button or link will cause the page to scroll unless preventDefault()
|
220
|
+
// is called. While calling preventDefault() appears to have no effect on link navigation, it skips
|
221
|
+
// form submission. The code below therefore only calls preventDefault() if the button has been
|
222
|
+
// activated by the space key, and manually submits the form if the button is a submit button.
|
223
|
+
if (this.#isKeyboardActivationViaSpace(event)) {
|
224
224
|
event.preventDefault()
|
225
|
-
|
225
|
+
|
226
|
+
if (item.getAttribute('type') === 'submit') {
|
227
|
+
item.closest('form')?.submit()
|
228
|
+
}
|
226
229
|
}
|
227
230
|
|
228
231
|
return
|
@@ -1 +1 @@
|
|
1
|
-
anchored-position[popover]{background:none;border-width:0;
|
1
|
+
anchored-position[popover]{background:none;border-width:0;min-width:192px;overflow:visible;padding:0;position:absolute}.Overlay{display:flex}anchored-position.not-anchored::-webkit-backdrop{background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted))}anchored-position.not-anchored::backdrop{background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted))}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["overlay.pcss"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"sources":["overlay.pcss"],"names":[],"mappings":"AAAA,2BAME,eAAgB,CALhB,cAAe,CAGf,eAAgB,CAChB,gBAAiB,CAHjB,SAAU,CACV,iBAIF,CAEA,SACE,YACF,CAEA,iDACE,2EACF,CAFA,yCACE,2EACF","file":"overlay.css","sourcesContent":["anchored-position[popover] {\n border-width: 0;\n padding: 0;\n position: absolute;\n min-width: 192px;\n overflow: visible;\n background: none;\n}\n\n.Overlay {\n display: flex;\n}\n\nanchored-position.not-anchored::backdrop {\n background-color: var(--overlay-backdrop-bgColor, var(--color-neutral-muted));\n}\n"]}
|
@@ -3,7 +3,6 @@ anchored-position[popover] {
|
|
3
3
|
padding: 0;
|
4
4
|
position: absolute;
|
5
5
|
min-width: 192px;
|
6
|
-
inset: auto;
|
7
6
|
overflow: visible;
|
8
7
|
background: none;
|
9
8
|
}
|
@@ -12,17 +11,6 @@ anchored-position[popover] {
|
|
12
11
|
display: flex;
|
13
12
|
}
|
14
13
|
|
15
|
-
anchored-position[popover]:not(.\:popover-open) {
|
16
|
-
display: none;
|
17
|
-
}
|
18
|
-
|
19
14
|
anchored-position.not-anchored::backdrop {
|
20
15
|
background-color: var(--overlay-backdrop-bgColor, var(--color-neutral-muted));
|
21
16
|
}
|
22
|
-
|
23
|
-
/* This reverts the declaration above for native popover, where `:popover-open` is supported */
|
24
|
-
@supports selector(:popover-open) {
|
25
|
-
anchored-position[popover]:not(.\:popover-open) {
|
26
|
-
display: revert;
|
27
|
-
}
|
28
|
-
}
|
@@ -1 +1 @@
|
|
1
|
-
.PageHeader{border-bottom:var(--borderWidth-thin,max(1px,.0625rem)) solid var(--borderColor-muted,var(--color-border-muted));display:flex;flex-flow:
|
1
|
+
.PageHeader{border-bottom:var(--borderWidth-thin,max(1px,.0625rem)) solid var(--borderColor-muted,var(--color-border-muted));display:flex;flex-flow:column;margin-bottom:var(--stack-gap-normal,1rem);padding-bottom:var(--stack-padding-condensed,.5rem)}@media (max-width:767.98px){.PageHeader{border-bottom:0}}.PageHeader-titleBar{align-items:center;display:flex;flex-flow:row;justify-content:flex-end}.PageHeader-title{flex:1 1 auto;font-size:24px;font-weight:var(--base-text-weight-normal,400)}.PageHeader-title--large{font-size:var(--text-title-size-large,2rem)}.PageHeader-description{color:var(--fgColor-muted,var(--color-fg-muted));flex:1 100%;font-size:var(--text-body-size-medium,.875rem)}.PageHeader-actions{justify-content:flex-end;margin:var(--base-size-4,.25rem) 0 var(--base-size-4,.25rem) var(--base-size-4,.25rem)}.PageHeader-actions+.PageHeader-description{margin-top:var(--base-size-4,.25rem)}.PageHeader-breadcrumbs{display:block;margin-bottom:var(--base-size-8,.5rem);width:100%}.PageHeader-backButton{margin-right:var(--base-size-4,.25rem);margin-top:2px}
|
@@ -2,10 +2,13 @@
|
|
2
2
|
"name": "open_project/page_header",
|
3
3
|
"selectors": [
|
4
4
|
".PageHeader",
|
5
|
+
".PageHeader-titleBar",
|
5
6
|
".PageHeader-title",
|
6
7
|
".PageHeader-title--large",
|
7
8
|
".PageHeader-description",
|
8
9
|
".PageHeader-actions",
|
9
|
-
".PageHeader-actions+.PageHeader-description"
|
10
|
+
".PageHeader-actions+.PageHeader-description",
|
11
|
+
".PageHeader-breadcrumbs",
|
12
|
+
".PageHeader-backButton"
|
10
13
|
]
|
11
14
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["page_header.pcss"],"names":[],"mappings":"AAEA,YAIE,gHAAqE,CAHrE,YAAa,CAIb,
|
1
|
+
{"version":3,"sources":["page_header.pcss"],"names":[],"mappings":"AAEA,YAIE,gHAAqE,CAHrE,YAAa,CAIb,gBAAiB,CAFjB,0CAAsC,CADtC,mDAQF,CAHE,4BAPF,YAQI,eAEJ,CADE,CAGF,qBAIE,kBAAmB,CAHnB,YAAa,CACb,aAAc,CACd,wBAEF,CAEA,kBAGE,aAAc,CAFd,cAAe,CACf,8CAEF,CAEA,yBACE,2CACF,CAGA,wBAEE,gDAA2B,CAC3B,WAAY,CAFZ,8CAGF,CAGA,oBAEE,wBAAyB,CADzB,sFAMF,CAHE,4CACE,oCACF,CAGF,wBACE,aAAc,CAEd,sCAAiC,CADjC,UAEF,CAEA,uBAEE,sCAAgC,CADhC,cAEF","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 @media (max-width: 767.98px) {\n border-bottom: 0;\n }\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}\n\n.PageHeader-title {\n font-size: 24px;\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/* Add 1 or 2 buttons to the right of the heading */\n.PageHeader-actions {\n margin: var(--base-size-4) 0 var(--base-size-4) var(--base-size-4);\n justify-content: flex-end;\n\n & + .PageHeader-description {\n margin-top: var(--base-size-4);\n }\n}\n\n.PageHeader-breadcrumbs {\n display: block;\n width: 100%;\n margin-bottom: var(--base-size-8);\n}\n\n.PageHeader-backButton {\n margin-top: 2px; /* to center align with label */\n margin-right: var(--base-size-4);\n}\n"]}
|
@@ -5,19 +5,24 @@
|
|
5
5
|
padding-bottom: var(--stack-padding-condensed);
|
6
6
|
margin-bottom: var(--stack-gap-normal);
|
7
7
|
border-bottom: var(--borderWidth-thin) solid var(--borderColor-muted);
|
8
|
-
flex-flow:
|
9
|
-
justify-content: flex-end; /* Keep actions right aligned. */
|
8
|
+
flex-flow: column;
|
10
9
|
|
11
10
|
@media (max-width: 767.98px) {
|
12
11
|
border-bottom: 0;
|
13
12
|
}
|
14
13
|
}
|
15
14
|
|
15
|
+
.PageHeader-titleBar {
|
16
|
+
display: flex;
|
17
|
+
flex-flow: row;
|
18
|
+
justify-content: flex-end;
|
19
|
+
align-items: center; /* Keep back button vertically aligned. */
|
20
|
+
}
|
21
|
+
|
16
22
|
.PageHeader-title {
|
17
23
|
font-size: 24px;
|
18
24
|
font-weight: var(--base-text-weight-normal);
|
19
25
|
flex: 1 1 auto;
|
20
|
-
order: 0;
|
21
26
|
}
|
22
27
|
|
23
28
|
.PageHeader-title--large {
|
@@ -29,17 +34,25 @@
|
|
29
34
|
font-size: var(--text-body-size-medium);
|
30
35
|
color: var(--fgColor-muted);
|
31
36
|
flex: 1 100%;
|
32
|
-
order: 2;
|
33
37
|
}
|
34
38
|
|
35
39
|
/* Add 1 or 2 buttons to the right of the heading */
|
36
40
|
.PageHeader-actions {
|
37
41
|
margin: var(--base-size-4) 0 var(--base-size-4) var(--base-size-4);
|
38
|
-
align-self: center;
|
39
42
|
justify-content: flex-end;
|
40
|
-
order: 1;
|
41
43
|
|
42
44
|
& + .PageHeader-description {
|
43
45
|
margin-top: var(--base-size-4);
|
44
46
|
}
|
45
47
|
}
|
48
|
+
|
49
|
+
.PageHeader-breadcrumbs {
|
50
|
+
display: block;
|
51
|
+
width: 100%;
|
52
|
+
margin-bottom: var(--base-size-8);
|
53
|
+
}
|
54
|
+
|
55
|
+
.PageHeader-backButton {
|
56
|
+
margin-top: 2px; /* to center align with label */
|
57
|
+
margin-right: var(--base-size-4);
|
58
|
+
}
|
@@ -13,6 +13,20 @@ module Primer
|
|
13
13
|
DEFAULT_HEADER_VARIANT
|
14
14
|
].freeze
|
15
15
|
|
16
|
+
DEFAULT_BACK_BUTTON_SIZE = :medium
|
17
|
+
BACK_BUTTON_SIZE_OPTIONS = [
|
18
|
+
:small,
|
19
|
+
DEFAULT_HEADER_VARIANT,
|
20
|
+
:large
|
21
|
+
].freeze
|
22
|
+
|
23
|
+
DEFAULT_BACK_BUTTON_ICON = "arrow-left"
|
24
|
+
BACK_BUTTON_ICON_OPTIONS = [
|
25
|
+
DEFAULT_BACK_BUTTON_ICON,
|
26
|
+
"chevron-left",
|
27
|
+
"triangle-left"
|
28
|
+
].freeze
|
29
|
+
|
16
30
|
status :open_project
|
17
31
|
|
18
32
|
# The title of the page header
|
@@ -50,6 +64,45 @@ module Primer
|
|
50
64
|
Primer::BaseComponent.new(**system_arguments)
|
51
65
|
}
|
52
66
|
|
67
|
+
# Optional back button prepend the title
|
68
|
+
#
|
69
|
+
# @param size [Symbol] <%= one_of(Primer::OpenProject::PageHeader::BACK_BUTTON_SIZE_OPTIONS) %>
|
70
|
+
# @param icon [String] <%= one_of(Primer::OpenProject::PageHeader::BACK_BUTTON_ICON_OPTIONS) %>
|
71
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
72
|
+
renders_one :back_button, lambda { |
|
73
|
+
size: DEFAULT_BACK_BUTTON_SIZE,
|
74
|
+
icon: DEFAULT_BACK_BUTTON_ICON,
|
75
|
+
**system_arguments
|
76
|
+
|
|
77
|
+
deny_tag_argument(**system_arguments)
|
78
|
+
system_arguments[:tag] = :a
|
79
|
+
system_arguments[:scheme] = :invisible
|
80
|
+
system_arguments[:size] = fetch_or_fallback(BACK_BUTTON_SIZE_OPTIONS, size, DEFAULT_BACK_BUTTON_SIZE)
|
81
|
+
system_arguments[:icon] = fetch_or_fallback(BACK_BUTTON_ICON_OPTIONS, icon, DEFAULT_BACK_BUTTON_ICON)
|
82
|
+
system_arguments[:classes] = class_names(system_arguments[:classes], "PageHeader-backButton")
|
83
|
+
|
84
|
+
Primer::Beta::IconButton.new(**system_arguments)
|
85
|
+
}
|
86
|
+
|
87
|
+
# Optional breadcrumbs above the title row
|
88
|
+
#
|
89
|
+
# @param items [Array<String, Hash>] Items is an array of strings, hash {href, text} or an anchor tag string
|
90
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
91
|
+
renders_one :breadcrumbs, lambda { |items, **system_arguments|
|
92
|
+
system_arguments[:classes] = class_names(system_arguments[:classes], "PageHeader-breadcrumbs")
|
93
|
+
render(Primer::Beta::Breadcrumbs.new(**system_arguments)) do |breadcrumbs|
|
94
|
+
items.each do |item|
|
95
|
+
item = anchor_string_to_object(item) if anchor_tag_string?(item)
|
96
|
+
|
97
|
+
if item.is_a?(String)
|
98
|
+
breadcrumbs.with_item(href: "#") { item }
|
99
|
+
else
|
100
|
+
breadcrumbs.with_item(href: item[:href]) { item[:text] }
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
}
|
105
|
+
|
53
106
|
def initialize(**system_arguments)
|
54
107
|
@system_arguments = deny_tag_argument(**system_arguments)
|
55
108
|
|
@@ -64,6 +117,23 @@ module Primer
|
|
64
117
|
def render?
|
65
118
|
title?
|
66
119
|
end
|
120
|
+
|
121
|
+
private
|
122
|
+
|
123
|
+
# transform anchor tag strings to {href, text} objects
|
124
|
+
# e.g "\u003ca href=\"/admin\"\u003eAdministration\u003c/a\u003e"
|
125
|
+
def anchor_string_to_object(html_string)
|
126
|
+
# Parse the HTML
|
127
|
+
doc = Nokogiri::HTML.fragment(html_string)
|
128
|
+
# Extract href and text
|
129
|
+
anchor = doc.at("a")
|
130
|
+
{ href: anchor["href"], text: anchor.text }
|
131
|
+
end
|
132
|
+
|
133
|
+
# Check if the item is an anchor tag string e.g "\u003ca href=\"/admin\"\u003eAdministration\u003c/a\u003e"
|
134
|
+
def anchor_tag_string?(item)
|
135
|
+
item.is_a?(String) && item.start_with?("\u003c")
|
136
|
+
end
|
67
137
|
end
|
68
138
|
end
|
69
139
|
end
|
@@ -70,10 +70,15 @@ module Primer
|
|
70
70
|
render_erb_ignoring_markdown_code_fences(docs.base_docstring)
|
71
71
|
end
|
72
72
|
|
73
|
+
accessibility_docs =
|
74
|
+
if (accessibility_tag_text = docs.tags(:accessibility)&.first&.text)
|
75
|
+
render_erb_ignoring_markdown_code_fences(accessibility_tag_text)
|
76
|
+
end
|
77
|
+
|
73
78
|
memo[component] = {
|
74
79
|
"fully_qualified_name" => component.name,
|
75
80
|
"description" => description,
|
76
|
-
"accessibility_docs" =>
|
81
|
+
"accessibility_docs" => accessibility_docs,
|
77
82
|
"is_form_component" => docs.manifest_entry.form_component?,
|
78
83
|
"is_published" => docs.manifest_entry.published?,
|
79
84
|
"requires_js" => docs.manifest_entry.requires_js?,
|
@@ -18,10 +18,24 @@ module Primer
|
|
18
18
|
# @param variant [Symbol] select [medium, large]
|
19
19
|
# @param title [String] text
|
20
20
|
# @param description [String] text
|
21
|
-
|
21
|
+
# @param with_back_button [Boolean]
|
22
|
+
# @param back_button_size [Symbol] select [small, medium, large]
|
23
|
+
# @param with_breadcrumbs [Boolean]
|
24
|
+
def playground(
|
25
|
+
variant: :medium,
|
26
|
+
title: "Hello",
|
27
|
+
description: "Last updated 5 minutes ago by XYZ.",
|
28
|
+
with_back_button: false,
|
29
|
+
back_button_size: :medium,
|
30
|
+
with_breadcrumbs: false
|
31
|
+
)
|
32
|
+
breadcrumb_items = [{ href: "/foo", text: "Foo" }, { href: "/bar", text: "Bar" }, "Baz"]
|
33
|
+
|
22
34
|
render(Primer::OpenProject::PageHeader.new) do |header|
|
23
35
|
header.with_title(variant: variant) { title }
|
24
36
|
header.with_description { description }
|
37
|
+
header.with_back_button(href: "#", size: back_button_size, 'aria-label': "Back") if with_back_button
|
38
|
+
header.with_breadcrumbs(breadcrumb_items) if with_breadcrumbs
|
25
39
|
end
|
26
40
|
end
|
27
41
|
|
@@ -37,6 +51,30 @@ module Primer
|
|
37
51
|
def actions
|
38
52
|
render_with_template(locals: {})
|
39
53
|
end
|
54
|
+
|
55
|
+
# @label With back button
|
56
|
+
# @param href [String] text
|
57
|
+
# @param size [Symbol] select [small, medium, large]
|
58
|
+
# @param icon [String] select ["arrow-left", "chevron-left", "triangle-left"]
|
59
|
+
def back_button(href: "#", size: :medium, icon: "arrow-left")
|
60
|
+
render(Primer::OpenProject::PageHeader.new) do |header|
|
61
|
+
header.with_title { "Hello" }
|
62
|
+
header.with_back_button(href: href, size: size, icon: icon, 'aria-label': "Back")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# @label With breadcrumbs
|
67
|
+
def breadcrumbs
|
68
|
+
breadcrumb_items = [
|
69
|
+
{ href: "/foo", text: "Foo" },
|
70
|
+
"\u003ca href=\"/foo/bar\"\u003eBar\u003c/a\u003e",
|
71
|
+
"Baz"
|
72
|
+
]
|
73
|
+
render(Primer::OpenProject::PageHeader.new) do |header|
|
74
|
+
header.with_title { "A title" }
|
75
|
+
header.with_breadcrumbs(breadcrumb_items)
|
76
|
+
end
|
77
|
+
end
|
40
78
|
end
|
41
79
|
end
|
42
80
|
end
|
data/static/classes.json
CHANGED
@@ -435,6 +435,12 @@
|
|
435
435
|
"PageHeader-actions": [
|
436
436
|
"Primer::OpenProject::PageHeader"
|
437
437
|
],
|
438
|
+
"PageHeader-backButton": [
|
439
|
+
"Primer::OpenProject::PageHeader"
|
440
|
+
],
|
441
|
+
"PageHeader-breadcrumbs": [
|
442
|
+
"Primer::OpenProject::PageHeader"
|
443
|
+
],
|
438
444
|
"PageHeader-description": [
|
439
445
|
"Primer::OpenProject::PageHeader"
|
440
446
|
],
|
@@ -444,6 +450,9 @@
|
|
444
450
|
"PageHeader-title--large": [
|
445
451
|
"Primer::OpenProject::PageHeader"
|
446
452
|
],
|
453
|
+
"PageHeader-titleBar": [
|
454
|
+
"Primer::OpenProject::PageHeader"
|
455
|
+
],
|
447
456
|
"Popover": [
|
448
457
|
"Primer::Beta::Popover"
|
449
458
|
],
|
data/static/constants.json
CHANGED
@@ -1360,6 +1360,18 @@
|
|
1360
1360
|
]
|
1361
1361
|
},
|
1362
1362
|
"Primer::OpenProject::PageHeader": {
|
1363
|
+
"BACK_BUTTON_ICON_OPTIONS": [
|
1364
|
+
"arrow-left",
|
1365
|
+
"chevron-left",
|
1366
|
+
"triangle-left"
|
1367
|
+
],
|
1368
|
+
"BACK_BUTTON_SIZE_OPTIONS": [
|
1369
|
+
"small",
|
1370
|
+
"medium",
|
1371
|
+
"large"
|
1372
|
+
],
|
1373
|
+
"DEFAULT_BACK_BUTTON_ICON": "arrow-left",
|
1374
|
+
"DEFAULT_BACK_BUTTON_SIZE": "medium",
|
1363
1375
|
"DEFAULT_HEADER_VARIANT": "medium",
|
1364
1376
|
"HEADER_VARIANT_OPTIONS": [
|
1365
1377
|
"large",
|
data/static/info_arch.json
CHANGED
@@ -7062,7 +7062,7 @@
|
|
7062
7062
|
{
|
7063
7063
|
"fully_qualified_name": "Primer::Alpha::TabNav",
|
7064
7064
|
"description": "Use `TabNav` to style navigation with a tab-based selected state, typically used for navigation placed at the top of the page.\nFor panel navigation, use {{#link_to_component}}Primer::Alpha::TabPanels{{/link_to_component}} instead.",
|
7065
|
-
"accessibility_docs": "- By default, `TabNav` renders links within a `<nav>` element. `<nav>` has an\n implicit landmark role of `navigation` which should be reserved for main links.\n For all other set of links, set tag to `:div`.\n- See
|
7065
|
+
"accessibility_docs": "- By default, `TabNav` renders links within a `<nav>` element. `<nav>` has an\n implicit landmark role of `navigation` which should be reserved for main links.\n For all other set of links, set tag to `:div`.\n- See {{#link_to_component}}Primer::Alpha::Navigation::Tab{{/link_to_component}} for additional\n accessibility considerations.",
|
7066
7066
|
"is_form_component": false,
|
7067
7067
|
"is_published": true,
|
7068
7068
|
"requires_js": false,
|
@@ -8461,7 +8461,7 @@
|
|
8461
8461
|
{
|
8462
8462
|
"fully_qualified_name": "Primer::Alpha::UnderlineNav",
|
8463
8463
|
"description": "Use `UnderlineNav` to style navigation links with a minimal\nunderlined selected state, typically placed at the top\nof the page.\n\nFor panel navigation, use {{#link_to_component}}Primer::Alpha::UnderlinePanels{{/link_to_component}} instead.",
|
8464
|
-
"accessibility_docs": "- By default, `UnderlineNav` renders links within a `<nav>` element. `<nav>` has an\n implicit landmark role of `navigation` which should be reserved for main links.\n For all other set of links, set tag to `:div`.\n- See
|
8464
|
+
"accessibility_docs": "- By default, `UnderlineNav` renders links within a `<nav>` element. `<nav>` has an\n implicit landmark role of `navigation` which should be reserved for main links.\n For all other set of links, set tag to `:div`.\n- See {{#link_to_component}}Primer::Alpha::Navigation::Tab{{/link_to_component}} for additional\n accessibility considerations.",
|
8465
8465
|
"is_form_component": false,
|
8466
8466
|
"is_published": true,
|
8467
8467
|
"requires_js": false,
|
@@ -10189,7 +10189,7 @@
|
|
10189
10189
|
{
|
10190
10190
|
"fully_qualified_name": "Primer::Beta::BorderBox::Header",
|
10191
10191
|
"description": "`BorderBox::Header` is used inside `BorderBox` to render its header slot.",
|
10192
|
-
"accessibility_docs": "When using `header.with_title`, set `tag` to one of `h1`, `h2`, `h3`, etc. based on what is appropriate for the page context.
|
10192
|
+
"accessibility_docs": "When using `header.with_title`, set `tag` to one of `h1`, `h2`, `h3`, etc. based on what is appropriate for the page context. [Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)",
|
10193
10193
|
"is_form_component": false,
|
10194
10194
|
"is_published": true,
|
10195
10195
|
"requires_js": false,
|
@@ -11589,7 +11589,7 @@
|
|
11589
11589
|
{
|
11590
11590
|
"fully_qualified_name": "Primer::Beta::Heading",
|
11591
11591
|
"description": "`Heading` should be used to communicate page organization and hierarchy.\n\n- Set tag to one of `:h1`, `:h2`, `:h3`, `:h4`, `:h5`, `:h6` based on what is appropriate for the page context.\n- Use `Heading` as the title of a section or sub section.\n- Do not use `Heading` for styling alone. For simply styling text, consider using {{#link_to_component}}Primer::Beta::Text{{/link_to_component}} with relevant {{link_to_typography_docs}}\n such as `font_size` and `font_weight`.\n- Do not jump heading levels. For instance, do not follow a `<h1>` with an `<h3>`. Heading levels should increase by one in ascending order.",
|
11592
|
-
"accessibility_docs": "While sighted users rely on visual cues such as font size changes to determine what the heading is, assistive technology users rely on programatic cues that can be read out.\nWhen text on a page is visually implied to be a heading, ensure that it is coded as a heading. Additionally, visually implied heading level and coded heading level should be\nconsistent. [See WCAG success criteria: 1.3.1: Info and Relationships](https://www.w3.org/WAI/WCAG21/Understanding/info-and-relationships.html)\n\nHeadings allow assistive technology users to quickly navigate around a page. Navigation to text that is not meant to be a heading can be a confusing experience.\n
|
11592
|
+
"accessibility_docs": "While sighted users rely on visual cues such as font size changes to determine what the heading is, assistive technology users rely on programatic cues that can be read out.\nWhen text on a page is visually implied to be a heading, ensure that it is coded as a heading. Additionally, visually implied heading level and coded heading level should be\nconsistent. [See WCAG success criteria: 1.3.1: Info and Relationships](https://www.w3.org/WAI/WCAG21/Understanding/info-and-relationships.html)\n\nHeadings allow assistive technology users to quickly navigate around a page. Navigation to text that is not meant to be a heading can be a confusing experience.\n[Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)",
|
11593
11593
|
"is_form_component": false,
|
11594
11594
|
"is_published": true,
|
11595
11595
|
"requires_js": false,
|
@@ -13751,7 +13751,7 @@
|
|
13751
13751
|
{
|
13752
13752
|
"fully_qualified_name": "Primer::Beta::Subhead",
|
13753
13753
|
"description": "Use `Subhead` as the start of a section. The `:heading` slot will render an `<h2>` font-sized text.\n\n- Optionally set the `:description` slot to render a short description and the `:actions` slot for a related action.\n- Use a succinct, one-line description for the `:description` slot. For longer descriptions, omit the description slot and render a paragraph below the `Subhead`.\n- Use the actions slot to render a related action to the right of the heading. Use {{#link_to_component}}Primer::ButtonComponent{{/link_to_component}} or {{#link_to_component}}Primer::Beta::Link{{/link_to_component}}.",
|
13754
|
-
"accessibility_docs": "The `:heading` slot defaults to rendering a `<div>`. Update the tag to a heading element with the appropriate level to improve page navigation for assistive technologies.\n
|
13754
|
+
"accessibility_docs": "The `:heading` slot defaults to rendering a `<div>`. Update the tag to a heading element with the appropriate level to improve page navigation for assistive technologies.\n[Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)",
|
13755
13755
|
"is_form_component": false,
|
13756
13756
|
"is_published": true,
|
13757
13757
|
"requires_js": false,
|
@@ -14288,7 +14288,7 @@
|
|
14288
14288
|
{
|
14289
14289
|
"fully_qualified_name": "Primer::BlankslateComponent",
|
14290
14290
|
"description": "Use `Blankslate` when there is a lack of content within a page or section. Use as placeholder to tell users why something isn't there.",
|
14291
|
-
"accessibility_docs": "`Blankslate` renders an `<h3>` element for the title by default. Update the heading level based on what is appropriate for your page hierarchy by setting `title_tag`.\n
|
14291
|
+
"accessibility_docs": "`Blankslate` renders an `<h3>` element for the title by default. Update the heading level based on what is appropriate for your page hierarchy by setting `title_tag`.\n[Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)",
|
14292
14292
|
"is_form_component": false,
|
14293
14293
|
"is_published": true,
|
14294
14294
|
"requires_js": false,
|
@@ -15472,10 +15472,65 @@
|
|
15472
15472
|
"description": "{{link_to_system_arguments_docs}}"
|
15473
15473
|
}
|
15474
15474
|
]
|
15475
|
+
},
|
15476
|
+
{
|
15477
|
+
"name": "back_button",
|
15478
|
+
"description": "Optional back button prepend the title",
|
15479
|
+
"parameters": [
|
15480
|
+
{
|
15481
|
+
"name": "size",
|
15482
|
+
"type": "Symbol",
|
15483
|
+
"default": "N/A",
|
15484
|
+
"description": "One of `:large`, `:medium`, or `:small`."
|
15485
|
+
},
|
15486
|
+
{
|
15487
|
+
"name": "icon",
|
15488
|
+
"type": "String",
|
15489
|
+
"default": "N/A",
|
15490
|
+
"description": "One of `arrow-left`, `chevron-left`, or `triangle-left`."
|
15491
|
+
},
|
15492
|
+
{
|
15493
|
+
"name": "system_arguments",
|
15494
|
+
"type": "Hash",
|
15495
|
+
"default": "N/A",
|
15496
|
+
"description": "{{link_to_system_arguments_docs}}"
|
15497
|
+
}
|
15498
|
+
]
|
15499
|
+
},
|
15500
|
+
{
|
15501
|
+
"name": "breadcrumbs",
|
15502
|
+
"description": "Optional breadcrumbs above the title row",
|
15503
|
+
"parameters": [
|
15504
|
+
{
|
15505
|
+
"name": "items",
|
15506
|
+
"type": "Array<String, Hash>",
|
15507
|
+
"default": "N/A",
|
15508
|
+
"description": "Items is an array of strings, hash {href, text} or an anchor tag string"
|
15509
|
+
},
|
15510
|
+
{
|
15511
|
+
"name": "system_arguments",
|
15512
|
+
"type": "Hash",
|
15513
|
+
"default": "N/A",
|
15514
|
+
"description": "{{link_to_system_arguments_docs}}"
|
15515
|
+
}
|
15516
|
+
]
|
15475
15517
|
}
|
15476
15518
|
],
|
15477
15519
|
"methods": [
|
15520
|
+
{
|
15521
|
+
"name": "anchor_string_to_object",
|
15522
|
+
"description": "transform anchor tag strings to {href, text} objects\ne.g \"\\u003ca href=\\\"/admin\\\"\\u003eAdministration\\u003c/a\\u003e\"",
|
15523
|
+
"parameters": [
|
15524
|
+
|
15525
|
+
]
|
15526
|
+
},
|
15527
|
+
{
|
15528
|
+
"name": "anchor_tag_string?",
|
15529
|
+
"description": "Check if the item is an anchor tag string e.g \"\\u003ca href=\\\"/admin\\\"\\u003eAdministration\\u003c/a\\u003e\"",
|
15530
|
+
"parameters": [
|
15478
15531
|
|
15532
|
+
]
|
15533
|
+
}
|
15479
15534
|
],
|
15480
15535
|
"previews": [
|
15481
15536
|
{
|
@@ -15529,6 +15584,32 @@
|
|
15529
15584
|
"color-contrast"
|
15530
15585
|
]
|
15531
15586
|
}
|
15587
|
+
},
|
15588
|
+
{
|
15589
|
+
"preview_path": "primer/open_project/page_header/back_button",
|
15590
|
+
"name": "back_button",
|
15591
|
+
"snapshot": "false",
|
15592
|
+
"skip_rules": {
|
15593
|
+
"wont_fix": [
|
15594
|
+
"region"
|
15595
|
+
],
|
15596
|
+
"will_fix": [
|
15597
|
+
"color-contrast"
|
15598
|
+
]
|
15599
|
+
}
|
15600
|
+
},
|
15601
|
+
{
|
15602
|
+
"preview_path": "primer/open_project/page_header/breadcrumbs",
|
15603
|
+
"name": "breadcrumbs",
|
15604
|
+
"snapshot": "false",
|
15605
|
+
"skip_rules": {
|
15606
|
+
"wont_fix": [
|
15607
|
+
"region"
|
15608
|
+
],
|
15609
|
+
"will_fix": [
|
15610
|
+
"color-contrast"
|
15611
|
+
]
|
15612
|
+
}
|
15532
15613
|
}
|
15533
15614
|
],
|
15534
15615
|
"subcomponents": [
|
data/static/previews.json
CHANGED
@@ -4755,6 +4755,32 @@
|
|
4755
4755
|
"color-contrast"
|
4756
4756
|
]
|
4757
4757
|
}
|
4758
|
+
},
|
4759
|
+
{
|
4760
|
+
"preview_path": "primer/open_project/page_header/back_button",
|
4761
|
+
"name": "back_button",
|
4762
|
+
"snapshot": "false",
|
4763
|
+
"skip_rules": {
|
4764
|
+
"wont_fix": [
|
4765
|
+
"region"
|
4766
|
+
],
|
4767
|
+
"will_fix": [
|
4768
|
+
"color-contrast"
|
4769
|
+
]
|
4770
|
+
}
|
4771
|
+
},
|
4772
|
+
{
|
4773
|
+
"preview_path": "primer/open_project/page_header/breadcrumbs",
|
4774
|
+
"name": "breadcrumbs",
|
4775
|
+
"snapshot": "false",
|
4776
|
+
"skip_rules": {
|
4777
|
+
"wont_fix": [
|
4778
|
+
"region"
|
4779
|
+
],
|
4780
|
+
"will_fix": [
|
4781
|
+
"color-contrast"
|
4782
|
+
]
|
4783
|
+
}
|
4758
4784
|
}
|
4759
4785
|
]
|
4760
4786
|
},
|