primer_view_components 0.1.9 → 0.2.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 +51 -0
- data/README.md +1 -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 -3
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/alpha/action_list/item.rb +2 -2
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.json +16 -16
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/action_list.pcss +145 -145
- data/app/components/primer/alpha/action_list.rb +30 -15
- data/app/components/primer/alpha/action_menu/action_menu_element.d.ts +2 -1
- data/app/components/primer/alpha/action_menu/action_menu_element.js +44 -34
- data/app/components/primer/alpha/action_menu/action_menu_element.ts +32 -30
- data/app/components/primer/alpha/action_menu/list.rb +6 -1
- data/app/components/primer/alpha/auto_complete.css +1 -1
- data/app/components/primer/alpha/auto_complete.css.map +1 -1
- data/app/components/primer/alpha/auto_complete.pcss +3 -3
- data/app/components/primer/alpha/banner.css +1 -1
- data/app/components/primer/alpha/banner.css.map +1 -1
- data/app/components/primer/alpha/banner.pcss +11 -11
- data/app/components/primer/alpha/button_marketing.css.map +1 -1
- data/app/components/primer/alpha/button_marketing.pcss +5 -12
- data/app/components/primer/alpha/button_marketing.rb +3 -0
- data/app/components/primer/alpha/dialog.css +1 -1
- data/app/components/primer/alpha/dialog.css.map +1 -1
- data/app/components/primer/alpha/dialog.pcss +36 -36
- data/app/components/primer/alpha/dropdown.css +1 -1
- data/app/components/primer/alpha/dropdown.css.map +1 -1
- data/app/components/primer/alpha/dropdown.pcss +12 -12
- data/app/components/primer/alpha/form_control.html.erb +1 -1
- data/app/components/primer/alpha/hellip_button.rb +3 -1
- data/app/components/primer/alpha/layout.css +1 -1
- data/app/components/primer/alpha/layout.css.map +1 -1
- data/app/components/primer/alpha/layout.pcss +4 -4
- data/app/components/primer/alpha/menu.css +1 -1
- data/app/components/primer/alpha/menu.css.map +1 -1
- data/app/components/primer/alpha/menu.pcss +21 -21
- data/app/components/primer/alpha/modal_dialog.js +11 -4
- data/app/components/primer/alpha/modal_dialog.ts +11 -4
- data/app/components/primer/alpha/nav_list/item.rb +2 -0
- data/app/components/primer/alpha/nav_list.js +6 -0
- data/app/components/primer/alpha/nav_list.rb +55 -36
- data/app/components/primer/alpha/nav_list.ts +8 -0
- data/app/components/primer/alpha/octicon_symbols.html.erb +1 -1
- data/app/components/primer/alpha/overlay.css +1 -1
- data/app/components/primer/alpha/overlay.css.json +1 -2
- data/app/components/primer/alpha/overlay.css.map +1 -1
- data/app/components/primer/alpha/overlay.pcss +14 -4
- data/app/components/primer/alpha/segmented_control.css +1 -1
- data/app/components/primer/alpha/segmented_control.css.map +1 -1
- data/app/components/primer/alpha/segmented_control.pcss +24 -33
- data/app/components/primer/alpha/tab_nav.css +1 -1
- data/app/components/primer/alpha/tab_nav.css.map +1 -1
- data/app/components/primer/alpha/tab_nav.pcss +12 -12
- data/app/components/primer/alpha/text_field.css +1 -3
- data/app/components/primer/alpha/text_field.css.json +1 -0
- data/app/components/primer/alpha/text_field.css.map +1 -1
- data/app/components/primer/alpha/text_field.pcss +87 -83
- data/app/components/primer/alpha/toggle_switch.css +1 -1
- data/app/components/primer/alpha/toggle_switch.css.map +1 -1
- data/app/components/primer/alpha/toggle_switch.pcss +12 -12
- 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/alpha/underline_nav.pcss +11 -11
- data/app/components/primer/beta/avatar.css +1 -1
- data/app/components/primer/beta/avatar.css.map +1 -1
- data/app/components/primer/beta/avatar.pcss +18 -18
- data/app/components/primer/beta/avatar_stack.css +1 -1
- data/app/components/primer/beta/avatar_stack.css.map +1 -1
- data/app/components/primer/beta/avatar_stack.pcss +5 -5
- data/app/components/primer/beta/base_button.rb +11 -0
- data/app/components/primer/beta/blankslate.css +1 -1
- data/app/components/primer/beta/blankslate.css.map +1 -1
- data/app/components/primer/beta/blankslate.pcss +16 -16
- data/app/components/primer/beta/border_box.css +1 -1
- data/app/components/primer/beta/border_box.css.json +1 -1
- data/app/components/primer/beta/border_box.css.map +1 -1
- data/app/components/primer/beta/border_box.pcss +40 -42
- data/app/components/primer/beta/button.css +1 -1
- data/app/components/primer/beta/button.css.json +4 -0
- data/app/components/primer/beta/button.css.map +1 -1
- data/app/components/primer/beta/button.pcss +39 -24
- data/app/components/primer/beta/button.rb +3 -0
- data/app/components/primer/beta/button_group.css +1 -0
- data/app/components/primer/beta/button_group.css.json +14 -0
- data/app/components/primer/beta/button_group.css.map +1 -0
- data/app/components/primer/beta/button_group.pcss +27 -0
- data/app/components/primer/beta/button_group.rb +19 -19
- data/app/components/primer/beta/close_button.rb +3 -1
- data/app/components/primer/beta/counter.css +1 -1
- data/app/components/primer/beta/counter.css.map +1 -1
- data/app/components/primer/beta/counter.pcss +5 -5
- data/app/components/primer/beta/details.html.erb +6 -2
- data/app/components/primer/beta/details.rb +18 -10
- data/app/components/primer/beta/flash.css +1 -1
- data/app/components/primer/beta/flash.css.map +1 -1
- data/app/components/primer/beta/flash.pcss +12 -12
- data/app/components/primer/beta/icon_button.rb +7 -3
- data/app/components/primer/beta/label.css +1 -1
- data/app/components/primer/beta/label.css.map +1 -1
- data/app/components/primer/beta/label.pcss +3 -3
- 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 -4
- data/app/components/primer/beta/state.css +1 -1
- data/app/components/primer/beta/state.css.map +1 -1
- data/app/components/primer/beta/state.pcss +7 -7
- data/app/components/primer/beta/subhead.css +1 -1
- data/app/components/primer/beta/subhead.css.map +1 -1
- data/app/components/primer/beta/subhead.pcss +9 -9
- data/app/components/primer/beta/timeline_item.css +1 -1
- data/app/components/primer/beta/timeline_item.css.map +1 -1
- data/app/components/primer/beta/timeline_item.pcss +18 -18
- data/app/components/primer/beta/truncate.css +1 -1
- data/app/components/primer/beta/truncate.css.map +1 -1
- data/app/components/primer/beta/truncate.pcss +1 -1
- data/app/components/primer/focus_group.js +1 -10
- data/app/components/primer/focus_group.ts +1 -10
- data/app/components/primer/primer.d.ts +1 -0
- data/app/components/primer/primer.js +1 -0
- data/app/components/primer/primer.pcss +1 -0
- data/app/components/primer/primer.ts +1 -0
- data/lib/postcss_mixins/activeIndicatorLine.pcss +4 -4
- data/lib/primer/accessibility.rb +74 -0
- data/lib/primer/forms/form_control.html.erb +1 -1
- data/lib/primer/static/generate_previews.rb +15 -8
- data/lib/primer/view_components/linters/deprecated_components_counter.rb +37 -13
- data/lib/primer/view_components/version.rb +2 -2
- data/lib/primer/yard/lookbook_pages_backend.rb +3 -3
- data/previews/pages/forms/03_caption_templates.md.erb +1 -1
- data/previews/pages/forms/04_after_content.md.erb +1 -1
- data/previews/pages/forms/06_miscellaneous_inputs.md.erb +1 -1
- data/previews/pages/forms/07_toggle_switch_forms.md.erb +1 -1
- data/previews/primer/alpha/action_menu_preview/two_menus.html.erb +13 -0
- data/previews/primer/alpha/action_menu_preview/with_actions.html.erb +21 -0
- data/previews/primer/alpha/action_menu_preview.rb +5 -13
- data/previews/primer/alpha/button_marketing_preview.rb +3 -2
- data/previews/primer/alpha/dialog_preview.rb +4 -3
- data/previews/primer/alpha/hellip_button_preview.rb +3 -2
- data/previews/primer/alpha/nav_list_preview.rb +1 -1
- data/previews/primer/beta/base_button_preview.rb +9 -2
- data/previews/primer/beta/button_group_preview/action_menus.html.erb +8 -0
- data/previews/primer/beta/button_group_preview.rb +49 -11
- data/previews/primer/beta/button_preview/trailing_counter.html.erb +1 -1
- data/previews/primer/beta/button_preview.rb +5 -2
- data/previews/primer/beta/close_button_preview.rb +3 -2
- data/previews/primer/beta/details_preview.rb +11 -8
- data/previews/primer/forms_preview.rb +44 -0
- data/static/arguments.json +4 -4
- data/static/classes.json +378 -372
- data/static/constants.json +0 -1
- data/static/info_arch.json +5150 -1368
- data/static/previews.json +5197 -1433
- metadata +37 -29
- data/previews/primer/forms/forms_preview.rb +0 -48
- /data/previews/primer/{forms/forms_preview → forms_preview}/after_content_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/array_check_box_group_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/caption_template_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/check_box_group_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/check_box_with_nested_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/composed_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/example_toggle_switch_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/horizontal_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/immediate_validation_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/invalid_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/multi_input_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/multi_text_field_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/name_with_question_mark_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/radio_button_group_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/radio_button_with_nested_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/select_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/single_text_field_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/submit_button_form.html.erb +0 -0
- /data/previews/primer/{forms/forms_preview → forms_preview}/text_field_and_checkbox_form.html.erb +0 -0
@@ -1,3 +1,9 @@
|
|
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
|
+
};
|
1
7
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
2
8
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
3
9
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
@@ -9,19 +15,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
9
15
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
10
16
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
17
|
};
|
12
|
-
var _ActionMenuElement_instances, _ActionMenuElement_abortController, _ActionMenuElement_originalLabel, _ActionMenuElement_inputName, _ActionMenuElement_setDynamicLabel, _ActionMenuElement_updateInput,
|
13
|
-
import '@github/
|
14
|
-
const popoverSelector = (() => {
|
15
|
-
try {
|
16
|
-
document.querySelector(':open');
|
17
|
-
return ':open';
|
18
|
-
}
|
19
|
-
catch (_a) {
|
20
|
-
return '.\\:open';
|
21
|
-
}
|
22
|
-
})();
|
18
|
+
var _ActionMenuElement_instances, _ActionMenuElement_abortController, _ActionMenuElement_originalLabel, _ActionMenuElement_inputName, _ActionMenuElement_setDynamicLabel, _ActionMenuElement_updateInput, _ActionMenuElement_isActivationKeydown, _ActionMenuElement_firstItem_get;
|
19
|
+
import { controller, target } from '@github/catalyst';
|
23
20
|
const menuItemSelectors = ['[role="menuitem"]', '[role="menuitemcheckbox"]', '[role="menuitemradio"]'];
|
24
|
-
|
21
|
+
let ActionMenuElement = class ActionMenuElement extends HTMLElement {
|
25
22
|
constructor() {
|
26
23
|
super(...arguments);
|
27
24
|
_ActionMenuElement_instances.add(this);
|
@@ -95,13 +92,16 @@ export class ActionMenuElement extends HTMLElement {
|
|
95
92
|
this.addEventListener('focusout', this, { signal });
|
96
93
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_setDynamicLabel).call(this);
|
97
94
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_updateInput).call(this);
|
95
|
+
if (this.includeFragment) {
|
96
|
+
this.includeFragment.addEventListener('include-fragment-replaced', this, { signal });
|
97
|
+
}
|
98
98
|
}
|
99
99
|
disconnectedCallback() {
|
100
100
|
__classPrivateFieldGet(this, _ActionMenuElement_abortController, "f").abort();
|
101
101
|
}
|
102
102
|
handleEvent(event) {
|
103
|
-
var _a, _b
|
104
|
-
if (event.target === this.invokerElement && __classPrivateFieldGet(this, _ActionMenuElement_instances, "m",
|
103
|
+
var _a, _b;
|
104
|
+
if (event.target === this.invokerElement && __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isActivationKeydown).call(this, event)) {
|
105
105
|
if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "a", _ActionMenuElement_firstItem_get)) {
|
106
106
|
event.preventDefault();
|
107
107
|
(_a = this.popoverElement) === null || _a === void 0 ? void 0 : _a.showPopover();
|
@@ -109,22 +109,34 @@ export class ActionMenuElement extends HTMLElement {
|
|
109
109
|
return;
|
110
110
|
}
|
111
111
|
}
|
112
|
-
if (!((_b = this.popoverElement) === null || _b === void 0 ? void 0 : _b.matches(
|
112
|
+
if (!((_b = this.popoverElement) === null || _b === void 0 ? void 0 : _b.matches(':popover-open')))
|
113
113
|
return;
|
114
|
-
if (event.type === '
|
115
|
-
(
|
114
|
+
if (event.type === 'include-fragment-replaced') {
|
115
|
+
if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "a", _ActionMenuElement_firstItem_get))
|
116
|
+
__classPrivateFieldGet(this, _ActionMenuElement_instances, "a", _ActionMenuElement_firstItem_get).focus();
|
116
117
|
}
|
117
|
-
else if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "m",
|
118
|
-
|
118
|
+
else if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isActivationKeydown).call(this, event) || (event instanceof MouseEvent && event.type === 'click')) {
|
119
|
+
// Hide popover after current event loop to prevent changes in focus from
|
120
|
+
// altering the target of the event. Not doing this specifically affects
|
121
|
+
// <a> tags. It causes the event to be sent to the currently focused element
|
122
|
+
// instead of the anchor, which effectively prevents navigation, i.e. it
|
123
|
+
// appears as if hitting enter does nothing. Curiously, clicking instead
|
124
|
+
// works fine.
|
125
|
+
if (this.selectVariant !== 'multiple') {
|
126
|
+
setTimeout(() => { var _a; return (_a = this.popoverElement) === null || _a === void 0 ? void 0 : _a.hidePopover(); });
|
127
|
+
}
|
128
|
+
// The rest of the code below deals with single/multiple selection behavior, and should not
|
129
|
+
// interfere with events fired by menu items whose behavior is specified outside the library.
|
130
|
+
if (this.selectVariant !== 'multiple' && this.selectVariant !== 'single')
|
131
|
+
return;
|
132
|
+
const item = event.target.closest(menuItemSelectors.join(','));
|
119
133
|
if (!item)
|
120
134
|
return;
|
121
135
|
const ariaChecked = item.getAttribute('aria-checked');
|
122
136
|
const checked = ariaChecked !== 'true';
|
123
137
|
item.setAttribute('aria-checked', `${checked}`);
|
124
138
|
if (this.selectVariant === 'single') {
|
125
|
-
const
|
126
|
-
for (const checkedItemContent of this.querySelectorAll(selector)) {
|
127
|
-
const checkedItem = checkedItemContent.closest('li');
|
139
|
+
for (const checkedItem of this.querySelectorAll('[aria-checked]')) {
|
128
140
|
if (checkedItem !== item) {
|
129
141
|
checkedItem.setAttribute('aria-checked', 'false');
|
130
142
|
}
|
@@ -136,18 +148,9 @@ export class ActionMenuElement extends HTMLElement {
|
|
136
148
|
// prevent buttons from being clicked twice
|
137
149
|
event.preventDefault();
|
138
150
|
}
|
139
|
-
// Hide popover after current event loop to prevent changes in focus from
|
140
|
-
// altering the target of the event. Not doing this specifically affects
|
141
|
-
// <a> tags. It causes the event to be sent to the currently focused element
|
142
|
-
// instead of the anchor, which effectively prevents navigation, i.e. it
|
143
|
-
// appears as if hitting enter does nothing. Curiously, clicking instead
|
144
|
-
// works fine.
|
145
|
-
if (this.selectVariant !== 'multiple') {
|
146
|
-
setTimeout(() => { var _a; return (_a = this.popoverElement) === null || _a === void 0 ? void 0 : _a.hidePopover(); });
|
147
|
-
}
|
148
151
|
}
|
149
152
|
}
|
150
|
-
}
|
153
|
+
};
|
151
154
|
_ActionMenuElement_abortController = new WeakMap(), _ActionMenuElement_originalLabel = new WeakMap(), _ActionMenuElement_inputName = new WeakMap(), _ActionMenuElement_instances = new WeakSet(), _ActionMenuElement_setDynamicLabel = function _ActionMenuElement_setDynamicLabel() {
|
152
155
|
if (!this.dynamicLabel)
|
153
156
|
return;
|
@@ -203,14 +206,21 @@ _ActionMenuElement_abortController = new WeakMap(), _ActionMenuElement_originalL
|
|
203
206
|
input.remove();
|
204
207
|
}
|
205
208
|
}
|
206
|
-
},
|
209
|
+
}, _ActionMenuElement_isActivationKeydown = function _ActionMenuElement_isActivationKeydown(event) {
|
207
210
|
return (event instanceof KeyboardEvent &&
|
208
211
|
event.type === 'keydown' &&
|
209
212
|
!(event.ctrlKey || event.altKey || event.metaKey || event.shiftKey) &&
|
210
|
-
event.key === 'Enter');
|
213
|
+
(event.key === 'Enter' || event.key === ' '));
|
211
214
|
}, _ActionMenuElement_firstItem_get = function _ActionMenuElement_firstItem_get() {
|
212
215
|
return this.querySelector(menuItemSelectors.join(','));
|
213
216
|
};
|
217
|
+
__decorate([
|
218
|
+
target
|
219
|
+
], ActionMenuElement.prototype, "includeFragment", void 0);
|
220
|
+
ActionMenuElement = __decorate([
|
221
|
+
controller
|
222
|
+
], ActionMenuElement);
|
223
|
+
export { ActionMenuElement };
|
214
224
|
if (!window.customElements.get('action-menu')) {
|
215
225
|
window.ActionMenuElement = ActionMenuElement;
|
216
226
|
window.customElements.define('action-menu', ActionMenuElement);
|
@@ -1,13 +1,5 @@
|
|
1
|
-
import '@github/
|
2
|
-
|
3
|
-
const popoverSelector = (() => {
|
4
|
-
try {
|
5
|
-
document.querySelector(':open')
|
6
|
-
return ':open'
|
7
|
-
} catch {
|
8
|
-
return '.\\:open'
|
9
|
-
}
|
10
|
-
})()
|
1
|
+
import {controller, target} from '@github/catalyst'
|
2
|
+
import IncludeFragmentElement from '@github/include-fragment-element'
|
11
3
|
|
12
4
|
type SelectVariant = 'none' | 'single' | 'multiple' | null
|
13
5
|
type SelectedItem = {
|
@@ -18,7 +10,10 @@ type SelectedItem = {
|
|
18
10
|
|
19
11
|
const menuItemSelectors = ['[role="menuitem"]', '[role="menuitemcheckbox"]', '[role="menuitemradio"]']
|
20
12
|
|
13
|
+
@controller
|
21
14
|
export class ActionMenuElement extends HTMLElement {
|
15
|
+
@target includeFragment: IncludeFragmentElement
|
16
|
+
|
22
17
|
#abortController: AbortController
|
23
18
|
#originalLabel = ''
|
24
19
|
#inputName = ''
|
@@ -96,6 +91,10 @@ export class ActionMenuElement extends HTMLElement {
|
|
96
91
|
this.addEventListener('focusout', this, {signal})
|
97
92
|
this.#setDynamicLabel()
|
98
93
|
this.#updateInput()
|
94
|
+
|
95
|
+
if (this.includeFragment) {
|
96
|
+
this.includeFragment.addEventListener('include-fragment-replaced', this, {signal})
|
97
|
+
}
|
99
98
|
}
|
100
99
|
|
101
100
|
disconnectedCallback() {
|
@@ -103,7 +102,7 @@ export class ActionMenuElement extends HTMLElement {
|
|
103
102
|
}
|
104
103
|
|
105
104
|
handleEvent(event: Event) {
|
106
|
-
if (event.target === this.invokerElement && this.#
|
105
|
+
if (event.target === this.invokerElement && this.#isActivationKeydown(event)) {
|
107
106
|
if (this.#firstItem) {
|
108
107
|
event.preventDefault()
|
109
108
|
this.popoverElement?.showPopover()
|
@@ -112,20 +111,32 @@ export class ActionMenuElement extends HTMLElement {
|
|
112
111
|
}
|
113
112
|
}
|
114
113
|
|
115
|
-
if (!this.popoverElement?.matches(
|
114
|
+
if (!this.popoverElement?.matches(':popover-open')) return
|
116
115
|
|
117
|
-
if (event.type === '
|
118
|
-
this.
|
119
|
-
} else if (this.#
|
120
|
-
|
116
|
+
if (event.type === 'include-fragment-replaced') {
|
117
|
+
if (this.#firstItem) this.#firstItem.focus()
|
118
|
+
} else if (this.#isActivationKeydown(event) || (event instanceof MouseEvent && event.type === 'click')) {
|
119
|
+
// Hide popover after current event loop to prevent changes in focus from
|
120
|
+
// altering the target of the event. Not doing this specifically affects
|
121
|
+
// <a> tags. It causes the event to be sent to the currently focused element
|
122
|
+
// instead of the anchor, which effectively prevents navigation, i.e. it
|
123
|
+
// appears as if hitting enter does nothing. Curiously, clicking instead
|
124
|
+
// works fine.
|
125
|
+
if (this.selectVariant !== 'multiple') {
|
126
|
+
setTimeout(() => this.popoverElement?.hidePopover())
|
127
|
+
}
|
128
|
+
|
129
|
+
// The rest of the code below deals with single/multiple selection behavior, and should not
|
130
|
+
// interfere with events fired by menu items whose behavior is specified outside the library.
|
131
|
+
if (this.selectVariant !== 'multiple' && this.selectVariant !== 'single') return
|
132
|
+
|
133
|
+
const item = (event.target as Element).closest(menuItemSelectors.join(','))
|
121
134
|
if (!item) return
|
122
135
|
const ariaChecked = item.getAttribute('aria-checked')
|
123
136
|
const checked = ariaChecked !== 'true'
|
124
137
|
item.setAttribute('aria-checked', `${checked}`)
|
125
138
|
if (this.selectVariant === 'single') {
|
126
|
-
const
|
127
|
-
for (const checkedItemContent of this.querySelectorAll(selector)) {
|
128
|
-
const checkedItem = checkedItemContent.closest('li')!
|
139
|
+
for (const checkedItem of this.querySelectorAll('[aria-checked]')) {
|
129
140
|
if (checkedItem !== item) {
|
130
141
|
checkedItem.setAttribute('aria-checked', 'false')
|
131
142
|
}
|
@@ -139,15 +150,6 @@ export class ActionMenuElement extends HTMLElement {
|
|
139
150
|
// prevent buttons from being clicked twice
|
140
151
|
event.preventDefault()
|
141
152
|
}
|
142
|
-
// Hide popover after current event loop to prevent changes in focus from
|
143
|
-
// altering the target of the event. Not doing this specifically affects
|
144
|
-
// <a> tags. It causes the event to be sent to the currently focused element
|
145
|
-
// instead of the anchor, which effectively prevents navigation, i.e. it
|
146
|
-
// appears as if hitting enter does nothing. Curiously, clicking instead
|
147
|
-
// works fine.
|
148
|
-
if (this.selectVariant !== 'multiple') {
|
149
|
-
setTimeout(() => this.popoverElement?.hidePopover())
|
150
|
-
}
|
151
153
|
}
|
152
154
|
}
|
153
155
|
|
@@ -210,12 +212,12 @@ export class ActionMenuElement extends HTMLElement {
|
|
210
212
|
}
|
211
213
|
}
|
212
214
|
|
213
|
-
#
|
215
|
+
#isActivationKeydown(event: Event): boolean {
|
214
216
|
return (
|
215
217
|
event instanceof KeyboardEvent &&
|
216
218
|
event.type === 'keydown' &&
|
217
219
|
!(event.ctrlKey || event.altKey || event.metaKey || event.shiftKey) &&
|
218
|
-
event.key === 'Enter'
|
220
|
+
(event.key === 'Enter' || event.key === ' ')
|
219
221
|
)
|
220
222
|
}
|
221
223
|
|
@@ -8,7 +8,7 @@ module Primer
|
|
8
8
|
# used as a standalone component.
|
9
9
|
class List < Primer::Alpha::ActionList
|
10
10
|
DEFAULT_ITEM_TAG = :button
|
11
|
-
ITEM_TAG_OPTIONS = [:a, :
|
11
|
+
ITEM_TAG_OPTIONS = [:a, :"clipboard-copy", DEFAULT_ITEM_TAG].freeze
|
12
12
|
|
13
13
|
# Adds a new item to the list.
|
14
14
|
#
|
@@ -35,6 +35,11 @@ module Primer
|
|
35
35
|
content_arguments[:tabindex] = -1
|
36
36
|
system_arguments[:autofocus] = "" if system_arguments[:autofocus]
|
37
37
|
|
38
|
+
content_arguments[:data] = merge_data(
|
39
|
+
content_arguments,
|
40
|
+
{ data: { value: data.delete(:value) || system_arguments.delete(:"data-value") } }
|
41
|
+
)
|
42
|
+
|
38
43
|
if system_arguments[:disabled]
|
39
44
|
content_arguments[:aria] = merge_aria(
|
40
45
|
content_arguments,
|
@@ -1 +1 @@
|
|
1
|
-
.autocomplete-label-stacked{display:block;margin-bottom:6px}.autocomplete-label-inline{display:inline;margin-right:6px}@media (max-width:543.98px){.autocomplete-label-inline{display:block;margin-bottom:6px}}.autocomplete-body{display:inline;position:relative}.autocomplete-embedded-icon-wrap{align-items:center;display:inline-flex;padding:4px 8px}.autocomplete-embedded-icon-wrap:focus-within{border-color:var(--color-accent-fg);box-shadow:inset 0 0 0 1px var(--color-accent-fg);outline:none}.autocomplete-embedded-icon-wrap .form-control{border:none;box-shadow:none;margin-left:8px;padding:0}.autocomplete-embedded-icon-wrap .form-control:focus{box-shadow:none}.autocomplete-embedded-icon-wrap .form-control:focus-visible{box-shadow:none}.autocomplete-results{background:var(--color-canvas-overlay);border:var(--borderWidth-thin,1px) solid var(--color-border-default);border-radius:var(--borderRadius-medium,6px);box-shadow:var(--color-shadow-medium);font-size:13px;left:0;list-style:none;max-height:20em;min-width:100%;overflow-y:auto;position:absolute;width:max-content;z-index:99}.autocomplete-item{background-color:var(--color-canvas-overlay);border:0;color:var(--color-fg-default);cursor:pointer;display:block;font-weight:var(--base-text-weight-semibold,600);overflow:hidden;padding:4px 8px;text-align:left;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;width:100%}.autocomplete-item:hover{background-color:var(--color-accent-emphasis);color:var(--color-fg-on-emphasis);text-decoration:none}.autocomplete-item:hover *{color:inherit!important}.autocomplete-item.navigation-focus,.autocomplete-item.selected,.autocomplete-item[aria-selected=true]{background-color:var(--color-accent-emphasis);color:var(--color-fg-on-emphasis);text-decoration:none}.autocomplete-item.navigation-focus *,.autocomplete-item.selected *,.autocomplete-item[aria-selected=true] *{color:inherit!important}
|
1
|
+
.autocomplete-label-stacked{display:block;margin-bottom:6px}.autocomplete-label-inline{display:inline;margin-right:6px}@media (max-width:543.98px){.autocomplete-label-inline{display:block;margin-bottom:6px}}.autocomplete-body{display:inline;position:relative}.autocomplete-embedded-icon-wrap{align-items:center;display:inline-flex;padding:4px 8px}.autocomplete-embedded-icon-wrap:focus-within{border-color:var(--color-accent-fg);box-shadow:inset 0 0 0 1px var(--color-accent-fg);outline:none}.autocomplete-embedded-icon-wrap .form-control{border:none;box-shadow:none;margin-left:8px;padding:0}.autocomplete-embedded-icon-wrap .form-control:focus{box-shadow:none}.autocomplete-embedded-icon-wrap .form-control:focus-visible{box-shadow:none}.autocomplete-results{background:var(--color-canvas-overlay);border:var(--borderWidth-thin,max(1px,.0625rem)) solid var(--color-border-default);border-radius:var(--borderRadius-medium,6px);box-shadow:var(--color-shadow-medium);font-size:13px;left:0;list-style:none;max-height:20em;min-width:100%;overflow-y:auto;position:absolute;width:max-content;z-index:99}.autocomplete-item{background-color:var(--color-canvas-overlay);border:0;color:var(--color-fg-default);cursor:pointer;display:block;font-weight:var(--base-text-weight-semibold,600);overflow:hidden;padding:4px 8px;text-align:left;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;width:100%}.autocomplete-item:hover{background-color:var(--color-accent-emphasis);color:var(--color-fg-on-emphasis);text-decoration:none}.autocomplete-item:hover *{color:inherit!important}.autocomplete-item.navigation-focus,.autocomplete-item.selected,.autocomplete-item[aria-selected=true]{background-color:var(--color-accent-emphasis);color:var(--color-fg-on-emphasis);text-decoration:none}.autocomplete-item.navigation-focus *,.autocomplete-item.selected *,.autocomplete-item[aria-selected=true] *{color:inherit!important}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["auto_complete.pcss","../../../../lib/postcss_mixins/focusBoxShadowInset.pcss"],"names":[],"mappings":"AAMA,4BACE,aAAc,CACd,iBACF,CAGA,2BACE,cAAe,CACf,gBACF,CAGA,4BACE,2BACE,aAAc,CACd,iBACF,CACF,CAGA,mBAEE,cAAe,CADf,iBAEF,CAGA,iCAGE,kBAAmB,CAFnB,mBAAoB,CACpB,eAuBF,CApBE,8CCnCA,mCAAoC,CAEpC,iDAAmD,CADnD,YDsCA,CAEA,+CAGE,WAAY,CACZ,eAAgB,CAFhB,eAAgB,CADhB,SAYF,CAPE,qDACE,eACF,CAEA,6DACE,eACF,CAKJ,sBAUE,sCAAuC,CACvC,
|
1
|
+
{"version":3,"sources":["auto_complete.pcss","../../../../lib/postcss_mixins/focusBoxShadowInset.pcss"],"names":[],"mappings":"AAMA,4BACE,aAAc,CACd,iBACF,CAGA,2BACE,cAAe,CACf,gBACF,CAGA,4BACE,2BACE,aAAc,CACd,iBACF,CACF,CAGA,mBAEE,cAAe,CADf,iBAEF,CAGA,iCAGE,kBAAmB,CAFnB,mBAAoB,CACpB,eAuBF,CApBE,8CCnCA,mCAAoC,CAEpC,iDAAmD,CADnD,YDsCA,CAEA,+CAGE,WAAY,CACZ,eAAgB,CAFhB,eAAgB,CADhB,SAYF,CAPE,qDACE,eACF,CAEA,6DACE,eACF,CAKJ,sBAUE,sCAAuC,CACvC,kFAAiE,CACjE,4CAAyC,CACzC,qCAAsC,CALtC,cAAe,CANf,MAAO,CAOP,eAAgB,CAHhB,eAAgB,CADhB,cAAe,CAEf,eAAgB,CANhB,iBAAkB,CAGlB,iBAAkB,CADlB,UAWF,CAKA,mBAYE,4CAA6C,CAC7C,QAAS,CAPT,6BAA8B,CAK9B,cAAe,CAVf,aAAc,CAId,gDAA6C,CAD7C,eAAgB,CADhB,eAAgB,CAIhB,eAAgB,CAChB,oBAAqB,CACrB,sBAAuB,CACvB,kBAAmB,CARnB,UAoCF,CAvBE,yBAGE,6CAA8C,CAF9C,iCAAkC,CAClC,oBAOF,CAHE,2BACE,uBACF,CAGF,uGAKE,6CAA8C,CAF9C,iCAAkC,CAClC,oBAOF,CAHE,6GACE,uBACF","file":"auto_complete.css","sourcesContent":["/* autocomplete */\n\n/* This file can be deprecated when AutoComplete is upstreamed to PVC + rolled out to dotcom https://github.com/github/primer/issues/796\n** AutoComplete relies on FormControl, Overlay and ActionList CSS */\n\n/* Stacked label (default) */\n.autocomplete-label-stacked {\n display: block;\n margin-bottom: 6px;\n}\n\n/* Inline label (non-default) */\n.autocomplete-label-inline {\n display: inline;\n margin-right: 6px;\n}\n\n/* Switch to stacked at smaller viewport */\n@media (max-width: 543.98px) {\n .autocomplete-label-inline {\n display: block;\n margin-bottom: 6px;\n }\n}\n\n/* Wrapper for the input and result elements to ensure alignment */\n.autocomplete-body {\n position: relative;\n display: inline;\n}\n\n/* Wrapper and conditional styles for when an icon is added */\n.autocomplete-embedded-icon-wrap {\n display: inline-flex;\n padding: 4px 8px;\n align-items: center;\n\n &:focus-within {\n border-color: var(--color-accent-fg);\n\n @mixin focusBoxShadowInset;\n }\n\n & .form-control {\n padding: 0;\n margin-left: 8px;\n border: none;\n box-shadow: none;\n\n &:focus {\n box-shadow: none;\n }\n\n &:focus-visible {\n box-shadow: none;\n }\n }\n}\n\n/* A pop up list of items used to show autocompleted results */\n.autocomplete-results {\n position: absolute;\n left: 0;\n z-index: 99;\n width: max-content;\n min-width: 100%;\n max-height: 20em;\n overflow-y: auto;\n font-size: 13px;\n list-style: none;\n background: var(--color-canvas-overlay);\n border: var(--borderWidth-thin) solid var(--color-border-default);\n border-radius: var(--borderRadius-medium);\n box-shadow: var(--color-shadow-medium);\n}\n\n/* One of the items that appears within an autocomplete group\n** Bold black text on white background */\n\n.autocomplete-item {\n display: block;\n width: 100%;\n padding: 4px 8px;\n overflow: hidden;\n font-weight: var(--base-text-weight-semibold);\n color: var(--color-fg-default);\n text-align: left;\n text-decoration: none;\n text-overflow: ellipsis;\n white-space: nowrap;\n cursor: pointer;\n background-color: var(--color-canvas-overlay);\n border: 0;\n\n &:hover {\n color: var(--color-fg-on-emphasis);\n text-decoration: none;\n background-color: var(--color-accent-emphasis);\n\n /* Inherit color on all child elements to ensure enough contrast */\n & * {\n color: inherit !important;\n }\n }\n\n &.selected,\n &[aria-selected='true'],\n &.navigation-focus {\n color: var(--color-fg-on-emphasis);\n text-decoration: none;\n background-color: var(--color-accent-emphasis);\n\n /* Inherit color on all child elements to ensure enough contrast */\n & * {\n color: inherit !important;\n }\n }\n}\n","/* inset box-shadow for form controls */\n@define-mixin focusBoxShadowInset $outlineWidth: 1px, $outlineColor: var(--color-accent-fg) {\n border-color: var(--color-accent-fg);\n outline: none;\n box-shadow: inset 0 0 0 $outlineWidth $outlineColor;\n}\n"]}
|
@@ -69,8 +69,8 @@
|
|
69
69
|
font-size: 13px;
|
70
70
|
list-style: none;
|
71
71
|
background: var(--color-canvas-overlay);
|
72
|
-
border: var(--borderWidth-thin
|
73
|
-
border-radius: var(--borderRadius-medium
|
72
|
+
border: var(--borderWidth-thin) solid var(--color-border-default);
|
73
|
+
border-radius: var(--borderRadius-medium);
|
74
74
|
box-shadow: var(--color-shadow-medium);
|
75
75
|
}
|
76
76
|
|
@@ -82,7 +82,7 @@
|
|
82
82
|
width: 100%;
|
83
83
|
padding: 4px 8px;
|
84
84
|
overflow: hidden;
|
85
|
-
font-weight: var(--base-text-weight-semibold
|
85
|
+
font-weight: var(--base-text-weight-semibold);
|
86
86
|
color: var(--color-fg-default);
|
87
87
|
text-align: left;
|
88
88
|
text-decoration: none;
|
@@ -1 +1 @@
|
|
1
|
-
.Banner{background-image:linear-gradient(var(--color-accent-subtle),var(--color-accent-subtle));border:var(--borderWidth-thin,max(1px,.0625rem)) solid var(--color-accent-muted);border-radius:var(--borderRadius-medium,6px);color:var(--color-fg-default);display:grid;grid-auto-flow:column;grid-template-areas:"visual message actions close";grid-template-columns:min-content 1fr minmax(0,auto) min-content;grid-template-rows:min-content;padding:var(--base-size-8
|
1
|
+
.Banner{background-image:linear-gradient(var(--color-accent-subtle),var(--color-accent-subtle));border:var(--borderWidth-thin,max(1px,.0625rem)) solid var(--color-accent-muted);border-radius:var(--borderRadius-medium,6px);color:var(--color-fg-default);display:grid;grid-auto-flow:column;grid-template-areas:"visual message actions close";grid-template-columns:min-content 1fr minmax(0,auto) min-content;grid-template-rows:min-content;padding:var(--base-size-8,.5rem);position:relative}@media (max-width:543.98px){.Banner{grid-template-areas:"visual message close" ". actions actions";grid-template-columns:min-content 1fr min-content;grid-template-rows:min-content min-content}.Banner .Banner-actions{margin:var(--base-size-8,.5rem) 0 0 var(--base-size-8,.5rem)}}.Banner .Banner-visual{align-self:start;display:grid;grid-area:visual;padding:.375rem var(--base-size-8,.5rem)}.Banner .Banner-visual>.octicon{margin-block:calc(var(--base-size-4,.25rem)/2)}.Banner .Banner-visual>*{align-self:center}.Banner .Banner-message{align-self:center;grid-area:message;padding:.375rem var(--base-size-8,.5rem)}.Banner .Banner-message p:last-child{margin-bottom:0}.Banner .Banner-message .Banner-title:not(:only-child){font-weight:var(--base-text-weight-semibold,600);margin-bottom:0}.Banner .Banner-actions{grid-area:actions}.Banner .Banner-actions:last-child{align-self:center}.Banner .Banner-close{grid-area:close;margin-left:var(--controlStack-medium-gap-condensed,.5rem)}.Banner .Banner-visual .octicon{color:var(--color-accent-fg)}.Banner.Banner--warning{background-image:linear-gradient(var(--color-attention-subtle),var(--color-attention-subtle));border-color:var(--color-attention-muted);color:var(--color-fg-default)}.Banner.Banner--warning .Banner-visual .octicon{color:var(--color-attention-fg)}.Banner.Banner--error{background-image:linear-gradient(var(--color-danger-subtle),var(--color-danger-subtle));border-color:var(--color-danger-muted);color:var(--color-fg-default)}.Banner.Banner--error .Banner-visual .octicon{color:var(--color-danger-fg)}.Banner.Banner--success{background-image:linear-gradient(var(--color-success-subtle),var(--color-success-subtle));border-color:var(--color-success-muted);color:var(--color-fg-default)}.Banner.Banner--success .Banner-visual .octicon{color:var(--color-success-fg)}.Banner.Banner--full{border-left:0;border-radius:0;border-right:0;margin-top:calc(var(--borderWidth-thin,max(1px, .0625rem))*-1)}@media (max-width:767.98px){.Banner.Banner--full-whenNarrow{border-left:0;border-radius:0;border-right:0;margin-top:calc(var(--borderWidth-thin,max(1px, .0625rem))*-1)}}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["banner.pcss"],"names":[],"mappings":"AAEA,QAKE,uFAAyF,CACzF,
|
1
|
+
{"version":3,"sources":["banner.pcss"],"names":[],"mappings":"AAEA,QAKE,uFAAyF,CACzF,gFAA+D,CAC/D,4CAAyC,CAHzC,6BAA8B,CAF9B,YAAa,CAMb,qBAAsB,CACtB,kDAAmD,CACnD,gEAAkE,CAClE,8BAA+B,CAR/B,gCAA2B,CAF3B,iBA0HF,CA7GE,4BAdF,QAeI,8DAEqB,CACrB,iDAAkD,CAClD,0CAwGJ,CAtGI,wBACE,4DACF,CACF,CAIA,uBAIE,gBAAiB,CAHjB,YAAa,CAEb,gBAAiB,CADjB,wCAWF,CAPE,gCACE,8CACF,CAEA,yBACE,iBACF,CAGF,wBAGE,iBAAkB,CADlB,iBAAkB,CADlB,wCAYF,CARE,qCACE,eACF,CAEA,uDAEE,gDAA6C,CAD7C,eAEF,CAGF,wBACE,iBAKF,CAHE,mCACE,iBACF,CAIF,sBACE,eAAgB,CAChB,0DACF,CAEA,gCACE,4BACF,CAEA,wBAEE,6FAA+F,CAC/F,yCAA0C,CAF1C,6BAOF,CAHE,gDACE,+BACF,CAGF,sBAEE,uFAAyF,CACzF,sCAAuC,CAFvC,6BAOF,CAHE,8CACE,4BACF,CAGF,wBAEE,yFAA2F,CAC3F,uCAAwC,CAFxC,6BAOF,CAHE,gDACE,6BACF,CAKF,qBAGE,aAAc,CACd,eAAgB,CAFhB,cAAe,CADf,8DAIF,CAEA,4BACE,gCAGE,aAAc,CACd,eAAgB,CAFhB,cAAe,CADf,8DAIF,CACF","file":"banner.css","sourcesContent":["/* Banner alert */\n\n.Banner {\n position: relative;\n display: grid;\n padding: var(--base-size-8);\n color: var(--color-fg-default);\n background-image: linear-gradient(var(--color-accent-subtle), var(--color-accent-subtle));\n border: var(--borderWidth-thin) solid var(--color-accent-muted);\n border-radius: var(--borderRadius-medium);\n grid-auto-flow: column;\n grid-template-areas: 'visual message actions close';\n grid-template-columns: min-content 1fr minmax(0, auto) min-content;\n grid-template-rows: min-content;\n\n /* `sm` breakpoint variantion */\n @media (max-width: 543.98px) {\n grid-template-areas:\n 'visual message close'\n '. actions actions';\n grid-template-columns: min-content 1fr min-content;\n grid-template-rows: min-content min-content;\n\n & .Banner-actions {\n margin: var(--base-size-8) 0 0 var(--base-size-8);\n }\n }\n\n /* Elements */\n\n & .Banner-visual {\n display: grid;\n padding: 0.375rem var(--base-size-8);\n grid-area: visual;\n align-self: start;\n\n & > .octicon {\n margin-block: calc(var(--base-size-4) / 2);\n }\n\n & > * {\n align-self: center;\n }\n }\n\n & .Banner-message {\n padding: 0.375rem var(--base-size-8);\n grid-area: message;\n align-self: center;\n\n & p:last-child {\n margin-bottom: 0;\n }\n\n & .Banner-title:not(:only-child) {\n margin-bottom: 0;\n font-weight: var(--base-text-weight-semibold);\n }\n }\n\n & .Banner-actions {\n grid-area: actions;\n\n &:last-child {\n align-self: center;\n }\n }\n\n /* is this used anywhere? could not find any use, but unsure */\n & .Banner-close {\n grid-area: close;\n margin-left: var(--controlStack-medium-gap-condensed);\n }\n\n & .Banner-visual .octicon {\n color: var(--color-accent-fg);\n }\n\n &.Banner--warning {\n color: var(--color-fg-default);\n background-image: linear-gradient(var(--color-attention-subtle), var(--color-attention-subtle));\n border-color: var(--color-attention-muted);\n\n & .Banner-visual .octicon {\n color: var(--color-attention-fg);\n }\n }\n\n &.Banner--error {\n color: var(--color-fg-default);\n background-image: linear-gradient(var(--color-danger-subtle), var(--color-danger-subtle));\n border-color: var(--color-danger-muted);\n\n & .Banner-visual .octicon {\n color: var(--color-danger-fg);\n }\n }\n\n &.Banner--success {\n color: var(--color-fg-default);\n background-image: linear-gradient(var(--color-success-subtle), var(--color-success-subtle));\n border-color: var(--color-success-muted);\n\n & .Banner-visual .octicon {\n color: var(--color-success-fg);\n }\n }\n\n /* Full-width */\n\n &.Banner--full {\n margin-top: calc(var(--borderWidth-thin) * -1);\n border-right: 0;\n border-left: 0;\n border-radius: 0;\n }\n\n @media (max-width: 767.98px) {\n &.Banner--full-whenNarrow {\n margin-top: calc(var(--borderWidth-thin) * -1);\n border-right: 0;\n border-left: 0;\n border-radius: 0;\n }\n }\n}\n"]}
|
@@ -3,11 +3,11 @@
|
|
3
3
|
.Banner {
|
4
4
|
position: relative;
|
5
5
|
display: grid;
|
6
|
-
padding: var(--base-size-8
|
6
|
+
padding: var(--base-size-8);
|
7
7
|
color: var(--color-fg-default);
|
8
8
|
background-image: linear-gradient(var(--color-accent-subtle), var(--color-accent-subtle));
|
9
|
-
border: var(--borderWidth-thin
|
10
|
-
border-radius: var(--borderRadius-medium
|
9
|
+
border: var(--borderWidth-thin) solid var(--color-accent-muted);
|
10
|
+
border-radius: var(--borderRadius-medium);
|
11
11
|
grid-auto-flow: column;
|
12
12
|
grid-template-areas: 'visual message actions close';
|
13
13
|
grid-template-columns: min-content 1fr minmax(0, auto) min-content;
|
@@ -22,7 +22,7 @@
|
|
22
22
|
grid-template-rows: min-content min-content;
|
23
23
|
|
24
24
|
& .Banner-actions {
|
25
|
-
margin: var(--base-size-8
|
25
|
+
margin: var(--base-size-8) 0 0 var(--base-size-8);
|
26
26
|
}
|
27
27
|
}
|
28
28
|
|
@@ -30,12 +30,12 @@
|
|
30
30
|
|
31
31
|
& .Banner-visual {
|
32
32
|
display: grid;
|
33
|
-
padding:
|
33
|
+
padding: 0.375rem var(--base-size-8);
|
34
34
|
grid-area: visual;
|
35
35
|
align-self: start;
|
36
36
|
|
37
37
|
& > .octicon {
|
38
|
-
margin-block: calc(var(--base-size-4
|
38
|
+
margin-block: calc(var(--base-size-4) / 2);
|
39
39
|
}
|
40
40
|
|
41
41
|
& > * {
|
@@ -44,7 +44,7 @@
|
|
44
44
|
}
|
45
45
|
|
46
46
|
& .Banner-message {
|
47
|
-
padding:
|
47
|
+
padding: 0.375rem var(--base-size-8);
|
48
48
|
grid-area: message;
|
49
49
|
align-self: center;
|
50
50
|
|
@@ -54,7 +54,7 @@
|
|
54
54
|
|
55
55
|
& .Banner-title:not(:only-child) {
|
56
56
|
margin-bottom: 0;
|
57
|
-
font-weight: var(--base-text-weight-semibold
|
57
|
+
font-weight: var(--base-text-weight-semibold);
|
58
58
|
}
|
59
59
|
}
|
60
60
|
|
@@ -69,7 +69,7 @@
|
|
69
69
|
/* is this used anywhere? could not find any use, but unsure */
|
70
70
|
& .Banner-close {
|
71
71
|
grid-area: close;
|
72
|
-
margin-left: var(--controlStack-medium-gap-condensed
|
72
|
+
margin-left: var(--controlStack-medium-gap-condensed);
|
73
73
|
}
|
74
74
|
|
75
75
|
& .Banner-visual .octicon {
|
@@ -109,7 +109,7 @@
|
|
109
109
|
/* Full-width */
|
110
110
|
|
111
111
|
&.Banner--full {
|
112
|
-
margin-top: calc(var(--borderWidth-thin
|
112
|
+
margin-top: calc(var(--borderWidth-thin) * -1);
|
113
113
|
border-right: 0;
|
114
114
|
border-left: 0;
|
115
115
|
border-radius: 0;
|
@@ -117,7 +117,7 @@
|
|
117
117
|
|
118
118
|
@media (max-width: 767.98px) {
|
119
119
|
&.Banner--full-whenNarrow {
|
120
|
-
margin-top: calc(var(--borderWidth-thin
|
120
|
+
margin-top: calc(var(--borderWidth-thin) * -1);
|
121
121
|
border-right: 0;
|
122
122
|
border-left: 0;
|
123
123
|
border-radius: 0;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["button_marketing.pcss","../../../../lib/postcss_mixins/focusOutline.pcss"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"sources":["button_marketing.pcss","../../../../lib/postcss_mixins/focusOutline.pcss"],"names":[],"mappings":"AAAA,UAwBE,iCAA2B,CAA3B,yBAA2B,CAP3B,4FACqC,CACrC,QAAS,CAGT,qBAAuB,CAVvB,iCAAkC,CATlC,oBAAqB,CAMrB,cAAe,CACf,gDAA6C,CAC7C,aAAc,CALd,2BAA6B,CAL7B,iBAAkB,CAYlB,iBAAkB,CAUlB,0CAA8C,CAP9C,wBAAiB,CAAjB,gBAAiB,CADjB,qBAAsB,CADtB,kBAAmB,CAZnB,SAmFF,CA3DE,iBAUE,4DAAyG,CAIzG,4BAA6B,CAH7B,qBAAsB,CAPtB,QAAS,CAGT,UAAW,CAFX,MAAO,CAOP,SAAU,CAXV,iBAAkB,CAElB,OAAQ,CADR,KAAM,CAWN,sBAAwB,CAPxB,UASF,CAEA,gBAEE,uDAAyD,CADzD,oBAEF,CAME,oGACE,SACF,CAIF,gBCvDA,eAAgB,CAFhB,wCAAgC,CAChC,kBDgEA,CAJE,oCAEE,eAAgB,CADhB,uBAEF,CAIF,wBClEA,eAAgB,CAFhB,wCAAgC,CAChC,kBDqEA,CAGE,wBACE,oBACF,CAGF,uCAGE,cAAe,CACf,UAAY,CAFZ,mBAGF,CAGF,gBAEE,yBAA2B,CAC3B,+CAAgD,CAFhD,uCAqBF,CAjBE,uBACE,YACF,CAEA,sBACE,6DACF,CAEA,uBAEE,4DACF,CAEA,yBAEE,2DACF,CAGF,iBAGE,yBAA2B,CAF3B,uCAWF,CAPE,yCAHA,yBAKA,CAEA,uBACE,6DACF,CAGF,iBAKE,wEAAuH,CAHvH,UAyBF,CApBE,wBAEE,gEACF,CAGA,uBCvIA,eAAgB,CAFhB,wCAAgC,CAChC,kBDgJA,CAJE,2CAEE,eAAgB,CADhB,uBAEF,CAIF,+BClJA,eAAgB,CAFhB,wCAAgC,CAChC,kBDqJA,CAKF,gBAEE,6BACF,CAEA,gBAKE,iBAAkB,CAHlB,gCAIF","file":"button_marketing.css","sourcesContent":[".btn-mktg {\n position: relative;\n z-index: 1;\n display: inline-block;\n\n /* stylelint-disable-next-line primer/spacing */\n padding: 0.9rem 1.5rem 1.1rem;\n\n /* stylelint-disable-next-line primer/typography */\n font-size: 1rem;\n font-weight: var(--base-text-weight-semibold);\n line-height: 1;\n color: var(--color-canvas-default);\n text-align: center;\n white-space: nowrap;\n vertical-align: middle;\n user-select: none;\n background: linear-gradient(180deg, rgba(255, 255, 255, 15%) 0%, rgba(255, 255, 255, 0%) 100%),\n var(--color-mktg-btn-bg) !important;\n border: 0;\n\n /* stylelint-disable-next-line primer/borders */\n border-radius: 0.375rem;\n transition: box-shadow 0.2s, outline 0.2s ease;\n appearance: none !important;\n\n &::before {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: -1;\n content: '';\n\n /* stylelint-disable-next-line primer/colors */\n background: linear-gradient(180deg, rgba(255, 255, 255, 15%) 0%, rgba(255, 255, 255, 0%) 100%) !important;\n border-radius: inherit;\n opacity: 0;\n transition: opacity 0.2s;\n background-blend-mode: normal;\n }\n\n &:hover {\n text-decoration: none;\n box-shadow: var(--color-mktg-btn-shadow-hover) !important;\n }\n\n &:hover,\n &:focus,\n &:focus-visible,\n &.focus {\n &::before {\n opacity: 1;\n }\n }\n\n /* fallback :focus state */\n &:focus {\n @mixin focusOutline 2px, var(--color-accent-fg);\n\n /* remove fallback :focus if :focus-visible is supported */\n &:not(:focus-visible) {\n outline: solid 1px transparent;\n box-shadow: none;\n }\n }\n\n /* default focus state */\n &:focus-visible {\n @mixin focusOutline 2px, var(--color-accent-fg);\n }\n\n &:active {\n &::before {\n opacity: 0.5 !important;\n }\n }\n\n &.disabled,\n &[disabled] {\n pointer-events: none;\n cursor: default;\n opacity: 0.5;\n }\n}\n\n.btn-muted-mktg {\n color: var(--color-fg-default) !important;\n background: none !important;\n box-shadow: var(--color-mktg-btn-shadow-outline);\n\n &::before {\n display: none;\n }\n\n &:hover {\n box-shadow: var(--color-mktg-btn-shadow-hover-muted) !important;\n }\n\n &:active {\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: var(--color-fg-default) 0 0 0 3px inset !important;\n }\n\n &:disabled {\n /* stylelint-disable-next-line primer/box-shadow */\n box-shadow: var(--color-fg-subtle) 0 0 0 1px inset !important;\n }\n}\n\n.btn-subtle-mktg {\n color: var(--color-fg-default) !important;\n background: none !important;\n box-shadow: none !important;\n\n &::before {\n background: none !important;\n }\n\n &:hover {\n box-shadow: var(--color-mktg-btn-shadow-hover-muted) !important;\n }\n}\n\n.btn-signup-mktg {\n /* stylelint-disable-next-line primer/colors */\n color: #fff;\n\n /* stylelint-disable-next-line primer/colors */\n background: linear-gradient(180deg, rgba(52, 183, 89, 15%) 0%, rgba(46, 164, 79, 0%) 100%), rgb(46, 164, 79) !important;\n\n &::before {\n /* stylelint-disable-next-line primer/colors */\n background: linear-gradient(180deg, rgba(52, 183, 89, 15%) 0%, rgba(46, 164, 79, 0%) 100%) !important;\n }\n\n /* fallback :focus state */\n &:focus {\n @mixin focusOutline 2px, var(--color-accent-fg);\n\n /* remove fallback :focus if :focus-visible is supported */\n &:not(:focus-visible) {\n outline: solid 1px transparent;\n box-shadow: none;\n }\n }\n\n /* default focus state */\n &:focus-visible {\n @mixin focusOutline 2px, var(--color-accent-fg);\n }\n}\n\n/* Size modifiers */\n\n.btn-small-mktg {\n /* stylelint-disable-next-line primer/spacing */\n padding: 0.625rem 1rem 0.8125rem;\n}\n\n.btn-large-mktg {\n /* stylelint-disable-next-line primer/spacing */\n padding: 16px 30px 20px !important;\n\n /* stylelint-disable-next-line primer/typography */\n font-size: 1.25rem;\n}\n","@define-mixin focusOutline $outlineOffset: -2px, $outlineColor: var(--color-accent-fg) {\n outline: 2px solid $outlineColor;\n outline-offset: $outlineOffset;\n box-shadow: none;\n}\n"]}
|
@@ -8,15 +8,14 @@
|
|
8
8
|
|
9
9
|
/* stylelint-disable-next-line primer/typography */
|
10
10
|
font-size: 1rem;
|
11
|
-
font-weight: var(--base-text-weight-semibold
|
11
|
+
font-weight: var(--base-text-weight-semibold);
|
12
12
|
line-height: 1;
|
13
13
|
color: var(--color-canvas-default);
|
14
14
|
text-align: center;
|
15
15
|
white-space: nowrap;
|
16
16
|
vertical-align: middle;
|
17
17
|
user-select: none;
|
18
|
-
background:
|
19
|
-
linear-gradient(180deg, rgba(255, 255, 255, 15%) 0%, rgba(255, 255, 255, 0%) 100%),
|
18
|
+
background: linear-gradient(180deg, rgba(255, 255, 255, 15%) 0%, rgba(255, 255, 255, 0%) 100%),
|
20
19
|
var(--color-mktg-btn-bg) !important;
|
21
20
|
border: 0;
|
22
21
|
|
@@ -69,7 +68,7 @@
|
|
69
68
|
|
70
69
|
/* default focus state */
|
71
70
|
&:focus-visible {
|
72
|
-
@mixin focusOutline 2px, var(--color-accent-fg)
|
71
|
+
@mixin focusOutline 2px, var(--color-accent-fg);
|
73
72
|
}
|
74
73
|
|
75
74
|
&:active {
|
@@ -100,13 +99,11 @@
|
|
100
99
|
}
|
101
100
|
|
102
101
|
&:active {
|
103
|
-
|
104
102
|
/* stylelint-disable-next-line primer/box-shadow */
|
105
103
|
box-shadow: var(--color-fg-default) 0 0 0 3px inset !important;
|
106
104
|
}
|
107
105
|
|
108
106
|
&:disabled {
|
109
|
-
|
110
107
|
/* stylelint-disable-next-line primer/box-shadow */
|
111
108
|
box-shadow: var(--color-fg-subtle) 0 0 0 1px inset !important;
|
112
109
|
}
|
@@ -127,7 +124,6 @@
|
|
127
124
|
}
|
128
125
|
|
129
126
|
.btn-signup-mktg {
|
130
|
-
|
131
127
|
/* stylelint-disable-next-line primer/colors */
|
132
128
|
color: #fff;
|
133
129
|
|
@@ -135,14 +131,13 @@
|
|
135
131
|
background: linear-gradient(180deg, rgba(52, 183, 89, 15%) 0%, rgba(46, 164, 79, 0%) 100%), rgb(46, 164, 79) !important;
|
136
132
|
|
137
133
|
&::before {
|
138
|
-
|
139
134
|
/* stylelint-disable-next-line primer/colors */
|
140
135
|
background: linear-gradient(180deg, rgba(52, 183, 89, 15%) 0%, rgba(46, 164, 79, 0%) 100%) !important;
|
141
136
|
}
|
142
137
|
|
143
138
|
/* fallback :focus state */
|
144
139
|
&:focus {
|
145
|
-
@mixin focusOutline 2px, var(--color-accent-fg)
|
140
|
+
@mixin focusOutline 2px, var(--color-accent-fg);
|
146
141
|
|
147
142
|
/* remove fallback :focus if :focus-visible is supported */
|
148
143
|
&:not(:focus-visible) {
|
@@ -153,20 +148,18 @@
|
|
153
148
|
|
154
149
|
/* default focus state */
|
155
150
|
&:focus-visible {
|
156
|
-
@mixin focusOutline 2px, var(--color-accent-fg)
|
151
|
+
@mixin focusOutline 2px, var(--color-accent-fg);
|
157
152
|
}
|
158
153
|
}
|
159
154
|
|
160
155
|
/* Size modifiers */
|
161
156
|
|
162
157
|
.btn-small-mktg {
|
163
|
-
|
164
158
|
/* stylelint-disable-next-line primer/spacing */
|
165
159
|
padding: 0.625rem 1rem 0.8125rem;
|
166
160
|
}
|
167
161
|
|
168
162
|
.btn-large-mktg {
|
169
|
-
|
170
163
|
/* stylelint-disable-next-line primer/spacing */
|
171
164
|
padding: 16px 30px 20px !important;
|
172
165
|
|
@@ -42,12 +42,14 @@ module Primer
|
|
42
42
|
# @param variant [Symbol] <%= one_of(Primer::Alpha::ButtonMarketing::VARIANT_OPTIONS) %>
|
43
43
|
# @param tag [Symbol] <%= one_of(Primer::Alpha::ButtonMarketing::TAG_OPTIONS) %>
|
44
44
|
# @param type [Symbol] <%= one_of(Primer::Alpha::ButtonMarketing::TYPE_OPTIONS) %>
|
45
|
+
# @param disabled [Boolean] Whether or not the button is disabled. If true, this option forces `tag:` to `:button`.
|
45
46
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
46
47
|
def initialize(
|
47
48
|
scheme: DEFAULT_SCHEME,
|
48
49
|
variant: DEFAULT_VARIANT,
|
49
50
|
tag: DEFAULT_TAG,
|
50
51
|
type: DEFAULT_TYPE,
|
52
|
+
disabled: false,
|
51
53
|
**system_arguments
|
52
54
|
)
|
53
55
|
@system_arguments = system_arguments
|
@@ -60,6 +62,7 @@ module Primer
|
|
60
62
|
VARIANT_MAPPINGS[fetch_or_fallback(VARIANT_OPTIONS, variant, DEFAULT_VARIANT)],
|
61
63
|
system_arguments[:classes]
|
62
64
|
)
|
65
|
+
@system_arguments[:disabled] = disabled
|
63
66
|
end
|
64
67
|
|
65
68
|
def call
|