primer_view_components 0.0.102 → 0.0.103
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -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/modal_dialog.d.ts +1 -1
- data/app/components/primer/alpha/modal_dialog.js +48 -40
- data/app/components/primer/alpha/modal_dialog.ts +55 -47
- data/app/components/primer/alpha/nav_list.js +3 -3
- data/app/components/primer/alpha/nav_list.ts +3 -3
- data/app/components/primer/beta/button.html.erb +1 -1
- data/app/forms/after_content_form/after_content.html.erb +1 -0
- data/app/forms/after_content_form.rb +13 -0
- data/app/forms/application_form.rb +5 -0
- data/app/forms/array_check_box_group_form/places_lopez_caption.html.erb +1 -0
- data/app/forms/array_check_box_group_form.rb +15 -0
- data/app/forms/both_types_of_caption_form/first_name_caption.html.erb +1 -0
- data/app/forms/both_types_of_caption_form.rb +13 -0
- data/app/forms/caption_template_form/age_middle_aged_caption.html.erb +1 -0
- data/app/forms/caption_template_form/age_young_caption.html.erb +1 -0
- data/app/forms/caption_template_form/cool_caption.html.erb +1 -0
- data/app/forms/caption_template_form/first_name_caption.html.erb +1 -0
- data/app/forms/caption_template_form.rb +22 -0
- data/app/forms/check_box_group_form.rb +28 -0
- data/app/forms/composed_form.rb +14 -0
- data/app/forms/first_name_form.rb +13 -0
- data/app/forms/horizontal_form.rb +34 -0
- data/app/forms/invalid_form.rb +21 -0
- data/app/forms/last_name_form.rb +13 -0
- data/app/forms/multi_input_form.rb +25 -0
- data/app/forms/multi_text_field_form.rb +27 -0
- data/app/forms/radio_button_group_form.rb +12 -0
- data/app/forms/radio_button_with_nested_form.rb +39 -0
- data/app/forms/select_list_form.rb +12 -0
- data/app/forms/single_text_field_form.rb +13 -0
- data/app/forms/submit_button_form.rb +20 -0
- data/app/forms/text_field_and_checkbox_form.rb +19 -0
- data/lib/primer/deprecations.rb +0 -4
- data/lib/primer/view_components/engine.rb +1 -0
- data/lib/primer/view_components/linters/close_button_component_migration_counter.rb +1 -1
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/tasks/docs.rake +1 -1
- data/lib/tasks/test.rake +14 -12
- data/previews/primer/alpha/dialog_preview/nested_dialog.html.erb +14 -0
- data/previews/primer/alpha/dialog_preview.rb +15 -0
- data/static/audited_at.json +0 -4
- data/static/constants.json +0 -8
- data/static/statuses.json +0 -4
- metadata +34 -15
- data/app/components/primer/alpha/tool-tip-element.d.ts +0 -23
- data/app/components/primer/alpha/tool-tip-element.js +0 -352
- data/app/components/primer/clipboard_copy_component.d.ts +0 -1
- data/app/components/primer/clipboard_copy_component.js +0 -43
- data/app/components/primer/close_button.rb +0 -7
- data/app/components/primer/details_component.rb +0 -7
- data/app/components/primer/heading_component.rb +0 -7
- data/app/components/primer/hidden_text_expander.rb +0 -7
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: primer_view_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.103
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -394,7 +394,7 @@ dependencies:
|
|
394
394
|
- - "~>"
|
395
395
|
- !ruby/object:Gem::Version
|
396
396
|
version: 0.9.25
|
397
|
-
description:
|
397
|
+
description:
|
398
398
|
email:
|
399
399
|
- opensource+primer_view_components@github.com
|
400
400
|
executables: []
|
@@ -452,8 +452,6 @@ files:
|
|
452
452
|
- app/components/primer/alpha/toggle_switch.js
|
453
453
|
- app/components/primer/alpha/toggle_switch.rb
|
454
454
|
- app/components/primer/alpha/toggle_switch.ts
|
455
|
-
- app/components/primer/alpha/tool-tip-element.d.ts
|
456
|
-
- app/components/primer/alpha/tool-tip-element.js
|
457
455
|
- app/components/primer/alpha/tool_tip.d.ts
|
458
456
|
- app/components/primer/alpha/tool_tip.js
|
459
457
|
- app/components/primer/alpha/tool_tip.ts
|
@@ -510,14 +508,10 @@ files:
|
|
510
508
|
- app/components/primer/clipboard_copy.js
|
511
509
|
- app/components/primer/clipboard_copy.rb
|
512
510
|
- app/components/primer/clipboard_copy.ts
|
513
|
-
- app/components/primer/clipboard_copy_component.d.ts
|
514
|
-
- app/components/primer/clipboard_copy_component.js
|
515
|
-
- app/components/primer/close_button.rb
|
516
511
|
- app/components/primer/component.rb
|
517
512
|
- app/components/primer/conditional_wrapper.rb
|
518
513
|
- app/components/primer/content.rb
|
519
514
|
- app/components/primer/counter_component.rb
|
520
|
-
- app/components/primer/details_component.rb
|
521
515
|
- app/components/primer/dropdown.d.ts
|
522
516
|
- app/components/primer/dropdown.html.erb
|
523
517
|
- app/components/primer/dropdown.js
|
@@ -530,9 +524,7 @@ files:
|
|
530
524
|
- app/components/primer/dropdown/menu.ts
|
531
525
|
- app/components/primer/dropdown_menu_component.html.erb
|
532
526
|
- app/components/primer/dropdown_menu_component.rb
|
533
|
-
- app/components/primer/heading_component.rb
|
534
527
|
- app/components/primer/hellip_button.rb
|
535
|
-
- app/components/primer/hidden_text_expander.rb
|
536
528
|
- app/components/primer/icon_button.html.erb
|
537
529
|
- app/components/primer/icon_button.rb
|
538
530
|
- app/components/primer/image.rb
|
@@ -583,6 +575,32 @@ files:
|
|
583
575
|
- app/components/primer/timeline_item_component.rb
|
584
576
|
- app/components/primer/tooltip.rb
|
585
577
|
- app/components/primer/truncate.rb
|
578
|
+
- app/forms/after_content_form.rb
|
579
|
+
- app/forms/after_content_form/after_content.html.erb
|
580
|
+
- app/forms/application_form.rb
|
581
|
+
- app/forms/array_check_box_group_form.rb
|
582
|
+
- app/forms/array_check_box_group_form/places_lopez_caption.html.erb
|
583
|
+
- app/forms/both_types_of_caption_form.rb
|
584
|
+
- app/forms/both_types_of_caption_form/first_name_caption.html.erb
|
585
|
+
- app/forms/caption_template_form.rb
|
586
|
+
- app/forms/caption_template_form/age_middle_aged_caption.html.erb
|
587
|
+
- app/forms/caption_template_form/age_young_caption.html.erb
|
588
|
+
- app/forms/caption_template_form/cool_caption.html.erb
|
589
|
+
- app/forms/caption_template_form/first_name_caption.html.erb
|
590
|
+
- app/forms/check_box_group_form.rb
|
591
|
+
- app/forms/composed_form.rb
|
592
|
+
- app/forms/first_name_form.rb
|
593
|
+
- app/forms/horizontal_form.rb
|
594
|
+
- app/forms/invalid_form.rb
|
595
|
+
- app/forms/last_name_form.rb
|
596
|
+
- app/forms/multi_input_form.rb
|
597
|
+
- app/forms/multi_text_field_form.rb
|
598
|
+
- app/forms/radio_button_group_form.rb
|
599
|
+
- app/forms/radio_button_with_nested_form.rb
|
600
|
+
- app/forms/select_list_form.rb
|
601
|
+
- app/forms/single_text_field_form.rb
|
602
|
+
- app/forms/submit_button_form.rb
|
603
|
+
- app/forms/text_field_and_checkbox_form.rb
|
586
604
|
- app/helpers/primer/form_helper.rb
|
587
605
|
- app/lib/primer/audited/dsl.rb
|
588
606
|
- app/lib/primer/class_name_helper.rb
|
@@ -727,6 +745,7 @@ files:
|
|
727
745
|
- previews/primer/alpha/button_marketing_preview.rb
|
728
746
|
- previews/primer/alpha/dialog_preview.rb
|
729
747
|
- previews/primer/alpha/dialog_preview/custom_header.html.erb
|
748
|
+
- previews/primer/alpha/dialog_preview/nested_dialog.html.erb
|
730
749
|
- previews/primer/alpha/dialog_preview/test.html.erb
|
731
750
|
- previews/primer/alpha/dialog_preview/with_footer.html.erb
|
732
751
|
- previews/primer/alpha/dialog_preview/with_form.html.erb
|
@@ -815,7 +834,7 @@ licenses:
|
|
815
834
|
- MIT
|
816
835
|
metadata:
|
817
836
|
allowed_push_host: https://rubygems.org
|
818
|
-
post_install_message:
|
837
|
+
post_install_message:
|
819
838
|
rdoc_options: []
|
820
839
|
require_paths:
|
821
840
|
- lib
|
@@ -830,8 +849,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
830
849
|
- !ruby/object:Gem::Version
|
831
850
|
version: '0'
|
832
851
|
requirements: []
|
833
|
-
rubygems_version: 3.
|
834
|
-
signing_key:
|
852
|
+
rubygems_version: 3.3.7
|
853
|
+
signing_key:
|
835
854
|
specification_version: 4
|
836
855
|
summary: ViewComponents for the Primer Design System
|
837
856
|
test_files: []
|
@@ -1,23 +0,0 @@
|
|
1
|
-
declare type Direction = 'n' | 's' | 'e' | 'w' | 'ne' | 'se' | 'nw' | 'sw';
|
2
|
-
declare class ToolTipElement extends HTMLElement {
|
3
|
-
#private;
|
4
|
-
styles(): string;
|
5
|
-
get htmlFor(): string;
|
6
|
-
set htmlFor(value: string);
|
7
|
-
get type(): 'description' | 'label';
|
8
|
-
set type(value: 'description' | 'label');
|
9
|
-
get direction(): Direction;
|
10
|
-
set direction(value: Direction);
|
11
|
-
get control(): HTMLElement | null;
|
12
|
-
connectedCallback(): void;
|
13
|
-
disconnectedCallback(): void;
|
14
|
-
handleEvent(event: Event): void;
|
15
|
-
static observedAttributes: string[];
|
16
|
-
attributeChangedCallback(name: string): void;
|
17
|
-
}
|
18
|
-
declare global {
|
19
|
-
interface Window {
|
20
|
-
ToolTipElement: typeof ToolTipElement;
|
21
|
-
}
|
22
|
-
}
|
23
|
-
export {};
|
@@ -1,352 +0,0 @@
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
4
|
-
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");
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
6
|
-
};
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
|
-
};
|
12
|
-
var _ToolTipElement_instances, _ToolTipElement_abortController, _ToolTipElement_align, _ToolTipElement_side, _ToolTipElement_allowUpdatePosition, _ToolTipElement_update, _ToolTipElement_updatePosition;
|
13
|
-
import { getAnchoredPosition } from '@primer/behaviors';
|
14
|
-
const TOOLTIP_OPEN_CLASS = 'tooltip-open';
|
15
|
-
const TOOLTIP_ARROW_EDGE_OFFSET = 6;
|
16
|
-
const DIRECTION_CLASSES = [
|
17
|
-
'tooltip-n',
|
18
|
-
'tooltip-s',
|
19
|
-
'tooltip-e',
|
20
|
-
'tooltip-w',
|
21
|
-
'tooltip-ne',
|
22
|
-
'tooltip-se',
|
23
|
-
'tooltip-nw',
|
24
|
-
'tooltip-sw'
|
25
|
-
];
|
26
|
-
class ToolTipElement extends HTMLElement {
|
27
|
-
constructor() {
|
28
|
-
super(...arguments);
|
29
|
-
_ToolTipElement_instances.add(this);
|
30
|
-
_ToolTipElement_abortController.set(this, void 0);
|
31
|
-
_ToolTipElement_align.set(this, 'center');
|
32
|
-
_ToolTipElement_side.set(this, 'outside-bottom');
|
33
|
-
_ToolTipElement_allowUpdatePosition.set(this, false);
|
34
|
-
}
|
35
|
-
styles() {
|
36
|
-
return `
|
37
|
-
:host {
|
38
|
-
position: absolute;
|
39
|
-
z-index: 1000000;
|
40
|
-
padding: .5em .75em;
|
41
|
-
font: normal normal 11px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
|
42
|
-
-webkit-font-smoothing: subpixel-antialiased;
|
43
|
-
color: var(--color-fg-on-emphasis);
|
44
|
-
text-align: center;
|
45
|
-
text-decoration: none;
|
46
|
-
text-shadow: none;
|
47
|
-
text-transform: none;
|
48
|
-
letter-spacing: normal;
|
49
|
-
word-wrap: break-word;
|
50
|
-
white-space: pre;
|
51
|
-
background: var(--color-neutral-emphasis-plus);
|
52
|
-
border-radius: 6px;
|
53
|
-
opacity: 0;
|
54
|
-
max-width: 250px;
|
55
|
-
word-wrap: break-word;
|
56
|
-
white-space: normal;
|
57
|
-
width: max-content;
|
58
|
-
}
|
59
|
-
|
60
|
-
:host:before{
|
61
|
-
position: absolute;
|
62
|
-
z-index: 1000001;
|
63
|
-
color: var(--color-neutral-emphasis-plus);
|
64
|
-
content: "";
|
65
|
-
border: 6px solid transparent;
|
66
|
-
opacity: 0
|
67
|
-
}
|
68
|
-
|
69
|
-
@keyframes tooltip-appear {
|
70
|
-
from {
|
71
|
-
opacity: 0
|
72
|
-
}
|
73
|
-
to {
|
74
|
-
opacity: 1
|
75
|
-
}
|
76
|
-
}
|
77
|
-
|
78
|
-
:host:after{
|
79
|
-
position: absolute;
|
80
|
-
display: block;
|
81
|
-
right: 0;
|
82
|
-
left: 0;
|
83
|
-
height: 12px;
|
84
|
-
content: ""
|
85
|
-
}
|
86
|
-
|
87
|
-
:host(.${TOOLTIP_OPEN_CLASS}),
|
88
|
-
:host(.${TOOLTIP_OPEN_CLASS}):before {
|
89
|
-
animation-name: tooltip-appear;
|
90
|
-
animation-duration: .1s;
|
91
|
-
animation-fill-mode: forwards;
|
92
|
-
animation-timing-function: ease-in;
|
93
|
-
animation-delay: .4s
|
94
|
-
}
|
95
|
-
|
96
|
-
:host(.tooltip-s):before,
|
97
|
-
:host(.tooltip-n):before {
|
98
|
-
right: 50%;
|
99
|
-
margin-right: -${TOOLTIP_ARROW_EDGE_OFFSET}px;
|
100
|
-
}
|
101
|
-
|
102
|
-
:host(.tooltip-s):before,
|
103
|
-
:host(.tooltip-se):before,
|
104
|
-
:host(.tooltip-sw):before {
|
105
|
-
bottom: 100%;
|
106
|
-
border-bottom-color: var(--color-neutral-emphasis-plus)
|
107
|
-
}
|
108
|
-
|
109
|
-
:host(.tooltip-s):after,
|
110
|
-
:host(.tooltip-se):after,
|
111
|
-
:host(.tooltip-sw):after {
|
112
|
-
bottom: 100%
|
113
|
-
}
|
114
|
-
|
115
|
-
:host(.tooltip-n):before,
|
116
|
-
:host(.tooltip-ne):before,
|
117
|
-
:host(.tooltip-nw):before {
|
118
|
-
top: 100%;
|
119
|
-
border-top-color: var(--color-neutral-emphasis-plus)
|
120
|
-
}
|
121
|
-
|
122
|
-
:host(.tooltip-n):after,
|
123
|
-
:host(.tooltip-ne):after,
|
124
|
-
:host(.tooltip-nw):after {
|
125
|
-
top: 100%
|
126
|
-
}
|
127
|
-
|
128
|
-
:host(.tooltip-se):before,
|
129
|
-
:host(.tooltip-ne):before {
|
130
|
-
left: 0;
|
131
|
-
margin-left: ${TOOLTIP_ARROW_EDGE_OFFSET}px;
|
132
|
-
}
|
133
|
-
|
134
|
-
:host(.tooltip-sw):before,
|
135
|
-
:host(.tooltip-nw):before {
|
136
|
-
right: 0;
|
137
|
-
margin-right: ${TOOLTIP_ARROW_EDGE_OFFSET}px;
|
138
|
-
}
|
139
|
-
|
140
|
-
:host(.tooltip-w):before {
|
141
|
-
top: 50%;
|
142
|
-
bottom: 50%;
|
143
|
-
left: 100%;
|
144
|
-
margin-top: -6px;
|
145
|
-
border-left-color: var(--color-neutral-emphasis-plus)
|
146
|
-
}
|
147
|
-
|
148
|
-
:host(.tooltip-e):before {
|
149
|
-
top: 50%;
|
150
|
-
right: 100%;
|
151
|
-
bottom: 50%;
|
152
|
-
margin-top: -6px;
|
153
|
-
border-right-color: var(--color-neutral-emphasis-plus)
|
154
|
-
}
|
155
|
-
`;
|
156
|
-
}
|
157
|
-
get htmlFor() {
|
158
|
-
return this.getAttribute('for') || '';
|
159
|
-
}
|
160
|
-
set htmlFor(value) {
|
161
|
-
this.setAttribute('for', value);
|
162
|
-
}
|
163
|
-
get type() {
|
164
|
-
const type = this.getAttribute('data-type');
|
165
|
-
return type === 'label' ? 'label' : 'description';
|
166
|
-
}
|
167
|
-
set type(value) {
|
168
|
-
this.setAttribute('data-type', value);
|
169
|
-
}
|
170
|
-
get direction() {
|
171
|
-
return (this.getAttribute('data-direction') || 's');
|
172
|
-
}
|
173
|
-
set direction(value) {
|
174
|
-
this.setAttribute('data-direction', value);
|
175
|
-
}
|
176
|
-
get control() {
|
177
|
-
return this.ownerDocument.getElementById(this.htmlFor);
|
178
|
-
}
|
179
|
-
connectedCallback() {
|
180
|
-
var _a;
|
181
|
-
if (!this.shadowRoot) {
|
182
|
-
const shadow = this.attachShadow({ mode: 'open' });
|
183
|
-
// eslint-disable-next-line github/no-inner-html
|
184
|
-
shadow.innerHTML = `
|
185
|
-
<style>
|
186
|
-
${this.styles()}
|
187
|
-
</style>
|
188
|
-
<slot></slot>
|
189
|
-
`;
|
190
|
-
}
|
191
|
-
this.hidden = true;
|
192
|
-
__classPrivateFieldSet(this, _ToolTipElement_allowUpdatePosition, true, "f");
|
193
|
-
if (!this.id) {
|
194
|
-
this.id = `tooltip-${Date.now()}-${(Math.random() * 10000).toFixed(0)}`;
|
195
|
-
}
|
196
|
-
if (!this.control)
|
197
|
-
return;
|
198
|
-
this.setAttribute('role', 'tooltip');
|
199
|
-
(_a = __classPrivateFieldGet(this, _ToolTipElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
|
200
|
-
__classPrivateFieldSet(this, _ToolTipElement_abortController, new AbortController(), "f");
|
201
|
-
const { signal } = __classPrivateFieldGet(this, _ToolTipElement_abortController, "f");
|
202
|
-
this.addEventListener('mouseleave', this, { signal });
|
203
|
-
this.control.addEventListener('mouseenter', this, { signal });
|
204
|
-
this.control.addEventListener('mouseleave', this, { signal });
|
205
|
-
this.control.addEventListener('focus', this, { signal });
|
206
|
-
this.control.addEventListener('blur', this, { signal });
|
207
|
-
this.ownerDocument.addEventListener('keydown', this, { signal });
|
208
|
-
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_update).call(this);
|
209
|
-
}
|
210
|
-
disconnectedCallback() {
|
211
|
-
var _a;
|
212
|
-
(_a = __classPrivateFieldGet(this, _ToolTipElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
|
213
|
-
}
|
214
|
-
handleEvent(event) {
|
215
|
-
if (!this.control)
|
216
|
-
return;
|
217
|
-
// Ensures that tooltip stays open when hovering between tooltip and element
|
218
|
-
// WCAG Success Criterion 1.4.13 Hoverable
|
219
|
-
if ((event.type === 'mouseenter' || event.type === 'focus') && this.hidden) {
|
220
|
-
this.hidden = false;
|
221
|
-
}
|
222
|
-
else if (event.type === 'blur') {
|
223
|
-
this.hidden = true;
|
224
|
-
}
|
225
|
-
else if (event.type === 'mouseleave' &&
|
226
|
-
event.relatedTarget !== this.control &&
|
227
|
-
event.relatedTarget !== this) {
|
228
|
-
this.hidden = true;
|
229
|
-
}
|
230
|
-
else if (event.type === 'keydown' && event.key === 'Escape' && !this.hidden) {
|
231
|
-
this.hidden = true;
|
232
|
-
}
|
233
|
-
}
|
234
|
-
attributeChangedCallback(name) {
|
235
|
-
if (name === 'id' || name === 'data-type') {
|
236
|
-
if (!this.id || !this.control)
|
237
|
-
return;
|
238
|
-
if (this.type === 'label') {
|
239
|
-
this.control.setAttribute('aria-labelledby', this.id);
|
240
|
-
this.setAttribute('aria-hidden', 'true');
|
241
|
-
}
|
242
|
-
else {
|
243
|
-
let describedBy = this.control.getAttribute('aria-describedby');
|
244
|
-
describedBy ? (describedBy = `${describedBy} ${this.id}`) : (describedBy = this.id);
|
245
|
-
this.control.setAttribute('aria-describedby', describedBy);
|
246
|
-
}
|
247
|
-
}
|
248
|
-
else if (this.isConnected && name === 'hidden') {
|
249
|
-
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_update).call(this);
|
250
|
-
}
|
251
|
-
else if (name === 'data-direction') {
|
252
|
-
this.classList.remove(...DIRECTION_CLASSES);
|
253
|
-
const direction = this.direction;
|
254
|
-
if (direction === 'n') {
|
255
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
256
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
257
|
-
}
|
258
|
-
else if (direction === 'ne') {
|
259
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'start', "f");
|
260
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
261
|
-
}
|
262
|
-
else if (direction === 'e') {
|
263
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
264
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-right', "f");
|
265
|
-
}
|
266
|
-
else if (direction === 'se') {
|
267
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'start', "f");
|
268
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
269
|
-
}
|
270
|
-
else if (direction === 's') {
|
271
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
272
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
273
|
-
}
|
274
|
-
else if (direction === 'sw') {
|
275
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'end', "f");
|
276
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
277
|
-
}
|
278
|
-
else if (direction === 'w') {
|
279
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
280
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-left', "f");
|
281
|
-
}
|
282
|
-
else if (direction === 'nw') {
|
283
|
-
__classPrivateFieldSet(this, _ToolTipElement_align, 'end', "f");
|
284
|
-
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
285
|
-
}
|
286
|
-
}
|
287
|
-
}
|
288
|
-
}
|
289
|
-
_ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new WeakMap(), _ToolTipElement_side = new WeakMap(), _ToolTipElement_allowUpdatePosition = new WeakMap(), _ToolTipElement_instances = new WeakSet(), _ToolTipElement_update = function _ToolTipElement_update() {
|
290
|
-
if (this.hidden) {
|
291
|
-
this.classList.remove(TOOLTIP_OPEN_CLASS, ...DIRECTION_CLASSES);
|
292
|
-
}
|
293
|
-
else {
|
294
|
-
this.classList.add(TOOLTIP_OPEN_CLASS);
|
295
|
-
for (const tooltip of this.ownerDocument.querySelectorAll(this.tagName)) {
|
296
|
-
if (tooltip !== this)
|
297
|
-
tooltip.hidden = true;
|
298
|
-
}
|
299
|
-
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updatePosition).call(this);
|
300
|
-
}
|
301
|
-
}, _ToolTipElement_updatePosition = function _ToolTipElement_updatePosition() {
|
302
|
-
if (!this.control)
|
303
|
-
return;
|
304
|
-
if (!__classPrivateFieldGet(this, _ToolTipElement_allowUpdatePosition, "f") || this.hidden)
|
305
|
-
return;
|
306
|
-
const TOOLTIP_OFFSET = 10;
|
307
|
-
this.style.left = `0px`; // Ensures we have reliable tooltip width in `getAnchoredPosition`
|
308
|
-
const position = getAnchoredPosition(this, this.control, {
|
309
|
-
side: __classPrivateFieldGet(this, _ToolTipElement_side, "f"),
|
310
|
-
align: __classPrivateFieldGet(this, _ToolTipElement_align, "f"),
|
311
|
-
anchorOffset: TOOLTIP_OFFSET
|
312
|
-
});
|
313
|
-
const anchorSide = position.anchorSide;
|
314
|
-
const align = position.anchorAlign;
|
315
|
-
this.style.top = `${position.top}px`;
|
316
|
-
this.style.left = `${position.left}px`;
|
317
|
-
let direction = 's';
|
318
|
-
if (anchorSide === 'outside-left') {
|
319
|
-
direction = 'w';
|
320
|
-
}
|
321
|
-
else if (anchorSide === 'outside-right') {
|
322
|
-
direction = 'e';
|
323
|
-
}
|
324
|
-
else if (anchorSide === 'outside-top') {
|
325
|
-
if (align === 'center') {
|
326
|
-
direction = 'n';
|
327
|
-
}
|
328
|
-
else if (align === 'start') {
|
329
|
-
direction = 'ne';
|
330
|
-
}
|
331
|
-
else {
|
332
|
-
direction = 'nw';
|
333
|
-
}
|
334
|
-
}
|
335
|
-
else {
|
336
|
-
if (align === 'center') {
|
337
|
-
direction = 's';
|
338
|
-
}
|
339
|
-
else if (align === 'start') {
|
340
|
-
direction = 'se';
|
341
|
-
}
|
342
|
-
else {
|
343
|
-
direction = 'sw';
|
344
|
-
}
|
345
|
-
}
|
346
|
-
this.classList.add(`tooltip-${direction}`);
|
347
|
-
};
|
348
|
-
ToolTipElement.observedAttributes = ['data-type', 'data-direction', 'id', 'hidden'];
|
349
|
-
if (!window.customElements.get('tool-tip')) {
|
350
|
-
window.ToolTipElement = ToolTipElement;
|
351
|
-
window.customElements.define('tool-tip', ToolTipElement);
|
352
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
import '@github/clipboard-copy-element';
|
@@ -1,43 +0,0 @@
|
|
1
|
-
import '@github/clipboard-copy-element';
|
2
|
-
const CLIPBOARD_COPY_TIMER_DURATION = 2000;
|
3
|
-
function showSVG(svg) {
|
4
|
-
svg.style.display = 'inline-block';
|
5
|
-
}
|
6
|
-
function hideSVG(svg) {
|
7
|
-
svg.style.display = 'none';
|
8
|
-
}
|
9
|
-
// Toggle a copy button.
|
10
|
-
function showCopy(button) {
|
11
|
-
const [copyIcon, checkIcon] = button.querySelectorAll('.octicon');
|
12
|
-
if (!copyIcon || !checkIcon)
|
13
|
-
return;
|
14
|
-
showSVG(copyIcon);
|
15
|
-
hideSVG(checkIcon);
|
16
|
-
}
|
17
|
-
// Toggle a copy button.
|
18
|
-
function showCheck(button) {
|
19
|
-
const [copyIcon, checkIcon] = button.querySelectorAll('.octicon');
|
20
|
-
if (!copyIcon || !checkIcon)
|
21
|
-
return;
|
22
|
-
hideSVG(copyIcon);
|
23
|
-
showSVG(checkIcon);
|
24
|
-
}
|
25
|
-
const clipboardCopyElementTimers = new WeakMap();
|
26
|
-
document.addEventListener('clipboard-copy', function ({ target }) {
|
27
|
-
if (!(target instanceof HTMLElement))
|
28
|
-
return;
|
29
|
-
if (!target.hasAttribute('data-view-component'))
|
30
|
-
return;
|
31
|
-
const currentTimeout = clipboardCopyElementTimers.get(target);
|
32
|
-
if (currentTimeout) {
|
33
|
-
clearTimeout(currentTimeout);
|
34
|
-
clipboardCopyElementTimers.delete(target);
|
35
|
-
}
|
36
|
-
else {
|
37
|
-
showCheck(target);
|
38
|
-
}
|
39
|
-
clipboardCopyElementTimers.set(target, setTimeout(() => {
|
40
|
-
showCopy(target);
|
41
|
-
clipboardCopyElementTimers.delete(target);
|
42
|
-
}, CLIPBOARD_COPY_TIMER_DURATION));
|
43
|
-
});
|