@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,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "alpha/layout",
|
|
3
|
+
"selectors": [
|
|
4
|
+
".Layout",
|
|
5
|
+
".Layout .Layout-sidebar",
|
|
6
|
+
".Layout .Layout-divider",
|
|
7
|
+
".Layout .Layout-main",
|
|
8
|
+
".Layout.Layout--sidebarPosition-flowRow-start .Layout-sidebar",
|
|
9
|
+
".Layout.Layout--sidebarPosition-flowRow-start .Layout-main",
|
|
10
|
+
".Layout.Layout--sidebarPosition-flowRow-end .Layout-sidebar",
|
|
11
|
+
".Layout.Layout--sidebarPosition-flowRow-end .Layout-main",
|
|
12
|
+
".Layout.Layout--sidebarPosition-flowRow-none .Layout-sidebar",
|
|
13
|
+
".Layout.Layout--divided",
|
|
14
|
+
".Layout.Layout--divided .Layout-divider",
|
|
15
|
+
".Layout-divider--flowRow-hidden:is(.Layout.Layout--divided .Layout-divider)",
|
|
16
|
+
".Layout-divider--flowRow-shallow:is(.Layout.Layout--divided .Layout-divider)",
|
|
17
|
+
".Layout.Layout--divided .Layout-main",
|
|
18
|
+
".Layout.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-sidebar",
|
|
19
|
+
".Layout.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-main",
|
|
20
|
+
".Layout.Layout--flowRow-until-md",
|
|
21
|
+
".Layout.Layout--flowRow-until-md .Layout-sidebar",
|
|
22
|
+
".Layout.Layout--flowRow-until-md .Layout-divider",
|
|
23
|
+
".Layout.Layout--flowRow-until-md .Layout-main",
|
|
24
|
+
".Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-start .Layout-sidebar",
|
|
25
|
+
".Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-start .Layout-main",
|
|
26
|
+
".Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-end .Layout-sidebar",
|
|
27
|
+
".Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-end .Layout-main",
|
|
28
|
+
".Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-none .Layout-sidebar",
|
|
29
|
+
".Layout.Layout--flowRow-until-md.Layout--divided",
|
|
30
|
+
".Layout.Layout--flowRow-until-md.Layout--divided .Layout-divider",
|
|
31
|
+
".Layout-divider--flowRow-hidden:is(.Layout.Layout--flowRow-until-md.Layout--divided .Layout-divider)",
|
|
32
|
+
".Layout-divider--flowRow-shallow:is(.Layout.Layout--flowRow-until-md.Layout--divided .Layout-divider)",
|
|
33
|
+
".Layout.Layout--flowRow-until-md.Layout--divided .Layout-main",
|
|
34
|
+
".Layout.Layout--flowRow-until-md.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-sidebar",
|
|
35
|
+
".Layout.Layout--flowRow-until-md.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-main",
|
|
36
|
+
".Layout.Layout--flowRow-until-lg",
|
|
37
|
+
".Layout.Layout--flowRow-until-lg .Layout-sidebar",
|
|
38
|
+
".Layout.Layout--flowRow-until-lg .Layout-divider",
|
|
39
|
+
".Layout.Layout--flowRow-until-lg .Layout-main",
|
|
40
|
+
".Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-start .Layout-sidebar",
|
|
41
|
+
".Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-start .Layout-main",
|
|
42
|
+
".Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-end .Layout-sidebar",
|
|
43
|
+
".Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-end .Layout-main",
|
|
44
|
+
".Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-none .Layout-sidebar",
|
|
45
|
+
".Layout.Layout--flowRow-until-lg.Layout--divided",
|
|
46
|
+
".Layout.Layout--flowRow-until-lg.Layout--divided .Layout-divider",
|
|
47
|
+
".Layout-divider--flowRow-hidden:is(.Layout.Layout--flowRow-until-lg.Layout--divided .Layout-divider)",
|
|
48
|
+
".Layout-divider--flowRow-shallow:is(.Layout.Layout--flowRow-until-lg.Layout--divided .Layout-divider)",
|
|
49
|
+
".Layout.Layout--flowRow-until-lg.Layout--divided .Layout-main",
|
|
50
|
+
".Layout.Layout--flowRow-until-lg.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-sidebar",
|
|
51
|
+
".Layout.Layout--flowRow-until-lg.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-main",
|
|
52
|
+
".Layout.Layout--gutter-none",
|
|
53
|
+
".Layout.Layout--gutter-condensed",
|
|
54
|
+
".Layout.Layout--gutter-spacious",
|
|
55
|
+
".Layout.Layout--sidebar-narrow",
|
|
56
|
+
".Layout.Layout--sidebar-wide",
|
|
57
|
+
".Layout.Layout--sidebarPosition-start .Layout-sidebar",
|
|
58
|
+
".Layout.Layout--sidebarPosition-start .Layout-main",
|
|
59
|
+
".Layout.Layout--sidebarPosition-end",
|
|
60
|
+
".Layout.Layout--sidebarPosition-end .Layout-main",
|
|
61
|
+
".Layout.Layout--sidebarPosition-end .Layout-sidebar",
|
|
62
|
+
".Layout.Layout--divided.Layout--sidebarPosition-end .Layout-sidebar",
|
|
63
|
+
".Layout.Layout--divided.Layout--sidebarPosition-end .Layout-main",
|
|
64
|
+
".Layout-divider",
|
|
65
|
+
".Layout-sidebar",
|
|
66
|
+
".Layout-main",
|
|
67
|
+
".Layout-main .Layout-main-centered-md",
|
|
68
|
+
".Layout-main .Layout-main-centered-lg",
|
|
69
|
+
".Layout-main .Layout-main-centered-xl",
|
|
70
|
+
":is(.Layout-main .Layout-main-centered-md,.Layout-main .Layout-main-centered-lg,.Layout-main .Layout-main-centered-xl) > .container-md",
|
|
71
|
+
":is(.Layout-main .Layout-main-centered-md,.Layout-main .Layout-main-centered-lg,.Layout-main .Layout-main-centered-xl) > .container-lg",
|
|
72
|
+
":is(.Layout-main .Layout-main-centered-md,.Layout-main .Layout-main-centered-lg,.Layout-main .Layout-main-centered-xl) > .container-xl"
|
|
73
|
+
]
|
|
74
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/* menu */
|
|
2
|
+
|
|
3
|
+
/* A menu on the side of a page, defaults to left side. e.g. github.com/about */
|
|
4
|
+
|
|
5
|
+
.menu {
|
|
6
|
+
/* stylelint-disable-next-line primer/spacing */
|
|
7
|
+
margin-bottom: var(--stack-gap-normal);
|
|
8
|
+
list-style: none;
|
|
9
|
+
background-color: var(--bgColor-default);
|
|
10
|
+
border: var(--borderWidth-thin) solid var(--borderColor-default);
|
|
11
|
+
border-radius: var(--borderRadius-medium);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.menu-item {
|
|
15
|
+
position: relative;
|
|
16
|
+
display: block;
|
|
17
|
+
/* stylelint-disable-next-line primer/spacing */
|
|
18
|
+
padding: var(--control-medium-paddingInline-condensed) var(--control-medium-paddingInline-spacious);
|
|
19
|
+
color: var(--fgColor-default);
|
|
20
|
+
border-bottom: var(--borderWidth-thin) solid var(--borderColor-default);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.menu-item:first-child {
|
|
24
|
+
border-top: 0;
|
|
25
|
+
border-top-left-radius: var(--borderRadius-medium);
|
|
26
|
+
border-top-right-radius: var(--borderRadius-medium);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.menu-item:first-child::before {
|
|
30
|
+
border-top-left-radius: var(--borderRadius-medium);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.menu-item:last-child {
|
|
34
|
+
border-bottom: 0;
|
|
35
|
+
border-bottom-right-radius: var(--borderRadius-medium);
|
|
36
|
+
border-bottom-left-radius: var(--borderRadius-medium);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.menu-item:last-child::before {
|
|
40
|
+
border-bottom-left-radius: var(--borderRadius-medium);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.menu-item:hover {
|
|
44
|
+
-webkit-text-decoration: none;
|
|
45
|
+
text-decoration: none;
|
|
46
|
+
background-color: var(--bgColor-neutral-muted);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.menu-item:active {
|
|
50
|
+
background-color: var(--bgColor-muted);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.menu-item.selected,.menu-item[aria-selected='true'],.menu-item[aria-current]:not([aria-current='false']) {
|
|
54
|
+
cursor: default;
|
|
55
|
+
background-color: var(--menu-bgColor-active);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:is(.menu-item.selected,.menu-item[aria-selected='true'],.menu-item[aria-current]:not([aria-current='false']))::before {
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: 0;
|
|
61
|
+
bottom: 0;
|
|
62
|
+
left: 0;
|
|
63
|
+
width: 2px;
|
|
64
|
+
content: '';
|
|
65
|
+
/* stylelint-disable-next-line primer/colors */
|
|
66
|
+
background-color: var(--underlineNav-borderColor-active);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.menu-item .octicon {
|
|
70
|
+
width: 16px;
|
|
71
|
+
/* stylelint-disable-next-line primer/spacing */
|
|
72
|
+
margin-right: var(--control-medium-gap);
|
|
73
|
+
color: var(--fgColor-muted);
|
|
74
|
+
text-align: center;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.menu-item .Counter {
|
|
78
|
+
float: right;
|
|
79
|
+
/* stylelint-disable-next-line primer/spacing */
|
|
80
|
+
margin-left: var(--control-small-gap);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.menu-item .menu-warning {
|
|
84
|
+
float: right;
|
|
85
|
+
color: var(--fgColor-attention);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.menu-item .avatar {
|
|
89
|
+
float: left;
|
|
90
|
+
/* stylelint-disable-next-line primer/spacing */
|
|
91
|
+
margin-right: var(--control-small-gap);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.menu-item.alert .Counter {
|
|
95
|
+
color: var(--fgColor-danger);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.menu-heading {
|
|
99
|
+
display: block;
|
|
100
|
+
/* stylelint-disable-next-line primer/spacing */
|
|
101
|
+
padding: var(--control-medium-paddingInline-condensed) var(--control-medium-paddingInline-spacious);
|
|
102
|
+
margin-top: 0;
|
|
103
|
+
margin-bottom: 0;
|
|
104
|
+
font-size: inherit;
|
|
105
|
+
font-weight: var(--base-text-weight-semibold);
|
|
106
|
+
color: var(--fgColor-default);
|
|
107
|
+
border-bottom: var(--borderWidth-thin) solid var(--borderColor-default);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.menu-heading:hover {
|
|
111
|
+
-webkit-text-decoration: none;
|
|
112
|
+
text-decoration: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.menu-heading:first-child {
|
|
116
|
+
border-top-left-radius: var(--borderRadius-medium);
|
|
117
|
+
border-top-right-radius: var(--borderRadius-medium);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.menu-heading:last-child {
|
|
121
|
+
border-bottom: 0;
|
|
122
|
+
border-bottom-right-radius: var(--borderRadius-medium);
|
|
123
|
+
border-bottom-left-radius: var(--borderRadius-medium);
|
|
124
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "alpha/menu",
|
|
3
|
+
"selectors": [
|
|
4
|
+
".menu",
|
|
5
|
+
".menu-item",
|
|
6
|
+
".menu-item:first-child",
|
|
7
|
+
".menu-item:first-child::before",
|
|
8
|
+
".menu-item:last-child",
|
|
9
|
+
".menu-item:last-child::before",
|
|
10
|
+
".menu-item:hover",
|
|
11
|
+
".menu-item:active",
|
|
12
|
+
".menu-item.selected",
|
|
13
|
+
".menu-item[aria-selected='true']",
|
|
14
|
+
".menu-item[aria-current]:not([aria-current='false'])",
|
|
15
|
+
":is(.menu-item.selected,.menu-item[aria-selected='true'],.menu-item[aria-current]:not([aria-current='false']))::before",
|
|
16
|
+
".menu-item .octicon",
|
|
17
|
+
".menu-item .Counter",
|
|
18
|
+
".menu-item .menu-warning",
|
|
19
|
+
".menu-item .avatar",
|
|
20
|
+
".menu-item.alert .Counter",
|
|
21
|
+
".menu-heading",
|
|
22
|
+
".menu-heading:hover",
|
|
23
|
+
".menu-heading:first-child",
|
|
24
|
+
".menu-heading:last-child"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class ModalDialogElement extends HTMLElement {
|
|
2
|
+
#private;
|
|
3
|
+
openButton: HTMLButtonElement | null;
|
|
4
|
+
get open(): boolean;
|
|
5
|
+
set open(value: boolean);
|
|
6
|
+
get showButtons(): NodeList;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
show(): void;
|
|
9
|
+
close(closedNotCancelled?: boolean): void;
|
|
10
|
+
}
|
|
11
|
+
declare global {
|
|
12
|
+
interface Window {
|
|
13
|
+
ModalDialogElement: typeof ModalDialogElement;
|
|
14
|
+
}
|
|
15
|
+
interface HTMLElementTagNameMap {
|
|
16
|
+
'modal-dialog': ModalDialogElement;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
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 _ModalDialogElement_instances, _ModalDialogElement_focusAbortController, _ModalDialogElement_overlayBackdrop_get, _ModalDialogElement_keydown;
|
|
13
|
+
import { focusTrap } from '@primer/behaviors';
|
|
14
|
+
import { getFocusableChild } from '@primer/behaviors/utils';
|
|
15
|
+
function focusIfNeeded(elem) {
|
|
16
|
+
if (document.activeElement !== elem) {
|
|
17
|
+
elem?.focus();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const overlayStack = [];
|
|
21
|
+
function clickHandler(event) {
|
|
22
|
+
const target = event.target;
|
|
23
|
+
const button = target?.closest('button');
|
|
24
|
+
if (!button || button.hasAttribute('disabled') || button.getAttribute('aria-disabled') === 'true')
|
|
25
|
+
return;
|
|
26
|
+
// If the user is clicking a valid dialog trigger
|
|
27
|
+
let dialogId = button?.getAttribute('data-show-dialog-id');
|
|
28
|
+
if (dialogId) {
|
|
29
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
30
|
+
event.stopPropagation();
|
|
31
|
+
const dialog = document.getElementById(dialogId);
|
|
32
|
+
if (dialog instanceof ModalDialogElement) {
|
|
33
|
+
dialog.openButton = button;
|
|
34
|
+
dialog.show();
|
|
35
|
+
// A buttons default behaviour in some browsers it to send a pointer event
|
|
36
|
+
// If the behaviour is allowed through the dialog will be shown but then
|
|
37
|
+
// quickly hidden- as if it were never shown. This prevents that.
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (!overlayStack.length)
|
|
43
|
+
return;
|
|
44
|
+
dialogId = button.getAttribute('data-close-dialog-id') || button.getAttribute('data-submit-dialog-id');
|
|
45
|
+
if (dialogId) {
|
|
46
|
+
const dialog = document.getElementById(dialogId);
|
|
47
|
+
if (dialog instanceof ModalDialogElement) {
|
|
48
|
+
const dialogIndex = overlayStack.findIndex(ele => ele.id === dialogId);
|
|
49
|
+
overlayStack.splice(dialogIndex, 1);
|
|
50
|
+
dialog.close(button.hasAttribute('data-submit-dialog-id'));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function keydownHandler(event) {
|
|
55
|
+
if (!(event instanceof KeyboardEvent) ||
|
|
56
|
+
event.type !== 'keydown' ||
|
|
57
|
+
event.key !== 'Enter' ||
|
|
58
|
+
event.ctrlKey ||
|
|
59
|
+
event.altKey ||
|
|
60
|
+
event.metaKey ||
|
|
61
|
+
event.shiftKey)
|
|
62
|
+
return;
|
|
63
|
+
clickHandler(event);
|
|
64
|
+
}
|
|
65
|
+
function mousedownHandler(event) {
|
|
66
|
+
const target = event.target;
|
|
67
|
+
if (target?.closest('button'))
|
|
68
|
+
return;
|
|
69
|
+
// Find the top level dialog that is open.
|
|
70
|
+
const topLevelDialog = overlayStack[overlayStack.length - 1];
|
|
71
|
+
if (!topLevelDialog)
|
|
72
|
+
return;
|
|
73
|
+
// Check if the mousedown happened outside the boundary of the top level dialog
|
|
74
|
+
const mouseDownOutsideDialog = !target.closest(`#${topLevelDialog.getAttribute('id')}`);
|
|
75
|
+
// Only close dialog if it's a click outside the dialog and the dialog has a button?
|
|
76
|
+
if (mouseDownOutsideDialog) {
|
|
77
|
+
target.ownerDocument.addEventListener('mouseup', (upEvent) => {
|
|
78
|
+
if (upEvent.target === target) {
|
|
79
|
+
overlayStack.pop();
|
|
80
|
+
topLevelDialog.close();
|
|
81
|
+
}
|
|
82
|
+
}, { once: true });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export class ModalDialogElement extends HTMLElement {
|
|
86
|
+
constructor() {
|
|
87
|
+
super(...arguments);
|
|
88
|
+
_ModalDialogElement_instances.add(this);
|
|
89
|
+
//TODO: Do we remove the abortController from focusTrap?
|
|
90
|
+
_ModalDialogElement_focusAbortController.set(this, new AbortController());
|
|
91
|
+
}
|
|
92
|
+
get open() {
|
|
93
|
+
return this.hasAttribute('open');
|
|
94
|
+
}
|
|
95
|
+
set open(value) {
|
|
96
|
+
if (value) {
|
|
97
|
+
if (this.open)
|
|
98
|
+
return;
|
|
99
|
+
this.setAttribute('open', '');
|
|
100
|
+
this.setAttribute('aria-disabled', 'false');
|
|
101
|
+
document.body.style.paddingRight = `${window.innerWidth - document.body.clientWidth}px`;
|
|
102
|
+
document.body.style.overflow = 'hidden';
|
|
103
|
+
__classPrivateFieldGet(this, _ModalDialogElement_instances, "a", _ModalDialogElement_overlayBackdrop_get)?.classList.remove('Overlay--hidden');
|
|
104
|
+
if (__classPrivateFieldGet(this, _ModalDialogElement_focusAbortController, "f").signal.aborted) {
|
|
105
|
+
__classPrivateFieldSet(this, _ModalDialogElement_focusAbortController, new AbortController(), "f");
|
|
106
|
+
}
|
|
107
|
+
focusTrap(this, this.querySelector('[autofocus]'), __classPrivateFieldGet(this, _ModalDialogElement_focusAbortController, "f").signal);
|
|
108
|
+
overlayStack.push(this);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
if (!this.open)
|
|
112
|
+
return;
|
|
113
|
+
this.removeAttribute('open');
|
|
114
|
+
this.setAttribute('aria-disabled', 'true');
|
|
115
|
+
__classPrivateFieldGet(this, _ModalDialogElement_instances, "a", _ModalDialogElement_overlayBackdrop_get)?.classList.add('Overlay--hidden');
|
|
116
|
+
document.body.style.paddingRight = '0';
|
|
117
|
+
document.body.style.overflow = 'initial';
|
|
118
|
+
__classPrivateFieldGet(this, _ModalDialogElement_focusAbortController, "f").abort();
|
|
119
|
+
// if #openButton is a child of a menu, we need to focus a suitable child of the menu
|
|
120
|
+
// element since it is expected for the menu to close on click
|
|
121
|
+
const menu = this.openButton?.closest('details') || this.openButton?.closest('action-menu');
|
|
122
|
+
if (menu) {
|
|
123
|
+
focusIfNeeded(getFocusableChild(menu));
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
focusIfNeeded(this.openButton);
|
|
127
|
+
}
|
|
128
|
+
this.openButton = null;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
get showButtons() {
|
|
132
|
+
// Dialogs may also be opened from any arbitrary button with a matching show-dialog-id data attribute
|
|
133
|
+
return document.querySelectorAll(`button[data-show-dialog-id='${this.id}']`);
|
|
134
|
+
}
|
|
135
|
+
connectedCallback() {
|
|
136
|
+
if (!this.hasAttribute('role'))
|
|
137
|
+
this.setAttribute('role', 'dialog');
|
|
138
|
+
document.addEventListener('click', clickHandler);
|
|
139
|
+
document.addEventListener('keydown', keydownHandler);
|
|
140
|
+
document.addEventListener('mousedown', mousedownHandler);
|
|
141
|
+
this.addEventListener('keydown', e => __classPrivateFieldGet(this, _ModalDialogElement_instances, "m", _ModalDialogElement_keydown).call(this, e));
|
|
142
|
+
}
|
|
143
|
+
show() {
|
|
144
|
+
this.open = true;
|
|
145
|
+
}
|
|
146
|
+
close(closedNotCancelled = false) {
|
|
147
|
+
if (this.open === false)
|
|
148
|
+
return;
|
|
149
|
+
const eventType = closedNotCancelled ? 'close' : 'cancel';
|
|
150
|
+
const dialogEvent = new Event(eventType);
|
|
151
|
+
this.dispatchEvent(dialogEvent);
|
|
152
|
+
this.open = false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
_ModalDialogElement_focusAbortController = new WeakMap(), _ModalDialogElement_instances = new WeakSet(), _ModalDialogElement_overlayBackdrop_get = function _ModalDialogElement_overlayBackdrop_get() {
|
|
156
|
+
if (this.parentElement?.hasAttribute('data-modal-dialog-overlay')) {
|
|
157
|
+
return this.parentElement;
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
}, _ModalDialogElement_keydown = function _ModalDialogElement_keydown(event) {
|
|
161
|
+
if (!(event instanceof KeyboardEvent))
|
|
162
|
+
return;
|
|
163
|
+
if (event.isComposing)
|
|
164
|
+
return;
|
|
165
|
+
if (!this.open)
|
|
166
|
+
return;
|
|
167
|
+
switch (event.key) {
|
|
168
|
+
case 'Escape':
|
|
169
|
+
this.close();
|
|
170
|
+
event.preventDefault();
|
|
171
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
172
|
+
event.stopPropagation();
|
|
173
|
+
break;
|
|
174
|
+
case 'Enter': {
|
|
175
|
+
const target = event.target;
|
|
176
|
+
if (target.getAttribute('data-close-dialog-id') === this.id) {
|
|
177
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
178
|
+
event.stopPropagation();
|
|
179
|
+
}
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
if (!window.customElements.get('modal-dialog')) {
|
|
185
|
+
window.ModalDialogElement = ModalDialogElement;
|
|
186
|
+
window.customElements.define('modal-dialog', ModalDialogElement);
|
|
187
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* stylelint-disable selector-max-type, selector-no-qualifying-type */
|
|
2
|
+
anchored-position[popover] {
|
|
3
|
+
position: absolute;
|
|
4
|
+
min-width: 192px;
|
|
5
|
+
padding: 0;
|
|
6
|
+
overflow: visible;
|
|
7
|
+
border-width: 0;
|
|
8
|
+
}
|
|
9
|
+
anchored-position:not(.Overlay) {
|
|
10
|
+
background: none;
|
|
11
|
+
}
|
|
12
|
+
.Overlay[popover]:not(:popover-open) {
|
|
13
|
+
display: none
|
|
14
|
+
}
|
|
15
|
+
anchored-position.not-anchored::backdrop, dialog::backdrop {
|
|
16
|
+
background-color: var(--overlay-backdrop-bgColor, var(--color-neutral-muted));
|
|
17
|
+
}
|
|
18
|
+
select-panel dialog::backdrop {
|
|
19
|
+
background: none;
|
|
20
|
+
}
|
|
21
|
+
@media (forced-colors: active) {
|
|
22
|
+
.Overlay {
|
|
23
|
+
outline: solid 1px transparent;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "alpha/overlay",
|
|
3
|
+
"selectors": [
|
|
4
|
+
"anchored-position[popover]",
|
|
5
|
+
"anchored-position:not(.Overlay)",
|
|
6
|
+
".Overlay[popover]:not(:popover-open)",
|
|
7
|
+
"anchored-position.not-anchored::backdrop",
|
|
8
|
+
"dialog::backdrop",
|
|
9
|
+
"select-panel dialog::backdrop",
|
|
10
|
+
".Overlay"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/* SegmentedControl */
|
|
2
|
+
|
|
3
|
+
.SegmentedControl {
|
|
4
|
+
--segmentedControl-item-padding: var(--control-small-paddingBlock);
|
|
5
|
+
--overlay-offset: 0.5rem;
|
|
6
|
+
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
list-style: none;
|
|
9
|
+
background-color: var(--controlTrack-bgColor-rest, var(--color-segmented-control-bg));
|
|
10
|
+
border-color: var(--controlTrack-borderColor-rest, transparent);
|
|
11
|
+
border-radius: var(--borderRadius-medium);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.SegmentedControl--iconOnly .Button--iconOnly.Button--small,.SegmentedControl--iconOnly .Button--iconOnly.Button--medium {
|
|
15
|
+
width: 100%;
|
|
16
|
+
padding-inline: 0 !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* sizes */
|
|
20
|
+
|
|
21
|
+
.SegmentedControl--small {
|
|
22
|
+
--segmentedControl-item-padding: var(--control-xsmall-paddingBlock);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.SegmentedControl--small .SegmentedControl-item {
|
|
26
|
+
height: var(--control-small-size);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:is(.SegmentedControl--small .SegmentedControl-item) .Button {
|
|
30
|
+
/* stylelint-disable-next-line primer/spacing */
|
|
31
|
+
padding-inline: calc(var(--control-xsmall-paddingInline-normal) - var(--segmentedControl-item-padding));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.SegmentedControl--small.SegmentedControl--iconOnly .SegmentedControl-item {
|
|
35
|
+
width: var(--control-small-size);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.SegmentedControl--medium .SegmentedControl-item {
|
|
39
|
+
height: var(--control-medium-size);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.SegmentedControl--medium.SegmentedControl--iconOnly .SegmentedControl-item {
|
|
43
|
+
width: var(--control-medium-size);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* item */
|
|
47
|
+
|
|
48
|
+
.SegmentedControl-item {
|
|
49
|
+
position: relative;
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
height: var(--control-medium-size);
|
|
52
|
+
/* stylelint-disable-next-line primer/spacing */
|
|
53
|
+
padding: var(--segmentedControl-item-padding);
|
|
54
|
+
border: var(--borderWidth-thin) solid transparent;
|
|
55
|
+
border-radius: var(--borderRadius-medium);
|
|
56
|
+
justify-content: center;
|
|
57
|
+
|
|
58
|
+
/* button color overrides */
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:is(.SegmentedControl-item .Button--invisible):hover:not(:disabled) {
|
|
62
|
+
background-color: var(--controlTrack-bgColor-hover, var(--color-action-list-item-default-hover-bg));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:is(.SegmentedControl-item .Button--invisible):active:not(:disabled) {
|
|
66
|
+
background-color: var(--controlTrack-bgColor-active, var(--color-action-list-item-default-active-bg));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Selected ---------------------------------------- */
|
|
70
|
+
|
|
71
|
+
.SegmentedControl-item.SegmentedControl-item--selected {
|
|
72
|
+
background-color: var(--controlKnob-bgColor-rest, var(--color-segmented-control-button-bg));
|
|
73
|
+
border-color: var(--controlKnob-borderColor-rest, var(--color-segmented-control-button-selected-border));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.SegmentedControl-item.SegmentedControl-item--selected .Button {
|
|
77
|
+
font-weight: var(--base-text-weight-semibold);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:is(.SegmentedControl-item.SegmentedControl-item--selected .Button):hover {
|
|
81
|
+
background-color: transparent;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.SegmentedControl-item.SegmentedControl-item--selected::before {
|
|
85
|
+
border-color: transparent !important;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.SegmentedControl-item.SegmentedControl-item--selected + .SegmentedControl-item::before {
|
|
89
|
+
border-color: transparent;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* renders a visibly hidden "copy" of the text in bold, reserving box space for when text becomes bold on selected */
|
|
93
|
+
|
|
94
|
+
.SegmentedControl-item .Button-label[data-content]::before {
|
|
95
|
+
display: block;
|
|
96
|
+
height: 0;
|
|
97
|
+
font-weight: var(--base-text-weight-semibold);
|
|
98
|
+
visibility: hidden;
|
|
99
|
+
content: attr(data-content);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Separator lines */
|
|
103
|
+
|
|
104
|
+
.SegmentedControl-item:not(:first-child)::before {
|
|
105
|
+
position: absolute;
|
|
106
|
+
inset: 0 0 0 -1px;
|
|
107
|
+
/* stylelint-disable-next-line primer/spacing */
|
|
108
|
+
margin-top: var(--control-medium-paddingBlock);
|
|
109
|
+
/* stylelint-disable-next-line primer/spacing */
|
|
110
|
+
margin-bottom: var(--control-medium-paddingBlock);
|
|
111
|
+
content: '';
|
|
112
|
+
border-left: var(--borderWidth-thin) solid var(--borderColor-default);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Button ----------------------------------------- */
|
|
116
|
+
|
|
117
|
+
.SegmentedControl-item .Button {
|
|
118
|
+
width: 100%;
|
|
119
|
+
min-width: fit-content;
|
|
120
|
+
height: 100%;
|
|
121
|
+
font-weight: var(--base-text-weight-normal);
|
|
122
|
+
border: 0;
|
|
123
|
+
/* stylelint-disable-next-line primer/borders */
|
|
124
|
+
border-radius: calc(var(--borderRadius-medium) - var(--segmentedControl-item-padding) / 2);
|
|
125
|
+
/* stylelint-disable-next-line primer/spacing */
|
|
126
|
+
padding-inline: calc(var(--control-medium-paddingInline-normal) - var(--segmentedControl-item-padding));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
:is(.SegmentedControl-item .Button):focus-visible {
|
|
130
|
+
/* stylelint-disable-next-line primer/borders */
|
|
131
|
+
border-radius: calc(var(--borderRadius-medium) - var(--segmentedControl-item-padding) / 1);
|
|
132
|
+
outline-offset: calc(var(--segmentedControl-item-padding) - var(--borderWidth-thin));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.SegmentedControl-item .Button--invisible.Button--invisible-noVisuals .Button-label {
|
|
136
|
+
color: var(--button-default-fgColor-rest);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.SegmentedControl-item .Button-content {
|
|
140
|
+
flex: 1 1 auto;
|
|
141
|
+
align-self: stretch;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* use ellipsis with the assumption that icon only variant will be used when not enough space is available */
|
|
145
|
+
|
|
146
|
+
.SegmentedControl-item .Button-label {
|
|
147
|
+
overflow: hidden;
|
|
148
|
+
text-overflow: ellipsis;
|
|
149
|
+
white-space: nowrap;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* fullWidth */
|
|
153
|
+
|
|
154
|
+
.SegmentedControl--fullWidth {
|
|
155
|
+
display: flex;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.SegmentedControl--fullWidth .SegmentedControl-item {
|
|
159
|
+
flex: 1;
|
|
160
|
+
justify-content: center;
|
|
161
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "alpha/segmented_control",
|
|
3
|
+
"selectors": [
|
|
4
|
+
".SegmentedControl",
|
|
5
|
+
".SegmentedControl--iconOnly .Button--iconOnly.Button--small",
|
|
6
|
+
".SegmentedControl--iconOnly .Button--iconOnly.Button--medium",
|
|
7
|
+
".SegmentedControl--small",
|
|
8
|
+
".SegmentedControl--small .SegmentedControl-item",
|
|
9
|
+
":is(.SegmentedControl--small .SegmentedControl-item) .Button",
|
|
10
|
+
".SegmentedControl--small.SegmentedControl--iconOnly .SegmentedControl-item",
|
|
11
|
+
".SegmentedControl--medium .SegmentedControl-item",
|
|
12
|
+
".SegmentedControl--medium.SegmentedControl--iconOnly .SegmentedControl-item",
|
|
13
|
+
".SegmentedControl-item",
|
|
14
|
+
":is(.SegmentedControl-item .Button--invisible):hover:not(:disabled)",
|
|
15
|
+
":is(.SegmentedControl-item .Button--invisible):active:not(:disabled)",
|
|
16
|
+
".SegmentedControl-item.SegmentedControl-item--selected",
|
|
17
|
+
".SegmentedControl-item.SegmentedControl-item--selected .Button",
|
|
18
|
+
":is(.SegmentedControl-item.SegmentedControl-item--selected .Button):hover",
|
|
19
|
+
".SegmentedControl-item.SegmentedControl-item--selected::before",
|
|
20
|
+
".SegmentedControl-item.SegmentedControl-item--selected + .SegmentedControl-item::before",
|
|
21
|
+
".SegmentedControl-item .Button-label[data-content]::before",
|
|
22
|
+
".SegmentedControl-item:not(:first-child)::before",
|
|
23
|
+
".SegmentedControl-item .Button",
|
|
24
|
+
":is(.SegmentedControl-item .Button):focus-visible",
|
|
25
|
+
".SegmentedControl-item .Button--invisible.Button--invisible-noVisuals .Button-label",
|
|
26
|
+
".SegmentedControl-item .Button-content",
|
|
27
|
+
".SegmentedControl-item .Button-label",
|
|
28
|
+
".SegmentedControl--fullWidth",
|
|
29
|
+
".SegmentedControl--fullWidth .SegmentedControl-item"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class SegmentedControlElement extends HTMLElement {
|
|
2
|
+
#private;
|
|
3
|
+
items: HTMLElement[];
|
|
4
|
+
connectedCallback(): void;
|
|
5
|
+
select(event: Event): void;
|
|
6
|
+
get current(): HTMLElement | null;
|
|
7
|
+
}
|
|
8
|
+
declare global {
|
|
9
|
+
interface Window {
|
|
10
|
+
SegmentedControlElement: typeof SegmentedControlElement;
|
|
11
|
+
}
|
|
12
|
+
}
|