@openproject/primer-view-components 0.0.0-20230808124600
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +21 -0
- package/README.md +21 -0
- package/app/assets/javascripts/app/components/primer/alpha/action_bar_element.d.ts +16 -0
- package/app/assets/javascripts/app/components/primer/alpha/action_menu/action_menu_element.d.ts +31 -0
- package/app/assets/javascripts/app/components/primer/alpha/dropdown/menu.d.ts +1 -0
- package/app/assets/javascripts/app/components/primer/alpha/dropdown.d.ts +1 -0
- package/app/assets/javascripts/app/components/primer/alpha/image_crop.d.ts +1 -0
- package/app/assets/javascripts/app/components/primer/alpha/modal_dialog.d.ts +18 -0
- package/app/assets/javascripts/app/components/primer/alpha/nav_list.d.ts +28 -0
- package/app/assets/javascripts/app/components/primer/alpha/segmented_control.d.ts +12 -0
- package/app/assets/javascripts/app/components/primer/alpha/tab_container.d.ts +1 -0
- package/app/assets/javascripts/app/components/primer/alpha/toggle_switch.d.ts +30 -0
- package/app/assets/javascripts/app/components/primer/alpha/tool_tip.d.ts +26 -0
- package/app/assets/javascripts/app/components/primer/alpha/x_banner.d.ts +13 -0
- package/app/assets/javascripts/app/components/primer/anchored_position.d.ts +27 -0
- package/app/assets/javascripts/app/components/primer/beta/auto_complete/auto_complete.d.ts +1 -0
- package/app/assets/javascripts/app/components/primer/beta/clipboard_copy.d.ts +1 -0
- package/app/assets/javascripts/app/components/primer/beta/relative_time.d.ts +1 -0
- package/app/assets/javascripts/app/components/primer/focus_group.d.ts +19 -0
- package/app/assets/javascripts/app/components/primer/primer.d.ts +21 -0
- package/app/assets/javascripts/lib/primer/forms/primer_multi_input.d.ts +10 -0
- package/app/assets/javascripts/lib/primer/forms/primer_text_field.d.ts +1 -0
- package/app/assets/javascripts/lib/primer/forms/toggle_switch_input.d.ts +5 -0
- package/app/assets/javascripts/primer_view_components.js +2 -0
- package/app/assets/javascripts/primer_view_components.js.map +1 -0
- package/app/assets/styles/primer_view_components.css +1 -0
- package/app/assets/styles/primer_view_components.css.map +1 -0
- package/app/components/primer/alpha/action_bar.css +1 -0
- package/app/components/primer/alpha/action_bar.css.json +17 -0
- package/app/components/primer/alpha/action_bar_element.d.ts +16 -0
- package/app/components/primer/alpha/action_bar_element.js +172 -0
- package/app/components/primer/alpha/action_list.css +1 -0
- package/app/components/primer/alpha/action_list.css.json +134 -0
- package/app/components/primer/alpha/action_menu/action_menu_element.d.ts +31 -0
- package/app/components/primer/alpha/action_menu/action_menu_element.js +241 -0
- package/app/components/primer/alpha/auto_complete.css +1 -0
- package/app/components/primer/alpha/auto_complete.css.json +23 -0
- package/app/components/primer/alpha/banner.css +1 -0
- package/app/components/primer/alpha/banner.css.json +24 -0
- package/app/components/primer/alpha/button_marketing.css +1 -0
- package/app/components/primer/alpha/button_marketing.css.json +33 -0
- package/app/components/primer/alpha/dialog.css +1 -0
- package/app/components/primer/alpha/dialog.css.json +80 -0
- package/app/components/primer/alpha/dropdown/menu.d.ts +1 -0
- package/app/components/primer/alpha/dropdown/menu.js +1 -0
- package/app/components/primer/alpha/dropdown.css +1 -0
- package/app/components/primer/alpha/dropdown.css.json +40 -0
- package/app/components/primer/alpha/dropdown.d.ts +1 -0
- package/app/components/primer/alpha/dropdown.js +1 -0
- package/app/components/primer/alpha/image_crop.d.ts +1 -0
- package/app/components/primer/alpha/image_crop.js +1 -0
- package/app/components/primer/alpha/layout.css +1 -0
- package/app/components/primer/alpha/layout.css.json +80 -0
- package/app/components/primer/alpha/menu.css +1 -0
- package/app/components/primer/alpha/menu.css.json +28 -0
- package/app/components/primer/alpha/modal_dialog.d.ts +18 -0
- package/app/components/primer/alpha/modal_dialog.js +189 -0
- package/app/components/primer/alpha/nav_list.d.ts +28 -0
- package/app/components/primer/alpha/nav_list.js +248 -0
- package/app/components/primer/alpha/overlay.css +1 -0
- package/app/components/primer/alpha/overlay.css.json +8 -0
- package/app/components/primer/alpha/segmented_control.css +1 -0
- package/app/components/primer/alpha/segmented_control.css.json +33 -0
- package/app/components/primer/alpha/segmented_control.d.ts +12 -0
- package/app/components/primer/alpha/segmented_control.js +47 -0
- package/app/components/primer/alpha/tab_container.d.ts +1 -0
- package/app/components/primer/alpha/tab_container.js +1 -0
- package/app/components/primer/alpha/tab_nav.css +1 -0
- package/app/components/primer/alpha/tab_nav.css.json +24 -0
- package/app/components/primer/alpha/text_field.css +1 -0
- package/app/components/primer/alpha/text_field.css.json +135 -0
- package/app/components/primer/alpha/toggle_switch.css +1 -0
- package/app/components/primer/alpha/toggle_switch.css.json +40 -0
- package/app/components/primer/alpha/toggle_switch.d.ts +30 -0
- package/app/components/primer/alpha/toggle_switch.js +165 -0
- package/app/components/primer/alpha/tool_tip.d.ts +26 -0
- package/app/components/primer/alpha/tool_tip.js +427 -0
- package/app/components/primer/alpha/underline_nav.css +1 -0
- package/app/components/primer/alpha/underline_nav.css.json +28 -0
- package/app/components/primer/alpha/x_banner.d.ts +13 -0
- package/app/components/primer/alpha/x_banner.js +49 -0
- package/app/components/primer/anchored_position.d.ts +27 -0
- package/app/components/primer/anchored_position.js +147 -0
- package/app/components/primer/beta/auto_complete/auto_complete.d.ts +1 -0
- package/app/components/primer/beta/auto_complete/auto_complete.js +1 -0
- package/app/components/primer/beta/avatar.css +1 -0
- package/app/components/primer/beta/avatar.css.json +17 -0
- package/app/components/primer/beta/avatar_stack.css +1 -0
- package/app/components/primer/beta/avatar_stack.css.json +28 -0
- package/app/components/primer/beta/blankslate.css +1 -0
- package/app/components/primer/beta/blankslate.css.json +22 -0
- package/app/components/primer/beta/border_box.css +1 -0
- package/app/components/primer/beta/border_box.css.json +54 -0
- package/app/components/primer/beta/breadcrumbs.css +1 -0
- package/app/components/primer/beta/breadcrumbs.css.json +11 -0
- package/app/components/primer/beta/button.css +1 -0
- package/app/components/primer/beta/button.css.json +75 -0
- package/app/components/primer/beta/button_group.css +1 -0
- package/app/components/primer/beta/button_group.css.json +14 -0
- package/app/components/primer/beta/clipboard_copy.d.ts +1 -0
- package/app/components/primer/beta/clipboard_copy.js +43 -0
- package/app/components/primer/beta/counter.css +1 -0
- package/app/components/primer/beta/counter.css.json +10 -0
- package/app/components/primer/beta/flash.css +1 -0
- package/app/components/primer/beta/flash.css.json +27 -0
- package/app/components/primer/beta/label.css +1 -0
- package/app/components/primer/beta/label.css.json +25 -0
- package/app/components/primer/beta/link.css +1 -0
- package/app/components/primer/beta/link.css.json +19 -0
- package/app/components/primer/beta/popover.css +1 -0
- package/app/components/primer/beta/popover.css.json +39 -0
- package/app/components/primer/beta/progress_bar.css +1 -0
- package/app/components/primer/beta/progress_bar.css.json +10 -0
- package/app/components/primer/beta/relative_time.d.ts +1 -0
- package/app/components/primer/beta/relative_time.js +1 -0
- package/app/components/primer/beta/state.css +1 -0
- package/app/components/primer/beta/state.css.json +13 -0
- package/app/components/primer/beta/subhead.css +1 -0
- package/app/components/primer/beta/subhead.css.json +12 -0
- package/app/components/primer/beta/timeline_item.css +1 -0
- package/app/components/primer/beta/timeline_item.css.json +16 -0
- package/app/components/primer/beta/truncate.css +1 -0
- package/app/components/primer/beta/truncate.css.json +12 -0
- package/app/components/primer/focus_group.d.ts +19 -0
- package/app/components/primer/focus_group.js +139 -0
- package/app/components/primer/primer.d.ts +21 -0
- package/app/components/primer/primer.js +21 -0
- package/app/components/primer/truncate.css +1 -0
- package/app/components/primer/truncate.css.json +13 -0
- package/lib/primer/forms/primer_multi_input.d.ts +10 -0
- package/lib/primer/forms/primer_multi_input.js +45 -0
- package/lib/primer/forms/primer_text_field.d.ts +1 -0
- package/lib/primer/forms/primer_text_field.js +73 -0
- package/lib/primer/forms/toggle_switch_input.d.ts +5 -0
- package/lib/primer/forms/toggle_switch_input.js +34 -0
- package/package.json +101 -0
- package/static/arguments.json +4501 -0
- package/static/audited_at.json +107 -0
- package/static/classes.json +606 -0
- package/static/constants.json +1335 -0
- package/static/info_arch.json +14465 -0
- package/static/previews.json +6408 -0
- package/static/statuses.json +107 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "alpha/toggle_switch",
|
|
3
|
+
"selectors": [
|
|
4
|
+
".ToggleSwitch",
|
|
5
|
+
".ToggleSwitch.ToggleSwitch",
|
|
6
|
+
".ToggleSwitch--checked .ToggleSwitch-statusOn",
|
|
7
|
+
".ToggleSwitch--checked .ToggleSwitch-statusOff",
|
|
8
|
+
".ToggleSwitch-track",
|
|
9
|
+
".ToggleSwitch-track:focus",
|
|
10
|
+
".ToggleSwitch-track:focus-visible",
|
|
11
|
+
".ToggleSwitch-track:hover",
|
|
12
|
+
".ToggleSwitch-track:active",
|
|
13
|
+
".ToggleSwitch-track:before",
|
|
14
|
+
".ToggleSwitch-track *",
|
|
15
|
+
".ToggleSwitch-track[aria-pressed=true][disabled]",
|
|
16
|
+
".ToggleSwitch-track[aria-pressed=true]",
|
|
17
|
+
".ToggleSwitch-track[aria-pressed=true]:not([disabled]):hover",
|
|
18
|
+
".ToggleSwitch-track[aria-pressed=true]:not([disabled]):active",
|
|
19
|
+
".ToggleSwitch-track[aria-pressed=true] .ToggleSwitch-knob",
|
|
20
|
+
".ToggleSwitch-track[aria-pressed=true] .ToggleSwitch-lineIcon",
|
|
21
|
+
".ToggleSwitch-track[aria-pressed=true] .ToggleSwitch-circleIcon",
|
|
22
|
+
".ToggleSwitch-track[disabled]",
|
|
23
|
+
".ToggleSwitch-track[disabled] .ToggleSwitch-knob",
|
|
24
|
+
".ToggleSwitch-track[disabled] .ToggleSwitch-circleIcon",
|
|
25
|
+
".ToggleSwitch-track[disabled] .ToggleSwitch-lineIcon",
|
|
26
|
+
".ToggleSwitch-icons",
|
|
27
|
+
".ToggleSwitch-lineIcon",
|
|
28
|
+
".ToggleSwitch-circleIcon",
|
|
29
|
+
".ToggleSwitch-knob",
|
|
30
|
+
".ToggleSwitch-status",
|
|
31
|
+
".ToggleSwitch-statusIcon",
|
|
32
|
+
".ToggleSwitch--small .ToggleSwitch-status",
|
|
33
|
+
".ToggleSwitch--small .ToggleSwitch-track",
|
|
34
|
+
".ToggleSwitch--disabled .ToggleSwitch-status",
|
|
35
|
+
".ToggleSwitch-statusOn",
|
|
36
|
+
".ToggleSwitch-statusOff",
|
|
37
|
+
".ToggleSwitch--statusAtEnd",
|
|
38
|
+
".ToggleSwitch--statusAtEnd .ToggleSwitch-status"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
declare class ToggleSwitchElement extends HTMLElement {
|
|
2
|
+
switch: HTMLElement;
|
|
3
|
+
loadingSpinner: HTMLElement;
|
|
4
|
+
errorIcon: HTMLElement;
|
|
5
|
+
private toggling;
|
|
6
|
+
get src(): string | null;
|
|
7
|
+
get csrf(): string | null;
|
|
8
|
+
get csrfField(): string;
|
|
9
|
+
isRemote(): boolean;
|
|
10
|
+
toggle(): Promise<void>;
|
|
11
|
+
turnOn(): void;
|
|
12
|
+
turnOff(): void;
|
|
13
|
+
isOn(): boolean;
|
|
14
|
+
isOff(): boolean;
|
|
15
|
+
isDisabled(): boolean;
|
|
16
|
+
disable(): void;
|
|
17
|
+
enable(): void;
|
|
18
|
+
private performToggle;
|
|
19
|
+
private setLoadingState;
|
|
20
|
+
private setSuccessState;
|
|
21
|
+
private setErrorState;
|
|
22
|
+
private setFinishedState;
|
|
23
|
+
private submitForm;
|
|
24
|
+
}
|
|
25
|
+
declare global {
|
|
26
|
+
interface Window {
|
|
27
|
+
ToggleSwitchElement: typeof ToggleSwitchElement;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { controller, target } from '@github/catalyst';
|
|
8
|
+
let ToggleSwitchElement = class ToggleSwitchElement extends HTMLElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.toggling = false;
|
|
12
|
+
}
|
|
13
|
+
get src() {
|
|
14
|
+
const src = this.getAttribute('src');
|
|
15
|
+
if (!src)
|
|
16
|
+
return null;
|
|
17
|
+
const link = this.ownerDocument.createElement('a');
|
|
18
|
+
link.href = src;
|
|
19
|
+
return link.href;
|
|
20
|
+
}
|
|
21
|
+
get csrf() {
|
|
22
|
+
const csrfElement = this.querySelector('[data-csrf]');
|
|
23
|
+
return this.getAttribute('csrf') || (csrfElement instanceof HTMLInputElement && csrfElement.value) || null;
|
|
24
|
+
}
|
|
25
|
+
get csrfField() {
|
|
26
|
+
// the authenticity token is passed into the element and is not generated in js land
|
|
27
|
+
return this.getAttribute('csrf-field') || 'authenticity_token';
|
|
28
|
+
}
|
|
29
|
+
isRemote() {
|
|
30
|
+
return this.src != null;
|
|
31
|
+
}
|
|
32
|
+
async toggle() {
|
|
33
|
+
if (this.toggling)
|
|
34
|
+
return;
|
|
35
|
+
this.toggling = true;
|
|
36
|
+
if (this.isDisabled()) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (!this.isRemote()) {
|
|
40
|
+
this.performToggle();
|
|
41
|
+
this.toggling = false;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// toggle immediately to tell screen readers the switch was clicked
|
|
45
|
+
this.performToggle();
|
|
46
|
+
this.setLoadingState();
|
|
47
|
+
try {
|
|
48
|
+
await this.submitForm();
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
if (error instanceof Error) {
|
|
52
|
+
// because we toggle immediately when the switch is clicked, toggle back to the
|
|
53
|
+
// old state on failure
|
|
54
|
+
this.setErrorState(error.message || 'An error occurred, please try again.');
|
|
55
|
+
this.performToggle();
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
this.toggling = false;
|
|
61
|
+
}
|
|
62
|
+
this.setSuccessState();
|
|
63
|
+
}
|
|
64
|
+
turnOn() {
|
|
65
|
+
if (this.isDisabled()) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this.switch.setAttribute('aria-pressed', 'true');
|
|
69
|
+
this.classList.add('ToggleSwitch--checked');
|
|
70
|
+
}
|
|
71
|
+
turnOff() {
|
|
72
|
+
if (this.isDisabled()) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.switch.setAttribute('aria-pressed', 'false');
|
|
76
|
+
this.classList.remove('ToggleSwitch--checked');
|
|
77
|
+
}
|
|
78
|
+
isOn() {
|
|
79
|
+
return this.switch.getAttribute('aria-pressed') === 'true';
|
|
80
|
+
}
|
|
81
|
+
isOff() {
|
|
82
|
+
return !this.isOn();
|
|
83
|
+
}
|
|
84
|
+
isDisabled() {
|
|
85
|
+
return this.switch.getAttribute('disabled') != null;
|
|
86
|
+
}
|
|
87
|
+
disable() {
|
|
88
|
+
this.switch.setAttribute('disabled', 'disabled');
|
|
89
|
+
}
|
|
90
|
+
enable() {
|
|
91
|
+
this.switch.removeAttribute('disabled');
|
|
92
|
+
}
|
|
93
|
+
performToggle() {
|
|
94
|
+
if (this.isOn()) {
|
|
95
|
+
this.turnOff();
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
this.turnOn();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
setLoadingState() {
|
|
102
|
+
this.errorIcon.setAttribute('hidden', 'hidden');
|
|
103
|
+
this.loadingSpinner.removeAttribute('hidden');
|
|
104
|
+
const event = new CustomEvent('toggleSwitchLoading', { bubbles: true });
|
|
105
|
+
this.dispatchEvent(event);
|
|
106
|
+
}
|
|
107
|
+
setSuccessState() {
|
|
108
|
+
const event = new CustomEvent('toggleSwitchSuccess', { bubbles: true });
|
|
109
|
+
this.dispatchEvent(event);
|
|
110
|
+
this.setFinishedState(false);
|
|
111
|
+
}
|
|
112
|
+
setErrorState(message) {
|
|
113
|
+
const event = new CustomEvent('toggleSwitchError', { bubbles: true, detail: message });
|
|
114
|
+
this.dispatchEvent(event);
|
|
115
|
+
this.setFinishedState(true);
|
|
116
|
+
}
|
|
117
|
+
setFinishedState(error) {
|
|
118
|
+
if (error) {
|
|
119
|
+
this.errorIcon.removeAttribute('hidden');
|
|
120
|
+
}
|
|
121
|
+
this.loadingSpinner.setAttribute('hidden', 'hidden');
|
|
122
|
+
}
|
|
123
|
+
async submitForm() {
|
|
124
|
+
const body = new FormData();
|
|
125
|
+
if (this.csrf) {
|
|
126
|
+
body.append(this.csrfField, this.csrf);
|
|
127
|
+
}
|
|
128
|
+
body.append('value', this.isOn() ? '1' : '0');
|
|
129
|
+
if (!this.src)
|
|
130
|
+
throw new Error('invalid src');
|
|
131
|
+
let response;
|
|
132
|
+
try {
|
|
133
|
+
response = await fetch(this.src, {
|
|
134
|
+
credentials: 'same-origin',
|
|
135
|
+
method: 'POST',
|
|
136
|
+
headers: {
|
|
137
|
+
'Requested-With': 'XMLHttpRequest'
|
|
138
|
+
},
|
|
139
|
+
body
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
throw new Error('A network error occurred, please try again.');
|
|
144
|
+
}
|
|
145
|
+
if (!response.ok) {
|
|
146
|
+
throw new Error(await response.text());
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
__decorate([
|
|
151
|
+
target
|
|
152
|
+
], ToggleSwitchElement.prototype, "switch", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
target
|
|
155
|
+
], ToggleSwitchElement.prototype, "loadingSpinner", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
target
|
|
158
|
+
], ToggleSwitchElement.prototype, "errorIcon", void 0);
|
|
159
|
+
ToggleSwitchElement = __decorate([
|
|
160
|
+
controller
|
|
161
|
+
], ToggleSwitchElement);
|
|
162
|
+
if (!window.customElements.get('toggle-switch')) {
|
|
163
|
+
window.ToggleSwitchElement = ToggleSwitchElement;
|
|
164
|
+
window.customElements.define('toggle-switch', ToggleSwitchElement);
|
|
165
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import '@oddbird/popover-polyfill';
|
|
2
|
+
type Direction = 'n' | 's' | 'e' | 'w' | 'ne' | 'se' | 'nw' | 'sw';
|
|
3
|
+
declare class ToolTipElement extends HTMLElement {
|
|
4
|
+
#private;
|
|
5
|
+
styles(): string;
|
|
6
|
+
get htmlFor(): string;
|
|
7
|
+
set htmlFor(value: string);
|
|
8
|
+
get type(): 'description' | 'label';
|
|
9
|
+
set type(value: 'description' | 'label');
|
|
10
|
+
get direction(): Direction;
|
|
11
|
+
set direction(value: Direction);
|
|
12
|
+
get control(): HTMLElement | null;
|
|
13
|
+
set hiddenFromView(value: true | false);
|
|
14
|
+
get hiddenFromView(): true | false;
|
|
15
|
+
connectedCallback(): void;
|
|
16
|
+
disconnectedCallback(): void;
|
|
17
|
+
handleEvent(event: Event): Promise<void>;
|
|
18
|
+
static observedAttributes: string[];
|
|
19
|
+
attributeChangedCallback(name: string): void;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface Window {
|
|
23
|
+
ToolTipElement: typeof ToolTipElement;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
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");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
+
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");
|
|
10
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
+
};
|
|
12
|
+
var _ToolTipElement_instances, _ToolTipElement_abortController, _ToolTipElement_align, _ToolTipElement_side, _ToolTipElement_allowUpdatePosition, _ToolTipElement_update, _ToolTipElement_updateControlReference, _ToolTipElement_updateDirection, _ToolTipElement_updatePosition;
|
|
13
|
+
import '@oddbird/popover-polyfill';
|
|
14
|
+
import { getAnchoredPosition } from '@primer/behaviors';
|
|
15
|
+
const TOOLTIP_ARROW_EDGE_OFFSET = 6;
|
|
16
|
+
const TOOLTIP_SR_ONLY_CLASS = 'sr-only';
|
|
17
|
+
const TOOLTIP_OFFSET = 10;
|
|
18
|
+
const DIRECTION_CLASSES = [
|
|
19
|
+
'tooltip-n',
|
|
20
|
+
'tooltip-s',
|
|
21
|
+
'tooltip-e',
|
|
22
|
+
'tooltip-w',
|
|
23
|
+
'tooltip-ne',
|
|
24
|
+
'tooltip-se',
|
|
25
|
+
'tooltip-nw',
|
|
26
|
+
'tooltip-sw'
|
|
27
|
+
];
|
|
28
|
+
function closeOpenTooltips(except) {
|
|
29
|
+
for (const tooltip of openTooltips) {
|
|
30
|
+
if (tooltip === except)
|
|
31
|
+
continue;
|
|
32
|
+
if (tooltip.matches(':popover-open')) {
|
|
33
|
+
tooltip.hidePopover();
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
openTooltips.delete(tooltip);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function focusOutListener() {
|
|
41
|
+
closeOpenTooltips();
|
|
42
|
+
}
|
|
43
|
+
const tooltips = new Set();
|
|
44
|
+
const openTooltips = new Set();
|
|
45
|
+
class ToolTipElement extends HTMLElement {
|
|
46
|
+
constructor() {
|
|
47
|
+
super(...arguments);
|
|
48
|
+
_ToolTipElement_instances.add(this);
|
|
49
|
+
_ToolTipElement_abortController.set(this, void 0);
|
|
50
|
+
_ToolTipElement_align.set(this, 'center');
|
|
51
|
+
_ToolTipElement_side.set(this, 'outside-bottom');
|
|
52
|
+
_ToolTipElement_allowUpdatePosition.set(this, false);
|
|
53
|
+
}
|
|
54
|
+
styles() {
|
|
55
|
+
return `
|
|
56
|
+
:host {
|
|
57
|
+
padding: .5em .75em !important;
|
|
58
|
+
font: normal normal 11px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
|
|
59
|
+
-webkit-font-smoothing: subpixel-antialiased;
|
|
60
|
+
color: var(--color-fg-on-emphasis) !important;
|
|
61
|
+
text-align: center;
|
|
62
|
+
text-decoration: none;
|
|
63
|
+
text-shadow: none;
|
|
64
|
+
text-transform: none;
|
|
65
|
+
letter-spacing: normal;
|
|
66
|
+
word-wrap: break-word;
|
|
67
|
+
white-space: pre;
|
|
68
|
+
background: var(--color-neutral-emphasis-plus) !important;
|
|
69
|
+
border-radius: 6px;
|
|
70
|
+
border: 0 !important;
|
|
71
|
+
opacity: 0;
|
|
72
|
+
max-width: 250px;
|
|
73
|
+
word-wrap: break-word;
|
|
74
|
+
white-space: normal;
|
|
75
|
+
width: max-content !important;
|
|
76
|
+
inset: var(--tool-tip-position-top, 0) auto auto var(--tool-tip-position-left, 0) !important;
|
|
77
|
+
overflow: visible !important;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:host:before{
|
|
81
|
+
position: absolute;
|
|
82
|
+
z-index: 1000001;
|
|
83
|
+
color: var(--color-neutral-emphasis-plus);
|
|
84
|
+
content: "";
|
|
85
|
+
border: 6px solid transparent;
|
|
86
|
+
opacity: 0
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@keyframes tooltip-appear {
|
|
90
|
+
from {
|
|
91
|
+
opacity: 0;
|
|
92
|
+
}
|
|
93
|
+
to {
|
|
94
|
+
opacity: 1
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
:host:after{
|
|
99
|
+
position: absolute;
|
|
100
|
+
display: block;
|
|
101
|
+
right: 0;
|
|
102
|
+
left: 0;
|
|
103
|
+
height: 12px;
|
|
104
|
+
content: ""
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
:host(:popover-open),
|
|
108
|
+
:host(:popover-open):before {
|
|
109
|
+
animation-name: tooltip-appear;
|
|
110
|
+
animation-duration: .1s;
|
|
111
|
+
animation-fill-mode: forwards;
|
|
112
|
+
animation-timing-function: ease-in;
|
|
113
|
+
animation-delay: .4s
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:host(.\\:popover-open),
|
|
117
|
+
:host(.\\:popover-open):before {
|
|
118
|
+
animation-name: tooltip-appear;
|
|
119
|
+
animation-duration: .1s;
|
|
120
|
+
animation-fill-mode: forwards;
|
|
121
|
+
animation-timing-function: ease-in;
|
|
122
|
+
animation-delay: .4s
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:host(.tooltip-s):before,
|
|
126
|
+
:host(.tooltip-n):before {
|
|
127
|
+
right: 50%;
|
|
128
|
+
margin-right: -${TOOLTIP_ARROW_EDGE_OFFSET}px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
:host(.tooltip-s):before,
|
|
132
|
+
:host(.tooltip-se):before,
|
|
133
|
+
:host(.tooltip-sw):before {
|
|
134
|
+
bottom: 100%;
|
|
135
|
+
border-bottom-color: var(--color-neutral-emphasis-plus)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
:host(.tooltip-s):after,
|
|
139
|
+
:host(.tooltip-se):after,
|
|
140
|
+
:host(.tooltip-sw):after {
|
|
141
|
+
bottom: 100%
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
:host(.tooltip-n):before,
|
|
145
|
+
:host(.tooltip-ne):before,
|
|
146
|
+
:host(.tooltip-nw):before {
|
|
147
|
+
top: 100%;
|
|
148
|
+
border-top-color: var(--color-neutral-emphasis-plus)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
:host(.tooltip-n):after,
|
|
152
|
+
:host(.tooltip-ne):after,
|
|
153
|
+
:host(.tooltip-nw):after {
|
|
154
|
+
top: 100%
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
:host(.tooltip-se):before,
|
|
158
|
+
:host(.tooltip-ne):before {
|
|
159
|
+
left: 0;
|
|
160
|
+
margin-left: ${TOOLTIP_ARROW_EDGE_OFFSET}px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
:host(.tooltip-sw):before,
|
|
164
|
+
:host(.tooltip-nw):before {
|
|
165
|
+
right: 0;
|
|
166
|
+
margin-right: ${TOOLTIP_ARROW_EDGE_OFFSET}px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
:host(.tooltip-w):before {
|
|
170
|
+
top: 50%;
|
|
171
|
+
bottom: 50%;
|
|
172
|
+
left: 100%;
|
|
173
|
+
margin-top: -6px;
|
|
174
|
+
border-left-color: var(--color-neutral-emphasis-plus)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
:host(.tooltip-e):before {
|
|
178
|
+
top: 50%;
|
|
179
|
+
right: 100%;
|
|
180
|
+
bottom: 50%;
|
|
181
|
+
margin-top: -6px;
|
|
182
|
+
border-right-color: var(--color-neutral-emphasis-plus)
|
|
183
|
+
}
|
|
184
|
+
`;
|
|
185
|
+
}
|
|
186
|
+
get htmlFor() {
|
|
187
|
+
return this.getAttribute('for') || '';
|
|
188
|
+
}
|
|
189
|
+
set htmlFor(value) {
|
|
190
|
+
this.setAttribute('for', value);
|
|
191
|
+
}
|
|
192
|
+
get type() {
|
|
193
|
+
const type = this.getAttribute('data-type');
|
|
194
|
+
return type === 'label' ? 'label' : 'description';
|
|
195
|
+
}
|
|
196
|
+
set type(value) {
|
|
197
|
+
this.setAttribute('data-type', value);
|
|
198
|
+
}
|
|
199
|
+
get direction() {
|
|
200
|
+
return (this.getAttribute('data-direction') || 's');
|
|
201
|
+
}
|
|
202
|
+
set direction(value) {
|
|
203
|
+
this.setAttribute('data-direction', value);
|
|
204
|
+
}
|
|
205
|
+
get control() {
|
|
206
|
+
return this.ownerDocument.getElementById(this.htmlFor);
|
|
207
|
+
}
|
|
208
|
+
/* @deprecated */
|
|
209
|
+
set hiddenFromView(value) {
|
|
210
|
+
if (value && this.matches(':popover-open')) {
|
|
211
|
+
this.hidePopover();
|
|
212
|
+
}
|
|
213
|
+
else if (!value && this.matches(':not(:popover-open)')) {
|
|
214
|
+
this.showPopover();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/* @deprecated */
|
|
218
|
+
get hiddenFromView() {
|
|
219
|
+
return !this.matches(':popover-open');
|
|
220
|
+
}
|
|
221
|
+
connectedCallback() {
|
|
222
|
+
var _a, _b;
|
|
223
|
+
tooltips.add(this);
|
|
224
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateControlReference).call(this);
|
|
225
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateDirection).call(this);
|
|
226
|
+
if (!this.shadowRoot) {
|
|
227
|
+
const shadow = this.attachShadow({ mode: 'open' });
|
|
228
|
+
const style = shadow.appendChild(document.createElement('style'));
|
|
229
|
+
style.textContent = this.styles();
|
|
230
|
+
shadow.appendChild(document.createElement('slot'));
|
|
231
|
+
}
|
|
232
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_update).call(this, false);
|
|
233
|
+
__classPrivateFieldSet(this, _ToolTipElement_allowUpdatePosition, true, "f");
|
|
234
|
+
if (!this.control)
|
|
235
|
+
return;
|
|
236
|
+
this.setAttribute('role', 'tooltip');
|
|
237
|
+
(_a = __classPrivateFieldGet(this, _ToolTipElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
|
|
238
|
+
__classPrivateFieldSet(this, _ToolTipElement_abortController, new AbortController(), "f");
|
|
239
|
+
const { signal } = __classPrivateFieldGet(this, _ToolTipElement_abortController, "f");
|
|
240
|
+
this.addEventListener('mouseleave', this, { signal });
|
|
241
|
+
this.addEventListener('toggle', this, { signal });
|
|
242
|
+
this.control.addEventListener('mouseenter', this, { signal });
|
|
243
|
+
this.control.addEventListener('mouseleave', this, { signal });
|
|
244
|
+
this.control.addEventListener('focus', this, { signal });
|
|
245
|
+
this.control.addEventListener('mousedown', this, { signal });
|
|
246
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
247
|
+
// @ts-ignore popoverTargetElement is not in the type definition
|
|
248
|
+
(_b = this.control.popoverTargetElement) === null || _b === void 0 ? void 0 : _b.addEventListener('beforetoggle', this, {
|
|
249
|
+
signal
|
|
250
|
+
});
|
|
251
|
+
this.ownerDocument.addEventListener('focusout', focusOutListener);
|
|
252
|
+
this.ownerDocument.addEventListener('keydown', this, { signal });
|
|
253
|
+
}
|
|
254
|
+
disconnectedCallback() {
|
|
255
|
+
var _a;
|
|
256
|
+
tooltips.delete(this);
|
|
257
|
+
openTooltips.delete(this);
|
|
258
|
+
(_a = __classPrivateFieldGet(this, _ToolTipElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
|
|
259
|
+
}
|
|
260
|
+
async handleEvent(event) {
|
|
261
|
+
if (!this.control)
|
|
262
|
+
return;
|
|
263
|
+
const showing = this.matches(':popover-open');
|
|
264
|
+
// Ensures that tooltip stays open when hovering between tooltip and element
|
|
265
|
+
// WCAG Success Criterion 1.4.13 Hoverable
|
|
266
|
+
const shouldShow = event.type === 'mouseenter' || event.type === 'focus';
|
|
267
|
+
const isMouseLeaveFromButton = event.type === 'mouseleave' &&
|
|
268
|
+
event.relatedTarget !== this.control &&
|
|
269
|
+
event.relatedTarget !== this;
|
|
270
|
+
const isEscapeKeydown = event.type === 'keydown' && event.key === 'Escape';
|
|
271
|
+
const isMouseDownOnButton = event.type === 'mousedown' && event.currentTarget === this.control;
|
|
272
|
+
const isOpeningOtherPopover = event.type === 'beforetoggle' && event.currentTarget !== this;
|
|
273
|
+
const shouldHide = isMouseLeaveFromButton || isEscapeKeydown || isMouseDownOnButton || isOpeningOtherPopover;
|
|
274
|
+
await Promise.resolve();
|
|
275
|
+
if (!showing && shouldShow && this.matches(':not(:popover-open)')) {
|
|
276
|
+
this.showPopover();
|
|
277
|
+
}
|
|
278
|
+
else if (showing && shouldHide && this.matches(':popover-open')) {
|
|
279
|
+
this.hidePopover();
|
|
280
|
+
}
|
|
281
|
+
if (event.type === 'toggle') {
|
|
282
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_update).call(this, event.newState === 'open');
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
attributeChangedCallback(name) {
|
|
286
|
+
if (!this.isConnected)
|
|
287
|
+
return;
|
|
288
|
+
if (name === 'id' || name === 'data-type') {
|
|
289
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateControlReference).call(this);
|
|
290
|
+
}
|
|
291
|
+
else if (name === 'data-direction') {
|
|
292
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateDirection).call(this);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
_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(isOpen) {
|
|
297
|
+
if (isOpen) {
|
|
298
|
+
openTooltips.add(this);
|
|
299
|
+
this.classList.remove(TOOLTIP_SR_ONLY_CLASS);
|
|
300
|
+
closeOpenTooltips(this);
|
|
301
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updatePosition).call(this);
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
openTooltips.delete(this);
|
|
305
|
+
this.classList.remove(...DIRECTION_CLASSES);
|
|
306
|
+
this.classList.add(TOOLTIP_SR_ONLY_CLASS);
|
|
307
|
+
}
|
|
308
|
+
}, _ToolTipElement_updateControlReference = function _ToolTipElement_updateControlReference() {
|
|
309
|
+
if (!this.id || !this.control)
|
|
310
|
+
return;
|
|
311
|
+
if (this.type === 'label') {
|
|
312
|
+
let labelledBy = this.control.getAttribute('aria-labelledby');
|
|
313
|
+
if (labelledBy) {
|
|
314
|
+
if (!labelledBy.split(' ').includes(this.id)) {
|
|
315
|
+
labelledBy = `${labelledBy} ${this.id}`;
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
labelledBy = `${labelledBy}`;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
labelledBy = this.id;
|
|
323
|
+
}
|
|
324
|
+
this.control.setAttribute('aria-labelledby', labelledBy);
|
|
325
|
+
// Prevent duplicate accessible name announcements.
|
|
326
|
+
this.setAttribute('aria-hidden', 'true');
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
let describedBy = this.control.getAttribute('aria-describedby');
|
|
330
|
+
if (describedBy) {
|
|
331
|
+
if (!describedBy.split(' ').includes(this.id)) {
|
|
332
|
+
describedBy = `${describedBy} ${this.id}`;
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
describedBy = `${describedBy}`;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
describedBy = this.id;
|
|
340
|
+
}
|
|
341
|
+
this.control.setAttribute('aria-describedby', describedBy);
|
|
342
|
+
}
|
|
343
|
+
}, _ToolTipElement_updateDirection = function _ToolTipElement_updateDirection() {
|
|
344
|
+
this.classList.remove(...DIRECTION_CLASSES);
|
|
345
|
+
const direction = this.direction;
|
|
346
|
+
if (direction === 'n') {
|
|
347
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
348
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
|
349
|
+
}
|
|
350
|
+
else if (direction === 'ne') {
|
|
351
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'start', "f");
|
|
352
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
|
353
|
+
}
|
|
354
|
+
else if (direction === 'e') {
|
|
355
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
356
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-right', "f");
|
|
357
|
+
}
|
|
358
|
+
else if (direction === 'se') {
|
|
359
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'start', "f");
|
|
360
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
|
361
|
+
}
|
|
362
|
+
else if (direction === 's') {
|
|
363
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
364
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
|
365
|
+
}
|
|
366
|
+
else if (direction === 'sw') {
|
|
367
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'end', "f");
|
|
368
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
|
369
|
+
}
|
|
370
|
+
else if (direction === 'w') {
|
|
371
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
372
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-left', "f");
|
|
373
|
+
}
|
|
374
|
+
else if (direction === 'nw') {
|
|
375
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'end', "f");
|
|
376
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
|
377
|
+
}
|
|
378
|
+
}, _ToolTipElement_updatePosition = function _ToolTipElement_updatePosition() {
|
|
379
|
+
if (!this.control)
|
|
380
|
+
return;
|
|
381
|
+
if (!__classPrivateFieldGet(this, _ToolTipElement_allowUpdatePosition, "f") || !this.matches(':popover-open'))
|
|
382
|
+
return;
|
|
383
|
+
const position = getAnchoredPosition(this, this.control, {
|
|
384
|
+
side: __classPrivateFieldGet(this, _ToolTipElement_side, "f"),
|
|
385
|
+
align: __classPrivateFieldGet(this, _ToolTipElement_align, "f"),
|
|
386
|
+
anchorOffset: TOOLTIP_OFFSET
|
|
387
|
+
});
|
|
388
|
+
const anchorSide = position.anchorSide;
|
|
389
|
+
const align = position.anchorAlign;
|
|
390
|
+
this.style.setProperty('--tool-tip-position-top', `${position.top}px`);
|
|
391
|
+
this.style.setProperty('--tool-tip-position-left', `${position.left}px`);
|
|
392
|
+
let direction = 's';
|
|
393
|
+
if (anchorSide === 'outside-left') {
|
|
394
|
+
direction = 'w';
|
|
395
|
+
}
|
|
396
|
+
else if (anchorSide === 'outside-right') {
|
|
397
|
+
direction = 'e';
|
|
398
|
+
}
|
|
399
|
+
else if (anchorSide === 'outside-top') {
|
|
400
|
+
if (align === 'center') {
|
|
401
|
+
direction = 'n';
|
|
402
|
+
}
|
|
403
|
+
else if (align === 'start') {
|
|
404
|
+
direction = 'ne';
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
direction = 'nw';
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
if (align === 'center') {
|
|
412
|
+
direction = 's';
|
|
413
|
+
}
|
|
414
|
+
else if (align === 'start') {
|
|
415
|
+
direction = 'se';
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
direction = 'sw';
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
this.classList.add(`tooltip-${direction}`);
|
|
422
|
+
};
|
|
423
|
+
ToolTipElement.observedAttributes = ['data-type', 'data-direction', 'id'];
|
|
424
|
+
if (!window.customElements.get('tool-tip')) {
|
|
425
|
+
window.ToolTipElement = ToolTipElement;
|
|
426
|
+
window.customElements.define('tool-tip', ToolTipElement);
|
|
427
|
+
}
|