@mixtint/primer-view-components 0.72.0
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 +30 -0
- package/app/assets/images/loading_indicator.svg +1 -0
- package/app/assets/javascripts/components/primer/alpha/action_bar_element.d.ts +17 -0
- package/app/assets/javascripts/components/primer/alpha/action_list.d.ts +16 -0
- package/app/assets/javascripts/components/primer/alpha/action_menu/action_menu_element.d.ts +49 -0
- package/app/assets/javascripts/components/primer/alpha/action_menu/action_menu_focus_zone_stack.d.ts +17 -0
- package/app/assets/javascripts/components/primer/alpha/dropdown/menu.d.ts +1 -0
- package/app/assets/javascripts/components/primer/alpha/dropdown.d.ts +1 -0
- package/app/assets/javascripts/components/primer/alpha/modal_dialog.d.ts +18 -0
- package/app/assets/javascripts/components/primer/alpha/segmented_control.d.ts +12 -0
- package/app/assets/javascripts/components/primer/alpha/select_panel_element.d.ts +65 -0
- package/app/assets/javascripts/components/primer/alpha/tab_container.d.ts +1 -0
- package/app/assets/javascripts/components/primer/alpha/toggle_switch.d.ts +34 -0
- package/app/assets/javascripts/components/primer/alpha/tool_tip.d.ts +27 -0
- package/app/assets/javascripts/components/primer/alpha/tree_view/tree_view.d.ts +42 -0
- package/app/assets/javascripts/components/primer/alpha/tree_view/tree_view_icon_pair_element.d.ts +15 -0
- package/app/assets/javascripts/components/primer/alpha/tree_view/tree_view_include_fragment_element.d.ts +9 -0
- package/app/assets/javascripts/components/primer/alpha/tree_view/tree_view_roving_tab_index.d.ts +3 -0
- package/app/assets/javascripts/components/primer/alpha/tree_view/tree_view_sub_tree_node_element.d.ts +45 -0
- package/app/assets/javascripts/components/primer/alpha/x_banner.d.ts +18 -0
- package/app/assets/javascripts/components/primer/anchored_position.d.ts +27 -0
- package/app/assets/javascripts/components/primer/beta/auto_complete/auto_complete.d.ts +1 -0
- package/app/assets/javascripts/components/primer/beta/clipboard_copy.d.ts +1 -0
- package/app/assets/javascripts/components/primer/beta/details_toggle_element.d.ts +40 -0
- package/app/assets/javascripts/components/primer/beta/nav_list.d.ts +20 -0
- package/app/assets/javascripts/components/primer/beta/nav_list_group_element.d.ts +19 -0
- package/app/assets/javascripts/components/primer/beta/relative_time.d.ts +1 -0
- package/app/assets/javascripts/components/primer/dialog_helper.d.ts +15 -0
- package/app/assets/javascripts/components/primer/focus_group.d.ts +19 -0
- package/app/assets/javascripts/components/primer/open_project/border_box/collapsible_header.d.ts +11 -0
- package/app/assets/javascripts/components/primer/open_project/collapsible.d.ts +13 -0
- package/app/assets/javascripts/components/primer/open_project/collapsible_section.d.ts +10 -0
- package/app/assets/javascripts/components/primer/open_project/danger_dialog_form_helper.d.ts +14 -0
- package/app/assets/javascripts/components/primer/open_project/filterable_tree_view.d.ts +29 -0
- package/app/assets/javascripts/components/primer/open_project/page_header_element.d.ts +9 -0
- package/app/assets/javascripts/components/primer/open_project/sub_header_element.d.ts +17 -0
- package/app/assets/javascripts/components/primer/open_project/zen_mode_button.d.ts +18 -0
- package/app/assets/javascripts/components/primer/primer.d.ts +40 -0
- package/app/assets/javascripts/components/primer/scrollable_region.d.ts +13 -0
- package/app/assets/javascripts/components/primer/shared_events.d.ts +26 -0
- package/app/assets/javascripts/components/primer/utils.d.ts +1 -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 +28 -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 +7336 -0
- package/app/assets/styles/primer_view_components.css.map +1 -0
- package/app/components/primer/alpha/action_bar.css +49 -0
- package/app/components/primer/alpha/action_bar.css.json +14 -0
- package/app/components/primer/alpha/action_bar_element.d.ts +17 -0
- package/app/components/primer/alpha/action_bar_element.js +170 -0
- package/app/components/primer/alpha/action_list.css +526 -0
- package/app/components/primer/alpha/action_list.css.json +117 -0
- package/app/components/primer/alpha/action_list.d.ts +16 -0
- package/app/components/primer/alpha/action_list.js +70 -0
- package/app/components/primer/alpha/action_menu/action_menu_element.d.ts +49 -0
- package/app/components/primer/alpha/action_menu/action_menu_element.js +591 -0
- package/app/components/primer/alpha/action_menu/action_menu_focus_zone_stack.d.ts +17 -0
- package/app/components/primer/alpha/action_menu/action_menu_focus_zone_stack.js +62 -0
- package/app/components/primer/alpha/auto_complete.css +131 -0
- package/app/components/primer/alpha/auto_complete.css.json +21 -0
- package/app/components/primer/alpha/banner.css +146 -0
- package/app/components/primer/alpha/banner.css.json +26 -0
- package/app/components/primer/alpha/button_marketing.css +183 -0
- package/app/components/primer/alpha/button_marketing.css.json +30 -0
- package/app/components/primer/alpha/dialog.css +377 -0
- package/app/components/primer/alpha/dialog.css.json +66 -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 +296 -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/layout.css +374 -0
- package/app/components/primer/alpha/layout.css.json +74 -0
- package/app/components/primer/alpha/menu.css +124 -0
- package/app/components/primer/alpha/menu.css.json +26 -0
- package/app/components/primer/alpha/modal_dialog.d.ts +18 -0
- package/app/components/primer/alpha/modal_dialog.js +187 -0
- package/app/components/primer/alpha/overlay.css +25 -0
- package/app/components/primer/alpha/overlay.css.json +12 -0
- package/app/components/primer/alpha/segmented_control.css +161 -0
- package/app/components/primer/alpha/segmented_control.css.json +31 -0
- package/app/components/primer/alpha/segmented_control.d.ts +12 -0
- package/app/components/primer/alpha/segmented_control.js +59 -0
- package/app/components/primer/alpha/select_panel.css +10 -0
- package/app/components/primer/alpha/select_panel.css.json +7 -0
- package/app/components/primer/alpha/select_panel_element.d.ts +65 -0
- package/app/components/primer/alpha/select_panel_element.js +988 -0
- package/app/components/primer/alpha/skeleton_box.css +36 -0
- package/app/components/primer/alpha/skeleton_box.css.json +6 -0
- package/app/components/primer/alpha/stack.css +266 -0
- package/app/components/primer/alpha/stack.css.json +94 -0
- package/app/components/primer/alpha/stack_item.css +27 -0
- package/app/components/primer/alpha/stack_item.css.json +12 -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 +112 -0
- package/app/components/primer/alpha/tab_nav.css.json +22 -0
- package/app/components/primer/alpha/text_field.css +838 -0
- package/app/components/primer/alpha/text_field.css.json +134 -0
- package/app/components/primer/alpha/toggle_switch.css +230 -0
- package/app/components/primer/alpha/toggle_switch.css.json +40 -0
- package/app/components/primer/alpha/toggle_switch.d.ts +34 -0
- package/app/components/primer/alpha/toggle_switch.js +179 -0
- package/app/components/primer/alpha/tool_tip.d.ts +27 -0
- package/app/components/primer/alpha/tool_tip.js +443 -0
- package/app/components/primer/alpha/tree_view/tree_view.d.ts +42 -0
- package/app/components/primer/alpha/tree_view/tree_view.js +391 -0
- package/app/components/primer/alpha/tree_view/tree_view_icon_pair_element.d.ts +15 -0
- package/app/components/primer/alpha/tree_view/tree_view_icon_pair_element.js +62 -0
- package/app/components/primer/alpha/tree_view/tree_view_include_fragment_element.d.ts +9 -0
- package/app/components/primer/alpha/tree_view/tree_view_include_fragment_element.js +28 -0
- package/app/components/primer/alpha/tree_view/tree_view_roving_tab_index.d.ts +3 -0
- package/app/components/primer/alpha/tree_view/tree_view_roving_tab_index.js +130 -0
- package/app/components/primer/alpha/tree_view/tree_view_sub_tree_node_element.d.ts +45 -0
- package/app/components/primer/alpha/tree_view/tree_view_sub_tree_node_element.js +429 -0
- package/app/components/primer/alpha/tree_view.css +396 -0
- package/app/components/primer/alpha/tree_view.css.json +52 -0
- package/app/components/primer/alpha/underline_nav.css +150 -0
- package/app/components/primer/alpha/underline_nav.css.json +26 -0
- package/app/components/primer/alpha/x_banner.d.ts +18 -0
- package/app/components/primer/alpha/x_banner.js +51 -0
- package/app/components/primer/anchored_position.d.ts +27 -0
- package/app/components/primer/anchored_position.js +159 -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 +77 -0
- package/app/components/primer/beta/avatar.css.json +17 -0
- package/app/components/primer/beta/avatar_stack.css +145 -0
- package/app/components/primer/beta/avatar_stack.css.json +28 -0
- package/app/components/primer/beta/blankslate.css +168 -0
- package/app/components/primer/beta/blankslate.css.json +23 -0
- package/app/components/primer/beta/border_box.css +218 -0
- package/app/components/primer/beta/border_box.css.json +54 -0
- package/app/components/primer/beta/breadcrumbs.css +29 -0
- package/app/components/primer/beta/breadcrumbs.css.json +9 -0
- package/app/components/primer/beta/button.css +359 -0
- package/app/components/primer/beta/button.css.json +86 -0
- package/app/components/primer/beta/button_group.css +20 -0
- package/app/components/primer/beta/button_group.css.json +12 -0
- package/app/components/primer/beta/clipboard_copy.d.ts +1 -0
- package/app/components/primer/beta/clipboard_copy.js +58 -0
- package/app/components/primer/beta/counter.css +38 -0
- package/app/components/primer/beta/counter.css.json +10 -0
- package/app/components/primer/beta/details_toggle_element.d.ts +40 -0
- package/app/components/primer/beta/details_toggle_element.js +65 -0
- package/app/components/primer/beta/flash.css +152 -0
- package/app/components/primer/beta/flash.css.json +27 -0
- package/app/components/primer/beta/label.css +109 -0
- package/app/components/primer/beta/label.css.json +24 -0
- package/app/components/primer/beta/link.css +79 -0
- package/app/components/primer/beta/link.css.json +19 -0
- package/app/components/primer/beta/nav_list.d.ts +20 -0
- package/app/components/primer/beta/nav_list.js +192 -0
- package/app/components/primer/beta/nav_list_group_element.d.ts +19 -0
- package/app/components/primer/beta/nav_list_group_element.js +111 -0
- package/app/components/primer/beta/popover.css +215 -0
- package/app/components/primer/beta/popover.css.json +33 -0
- package/app/components/primer/beta/progress_bar.css +27 -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 +59 -0
- package/app/components/primer/beta/state.css.json +13 -0
- package/app/components/primer/beta/subhead.css +64 -0
- package/app/components/primer/beta/subhead.css.json +14 -0
- package/app/components/primer/beta/timeline_item.css +106 -0
- package/app/components/primer/beta/timeline_item.css.json +16 -0
- package/app/components/primer/beta/truncate.css +30 -0
- package/app/components/primer/beta/truncate.css.json +12 -0
- package/app/components/primer/dialog_helper.d.ts +15 -0
- package/app/components/primer/dialog_helper.js +132 -0
- package/app/components/primer/focus_group.d.ts +19 -0
- package/app/components/primer/focus_group.js +163 -0
- package/app/components/primer/open_project/border_box/collapsible_header.css +21 -0
- package/app/components/primer/open_project/border_box/collapsible_header.css.json +11 -0
- package/app/components/primer/open_project/border_box/collapsible_header.d.ts +11 -0
- package/app/components/primer/open_project/border_box/collapsible_header.js +21 -0
- package/app/components/primer/open_project/border_grid.css +35 -0
- package/app/components/primer/open_project/border_grid.css.json +11 -0
- package/app/components/primer/open_project/collapsible.d.ts +13 -0
- package/app/components/primer/open_project/collapsible.js +67 -0
- package/app/components/primer/open_project/collapsible_section.css +5 -0
- package/app/components/primer/open_project/collapsible_section.css.json +6 -0
- package/app/components/primer/open_project/collapsible_section.d.ts +10 -0
- package/app/components/primer/open_project/collapsible_section.js +16 -0
- package/app/components/primer/open_project/danger_dialog_form_helper.d.ts +14 -0
- package/app/components/primer/open_project/danger_dialog_form_helper.js +54 -0
- package/app/components/primer/open_project/drag_handle.css +6 -0
- package/app/components/primer/open_project/drag_handle.css.json +6 -0
- package/app/components/primer/open_project/filterable_tree_view.d.ts +29 -0
- package/app/components/primer/open_project/filterable_tree_view.js +409 -0
- package/app/components/primer/open_project/input_group.css +22 -0
- package/app/components/primer/open_project/input_group.css.json +12 -0
- package/app/components/primer/open_project/page_header.css +87 -0
- package/app/components/primer/open_project/page_header.css.json +20 -0
- package/app/components/primer/open_project/page_header_element.d.ts +9 -0
- package/app/components/primer/open_project/page_header_element.js +23 -0
- package/app/components/primer/open_project/side_panel/section.css +27 -0
- package/app/components/primer/open_project/side_panel/section.css.json +11 -0
- package/app/components/primer/open_project/sub_header.css +80 -0
- package/app/components/primer/open_project/sub_header.css.json +17 -0
- package/app/components/primer/open_project/sub_header_element.d.ts +17 -0
- package/app/components/primer/open_project/sub_header_element.js +76 -0
- package/app/components/primer/open_project/zen_mode_button.d.ts +18 -0
- package/app/components/primer/open_project/zen_mode_button.js +64 -0
- package/app/components/primer/primer.d.ts +40 -0
- package/app/components/primer/primer.js +40 -0
- package/app/components/primer/scrollable_region.d.ts +13 -0
- package/app/components/primer/scrollable_region.js +52 -0
- package/app/components/primer/shared_events.d.ts +26 -0
- package/app/components/primer/shared_events.js +1 -0
- package/app/components/primer/truncate.css +23 -0
- package/app/components/primer/truncate.css.json +13 -0
- package/app/components/primer/utils.d.ts +1 -0
- package/app/components/primer/utils.js +16 -0
- package/app/lib/primer/forms/primer_multi_input.d.ts +10 -0
- package/app/lib/primer/forms/primer_multi_input.js +44 -0
- package/app/lib/primer/forms/primer_text_field.d.ts +28 -0
- package/app/lib/primer/forms/primer_text_field.js +119 -0
- package/app/lib/primer/forms/toggle_switch_input.d.ts +5 -0
- package/app/lib/primer/forms/toggle_switch_input.js +34 -0
- package/package.json +103 -0
- package/static/arguments.json +6472 -0
- package/static/audited_at.json +173 -0
- package/static/classes.json +781 -0
- package/static/constants.json +1972 -0
- package/static/form_previews.json +118 -0
- package/static/info_arch.json +21331 -0
- package/static/previews.json +9436 -0
- package/static/statuses.json +173 -0
|
@@ -0,0 +1,443 @@
|
|
|
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_showReason, _ToolTipElement_update, _ToolTipElement_updateControl, _ToolTipElement_updateControlReference, _ToolTipElement_updateDirection, _ToolTipElement_updatePosition;
|
|
13
|
+
import '@oddbird/popover-polyfill';
|
|
14
|
+
import { getAnchoredPosition } from '@primer/behaviors';
|
|
15
|
+
const isPopoverOpen = (() => {
|
|
16
|
+
let selector;
|
|
17
|
+
function setSelector(el) {
|
|
18
|
+
try {
|
|
19
|
+
selector = ':popover-open';
|
|
20
|
+
return el.matches(selector);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
try {
|
|
24
|
+
selector = ':open';
|
|
25
|
+
return el.matches(':open');
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
selector = '.\\:popover-open';
|
|
29
|
+
return el.matches('.\\:popover-open');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return (el) => (selector ? el.matches(selector) : setSelector(el));
|
|
34
|
+
})();
|
|
35
|
+
const TOOLTIP_SR_ONLY_CLASS = 'sr-only';
|
|
36
|
+
const DIRECTION_CLASSES = [
|
|
37
|
+
'tooltip-n',
|
|
38
|
+
'tooltip-s',
|
|
39
|
+
'tooltip-e',
|
|
40
|
+
'tooltip-w',
|
|
41
|
+
'tooltip-ne',
|
|
42
|
+
'tooltip-se',
|
|
43
|
+
'tooltip-nw',
|
|
44
|
+
'tooltip-sw',
|
|
45
|
+
];
|
|
46
|
+
function closeOpenTooltips(except) {
|
|
47
|
+
for (const tooltip of openTooltips) {
|
|
48
|
+
if (tooltip === except)
|
|
49
|
+
continue;
|
|
50
|
+
if (isPopoverOpen(tooltip)) {
|
|
51
|
+
tooltip.hidePopover();
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
openTooltips.delete(tooltip);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function focusOutListener() {
|
|
59
|
+
closeOpenTooltips();
|
|
60
|
+
}
|
|
61
|
+
function focusInListener(event) {
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
for (const tooltip of openTooltips) {
|
|
64
|
+
if (isPopoverOpen(tooltip) && tooltip.showReason === 'focus' && tooltip.control !== event.target) {
|
|
65
|
+
tooltip.hidePopover();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, 0);
|
|
69
|
+
}
|
|
70
|
+
const tooltips = new Set();
|
|
71
|
+
const openTooltips = new Set();
|
|
72
|
+
class ToolTipElement extends HTMLElement {
|
|
73
|
+
constructor() {
|
|
74
|
+
super(...arguments);
|
|
75
|
+
_ToolTipElement_instances.add(this);
|
|
76
|
+
_ToolTipElement_abortController.set(this, void 0);
|
|
77
|
+
_ToolTipElement_align.set(this, 'center');
|
|
78
|
+
_ToolTipElement_side.set(this, 'outside-bottom');
|
|
79
|
+
_ToolTipElement_allowUpdatePosition.set(this, false);
|
|
80
|
+
_ToolTipElement_showReason.set(this, 'mouse');
|
|
81
|
+
}
|
|
82
|
+
styles() {
|
|
83
|
+
return `
|
|
84
|
+
:host {
|
|
85
|
+
--tooltip-top: var(--tool-tip-position-top, 0);
|
|
86
|
+
--tooltip-left: var(--tool-tip-position-left, 0);
|
|
87
|
+
padding: var(--overlay-paddingBlock-condensed) var(--overlay-padding-condensed) !important;
|
|
88
|
+
font: var(--text-body-shorthand-small);
|
|
89
|
+
color: var(--tooltip-fgColor, var(--fgColor-onEmphasis)) !important;
|
|
90
|
+
text-align: center;
|
|
91
|
+
text-decoration: none;
|
|
92
|
+
text-shadow: none;
|
|
93
|
+
text-transform: none;
|
|
94
|
+
letter-spacing: normal;
|
|
95
|
+
word-wrap: break-word;
|
|
96
|
+
white-space: pre;
|
|
97
|
+
background: var(--tooltip-bgColor, var(--bgColor-emphasis)) !important;
|
|
98
|
+
border-radius: var(--borderRadius-medium);
|
|
99
|
+
border: 0 !important;
|
|
100
|
+
opacity: 0;
|
|
101
|
+
max-width: var(--overlay-width-small);
|
|
102
|
+
word-wrap: break-word;
|
|
103
|
+
white-space: normal;
|
|
104
|
+
width: max-content !important;
|
|
105
|
+
inset: var(--tooltip-top) auto auto var(--tooltip-left) !important;
|
|
106
|
+
overflow: visible !important;
|
|
107
|
+
text-wrap: balance;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
:host(:is(.tooltip-n, .tooltip-nw, .tooltip-ne)) {
|
|
111
|
+
--tooltip-top: calc(var(--tool-tip-position-top, 0) - var(--overlay-offset, 0.25rem));
|
|
112
|
+
--tooltip-left: var(--tool-tip-position-left);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
:host(:is(.tooltip-s, .tooltip-sw, .tooltip-se)) {
|
|
116
|
+
--tooltip-top: calc(var(--tool-tip-position-top, 0) + var(--overlay-offset, 0.25rem));
|
|
117
|
+
--tooltip-left: var(--tool-tip-position-left);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
:host(.tooltip-w) {
|
|
121
|
+
--tooltip-top: var(--tool-tip-position-top);
|
|
122
|
+
--tooltip-left: calc(var(--tool-tip-position-left, 0) - var(--overlay-offset, 0.25rem));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:host(.tooltip-e) {
|
|
126
|
+
--tooltip-top: var(--tool-tip-position-top);
|
|
127
|
+
--tooltip-left: calc(var(--tool-tip-position-left, 0) + var(--overlay-offset, 0.25rem));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
:host:after{
|
|
131
|
+
position: absolute;
|
|
132
|
+
display: block;
|
|
133
|
+
right: 0;
|
|
134
|
+
left: 0;
|
|
135
|
+
height: var(--overlay-offset, 0.25rem);
|
|
136
|
+
content: "";
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
:host(.tooltip-s):after,
|
|
140
|
+
:host(.tooltip-se):after,
|
|
141
|
+
:host(.tooltip-sw):after {
|
|
142
|
+
bottom: 100%
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:host(.tooltip-n):after,
|
|
146
|
+
:host(.tooltip-ne):after,
|
|
147
|
+
:host(.tooltip-nw):after {
|
|
148
|
+
top: 100%;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@keyframes tooltip-appear {
|
|
152
|
+
from {
|
|
153
|
+
opacity: 0;
|
|
154
|
+
}
|
|
155
|
+
to {
|
|
156
|
+
opacity: 1;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
:host(:popover-open),
|
|
161
|
+
:host(:popover-open):before {
|
|
162
|
+
animation-name: tooltip-appear;
|
|
163
|
+
animation-duration: .1s;
|
|
164
|
+
animation-fill-mode: forwards;
|
|
165
|
+
animation-timing-function: ease-in;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
:host(.\\:popover-open) {
|
|
169
|
+
animation-name: tooltip-appear;
|
|
170
|
+
animation-duration: .1s;
|
|
171
|
+
animation-fill-mode: forwards;
|
|
172
|
+
animation-timing-function: ease-in;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@media (forced-colors: active) {
|
|
176
|
+
:host {
|
|
177
|
+
outline: solid 1px transparent;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
:host:before {
|
|
181
|
+
display: none;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
`;
|
|
185
|
+
}
|
|
186
|
+
get showReason() {
|
|
187
|
+
return __classPrivateFieldGet(this, _ToolTipElement_showReason, "f");
|
|
188
|
+
}
|
|
189
|
+
get htmlFor() {
|
|
190
|
+
return this.getAttribute('for') || '';
|
|
191
|
+
}
|
|
192
|
+
set htmlFor(value) {
|
|
193
|
+
this.setAttribute('for', value);
|
|
194
|
+
}
|
|
195
|
+
get type() {
|
|
196
|
+
const type = this.getAttribute('data-type');
|
|
197
|
+
return type === 'label' ? 'label' : 'description';
|
|
198
|
+
}
|
|
199
|
+
set type(value) {
|
|
200
|
+
this.setAttribute('data-type', value);
|
|
201
|
+
}
|
|
202
|
+
get direction() {
|
|
203
|
+
return (this.getAttribute('data-direction') || 's');
|
|
204
|
+
}
|
|
205
|
+
set direction(value) {
|
|
206
|
+
this.setAttribute('data-direction', value);
|
|
207
|
+
}
|
|
208
|
+
get control() {
|
|
209
|
+
return this.ownerDocument.getElementById(this.htmlFor);
|
|
210
|
+
}
|
|
211
|
+
/* @deprecated */
|
|
212
|
+
set hiddenFromView(value) {
|
|
213
|
+
if (value && isPopoverOpen(this)) {
|
|
214
|
+
this.hidePopover();
|
|
215
|
+
}
|
|
216
|
+
else if (!value && !isPopoverOpen(this)) {
|
|
217
|
+
this.showPopover();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/* @deprecated */
|
|
221
|
+
get hiddenFromView() {
|
|
222
|
+
return !isPopoverOpen(this);
|
|
223
|
+
}
|
|
224
|
+
connectedCallback() {
|
|
225
|
+
tooltips.add(this);
|
|
226
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateControlReference).call(this);
|
|
227
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateDirection).call(this);
|
|
228
|
+
if (!this.shadowRoot) {
|
|
229
|
+
const shadow = this.attachShadow({ mode: 'open' });
|
|
230
|
+
const style = shadow.appendChild(document.createElement('style'));
|
|
231
|
+
style.textContent = this.styles();
|
|
232
|
+
shadow.appendChild(document.createElement('slot'));
|
|
233
|
+
}
|
|
234
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_update).call(this, false);
|
|
235
|
+
__classPrivateFieldSet(this, _ToolTipElement_allowUpdatePosition, true, "f");
|
|
236
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateControl).call(this);
|
|
237
|
+
}
|
|
238
|
+
disconnectedCallback() {
|
|
239
|
+
tooltips.delete(this);
|
|
240
|
+
openTooltips.delete(this);
|
|
241
|
+
__classPrivateFieldGet(this, _ToolTipElement_abortController, "f")?.abort();
|
|
242
|
+
}
|
|
243
|
+
async handleEvent(event) {
|
|
244
|
+
if (!this.control)
|
|
245
|
+
return;
|
|
246
|
+
const showing = isPopoverOpen(this);
|
|
247
|
+
// Ensures that tooltip stays open when hovering between tooltip and element
|
|
248
|
+
// WCAG Success Criterion 1.4.13 Hoverable
|
|
249
|
+
const shouldShow = event.type === 'mouseenter' ||
|
|
250
|
+
// Only show tooltip on focus if running in headless browser (for tests) or if focus ring
|
|
251
|
+
// is visible (i.e. if user is using keyboard navigation)
|
|
252
|
+
(event.type === 'focus' && (navigator.webdriver || this.control.matches(':focus-visible')));
|
|
253
|
+
const isMouseLeaveFromButton = event.type === 'mouseleave' &&
|
|
254
|
+
event.relatedTarget !== this.control &&
|
|
255
|
+
event.relatedTarget !== this;
|
|
256
|
+
const isEscapeKeydown = event.type === 'keydown' && event.key === 'Escape';
|
|
257
|
+
const isMouseDownOnButton = event.type === 'mousedown' && event.currentTarget === this.control;
|
|
258
|
+
const isOpeningOtherPopover = event.type === 'beforetoggle' && event.currentTarget !== this;
|
|
259
|
+
const shouldHide = isMouseLeaveFromButton || isEscapeKeydown || isMouseDownOnButton || isOpeningOtherPopover;
|
|
260
|
+
if (showing && isEscapeKeydown) {
|
|
261
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
262
|
+
event.stopImmediatePropagation();
|
|
263
|
+
event.preventDefault();
|
|
264
|
+
}
|
|
265
|
+
await Promise.resolve();
|
|
266
|
+
if (!showing && shouldShow && !isPopoverOpen(this)) {
|
|
267
|
+
__classPrivateFieldSet(this, _ToolTipElement_showReason, event.type === 'mouseenter' ? 'mouse' : 'focus', "f");
|
|
268
|
+
this.showPopover();
|
|
269
|
+
}
|
|
270
|
+
else if (showing && shouldHide && isPopoverOpen(this)) {
|
|
271
|
+
this.hidePopover();
|
|
272
|
+
}
|
|
273
|
+
if (event.type === 'toggle') {
|
|
274
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_update).call(this, event.newState === 'open');
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
attributeChangedCallback(name) {
|
|
278
|
+
if (!this.isConnected)
|
|
279
|
+
return;
|
|
280
|
+
if (name === 'for') {
|
|
281
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateControl).call(this);
|
|
282
|
+
}
|
|
283
|
+
else if (name === 'id' || name === 'data-type') {
|
|
284
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateControlReference).call(this);
|
|
285
|
+
}
|
|
286
|
+
else if (name === 'data-direction') {
|
|
287
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updateDirection).call(this);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
_ToolTipElement_abortController = new WeakMap(), _ToolTipElement_align = new WeakMap(), _ToolTipElement_side = new WeakMap(), _ToolTipElement_allowUpdatePosition = new WeakMap(), _ToolTipElement_showReason = new WeakMap(), _ToolTipElement_instances = new WeakSet(), _ToolTipElement_update = function _ToolTipElement_update(isOpen) {
|
|
292
|
+
if (isOpen) {
|
|
293
|
+
openTooltips.add(this);
|
|
294
|
+
this.classList.remove(TOOLTIP_SR_ONLY_CLASS);
|
|
295
|
+
closeOpenTooltips(this);
|
|
296
|
+
__classPrivateFieldGet(this, _ToolTipElement_instances, "m", _ToolTipElement_updatePosition).call(this);
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
openTooltips.delete(this);
|
|
300
|
+
this.classList.remove(...DIRECTION_CLASSES);
|
|
301
|
+
this.classList.add(TOOLTIP_SR_ONLY_CLASS);
|
|
302
|
+
}
|
|
303
|
+
}, _ToolTipElement_updateControl = function _ToolTipElement_updateControl() {
|
|
304
|
+
if (!this.control)
|
|
305
|
+
return;
|
|
306
|
+
this.setAttribute('role', 'tooltip');
|
|
307
|
+
__classPrivateFieldGet(this, _ToolTipElement_abortController, "f")?.abort();
|
|
308
|
+
__classPrivateFieldSet(this, _ToolTipElement_abortController, new AbortController(), "f");
|
|
309
|
+
const { signal } = __classPrivateFieldGet(this, _ToolTipElement_abortController, "f");
|
|
310
|
+
this.addEventListener('mouseleave', this, { signal });
|
|
311
|
+
this.addEventListener('toggle', this, { signal });
|
|
312
|
+
this.control.addEventListener('mouseenter', this, { signal });
|
|
313
|
+
this.control.addEventListener('mouseleave', this, { signal });
|
|
314
|
+
this.control.addEventListener('focus', this, { signal });
|
|
315
|
+
this.control.addEventListener('mousedown', this, { signal });
|
|
316
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
317
|
+
// @ts-ignore popoverTargetElement is not in the type definition
|
|
318
|
+
this.control.popoverTargetElement?.addEventListener('beforetoggle', this, {
|
|
319
|
+
signal,
|
|
320
|
+
});
|
|
321
|
+
this.ownerDocument.addEventListener('focusout', focusOutListener);
|
|
322
|
+
this.ownerDocument.addEventListener('focusin', focusInListener);
|
|
323
|
+
this.ownerDocument.addEventListener('keydown', this, { signal, capture: true });
|
|
324
|
+
}, _ToolTipElement_updateControlReference = function _ToolTipElement_updateControlReference() {
|
|
325
|
+
if (!this.id || !this.control)
|
|
326
|
+
return;
|
|
327
|
+
if (this.type === 'label') {
|
|
328
|
+
let labelledBy = this.control.getAttribute('aria-labelledby');
|
|
329
|
+
if (labelledBy) {
|
|
330
|
+
if (!labelledBy.split(' ').includes(this.id)) {
|
|
331
|
+
labelledBy = `${labelledBy} ${this.id}`;
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
labelledBy = `${labelledBy}`;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
labelledBy = this.id;
|
|
339
|
+
}
|
|
340
|
+
this.control.setAttribute('aria-labelledby', labelledBy);
|
|
341
|
+
// Prevent duplicate accessible name announcements.
|
|
342
|
+
this.setAttribute('aria-hidden', 'true');
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
let describedBy = this.control.getAttribute('aria-describedby');
|
|
346
|
+
if (describedBy) {
|
|
347
|
+
if (!describedBy.split(' ').includes(this.id)) {
|
|
348
|
+
describedBy = `${describedBy} ${this.id}`;
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
describedBy = `${describedBy}`;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
describedBy = this.id;
|
|
356
|
+
}
|
|
357
|
+
this.control.setAttribute('aria-describedby', describedBy);
|
|
358
|
+
}
|
|
359
|
+
}, _ToolTipElement_updateDirection = function _ToolTipElement_updateDirection() {
|
|
360
|
+
this.classList.remove(...DIRECTION_CLASSES);
|
|
361
|
+
const direction = this.direction;
|
|
362
|
+
if (direction === 'n') {
|
|
363
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
364
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
|
365
|
+
}
|
|
366
|
+
else if (direction === 'ne') {
|
|
367
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'end', "f");
|
|
368
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
|
369
|
+
}
|
|
370
|
+
else if (direction === 'e') {
|
|
371
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
372
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-right', "f");
|
|
373
|
+
}
|
|
374
|
+
else if (direction === 'se') {
|
|
375
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'end', "f");
|
|
376
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
|
377
|
+
}
|
|
378
|
+
else if (direction === 's') {
|
|
379
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
380
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
|
381
|
+
}
|
|
382
|
+
else if (direction === 'sw') {
|
|
383
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'start', "f");
|
|
384
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-bottom', "f");
|
|
385
|
+
}
|
|
386
|
+
else if (direction === 'w') {
|
|
387
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'center', "f");
|
|
388
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-left', "f");
|
|
389
|
+
}
|
|
390
|
+
else if (direction === 'nw') {
|
|
391
|
+
__classPrivateFieldSet(this, _ToolTipElement_align, 'start', "f");
|
|
392
|
+
__classPrivateFieldSet(this, _ToolTipElement_side, 'outside-top', "f");
|
|
393
|
+
}
|
|
394
|
+
}, _ToolTipElement_updatePosition = function _ToolTipElement_updatePosition() {
|
|
395
|
+
if (!this.control)
|
|
396
|
+
return;
|
|
397
|
+
if (!__classPrivateFieldGet(this, _ToolTipElement_allowUpdatePosition, "f") || !isPopoverOpen(this))
|
|
398
|
+
return;
|
|
399
|
+
const position = getAnchoredPosition(this, this.control, {
|
|
400
|
+
side: __classPrivateFieldGet(this, _ToolTipElement_side, "f"),
|
|
401
|
+
align: __classPrivateFieldGet(this, _ToolTipElement_align, "f"),
|
|
402
|
+
anchorOffset: 0,
|
|
403
|
+
});
|
|
404
|
+
const anchorSide = position.anchorSide;
|
|
405
|
+
const align = position.anchorAlign;
|
|
406
|
+
this.style.setProperty('--tool-tip-position-top', `${position.top}px`);
|
|
407
|
+
this.style.setProperty('--tool-tip-position-left', `${position.left}px`);
|
|
408
|
+
let direction = 's';
|
|
409
|
+
if (anchorSide === 'outside-left') {
|
|
410
|
+
direction = 'w';
|
|
411
|
+
}
|
|
412
|
+
else if (anchorSide === 'outside-right') {
|
|
413
|
+
direction = 'e';
|
|
414
|
+
}
|
|
415
|
+
else if (anchorSide === 'outside-top') {
|
|
416
|
+
if (align === 'center') {
|
|
417
|
+
direction = 'n';
|
|
418
|
+
}
|
|
419
|
+
else if (align === 'start') {
|
|
420
|
+
direction = 'ne';
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
direction = 'nw';
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
else {
|
|
427
|
+
if (align === 'center') {
|
|
428
|
+
direction = 's';
|
|
429
|
+
}
|
|
430
|
+
else if (align === 'start') {
|
|
431
|
+
direction = 'se';
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
direction = 'sw';
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
this.classList.add(`tooltip-${direction}`);
|
|
438
|
+
};
|
|
439
|
+
ToolTipElement.observedAttributes = ['data-type', 'data-direction', 'id', 'for'];
|
|
440
|
+
if (!window.customElements.get('tool-tip')) {
|
|
441
|
+
window.ToolTipElement = ToolTipElement;
|
|
442
|
+
window.customElements.define('tool-tip', ToolTipElement);
|
|
443
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { SelectStrategy, TreeViewSubTreeNodeElement } from './tree_view_sub_tree_node_element';
|
|
2
|
+
import type { TreeViewNodeType, TreeViewCheckedValue, TreeViewNodeInfo } from '../../shared_events';
|
|
3
|
+
export declare class TreeViewElement extends HTMLElement {
|
|
4
|
+
#private;
|
|
5
|
+
formInputContainer: HTMLElement;
|
|
6
|
+
formInputPrototype: HTMLInputElement;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
rootLeafNodes(): NodeListOf<HTMLElement>;
|
|
9
|
+
rootSubTreeNodes(): NodeListOf<TreeViewSubTreeNodeElement>;
|
|
10
|
+
disconnectedCallback(): void;
|
|
11
|
+
handleEvent(event: Event): void;
|
|
12
|
+
getFormInputValueForNode(node: Element): string | null;
|
|
13
|
+
getNodePath(node: Element): string[];
|
|
14
|
+
getNodeType(node: Element): TreeViewNodeType | null;
|
|
15
|
+
markCurrentAtPath(path: string[]): void;
|
|
16
|
+
get currentNode(): HTMLLIElement | null;
|
|
17
|
+
expandAtPath(path: string[]): void;
|
|
18
|
+
collapseAtPath(path: string[]): void;
|
|
19
|
+
toggleAtPath(path: string[]): void;
|
|
20
|
+
checkAtPath(path: string[]): void;
|
|
21
|
+
uncheckAtPath(path: string[]): void;
|
|
22
|
+
toggleCheckedAtPath(path: string[]): void;
|
|
23
|
+
checkedValueAtPath(path: string[]): TreeViewCheckedValue;
|
|
24
|
+
disabledValueAtPath(path: string[]): boolean;
|
|
25
|
+
nodeAtPath(path: string[], selector?: string): Element | null;
|
|
26
|
+
subTreeAtPath(path: string[]): TreeViewSubTreeNodeElement | null;
|
|
27
|
+
leafAtPath(path: string[]): HTMLLIElement | null;
|
|
28
|
+
setNodeCheckedValue(node: Element, value: TreeViewCheckedValue): void;
|
|
29
|
+
getNodeCheckedValue(node: Element): TreeViewCheckedValue;
|
|
30
|
+
getNodeDisabledValue(node: Element): boolean;
|
|
31
|
+
setNodeDisabledValue(node: Element, disabled: boolean): void;
|
|
32
|
+
nodeHasCheckBox(node: Element): boolean;
|
|
33
|
+
nodeHasNativeAction(node: Element): boolean;
|
|
34
|
+
expandAncestorsForNode(node: HTMLElement): void;
|
|
35
|
+
changeSelectStrategy(newStrategy: SelectStrategy): void;
|
|
36
|
+
infoFromNode(node: Element, newCheckedValue?: TreeViewCheckedValue): TreeViewNodeInfo | null;
|
|
37
|
+
}
|
|
38
|
+
declare global {
|
|
39
|
+
interface Window {
|
|
40
|
+
TreeViewElement: typeof TreeViewElement;
|
|
41
|
+
}
|
|
42
|
+
}
|