@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,49 @@
|
|
|
1
|
+
/* CSS for ActionBar */
|
|
2
|
+
.ActionBar {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: flex !important;
|
|
5
|
+
min-width: calc(var(--control-medium-size) * 3);
|
|
6
|
+
align-items: center;
|
|
7
|
+
flex-grow: 1;
|
|
8
|
+
flex-shrink: 1;
|
|
9
|
+
box-sizing: content-box;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
justify-content: flex-end;
|
|
12
|
+
}
|
|
13
|
+
.ActionBar-item-container {
|
|
14
|
+
height: var(--control-medium-size);
|
|
15
|
+
box-sizing: content-box;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
}
|
|
18
|
+
.ActionBar-item {
|
|
19
|
+
position: relative;
|
|
20
|
+
float: left;
|
|
21
|
+
}
|
|
22
|
+
.ActionBar-more-menu {
|
|
23
|
+
float: left;
|
|
24
|
+
}
|
|
25
|
+
.ActionBar--small {
|
|
26
|
+
min-width: calc(var(--control-small-size) * 3);
|
|
27
|
+
}
|
|
28
|
+
.ActionBar--large {
|
|
29
|
+
min-width: calc(var(--control-large-size) * 3);
|
|
30
|
+
}
|
|
31
|
+
/* Divider */
|
|
32
|
+
.ActionBar-divider {
|
|
33
|
+
top: 50%;
|
|
34
|
+
bottom: 50%;
|
|
35
|
+
float: left;
|
|
36
|
+
height: calc(var(--control-medium-size) / 2);
|
|
37
|
+
/* stylelint-disable-next-line primer/spacing */
|
|
38
|
+
margin: 0 var(--controlStack-medium-gap-condensed);
|
|
39
|
+
border-left: var(--borderWidth-thin) solid var(--borderColor-muted);
|
|
40
|
+
transform: translateY(-50%);
|
|
41
|
+
}
|
|
42
|
+
.ActionBar--small .ActionBar-divider {
|
|
43
|
+
/* stylelint-disable-next-line primer/spacing */
|
|
44
|
+
margin: 0 var(--controlStack-small-gap-condensed);
|
|
45
|
+
}
|
|
46
|
+
.ActionBar--large .ActionBar-divider {
|
|
47
|
+
/* stylelint-disable-next-line primer/spacing */
|
|
48
|
+
margin: 0 var(--controlStack-large-gap-condensed);
|
|
49
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "alpha/action_bar",
|
|
3
|
+
"selectors": [
|
|
4
|
+
".ActionBar",
|
|
5
|
+
".ActionBar-item-container",
|
|
6
|
+
".ActionBar-item",
|
|
7
|
+
".ActionBar-more-menu",
|
|
8
|
+
".ActionBar--small",
|
|
9
|
+
".ActionBar--large",
|
|
10
|
+
".ActionBar-divider",
|
|
11
|
+
".ActionBar--small .ActionBar-divider",
|
|
12
|
+
".ActionBar--large .ActionBar-divider"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ActionMenuElement } from './action_menu/action_menu_element';
|
|
2
|
+
declare class ActionBarElement extends HTMLElement {
|
|
3
|
+
#private;
|
|
4
|
+
items: HTMLElement[];
|
|
5
|
+
itemContainer: HTMLElement;
|
|
6
|
+
moreMenu: ActionMenuElement;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
disconnectedCallback(): void;
|
|
9
|
+
menuItemClick(event: Event): void;
|
|
10
|
+
update(): void;
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface Window {
|
|
14
|
+
ActionBarElement: typeof ActionBarElement;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,170 @@
|
|
|
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
|
+
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 __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
14
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
15
|
+
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");
|
|
16
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
17
|
+
};
|
|
18
|
+
var _ActionBarElement_instances, _ActionBarElement_focusZoneAbortController, _ActionBarElement_firstItem_get, _ActionBarElement_showItem, _ActionBarElement_hideItem, _ActionBarElement_menuItems_get, _ActionBarElement_eachItem;
|
|
19
|
+
import { controller, targets, target } from '@github/catalyst';
|
|
20
|
+
import { focusZone, FocusKeys } from '@primer/behaviors';
|
|
21
|
+
const instersectionObserver = new IntersectionObserver(entries => {
|
|
22
|
+
for (const entry of entries) {
|
|
23
|
+
const action = entry.target;
|
|
24
|
+
if (entry.isIntersecting && action instanceof ActionBarElement) {
|
|
25
|
+
action.update();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const resizeObserver = new ResizeObserver(entries => {
|
|
30
|
+
for (const entry of entries) {
|
|
31
|
+
const action = entry.target;
|
|
32
|
+
if (action instanceof ActionBarElement) {
|
|
33
|
+
action.update();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
// These are definitely used, but eslint is dumb apparently
|
|
38
|
+
var ItemType;
|
|
39
|
+
(function (ItemType) {
|
|
40
|
+
ItemType[ItemType["Item"] = 0] = "Item";
|
|
41
|
+
ItemType[ItemType["Divider"] = 1] = "Divider";
|
|
42
|
+
})(ItemType || (ItemType = {}));
|
|
43
|
+
let ActionBarElement = class ActionBarElement extends HTMLElement {
|
|
44
|
+
constructor() {
|
|
45
|
+
super(...arguments);
|
|
46
|
+
_ActionBarElement_instances.add(this);
|
|
47
|
+
_ActionBarElement_focusZoneAbortController.set(this, null);
|
|
48
|
+
}
|
|
49
|
+
connectedCallback() {
|
|
50
|
+
resizeObserver.observe(this);
|
|
51
|
+
instersectionObserver.observe(this);
|
|
52
|
+
requestAnimationFrame(() => {
|
|
53
|
+
// This overflow visible is needed for browsers that don't support PopoverElement
|
|
54
|
+
// to ensure the menu and tooltips are visible when the action bar is in a collapsed state
|
|
55
|
+
// once popover is fully supported we can remove this.style.overflow = 'visible'
|
|
56
|
+
this.style.overflow = 'visible';
|
|
57
|
+
this.update();
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
disconnectedCallback() {
|
|
61
|
+
resizeObserver.unobserve(this);
|
|
62
|
+
instersectionObserver.unobserve(this);
|
|
63
|
+
}
|
|
64
|
+
menuItemClick(event) {
|
|
65
|
+
const currentTarget = event.currentTarget;
|
|
66
|
+
const id = currentTarget?.getAttribute('data-for');
|
|
67
|
+
if (id) {
|
|
68
|
+
document.getElementById(id)?.click();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
update() {
|
|
72
|
+
const firstItem = __classPrivateFieldGet(this, _ActionBarElement_instances, "a", _ActionBarElement_firstItem_get);
|
|
73
|
+
if (!firstItem)
|
|
74
|
+
return;
|
|
75
|
+
const firstItemTop = firstItem.getBoundingClientRect().top;
|
|
76
|
+
let previousItemType = null;
|
|
77
|
+
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_eachItem).call(this, (item, index, type) => {
|
|
78
|
+
const itemTop = item.getBoundingClientRect().top;
|
|
79
|
+
if (type === ItemType.Item) {
|
|
80
|
+
if (itemTop > firstItemTop) {
|
|
81
|
+
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_hideItem).call(this, index);
|
|
82
|
+
if (this.moreMenu.hidden) {
|
|
83
|
+
this.moreMenu.hidden = false;
|
|
84
|
+
}
|
|
85
|
+
if (previousItemType === ItemType.Divider) {
|
|
86
|
+
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_hideItem).call(this, index - 1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_showItem).call(this, index);
|
|
91
|
+
if (index === this.items.length - 1) {
|
|
92
|
+
this.moreMenu.hidden = true;
|
|
93
|
+
}
|
|
94
|
+
if (previousItemType === ItemType.Divider) {
|
|
95
|
+
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_showItem).call(this, index - 1);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
previousItemType = type;
|
|
100
|
+
return true;
|
|
101
|
+
});
|
|
102
|
+
if (__classPrivateFieldGet(this, _ActionBarElement_focusZoneAbortController, "f")) {
|
|
103
|
+
__classPrivateFieldGet(this, _ActionBarElement_focusZoneAbortController, "f").abort();
|
|
104
|
+
}
|
|
105
|
+
__classPrivateFieldSet(this, _ActionBarElement_focusZoneAbortController, focusZone(this, {
|
|
106
|
+
bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
|
|
107
|
+
focusOutBehavior: 'wrap',
|
|
108
|
+
focusableElementFilter: element => {
|
|
109
|
+
const idx = this.items.indexOf(element.parentElement);
|
|
110
|
+
const elementIsVisibleItem = idx > -1 && this.items[idx].style.visibility === 'visible';
|
|
111
|
+
const elementIsVisibleActionMenuInvoker = element === this.moreMenu.invokerElement && !this.moreMenu.hidden;
|
|
112
|
+
return elementIsVisibleItem || elementIsVisibleActionMenuInvoker;
|
|
113
|
+
},
|
|
114
|
+
}), "f");
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
_ActionBarElement_focusZoneAbortController = new WeakMap();
|
|
118
|
+
_ActionBarElement_instances = new WeakSet();
|
|
119
|
+
_ActionBarElement_firstItem_get = function _ActionBarElement_firstItem_get() {
|
|
120
|
+
let foundItem = null;
|
|
121
|
+
__classPrivateFieldGet(this, _ActionBarElement_instances, "m", _ActionBarElement_eachItem).call(this, (item, _index, type) => {
|
|
122
|
+
if (type === ItemType.Item) {
|
|
123
|
+
foundItem = item;
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
return true;
|
|
127
|
+
});
|
|
128
|
+
return foundItem;
|
|
129
|
+
};
|
|
130
|
+
_ActionBarElement_showItem = function _ActionBarElement_showItem(index) {
|
|
131
|
+
const item = this.items[index];
|
|
132
|
+
const menuItem = __classPrivateFieldGet(this, _ActionBarElement_instances, "a", _ActionBarElement_menuItems_get)[index];
|
|
133
|
+
if (!item || !menuItem)
|
|
134
|
+
return;
|
|
135
|
+
item.style.setProperty('visibility', 'visible');
|
|
136
|
+
menuItem.hidden = true;
|
|
137
|
+
};
|
|
138
|
+
_ActionBarElement_hideItem = function _ActionBarElement_hideItem(index) {
|
|
139
|
+
const item = this.items[index];
|
|
140
|
+
const menuItem = __classPrivateFieldGet(this, _ActionBarElement_instances, "a", _ActionBarElement_menuItems_get)[index];
|
|
141
|
+
if (!item || !menuItem)
|
|
142
|
+
return;
|
|
143
|
+
item.style.setProperty('visibility', 'hidden');
|
|
144
|
+
menuItem.hidden = false;
|
|
145
|
+
};
|
|
146
|
+
_ActionBarElement_menuItems_get = function _ActionBarElement_menuItems_get() {
|
|
147
|
+
return this.moreMenu.querySelectorAll('[role="menu"] > li');
|
|
148
|
+
};
|
|
149
|
+
_ActionBarElement_eachItem = function _ActionBarElement_eachItem(callback) {
|
|
150
|
+
for (let i = 0; i < this.items.length; i++) {
|
|
151
|
+
const item = this.items[i];
|
|
152
|
+
const type = item.classList.contains('ActionBar-divider') ? ItemType.Divider : ItemType.Item;
|
|
153
|
+
if (!callback(item, i, type)) {
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
__decorate([
|
|
159
|
+
targets
|
|
160
|
+
], ActionBarElement.prototype, "items", void 0);
|
|
161
|
+
__decorate([
|
|
162
|
+
target
|
|
163
|
+
], ActionBarElement.prototype, "itemContainer", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
target
|
|
166
|
+
], ActionBarElement.prototype, "moreMenu", void 0);
|
|
167
|
+
ActionBarElement = __decorate([
|
|
168
|
+
controller
|
|
169
|
+
], ActionBarElement);
|
|
170
|
+
window.ActionBarElement = ActionBarElement;
|