openproject-primer_view_components 0.63.0 → 0.64.1
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 +4 -4
- data/CHANGELOG.md +20 -0
- data/app/assets/javascripts/components/primer/open_project/collapsible.d.ts +2 -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/alpha/dialog/header.html.erb +1 -1
- data/app/components/primer/alpha/dialog/header.rb +5 -0
- data/app/components/primer/alpha/include_fragment.rb +14 -1
- data/app/components/primer/alpha/select_panel.html.erb +1 -1
- data/app/components/primer/open_project/border_box/collapsible_header.css +1 -1
- data/app/components/primer/open_project/border_box/collapsible_header.css.json +2 -1
- data/app/components/primer/open_project/border_box/collapsible_header.css.map +1 -1
- data/app/components/primer/open_project/border_box/collapsible_header.html.erb +12 -1
- data/app/components/primer/open_project/border_box/collapsible_header.pcss +4 -0
- data/app/components/primer/open_project/border_box/collapsible_header.rb +16 -12
- data/app/components/primer/open_project/collapsible.d.ts +2 -0
- data/app/components/primer/open_project/collapsible.js +11 -0
- data/app/components/primer/open_project/collapsible.ts +10 -0
- data/app/components/primer/open_project/collapsible_section.html.erb +14 -2
- data/app/components/primer/open_project/collapsible_section.rb +5 -1
- data/app/components/primer/open_project/danger_dialog.html.erb +4 -0
- data/app/components/primer/open_project/feedback_dialog.html.erb +5 -0
- data/app/lib/primer/current_attributes.rb +9 -0
- data/lib/primer/view_components/version.rb +2 -2
- data/previews/primer/alpha/dialog_preview/with_header_close_button_label.html.erb +5 -0
- data/previews/primer/alpha/dialog_preview/without_header_close_button_label.html.erb +8 -0
- data/previews/primer/alpha/dialog_preview.rb +32 -0
- data/previews/primer/open_project/page_header_preview/playground.html.erb +1 -1
- data/previews/primer/open_project/sub_header_preview/action_menu_buttons.html.erb +1 -1
- data/static/arguments.json +25 -1
- data/static/classes.json +3 -0
- data/static/constants.json +6 -0
- data/static/info_arch.json +51 -1
- data/static/previews.json +26 -0
- metadata +7 -4
@@ -13,7 +13,7 @@
|
|
13
13
|
<% end %>
|
14
14
|
</div>
|
15
15
|
<div class="Overlay-actionWrap">
|
16
|
-
<%= render Primer::Beta::CloseButton.new(classes: "Overlay-closeButton", "data-close-dialog-id": @id) %>
|
16
|
+
<%= render Primer::Beta::CloseButton.new(classes: "Overlay-closeButton", "data-close-dialog-id": @id, aria: { label: @close_label }) %>
|
17
17
|
</div>
|
18
18
|
</div>
|
19
19
|
<%= filter %>
|
@@ -16,6 +16,8 @@ module Primer
|
|
16
16
|
}.freeze
|
17
17
|
VARIANT_OPTIONS = VARIANT_MAPPINGS.keys
|
18
18
|
|
19
|
+
DEFAULT_CLOSE_LABEL = "Close"
|
20
|
+
|
19
21
|
# Optional filter slot for adding a filter input to the header.
|
20
22
|
#
|
21
23
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
@@ -48,6 +50,7 @@ module Primer
|
|
48
50
|
# @param show_divider [Boolean] Show a divider between the header and body.
|
49
51
|
# @param visually_hide_title [Boolean] Visually hide the `title` while maintaining a label for assistive technologies.
|
50
52
|
# @param variant [Symbol] <%= one_of(Primer::Alpha::Dialog::Header::VARIANT_OPTIONS) %>
|
53
|
+
# @param close_label [String] The aria-label text of the close "x" button.
|
51
54
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
52
55
|
def initialize(
|
53
56
|
id:,
|
@@ -56,12 +59,14 @@ module Primer
|
|
56
59
|
show_divider: false,
|
57
60
|
visually_hide_title: false,
|
58
61
|
variant: DEFAULT_VARIANT,
|
62
|
+
close_label: DEFAULT_CLOSE_LABEL,
|
59
63
|
**system_arguments
|
60
64
|
)
|
61
65
|
@id = id
|
62
66
|
@title = title
|
63
67
|
@subtitle = subtitle
|
64
68
|
@visually_hide_title = visually_hide_title
|
69
|
+
@close_label = close_label
|
65
70
|
@system_arguments = deny_tag_argument(**system_arguments)
|
66
71
|
@system_arguments[:tag] = :div
|
67
72
|
|
@@ -8,14 +8,27 @@ module Primer
|
|
8
8
|
class IncludeFragment < Primer::Component
|
9
9
|
status :alpha
|
10
10
|
|
11
|
+
ALLOWED_LOADING_VALUES = [:lazy, :eager].freeze
|
12
|
+
DEFAULT_LOADING = :eager
|
13
|
+
|
11
14
|
# @param src [String] The URL from which to retrieve an HTML element fragment.
|
12
15
|
# @param loading [Symbol] <%= one_of([:lazy, :eager]) %>
|
16
|
+
# @param accept [String] What to send as the Accept header.
|
13
17
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
14
|
-
def initialize(src: nil, loading: :
|
18
|
+
def initialize(src: nil, loading: nil, accept: nil, **system_arguments)
|
15
19
|
@system_arguments = system_arguments
|
16
20
|
@system_arguments[:tag] = "include-fragment"
|
17
21
|
@system_arguments[:loading] = loading
|
18
22
|
@system_arguments[:src] = src
|
23
|
+
@system_arguments[:accept] = accept if accept
|
24
|
+
|
25
|
+
if loading
|
26
|
+
@system_arguments[:loading] = fetch_or_fallback(ALLOWED_LOADING_VALUES, loading.to_sym, DEFAULT_LOADING)
|
27
|
+
end
|
28
|
+
|
29
|
+
if Primer::CurrentAttributes.nonce
|
30
|
+
@system_arguments[:"data-nonce"] = Primer::CurrentAttributes.nonce
|
31
|
+
end
|
19
32
|
end
|
20
33
|
|
21
34
|
def call
|
@@ -50,7 +50,7 @@
|
|
50
50
|
<% end %>
|
51
51
|
<% end %>
|
52
52
|
<% end %>
|
53
|
-
<%= render Primer::Alpha::Dialog::Body.new(
|
53
|
+
<%= render Primer::Alpha::Dialog::Body.new(p: 0) do %>
|
54
54
|
<focus-group direction="vertical" mnemonics retain>
|
55
55
|
<live-region data-target="select-panel.liveRegion"></live-region>
|
56
56
|
<%= render(Primer::BaseComponent.new(
|
@@ -1 +1 @@
|
|
1
|
-
.CollapsibleHeader{align-items:center;cursor:pointer;display:flex}.Box:has(.CollapsibleHeader--collapsed){border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-width:var(--borderWidth-thicker)}.Box:has(.CollapsibleHeader--collapsed) .Box-body,.Box:has(.CollapsibleHeader--collapsed) .Box-footer,.Box:has(.CollapsibleHeader--collapsed) .Box-row{display:none}
|
1
|
+
.CollapsibleHeader{align-items:center;cursor:pointer;display:flex}.Box:has(.CollapsibleHeader--collapsed){border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-width:var(--borderWidth-thicker)}.Box:has(.CollapsibleHeader--collapsed) .Box-body,.Box:has(.CollapsibleHeader--collapsed) .Box-footer,.Box:has(.CollapsibleHeader--collapsed) .Box-row{display:none}.CollapsibleHeader--triggerArea{width:100%}
|
@@ -5,6 +5,7 @@
|
|
5
5
|
".Box:has(.CollapsibleHeader--collapsed)",
|
6
6
|
".Box:has(.CollapsibleHeader--collapsed) .Box-body",
|
7
7
|
".Box:has(.CollapsibleHeader--collapsed) .Box-footer",
|
8
|
-
".Box:has(.CollapsibleHeader--collapsed) .Box-row"
|
8
|
+
".Box:has(.CollapsibleHeader--collapsed) .Box-row",
|
9
|
+
".CollapsibleHeader--triggerArea"
|
9
10
|
]
|
10
11
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["collapsible_header.pcss"],"names":[],"mappings":"AAEA,mBAGI,kBAAmB,CAFnB,cAAe,CACf,YAEJ,CAEA,wCACI,2BAA4B,CAC5B,4BAA6B,CAC7B,8CAOJ,CALI,uJAGI,YACJ","file":"collapsible_header.css","sourcesContent":["/* CSS for BorderBox::CollapsibleHeader */\n\n.CollapsibleHeader {\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n\n.Box:has(.CollapsibleHeader--collapsed) {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-bottom-width: var(--borderWidth-thicker);\n\n & .Box-row,\n & .Box-body,\n & .Box-footer {\n display: none;\n }\n}\n"]}
|
1
|
+
{"version":3,"sources":["collapsible_header.pcss"],"names":[],"mappings":"AAEA,mBAGI,kBAAmB,CAFnB,cAAe,CACf,YAEJ,CAEA,wCACI,2BAA4B,CAC5B,4BAA6B,CAC7B,8CAOJ,CALI,uJAGI,YACJ,CAGJ,gCACI,UACJ","file":"collapsible_header.css","sourcesContent":["/* CSS for BorderBox::CollapsibleHeader */\n\n.CollapsibleHeader {\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n\n.Box:has(.CollapsibleHeader--collapsed) {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-bottom-width: var(--borderWidth-thicker);\n\n & .Box-row,\n & .Box-body,\n & .Box-footer {\n display: none;\n }\n}\n\n.CollapsibleHeader--triggerArea {\n width: 100%;\n}\n"]}
|
@@ -1,5 +1,16 @@
|
|
1
1
|
<%= render(Primer::BaseComponent.new(**@system_arguments)) do %>
|
2
|
-
<%= render(Primer::OpenProject::FlexLayout.new
|
2
|
+
<%= render(Primer::OpenProject::FlexLayout.new(
|
3
|
+
data: {
|
4
|
+
target: "collapsible-header.triggerElement",
|
5
|
+
action: "click:collapsible-header#toggle keydown:collapsible-header#toggleViaKeyboard"
|
6
|
+
},
|
7
|
+
tabindex: 0,
|
8
|
+
role: "button",
|
9
|
+
aria: {
|
10
|
+
expanded: !@collapsed,
|
11
|
+
},
|
12
|
+
classes: "CollapsibleHeader--triggerArea"
|
13
|
+
)) do |flex| %>
|
3
14
|
<%= flex.with_row do %>
|
4
15
|
<%= title %>
|
5
16
|
<% if count? %>
|
@@ -32,39 +32,43 @@ module Primer
|
|
32
32
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
33
33
|
renders_one :description, lambda { |**system_arguments, &block|
|
34
34
|
system_arguments[:color] ||= :subtle
|
35
|
+
system_arguments[:hidden] = @collapsed
|
36
|
+
|
35
37
|
system_arguments[:data] = merge_data(
|
36
38
|
system_arguments, {
|
37
|
-
|
39
|
+
data: {
|
38
40
|
targets: "collapsible-header.collapsibleElements"
|
39
41
|
}
|
40
42
|
}
|
41
43
|
)
|
42
|
-
system_arguments[:hidden] = @collapsed
|
43
44
|
|
44
45
|
Primer::Beta::Text.new(**system_arguments, &block)
|
45
46
|
}
|
46
47
|
|
47
|
-
|
48
|
+
# @param id [String] The unique ID of the collapsible header.
|
48
49
|
# @param collapsed [Boolean] Whether the header is collapsed on initial render.
|
49
50
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
50
|
-
def initialize(collapsed: false, box:, **system_arguments)
|
51
|
+
def initialize(id: self.class.generate_id, collapsed: false, box:, **system_arguments)
|
51
52
|
@collapsed = collapsed
|
52
53
|
@box = box
|
53
54
|
@system_arguments = system_arguments
|
54
|
-
|
55
|
+
@system_arguments[:id] = id
|
55
56
|
@system_arguments[:tag] = "collapsible-header"
|
56
57
|
@system_arguments[:classes] = class_names(
|
57
58
|
system_arguments[:classes],
|
58
59
|
"CollapsibleHeader",
|
59
60
|
"CollapsibleHeader--collapsed" => @collapsed
|
60
61
|
)
|
61
|
-
@
|
62
|
-
@system_arguments
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
62
|
+
if @collapsed
|
63
|
+
@system_arguments[:data] = merge_data(
|
64
|
+
@system_arguments, {
|
65
|
+
data: {
|
66
|
+
collapsed: @collapsed
|
67
|
+
}
|
68
|
+
}
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
68
72
|
end
|
69
73
|
|
70
74
|
private
|
@@ -1,8 +1,10 @@
|
|
1
1
|
export declare abstract class CollapsibleElement extends HTMLElement {
|
2
2
|
arrowDown: Element;
|
3
3
|
arrowUp: Element;
|
4
|
+
triggerElement: HTMLElement;
|
4
5
|
collapsibleElements: HTMLElement[];
|
5
6
|
collapsed: boolean;
|
7
|
+
toggleViaKeyboard(event: KeyboardEvent): void;
|
6
8
|
toggle(): void;
|
7
9
|
attributeChangedCallback(name: string): void;
|
8
10
|
hideAll(): void;
|
@@ -11,6 +11,12 @@ export class CollapsibleElement extends HTMLElement {
|
|
11
11
|
super(...arguments);
|
12
12
|
this.collapsed = false;
|
13
13
|
}
|
14
|
+
toggleViaKeyboard(event) {
|
15
|
+
if (event.code === 'Enter' || event.code === 'Space') {
|
16
|
+
event.preventDefault();
|
17
|
+
this.toggle();
|
18
|
+
}
|
19
|
+
}
|
14
20
|
toggle() {
|
15
21
|
this.collapsed = !this.collapsed;
|
16
22
|
}
|
@@ -28,6 +34,7 @@ export class CollapsibleElement extends HTMLElement {
|
|
28
34
|
// For whatever reason, setting `hidden` directly does not work on the SVGs
|
29
35
|
this.arrowDown?.removeAttribute('hidden');
|
30
36
|
this.arrowUp?.setAttribute('hidden', '');
|
37
|
+
this.triggerElement.setAttribute('aria-expanded', 'false');
|
31
38
|
for (const el of this.collapsibleElements) {
|
32
39
|
el.hidden = true;
|
33
40
|
}
|
@@ -36,6 +43,7 @@ export class CollapsibleElement extends HTMLElement {
|
|
36
43
|
expandAll() {
|
37
44
|
this.arrowUp?.removeAttribute('hidden');
|
38
45
|
this.arrowDown?.setAttribute('hidden', '');
|
46
|
+
this.triggerElement.setAttribute('aria-expanded', 'true');
|
39
47
|
for (const el of this.collapsibleElements) {
|
40
48
|
el.hidden = false;
|
41
49
|
}
|
@@ -48,6 +56,9 @@ __decorate([
|
|
48
56
|
__decorate([
|
49
57
|
target
|
50
58
|
], CollapsibleElement.prototype, "arrowUp", void 0);
|
59
|
+
__decorate([
|
60
|
+
target
|
61
|
+
], CollapsibleElement.prototype, "triggerElement", void 0);
|
51
62
|
__decorate([
|
52
63
|
targets
|
53
64
|
], CollapsibleElement.prototype, "collapsibleElements", void 0);
|
@@ -4,10 +4,18 @@ import {attr, target, targets} from '@github/catalyst'
|
|
4
4
|
export abstract class CollapsibleElement extends HTMLElement {
|
5
5
|
@target arrowDown: Element
|
6
6
|
@target arrowUp: Element
|
7
|
+
@target triggerElement: HTMLElement
|
7
8
|
@targets collapsibleElements: HTMLElement[]
|
8
9
|
|
9
10
|
@attr collapsed = false
|
10
11
|
|
12
|
+
toggleViaKeyboard(event: KeyboardEvent) {
|
13
|
+
if (event.code === 'Enter' || event.code === 'Space') {
|
14
|
+
event.preventDefault()
|
15
|
+
this.toggle()
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
11
19
|
toggle() {
|
12
20
|
this.collapsed = !this.collapsed
|
13
21
|
}
|
@@ -26,6 +34,7 @@ export abstract class CollapsibleElement extends HTMLElement {
|
|
26
34
|
// For whatever reason, setting `hidden` directly does not work on the SVGs
|
27
35
|
this.arrowDown?.removeAttribute('hidden')
|
28
36
|
this.arrowUp?.setAttribute('hidden', '')
|
37
|
+
this.triggerElement.setAttribute('aria-expanded', 'false')
|
29
38
|
|
30
39
|
for (const el of this.collapsibleElements) {
|
31
40
|
el.hidden = true
|
@@ -37,6 +46,7 @@ export abstract class CollapsibleElement extends HTMLElement {
|
|
37
46
|
expandAll() {
|
38
47
|
this.arrowUp?.removeAttribute('hidden')
|
39
48
|
this.arrowDown?.setAttribute('hidden', '')
|
49
|
+
this.triggerElement.setAttribute('aria-expanded', 'true')
|
40
50
|
|
41
51
|
for (const el of this.collapsibleElements) {
|
42
52
|
el.hidden = false
|
@@ -1,7 +1,14 @@
|
|
1
1
|
<%= render(Primer::BaseComponent.new(**@system_arguments)) do %>
|
2
2
|
<%= render(Primer::OpenProject::FlexLayout.new) do |flex| %>
|
3
3
|
<%= flex.with_row(classes: "CollapsibleSection--triggerArea",
|
4
|
-
|
4
|
+
id: @title_id,
|
5
|
+
tabindex: 0,
|
6
|
+
role: "button",
|
7
|
+
data: {
|
8
|
+
action: "click:collapsible-section#toggle keydown:collapsible-section#toggleViaKeyboard",
|
9
|
+
target: "collapsible-section.triggerElement"
|
10
|
+
},
|
11
|
+
aria: { expanded: !@collapsed, controls: @content_id }) do %>
|
5
12
|
<%= render(Primer::OpenProject::FlexLayout.new(display: :flex, align_items: :center)) do |header| %>
|
6
13
|
<%= header.with_column do %>
|
7
14
|
<%= title %>
|
@@ -18,7 +25,12 @@
|
|
18
25
|
<% end %>
|
19
26
|
<% end %>
|
20
27
|
<% end %>
|
21
|
-
<%= flex.with_row(hidden: @collapsed,
|
28
|
+
<%= flex.with_row(hidden: @collapsed,
|
29
|
+
mt: 3,
|
30
|
+
role: "region",
|
31
|
+
id: @content_id,
|
32
|
+
data: { targets: "collapsible-section.collapsibleElements" },
|
33
|
+
aria: { labelledby: @title_id }) do %>
|
22
34
|
<%= collapsible_content %>
|
23
35
|
<% end %>
|
24
36
|
<% end %>
|
@@ -47,13 +47,17 @@ module Primer
|
|
47
47
|
Primer::BaseComponent.new(tag: :div, **system_arguments)
|
48
48
|
}
|
49
49
|
|
50
|
+
# @param id [String] The unique ID of the collapsible section.
|
50
51
|
# @param collapsed [Boolean] Whether the section is collapsed on initial render.
|
51
52
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
52
|
-
def initialize(collapsed: false, **system_arguments)
|
53
|
+
def initialize(id: self.class.generate_id, collapsed: false, **system_arguments)
|
54
|
+
@title_id = "#{id}-title"
|
55
|
+
@content_id = "#{id}-content"
|
53
56
|
@collapsed = collapsed
|
54
57
|
|
55
58
|
@system_arguments = deny_tag_argument(**system_arguments)
|
56
59
|
@system_arguments[:tag] = "collapsible-section"
|
60
|
+
@system_arguments[:id] = id
|
57
61
|
@system_arguments[:classes] = class_names(
|
58
62
|
@system_arguments[:classes],
|
59
63
|
"CollapsibleSection",
|
@@ -1,10 +1,15 @@
|
|
1
1
|
<%= render @dialog do |dialog| %>
|
2
|
+
<% unless header.present? %>
|
3
|
+
<% dialog.with_header(close_label: I18n.t("button_close")) %>
|
4
|
+
<% end %>
|
5
|
+
|
2
6
|
<% dialog.with_body do %>
|
3
7
|
<%= feedback_message %>
|
4
8
|
<% if additional_details.present? %>
|
5
9
|
<%= additional_details %>
|
6
10
|
<% end %>
|
7
11
|
<% end %>
|
12
|
+
|
8
13
|
<% dialog.with_footer do %>
|
9
14
|
<% if footer.present? %>
|
10
15
|
<%= footer %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
# `Primer::CurrentAttributes` can be used by controllers to set request-bound data
|
5
|
+
# that can be propagated to components.
|
6
|
+
class CurrentAttributes < ActiveSupport::CurrentAttributes
|
7
|
+
attribute :nonce
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<%= render(Primer::Alpha::Dialog.new(id: "my-dialog", title: title, subtitle: subtitle, visually_hide_title: false)) do |dialog| %>
|
2
|
+
<% dialog.with_header(show_divider: show_divider, close_label: close_label) %>
|
3
|
+
<% dialog.with_show_button_content(button_text) %>
|
4
|
+
<% dialog.with_body_content("Hello World") %>
|
5
|
+
<% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= render(Primer::Alpha::Dialog.new(id: "my-dialog", title: title, subtitle: subtitle, visually_hide_title: false)) do |dialog| %>
|
2
|
+
<% dialog.with_header(show_divider: show_divider, close_scheme: :none) %>
|
3
|
+
<% dialog.with_show_button_content(button_text) %>
|
4
|
+
<% dialog.with_body_content("Hello World") %>
|
5
|
+
<% dialog.with_footer do %>
|
6
|
+
<%= render(Primer::Beta::Button.new(data: { "close-dialog-id": "my-dialog" })) { "Close" } %>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
@@ -302,6 +302,38 @@ module Primer
|
|
302
302
|
def with_header_filter
|
303
303
|
render_with_template(locals: {})
|
304
304
|
end
|
305
|
+
|
306
|
+
# @label With custom label for close button of header
|
307
|
+
#
|
308
|
+
# @param title [String] text
|
309
|
+
# @param subtitle [String] text
|
310
|
+
# @param button_text [String] text
|
311
|
+
# @param show_divider [Boolean] toggle
|
312
|
+
# @param close_label [String] text
|
313
|
+
def with_header_close_button_label(title: "Test Dialog", subtitle: nil, button_text: "Show Dialog", show_divider: true, close_label: "Close me!")
|
314
|
+
render_with_template(locals: {
|
315
|
+
title: title,
|
316
|
+
subtitle: subtitle,
|
317
|
+
button_text: button_text,
|
318
|
+
show_divider: show_divider,
|
319
|
+
close_label: close_label
|
320
|
+
})
|
321
|
+
end
|
322
|
+
|
323
|
+
# @label Without custom label for close button of header
|
324
|
+
#
|
325
|
+
# @param title [String] text
|
326
|
+
# @param subtitle [String] text
|
327
|
+
# @param button_text [String] text
|
328
|
+
# @param show_divider [Boolean] toggle
|
329
|
+
def without_header_close_button_label(title: "Test Dialog", subtitle: nil, button_text: "Show Dialog", show_divider: true)
|
330
|
+
render_with_template(locals: {
|
331
|
+
title: title,
|
332
|
+
subtitle: subtitle,
|
333
|
+
button_text: button_text,
|
334
|
+
show_divider: show_divider
|
335
|
+
})
|
336
|
+
end
|
305
337
|
end
|
306
338
|
end
|
307
339
|
end
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<%= header.with_breadcrumbs(breadcrumb_items) %>
|
11
11
|
<% if with_actions %>
|
12
12
|
<% header.with_action_icon_button(icon: 'pencil', mobile_icon: 'pencil', label: 'Edit') %>
|
13
|
-
<% header.with_action_menu(menu_arguments: { anchor_align: :end }, button_arguments: { icon: "
|
13
|
+
<% header.with_action_menu(menu_arguments: { anchor_align: :end }, button_arguments: { icon: "kebab-horizontal", "aria-label": "Menu" }) do |menu, button| %>
|
14
14
|
<% menu.with_item(label: "Subitem 1") do |item| %>
|
15
15
|
<% item.with_leading_visual_icon(icon: :unlock) %>
|
16
16
|
<% end %>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
<% component.with_action_component do %>
|
5
5
|
<%= render Primer::Alpha::ActionMenu.new(menu_id: "menu-1") do |menu|
|
6
|
-
menu.with_show_button(icon: :"
|
6
|
+
menu.with_show_button(icon: :"kebab-horizontal", "aria-label": "Menu")
|
7
7
|
menu.with_item(label: "Subitem 1") do |item|
|
8
8
|
item.with_leading_visual_icon(icon: :paste)
|
9
9
|
end
|
data/static/arguments.json
CHANGED
@@ -1070,6 +1070,12 @@
|
|
1070
1070
|
"default": "`:medium`",
|
1071
1071
|
"description": "One of `:large` or `:medium`."
|
1072
1072
|
},
|
1073
|
+
{
|
1074
|
+
"name": "close_label",
|
1075
|
+
"type": "String",
|
1076
|
+
"default": "`Close`",
|
1077
|
+
"description": "The aria-label text of the close \"x\" button."
|
1078
|
+
},
|
1073
1079
|
{
|
1074
1080
|
"name": "system_arguments",
|
1075
1081
|
"type": "Hash",
|
@@ -1374,9 +1380,15 @@
|
|
1374
1380
|
{
|
1375
1381
|
"name": "loading",
|
1376
1382
|
"type": "Symbol",
|
1377
|
-
"default": "
|
1383
|
+
"default": "`nil`",
|
1378
1384
|
"description": "One of `:eager` or `:lazy`."
|
1379
1385
|
},
|
1386
|
+
{
|
1387
|
+
"name": "accept",
|
1388
|
+
"type": "String",
|
1389
|
+
"default": "`nil`",
|
1390
|
+
"description": "What to send as the Accept header."
|
1391
|
+
},
|
1380
1392
|
{
|
1381
1393
|
"name": "system_arguments",
|
1382
1394
|
"type": "Hash",
|
@@ -5162,6 +5174,12 @@
|
|
5162
5174
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/border_box/collapsible_header.rb",
|
5163
5175
|
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/border_box/collapsible_header/default/",
|
5164
5176
|
"parameters": [
|
5177
|
+
{
|
5178
|
+
"name": "id",
|
5179
|
+
"type": "String",
|
5180
|
+
"default": "`self.class.generate_id`",
|
5181
|
+
"description": "The unique ID of the collapsible header."
|
5182
|
+
},
|
5165
5183
|
{
|
5166
5184
|
"name": "collapsed",
|
5167
5185
|
"type": "Boolean",
|
@@ -5222,6 +5240,12 @@
|
|
5222
5240
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/collapsible_section.rb",
|
5223
5241
|
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/collapsible_section/default/",
|
5224
5242
|
"parameters": [
|
5243
|
+
{
|
5244
|
+
"name": "id",
|
5245
|
+
"type": "String",
|
5246
|
+
"default": "`self.class.generate_id`",
|
5247
|
+
"description": "The unique ID of the collapsible section."
|
5248
|
+
},
|
5225
5249
|
{
|
5226
5250
|
"name": "collapsed",
|
5227
5251
|
"type": "Boolean",
|
data/static/classes.json
CHANGED
@@ -243,6 +243,9 @@
|
|
243
243
|
"CollapsibleHeader": [
|
244
244
|
"Primer::OpenProject::BorderBox::CollapsibleHeader"
|
245
245
|
],
|
246
|
+
"CollapsibleHeader--triggerArea": [
|
247
|
+
"Primer::OpenProject::BorderBox::CollapsibleHeader"
|
248
|
+
],
|
246
249
|
"CollapsibleSection--triggerArea": [
|
247
250
|
"Primer::OpenProject::CollapsibleSection"
|
248
251
|
],
|
data/static/constants.json
CHANGED
@@ -323,6 +323,7 @@
|
|
323
323
|
"GeneratedSlotMethods": "Primer::Alpha::Dialog::Footer::GeneratedSlotMethods"
|
324
324
|
},
|
325
325
|
"Primer::Alpha::Dialog::Header": {
|
326
|
+
"DEFAULT_CLOSE_LABEL": "Close",
|
326
327
|
"DEFAULT_VARIANT": "medium",
|
327
328
|
"GeneratedSlotMethods": "Primer::Alpha::Dialog::Header::GeneratedSlotMethods",
|
328
329
|
"VARIANT_MAPPINGS": {
|
@@ -392,6 +393,11 @@
|
|
392
393
|
"GeneratedSlotMethods": "Primer::Alpha::Image::GeneratedSlotMethods"
|
393
394
|
},
|
394
395
|
"Primer::Alpha::IncludeFragment": {
|
396
|
+
"ALLOWED_LOADING_VALUES": [
|
397
|
+
"lazy",
|
398
|
+
"eager"
|
399
|
+
],
|
400
|
+
"DEFAULT_LOADING": "eager",
|
395
401
|
"GeneratedSlotMethods": "Primer::Alpha::IncludeFragment::GeneratedSlotMethods"
|
396
402
|
},
|
397
403
|
"Primer::Alpha::Layout": {
|
data/static/info_arch.json
CHANGED
@@ -3646,6 +3646,32 @@
|
|
3646
3646
|
"color-contrast"
|
3647
3647
|
]
|
3648
3648
|
}
|
3649
|
+
},
|
3650
|
+
{
|
3651
|
+
"preview_path": "primer/alpha/dialog/with_header_close_button_label",
|
3652
|
+
"name": "with_header_close_button_label",
|
3653
|
+
"snapshot": "false",
|
3654
|
+
"skip_rules": {
|
3655
|
+
"wont_fix": [
|
3656
|
+
"region"
|
3657
|
+
],
|
3658
|
+
"will_fix": [
|
3659
|
+
"color-contrast"
|
3660
|
+
]
|
3661
|
+
}
|
3662
|
+
},
|
3663
|
+
{
|
3664
|
+
"preview_path": "primer/alpha/dialog/without_header_close_button_label",
|
3665
|
+
"name": "without_header_close_button_label",
|
3666
|
+
"snapshot": "false",
|
3667
|
+
"skip_rules": {
|
3668
|
+
"wont_fix": [
|
3669
|
+
"region"
|
3670
|
+
],
|
3671
|
+
"will_fix": [
|
3672
|
+
"color-contrast"
|
3673
|
+
]
|
3674
|
+
}
|
3649
3675
|
}
|
3650
3676
|
],
|
3651
3677
|
"subcomponents": [
|
@@ -3699,6 +3725,12 @@
|
|
3699
3725
|
"default": "`:medium`",
|
3700
3726
|
"description": "One of `:large` or `:medium`."
|
3701
3727
|
},
|
3728
|
+
{
|
3729
|
+
"name": "close_label",
|
3730
|
+
"type": "String",
|
3731
|
+
"default": "`Close`",
|
3732
|
+
"description": "The aria-label text of the close \"x\" button."
|
3733
|
+
},
|
3702
3734
|
{
|
3703
3735
|
"name": "system_arguments",
|
3704
3736
|
"type": "Hash",
|
@@ -4702,9 +4734,15 @@
|
|
4702
4734
|
{
|
4703
4735
|
"name": "loading",
|
4704
4736
|
"type": "Symbol",
|
4705
|
-
"default": "
|
4737
|
+
"default": "`nil`",
|
4706
4738
|
"description": "One of `:eager` or `:lazy`."
|
4707
4739
|
},
|
4740
|
+
{
|
4741
|
+
"name": "accept",
|
4742
|
+
"type": "String",
|
4743
|
+
"default": "`nil`",
|
4744
|
+
"description": "What to send as the Accept header."
|
4745
|
+
},
|
4708
4746
|
{
|
4709
4747
|
"name": "system_arguments",
|
4710
4748
|
"type": "Hash",
|
@@ -17652,6 +17690,12 @@
|
|
17652
17690
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/border_box/collapsible_header.rb",
|
17653
17691
|
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/border_box/collapsible_header/default/",
|
17654
17692
|
"parameters": [
|
17693
|
+
{
|
17694
|
+
"name": "id",
|
17695
|
+
"type": "String",
|
17696
|
+
"default": "`self.class.generate_id`",
|
17697
|
+
"description": "The unique ID of the collapsible header."
|
17698
|
+
},
|
17655
17699
|
{
|
17656
17700
|
"name": "collapsed",
|
17657
17701
|
"type": "Boolean",
|
@@ -17914,6 +17958,12 @@
|
|
17914
17958
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/collapsible_section.rb",
|
17915
17959
|
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/collapsible_section/default/",
|
17916
17960
|
"parameters": [
|
17961
|
+
{
|
17962
|
+
"name": "id",
|
17963
|
+
"type": "String",
|
17964
|
+
"default": "`self.class.generate_id`",
|
17965
|
+
"description": "The unique ID of the collapsible section."
|
17966
|
+
},
|
17917
17967
|
{
|
17918
17968
|
"name": "collapsed",
|
17919
17969
|
"type": "Boolean",
|