openproject-primer_view_components 0.22.2 → 0.24.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 +53 -0
- data/app/assets/javascripts/app/components/primer/alpha/action_list.d.ts +16 -0
- data/app/assets/javascripts/app/components/primer/beta/nav_list.d.ts +3 -0
- data/app/assets/javascripts/app/components/primer/primer.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/alpha/action_bar_element.js +4 -6
- data/app/components/primer/alpha/action_list/item.rb +19 -6
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.json +2 -0
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/action_list.d.ts +16 -0
- data/app/components/primer/alpha/action_list.html.erb +19 -17
- data/app/components/primer/alpha/action_list.js +69 -0
- data/app/components/primer/alpha/action_list.pcss +8 -0
- data/app/components/primer/alpha/action_list.ts +58 -0
- data/app/components/primer/alpha/action_menu/action_menu_element.js +12 -19
- data/app/components/primer/alpha/banner.css +1 -1
- data/app/components/primer/alpha/banner.css.map +1 -1
- data/app/components/primer/alpha/banner.pcss +4 -4
- data/app/components/primer/alpha/banner.rb +17 -3
- data/app/components/primer/alpha/dialog.css +1 -1
- data/app/components/primer/alpha/dialog.css.json +2 -0
- data/app/components/primer/alpha/dialog.css.map +1 -1
- data/app/components/primer/alpha/dialog.pcss +9 -0
- data/app/components/primer/alpha/dropdown.css +1 -1
- data/app/components/primer/alpha/dropdown.css.map +1 -1
- data/app/components/primer/alpha/dropdown.pcss +1 -1
- data/app/components/primer/alpha/modal_dialog.js +8 -10
- data/app/components/primer/alpha/segmented_control.js +2 -3
- data/app/components/primer/alpha/text_field.css +1 -1
- data/app/components/primer/alpha/text_field.css.json +2 -0
- data/app/components/primer/alpha/text_field.css.map +1 -1
- data/app/components/primer/alpha/text_field.pcss +10 -0
- data/app/components/primer/alpha/toggle_switch.rb +2 -2
- data/app/components/primer/alpha/tool_tip.js +5 -7
- data/app/components/primer/beta/auto_complete/auto_complete.html.erb +9 -9
- data/app/components/primer/beta/breadcrumbs.css +1 -1
- data/app/components/primer/beta/breadcrumbs.css.map +1 -1
- data/app/components/primer/beta/breadcrumbs.pcss +3 -1
- data/app/components/primer/beta/button.css +1 -1
- data/app/components/primer/beta/button.css.json +1 -1
- data/app/components/primer/beta/button.css.map +1 -1
- data/app/components/primer/beta/button.pcss +5 -5
- data/app/components/primer/beta/button_group.rb +53 -1
- data/app/components/primer/beta/flash.css +1 -1
- data/app/components/primer/beta/flash.css.map +1 -1
- data/app/components/primer/beta/flash.pcss +4 -4
- data/app/components/primer/beta/flash.rb +3 -1
- data/app/components/primer/beta/nav_list.d.ts +3 -0
- data/app/components/primer/beta/nav_list.html.erb +1 -1
- data/app/components/primer/beta/nav_list.js +31 -12
- data/app/components/primer/beta/nav_list.ts +18 -1
- data/app/components/primer/beta/nav_list_group_element.js +6 -4
- data/app/components/primer/beta/nav_list_group_element.ts +3 -0
- data/app/components/primer/beta/popover.css +1 -1
- data/app/components/primer/beta/popover.css.map +1 -1
- data/app/components/primer/beta/popover.pcss +3 -0
- data/app/components/primer/beta/popover.rb +0 -1
- data/app/components/primer/dialog_helper.js +5 -7
- data/app/components/primer/focus_group.js +9 -12
- data/app/components/primer/open_project/page_header.css +1 -1
- data/app/components/primer/open_project/page_header.css.json +2 -4
- data/app/components/primer/open_project/page_header.css.map +1 -1
- data/app/components/primer/open_project/page_header.html.erb +15 -3
- data/app/components/primer/open_project/page_header.pcss +4 -17
- data/app/components/primer/open_project/page_header.rb +17 -28
- data/app/components/primer/primer.d.ts +1 -0
- data/app/components/primer/primer.js +1 -0
- data/app/components/primer/primer.ts +1 -0
- data/app/forms/auto_complete_form.rb +18 -0
- data/app/forms/select_form.rb +10 -0
- data/lib/primer/deprecations.yml +5 -0
- data/lib/primer/forms/auto_complete.html.erb +6 -0
- data/lib/primer/forms/auto_complete.rb +56 -0
- data/lib/primer/forms/builder.rb +19 -0
- data/lib/primer/forms/check_box_group.html.erb +4 -4
- data/lib/primer/forms/check_box_group.rb +0 -3
- data/lib/primer/forms/dsl/auto_complete_input.rb +33 -0
- data/lib/primer/forms/dsl/check_box_group_input.rb +8 -0
- data/lib/primer/forms/dsl/input.rb +8 -2
- data/lib/primer/forms/dsl/input_methods.rb +9 -0
- data/lib/primer/forms/dsl/radio_button_group_input.rb +8 -0
- data/lib/primer/forms/dsl/select_input.rb +5 -1
- data/lib/primer/forms/form_control.rb +1 -2
- data/lib/primer/forms/primer_multi_input.js +2 -3
- data/lib/primer/forms/primer_text_field.js +4 -6
- data/lib/primer/forms/primer_text_field.ts +2 -2
- data/lib/primer/forms/radio_button_group.html.erb +4 -4
- data/lib/primer/forms/radio_button_group.rb +0 -3
- data/lib/primer/forms/select.html.erb +1 -0
- data/lib/primer/forms/select.rb +9 -5
- data/lib/primer/view_components/version.rb +2 -2
- data/previews/primer/alpha/action_list_preview.rb +42 -0
- data/previews/primer/alpha/select_preview.rb +12 -1
- data/previews/primer/alpha/text_area_preview.rb +7 -1
- data/previews/primer/alpha/text_field_preview.rb +7 -1
- data/previews/primer/beta/button_group_preview/with_menu_button.html.erb +7 -0
- data/previews/primer/beta/button_group_preview.rb +6 -0
- data/previews/primer/beta/nav_list_preview.rb +43 -0
- data/previews/primer/forms_preview/auto_complete_form.html.erb +3 -0
- data/previews/primer/forms_preview/select_form.html.erb +1 -1
- data/previews/primer/forms_preview.rb +2 -0
- data/previews/primer/open_project/page_header_preview/actions.html.erb +9 -7
- data/previews/primer/open_project/page_header_preview/context_bar_actions.html.erb +8 -6
- data/previews/primer/open_project/page_header_preview/playground.html.erb +4 -4
- data/previews/primer/open_project/page_header_preview.rb +11 -15
- data/static/arguments.json +30 -8
- data/static/audited_at.json +1 -0
- data/static/classes.json +2 -5
- data/static/constants.json +25 -13
- data/static/info_arch.json +226 -25
- data/static/previews.json +161 -5
- data/static/statuses.json +2 -1
- metadata +12 -3
- data/previews/primer/beta/button_group_preview/action_menus.html.erb +0 -8
@@ -1,6 +1,9 @@
|
|
1
1
|
export declare class NavListElement extends HTMLElement {
|
2
2
|
#private;
|
3
3
|
items: HTMLElement[];
|
4
|
+
topLevelList: HTMLElement;
|
5
|
+
connectedCallback(): void;
|
6
|
+
disconnectedCallback(): void;
|
4
7
|
selectItemById(itemId: string | null): boolean;
|
5
8
|
selectItemByHref(href: string | null): boolean;
|
6
9
|
selectItemByCurrentLocation(): boolean;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= render(Primer::BaseComponent.new(tag: :nav, **@system_arguments)) do %>
|
2
2
|
<%= heading %>
|
3
3
|
<nav-list>
|
4
|
-
<%= render(Primer::ConditionalWrapper.new(condition: render_outer_list?, tag: :ul, classes: "ActionListWrap")) do %>
|
4
|
+
<%= render(Primer::ConditionalWrapper.new(condition: render_outer_list?, tag: :ul, classes: "ActionListWrap", data: { target: "nav-list.topLevelList" })) do %>
|
5
5
|
<% items.each_with_index do |item, index| %>
|
6
6
|
<% if index > 0 && render_divider_between?(item, items[index - 1]) %>
|
7
7
|
<%= render(Primer::Alpha::ActionList::Divider.new) %>
|
@@ -4,18 +4,37 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
6
|
};
|
7
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
8
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
11
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
12
|
+
};
|
7
13
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8
14
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9
15
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
10
16
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
17
|
};
|
12
|
-
var _NavListElement_instances, _NavListElement_findSelectedNavItemById, _NavListElement_findSelectedNavItemByHref, _NavListElement_findSelectedNavItemByCurrentLocation, _NavListElement_select, _NavListElement_deselect, _NavListElement_findParentMenu;
|
18
|
+
var _NavListElement_instances, _NavListElement_truncationObserver, _NavListElement_findSelectedNavItemById, _NavListElement_findSelectedNavItemByHref, _NavListElement_findSelectedNavItemByCurrentLocation, _NavListElement_select, _NavListElement_deselect, _NavListElement_findParentMenu;
|
13
19
|
/* eslint-disable custom-elements/expose-class-on-global */
|
14
|
-
import { controller, targets } from '@github/catalyst';
|
20
|
+
import { controller, target, targets } from '@github/catalyst';
|
21
|
+
import { ActionListTruncationObserver } from '../alpha/action_list';
|
15
22
|
let NavListElement = class NavListElement extends HTMLElement {
|
16
23
|
constructor() {
|
17
24
|
super(...arguments);
|
18
25
|
_NavListElement_instances.add(this);
|
26
|
+
_NavListElement_truncationObserver.set(this, void 0);
|
27
|
+
}
|
28
|
+
connectedCallback() {
|
29
|
+
// groups are wrapped in <action-list>, which handles resizing on its own
|
30
|
+
if (this.topLevelList) {
|
31
|
+
__classPrivateFieldSet(this, _NavListElement_truncationObserver, new ActionListTruncationObserver(this.topLevelList), "f");
|
32
|
+
}
|
33
|
+
}
|
34
|
+
disconnectedCallback() {
|
35
|
+
if (this.topLevelList) {
|
36
|
+
__classPrivateFieldGet(this, _NavListElement_truncationObserver, "f").unobserve(this.topLevelList);
|
37
|
+
}
|
19
38
|
}
|
20
39
|
selectItemById(itemId) {
|
21
40
|
if (!itemId)
|
@@ -47,21 +66,19 @@ let NavListElement = class NavListElement extends HTMLElement {
|
|
47
66
|
}
|
48
67
|
// expand collapsible item onClick
|
49
68
|
expandItem(item) {
|
50
|
-
|
51
|
-
(_a = item.nextElementSibling) === null || _a === void 0 ? void 0 : _a.removeAttribute('data-hidden');
|
69
|
+
item.nextElementSibling?.removeAttribute('data-hidden');
|
52
70
|
item.setAttribute('aria-expanded', 'true');
|
53
71
|
}
|
54
72
|
collapseItem(item) {
|
55
|
-
|
56
|
-
(_a = item.nextElementSibling) === null || _a === void 0 ? void 0 : _a.setAttribute('data-hidden', '');
|
73
|
+
item.nextElementSibling?.setAttribute('data-hidden', '');
|
57
74
|
item.setAttribute('aria-expanded', 'false');
|
58
75
|
item.focus();
|
59
76
|
}
|
60
77
|
itemIsExpanded(item) {
|
61
|
-
if (
|
78
|
+
if (item?.tagName === 'A') {
|
62
79
|
return true;
|
63
80
|
}
|
64
|
-
return
|
81
|
+
return item?.getAttribute('aria-expanded') === 'true';
|
65
82
|
}
|
66
83
|
// expand/collapse item
|
67
84
|
handleItemWithSubItemClick(e) {
|
@@ -102,15 +119,15 @@ let NavListElement = class NavListElement extends HTMLElement {
|
|
102
119
|
e.stopPropagation();
|
103
120
|
}
|
104
121
|
};
|
122
|
+
_NavListElement_truncationObserver = new WeakMap();
|
105
123
|
_NavListElement_instances = new WeakSet();
|
106
124
|
_NavListElement_findSelectedNavItemById = function _NavListElement_findSelectedNavItemById(itemId) {
|
107
|
-
var _a;
|
108
125
|
// First we compare the selected link to data-item-id for each nav item
|
109
126
|
for (const navItem of this.items) {
|
110
127
|
if (navItem.classList.contains('ActionListItem--hasSubItem')) {
|
111
128
|
continue;
|
112
129
|
}
|
113
|
-
const keys =
|
130
|
+
const keys = navItem.getAttribute('data-item-id')?.split(' ') || [];
|
114
131
|
if (keys.includes(itemId)) {
|
115
132
|
return navItem;
|
116
133
|
}
|
@@ -154,10 +171,9 @@ _NavListElement_deselect = function _NavListElement_deselect(navItem) {
|
|
154
171
|
}
|
155
172
|
};
|
156
173
|
_NavListElement_findParentMenu = function _NavListElement_findParentMenu(navItem) {
|
157
|
-
var _a;
|
158
174
|
if (!navItem.classList.contains('ActionListItem--subItem'))
|
159
175
|
return null;
|
160
|
-
const parent =
|
176
|
+
const parent = navItem.closest('li.ActionListItem--hasSubItem')?.querySelector('button.ActionListContent');
|
161
177
|
if (parent) {
|
162
178
|
return parent;
|
163
179
|
}
|
@@ -168,6 +184,9 @@ _NavListElement_findParentMenu = function _NavListElement_findParentMenu(navItem
|
|
168
184
|
__decorate([
|
169
185
|
targets
|
170
186
|
], NavListElement.prototype, "items", void 0);
|
187
|
+
__decorate([
|
188
|
+
target
|
189
|
+
], NavListElement.prototype, "topLevelList", void 0);
|
171
190
|
NavListElement = __decorate([
|
172
191
|
controller
|
173
192
|
], NavListElement);
|
@@ -1,9 +1,26 @@
|
|
1
1
|
/* eslint-disable custom-elements/expose-class-on-global */
|
2
|
-
import {controller, targets} from '@github/catalyst'
|
2
|
+
import {controller, target, targets} from '@github/catalyst'
|
3
|
+
import {ActionListTruncationObserver} from '../alpha/action_list'
|
3
4
|
|
4
5
|
@controller
|
5
6
|
export class NavListElement extends HTMLElement {
|
6
7
|
@targets items: HTMLElement[]
|
8
|
+
@target topLevelList: HTMLElement
|
9
|
+
|
10
|
+
#truncationObserver: ActionListTruncationObserver
|
11
|
+
|
12
|
+
connectedCallback() {
|
13
|
+
// groups are wrapped in <action-list>, which handles resizing on its own
|
14
|
+
if (this.topLevelList) {
|
15
|
+
this.#truncationObserver = new ActionListTruncationObserver(this.topLevelList)
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
disconnectedCallback() {
|
20
|
+
if (this.topLevelList) {
|
21
|
+
this.#truncationObserver.unobserve(this.topLevelList)
|
22
|
+
}
|
23
|
+
}
|
7
24
|
|
8
25
|
selectItemById(itemId: string | null): boolean {
|
9
26
|
if (!itemId) return false
|
@@ -9,12 +9,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
11
|
};
|
12
|
-
var _NavListGroupElement_instances, _NavListGroupElement_parseHTML;
|
12
|
+
var _NavListGroupElement_instances, _NavListGroupElement_parseHTML, _NavListGroupElement_truncateObserver;
|
13
13
|
import { controller, target, targets } from '@github/catalyst';
|
14
|
+
import { ActionListTruncationObserver } from '../alpha/action_list';
|
14
15
|
let NavListGroupElement = class NavListGroupElement extends HTMLElement {
|
15
16
|
constructor() {
|
16
17
|
super(...arguments);
|
17
18
|
_NavListGroupElement_instances.add(this);
|
19
|
+
_NavListGroupElement_truncateObserver.set(this, new ActionListTruncationObserver(this));
|
18
20
|
}
|
19
21
|
connectedCallback() {
|
20
22
|
this.setShowMoreItemState();
|
@@ -44,7 +46,6 @@ let NavListGroupElement = class NavListGroupElement extends HTMLElement {
|
|
44
46
|
return this.showMoreItem.getAttribute('src') || '';
|
45
47
|
}
|
46
48
|
async showMore(e) {
|
47
|
-
var _a, _b;
|
48
49
|
e.preventDefault();
|
49
50
|
if (this.showMoreDisabled)
|
50
51
|
return;
|
@@ -69,11 +70,11 @@ let NavListGroupElement = class NavListGroupElement extends HTMLElement {
|
|
69
70
|
return;
|
70
71
|
}
|
71
72
|
const fragment = __classPrivateFieldGet(this, _NavListGroupElement_instances, "m", _NavListGroupElement_parseHTML).call(this, document, html);
|
72
|
-
|
73
|
+
fragment?.querySelector('li > a')?.setAttribute('data-targets', 'nav-list-group.focusMarkers');
|
73
74
|
const listId = e.target.closest('button').getAttribute('data-list-id');
|
74
75
|
const list = document.getElementById(listId);
|
75
76
|
list.append(fragment);
|
76
|
-
|
77
|
+
this.focusMarkers.pop()?.focus();
|
77
78
|
this.showMoreDisabled = false;
|
78
79
|
}
|
79
80
|
setShowMoreItemState() {
|
@@ -88,6 +89,7 @@ let NavListGroupElement = class NavListGroupElement extends HTMLElement {
|
|
88
89
|
}
|
89
90
|
}
|
90
91
|
};
|
92
|
+
_NavListGroupElement_truncateObserver = new WeakMap();
|
91
93
|
_NavListGroupElement_instances = new WeakSet();
|
92
94
|
_NavListGroupElement_parseHTML = function _NavListGroupElement_parseHTML(document, html) {
|
93
95
|
const template = document.createElement('template');
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import {controller, target, targets} from '@github/catalyst'
|
2
|
+
import {ActionListTruncationObserver} from '../alpha/action_list'
|
2
3
|
|
3
4
|
@controller
|
4
5
|
export class NavListGroupElement extends HTMLElement {
|
@@ -86,6 +87,8 @@ export class NavListGroupElement extends HTMLElement {
|
|
86
87
|
template.innerHTML = html
|
87
88
|
return document.importNode(template.content, true)
|
88
89
|
}
|
90
|
+
|
91
|
+
#truncateObserver = new ActionListTruncationObserver(this)
|
89
92
|
}
|
90
93
|
|
91
94
|
declare global {
|
@@ -1 +1 @@
|
|
1
|
-
.Popover{position:absolute;z-index:100}.Popover-message{background-color:var(--overlay-bgColor,var(--color-canvas-overlay));border:var(--borderWidth-thin,max(1px,.0625rem)) solid var(--borderColor-default,var(--color-border-default));border-radius:var(--borderRadius-medium,.375rem);margin-left:auto;margin-right:auto;position:relative;width:232px}.Popover-message:after,.Popover-message:before{content:"";display:inline-block;left:50%;position:absolute}.Popover-message:before{border:8px solid #0000;border-bottom:8px solid var(--borderColor-default,var(--color-border-default));margin-left:-9px;top:-16px}.Popover-message:after{border:7px solid #0000;border-bottom:7px solid var(--overlay-bgColor,var(--color-canvas-overlay));margin-left:-8px;top:-14px}.Popover-message--no-caret:after,.Popover-message--no-caret:before{display:none}.Popover-message--bottom-left:after,.Popover-message--bottom-left:before,.Popover-message--bottom-right:after,.Popover-message--bottom-right:before,.Popover-message--bottom:after,.Popover-message--bottom:before{border-bottom-color:#0000;top:auto}.Popover-message--bottom-left:before,.Popover-message--bottom-right:before,.Popover-message--bottom:before{border-top-color:var(--borderColor-default,var(--color-border-default));bottom:-16px}.Popover-message--bottom-left:after,.Popover-message--bottom-right:after,.Popover-message--bottom:after{border-top-color:var(--overlay-bgColor,var(--color-canvas-overlay));bottom:-14px}.Popover-message--bottom-right,.Popover-message--top-right{margin-right:0;right:-9px}.Popover-message--bottom-right:after,.Popover-message--bottom-right:before,.Popover-message--top-right:after,.Popover-message--top-right:before{left:auto;margin-left:0}.Popover-message--bottom-right:before,.Popover-message--top-right:before{right:20px}.Popover-message--bottom-right:after,.Popover-message--top-right:after{right:21px}.Popover-message--bottom-left,.Popover-message--top-left{left:-9px;margin-left:0}.Popover-message--bottom-left:after,.Popover-message--bottom-left:before,.Popover-message--top-left:after,.Popover-message--top-left:before{left:24px;margin-left:0}.Popover-message--bottom-left:after,.Popover-message--top-left:after{left:25px}.Popover-message--left-bottom:after,.Popover-message--left-bottom:before,.Popover-message--left-top:after,.Popover-message--left-top:before,.Popover-message--left:after,.Popover-message--left:before,.Popover-message--right-bottom:after,.Popover-message--right-bottom:before,.Popover-message--right-top:after,.Popover-message--right-top:before,.Popover-message--right:after,.Popover-message--right:before{border-bottom-color:#0000;left:auto;margin-left:0;top:50%}.Popover-message--left-bottom:before,.Popover-message--left-top:before,.Popover-message--left:before,.Popover-message--right-bottom:before,.Popover-message--right-top:before,.Popover-message--right:before{margin-top:-9px}.Popover-message--left-bottom:after,.Popover-message--left-top:after,.Popover-message--left:after,.Popover-message--right-bottom:after,.Popover-message--right-top:after,.Popover-message--right:after{margin-top:-8px}.Popover-message--right-bottom:before,.Popover-message--right-top:before,.Popover-message--right:before{border-left-color:var(--borderColor-default,var(--color-border-default));right:-16px}.Popover-message--right-bottom:after,.Popover-message--right-top:after,.Popover-message--right:after{border-left-color:var(--overlay-bgColor,var(--color-canvas-overlay));right:-14px}.Popover-message--left-bottom:before,.Popover-message--left-top:before,.Popover-message--left:before{border-right-color:var(--borderColor-default,var(--color-border-default));left:-16px}.Popover-message--left-bottom:after,.Popover-message--left-top:after,.Popover-message--left:after{border-right-color:var(--overlay-bgColor,var(--color-canvas-overlay));left:-14px}.Popover-message--left-top:after,.Popover-message--left-top:before,.Popover-message--right-top:after,.Popover-message--right-top:before{top:24px}.Popover-message--left-bottom:after,.Popover-message--left-bottom:before,.Popover-message--right-bottom:after,.Popover-message--right-bottom:before{top:auto}.Popover-message--left-bottom:before,.Popover-message--right-bottom:before{bottom:16px}.Popover-message--left-bottom:after,.Popover-message--right-bottom:after{bottom:17px}@media (min-width:544px){.Popover-message--large{min-width:320px}}@media (max-width:767.98px){.Popover{bottom:0!important;left:0!important;position:fixed;right:0!important;top:auto!important}.Popover-message{bottom:auto;left:auto;margin:var(--stack-gap-condensed,.5rem);right:auto;top:auto;width:auto!important}.Popover-message>.btn-octicon{padding:var(--control-medium-paddingInline-normal,.75rem)!important}.Popover-message:after,.Popover-message:before{display:none}}
|
1
|
+
.Popover{position:absolute;z-index:100}.Popover-message{background-color:var(--overlay-bgColor,var(--color-canvas-overlay));border:var(--borderWidth-thin,max(1px,.0625rem)) solid var(--borderColor-default,var(--color-border-default));border-radius:var(--borderRadius-medium,.375rem);box-shadow:var(--shadow-floating-legacy,var(--color-shadow-large))!important;margin-left:auto;margin-right:auto;position:relative;width:232px}.Popover-message:after,.Popover-message:before{content:"";display:inline-block;left:50%;position:absolute}.Popover-message:before{border:8px solid #0000;border-bottom:8px solid var(--borderColor-default,var(--color-border-default));margin-left:-9px;top:-16px}.Popover-message:after{border:7px solid #0000;border-bottom:7px solid var(--overlay-bgColor,var(--color-canvas-overlay));margin-left:-8px;top:-14px}.Popover-message--no-caret:after,.Popover-message--no-caret:before{display:none}.Popover-message--bottom-left:after,.Popover-message--bottom-left:before,.Popover-message--bottom-right:after,.Popover-message--bottom-right:before,.Popover-message--bottom:after,.Popover-message--bottom:before{border-bottom-color:#0000;top:auto}.Popover-message--bottom-left:before,.Popover-message--bottom-right:before,.Popover-message--bottom:before{border-top-color:var(--borderColor-default,var(--color-border-default));bottom:-16px}.Popover-message--bottom-left:after,.Popover-message--bottom-right:after,.Popover-message--bottom:after{border-top-color:var(--overlay-bgColor,var(--color-canvas-overlay));bottom:-14px}.Popover-message--bottom-right,.Popover-message--top-right{margin-right:0;right:-9px}.Popover-message--bottom-right:after,.Popover-message--bottom-right:before,.Popover-message--top-right:after,.Popover-message--top-right:before{left:auto;margin-left:0}.Popover-message--bottom-right:before,.Popover-message--top-right:before{right:20px}.Popover-message--bottom-right:after,.Popover-message--top-right:after{right:21px}.Popover-message--bottom-left,.Popover-message--top-left{left:-9px;margin-left:0}.Popover-message--bottom-left:after,.Popover-message--bottom-left:before,.Popover-message--top-left:after,.Popover-message--top-left:before{left:24px;margin-left:0}.Popover-message--bottom-left:after,.Popover-message--top-left:after{left:25px}.Popover-message--left-bottom:after,.Popover-message--left-bottom:before,.Popover-message--left-top:after,.Popover-message--left-top:before,.Popover-message--left:after,.Popover-message--left:before,.Popover-message--right-bottom:after,.Popover-message--right-bottom:before,.Popover-message--right-top:after,.Popover-message--right-top:before,.Popover-message--right:after,.Popover-message--right:before{border-bottom-color:#0000;left:auto;margin-left:0;top:50%}.Popover-message--left-bottom:before,.Popover-message--left-top:before,.Popover-message--left:before,.Popover-message--right-bottom:before,.Popover-message--right-top:before,.Popover-message--right:before{margin-top:-9px}.Popover-message--left-bottom:after,.Popover-message--left-top:after,.Popover-message--left:after,.Popover-message--right-bottom:after,.Popover-message--right-top:after,.Popover-message--right:after{margin-top:-8px}.Popover-message--right-bottom:before,.Popover-message--right-top:before,.Popover-message--right:before{border-left-color:var(--borderColor-default,var(--color-border-default));right:-16px}.Popover-message--right-bottom:after,.Popover-message--right-top:after,.Popover-message--right:after{border-left-color:var(--overlay-bgColor,var(--color-canvas-overlay));right:-14px}.Popover-message--left-bottom:before,.Popover-message--left-top:before,.Popover-message--left:before{border-right-color:var(--borderColor-default,var(--color-border-default));left:-16px}.Popover-message--left-bottom:after,.Popover-message--left-top:after,.Popover-message--left:after{border-right-color:var(--overlay-bgColor,var(--color-canvas-overlay));left:-14px}.Popover-message--left-top:after,.Popover-message--left-top:before,.Popover-message--right-top:after,.Popover-message--right-top:before{top:24px}.Popover-message--left-bottom:after,.Popover-message--left-bottom:before,.Popover-message--right-bottom:after,.Popover-message--right-bottom:before{top:auto}.Popover-message--left-bottom:before,.Popover-message--right-bottom:before{bottom:16px}.Popover-message--left-bottom:after,.Popover-message--right-bottom:after{bottom:17px}@media (min-width:544px){.Popover-message--large{min-width:320px}}@media (max-width:767.98px){.Popover{bottom:0!important;left:0!important;position:fixed;right:0!important;top:auto!important}.Popover-message{bottom:auto;left:auto;margin:var(--stack-gap-condensed,.5rem);right:auto;top:auto;width:auto!important}.Popover-message>.btn-octicon{padding:var(--control-medium-paddingInline-normal,.75rem)!important}.Popover-message:after,.Popover-message:before{display:none}}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["popover.pcss"],"names":[],"mappings":"AAEA,SACE,iBAAkB,CAClB,WACF,CAEA,iBAKE,mEAAwC,CACxC,6GAAgE,CAChE,gDAAyC,
|
1
|
+
{"version":3,"sources":["popover.pcss"],"names":[],"mappings":"AAEA,SACE,iBAAkB,CAClB,WACF,CAEA,iBAKE,mEAAwC,CACxC,6GAAgE,CAChE,gDAAyC,CAGzC,4EAA+E,CAN/E,gBAAiB,CADjB,iBAAkB,CAFlB,iBAAkB,CAClB,WAgCF,CArBE,+CAKE,UAAW,CADX,oBAAqB,CADrB,QAAS,CADT,iBAIF,CAEA,wBAIE,sBAA+C,CAA/C,8EAA+C,CAF/C,gBAAiB,CADjB,SAIF,CAEA,uBAIE,sBAA2C,CAA3C,0EAA2C,CAF3C,gBAAiB,CADjB,SAIF,CAKA,mEAEE,YACF,CAOA,mNAGE,yBAAgC,CADhC,QAEF,CAEA,2GAEE,uEAA4C,CAD5C,YAEF,CAEA,wGAEE,mEAAwC,CADxC,YAEF,CAIF,2DAGE,cAAe,CADf,UAgBF,CAbE,gJAEE,SAAU,CACV,aACF,CAEA,yEACE,UACF,CAEA,uEACE,UACF,CAIF,yDAEE,SAAU,CACV,aAWF,CATE,4IAEE,SAAU,CACV,aACF,CAEA,qEACE,SACF,CAUA,oZAKE,yBAAgC,CAFhC,SAAU,CACV,aAAc,CAFd,OAIF,CAEA,6MACE,eACF,CAEA,uMACE,eACF,CAOA,wGAEE,wEAA6C,CAD7C,WAEF,CAEA,qGAEE,oEAAyC,CADzC,WAEF,CAOA,qGAEE,yEAA8C,CAD9C,UAEF,CAEA,kGAEE,qEAA0C,CAD1C,UAEF,CAMA,wIAEE,QACF,CAMA,oJAEE,QACF,CAEA,2EACE,WACF,CAEA,yEACE,WACF,CAGF,yBACE,wBACE,eACF,CACF,CAKA,4BACE,SAIE,kBAAoB,CACpB,gBAAkB,CAJlB,cAAe,CAEf,iBAAmB,CADnB,kBAIF,CAEA,iBAGE,WAAY,CACZ,SAAU,CAEV,uCAAkC,CAJlC,UAAW,CADX,QAAS,CAIT,oBAEF,CAGA,8BACE,mEACF,CAGA,+CAEE,YACF,CACF","file":"popover.css","sourcesContent":["/* Popover */\n\n.Popover {\n position: absolute;\n z-index: 100;\n}\n\n.Popover-message {\n position: relative;\n width: 232px;\n margin-right: auto;\n margin-left: auto;\n background-color: var(--overlay-bgColor);\n border: var(--borderWidth-thin) solid var(--borderColor-default);\n border-radius: var(--borderRadius-medium);\n\n /* adding !important to override utility classes used in dotcom */\n box-shadow: var(--shadow-floating-legacy, var(--color-shadow-large)) !important;\n\n /* Carets */\n &::before,\n &::after {\n position: absolute;\n left: 50%;\n display: inline-block;\n content: '';\n }\n\n &::before {\n top: -16px;\n margin-left: -9px;\n border: 8px solid transparent;\n border-bottom-color: var(--borderColor-default);\n }\n\n &::after {\n top: -14px;\n margin-left: -8px;\n border: 7px solid transparent;\n border-bottom-color: var(--overlay-bgColor);\n }\n}\n\n/* No caret */\n.Popover-message--no-caret {\n &::before,\n &::after {\n display: none;\n }\n}\n\n/* Bottom-oriented carets */\n.Popover-message--bottom,\n.Popover-message--bottom-right,\n.Popover-message--bottom-left {\n &::before,\n &::after {\n top: auto;\n border-bottom-color: transparent;\n }\n\n &::before {\n bottom: -16px;\n border-top-color: var(--borderColor-default);\n }\n\n &::after {\n bottom: -14px;\n border-top-color: var(--overlay-bgColor);\n }\n}\n\n/* Top and Bottom: Right-oriented carets */\n.Popover-message--top-right,\n.Popover-message--bottom-right {\n right: -9px;\n margin-right: 0;\n\n &::before,\n &::after {\n left: auto;\n margin-left: 0;\n }\n\n &::before {\n right: 20px;\n }\n\n &::after {\n right: 21px;\n }\n}\n\n/* Top and Bottom: Left-oriented carets */\n.Popover-message--top-left,\n.Popover-message--bottom-left {\n left: -9px;\n margin-left: 0;\n\n &::before,\n &::after {\n left: 24px;\n margin-left: 0;\n }\n\n &::after {\n left: 25px;\n }\n}\n\n/* Right- and Left-oriented carets */\n.Popover-message--right,\n.Popover-message--right-top,\n.Popover-message--right-bottom,\n.Popover-message--left,\n.Popover-message--left-top,\n.Popover-message--left-bottom {\n &::before,\n &::after {\n top: 50%;\n left: auto;\n margin-left: 0;\n border-bottom-color: transparent;\n }\n\n &::before {\n margin-top: -9px;\n }\n\n &::after {\n margin-top: -8px;\n }\n}\n\n/* Right-oriented carets */\n.Popover-message--right,\n.Popover-message--right-top,\n.Popover-message--right-bottom {\n &::before {\n right: -16px;\n border-left-color: var(--borderColor-default);\n }\n\n &::after {\n right: -14px;\n border-left-color: var(--overlay-bgColor);\n }\n}\n\n/* Left-oriented carets */\n.Popover-message--left,\n.Popover-message--left-top,\n.Popover-message--left-bottom {\n &::before {\n left: -16px;\n border-right-color: var(--borderColor-default);\n }\n\n &::after {\n left: -14px;\n border-right-color: var(--overlay-bgColor);\n }\n}\n\n/* Right and Left: Top-oriented carets */\n.Popover-message--right-top,\n.Popover-message--left-top {\n &::before,\n &::after {\n top: 24px;\n }\n}\n\n/* Right and Left: Bottom-oriented carets */\n.Popover-message--right-bottom,\n.Popover-message--left-bottom {\n &::before,\n &::after {\n top: auto;\n }\n\n &::before {\n bottom: 16px;\n }\n\n &::after {\n bottom: 17px;\n }\n}\n\n@media (min-width: 544px) {\n .Popover-message--large {\n min-width: 320px;\n }\n}\n\n/* Responsive Popover\n** For < md it will show full-width anchored to the bottom */\n\n@media (max-width: 767.98px) {\n .Popover {\n position: fixed;\n top: auto !important;\n right: 0 !important;\n bottom: 0 !important;\n left: 0 !important;\n }\n\n .Popover-message {\n top: auto;\n right: auto;\n bottom: auto;\n left: auto;\n width: auto !important;\n margin: var(--stack-gap-condensed);\n }\n\n /* Increase tap area for touch input */\n .Popover-message > .btn-octicon {\n padding: var(--control-medium-paddingInline-normal) !important;\n }\n\n /* Remove caret */\n .Popover-message::after,\n .Popover-message::before {\n display: none;\n }\n}\n"]}
|
@@ -14,6 +14,9 @@
|
|
14
14
|
border: var(--borderWidth-thin) solid var(--borderColor-default);
|
15
15
|
border-radius: var(--borderRadius-medium);
|
16
16
|
|
17
|
+
/* adding !important to override utility classes used in dotcom */
|
18
|
+
box-shadow: var(--shadow-floating-legacy, var(--color-shadow-large)) !important;
|
19
|
+
|
17
20
|
/* Carets */
|
18
21
|
&::before,
|
19
22
|
&::after {
|
@@ -11,13 +11,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
11
11
|
};
|
12
12
|
var _DialogHelperElement_abortController;
|
13
13
|
function dialogInvokerButtonHandler(event) {
|
14
|
-
var _a;
|
15
14
|
const target = event.target;
|
16
|
-
const button = target
|
15
|
+
const button = target?.closest('button');
|
17
16
|
if (!button || button.hasAttribute('disabled') || button.getAttribute('aria-disabled') === 'true')
|
18
17
|
return;
|
19
18
|
// If the user is clicking a valid dialog trigger
|
20
|
-
let dialogId = button
|
19
|
+
let dialogId = button?.getAttribute('data-show-dialog-id');
|
21
20
|
if (dialogId) {
|
22
21
|
const dialog = document.getElementById(dialogId);
|
23
22
|
if (dialog instanceof HTMLDialogElement) {
|
@@ -36,7 +35,7 @@ function dialogInvokerButtonHandler(event) {
|
|
36
35
|
let node = button;
|
37
36
|
let fixed = false;
|
38
37
|
while (node) {
|
39
|
-
node =
|
38
|
+
node = node.parentElement?.closest('[popover]:not(:popover-open)');
|
40
39
|
if (node && node.popover === 'auto') {
|
41
40
|
node.classList.add('dialog-inside-popover-fix');
|
42
41
|
node.popover = 'manual';
|
@@ -93,14 +92,13 @@ export class DialogHelperElement extends HTMLElement {
|
|
93
92
|
}).observe(this, { subtree: true, attributeFilter: ['open'] });
|
94
93
|
}
|
95
94
|
disconnectedCallback() {
|
96
|
-
|
97
|
-
(_a = __classPrivateFieldGet(this, _DialogHelperElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
|
95
|
+
__classPrivateFieldGet(this, _DialogHelperElement_abortController, "f")?.abort();
|
98
96
|
}
|
99
97
|
handleEvent(event) {
|
100
98
|
const target = event.target;
|
101
99
|
const dialog = this.dialog;
|
102
100
|
// The click target _must_ be the dialog element itself, and not elements underneath or inside.
|
103
|
-
if (target !== dialog || !
|
101
|
+
if (target !== dialog || !dialog?.open)
|
104
102
|
return;
|
105
103
|
const rect = dialog.getBoundingClientRect();
|
106
104
|
const clickWasInsideDialog = rect.top <= event.clientY &&
|
@@ -13,7 +13,7 @@ var _FocusGroupElement_instances, _FocusGroupElement_retainSignal, _FocusGroupEl
|
|
13
13
|
import '@oddbird/popover-polyfill';
|
14
14
|
const validSelectors = ['[role="menuitem"]', '[role="menuitemcheckbox"]', '[role="menuitemradio"]'];
|
15
15
|
const menuItemSelector = validSelectors.map(selector => `:not([hidden]) > ${selector}`).join(', ');
|
16
|
-
const getMnemonicFor = (item) =>
|
16
|
+
const getMnemonicFor = (item) => item.textContent?.trim()[0].toLowerCase();
|
17
17
|
const printable = /^\S$/;
|
18
18
|
class FocusGroupElement extends HTMLElement {
|
19
19
|
constructor() {
|
@@ -54,26 +54,23 @@ class FocusGroupElement extends HTMLElement {
|
|
54
54
|
this.addEventListener('focusin', this, { signal });
|
55
55
|
}
|
56
56
|
disconnectedCallback() {
|
57
|
-
|
58
|
-
(_a = __classPrivateFieldGet(this, _FocusGroupElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
|
57
|
+
__classPrivateFieldGet(this, _FocusGroupElement_abortController, "f")?.abort();
|
59
58
|
}
|
60
59
|
handleEvent(event) {
|
61
|
-
var _a;
|
62
60
|
const { direction, nowrap } = this;
|
63
61
|
if (event.type === 'focusin') {
|
64
62
|
if (this.retain && event.target instanceof Element && event.target.matches(menuItemSelector)) {
|
65
|
-
|
63
|
+
__classPrivateFieldGet(this, _FocusGroupElement_retainSignal, "f")?.abort();
|
66
64
|
const { signal } = (__classPrivateFieldSet(this, _FocusGroupElement_retainSignal, new AbortController(), "f"));
|
67
65
|
for (const item of __classPrivateFieldGet(this, _FocusGroupElement_instances, "a", _FocusGroupElement_items_get)) {
|
68
66
|
item.setAttribute('tabindex', item === event.target ? '0' : '-1');
|
69
67
|
const popover = event.target.closest('[popover]');
|
70
|
-
if (item === event.target &&
|
68
|
+
if (item === event.target && popover?.popover === 'auto' && popover.closest('focus-group') === this) {
|
71
69
|
popover.addEventListener('toggle', (toggleEvent) => {
|
72
|
-
var _a, _b;
|
73
70
|
if (!(toggleEvent.target instanceof Element))
|
74
71
|
return;
|
75
72
|
if (toggleEvent.newState === 'closed') {
|
76
|
-
|
73
|
+
__classPrivateFieldGet(this, _FocusGroupElement_retainSignal, "f")?.abort();
|
77
74
|
item.setAttribute('tabindex', '-1');
|
78
75
|
if (popover.id) {
|
79
76
|
const invoker = this.querySelector(`[popovertarget="${popover.id}"]`);
|
@@ -81,7 +78,7 @@ class FocusGroupElement extends HTMLElement {
|
|
81
78
|
invoker.setAttribute('tabindex', '0');
|
82
79
|
}
|
83
80
|
else {
|
84
|
-
|
81
|
+
__classPrivateFieldGet(this, _FocusGroupElement_instances, "a", _FocusGroupElement_items_get)[0]?.setAttribute('tabindex', '0');
|
85
82
|
}
|
86
83
|
}
|
87
84
|
}
|
@@ -146,13 +143,13 @@ class FocusGroupElement extends HTMLElement {
|
|
146
143
|
let el = focusEl;
|
147
144
|
do {
|
148
145
|
el = el.closest(`[popover]:not(:popover-open)`);
|
149
|
-
if (
|
146
|
+
if (el?.popover === 'auto' && !['ArrowRight', 'ArrowLeft'].includes(event.key)) {
|
150
147
|
el.showPopover();
|
151
148
|
}
|
152
|
-
el =
|
149
|
+
el = el?.parentElement || null;
|
153
150
|
} while (el);
|
154
151
|
}
|
155
|
-
focusEl
|
152
|
+
focusEl?.focus();
|
156
153
|
}
|
157
154
|
}
|
158
155
|
}
|
@@ -1 +1 @@
|
|
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)}
|
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)}.PageHeader-contextBar,.PageHeader-titleBar{align-items:center;display:flex;flex-flow:row;justify-content:flex-end}.PageHeader-titleBar{margin-bottom:var(--space-xsmall,.25rem)}.PageHeader-title{flex:1 1 auto;font-size:var(--text-title-size-medium,1.25rem);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{align-items:center;display:flex;justify-content:flex-end}.PageHeader-breadcrumbs{display:block;margin-bottom:var(--base-size-8,.5rem);padding-bottom:var(--base-size-4,.25rem);width:100%}.PageHeader-leadingAction{margin-right:var(--base-size-4,.25rem);margin-top:2px}.PageHeader-parentLink{flex:1 1 auto}
|
@@ -8,10 +8,8 @@
|
|
8
8
|
".PageHeader-title--large",
|
9
9
|
".PageHeader-description",
|
10
10
|
".PageHeader-actions",
|
11
|
-
".PageHeader-actions+.PageHeader-description",
|
12
11
|
".PageHeader-breadcrumbs",
|
13
|
-
".PageHeader-
|
14
|
-
".PageHeader-parentLink"
|
15
|
-
".PageHeader-contextBarActions"
|
12
|
+
".PageHeader-leadingAction",
|
13
|
+
".PageHeader-parentLink"
|
16
14
|
]
|
17
15
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["page_header.pcss"],"names":[],"mappings":"AAEA,YAIE,gHAAqE,CAHrE,YAAa,CAIb,gBAAiB,CAFjB,0CAAsC,CADtC,
|
1
|
+
{"version":3,"sources":["page_header.pcss"],"names":[],"mappings":"AAEA,YAIE,gHAAqE,CAHrE,YAAa,CAIb,gBAAiB,CAFjB,0CAAsC,CADtC,mDAIF,CASA,4CAHE,kBAAmB,CAHnB,YAAa,CACb,aAAc,CACd,wBAUF,CANA,qBAKE,wCACF,CAEA,kBAGE,aAAc,CAFd,+CAAwC,CACxC,8CAEF,CAEA,yBACE,2CACF,CAGA,wBAEE,gDAA2B,CAC3B,WAAY,CAFZ,8CAGF,CAEA,oBAGE,kBAAmB,CADnB,YAAa,CADb,wBAGF,CAEA,wBACE,aAAc,CAEd,sCAAiC,CACjC,wCAAkC,CAFlC,UAGF,CAEA,0BAEE,sCAAgC,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-contextBar {\n display: flex;\n flex-flow: row;\n justify-content: flex-end;\n align-items: center;\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(--space-xsmall);\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-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 margin-bottom: var(--base-size-8);\n padding-bottom: var(--base-size-4);\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"]}
|
@@ -3,14 +3,26 @@
|
|
3
3
|
<div class="PageHeader-contextBar">
|
4
4
|
<%= parent_link %>
|
5
5
|
<%= breadcrumbs %>
|
6
|
-
|
6
|
+
<% if context_bar_actions.any? %>
|
7
|
+
<%= render Primer::BaseComponent.new(tag: :div, classes: 'PageHeader-contextBarActions', display: DEFAULT_CONTEXT_BAR_ACTIONS_DISPLAY, align_items: :center) do %>
|
8
|
+
<% context_bar_actions.each do |action| %>
|
9
|
+
<%= action %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
7
13
|
</div>
|
8
14
|
<% end %>
|
9
15
|
|
10
16
|
<div class="PageHeader-titleBar">
|
11
|
-
<%=
|
17
|
+
<%= leading_action %>
|
12
18
|
<%= title %>
|
13
|
-
|
19
|
+
<% if actions.any? %>
|
20
|
+
<div class="PageHeader-actions">
|
21
|
+
<% actions.each do |action| %>
|
22
|
+
<%= action %>
|
23
|
+
<% end %>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
14
26
|
</div>
|
15
27
|
|
16
28
|
<%= description %>
|
@@ -6,10 +6,6 @@
|
|
6
6
|
margin-bottom: var(--stack-gap-normal);
|
7
7
|
border-bottom: var(--borderWidth-thin) solid var(--borderColor-muted);
|
8
8
|
flex-flow: column;
|
9
|
-
|
10
|
-
@media (max-width: 767.98px) {
|
11
|
-
border-bottom: 0;
|
12
|
-
}
|
13
9
|
}
|
14
10
|
|
15
11
|
.PageHeader-contextBar {
|
@@ -24,10 +20,11 @@
|
|
24
20
|
flex-flow: row;
|
25
21
|
justify-content: flex-end;
|
26
22
|
align-items: center; /* Keep back button vertically aligned. */
|
23
|
+
margin-bottom: var(--space-xsmall);
|
27
24
|
}
|
28
25
|
|
29
26
|
.PageHeader-title {
|
30
|
-
font-size:
|
27
|
+
font-size: var(--text-title-size-medium);
|
31
28
|
font-weight: var(--base-text-weight-normal);
|
32
29
|
flex: 1 1 auto;
|
33
30
|
}
|
@@ -43,15 +40,10 @@
|
|
43
40
|
flex: 1 100%;
|
44
41
|
}
|
45
42
|
|
46
|
-
/* Add 1 or 2 buttons to the right of the heading */
|
47
43
|
.PageHeader-actions {
|
48
|
-
margin: 0 0 0 var(--base-size-4);
|
49
44
|
justify-content: flex-end;
|
50
45
|
display: flex;
|
51
|
-
|
52
|
-
& + .PageHeader-description {
|
53
|
-
margin-top: var(--base-size-4);
|
54
|
-
}
|
46
|
+
align-items: center;
|
55
47
|
}
|
56
48
|
|
57
49
|
.PageHeader-breadcrumbs {
|
@@ -61,16 +53,11 @@
|
|
61
53
|
padding-bottom: var(--base-size-4);
|
62
54
|
}
|
63
55
|
|
64
|
-
.PageHeader-
|
56
|
+
.PageHeader-leadingAction {
|
65
57
|
margin-top: 2px; /* to center align with label */
|
66
58
|
margin-right: var(--base-size-4);
|
67
59
|
}
|
68
60
|
|
69
61
|
.PageHeader-parentLink {
|
70
62
|
flex: 1 1 auto;
|
71
|
-
margin-bottom: var(--base-size-4);
|
72
63
|
}
|
73
|
-
|
74
|
-
.PageHeader-contextBarActions {
|
75
|
-
margin: 0 0 0 var(--base-size-4);
|
76
|
-
}
|
@@ -5,18 +5,11 @@ module Primer
|
|
5
5
|
# A ViewComponent PageHeader inspired by the primer react variant
|
6
6
|
class PageHeader < Primer::Component
|
7
7
|
HEADING_TAG_OPTIONS = [:h1, :h2, :h3, :h4, :h5, :h6].freeze
|
8
|
-
HEADING_TAG_FALLBACK = :
|
8
|
+
HEADING_TAG_FALLBACK = :h1
|
9
9
|
|
10
|
-
DEFAULT_HEADER_VARIANT = :
|
10
|
+
DEFAULT_HEADER_VARIANT = :medium
|
11
11
|
HEADER_VARIANT_OPTIONS = [
|
12
|
-
|
13
|
-
DEFAULT_HEADER_VARIANT
|
14
|
-
].freeze
|
15
|
-
|
16
|
-
DEFAULT_BACK_BUTTON_SIZE = :medium
|
17
|
-
BACK_BUTTON_SIZE_OPTIONS = [
|
18
|
-
:small,
|
19
|
-
DEFAULT_BACK_BUTTON_SIZE,
|
12
|
+
DEFAULT_HEADER_VARIANT,
|
20
13
|
:large
|
21
14
|
].freeze
|
22
15
|
|
@@ -27,10 +20,10 @@ module Primer
|
|
27
20
|
"triangle-left"
|
28
21
|
].freeze
|
29
22
|
|
30
|
-
|
23
|
+
DEFAULT_LEADING_ACTION_DISPLAY = [:none, :flex].freeze
|
31
24
|
DEFAULT_BREADCRUMBS_DISPLAY = [:none, :flex].freeze
|
32
25
|
DEFAULT_PARENT_LINK_DISPLAY = [:block, :none].freeze
|
33
|
-
DEFAULT_CONTEXT_BAR_ACTIONS_DISPLAY = [:
|
26
|
+
DEFAULT_CONTEXT_BAR_ACTIONS_DISPLAY = [:flex, :none].freeze
|
34
27
|
|
35
28
|
status :open_project
|
36
29
|
|
@@ -61,10 +54,10 @@ module Primer
|
|
61
54
|
# Actions
|
62
55
|
#
|
63
56
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
64
|
-
|
57
|
+
renders_many :actions, lambda { |**system_arguments|
|
65
58
|
deny_tag_argument(**system_arguments)
|
66
59
|
system_arguments[:tag] = :div
|
67
|
-
system_arguments[:
|
60
|
+
system_arguments[:ml] ||= 2
|
68
61
|
|
69
62
|
Primer::BaseComponent.new(**system_arguments)
|
70
63
|
}
|
@@ -73,35 +66,31 @@ module Primer
|
|
73
66
|
# By default shown on narrow screens. Can be overridden with system_argument: display
|
74
67
|
#
|
75
68
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
76
|
-
|
69
|
+
renders_many :context_bar_actions, lambda { |**system_arguments|
|
77
70
|
deny_tag_argument(**system_arguments)
|
78
71
|
system_arguments[:tag] = :div
|
79
|
-
system_arguments[:
|
80
|
-
system_arguments[:display] ||= DEFAULT_CONTEXT_BAR_ACTIONS_DISPLAY
|
72
|
+
system_arguments[:ml] ||= 2
|
81
73
|
|
82
74
|
Primer::BaseComponent.new(**system_arguments)
|
83
75
|
}
|
84
76
|
|
85
|
-
# Optional
|
77
|
+
# Optional leading action prepend the title
|
86
78
|
# By default shown on wider screens. Can be overridden with system_argument: display
|
87
79
|
#
|
88
|
-
# @param
|
89
|
-
# @param icon [String] <%= one_of(Primer::OpenProject::PageHeader::BACK_BUTTON_ICON_OPTIONS) %>
|
80
|
+
# @param icon [Symbol] The name of an <%= link_to_octicons %> icon to use.
|
90
81
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
91
|
-
renders_one :
|
92
|
-
|
93
|
-
icon: DEFAULT_BACK_BUTTON_ICON,
|
82
|
+
renders_one :leading_action, lambda { |
|
83
|
+
icon:,
|
94
84
|
**system_arguments
|
95
85
|
|
|
96
86
|
deny_tag_argument(**system_arguments)
|
97
87
|
system_arguments[:tag] = :a
|
98
88
|
system_arguments[:scheme] = :invisible
|
99
|
-
system_arguments[:
|
100
|
-
system_arguments[:
|
101
|
-
system_arguments[:
|
102
|
-
system_arguments[:display] ||= DEFAULT_BACK_BUTTON_DISPLAY
|
89
|
+
system_arguments[:icon] = icon
|
90
|
+
system_arguments[:classes] = class_names(system_arguments[:classes], "PageHeader-leadingAction")
|
91
|
+
system_arguments[:display] ||= DEFAULT_LEADING_ACTION_DISPLAY
|
103
92
|
|
104
|
-
Primer::Beta::IconButton.new(**system_arguments)
|
93
|
+
Primer::Beta::IconButton.new(icon: icon, **system_arguments)
|
105
94
|
}
|
106
95
|
|
107
96
|
# Optional parent link in the context area
|