openproject-primer_view_components 0.49.1 → 0.50.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 +26 -0
- data/app/assets/javascripts/components/primer/alpha/select_panel_element.d.ts +3 -1
- data/app/assets/javascripts/components/primer/primer.d.ts +0 -1
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/assets/styles/primer_view_components.css +1 -1
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/alpha/action_bar.rb +2 -2
- data/app/components/primer/alpha/action_bar_element.js +0 -7
- data/app/components/primer/alpha/action_bar_element.ts +0 -8
- data/app/components/primer/alpha/action_list/item.rb +1 -1
- data/app/components/primer/alpha/select_panel.html.erb +1 -1
- data/app/components/primer/alpha/select_panel_element.d.ts +3 -1
- data/app/components/primer/alpha/select_panel_element.js +10 -12
- data/app/components/primer/alpha/select_panel_element.ts +9 -10
- data/app/components/primer/base_component.rb +4 -1
- data/app/components/primer/beta/auto_complete.rb +1 -0
- data/app/components/primer/beta/button.rb +0 -11
- data/app/components/primer/beta/link.css +1 -1
- data/app/components/primer/beta/link.css.json +2 -1
- data/app/components/primer/beta/link.css.map +1 -1
- data/app/components/primer/beta/link.html.erb +18 -0
- data/app/components/primer/beta/link.pcss +9 -0
- data/app/components/primer/beta/link.rb +26 -14
- 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 +4 -0
- data/app/components/primer/button_component.rb +0 -11
- data/app/components/primer/component.rb +7 -0
- data/app/components/primer/conditional_wrapper.rb +5 -2
- data/app/components/primer/primer.d.ts +0 -1
- data/app/components/primer/primer.js +0 -1
- data/app/components/primer/primer.ts +0 -1
- data/app/forms/horizontal_form.rb +2 -0
- data/app/lib/primer/forms/auto_complete.rb +2 -1
- data/app/lib/primer/forms/dsl/hidden_input.rb +4 -0
- data/app/lib/primer/forms/group.rb +4 -1
- data/lib/primer/classify/utilities.yml +63 -0
- data/lib/primer/classify.rb +1 -26
- data/lib/primer/forms/primer_multi_input.d.ts +10 -0
- data/lib/primer/forms/primer_multi_input.js +44 -0
- data/lib/primer/forms/primer_text_field.d.ts +28 -0
- data/lib/primer/forms/primer_text_field.js +119 -0
- data/lib/primer/forms/toggle_switch_input.d.ts +5 -0
- data/lib/primer/forms/toggle_switch_input.js +34 -0
- data/lib/primer/static/generate_form_previews.rb +44 -0
- data/lib/primer/static.rb +8 -0
- data/lib/primer/view_components/version.rb +2 -2
- data/lib/tasks/custom_utilities.yml +63 -0
- data/previews/primer/beta/link_preview.rb +24 -2
- data/previews/primer/forms_preview.rb +21 -0
- data/static/classes.json +3 -0
- data/static/form_previews.json +113 -0
- metadata +11 -6
- data/app/assets/javascripts/components/primer/aria_live.d.ts +0 -8
- data/app/components/primer/aria_live.d.ts +0 -8
- data/app/components/primer/aria_live.js +0 -38
- data/app/components/primer/aria_live.ts +0 -41
@@ -1877,3 +1877,66 @@
|
|
1877
1877
|
- flex-md-shrink-0
|
1878
1878
|
- flex-lg-shrink-0
|
1879
1879
|
- flex-xl-shrink-0
|
1880
|
+
:overflow:
|
1881
|
+
:auto:
|
1882
|
+
- overflow-auto
|
1883
|
+
- overflow-sm-auto
|
1884
|
+
- overflow-lg-auto
|
1885
|
+
- overflow-xl-auto
|
1886
|
+
:hidden:
|
1887
|
+
- overflow-hidden
|
1888
|
+
- overflow-sm-hidden
|
1889
|
+
- overflow-lg-hidden
|
1890
|
+
- overflow-xl-hidden
|
1891
|
+
:scroll:
|
1892
|
+
- overflow-scroll
|
1893
|
+
- overflow-sm-scroll
|
1894
|
+
- overflow-lg-scroll
|
1895
|
+
- overflow-xl-scroll
|
1896
|
+
:visible:
|
1897
|
+
- overflow-visible
|
1898
|
+
- overflow-sm-visible
|
1899
|
+
- overflow-lg-visible
|
1900
|
+
- overflow-xl-visible
|
1901
|
+
:overflow_x:
|
1902
|
+
:auto:
|
1903
|
+
- overflow-x-auto
|
1904
|
+
- overflow-sm-x-auto
|
1905
|
+
- overflow-lg-x-auto
|
1906
|
+
- overflow-xl-x-auto
|
1907
|
+
:hidden:
|
1908
|
+
- overflow-x-hidden
|
1909
|
+
- overflow-sm-x-hidden
|
1910
|
+
- overflow-lg-x-hidden
|
1911
|
+
- overflow-xl-x-hidden
|
1912
|
+
:scroll:
|
1913
|
+
- overflow-x-scroll
|
1914
|
+
- overflow-sm-x-scroll
|
1915
|
+
- overflow-lg-x-scroll
|
1916
|
+
- overflow-xl-x-scroll
|
1917
|
+
:visible:
|
1918
|
+
- overflow-x-visible
|
1919
|
+
- overflow-sm-x-visible
|
1920
|
+
- overflow-lg-x-visible
|
1921
|
+
- overflow-xl-x-visible
|
1922
|
+
:overflow_y:
|
1923
|
+
:auto:
|
1924
|
+
- overflow-y-auto
|
1925
|
+
- overflow-sm-y-auto
|
1926
|
+
- overflow-lg-y-auto
|
1927
|
+
- overflow-xl-y-auto
|
1928
|
+
:hidden:
|
1929
|
+
- overflow-y-hidden
|
1930
|
+
- overflow-sm-y-hidden
|
1931
|
+
- overflow-lg-y-hidden
|
1932
|
+
- overflow-xl-y-hidden
|
1933
|
+
:scroll:
|
1934
|
+
- overflow-y-scroll
|
1935
|
+
- overflow-sm-y-scroll
|
1936
|
+
- overflow-lg-y-scroll
|
1937
|
+
- overflow-xl-y-scroll
|
1938
|
+
:visible:
|
1939
|
+
- overflow-y-visible
|
1940
|
+
- overflow-sm-y-visible
|
1941
|
+
- overflow-lg-y-visible
|
1942
|
+
- overflow-xl-y-visible
|
data/lib/primer/classify.rb
CHANGED
@@ -49,9 +49,7 @@ module Primer
|
|
49
49
|
case key
|
50
50
|
when :classes
|
51
51
|
# insert :classes first to avoid huge doc diffs
|
52
|
-
|
53
|
-
result.unshift(class_names)
|
54
|
-
end
|
52
|
+
result.unshift(val)
|
55
53
|
next
|
56
54
|
when :style
|
57
55
|
style = val
|
@@ -105,29 +103,6 @@ module Primer
|
|
105
103
|
brk_str = Primer::Classify::Utilities::BREAKPOINTS[brk]
|
106
104
|
Primer::Classify::Utilities.validate(key, val, brk_str)
|
107
105
|
end
|
108
|
-
|
109
|
-
def validated_class_names(classes)
|
110
|
-
return if classes.blank?
|
111
|
-
|
112
|
-
if raise_on_invalid_options? && !ENV["PRIMER_WARNINGS_DISABLED"]
|
113
|
-
invalid_class_names =
|
114
|
-
classes.split.each_with_object([]) do |class_name, memo|
|
115
|
-
memo << class_name if Primer::Classify::Validation.invalid?(class_name)
|
116
|
-
end
|
117
|
-
|
118
|
-
if invalid_class_names.any?
|
119
|
-
raise ArgumentError, "Use System Arguments (https://primer.style/view-components/system-arguments) "\
|
120
|
-
"instead of Primer CSS class #{'name'.pluralize(invalid_class_names.length)} #{invalid_class_names.to_sentence}. "\
|
121
|
-
"This warning will not be raised in production. Set PRIMER_WARNINGS_DISABLED=1 to disable this warning."
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
classes
|
126
|
-
end
|
127
|
-
|
128
|
-
def raise_on_invalid_options?
|
129
|
-
Rails.application.config.primer_view_components.raise_on_invalid_options
|
130
|
-
end
|
131
106
|
end
|
132
107
|
end
|
133
108
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export declare class PrimerMultiInputElement extends HTMLElement {
|
2
|
+
fields: HTMLInputElement[];
|
3
|
+
activateField(name: string): void;
|
4
|
+
private findField;
|
5
|
+
}
|
6
|
+
declare global {
|
7
|
+
interface Window {
|
8
|
+
PrimerMultiInputElement: typeof PrimerMultiInputElement;
|
9
|
+
}
|
10
|
+
}
|
@@ -0,0 +1,44 @@
|
|
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
|
+
/* eslint-disable custom-elements/expose-class-on-global */
|
8
|
+
import { controller, targets } from '@github/catalyst';
|
9
|
+
let PrimerMultiInputElement = class PrimerMultiInputElement extends HTMLElement {
|
10
|
+
activateField(name) {
|
11
|
+
const fieldWithName = this.findField(name);
|
12
|
+
if (!fieldWithName)
|
13
|
+
return;
|
14
|
+
for (const field of this.fields) {
|
15
|
+
if (field === fieldWithName)
|
16
|
+
continue;
|
17
|
+
field.setAttribute('disabled', 'disabled');
|
18
|
+
field.setAttribute('hidden', 'hidden');
|
19
|
+
field.parentElement?.setAttribute('hidden', 'hidden');
|
20
|
+
}
|
21
|
+
fieldWithName.removeAttribute('disabled');
|
22
|
+
fieldWithName.removeAttribute('hidden');
|
23
|
+
fieldWithName.parentElement?.removeAttribute('hidden');
|
24
|
+
}
|
25
|
+
findField(name) {
|
26
|
+
for (const field of this.fields) {
|
27
|
+
if (field.getAttribute('data-name') === name) {
|
28
|
+
return field;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
return null;
|
32
|
+
}
|
33
|
+
};
|
34
|
+
__decorate([
|
35
|
+
targets
|
36
|
+
], PrimerMultiInputElement.prototype, "fields", void 0);
|
37
|
+
PrimerMultiInputElement = __decorate([
|
38
|
+
controller
|
39
|
+
], PrimerMultiInputElement);
|
40
|
+
export { PrimerMultiInputElement };
|
41
|
+
if (!window.customElements.get('primer-multi-input')) {
|
42
|
+
Object.assign(window, { PrimerMultiInputElement });
|
43
|
+
window.customElements.define('primer-multi-input', PrimerMultiInputElement);
|
44
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import '@github/auto-check-element';
|
2
|
+
import type { AutoCheckErrorEvent, AutoCheckSuccessEvent } from '@github/auto-check-element';
|
3
|
+
declare global {
|
4
|
+
interface HTMLElementEventMap {
|
5
|
+
'auto-check-success': AutoCheckSuccessEvent;
|
6
|
+
'auto-check-error': AutoCheckErrorEvent;
|
7
|
+
}
|
8
|
+
}
|
9
|
+
export declare class PrimerTextFieldElement extends HTMLElement {
|
10
|
+
#private;
|
11
|
+
inputElement: HTMLInputElement;
|
12
|
+
validationElement: HTMLElement;
|
13
|
+
validationMessageElement: HTMLElement;
|
14
|
+
validationSuccessIcon: HTMLElement;
|
15
|
+
validationErrorIcon: HTMLElement;
|
16
|
+
leadingVisual: HTMLElement;
|
17
|
+
leadingSpinner: HTMLElement;
|
18
|
+
connectedCallback(): void;
|
19
|
+
disconnectedCallback(): void;
|
20
|
+
clearContents(): void;
|
21
|
+
clearError(): void;
|
22
|
+
setValidationMessage(message: string): void;
|
23
|
+
toggleValidationStyling(isError: boolean): void;
|
24
|
+
setSuccess(message: string): void;
|
25
|
+
setError(message: string): void;
|
26
|
+
showLeadingSpinner(): void;
|
27
|
+
hideLeadingSpinner(): void;
|
28
|
+
}
|
@@ -0,0 +1,119 @@
|
|
1
|
+
/* eslint-disable custom-elements/expose-class-on-global */
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
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;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
10
|
+
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");
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
12
|
+
};
|
13
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
14
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
15
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
16
|
+
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");
|
17
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
18
|
+
};
|
19
|
+
var _PrimerTextFieldElement_abortController;
|
20
|
+
import '@github/auto-check-element';
|
21
|
+
import { controller, target } from '@github/catalyst';
|
22
|
+
let PrimerTextFieldElement = class PrimerTextFieldElement extends HTMLElement {
|
23
|
+
constructor() {
|
24
|
+
super(...arguments);
|
25
|
+
_PrimerTextFieldElement_abortController.set(this, void 0);
|
26
|
+
}
|
27
|
+
connectedCallback() {
|
28
|
+
__classPrivateFieldGet(this, _PrimerTextFieldElement_abortController, "f")?.abort();
|
29
|
+
const { signal } = (__classPrivateFieldSet(this, _PrimerTextFieldElement_abortController, new AbortController(), "f"));
|
30
|
+
this.addEventListener('auto-check-success', async (event) => {
|
31
|
+
const message = await event.detail.response.text();
|
32
|
+
if (message && message.length > 0) {
|
33
|
+
this.setSuccess(message);
|
34
|
+
}
|
35
|
+
else {
|
36
|
+
this.clearError();
|
37
|
+
}
|
38
|
+
}, { signal });
|
39
|
+
this.addEventListener('auto-check-error', async (event) => {
|
40
|
+
const errorMessage = await event.detail.response.text();
|
41
|
+
this.setError(errorMessage);
|
42
|
+
}, { signal });
|
43
|
+
}
|
44
|
+
disconnectedCallback() {
|
45
|
+
__classPrivateFieldGet(this, _PrimerTextFieldElement_abortController, "f")?.abort();
|
46
|
+
}
|
47
|
+
clearContents() {
|
48
|
+
this.inputElement.value = '';
|
49
|
+
this.inputElement.focus();
|
50
|
+
this.inputElement.dispatchEvent(new Event('input', { bubbles: true, cancelable: false }));
|
51
|
+
}
|
52
|
+
clearError() {
|
53
|
+
this.inputElement.removeAttribute('invalid');
|
54
|
+
this.validationElement.hidden = true;
|
55
|
+
this.validationMessageElement.replaceChildren();
|
56
|
+
}
|
57
|
+
setValidationMessage(message) {
|
58
|
+
const template = document.createElement('template');
|
59
|
+
// eslint-disable-next-line github/no-inner-html
|
60
|
+
template.innerHTML = message;
|
61
|
+
const fragment = document.importNode(template.content, true);
|
62
|
+
this.validationMessageElement.replaceChildren(fragment);
|
63
|
+
}
|
64
|
+
toggleValidationStyling(isError) {
|
65
|
+
if (isError) {
|
66
|
+
this.validationElement.classList.remove('FormControl-inlineValidation--success');
|
67
|
+
}
|
68
|
+
else {
|
69
|
+
this.validationElement.classList.add('FormControl-inlineValidation--success');
|
70
|
+
}
|
71
|
+
this.validationSuccessIcon.hidden = isError;
|
72
|
+
this.validationErrorIcon.hidden = !isError;
|
73
|
+
this.inputElement.setAttribute('invalid', isError ? 'true' : 'false');
|
74
|
+
}
|
75
|
+
setSuccess(message) {
|
76
|
+
this.toggleValidationStyling(false);
|
77
|
+
this.setValidationMessage(message);
|
78
|
+
this.validationElement.hidden = false;
|
79
|
+
}
|
80
|
+
setError(message) {
|
81
|
+
this.toggleValidationStyling(true);
|
82
|
+
this.setValidationMessage(message);
|
83
|
+
this.validationElement.hidden = false;
|
84
|
+
}
|
85
|
+
showLeadingSpinner() {
|
86
|
+
this.leadingSpinner?.removeAttribute('hidden');
|
87
|
+
this.leadingVisual?.setAttribute('hidden', '');
|
88
|
+
}
|
89
|
+
hideLeadingSpinner() {
|
90
|
+
this.leadingSpinner?.setAttribute('hidden', '');
|
91
|
+
this.leadingVisual?.removeAttribute('hidden');
|
92
|
+
}
|
93
|
+
};
|
94
|
+
_PrimerTextFieldElement_abortController = new WeakMap();
|
95
|
+
__decorate([
|
96
|
+
target
|
97
|
+
], PrimerTextFieldElement.prototype, "inputElement", void 0);
|
98
|
+
__decorate([
|
99
|
+
target
|
100
|
+
], PrimerTextFieldElement.prototype, "validationElement", void 0);
|
101
|
+
__decorate([
|
102
|
+
target
|
103
|
+
], PrimerTextFieldElement.prototype, "validationMessageElement", void 0);
|
104
|
+
__decorate([
|
105
|
+
target
|
106
|
+
], PrimerTextFieldElement.prototype, "validationSuccessIcon", void 0);
|
107
|
+
__decorate([
|
108
|
+
target
|
109
|
+
], PrimerTextFieldElement.prototype, "validationErrorIcon", void 0);
|
110
|
+
__decorate([
|
111
|
+
target
|
112
|
+
], PrimerTextFieldElement.prototype, "leadingVisual", void 0);
|
113
|
+
__decorate([
|
114
|
+
target
|
115
|
+
], PrimerTextFieldElement.prototype, "leadingSpinner", void 0);
|
116
|
+
PrimerTextFieldElement = __decorate([
|
117
|
+
controller
|
118
|
+
], PrimerTextFieldElement);
|
119
|
+
export { PrimerTextFieldElement };
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/* eslint-disable custom-elements/expose-class-on-global */
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
+
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;
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
+
};
|
8
|
+
import { controller, target } from '@github/catalyst';
|
9
|
+
let ToggleSwitchInputElement = class ToggleSwitchInputElement extends HTMLElement {
|
10
|
+
connectedCallback() {
|
11
|
+
this.addEventListener('toggleSwitchError', (event) => {
|
12
|
+
this.validationMessageElement.textContent = event.detail;
|
13
|
+
this.validationElement.removeAttribute('hidden');
|
14
|
+
});
|
15
|
+
this.addEventListener('toggleSwitchSuccess', () => {
|
16
|
+
this.validationMessageElement.textContent = '';
|
17
|
+
this.validationElement.setAttribute('hidden', 'hidden');
|
18
|
+
});
|
19
|
+
this.addEventListener('toggleSwitchLoading', () => {
|
20
|
+
this.validationMessageElement.textContent = '';
|
21
|
+
this.validationElement.setAttribute('hidden', 'hidden');
|
22
|
+
});
|
23
|
+
}
|
24
|
+
};
|
25
|
+
__decorate([
|
26
|
+
target
|
27
|
+
], ToggleSwitchInputElement.prototype, "validationElement", void 0);
|
28
|
+
__decorate([
|
29
|
+
target
|
30
|
+
], ToggleSwitchInputElement.prototype, "validationMessageElement", void 0);
|
31
|
+
ToggleSwitchInputElement = __decorate([
|
32
|
+
controller
|
33
|
+
], ToggleSwitchInputElement);
|
34
|
+
export { ToggleSwitchInputElement };
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# :nocov:
|
4
|
+
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Primer
|
8
|
+
module Static
|
9
|
+
# :nodoc:
|
10
|
+
module GenerateFormPreviews
|
11
|
+
class << self
|
12
|
+
def call
|
13
|
+
Lookbook.previews.filter_map do |preview|
|
14
|
+
next unless preview.preview_class == Primer::FormsPreview
|
15
|
+
|
16
|
+
{
|
17
|
+
name: preview.name,
|
18
|
+
lookup_path: preview.lookup_path,
|
19
|
+
examples: preview.scenarios.flat_map do |parent_scenario|
|
20
|
+
scenarios = parent_scenario.type == :scenario_group ? parent_scenario.scenarios : [parent_scenario]
|
21
|
+
|
22
|
+
scenarios.map do |scenario|
|
23
|
+
snapshot_tag = scenario.tags.find { |tag| tag.tag_name == "snapshot" }
|
24
|
+
snapshot = if snapshot_tag.nil?
|
25
|
+
"false"
|
26
|
+
elsif snapshot_tag.text.blank?
|
27
|
+
"true"
|
28
|
+
else
|
29
|
+
snapshot_tag.text
|
30
|
+
end
|
31
|
+
{
|
32
|
+
preview_path: scenario.lookup_path,
|
33
|
+
name: scenario.name,
|
34
|
+
snapshot: snapshot
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/primer/static.rb
CHANGED
@@ -15,6 +15,7 @@ module Primer
|
|
15
15
|
audited_at: "audited_at.json",
|
16
16
|
arguments: "arguments.json",
|
17
17
|
previews: "previews.json",
|
18
|
+
form_previews: "form_previews.json",
|
18
19
|
info_arch: "info_arch.json"
|
19
20
|
}.freeze
|
20
21
|
|
@@ -50,6 +51,13 @@ module Primer
|
|
50
51
|
Static::GeneratePreviews.call
|
51
52
|
end
|
52
53
|
|
54
|
+
# Returns an array of hashes, one per example form, that contains some metadata and
|
55
|
+
# an array of all the form's previews. The preview data contains the Lookbook URL
|
56
|
+
# to each preview and its name.
|
57
|
+
def self.generate_form_previews
|
58
|
+
Static::GenerateFormPreviews.call
|
59
|
+
end
|
60
|
+
|
53
61
|
# Returns an array of hashes, one per Primer component, that contains all the data needed
|
54
62
|
# for the new primer.style docsite.
|
55
63
|
def self.generate_info_arch
|
@@ -370,3 +370,66 @@
|
|
370
370
|
- flex-md-shrink-0
|
371
371
|
- flex-lg-shrink-0
|
372
372
|
- flex-xl-shrink-0
|
373
|
+
:overflow:
|
374
|
+
:auto:
|
375
|
+
- overflow-auto
|
376
|
+
- overflow-sm-auto
|
377
|
+
- overflow-lg-auto
|
378
|
+
- overflow-xl-auto
|
379
|
+
:hidden:
|
380
|
+
- overflow-hidden
|
381
|
+
- overflow-sm-hidden
|
382
|
+
- overflow-lg-hidden
|
383
|
+
- overflow-xl-hidden
|
384
|
+
:scroll:
|
385
|
+
- overflow-scroll
|
386
|
+
- overflow-sm-scroll
|
387
|
+
- overflow-lg-scroll
|
388
|
+
- overflow-xl-scroll
|
389
|
+
:visible:
|
390
|
+
- overflow-visible
|
391
|
+
- overflow-sm-visible
|
392
|
+
- overflow-lg-visible
|
393
|
+
- overflow-xl-visible
|
394
|
+
:overflow_x:
|
395
|
+
:auto:
|
396
|
+
- overflow-x-auto
|
397
|
+
- overflow-sm-x-auto
|
398
|
+
- overflow-lg-x-auto
|
399
|
+
- overflow-xl-x-auto
|
400
|
+
:hidden:
|
401
|
+
- overflow-x-hidden
|
402
|
+
- overflow-sm-x-hidden
|
403
|
+
- overflow-lg-x-hidden
|
404
|
+
- overflow-xl-x-hidden
|
405
|
+
:scroll:
|
406
|
+
- overflow-x-scroll
|
407
|
+
- overflow-sm-x-scroll
|
408
|
+
- overflow-lg-x-scroll
|
409
|
+
- overflow-xl-x-scroll
|
410
|
+
:visible:
|
411
|
+
- overflow-x-visible
|
412
|
+
- overflow-sm-x-visible
|
413
|
+
- overflow-lg-x-visible
|
414
|
+
- overflow-xl-x-visible
|
415
|
+
:overflow_y:
|
416
|
+
:auto:
|
417
|
+
- overflow-y-auto
|
418
|
+
- overflow-sm-y-auto
|
419
|
+
- overflow-lg-y-auto
|
420
|
+
- overflow-xl-y-auto
|
421
|
+
:hidden:
|
422
|
+
- overflow-y-hidden
|
423
|
+
- overflow-sm-y-hidden
|
424
|
+
- overflow-lg-y-hidden
|
425
|
+
- overflow-xl-y-hidden
|
426
|
+
:scroll:
|
427
|
+
- overflow-y-scroll
|
428
|
+
- overflow-sm-y-scroll
|
429
|
+
- overflow-lg-y-scroll
|
430
|
+
- overflow-xl-y-scroll
|
431
|
+
:visible:
|
432
|
+
- overflow-y-visible
|
433
|
+
- overflow-sm-y-visible
|
434
|
+
- overflow-lg-y-visible
|
435
|
+
- overflow-xl-y-visible
|
@@ -9,8 +9,14 @@ module Primer
|
|
9
9
|
# @param underline [Boolean]
|
10
10
|
# @param muted [Boolean]
|
11
11
|
# @param scheme [Symbol] select [default, primary, secondary]
|
12
|
-
|
13
|
-
|
12
|
+
# @param leading_visual_icon [Symbol] octicon
|
13
|
+
# @param trailing_visual_icon [Symbol] octicon
|
14
|
+
def playground(scheme: :default, muted: false, underline: true, leading_visual_icon: nil, trailing_visual_icon: nil)
|
15
|
+
render(Primer::Beta::Link.new(href: "#", scheme: scheme, muted: muted, underline: underline)) do |link|
|
16
|
+
link.with_leading_visual_icon(icon: leading_visual_icon) if leading_visual_icon && leading_visual_icon != :none
|
17
|
+
link.with_trailing_visual_icon(icon: trailing_visual_icon) if trailing_visual_icon && trailing_visual_icon != :none
|
18
|
+
"This is a link!"
|
19
|
+
end
|
14
20
|
end
|
15
21
|
|
16
22
|
# @label Default Options
|
@@ -66,6 +72,22 @@ module Primer
|
|
66
72
|
render(Primer::Beta::Link.new(href: "#", scheme: :secondary, muted: true)) { "This is a muted secondary link color." }
|
67
73
|
end
|
68
74
|
# @!endgroup
|
75
|
+
|
76
|
+
# @label With leading icon
|
77
|
+
def with_leading_icon
|
78
|
+
render(Primer::Beta::Link.new(href: "#")) do |component|
|
79
|
+
component.with_leading_visual_icon(icon: :"mark-github")
|
80
|
+
"Link with leading icon"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# @label With trailing icon
|
85
|
+
def with_trailing_icon
|
86
|
+
render(Primer::Beta::Link.new(href: "#")) do |component|
|
87
|
+
component.with_trailing_visual_icon(icon: :"link-external")
|
88
|
+
"Link with trailing icon"
|
89
|
+
end
|
90
|
+
end
|
69
91
|
end
|
70
92
|
end
|
71
93
|
end
|
@@ -3,50 +3,71 @@
|
|
3
3
|
module Primer
|
4
4
|
# :nodoc:
|
5
5
|
class FormsPreview < ViewComponent::Preview
|
6
|
+
# @snapshot
|
6
7
|
def single_text_field_form; end
|
7
8
|
|
9
|
+
# @snapshot
|
8
10
|
def multi_text_field_form; end
|
9
11
|
|
10
12
|
def custom_width_fields_form; end
|
11
13
|
|
14
|
+
# @snapshot
|
12
15
|
def text_field_and_checkbox_form; end
|
13
16
|
|
17
|
+
# @snapshot
|
14
18
|
def horizontal_form; end
|
15
19
|
|
20
|
+
# @snapshot
|
16
21
|
def composed_form; end
|
17
22
|
|
23
|
+
# @snapshot
|
18
24
|
def submit_button_form; end
|
19
25
|
|
26
|
+
# @snapshot
|
20
27
|
def radio_button_group_form; end
|
21
28
|
|
29
|
+
# @snapshot
|
22
30
|
def check_box_group_form; end
|
23
31
|
|
32
|
+
# @snapshot
|
24
33
|
def array_check_box_group_form; end
|
25
34
|
|
35
|
+
# @snapshot
|
26
36
|
def select_form; end
|
27
37
|
|
38
|
+
# @snapshot
|
28
39
|
def action_menu_form(route_format: :html)
|
29
40
|
render_with_template(locals: { route_format: route_format })
|
30
41
|
end
|
31
42
|
|
43
|
+
# @snapshot
|
32
44
|
def radio_button_with_nested_form; end
|
33
45
|
|
46
|
+
# @snapshot
|
34
47
|
def check_box_with_nested_form; end
|
35
48
|
|
49
|
+
# @snapshot
|
36
50
|
def caption_template_form; end
|
37
51
|
|
52
|
+
# @snapshot
|
38
53
|
def after_content_form; end
|
39
54
|
|
55
|
+
# @snapshot
|
40
56
|
def invalid_form; end
|
41
57
|
|
58
|
+
# @snapshot
|
42
59
|
def multi_input_form; end
|
43
60
|
|
61
|
+
# @snapshot
|
44
62
|
def name_with_question_mark_form; end
|
45
63
|
|
64
|
+
# @snapshot
|
46
65
|
def immediate_validation_form; end
|
47
66
|
|
67
|
+
# @snapshot
|
48
68
|
def example_toggle_switch_form; end
|
49
69
|
|
70
|
+
# @snapshot
|
50
71
|
def auto_complete_form; end
|
51
72
|
end
|
52
73
|
end
|