openproject-primer_view_components 0.19.0 → 0.21.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 +54 -0
- data/app/assets/javascripts/app/components/primer/alpha/action_bar_element.d.ts +3 -2
- data/app/assets/javascripts/app/components/primer/dialog_helper.d.ts +15 -0
- data/app/assets/javascripts/app/components/primer/primer.d.ts +2 -0
- data/app/assets/javascripts/app/components/primer/scrollable_region.d.ts +13 -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.css +1 -1
- data/app/components/primer/alpha/action_bar.css.map +1 -1
- data/app/components/primer/alpha/action_bar.pcss +8 -6
- data/app/components/primer/alpha/action_bar_element.d.ts +3 -2
- data/app/components/primer/alpha/action_bar_element.js +80 -97
- data/app/components/primer/alpha/action_bar_element.ts +84 -89
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/action_menu/action_menu_element.js +15 -4
- data/app/components/primer/alpha/action_menu/action_menu_element.ts +13 -1
- data/app/components/primer/alpha/action_menu.rb +3 -1
- data/app/components/primer/alpha/banner.html.erb +1 -1
- data/app/components/primer/alpha/banner.rb +11 -3
- data/app/components/primer/alpha/dialog.css +1 -1
- data/app/components/primer/alpha/dialog.css.json +12 -27
- data/app/components/primer/alpha/dialog.css.map +1 -1
- data/app/components/primer/alpha/dialog.html.erb +5 -3
- data/app/components/primer/alpha/dialog.pcss +78 -143
- data/app/components/primer/alpha/dialog.rb +15 -14
- data/app/components/primer/alpha/layout.css +1 -1
- data/app/components/primer/alpha/layout.css.map +1 -1
- data/app/components/primer/alpha/modal_dialog.ts +1 -1
- data/app/components/primer/alpha/overlay.css +1 -1
- data/app/components/primer/alpha/overlay.css.json +3 -1
- data/app/components/primer/alpha/overlay.css.map +1 -1
- data/app/components/primer/alpha/overlay.pcss +7 -1
- data/app/components/primer/alpha/text_field.css +1 -1
- data/app/components/primer/alpha/text_field.css.map +1 -1
- data/app/components/primer/alpha/text_field.pcss +4 -3
- data/app/components/primer/alpha/tool_tip.js +14 -1
- data/app/components/primer/alpha/tool_tip.ts +15 -1
- data/app/components/primer/alpha/underline_nav.css +1 -1
- data/app/components/primer/alpha/underline_nav.css.map +1 -1
- data/app/components/primer/base_component.rb +20 -18
- data/app/components/primer/beta/button.css +1 -1
- data/app/components/primer/beta/button.css.map +1 -1
- data/app/components/primer/dialog_helper.d.ts +15 -0
- data/app/components/primer/dialog_helper.js +85 -0
- data/app/components/primer/dialog_helper.ts +88 -0
- data/app/components/primer/open_project/page_header.rb +3 -3
- data/app/components/primer/primer.d.ts +2 -0
- data/app/components/primer/primer.js +2 -0
- data/app/components/primer/primer.ts +2 -0
- data/app/components/primer/scrollable_region.d.ts +13 -0
- data/app/components/primer/scrollable_region.js +52 -0
- data/app/components/primer/scrollable_region.ts +48 -0
- data/lib/primer/classify/utilities.rb +3 -4
- data/lib/primer/deprecations.yml +3 -3
- data/lib/primer/forms/dsl/button_input.rb +4 -0
- data/lib/primer/forms/dsl/check_box_input.rb +6 -0
- data/lib/primer/forms/dsl/hidden_input.rb +4 -0
- data/lib/primer/forms/dsl/input.rb +7 -3
- data/lib/primer/forms/dsl/radio_button_input.rb +6 -0
- data/lib/primer/forms/dsl/select_input.rb +3 -1
- data/lib/primer/forms/dsl/submit_button_input.rb +4 -0
- data/lib/primer/forms/form_control.html.erb +3 -1
- data/lib/primer/view_components/linters/tooltipped_migration.rb +1 -1
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/primer/yard/docs_helper.rb +1 -1
- data/previews/primer/alpha/action_menu_preview/in_scroll_container.html.erb +11 -0
- data/previews/primer/alpha/action_menu_preview.rb +7 -0
- data/previews/primer/alpha/banner_preview.rb +3 -2
- data/previews/primer/alpha/dialog_preview/nested_dialog.html.erb +1 -1
- data/previews/primer/alpha/dialog_preview/scroll_container.html.erb +35 -0
- data/previews/primer/alpha/dialog_preview.rb +61 -1
- data/previews/primer/alpha/tooltip_preview/tooltip_with_dialog_moving_focus_to_input.html.erb +2 -3
- data/previews/primer/alpha/tooltip_preview.rb +1 -1
- data/previews/primer/beta/button_preview/trailing_visual.html.erb +2 -1
- data/previews/primer/beta/button_preview.rb +4 -2
- data/previews/primer/open_project/page_header_preview.rb +4 -4
- data/static/arguments.json +12 -0
- data/static/classes.json +5 -20
- data/static/constants.json +17 -11
- data/static/info_arch.json +67 -3
- data/static/previews.json +54 -2
- metadata +13 -3
@@ -0,0 +1,88 @@
|
|
1
|
+
function dialogInvokerButtonHandler(event: Event) {
|
2
|
+
const target = event.target as HTMLElement
|
3
|
+
const button = target?.closest('button')
|
4
|
+
|
5
|
+
if (!button || button.hasAttribute('disabled') || button.getAttribute('aria-disabled') === 'true') return
|
6
|
+
|
7
|
+
// If the user is clicking a valid dialog trigger
|
8
|
+
let dialogId = button?.getAttribute('data-show-dialog-id')
|
9
|
+
if (dialogId) {
|
10
|
+
event.stopPropagation()
|
11
|
+
const dialog = document.getElementById(dialogId)
|
12
|
+
if (dialog instanceof HTMLDialogElement) {
|
13
|
+
dialog.showModal()
|
14
|
+
// A buttons default behaviour in some browsers it to send a pointer event
|
15
|
+
// If the behaviour is allowed through the dialog will be shown but then
|
16
|
+
// quickly hidden- as if it were never shown. This prevents that.
|
17
|
+
event.preventDefault()
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
dialogId = button.getAttribute('data-close-dialog-id') || button.getAttribute('data-submit-dialog-id')
|
22
|
+
if (dialogId) {
|
23
|
+
const dialog = document.getElementById(dialogId)
|
24
|
+
if (dialog instanceof HTMLDialogElement && dialog.open) {
|
25
|
+
dialog.close()
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
export class DialogHelperElement extends HTMLElement {
|
31
|
+
get dialog() {
|
32
|
+
return this.querySelector('dialog')
|
33
|
+
}
|
34
|
+
|
35
|
+
#abortController: AbortController | null = null
|
36
|
+
connectedCallback() {
|
37
|
+
const {signal} = (this.#abortController = new AbortController())
|
38
|
+
document.addEventListener('click', dialogInvokerButtonHandler)
|
39
|
+
document.addEventListener('click', this, {signal})
|
40
|
+
this.ownerDocument.body.style.setProperty(
|
41
|
+
'--dialog-scrollgutter',
|
42
|
+
`${window.innerWidth - this.ownerDocument.body.clientWidth}px`,
|
43
|
+
)
|
44
|
+
new MutationObserver(records => {
|
45
|
+
for (const record of records) {
|
46
|
+
if (record.target === this.dialog) {
|
47
|
+
this.ownerDocument.body.classList.toggle('has-modal', this.dialog.hasAttribute('open'))
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}).observe(this, {subtree: true, attributeFilter: ['open']})
|
51
|
+
}
|
52
|
+
|
53
|
+
disconnectedCallback() {
|
54
|
+
this.#abortController?.abort()
|
55
|
+
}
|
56
|
+
|
57
|
+
handleEvent(event: MouseEvent) {
|
58
|
+
const target = event.target as HTMLElement
|
59
|
+
const dialog = this.dialog
|
60
|
+
if (!dialog?.open) return
|
61
|
+
if (target?.closest('dialog') !== dialog) return
|
62
|
+
|
63
|
+
const rect = dialog.getBoundingClientRect()
|
64
|
+
const clickWasInsideDialog =
|
65
|
+
rect.top <= event.clientY &&
|
66
|
+
event.clientY <= rect.top + rect.height &&
|
67
|
+
rect.left <= event.clientX &&
|
68
|
+
event.clientX <= rect.left + rect.width
|
69
|
+
|
70
|
+
if (!clickWasInsideDialog) {
|
71
|
+
dialog.close()
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
declare global {
|
77
|
+
interface Window {
|
78
|
+
DialogHelperElement: typeof DialogHelperElement
|
79
|
+
}
|
80
|
+
interface HTMLElementTagNameMap {
|
81
|
+
'dialog-helper': DialogHelperElement
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
if (!window.customElements.get('dialog-helper')) {
|
86
|
+
window.DialogHelperElement = DialogHelperElement
|
87
|
+
window.customElements.define('dialog-helper', DialogHelperElement)
|
88
|
+
}
|
@@ -7,16 +7,16 @@ module Primer
|
|
7
7
|
HEADING_TAG_OPTIONS = [:h1, :h2, :h3, :h4, :h5, :h6].freeze
|
8
8
|
HEADING_TAG_FALLBACK = :h2
|
9
9
|
|
10
|
-
DEFAULT_HEADER_VARIANT = :
|
10
|
+
DEFAULT_HEADER_VARIANT = :large
|
11
11
|
HEADER_VARIANT_OPTIONS = [
|
12
|
-
:
|
12
|
+
:medium,
|
13
13
|
DEFAULT_HEADER_VARIANT
|
14
14
|
].freeze
|
15
15
|
|
16
16
|
DEFAULT_BACK_BUTTON_SIZE = :medium
|
17
17
|
BACK_BUTTON_SIZE_OPTIONS = [
|
18
18
|
:small,
|
19
|
-
|
19
|
+
DEFAULT_BACK_BUTTON_SIZE,
|
20
20
|
:large
|
21
21
|
].freeze
|
22
22
|
|
@@ -2,7 +2,9 @@ import '@github/include-fragment-element';
|
|
2
2
|
import './alpha/action_bar_element';
|
3
3
|
import './alpha/dropdown';
|
4
4
|
import './anchored_position';
|
5
|
+
import './dialog_helper';
|
5
6
|
import './focus_group';
|
7
|
+
import './scrollable_region';
|
6
8
|
import './alpha/image_crop';
|
7
9
|
import './alpha/modal_dialog';
|
8
10
|
import './beta/nav_list';
|
@@ -2,7 +2,9 @@ import '@github/include-fragment-element';
|
|
2
2
|
import './alpha/action_bar_element';
|
3
3
|
import './alpha/dropdown';
|
4
4
|
import './anchored_position';
|
5
|
+
import './dialog_helper';
|
5
6
|
import './focus_group';
|
7
|
+
import './scrollable_region';
|
6
8
|
import './alpha/image_crop';
|
7
9
|
import './alpha/modal_dialog';
|
8
10
|
import './beta/nav_list';
|
@@ -2,7 +2,9 @@ import '@github/include-fragment-element'
|
|
2
2
|
import './alpha/action_bar_element'
|
3
3
|
import './alpha/dropdown'
|
4
4
|
import './anchored_position'
|
5
|
+
import './dialog_helper'
|
5
6
|
import './focus_group'
|
7
|
+
import './scrollable_region'
|
6
8
|
import './alpha/image_crop'
|
7
9
|
import './alpha/modal_dialog'
|
8
10
|
import './beta/nav_list'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export declare class ScrollableRegionElement extends HTMLElement {
|
2
|
+
hasOverflow: boolean;
|
3
|
+
labelledBy: string;
|
4
|
+
observer: ResizeObserver;
|
5
|
+
connectedCallback(): void;
|
6
|
+
disconnectedCallback(): void;
|
7
|
+
attributeChangedCallback(name: string): void;
|
8
|
+
}
|
9
|
+
declare global {
|
10
|
+
interface Window {
|
11
|
+
ScrollableRegionElement: typeof ScrollableRegionElement;
|
12
|
+
}
|
13
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
import { controller, attr } from '@github/catalyst';
|
8
|
+
let ScrollableRegionElement = class ScrollableRegionElement extends HTMLElement {
|
9
|
+
constructor() {
|
10
|
+
super(...arguments);
|
11
|
+
this.hasOverflow = false;
|
12
|
+
this.labelledBy = '';
|
13
|
+
}
|
14
|
+
connectedCallback() {
|
15
|
+
this.style.overflow = 'auto';
|
16
|
+
this.observer = new ResizeObserver(entries => {
|
17
|
+
for (const entry of entries) {
|
18
|
+
this.hasOverflow =
|
19
|
+
entry.target.scrollHeight > entry.target.clientHeight || entry.target.scrollWidth > entry.target.clientWidth;
|
20
|
+
}
|
21
|
+
});
|
22
|
+
this.observer.observe(this);
|
23
|
+
}
|
24
|
+
disconnectedCallback() {
|
25
|
+
this.observer.disconnect();
|
26
|
+
}
|
27
|
+
attributeChangedCallback(name) {
|
28
|
+
if (name === 'data-has-overflow') {
|
29
|
+
if (this.hasOverflow) {
|
30
|
+
this.setAttribute('aria-labelledby', this.labelledBy);
|
31
|
+
this.setAttribute('role', 'region');
|
32
|
+
this.setAttribute('tabindex', '0');
|
33
|
+
}
|
34
|
+
else {
|
35
|
+
this.removeAttribute('aria-labelledby');
|
36
|
+
this.removeAttribute('role');
|
37
|
+
this.removeAttribute('tabindex');
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
};
|
42
|
+
__decorate([
|
43
|
+
attr
|
44
|
+
], ScrollableRegionElement.prototype, "hasOverflow", void 0);
|
45
|
+
__decorate([
|
46
|
+
attr
|
47
|
+
], ScrollableRegionElement.prototype, "labelledBy", void 0);
|
48
|
+
ScrollableRegionElement = __decorate([
|
49
|
+
controller
|
50
|
+
], ScrollableRegionElement);
|
51
|
+
export { ScrollableRegionElement };
|
52
|
+
window.ScrollableRegionElement = ScrollableRegionElement;
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import {controller, attr} from '@github/catalyst'
|
2
|
+
|
3
|
+
@controller
|
4
|
+
export class ScrollableRegionElement extends HTMLElement {
|
5
|
+
@attr hasOverflow = false
|
6
|
+
@attr labelledBy = ''
|
7
|
+
|
8
|
+
observer: ResizeObserver
|
9
|
+
|
10
|
+
connectedCallback() {
|
11
|
+
this.style.overflow = 'auto'
|
12
|
+
|
13
|
+
this.observer = new ResizeObserver(entries => {
|
14
|
+
for (const entry of entries) {
|
15
|
+
this.hasOverflow =
|
16
|
+
entry.target.scrollHeight > entry.target.clientHeight || entry.target.scrollWidth > entry.target.clientWidth
|
17
|
+
}
|
18
|
+
})
|
19
|
+
|
20
|
+
this.observer.observe(this)
|
21
|
+
}
|
22
|
+
|
23
|
+
disconnectedCallback() {
|
24
|
+
this.observer.disconnect()
|
25
|
+
}
|
26
|
+
|
27
|
+
attributeChangedCallback(name: string) {
|
28
|
+
if (name === 'data-has-overflow') {
|
29
|
+
if (this.hasOverflow) {
|
30
|
+
this.setAttribute('aria-labelledby', this.labelledBy)
|
31
|
+
this.setAttribute('role', 'region')
|
32
|
+
this.setAttribute('tabindex', '0')
|
33
|
+
} else {
|
34
|
+
this.removeAttribute('aria-labelledby')
|
35
|
+
this.removeAttribute('role')
|
36
|
+
this.removeAttribute('tabindex')
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
declare global {
|
43
|
+
interface Window {
|
44
|
+
ScrollableRegionElement: typeof ScrollableRegionElement
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
window.ScrollableRegionElement = ScrollableRegionElement
|
@@ -18,6 +18,7 @@ module Primer
|
|
18
18
|
|
19
19
|
# Replacements for some classnames that end up being a different argument key
|
20
20
|
REPLACEMENT_KEYS = {
|
21
|
+
"^f" => "font_size",
|
21
22
|
"^anim" => "animation",
|
22
23
|
"^v-align" => "vertical_align",
|
23
24
|
"^d" => "display",
|
@@ -27,7 +28,8 @@ module Primer
|
|
27
28
|
"^height" => "h",
|
28
29
|
"^color-bg" => "bg",
|
29
30
|
"^color-border" => "border_color",
|
30
|
-
"^color-fg" => "color"
|
31
|
+
"^color-fg" => "color",
|
32
|
+
"^rounded" => "border_radius"
|
31
33
|
}.freeze
|
32
34
|
|
33
35
|
SUPPORTED_KEY_CACHE = Hash.new { |h, k| h[k] = !UTILITIES[k].nil? }
|
@@ -91,9 +93,6 @@ module Primer
|
|
91
93
|
|
92
94
|
# Extract hash from classes ie. "mr-1 mb-2 foo" => { mr: 1, mb: 2, classes: "foo" }
|
93
95
|
def classes_to_hash(classes)
|
94
|
-
# This method is too slow to run in production
|
95
|
-
return { classes: classes } unless validate_class_names?
|
96
|
-
|
97
96
|
obj = {}
|
98
97
|
classes = classes.split
|
99
98
|
# Loop through all classes supplied and reject ones we find a match for
|
data/lib/primer/deprecations.yml
CHANGED
@@ -40,7 +40,7 @@ deprecations:
|
|
40
40
|
- component: "Primer::ButtonComponent"
|
41
41
|
autocorrect: false
|
42
42
|
replacement: "Primer::Beta::Button"
|
43
|
-
guide: "https://primer.style/
|
43
|
+
guide: "https://primer.style/guides/rails/migration-guides/primer-button-component"
|
44
44
|
|
45
45
|
- component: "Primer::IconButton"
|
46
46
|
autocorrect: true
|
@@ -49,7 +49,7 @@ deprecations:
|
|
49
49
|
- component: "Primer::LayoutComponent"
|
50
50
|
autocorrect: false
|
51
51
|
replacement: "Primer::Alpha::Layout"
|
52
|
-
guide: "https://primer.style/
|
52
|
+
guide: "https://primer.style/guides/rails/migration-guides/primer-layout-component"
|
53
53
|
|
54
54
|
- component: "Primer::Navigation::TabComponent"
|
55
55
|
autocorrect: true
|
@@ -62,4 +62,4 @@ deprecations:
|
|
62
62
|
- component: "Primer::Truncate"
|
63
63
|
autocorrect: false
|
64
64
|
replacement: "Primer::Beta::Truncate"
|
65
|
-
guide: "https://primer.style/
|
65
|
+
guide: "https://primer.style/guides/rails/migration-guides/primer-truncate"
|
@@ -27,9 +27,11 @@ module Primer
|
|
27
27
|
end
|
28
28
|
|
29
29
|
# check boxes cannot be invalid, as both checked and unchecked are valid states
|
30
|
+
# :nocov:
|
30
31
|
def valid?
|
31
32
|
true
|
32
33
|
end
|
34
|
+
# :nocov:
|
33
35
|
|
34
36
|
def to_component
|
35
37
|
CheckBox.new(input: self)
|
@@ -44,6 +46,10 @@ module Primer
|
|
44
46
|
:check_box
|
45
47
|
end
|
46
48
|
|
49
|
+
def supports_validation?
|
50
|
+
false
|
51
|
+
end
|
52
|
+
|
47
53
|
private
|
48
54
|
|
49
55
|
def caption_template_name
|
@@ -121,7 +121,7 @@ module Primer
|
|
121
121
|
@base_id = SecureRandom.uuid
|
122
122
|
|
123
123
|
@ids = {}.tap do |id_map|
|
124
|
-
id_map[:validation] = "validation-#{@base_id}"
|
124
|
+
id_map[:validation] = "validation-#{@base_id}" if supports_validation?
|
125
125
|
id_map[:caption] = "caption-#{@base_id}" if caption? || caption_template?
|
126
126
|
end
|
127
127
|
|
@@ -208,11 +208,11 @@ module Primer
|
|
208
208
|
end
|
209
209
|
|
210
210
|
def valid?
|
211
|
-
validation_messages.empty? && !@invalid
|
211
|
+
supports_validation? && validation_messages.empty? && !@invalid
|
212
212
|
end
|
213
213
|
|
214
214
|
def invalid?
|
215
|
-
!valid?
|
215
|
+
supports_validation? && !valid?
|
216
216
|
end
|
217
217
|
|
218
218
|
def hidden?
|
@@ -284,6 +284,10 @@ module Primer
|
|
284
284
|
true
|
285
285
|
end
|
286
286
|
|
287
|
+
def supports_validation?
|
288
|
+
true
|
289
|
+
end
|
290
|
+
|
287
291
|
def validation_arguments
|
288
292
|
{
|
289
293
|
class: "FormControl-inlineValidation",
|
@@ -18,9 +18,11 @@ module Primer
|
|
18
18
|
end
|
19
19
|
|
20
20
|
# radio buttons cannot be invalid, as both selected and unselected are valid states
|
21
|
+
# :nocov:
|
21
22
|
def valid?
|
22
23
|
true
|
23
24
|
end
|
25
|
+
# :nocov:
|
24
26
|
|
25
27
|
def to_component
|
26
28
|
RadioButton.new(input: self)
|
@@ -36,6 +38,10 @@ module Primer
|
|
36
38
|
:radio_button
|
37
39
|
end
|
38
40
|
# :nocov:
|
41
|
+
|
42
|
+
def supports_validation?
|
43
|
+
false
|
44
|
+
end
|
39
45
|
end
|
40
46
|
end
|
41
47
|
end
|
@@ -9,12 +9,14 @@ module Primer
|
|
9
9
|
|
10
10
|
# :nodoc:
|
11
11
|
class Option
|
12
|
+
include Primer::TestSelectorHelper
|
13
|
+
|
12
14
|
attr_reader :label, :value, :system_arguments
|
13
15
|
|
14
16
|
def initialize(label:, value:, **system_arguments)
|
15
17
|
@label = label
|
16
18
|
@value = value
|
17
|
-
@system_arguments = system_arguments
|
19
|
+
@system_arguments = add_test_selector(system_arguments)
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
@@ -9,7 +9,9 @@
|
|
9
9
|
<% end %>
|
10
10
|
<% end %>
|
11
11
|
<%= content %>
|
12
|
-
|
12
|
+
<% if @input.supports_validation? %>
|
13
|
+
<%= render(ValidationMessage.new(input: @input)) %>
|
14
|
+
<% end %>
|
13
15
|
<%= render(Caption.new(input: @input)) %>
|
14
16
|
<% end %>
|
15
17
|
<% else %>
|
@@ -10,7 +10,7 @@ module ERBLint
|
|
10
10
|
include LinterRegistry
|
11
11
|
include Helpers::RuleHelpers
|
12
12
|
|
13
|
-
MIGRATE_TO_NEWER_TOOLTIP = ".tooltipped has been deprecated. There are major accessibility concerns with using this tooltip so please take action. See https://primer.style/
|
13
|
+
MIGRATE_TO_NEWER_TOOLTIP = ".tooltipped has been deprecated. There are major accessibility concerns with using this tooltip so please take action. See https://primer.style/guides/rails/migration-guides/primer-css-tooltipped."
|
14
14
|
TOOLTIPPED_RUBY_PATTERN = /classes:.*tooltipped|class:.*tooltipped/.freeze
|
15
15
|
|
16
16
|
def run(processed_source)
|
@@ -8,7 +8,7 @@ module Primer
|
|
8
8
|
module DocsHelper
|
9
9
|
def one_of(enumerable, lower: false, sort: true)
|
10
10
|
# Sort the array if requested
|
11
|
-
if sort
|
11
|
+
if sort && !enumerable.nil?
|
12
12
|
enumerable = enumerable.sort do |a, b|
|
13
13
|
a.instance_of?(b.class) ? a <=> b : a.class.to_s <=> b.class.to_s
|
14
14
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div style="height: 400px"></div>
|
2
|
+
|
3
|
+
<div style="position: relative">
|
4
|
+
<%= render Primer::Alpha::ActionMenu.new(anchor_align: :end) do |c| %>
|
5
|
+
<% c.with_show_button { "Edit" } %>
|
6
|
+
<% c.with_item(tag: :button, type: "button", label: "Rename") %>
|
7
|
+
<% c.with_item(tag: :button, type: "button", scheme: :danger, label: "Remove") %>
|
8
|
+
<% end %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div style="height: 1400px"></div>
|
@@ -9,13 +9,14 @@ module Primer
|
|
9
9
|
# @param full toggle
|
10
10
|
# @param full_when_narrow toggle
|
11
11
|
# @param dismiss_scheme [Symbol] select [none, remove, hide]
|
12
|
+
# @param dismiss_label text
|
12
13
|
# @param icon [Symbol] octicon
|
13
14
|
# @param scheme [Symbol] select [default, warning, danger, success]
|
14
15
|
# @param content text
|
15
16
|
# @param description text
|
16
|
-
def playground(full: false, full_when_narrow: false, dismiss_scheme: Primer::Alpha::Banner::DEFAULT_DISMISS_SCHEME, icon: :people, scheme: Primer::Alpha::Banner::DEFAULT_SCHEME, content: "This is a banner!", description: nil)
|
17
|
+
def playground(full: false, full_when_narrow: false, dismiss_scheme: Primer::Alpha::Banner::DEFAULT_DISMISS_SCHEME, dismiss_label: Primer::Alpha::Banner::DEFAULT_DISMISS_LABEL, icon: :people, scheme: Primer::Alpha::Banner::DEFAULT_SCHEME, content: "This is a banner!", description: nil)
|
17
18
|
icon = nil if icon == :none
|
18
|
-
render(Primer::Alpha::Banner.new(full: full, full_when_narrow: full_when_narrow, dismiss_scheme: dismiss_scheme, icon: icon == :none ? nil : icon, scheme: scheme, description: description)) { content }
|
19
|
+
render(Primer::Alpha::Banner.new(full: full, full_when_narrow: full_when_narrow, dismiss_scheme: dismiss_scheme, dismiss_label: dismiss_label, icon: icon == :none ? nil : icon, scheme: scheme, description: description)) { content }
|
19
20
|
end
|
20
21
|
|
21
22
|
# @label Default
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= render(Primer::Alpha::Dialog.new(id: "dialog-one", title: title, subtitle: subtitle, visually_hide_title: false)) do |d| %>
|
1
|
+
<%= render(Primer::Alpha::Dialog.new(id: "dialog-one", title: title, position: position, subtitle: subtitle, visually_hide_title: false)) do |d| %>
|
2
2
|
<% d.with_show_button { button_text } %>
|
3
3
|
<% d.with_body do %>
|
4
4
|
<p>Dialog One!</p>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<%= render(Primer::Alpha::Dialog.new(id: "dialog-one", title: title, position: position, subtitle: subtitle, visually_hide_title: false)) do |d| %>
|
2
|
+
<% d.with_show_button { button_text } %>
|
3
|
+
<% d.with_body { body_text} %>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<!-- just some lorem ipsum -->
|
7
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut etiam sit amet nisl purus in. Amet risus nullam eget felis. Consectetur adipiscing elit ut aliquam purus sit amet luctus. Non quam lacus suspendisse faucibus interdum. Tempus iaculis urna id volutpat lacus laoreet non curabitur. Ipsum nunc aliquet bibendum enim facilisis gravida. Egestas pretium aenean pharetra magna. Amet mattis vulputate enim nulla aliquet. Diam vel quam elementum pulvinar etiam non. Tempor orci eu lobortis elementum. Arcu non odio euismod lacinia at quis risus sed.</p>
|
8
|
+
|
9
|
+
<p>Aenean pharetra magna ac placerat vestibulum lectus mauris. Aenean euismod elementum nisi quis eleifend quam. Duis at tellus at urna condimentum. Tortor dignissim convallis aenean et tortor. Eget nullam non nisi est sit amet facilisis magna. Fermentum et sollicitudin ac orci phasellus egestas tellus. Ac turpis egestas maecenas pharetra convallis posuere morbi leo urna. In nisl nisi scelerisque eu. A erat nam at lectus. Dolor magna eget est lorem. Volutpat diam ut venenatis tellus in metus vulputate eu scelerisque. Eros donec ac odio tempor orci dapibus ultrices in iaculis. Aenean et tortor at risus. Suspendisse sed nisi lacus sed viverra tellus in. Arcu felis bibendum ut tristique et.</p>
|
10
|
+
|
11
|
+
<p>At ultrices mi tempus imperdiet nulla malesuada pellentesque elit. Nisl suscipit adipiscing bibendum est ultricies integer quis. Nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Malesuada fames ac turpis egestas maecenas. Fames ac turpis egestas sed tempus urna et pharetra. Vitae elementum curabitur vitae nunc sed velit dignissim sodales ut. Nisi lacus sed viverra tellus in hac habitasse platea. Arcu non odio euismod lacinia at quis risus sed vulputate. Ac placerat vestibulum lectus mauris ultrices eros. Magna sit amet purus gravida quis blandit turpis. Arcu felis bibendum ut tristique. Egestas congue quisque egestas diam in arcu cursus. Pretium aenean pharetra magna ac placerat. Diam maecenas sed enim ut sem viverra. Egestas sed sed risus pretium quam vulputate dignissim suspendisse. Tincidunt id aliquet risus feugiat in. A cras semper auctor neque vitae tempus. Eu lobortis elementum nibh tellus molestie. Neque ornare aenean euismod elementum nisi quis eleifend.</p>
|
12
|
+
|
13
|
+
<p>Sed nisi lacus sed viverra tellus in. Nisl condimentum id venenatis a condimentum vitae. Integer malesuada nunc vel risus commodo viverra maecenas accumsan. Magnis dis parturient montes nascetur ridiculus mus mauris vitae ultricies. Nulla facilisi cras fermentum odio eu. Adipiscing elit pellentesque habitant morbi tristique senectus. Urna condimentum mattis pellentesque id. Arcu cursus euismod quis viverra nibh cras pulvinar. Elementum integer enim neque volutpat ac. Euismod nisi porta lorem mollis aliquam ut porttitor. Mauris nunc congue nisi vitae suscipit tellus mauris a. Volutpat blandit aliquam etiam erat velit. Risus sed vulputate odio ut. Ut sem nulla pharetra diam. Turpis massa sed elementum tempus egestas sed sed risus pretium. Cras sed felis eget velit aliquet sagittis. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat.</p>
|
14
|
+
|
15
|
+
<p>Eget felis eget nunc lobortis mattis aliquam faucibus. Enim nunc faucibus a pellentesque sit amet. Luctus accumsan tortor posuere ac ut consequat. Sed euismod nisi porta lorem mollis aliquam ut porttitor leo. Tincidunt tortor aliquam nulla facilisi cras fermentum odio. Lobortis elementum nibh tellus molestie nunc non blandit. Luctus accumsan tortor posuere ac ut consequat semper. Etiam tempor orci eu lobortis elementum. Posuere ac ut consequat semper. Feugiat nisl pretium fusce id velit ut tortor pretium viverra. Aliquam id diam maecenas ultricies mi eget mauris pharetra. Maecenas ultricies mi eget mauris pharetra et. Sodales ut eu sem integer vitae justo eget magna fermentum. Ac placerat vestibulum lectus mauris ultrices eros in cursus. Eu non diam phasellus vestibulum lorem sed risus. Facilisi nullam vehicula ipsum a arcu cursus vitae congue mauris. Mauris pharetra et ultrices neque ornare. Aliquam ultrices sagittis orci a. Diam maecenas ultricies mi eget mauris pharetra. Molestie ac feugiat sed lectus vestibulum mattis ullamcorper velit sed.</p>
|
16
|
+
|
17
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut etiam sit amet nisl purus in. Amet risus nullam eget felis. Consectetur adipiscing elit ut aliquam purus sit amet luctus. Non quam lacus suspendisse faucibus interdum. Tempus iaculis urna id volutpat lacus laoreet non curabitur. Ipsum nunc aliquet bibendum enim facilisis gravida. Egestas pretium aenean pharetra magna. Amet mattis vulputate enim nulla aliquet. Diam vel quam elementum pulvinar etiam non. Tempor orci eu lobortis elementum. Arcu non odio euismod lacinia at quis risus sed.</p>
|
18
|
+
|
19
|
+
<p>Aenean pharetra magna ac placerat vestibulum lectus mauris. Aenean euismod elementum nisi quis eleifend quam. Duis at tellus at urna condimentum. Tortor dignissim convallis aenean et tortor. Eget nullam non nisi est sit amet facilisis magna. Fermentum et sollicitudin ac orci phasellus egestas tellus. Ac turpis egestas maecenas pharetra convallis posuere morbi leo urna. In nisl nisi scelerisque eu. A erat nam at lectus. Dolor magna eget est lorem. Volutpat diam ut venenatis tellus in metus vulputate eu scelerisque. Eros donec ac odio tempor orci dapibus ultrices in iaculis. Aenean et tortor at risus. Suspendisse sed nisi lacus sed viverra tellus in. Arcu felis bibendum ut tristique et.</p>
|
20
|
+
|
21
|
+
<p>At ultrices mi tempus imperdiet nulla malesuada pellentesque elit. Nisl suscipit adipiscing bibendum est ultricies integer quis. Nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Malesuada fames ac turpis egestas maecenas. Fames ac turpis egestas sed tempus urna et pharetra. Vitae elementum curabitur vitae nunc sed velit dignissim sodales ut. Nisi lacus sed viverra tellus in hac habitasse platea. Arcu non odio euismod lacinia at quis risus sed vulputate. Ac placerat vestibulum lectus mauris ultrices eros. Magna sit amet purus gravida quis blandit turpis. Arcu felis bibendum ut tristique. Egestas congue quisque egestas diam in arcu cursus. Pretium aenean pharetra magna ac placerat. Diam maecenas sed enim ut sem viverra. Egestas sed sed risus pretium quam vulputate dignissim suspendisse. Tincidunt id aliquet risus feugiat in. A cras semper auctor neque vitae tempus. Eu lobortis elementum nibh tellus molestie. Neque ornare aenean euismod elementum nisi quis eleifend.</p>
|
22
|
+
|
23
|
+
<p>Sed nisi lacus sed viverra tellus in. Nisl condimentum id venenatis a condimentum vitae. Integer malesuada nunc vel risus commodo viverra maecenas accumsan. Magnis dis parturient montes nascetur ridiculus mus mauris vitae ultricies. Nulla facilisi cras fermentum odio eu. Adipiscing elit pellentesque habitant morbi tristique senectus. Urna condimentum mattis pellentesque id. Arcu cursus euismod quis viverra nibh cras pulvinar. Elementum integer enim neque volutpat ac. Euismod nisi porta lorem mollis aliquam ut porttitor. Mauris nunc congue nisi vitae suscipit tellus mauris a. Volutpat blandit aliquam etiam erat velit. Risus sed vulputate odio ut. Ut sem nulla pharetra diam. Turpis massa sed elementum tempus egestas sed sed risus pretium. Cras sed felis eget velit aliquet sagittis. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat.</p>
|
24
|
+
|
25
|
+
<p>Eget felis eget nunc lobortis mattis aliquam faucibus. Enim nunc faucibus a pellentesque sit amet. Luctus accumsan tortor posuere ac ut consequat. Sed euismod nisi porta lorem mollis aliquam ut porttitor leo. Tincidunt tortor aliquam nulla facilisi cras fermentum odio. Lobortis elementum nibh tellus molestie nunc non blandit. Luctus accumsan tortor posuere ac ut consequat semper. Etiam tempor orci eu lobortis elementum. Posuere ac ut consequat semper. Feugiat nisl pretium fusce id velit ut tortor pretium viverra. Aliquam id diam maecenas ultricies mi eget mauris pharetra. Maecenas ultricies mi eget mauris pharetra et. Sodales ut eu sem integer vitae justo eget magna fermentum. Ac placerat vestibulum lectus mauris ultrices eros in cursus. Eu non diam phasellus vestibulum lorem sed risus. Facilisi nullam vehicula ipsum a arcu cursus vitae congue mauris. Mauris pharetra et ultrices neque ornare. Aliquam ultrices sagittis orci a. Diam maecenas ultricies mi eget mauris pharetra. Molestie ac feugiat sed lectus vestibulum mattis ullamcorper velit sed.</p>
|
26
|
+
|
27
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut etiam sit amet nisl purus in. Amet risus nullam eget felis. Consectetur adipiscing elit ut aliquam purus sit amet luctus. Non quam lacus suspendisse faucibus interdum. Tempus iaculis urna id volutpat lacus laoreet non curabitur. Ipsum nunc aliquet bibendum enim facilisis gravida. Egestas pretium aenean pharetra magna. Amet mattis vulputate enim nulla aliquet. Diam vel quam elementum pulvinar etiam non. Tempor orci eu lobortis elementum. Arcu non odio euismod lacinia at quis risus sed.</p>
|
28
|
+
|
29
|
+
<p>Aenean pharetra magna ac placerat vestibulum lectus mauris. Aenean euismod elementum nisi quis eleifend quam. Duis at tellus at urna condimentum. Tortor dignissim convallis aenean et tortor. Eget nullam non nisi est sit amet facilisis magna. Fermentum et sollicitudin ac orci phasellus egestas tellus. Ac turpis egestas maecenas pharetra convallis posuere morbi leo urna. In nisl nisi scelerisque eu. A erat nam at lectus. Dolor magna eget est lorem. Volutpat diam ut venenatis tellus in metus vulputate eu scelerisque. Eros donec ac odio tempor orci dapibus ultrices in iaculis. Aenean et tortor at risus. Suspendisse sed nisi lacus sed viverra tellus in. Arcu felis bibendum ut tristique et.</p>
|
30
|
+
|
31
|
+
<p>At ultrices mi tempus imperdiet nulla malesuada pellentesque elit. Nisl suscipit adipiscing bibendum est ultricies integer quis. Nec sagittis aliquam malesuada bibendum arcu vitae elementum curabitur. Malesuada fames ac turpis egestas maecenas. Fames ac turpis egestas sed tempus urna et pharetra. Vitae elementum curabitur vitae nunc sed velit dignissim sodales ut. Nisi lacus sed viverra tellus in hac habitasse platea. Arcu non odio euismod lacinia at quis risus sed vulputate. Ac placerat vestibulum lectus mauris ultrices eros. Magna sit amet purus gravida quis blandit turpis. Arcu felis bibendum ut tristique. Egestas congue quisque egestas diam in arcu cursus. Pretium aenean pharetra magna ac placerat. Diam maecenas sed enim ut sem viverra. Egestas sed sed risus pretium quam vulputate dignissim suspendisse. Tincidunt id aliquet risus feugiat in. A cras semper auctor neque vitae tempus. Eu lobortis elementum nibh tellus molestie. Neque ornare aenean euismod elementum nisi quis eleifend.</p>
|
32
|
+
|
33
|
+
<p>Sed nisi lacus sed viverra tellus in. Nisl condimentum id venenatis a condimentum vitae. Integer malesuada nunc vel risus commodo viverra maecenas accumsan. Magnis dis parturient montes nascetur ridiculus mus mauris vitae ultricies. Nulla facilisi cras fermentum odio eu. Adipiscing elit pellentesque habitant morbi tristique senectus. Urna condimentum mattis pellentesque id. Arcu cursus euismod quis viverra nibh cras pulvinar. Elementum integer enim neque volutpat ac. Euismod nisi porta lorem mollis aliquam ut porttitor. Mauris nunc congue nisi vitae suscipit tellus mauris a. Volutpat blandit aliquam etiam erat velit. Risus sed vulputate odio ut. Ut sem nulla pharetra diam. Turpis massa sed elementum tempus egestas sed sed risus pretium. Cras sed felis eget velit aliquet sagittis. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis feugiat.</p>
|
34
|
+
|
35
|
+
<p>Eget felis eget nunc lobortis mattis aliquam faucibus. Enim nunc faucibus a pellentesque sit amet. Luctus accumsan tortor posuere ac ut consequat. Sed euismod nisi porta lorem mollis aliquam ut porttitor leo. Tincidunt tortor aliquam nulla facilisi cras fermentum odio. Lobortis elementum nibh tellus molestie nunc non blandit. Luctus accumsan tortor posuere ac ut consequat semper. Etiam tempor orci eu lobortis elementum. Posuere ac ut consequat semper. Feugiat nisl pretium fusce id velit ut tortor pretium viverra. Aliquam id diam maecenas ultricies mi eget mauris pharetra. Maecenas ultricies mi eget mauris pharetra et. Sodales ut eu sem integer vitae justo eget magna fermentum. Ac placerat vestibulum lectus mauris ultrices eros in cursus. Eu non diam phasellus vestibulum lorem sed risus. Facilisi nullam vehicula ipsum a arcu cursus vitae congue mauris. Mauris pharetra et ultrices neque ornare. Aliquam ultrices sagittis orci a. Diam maecenas ultricies mi eget mauris pharetra. Molestie ac feugiat sed lectus vestibulum mattis ullamcorper velit sed.</p>
|