openproject-primer_view_components 0.82.1 → 0.83.0
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 +36 -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 +68 -77
- data/app/components/primer/alpha/action_bar_element.ts +48 -70
- data/app/components/primer/alpha/action_list.js +1 -1
- data/app/components/primer/alpha/action_list.ts +1 -1
- data/app/components/primer/alpha/action_menu/action_menu_element.js +1 -1
- data/app/components/primer/alpha/action_menu/action_menu_element.ts +1 -1
- data/app/components/primer/alpha/action_menu/menu.rb +5 -1
- data/app/components/primer/alpha/action_menu/primary_menu.rb +4 -0
- data/app/components/primer/alpha/action_menu/sub_menu.rb +4 -0
- data/app/components/primer/alpha/dialog.css +1 -1
- data/app/components/primer/alpha/dialog.css.json +2 -1
- data/app/components/primer/alpha/dialog.css.map +1 -1
- data/app/components/primer/alpha/dialog.pcss +12 -0
- data/app/components/primer/alpha/layout.rb +6 -2
- data/app/components/primer/alpha/overlay.rb +14 -1
- data/app/components/primer/alpha/segmented_control.js +1 -1
- data/app/components/primer/alpha/segmented_control.ts +1 -1
- data/app/components/primer/alpha/select_panel_element.js +3 -1
- data/app/components/primer/alpha/select_panel_element.ts +4 -1
- data/app/components/primer/alpha/toggle_switch.js +1 -1
- data/app/components/primer/alpha/toggle_switch.rb +3 -0
- data/app/components/primer/alpha/toggle_switch.ts +1 -1
- data/app/components/primer/alpha/tool_tip.js +1 -1
- data/app/components/primer/alpha/tool_tip.ts +1 -1
- data/app/components/primer/alpha/tree_view/tree_view.js +1 -1
- data/app/components/primer/alpha/tree_view/tree_view.ts +1 -1
- data/app/components/primer/alpha/tree_view/tree_view_icon_pair_element.js +1 -1
- data/app/components/primer/alpha/tree_view/tree_view_icon_pair_element.ts +1 -1
- data/app/components/primer/alpha/tree_view/tree_view_include_fragment_element.js +1 -1
- data/app/components/primer/alpha/tree_view/tree_view_include_fragment_element.ts +1 -1
- data/app/components/primer/alpha/tree_view/tree_view_sub_tree_node_element.js +25 -2
- data/app/components/primer/alpha/tree_view/tree_view_sub_tree_node_element.ts +27 -1
- data/app/components/primer/alpha/x_banner.js +1 -1
- data/app/components/primer/alpha/x_banner.ts +1 -1
- data/app/components/primer/beta/auto_complete/no_result_item.rb +23 -13
- data/app/components/primer/beta/blankslate.css +1 -1
- data/app/components/primer/beta/blankslate.css.json +1 -0
- data/app/components/primer/beta/blankslate.css.map +1 -1
- data/app/components/primer/beta/blankslate.pcss +5 -0
- data/app/components/primer/beta/blankslate.rb +1 -0
- data/app/components/primer/beta/details_toggle_element.js +1 -1
- data/app/components/primer/beta/details_toggle_element.ts +1 -1
- data/app/components/primer/beta/nav_list.js +1 -1
- data/app/components/primer/beta/nav_list.ts +1 -1
- data/app/components/primer/beta/nav_list_group_element.js +1 -1
- data/app/components/primer/beta/nav_list_group_element.ts +1 -1
- data/app/components/primer/dialog_helper.js +24 -9
- data/app/components/primer/dialog_helper.ts +24 -12
- data/app/components/primer/scrollable_region.js +1 -1
- data/app/components/primer/scrollable_region.ts +1 -1
- data/app/lib/primer/forms/primer_multi_input.js +1 -1
- data/app/lib/primer/forms/primer_multi_input.ts +1 -1
- data/app/lib/primer/forms/primer_text_area.js +1 -1
- data/app/lib/primer/forms/primer_text_area.ts +1 -1
- data/app/lib/primer/forms/primer_text_field.js +1 -1
- data/app/lib/primer/forms/primer_text_field.ts +1 -1
- data/app/lib/primer/forms/toggle_switch_input.js +1 -1
- data/app/lib/primer/forms/toggle_switch_input.ts +1 -1
- data/lib/primer/view_components/version.rb +2 -2
- data/previews/primer/alpha/action_menu_preview/sub_menus.html.erb +2 -2
- data/previews/primer/alpha/action_menu_preview.rb +35 -1
- data/previews/primer/beta/button_preview/summary_as_button.html.erb +0 -1
- data/previews/primer/beta/truncate_preview/advanced_multiple_items.html.erb +32 -0
- data/previews/primer/beta/truncate_preview/max_widths.html.erb +22 -0
- data/previews/primer/beta/truncate_preview/multiple_items.html.erb +14 -0
- data/previews/primer/beta/truncate_preview.rb +3 -26
- data/static/arguments.json +38 -1
- data/static/classes.json +3 -0
- data/static/constants.json +17 -0
- data/static/info_arch.json +77 -58
- data/static/previews.json +13 -0
- metadata +5 -2
|
@@ -10,6 +10,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _DialogHelperElement_instances, _DialogHelperElement_abortController, _DialogHelperElement_handleDialogOpenAttribute;
|
|
13
|
+
function setScrollGutter(doc) {
|
|
14
|
+
if (doc.body.style.getPropertyValue('--dialog-scrollgutter'))
|
|
15
|
+
return;
|
|
16
|
+
doc.body.style.setProperty('--dialog-scrollgutter', `${window.innerWidth - doc.body.clientWidth}px`);
|
|
17
|
+
}
|
|
13
18
|
function dialogInvokerButtonHandler(event) {
|
|
14
19
|
const target = event.target;
|
|
15
20
|
const button = target?.closest('button');
|
|
@@ -20,25 +25,35 @@ function dialogInvokerButtonHandler(event) {
|
|
|
20
25
|
if (dialogId) {
|
|
21
26
|
const dialog = document.getElementById(dialogId);
|
|
22
27
|
if (dialog instanceof HTMLDialogElement) {
|
|
28
|
+
setScrollGutter(dialog.ownerDocument);
|
|
23
29
|
dialog.showModal();
|
|
24
30
|
// A buttons default behaviour in some browsers it to send a pointer event
|
|
25
31
|
// If the behaviour is allowed through the dialog will be shown but then
|
|
26
32
|
// quickly hidden- as if it were never shown. This prevents that.
|
|
27
33
|
event.preventDefault();
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
34
|
+
// When a <dialog> is opened with showModal() from inside a popover with popover="auto",
|
|
35
|
+
// there are two related issues:
|
|
36
|
+
//
|
|
37
|
+
// 1. In older browsers (e.g. Chrome 122), the "hide all popovers" algorithm runs when a
|
|
38
|
+
// top layer element opens, closing any ancestor popover. We must re-open those popovers.
|
|
39
|
+
// See https://github.com/whatwg/html/issues/9998,
|
|
40
|
+
// fixed by https://github.com/whatwg/html/pull/10116.
|
|
41
|
+
//
|
|
42
|
+
// 2. In newer browsers where the popover stays open, the popover="auto" behavior still
|
|
43
|
+
// interferes with the native <dialog> focus trap, causing focus to escape the dialog
|
|
44
|
+
// when tabbing past the last focusable element. Converting the popover to "manual"
|
|
45
|
+
// prevents this interference.
|
|
46
|
+
//
|
|
47
|
+
// In both cases, the fix is the same: convert ancestor auto popovers to manual.
|
|
35
48
|
let node = button;
|
|
36
49
|
let fixed = false;
|
|
37
50
|
while (node) {
|
|
38
|
-
node = node.parentElement?.closest('[popover]
|
|
51
|
+
node = node.parentElement?.closest('[popover]');
|
|
39
52
|
if (node && node.popover === 'auto') {
|
|
40
53
|
node.classList.add('dialog-inside-popover-fix');
|
|
41
54
|
node.popover = 'manual';
|
|
55
|
+
// Changing popover from "auto" to "manual" closes the popover,
|
|
56
|
+
// so we need to re-show it regardless of whether it was previously open.
|
|
42
57
|
node.showPopover();
|
|
43
58
|
fixed = true;
|
|
44
59
|
}
|
|
@@ -83,7 +98,6 @@ export class DialogHelperElement extends HTMLElement {
|
|
|
83
98
|
const { signal } = (__classPrivateFieldSet(this, _DialogHelperElement_abortController, new AbortController(), "f"));
|
|
84
99
|
document.addEventListener('click', dialogInvokerButtonHandler, true);
|
|
85
100
|
document.addEventListener('click', this, { signal });
|
|
86
|
-
this.ownerDocument.body.style.setProperty('--dialog-scrollgutter', `${window.innerWidth - this.ownerDocument.body.clientWidth}px`);
|
|
87
101
|
new MutationObserver(records => {
|
|
88
102
|
for (const record of records) {
|
|
89
103
|
if (record.target === this.dialog) {
|
|
@@ -123,6 +137,7 @@ _DialogHelperElement_abortController = new WeakMap(), _DialogHelperElement_insta
|
|
|
123
137
|
// eslint-disable-next-line no-restricted-syntax
|
|
124
138
|
this.dialog.addEventListener('close', e => e.stopImmediatePropagation(), { once: true });
|
|
125
139
|
this.dialog.close();
|
|
140
|
+
setScrollGutter(this.dialog.ownerDocument);
|
|
126
141
|
this.dialog.showModal();
|
|
127
142
|
}
|
|
128
143
|
};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
function setScrollGutter(doc: Document) {
|
|
2
|
+
if (doc.body.style.getPropertyValue('--dialog-scrollgutter')) return
|
|
3
|
+
doc.body.style.setProperty('--dialog-scrollgutter', `${window.innerWidth - doc.body.clientWidth}px`)
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
function dialogInvokerButtonHandler(event: Event) {
|
|
2
7
|
const target = event.target as HTMLElement
|
|
3
8
|
const button = target?.closest('button')
|
|
@@ -9,26 +14,36 @@ function dialogInvokerButtonHandler(event: Event) {
|
|
|
9
14
|
if (dialogId) {
|
|
10
15
|
const dialog = document.getElementById(dialogId)
|
|
11
16
|
if (dialog instanceof HTMLDialogElement) {
|
|
17
|
+
setScrollGutter(dialog.ownerDocument)
|
|
12
18
|
dialog.showModal()
|
|
13
19
|
// A buttons default behaviour in some browsers it to send a pointer event
|
|
14
20
|
// If the behaviour is allowed through the dialog will be shown but then
|
|
15
21
|
// quickly hidden- as if it were never shown. This prevents that.
|
|
16
22
|
event.preventDefault()
|
|
17
23
|
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
24
|
+
// When a <dialog> is opened with showModal() from inside a popover with popover="auto",
|
|
25
|
+
// there are two related issues:
|
|
26
|
+
//
|
|
27
|
+
// 1. In older browsers (e.g. Chrome 122), the "hide all popovers" algorithm runs when a
|
|
28
|
+
// top layer element opens, closing any ancestor popover. We must re-open those popovers.
|
|
29
|
+
// See https://github.com/whatwg/html/issues/9998,
|
|
30
|
+
// fixed by https://github.com/whatwg/html/pull/10116.
|
|
31
|
+
//
|
|
32
|
+
// 2. In newer browsers where the popover stays open, the popover="auto" behavior still
|
|
33
|
+
// interferes with the native <dialog> focus trap, causing focus to escape the dialog
|
|
34
|
+
// when tabbing past the last focusable element. Converting the popover to "manual"
|
|
35
|
+
// prevents this interference.
|
|
36
|
+
//
|
|
37
|
+
// In both cases, the fix is the same: convert ancestor auto popovers to manual.
|
|
25
38
|
let node: HTMLElement | null | undefined = button
|
|
26
39
|
let fixed = false
|
|
27
40
|
while (node) {
|
|
28
|
-
node = node.parentElement?.closest('[popover]
|
|
41
|
+
node = node.parentElement?.closest('[popover]')
|
|
29
42
|
if (node && node.popover === 'auto') {
|
|
30
43
|
node.classList.add('dialog-inside-popover-fix')
|
|
31
44
|
node.popover = 'manual'
|
|
45
|
+
// Changing popover from "auto" to "manual" closes the popover,
|
|
46
|
+
// so we need to re-show it regardless of whether it was previously open.
|
|
32
47
|
node.showPopover()
|
|
33
48
|
fixed = true
|
|
34
49
|
}
|
|
@@ -76,10 +91,6 @@ export class DialogHelperElement extends HTMLElement {
|
|
|
76
91
|
const {signal} = (this.#abortController = new AbortController())
|
|
77
92
|
document.addEventListener('click', dialogInvokerButtonHandler, true)
|
|
78
93
|
document.addEventListener('click', this, {signal})
|
|
79
|
-
this.ownerDocument.body.style.setProperty(
|
|
80
|
-
'--dialog-scrollgutter',
|
|
81
|
-
`${window.innerWidth - this.ownerDocument.body.clientWidth}px`,
|
|
82
|
-
)
|
|
83
94
|
new MutationObserver(records => {
|
|
84
95
|
for (const record of records) {
|
|
85
96
|
if (record.target === this.dialog) {
|
|
@@ -101,6 +112,7 @@ export class DialogHelperElement extends HTMLElement {
|
|
|
101
112
|
// eslint-disable-next-line no-restricted-syntax
|
|
102
113
|
this.dialog.addEventListener('close', e => e.stopImmediatePropagation(), {once: true})
|
|
103
114
|
this.dialog.close()
|
|
115
|
+
setScrollGutter(this.dialog.ownerDocument)
|
|
104
116
|
this.dialog.showModal()
|
|
105
117
|
}
|
|
106
118
|
}
|
|
@@ -46,7 +46,7 @@ __decorate([
|
|
|
46
46
|
attr
|
|
47
47
|
], ScrollableRegionElement.prototype, "labelledBy", void 0);
|
|
48
48
|
ScrollableRegionElement = __decorate([
|
|
49
|
-
controller
|
|
49
|
+
controller('scrollable-region')
|
|
50
50
|
], ScrollableRegionElement);
|
|
51
51
|
export { ScrollableRegionElement };
|
|
52
52
|
window.ScrollableRegionElement = ScrollableRegionElement;
|
|
@@ -35,7 +35,7 @@ __decorate([
|
|
|
35
35
|
targets
|
|
36
36
|
], PrimerMultiInputElement.prototype, "fields", void 0);
|
|
37
37
|
PrimerMultiInputElement = __decorate([
|
|
38
|
-
controller
|
|
38
|
+
controller('primer-multi-input')
|
|
39
39
|
], PrimerMultiInputElement);
|
|
40
40
|
export { PrimerMultiInputElement };
|
|
41
41
|
if (!window.customElements.get('primer-multi-input')) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable custom-elements/expose-class-on-global */
|
|
2
2
|
import {controller, targets} from '@github/catalyst'
|
|
3
3
|
|
|
4
|
-
@controller
|
|
4
|
+
@controller('primer-multi-input')
|
|
5
5
|
export class PrimerMultiInputElement extends HTMLElement {
|
|
6
6
|
@targets fields: HTMLInputElement[]
|
|
7
7
|
|
|
@@ -44,7 +44,7 @@ __decorate([
|
|
|
44
44
|
target
|
|
45
45
|
], PrimerTextAreaElement.prototype, "characterLimitSrElement", void 0);
|
|
46
46
|
PrimerTextAreaElement = __decorate([
|
|
47
|
-
controller
|
|
47
|
+
controller('primer-text-area')
|
|
48
48
|
], PrimerTextAreaElement);
|
|
49
49
|
export { PrimerTextAreaElement };
|
|
50
50
|
if (!window.customElements.get('primer-text-area')) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {controller, target} from '@github/catalyst'
|
|
2
2
|
import {CharacterCounter} from './character_counter'
|
|
3
3
|
|
|
4
|
-
@controller
|
|
4
|
+
@controller('primer-text-area')
|
|
5
5
|
export class PrimerTextAreaElement extends HTMLElement {
|
|
6
6
|
@target inputElement: HTMLTextAreaElement
|
|
7
7
|
@target characterLimitElement: HTMLElement
|
|
@@ -128,6 +128,6 @@ __decorate([
|
|
|
128
128
|
target
|
|
129
129
|
], PrimerTextFieldElement.prototype, "characterLimitSrElement", void 0);
|
|
130
130
|
PrimerTextFieldElement = __decorate([
|
|
131
|
-
controller
|
|
131
|
+
controller('primer-text-field')
|
|
132
132
|
], PrimerTextFieldElement);
|
|
133
133
|
export { PrimerTextFieldElement };
|
|
@@ -29,6 +29,6 @@ __decorate([
|
|
|
29
29
|
target
|
|
30
30
|
], ToggleSwitchInputElement.prototype, "validationMessageElement", void 0);
|
|
31
31
|
ToggleSwitchInputElement = __decorate([
|
|
32
|
-
controller
|
|
32
|
+
controller('toggle-switch-input')
|
|
33
33
|
], ToggleSwitchInputElement);
|
|
34
34
|
export { ToggleSwitchInputElement };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<%# Center the invoker button to give left-appearing sub-menus enough space %>
|
|
2
2
|
<div style="<%= sub_menu_anchor_side.to_s.include?("left") ? "text-align: center" : "" %>">
|
|
3
|
-
<%= render(Primer::Alpha::ActionMenu.new(anchor_align: anchor_align, anchor_side: anchor_side)) do |menu| %>
|
|
3
|
+
<%= render(Primer::Alpha::ActionMenu.new(anchor_align: anchor_align, anchor_side: anchor_side, anchor_when_narrow: anchor_when_narrow)) do |menu| %>
|
|
4
4
|
<% menu.with_show_button { "Edit" } %>
|
|
5
5
|
<% menu.with_item(label: "Cut") %>
|
|
6
6
|
<% menu.with_item(label: "Copy") %>
|
|
7
|
-
<% menu.with_sub_menu_item(label: "Paste special", anchor_align: sub_menu_anchor_align, anchor_side: sub_menu_anchor_side) do |sub_menu| %>
|
|
7
|
+
<% menu.with_sub_menu_item(label: "Paste special", anchor_align: sub_menu_anchor_align, anchor_side: sub_menu_anchor_side, anchor_when_narrow: anchor_when_narrow) do |sub_menu| %>
|
|
8
8
|
<% sub_menu.with_leading_visual_icon(icon: :"sparkle-fill") %>
|
|
9
9
|
<% sub_menu.with_item(label: "Paste plain text") %>
|
|
10
10
|
<% sub_menu.with_item(label: "Paste formulas") %>
|
|
@@ -9,14 +9,16 @@ module Primer
|
|
|
9
9
|
# @param select_variant [Symbol] select [single, multiple, none]
|
|
10
10
|
# @param anchor_align [Symbol] select [start, center, end]
|
|
11
11
|
# @param anchor_side [Symbol] select [outside_bottom, outside_top, outside_left, outside_right]
|
|
12
|
+
# @param anchor_when_narrow [Symbol] select [inherit, bottom, fullscreen, left, right]
|
|
12
13
|
# @param size [Symbol] select [auto, small, medium, large, xlarge]
|
|
13
14
|
def playground(
|
|
14
15
|
select_variant: Primer::Alpha::ActionMenu::PrimaryMenu::DEFAULT_SELECT_VARIANT,
|
|
15
16
|
anchor_align: Primer::Alpha::Overlay::DEFAULT_ANCHOR_ALIGN,
|
|
16
17
|
anchor_side: Primer::Alpha::Overlay::DEFAULT_ANCHOR_SIDE,
|
|
18
|
+
anchor_when_narrow: Primer::Alpha::Overlay::DEFAULT_ANCHOR_WHEN_NARROW,
|
|
17
19
|
size: Primer::Alpha::Overlay::DEFAULT_SIZE
|
|
18
20
|
)
|
|
19
|
-
render(Primer::Alpha::ActionMenu.new(select_variant: select_variant, anchor_align: anchor_align, anchor_side: anchor_side, size: size)) do |menu|
|
|
21
|
+
render(Primer::Alpha::ActionMenu.new(select_variant: select_variant, anchor_align: anchor_align, anchor_side: anchor_side, anchor_when_narrow: anchor_when_narrow, size: size)) do |menu|
|
|
20
22
|
menu.with_show_button { "Menu" }
|
|
21
23
|
menu.with_item(label: "Copy link")
|
|
22
24
|
menu.with_item(label: "Quote reply")
|
|
@@ -450,21 +452,53 @@ module Primer
|
|
|
450
452
|
#
|
|
451
453
|
def two_menus; end
|
|
452
454
|
|
|
455
|
+
# @label Fullscreen when narrow
|
|
456
|
+
#
|
|
457
|
+
def fullscreen_when_narrow
|
|
458
|
+
render(Primer::Alpha::ActionMenu.new(anchor_when_narrow: :fullscreen)) do |menu|
|
|
459
|
+
menu.with_show_button do |button|
|
|
460
|
+
button.with_trailing_action_icon(icon: :"triangle-down")
|
|
461
|
+
"Options"
|
|
462
|
+
end
|
|
463
|
+
|
|
464
|
+
menu.with_item(label: "Edit profile") do |item|
|
|
465
|
+
item.with_description.with_content("Update your profile information")
|
|
466
|
+
end
|
|
467
|
+
|
|
468
|
+
menu.with_item(label: "Settings") do |item|
|
|
469
|
+
item.with_description.with_content("Configure your preferences")
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
menu.with_item(label: "Notifications") do |item|
|
|
473
|
+
item.with_description.with_content("Manage notification settings")
|
|
474
|
+
end
|
|
475
|
+
|
|
476
|
+
menu.with_divider
|
|
477
|
+
|
|
478
|
+
menu.with_item(label: "Sign out", scheme: :danger) do |item|
|
|
479
|
+
item.with_description.with_content("Log out of your account")
|
|
480
|
+
end
|
|
481
|
+
end
|
|
482
|
+
end
|
|
483
|
+
|
|
453
484
|
# @label Sub-menus
|
|
454
485
|
#
|
|
455
486
|
# @param anchor_align [Symbol] select [start, center, end]
|
|
456
487
|
# @param anchor_side [Symbol] select [outside_bottom, outside_top, outside_left, outside_right]
|
|
488
|
+
# @param anchor_when_narrow [Symbol] select [inherit, bottom, fullscreen, left, right]
|
|
457
489
|
# @param sub_menu_anchor_align [Symbol] select [start, center, end]
|
|
458
490
|
# @param sub_menu_anchor_side [Symbol] select [outside_bottom, outside_top, outside_left, outside_right]
|
|
459
491
|
def sub_menus(
|
|
460
492
|
anchor_align: Primer::Alpha::ActionMenu::PrimaryMenu::DEFAULT_ANCHOR_ALIGN,
|
|
461
493
|
anchor_side: Primer::Alpha::ActionMenu::PrimaryMenu::DEFAULT_ANCHOR_SIDE,
|
|
494
|
+
anchor_when_narrow: Primer::Alpha::ActionMenu::SubMenu::DEFAULT_ANCHOR_WHEN_NARROW,
|
|
462
495
|
sub_menu_anchor_align: Primer::Alpha::ActionMenu::SubMenu::DEFAULT_ANCHOR_ALIGN,
|
|
463
496
|
sub_menu_anchor_side: Primer::Alpha::ActionMenu::SubMenu::DEFAULT_ANCHOR_SIDE
|
|
464
497
|
)
|
|
465
498
|
render_with_template(locals: {
|
|
466
499
|
anchor_align: anchor_align.to_sym,
|
|
467
500
|
anchor_side: anchor_side.to_sym,
|
|
501
|
+
anchor_when_narrow: anchor_when_narrow.to_sym,
|
|
468
502
|
sub_menu_anchor_align: sub_menu_anchor_align,
|
|
469
503
|
sub_menu_anchor_side: sub_menu_anchor_side
|
|
470
504
|
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<%= render(Primer::Beta::Truncate.new(tag: :ol)) do |component| %>
|
|
2
|
+
<% component.with_item(tag: :li) do %>
|
|
3
|
+
<%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-primer")) do |link| %>
|
|
4
|
+
<% link.with_tooltip(text: "primer") %>
|
|
5
|
+
primer
|
|
6
|
+
<% end %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% component.with_item(tag: :li, priority: true) do %>
|
|
9
|
+
<%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-css")) do |link| %>
|
|
10
|
+
<% link.with_tooltip(text: "/ css") %>
|
|
11
|
+
/ css
|
|
12
|
+
<% end %>
|
|
13
|
+
<% end %>
|
|
14
|
+
<% component.with_item(tag: :li) do %>
|
|
15
|
+
<%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-issues")) do |link| %>
|
|
16
|
+
<% link.with_tooltip(text: "/ Issues") %>
|
|
17
|
+
/ Issues
|
|
18
|
+
<% end %>
|
|
19
|
+
<% end %>
|
|
20
|
+
<% component.with_item(tag: :li) do %>
|
|
21
|
+
<%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-number")) do |link| %>
|
|
22
|
+
<% link.with_tooltip(text: "/ #123") %>
|
|
23
|
+
/ #123
|
|
24
|
+
<% end %>
|
|
25
|
+
<% end %>
|
|
26
|
+
<% component.with_item(tag: :li, priority: true) do %>
|
|
27
|
+
<%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-title")) do |link| %>
|
|
28
|
+
<% link.with_tooltip(text: "Visual bug on primer.style found in lists") %>
|
|
29
|
+
Visual bug on primer.style found in lists
|
|
30
|
+
<% end %>
|
|
31
|
+
<% end %>
|
|
32
|
+
<% end %>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<% long_text = "branch-name-that-is-really-long-branch-name-that-is-really-long-branch-name-that-is-really-long" %>
|
|
2
|
+
|
|
3
|
+
<%= render(Primer::Beta::Truncate.new) do |component| %>
|
|
4
|
+
<% component.with_item(max_width: 300) do %>
|
|
5
|
+
<%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-300")) do |link| %>
|
|
6
|
+
<% link.with_tooltip(text: long_text) %>
|
|
7
|
+
<%= long_text %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% end %>
|
|
10
|
+
<% component.with_item(max_width: 200) do %>
|
|
11
|
+
<%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-200")) do |link| %>
|
|
12
|
+
<% link.with_tooltip(text: long_text) %>
|
|
13
|
+
<%= long_text %>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% end %>
|
|
16
|
+
<% component.with_item(max_width: 100) do %>
|
|
17
|
+
<%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-100")) do |link| %>
|
|
18
|
+
<% link.with_tooltip(text: long_text) %>
|
|
19
|
+
<%= long_text %>
|
|
20
|
+
<% end %>
|
|
21
|
+
<% end %>
|
|
22
|
+
<% end %>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<%= render(Primer::Beta::Truncate.new) do |component| %>
|
|
2
|
+
<% component.with_item do %>
|
|
3
|
+
<%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-owner")) do |link| %>
|
|
4
|
+
<% link.with_tooltip(text: "really-long-repository-owner-name") %>
|
|
5
|
+
really-long-repository-owner-name
|
|
6
|
+
<% end %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% component.with_item(font_weight: :bold) do %>
|
|
9
|
+
<%= render(Primer::Beta::Link.new(href: "https://github.com", id: "truncate-link-repo")) do |link| %>
|
|
10
|
+
<% link.with_tooltip(text: "really-long-repository-name") %>
|
|
11
|
+
really-long-repository-name
|
|
12
|
+
<% end %>
|
|
13
|
+
<% end %>
|
|
14
|
+
<% end %>
|
|
@@ -19,37 +19,14 @@ module Primer
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
# @label Multiple items
|
|
22
|
-
def multiple_items
|
|
23
|
-
render(Primer::Beta::Truncate.new) do |component|
|
|
24
|
-
component.with_item do
|
|
25
|
-
"really-long-repository-owner-name"
|
|
26
|
-
end
|
|
27
|
-
component.with_item(font_weight: :bold) do
|
|
28
|
-
"really-long-repository-name"
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
22
|
+
def multiple_items; end
|
|
32
23
|
|
|
33
24
|
# @label Advanced multiple items
|
|
34
|
-
def advanced_multiple_items
|
|
35
|
-
render(Primer::Beta::Truncate.new(tag: :ol)) do |component|
|
|
36
|
-
component.with_item(tag: :li) { "primer" }
|
|
37
|
-
component.with_item(tag: :li, priority: true) { "/ css" }
|
|
38
|
-
component.with_item(tag: :li) { "/ Issues" }
|
|
39
|
-
component.with_item(tag: :li) { "/ #123" }
|
|
40
|
-
component.with_item(tag: :li, priority: true) { "Visual bug on primer.style found in lists" }
|
|
41
|
-
end
|
|
42
|
-
end
|
|
25
|
+
def advanced_multiple_items; end
|
|
43
26
|
|
|
44
27
|
# @label Max widths
|
|
45
28
|
# @snapshot
|
|
46
|
-
def max_widths
|
|
47
|
-
render(Primer::Beta::Truncate.new) do |component|
|
|
48
|
-
component.with_item(max_width: 300) { "branch-name-that-is-really-long-branch-name-that-is-really-long-branch-name-that-is-really-long" }
|
|
49
|
-
component.with_item(max_width: 200) { "branch-name-that-is-really-long-branch-name-that-is-really-long-branch-name-that-is-really-long" }
|
|
50
|
-
component.with_item(max_width: 100) { "branch-name-that-is-really-long-branch-name-that-is-really-long-branch-name-that-is-really-long" }
|
|
51
|
-
end
|
|
52
|
-
end
|
|
29
|
+
def max_widths; end
|
|
53
30
|
end
|
|
54
31
|
end
|
|
55
32
|
end
|
data/static/arguments.json
CHANGED
|
@@ -464,6 +464,12 @@
|
|
|
464
464
|
"default": "N/A",
|
|
465
465
|
"description": "One of `:inside_bottom`, `:inside_center`, `:inside_left`, `:inside_right`, `:inside_top`, `:outside_bottom`, `:outside_left`, `:outside_right`, or `:outside_top`."
|
|
466
466
|
},
|
|
467
|
+
{
|
|
468
|
+
"name": "anchor_when_narrow",
|
|
469
|
+
"type": "Symbol",
|
|
470
|
+
"default": "N/A",
|
|
471
|
+
"description": "One of `:bottom`, `:fullscreen`, `:inherit`, `:left`, or `:right`."
|
|
472
|
+
},
|
|
467
473
|
{
|
|
468
474
|
"name": "menu_id",
|
|
469
475
|
"type": "String",
|
|
@@ -540,6 +546,12 @@
|
|
|
540
546
|
"default": "`:outside_bottom`",
|
|
541
547
|
"description": "One of `:inside_bottom`, `:inside_center`, `:inside_left`, `:inside_right`, `:inside_top`, `:outside_bottom`, `:outside_left`, `:outside_right`, or `:outside_top`."
|
|
542
548
|
},
|
|
549
|
+
{
|
|
550
|
+
"name": "anchor_when_narrow",
|
|
551
|
+
"type": "Symbol",
|
|
552
|
+
"default": "`:inherit`",
|
|
553
|
+
"description": "One of `:bottom`, `:fullscreen`, `:inherit`, `:left`, or `:right`.."
|
|
554
|
+
},
|
|
543
555
|
{
|
|
544
556
|
"name": "dynamic_label",
|
|
545
557
|
"type": "Boolean",
|
|
@@ -586,6 +598,12 @@
|
|
|
586
598
|
"default": "`:outside_right`",
|
|
587
599
|
"description": "One of `:inside_bottom`, `:inside_center`, `:inside_left`, `:inside_right`, `:inside_top`, `:outside_bottom`, `:outside_left`, `:outside_right`, or `:outside_top`."
|
|
588
600
|
},
|
|
601
|
+
{
|
|
602
|
+
"name": "anchor_when_narrow",
|
|
603
|
+
"type": "Symbol",
|
|
604
|
+
"default": "`:inherit`",
|
|
605
|
+
"description": "One of `:bottom`, `:fullscreen`, `:inherit`, `:left`, or `:right`.."
|
|
606
|
+
},
|
|
589
607
|
{
|
|
590
608
|
"name": "overlay_arguments",
|
|
591
609
|
"type": "Hash",
|
|
@@ -2009,6 +2027,12 @@
|
|
|
2009
2027
|
"default": "`:normal`",
|
|
2010
2028
|
"description": "The anchor offset to give the Overlay. One of `:normal` or `:spacious`."
|
|
2011
2029
|
},
|
|
2030
|
+
{
|
|
2031
|
+
"name": "anchor_when_narrow",
|
|
2032
|
+
"type": "Symbol",
|
|
2033
|
+
"default": "`:inherit`",
|
|
2034
|
+
"description": "The position of the Overlay when in a narrow viewport. One of `:bottom`, `:fullscreen`, `:inherit`, `:left`, or `:right`."
|
|
2035
|
+
},
|
|
2012
2036
|
{
|
|
2013
2037
|
"name": "allow_out_of_bounds",
|
|
2014
2038
|
"type": "Boolean",
|
|
@@ -3336,6 +3360,12 @@
|
|
|
3336
3360
|
"type": "String",
|
|
3337
3361
|
"default": "`nil`",
|
|
3338
3362
|
"description": "Custom label to show when the switch is OFF. Defaults to (\"Off\"). Only customize this label if it makes the toggle’s state more meaningful in its specific context. For example, for a \"Show images\" setting, you might use \"Show\" when the switch is OFF."
|
|
3363
|
+
},
|
|
3364
|
+
{
|
|
3365
|
+
"name": "button_type",
|
|
3366
|
+
"type": "Symbol",
|
|
3367
|
+
"default": "`nil`",
|
|
3368
|
+
"description": "The type attribute for the underlying button element. If `nil`, the button will not have a type attribute, which means it will default to \"submit\" if it's inside a form and \"button\" otherwise."
|
|
3339
3369
|
}
|
|
3340
3370
|
]
|
|
3341
3371
|
},
|
|
@@ -4003,7 +4033,14 @@
|
|
|
4003
4033
|
"short_name": "AutoCompleteNoResultItem",
|
|
4004
4034
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/beta/auto_complete/no_result_item.rb",
|
|
4005
4035
|
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/beta/auto_complete/no_result_item/default/",
|
|
4006
|
-
"parameters": [
|
|
4036
|
+
"parameters": [
|
|
4037
|
+
{
|
|
4038
|
+
"name": "system_arguments",
|
|
4039
|
+
"type": "Hash",
|
|
4040
|
+
"default": "N/A",
|
|
4041
|
+
"description": "[System arguments](/system-arguments)"
|
|
4042
|
+
}
|
|
4043
|
+
]
|
|
4007
4044
|
},
|
|
4008
4045
|
{
|
|
4009
4046
|
"component": "Avatar",
|
data/static/classes.json
CHANGED
data/static/constants.json
CHANGED
|
@@ -193,11 +193,13 @@
|
|
|
193
193
|
"Primer::Alpha::ActionMenu::PrimaryMenu": {
|
|
194
194
|
"DEFAULT_ANCHOR_ALIGN": "start",
|
|
195
195
|
"DEFAULT_ANCHOR_SIDE": "outside_bottom",
|
|
196
|
+
"DEFAULT_ANCHOR_WHEN_NARROW": "inherit",
|
|
196
197
|
"GeneratedSlotMethods": "Primer::Alpha::ActionMenu::PrimaryMenu::GeneratedSlotMethods"
|
|
197
198
|
},
|
|
198
199
|
"Primer::Alpha::ActionMenu::SubMenu": {
|
|
199
200
|
"DEFAULT_ANCHOR_ALIGN": "start",
|
|
200
201
|
"DEFAULT_ANCHOR_SIDE": "outside_right",
|
|
202
|
+
"DEFAULT_ANCHOR_WHEN_NARROW": "inherit",
|
|
201
203
|
"GeneratedSlotMethods": "Primer::Alpha::ActionMenu::SubMenu::GeneratedSlotMethods"
|
|
202
204
|
},
|
|
203
205
|
"Primer::Alpha::ActionMenu::SubMenuItem": {
|
|
@@ -599,11 +601,26 @@
|
|
|
599
601
|
"outside_left",
|
|
600
602
|
"outside_right"
|
|
601
603
|
],
|
|
604
|
+
"ANCHOR_WHEN_NARROW_MAPPINGS": {
|
|
605
|
+
"inherit": "",
|
|
606
|
+
"bottom": "Overlay--placement-bottom-whenNarrow",
|
|
607
|
+
"fullscreen": "Overlay--fullscreen-whenNarrow",
|
|
608
|
+
"left": "Overlay--placement-left-whenNarrow",
|
|
609
|
+
"right": "Overlay--placement-right-whenNarrow"
|
|
610
|
+
},
|
|
611
|
+
"ANCHOR_WHEN_NARROW_OPTIONS": [
|
|
612
|
+
"inherit",
|
|
613
|
+
"bottom",
|
|
614
|
+
"fullscreen",
|
|
615
|
+
"left",
|
|
616
|
+
"right"
|
|
617
|
+
],
|
|
602
618
|
"Body": "Primer::Alpha::Overlay::Body",
|
|
603
619
|
"DEFAULT_ALIGN_CONTENT": "end",
|
|
604
620
|
"DEFAULT_ANCHOR_ALIGN": "start",
|
|
605
621
|
"DEFAULT_ANCHOR_OFFSET": "normal",
|
|
606
622
|
"DEFAULT_ANCHOR_SIDE": "outside_bottom",
|
|
623
|
+
"DEFAULT_ANCHOR_WHEN_NARROW": "inherit",
|
|
607
624
|
"DEFAULT_PADDING": "normal",
|
|
608
625
|
"DEFAULT_POPOVER": "auto",
|
|
609
626
|
"DEFAULT_SIZE": "auto",
|