openproject-primer_view_components 0.95.0 → 0.97.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -0
- data/app/assets/javascripts/primer_view_components.js +11 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/assets/styles/primer_view_components.css +1 -1
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/alpha/action_bar.css +1 -1
- data/app/components/primer/alpha/action_bar.css.map +1 -1
- data/app/components/primer/alpha/action_list/item.rb +7 -2
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.json +16 -27
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/action_list.html.erb +1 -5
- data/app/components/primer/alpha/action_list.pcss +55 -81
- data/app/components/primer/alpha/action_list.rb +9 -7
- data/app/components/primer/alpha/action_menu/action_menu_element.d.ts +6 -0
- data/app/components/primer/alpha/action_menu/action_menu_element.js +239 -84
- data/app/components/primer/alpha/action_menu/action_menu_element.ts +261 -81
- data/app/components/primer/alpha/action_menu/action_menu_focus_zone_stack.d.ts +4 -1
- data/app/components/primer/alpha/action_menu/action_menu_focus_zone_stack.js +38 -14
- data/app/components/primer/alpha/action_menu/action_menu_focus_zone_stack.ts +42 -13
- data/app/components/primer/alpha/action_menu/menu.html.erb +27 -19
- data/app/components/primer/alpha/action_menu/menu.rb +7 -0
- data/app/components/primer/alpha/action_menu/menu_loader.d.ts +21 -0
- data/app/components/primer/alpha/action_menu/menu_loader.js +221 -0
- data/app/components/primer/alpha/action_menu/menu_loader.ts +269 -0
- data/app/components/primer/alpha/action_menu/primary_menu.rb +15 -0
- data/app/components/primer/alpha/action_menu.rb +55 -0
- data/app/components/primer/alpha/auto_complete.css +1 -1
- data/app/components/primer/alpha/auto_complete.css.map +1 -1
- data/app/components/primer/alpha/banner.css +1 -1
- data/app/components/primer/alpha/banner.css.map +1 -1
- data/app/components/primer/alpha/button_marketing.css +1 -1
- data/app/components/primer/alpha/button_marketing.css.map +1 -1
- data/app/components/primer/alpha/dialog.css +1 -1
- data/app/components/primer/alpha/dialog.css.map +1 -1
- data/app/components/primer/alpha/dropdown/menu.rb +1 -1
- data/app/components/primer/alpha/dropdown.css +1 -1
- data/app/components/primer/alpha/dropdown.css.json +1 -1
- data/app/components/primer/alpha/dropdown.css.map +1 -1
- data/app/components/primer/alpha/layout.css +1 -1
- data/app/components/primer/alpha/layout.css.json +3 -3
- data/app/components/primer/alpha/layout.css.map +1 -1
- data/app/components/primer/alpha/menu.css +1 -1
- data/app/components/primer/alpha/menu.css.json +3 -3
- data/app/components/primer/alpha/menu.css.map +1 -1
- data/app/components/primer/alpha/overlay.css +1 -1
- data/app/components/primer/alpha/overlay.css.map +1 -1
- data/app/components/primer/alpha/segmented_control.css +1 -1
- data/app/components/primer/alpha/segmented_control.css.json +1 -1
- data/app/components/primer/alpha/segmented_control.css.map +1 -1
- data/app/components/primer/alpha/select_panel.css +1 -1
- data/app/components/primer/alpha/select_panel.css.map +1 -1
- data/app/components/primer/alpha/skeleton_box.css +1 -1
- data/app/components/primer/alpha/skeleton_box.css.map +1 -1
- data/app/components/primer/alpha/stack.css +1 -1
- data/app/components/primer/alpha/stack.css.map +1 -1
- data/app/components/primer/alpha/stack_item.css +1 -1
- data/app/components/primer/alpha/stack_item.css.map +1 -1
- data/app/components/primer/alpha/tab_nav.css +1 -1
- data/app/components/primer/alpha/tab_nav.css.map +1 -1
- data/app/components/primer/alpha/text_field.css +1 -1
- data/app/components/primer/alpha/text_field.css.map +1 -1
- data/app/components/primer/alpha/toggle_switch.css +1 -1
- data/app/components/primer/alpha/toggle_switch.css.map +1 -1
- data/app/components/primer/alpha/tree_view.css +1 -1
- data/app/components/primer/alpha/tree_view.css.json +3 -3
- data/app/components/primer/alpha/tree_view.css.map +1 -1
- data/app/components/primer/alpha/underline_nav.css +1 -1
- data/app/components/primer/alpha/underline_nav.css.map +1 -1
- data/app/components/primer/beta/border_box.css +1 -1
- data/app/components/primer/beta/border_box.css.json +5 -5
- data/app/components/primer/beta/border_box.css.map +1 -1
- data/app/components/primer/beta/button.css +1 -1
- data/app/components/primer/beta/button.css.map +1 -1
- data/app/components/primer/beta/button.pcss +97 -0
- data/app/components/primer/beta/button.rb +15 -3
- data/app/components/primer/beta/counter.css +1 -1
- data/app/components/primer/beta/counter.css.map +1 -1
- data/app/components/primer/beta/flash.css +1 -1
- data/app/components/primer/beta/flash.css.map +1 -1
- data/app/components/primer/beta/link.css +1 -1
- data/app/components/primer/beta/link.css.json +1 -1
- data/app/components/primer/beta/link.css.map +1 -1
- data/app/components/primer/beta/popover.css +1 -1
- data/app/components/primer/beta/popover.css.map +1 -1
- data/app/components/primer/beta/progress_bar.css +1 -1
- data/app/components/primer/beta/progress_bar.css.map +1 -1
- data/app/components/primer/beta/relative_time.rb +7 -1
- data/app/components/primer/beta/state.css +1 -1
- data/app/components/primer/beta/state.css.json +2 -2
- data/app/components/primer/beta/state.css.map +1 -1
- data/app/components/primer/beta/timeline_item.css +1 -1
- data/app/components/primer/beta/timeline_item.css.map +1 -1
- data/app/components/primer/open_project/border_grid.css +1 -1
- data/app/components/primer/open_project/border_grid.css.map +1 -1
- data/app/components/primer/open_project/color_field.css +1 -1
- data/app/components/primer/open_project/color_field.css.map +1 -1
- data/app/components/primer/open_project/inline_message.css +1 -1
- data/app/components/primer/open_project/inline_message.css.map +1 -1
- data/app/components/primer/open_project/input_group.css +1 -1
- data/app/components/primer/open_project/input_group.css.map +1 -1
- data/app/components/primer/open_project/keybinding_hint/chords.d.ts +5 -0
- data/app/components/primer/open_project/keybinding_hint/chords.js +29 -0
- data/app/components/primer/open_project/keybinding_hint/chords.ts +38 -0
- data/app/components/primer/open_project/keybinding_hint/key_names.d.ts +16 -0
- data/app/components/primer/open_project/keybinding_hint/key_names.js +107 -0
- data/app/components/primer/open_project/keybinding_hint/key_names.ts +116 -0
- data/app/components/primer/open_project/keybinding_hint/localized_names.d.ts +22 -0
- data/app/components/primer/open_project/keybinding_hint/localized_names.js +47 -0
- data/app/components/primer/open_project/keybinding_hint/localized_names.ts +71 -0
- data/app/components/primer/open_project/keybinding_hint/names.rb +92 -0
- data/app/components/primer/open_project/keybinding_hint/names_from_scope.d.ts +21 -0
- data/app/components/primer/open_project/keybinding_hint/names_from_scope.js +81 -0
- data/app/components/primer/open_project/keybinding_hint/names_from_scope.ts +96 -0
- data/app/components/primer/open_project/keybinding_hint/platform.d.ts +10 -0
- data/app/components/primer/open_project/keybinding_hint/platform.js +24 -0
- data/app/components/primer/open_project/keybinding_hint/platform.ts +34 -0
- data/app/components/primer/open_project/keybinding_hint/platform_override.d.ts +2 -0
- data/app/components/primer/open_project/keybinding_hint/platform_override.js +4 -0
- data/app/components/primer/open_project/keybinding_hint/platform_override.ts +7 -0
- data/app/components/primer/open_project/keybinding_hint.css +1 -0
- data/app/components/primer/open_project/keybinding_hint.css.json +10 -0
- data/app/components/primer/open_project/keybinding_hint.css.map +1 -0
- data/app/components/primer/open_project/keybinding_hint.html.erb +4 -0
- data/app/components/primer/open_project/keybinding_hint.pcss +65 -0
- data/app/components/primer/open_project/keybinding_hint.rb +112 -0
- data/app/components/primer/open_project/keybinding_hint_element.d.ts +31 -0
- data/app/components/primer/open_project/keybinding_hint_element.js +183 -0
- data/app/components/primer/open_project/keybinding_hint_element.ts +152 -0
- data/app/components/primer/open_project/page_header.css +1 -1
- data/app/components/primer/open_project/page_header.css.json +2 -2
- data/app/components/primer/open_project/page_header.css.map +1 -1
- data/app/components/primer/open_project/pagination.css +1 -1
- data/app/components/primer/open_project/pagination.css.json +1 -1
- data/app/components/primer/open_project/pagination.css.map +1 -1
- data/app/components/primer/open_project/sub_header.css +1 -1
- data/app/components/primer/open_project/sub_header.css.map +1 -1
- data/app/components/primer/primer.d.ts +1 -0
- data/app/components/primer/primer.js +1 -0
- data/app/components/primer/primer.pcss +1 -0
- data/app/components/primer/primer.ts +1 -0
- data/app/components/primer/truncate.css +1 -1
- data/app/components/primer/truncate.css.json +3 -4
- data/app/components/primer/truncate.css.map +1 -1
- data/app/controllers/primer/view_components/action_menu_controller.rb +35 -0
- data/app/views/primer/view_components/action_menu/deferred.html.erb +25 -11
- data/app/views/primer/view_components/action_menu/deferred_form.html.erb +10 -0
- data/app/views/primer/view_components/action_menu/deferred_preload.html.erb +7 -1
- data/config/locales/en.yml +179 -0
- data/config/routes.rb +1 -0
- data/lib/primer/accessibility.rb +1 -2
- data/lib/primer/classify.rb +1 -2
- data/lib/primer/view_components/version.rb +1 -1
- data/previews/primer/alpha/action_list_preview.rb +46 -1
- data/previews/primer/alpha/action_menu_preview/deferred_refresh.html.erb +34 -0
- data/previews/primer/alpha/action_menu_preview/deferred_refresh_form.html.erb +9 -0
- data/previews/primer/alpha/action_menu_preview/sub_menus.html.erb +1 -1
- data/previews/primer/alpha/action_menu_preview.rb +19 -2
- data/previews/primer/open_project/keybinding_hint_preview/full_format.html.erb +3 -0
- data/previews/primer/open_project/keybinding_hint_preview/in_action_list.html.erb +12 -0
- data/previews/primer/open_project/keybinding_hint_preview/in_button.html.erb +24 -0
- data/previews/primer/open_project/keybinding_hint_preview/platforms.html.erb +8 -0
- data/previews/primer/open_project/keybinding_hint_preview/playground.html.erb +4 -0
- data/previews/primer/open_project/keybinding_hint_preview/prose.html.erb +3 -0
- data/previews/primer/open_project/keybinding_hint_preview/schemes.html.erb +6 -0
- data/previews/primer/open_project/keybinding_hint_preview/sequence.html.erb +1 -0
- data/previews/primer/open_project/keybinding_hint_preview/sizes.html.erb +4 -0
- data/previews/primer/open_project/keybinding_hint_preview.rb +71 -0
- data/static/arguments.json +55 -3
- data/static/audited_at.json +1 -0
- data/static/classes.json +15 -3
- data/static/classnames.cjs +5 -1
- data/static/classnames.js +5 -1
- data/static/constants.json +35 -0
- data/static/info_arch.json +255 -10
- data/static/previews.json +177 -0
- data/static/statuses.json +1 -0
- metadata +45 -5
- data/app/components/primer/alpha/text_field.css.json +0 -134
- data/app/components/primer/alpha/toggle_switch.css.json +0 -40
- data/app/components/primer/alpha/underline_nav.css.json +0 -26
- data/app/components/primer/beta/button.css.json +0 -86
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["sub_header.pcss"],"names":[],"mappings":"AAEA,WACI,YAAa,CACb,8DAA+D,CAC/D,mCAAoC,CACpC,oBAAqB,CACrB,iCACJ,CAEA,qBACI,eAAgB,CAChB,YAAa,CACb,kBAAmB,CACnB,eACJ,CAEA,sBACI,gBAAiB,CACjB,iBAAkB,CAClB,kBACJ,CAEA,sBACI,gBACJ,CAEA,oBACI,cAAe,CACf,YAAa,CACb,kBAAmB,CACnB,cAAe,CACf,2BAA4B,CAC5B,UASJ,CAJQ,gGACI,WACJ,CAIR,2BACI,YAAa,CACb,sBAAuB,CACvB,UAAW,CACX,OACJ,CAEA,2EACE,YACF,CAEA,
|
|
1
|
+
{"version":3,"sources":["sub_header.pcss"],"names":[],"mappings":"AAEA,WACI,YAAa,CACb,8DAA+D,CAC/D,mCAAoC,CACpC,oBAAqB,CACrB,iCACJ,CAEA,qBACI,eAAgB,CAChB,YAAa,CACb,kBAAmB,CACnB,eACJ,CAEA,sBACI,gBAAiB,CACjB,iBAAkB,CAClB,kBACJ,CAEA,sBACI,gBACJ,CAEA,oBACI,cAAe,CACf,YAAa,CACb,kBAAmB,CACnB,cAAe,CACf,2BAA4B,CAC5B,UASJ,CAJQ,gGACI,WACJ,CAIR,2BACI,YAAa,CACb,sBAAuB,CACvB,UAAW,CACX,OACJ,CAEA,2EACE,YACF,CAEA,2BACI,WACI,gEAAiE,CACjE,8BACJ,CAEA,2BACI,+DACJ,CAEA,qDACI,sBACJ,CAEA,0BACI,gEAAiE,CACjE,mCACJ,CAEA,gDACI,kBAAmB,CACnB,sBAAuB,CACvB,eACJ,CAEA,sBACI,eACJ,CAEA,8BACI,8BACJ,CACJ","file":"sub_header.css","sourcesContent":["/* CSS for SubHeader */\n\n.SubHeader {\n display: grid;\n grid-template-areas: \"left middle right\" \"bottom bottom bottom\";\n grid-template-columns: auto 1fr auto;\n align-items: baseline;\n margin-bottom: var(--base-size-16);\n}\n\n.SubHeader-rightPane {\n grid-area: right;\n display: flex;\n align-items: center;\n column-gap: 12px;\n}\n\n.SubHeader-middlePane {\n grid-area: middle;\n text-align: center;\n white-space: nowrap;\n}\n\n.SubHeader-bottomPane {\n grid-area: bottom;\n}\n\n.SubHeader-leftPane {\n grid-area: left;\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n row-gap: var(--base-size-16);\n width: 100%;\n\n /* Since the container is not full width (due to the grid around it)\n we want it to grow, and then be limited by the max-width of the \"FormControl-input-width--xy\" class */\n & [class*='FormControl-input-width--'] {\n &:not(.FormControl-input-width--auto) {\n width: 100vw;\n }\n }\n}\n\n.SubHeader-filterContainer {\n display: flex;\n flex-basis: max-content;\n width: 100%;\n gap: 8px;\n}\n\n.SubHeader-filterInput_hiddenClearButton + .FormControl-input-trailingAction {\n display: none;\n}\n\n@media (max-width: 767.98px) {\n .SubHeader {\n grid-template-areas: \"left right\" \"middle middle\" \"bottom bottom\";\n grid-template-columns: 1fr auto;\n }\n\n .SubHeader--expandedSearch {\n grid-template-areas: \"left left\" \"middle middle\" \"bottom bottom\";\n }\n\n .SubHeader--expandedSearch .SubHeader-hiddenOnExpand {\n display: none !important;\n }\n\n .SubHeader--emptyLeftPane {\n grid-template-areas: \"middle middle right\" \"bottom bottom bottom\";\n grid-template-columns: auto 1fr auto;\n }\n\n .SubHeader--emptyLeftPane .SubHeader-middlePane {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n\n .SubHeader-middlePane {\n text-align: left;\n }\n\n .SubHeader-middlePane:has(> *) {\n margin-top: var(--base-size-16);\n }\n}\n"]}
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
@import "./open_project/input_group.pcss";
|
|
53
53
|
@import "./open_project/color_field.pcss";
|
|
54
54
|
@import "./open_project/inline_message.pcss";
|
|
55
|
+
@import "./open_project/keybinding_hint.pcss";
|
|
55
56
|
@import "./open_project/sub_header.pcss";
|
|
56
57
|
@import "./open_project/side_panel/section.pcss";
|
|
57
58
|
@import "./open_project/border_box/collapsible_header.pcss";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.css-truncate .css-truncate-overflow,.css-truncate
|
|
1
|
+
.css-truncate :is(.css-truncate-overflow,.css-truncate-target),.css-truncate.css-truncate-overflow,.css-truncate.css-truncate-target{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.css-truncate .css-truncate-target,.css-truncate.css-truncate-target{display:inline-block;max-width:125px;vertical-align:top}.css-truncate.expandable.css-truncate-target:hover,.css-truncate.expandable.zeroclipboard-is-hover.css-truncate-target,:is(.css-truncate.expandable.zeroclipboard-is-hover,.css-truncate.expandable:hover) .css-truncate-target{max-width:1e4px!important}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "truncate",
|
|
3
3
|
"selectors": [
|
|
4
|
-
".css-truncate .css-truncate-overflow",
|
|
5
|
-
".css-truncate .css-truncate-target",
|
|
4
|
+
".css-truncate :is(.css-truncate-overflow,.css-truncate-target)",
|
|
6
5
|
".css-truncate.css-truncate-overflow",
|
|
7
6
|
".css-truncate.css-truncate-target",
|
|
7
|
+
".css-truncate .css-truncate-target",
|
|
8
8
|
".css-truncate.expandable.css-truncate-target:hover",
|
|
9
|
-
".css-truncate.expandable.zeroclipboard-is-hover .css-truncate-target",
|
|
10
9
|
".css-truncate.expandable.zeroclipboard-is-hover.css-truncate-target",
|
|
11
|
-
".css-truncate.expandable:hover .css-truncate-target"
|
|
10
|
+
":is(.css-truncate.expandable.zeroclipboard-is-hover,.css-truncate.expandable:hover) .css-truncate-target"
|
|
12
11
|
]
|
|
13
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["truncate.pcss"],"names":[],"mappings":"AAME,
|
|
1
|
+
{"version":3,"sources":["truncate.pcss"],"names":[],"mappings":"AAME,qIAIE,eAAgB,CAChB,sBAAuB,CACvB,kBACF,CAGA,qEAEE,oBAAqB,CACrB,eAAgB,CAChB,kBACF,CAEA,gOAIE,yBACF","file":"truncate.css","sourcesContent":["/* CSS truncate */\n\n/* css-truncate will shorten text with an ellipsis. */\n\n.css-truncate {\n /* css-truncate-overflow will shorten text with an ellipsis when overflowing */\n &.css-truncate-overflow,\n & .css-truncate-overflow,\n &.css-truncate-target,\n & .css-truncate-target {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n /* css-truncate-target will shorten text with an ellipsis and a max width */\n &.css-truncate-target,\n & .css-truncate-target {\n display: inline-block;\n max-width: 125px;\n vertical-align: top;\n }\n\n &.expandable.zeroclipboard-is-hover .css-truncate-target,\n &.expandable.zeroclipboard-is-hover.css-truncate-target,\n &.expandable:hover .css-truncate-target,\n &.expandable:hover.css-truncate-target {\n max-width: 10000px !important;\n }\n}\n"]}
|
|
@@ -11,13 +11,33 @@ module Primer
|
|
|
11
11
|
|
|
12
12
|
def deferred
|
|
13
13
|
sleep params[:delay].to_f if params[:delay].present?
|
|
14
|
+
status = request_gate_status
|
|
15
|
+
return head(status) unless status == 200
|
|
16
|
+
return render(html: "") if params[:empty].present?
|
|
17
|
+
|
|
18
|
+
assign_deferred_params
|
|
14
19
|
render "primer/view_components/action_menu/deferred"
|
|
15
20
|
end
|
|
16
21
|
|
|
17
22
|
def deferred_preload
|
|
23
|
+
status = request_gate_status
|
|
24
|
+
return head(status) unless status == 200
|
|
25
|
+
|
|
26
|
+
assign_deferred_params
|
|
18
27
|
render "primer/view_components/action_menu/deferred_preload"
|
|
19
28
|
end
|
|
20
29
|
|
|
30
|
+
def deferred_form
|
|
31
|
+
status = request_gate_status
|
|
32
|
+
return head(status) unless status == 200
|
|
33
|
+
|
|
34
|
+
@label = params[:label].presence
|
|
35
|
+
@name = params[:name].presence || "foo"
|
|
36
|
+
@variant = params[:variant].presence || "multiple"
|
|
37
|
+
@checked = params.key?(:checked) ? params[:checked].to_s.split(",") : ["ours"]
|
|
38
|
+
render "primer/view_components/action_menu/deferred_form"
|
|
39
|
+
end
|
|
40
|
+
|
|
21
41
|
def form_action
|
|
22
42
|
respond_to do |format|
|
|
23
43
|
format.html do
|
|
@@ -33,6 +53,21 @@ module Primer
|
|
|
33
53
|
|
|
34
54
|
private
|
|
35
55
|
|
|
56
|
+
# Test-only: holds the request until the test releases it and returns
|
|
57
|
+
# the status it was released with (see test/test_helpers/request_gate.rb).
|
|
58
|
+
def request_gate_status
|
|
59
|
+
return 200 unless params[:gate].present? && defined?(Primer::RequestGate)
|
|
60
|
+
|
|
61
|
+
Primer::RequestGate.pass(params[:gate])
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def assign_deferred_params
|
|
65
|
+
@label = params[:label].presence
|
|
66
|
+
@deferred_sub = params[:deferred_sub].present?
|
|
67
|
+
@with_sub_menu = params[:with_sub_menu].present?
|
|
68
|
+
@empty_list = params[:empty_list].present?
|
|
69
|
+
end
|
|
70
|
+
|
|
36
71
|
def form_action_selected_value
|
|
37
72
|
params.permit(:foo)[:foo] || params.permit(foo: [])[:foo]
|
|
38
73
|
end
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
<%= render(Primer::Alpha::ActionMenu::List.new(menu_id: "deferred")) do |list| %>
|
|
2
|
-
<%
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
label: "
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
<% unless @empty_list %>
|
|
3
|
+
<% if @label.present? %>
|
|
4
|
+
<% list.with_item(label: @label, value: "", autofocus: true) %>
|
|
5
|
+
<% end %>
|
|
6
|
+
<% list.with_item(label: "Copy link", value: "", autofocus: @label.blank?) %>
|
|
7
|
+
<% list.with_item(label: "Quote reply", value: "") %>
|
|
8
|
+
<% list.with_item(label: "Reference in new issue", value: "") %>
|
|
9
|
+
<% list.with_item(
|
|
10
|
+
label: "Show dialog",
|
|
11
|
+
tag: :button,
|
|
12
|
+
# this dialog is rendered by demo/app/views/action_menu/deferred.html.erb
|
|
13
|
+
content_arguments: { "data-show-dialog-id": "my-dialog" },
|
|
14
|
+
value: "",
|
|
15
|
+
scheme: :danger
|
|
16
|
+
) %>
|
|
17
|
+
<% if @with_sub_menu %>
|
|
18
|
+
<% list.with_item(component_klass: Primer::Alpha::ActionMenu::SubMenuItem, label: "More") do |sub_menu| %>
|
|
19
|
+
<% sub_menu.with_item(label: "Sub one") %>
|
|
20
|
+
<% sub_menu.with_item(label: "Sub two") %>
|
|
21
|
+
<% end %>
|
|
22
|
+
<% end %>
|
|
23
|
+
<% if @deferred_sub %>
|
|
24
|
+
<% list.with_item(component_klass: Primer::Alpha::ActionMenu::SubMenuItem, label: "Deferred more", src: primer_view_components.action_menu_deferred_path) %>
|
|
25
|
+
<% end %>
|
|
26
|
+
<% end %>
|
|
13
27
|
<% end %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<%= fields do |f| %>
|
|
2
|
+
<%= render(Primer::Alpha::ActionMenu::List.new(menu_id: "deferred-form", select_variant: @variant.to_sym, form_arguments: { builder: f, name: @name })) do |list| %>
|
|
3
|
+
<% list.with_group do |group| %>
|
|
4
|
+
<% group.with_heading(title: "Strategy") %>
|
|
5
|
+
<% [["Fast forward", "fast_forward"], ["Recursive", "recursive"], ["Ours", "ours"]].each do |name, value| %>
|
|
6
|
+
<% group.with_item(label: [name, @label].compact.join(" "), content_arguments: { data: { value: value } }, active: @checked.include?(value)) %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% end %>
|
|
10
|
+
<% end %>
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<%= render(Primer::Alpha::ActionMenu::List.new(menu_id: "deferred-preload")) do |list| %>
|
|
2
|
-
<%
|
|
2
|
+
<% if @label.present? %>
|
|
3
|
+
<% list.with_item(label: @label, value: "", autofocus: true) %>
|
|
4
|
+
<% end %>
|
|
5
|
+
<% list.with_item(label: "Copy link", value: "", autofocus: @label.blank?) %>
|
|
3
6
|
<% list.with_item(label: "Quote reply", value: "") %>
|
|
4
7
|
<% list.with_item(label: "Reference in new issue", value: "") %>
|
|
8
|
+
<% if @deferred_sub %>
|
|
9
|
+
<% list.with_item(component_klass: Primer::Alpha::ActionMenu::SubMenuItem, label: "Deferred more", src: primer_view_components.action_menu_deferred_path) %>
|
|
10
|
+
<% end %>
|
|
5
11
|
<% end %>
|
data/config/locales/en.yml
CHANGED
|
@@ -46,3 +46,182 @@ en:
|
|
|
46
46
|
|
|
47
47
|
tree_view:
|
|
48
48
|
label_empty_sub_tree: "No items"
|
|
49
|
+
|
|
50
|
+
keybinding_hint:
|
|
51
|
+
then: "then"
|
|
52
|
+
keys:
|
|
53
|
+
alt:
|
|
54
|
+
condensed: { apple: "⌥", other: "Alt" }
|
|
55
|
+
full: { apple: "Option", other: "Alt" }
|
|
56
|
+
accessible: { apple: "option", other: "alt" }
|
|
57
|
+
arrowdown:
|
|
58
|
+
full: { other: "Down Arrow" }
|
|
59
|
+
accessible: { other: "down arrow" }
|
|
60
|
+
arrowleft:
|
|
61
|
+
full: { other: "Left Arrow" }
|
|
62
|
+
accessible: { other: "left arrow" }
|
|
63
|
+
arrowright:
|
|
64
|
+
full: { other: "Right Arrow" }
|
|
65
|
+
accessible: { other: "right arrow" }
|
|
66
|
+
arrowup:
|
|
67
|
+
full: { other: "Up Arrow" }
|
|
68
|
+
accessible: { other: "up arrow" }
|
|
69
|
+
backspace:
|
|
70
|
+
full: { other: "Backspace" }
|
|
71
|
+
accessible: { other: "backspace" }
|
|
72
|
+
capslock:
|
|
73
|
+
condensed: { other: "CapsLock" }
|
|
74
|
+
full: { other: "Caps Lock" }
|
|
75
|
+
accessible: { other: "caps lock" }
|
|
76
|
+
control:
|
|
77
|
+
condensed: { apple: "⌃", other: "Ctrl" }
|
|
78
|
+
full: { other: "Control" }
|
|
79
|
+
accessible: { other: "control" }
|
|
80
|
+
delete:
|
|
81
|
+
condensed: { other: "Del" }
|
|
82
|
+
full: { other: "Delete" }
|
|
83
|
+
accessible: { other: "delete" }
|
|
84
|
+
end:
|
|
85
|
+
condensed: { other: "End" }
|
|
86
|
+
full: { other: "End" }
|
|
87
|
+
accessible: { other: "end" }
|
|
88
|
+
enter:
|
|
89
|
+
full: { other: "Enter" }
|
|
90
|
+
accessible: { other: "enter" }
|
|
91
|
+
escape:
|
|
92
|
+
condensed: { other: "Esc" }
|
|
93
|
+
full: { other: "Escape" }
|
|
94
|
+
accessible: { other: "escape" }
|
|
95
|
+
function:
|
|
96
|
+
condensed: { other: "Fn" }
|
|
97
|
+
full: { other: "Function" }
|
|
98
|
+
accessible: { other: "function" }
|
|
99
|
+
home:
|
|
100
|
+
condensed: { other: "Home" }
|
|
101
|
+
full: { other: "Home" }
|
|
102
|
+
accessible: { other: "home" }
|
|
103
|
+
insert:
|
|
104
|
+
condensed: { other: "Ins" }
|
|
105
|
+
full: { other: "Insert" }
|
|
106
|
+
accessible: { other: "insert" }
|
|
107
|
+
meta:
|
|
108
|
+
condensed: { apple: "⌘", windows: "Win", other: "Meta" }
|
|
109
|
+
full: { apple: "Command", windows: "Windows", other: "Meta" }
|
|
110
|
+
accessible: { apple: "command", windows: "Windows", other: "meta" }
|
|
111
|
+
pagedown:
|
|
112
|
+
condensed: { other: "PgDn" }
|
|
113
|
+
full: { other: "Page Down" }
|
|
114
|
+
accessible: { other: "page down" }
|
|
115
|
+
pageup:
|
|
116
|
+
condensed: { other: "PgUp" }
|
|
117
|
+
full: { other: "Page Up" }
|
|
118
|
+
accessible: { other: "page up" }
|
|
119
|
+
plus:
|
|
120
|
+
full: { other: "Plus" }
|
|
121
|
+
accessible: { other: "plus" }
|
|
122
|
+
printscreen:
|
|
123
|
+
condensed: { other: "PrtScn" }
|
|
124
|
+
full: { other: "Print Screen" }
|
|
125
|
+
accessible: { other: "print screen" }
|
|
126
|
+
shift:
|
|
127
|
+
full: { other: "Shift" }
|
|
128
|
+
accessible: { other: "shift" }
|
|
129
|
+
space:
|
|
130
|
+
full: { other: "Space" }
|
|
131
|
+
accessible: { other: "space" }
|
|
132
|
+
tab:
|
|
133
|
+
full: { other: "Tab" }
|
|
134
|
+
accessible: { other: "tab" }
|
|
135
|
+
ampersand:
|
|
136
|
+
key: "&"
|
|
137
|
+
accessible: { other: "ampersand" }
|
|
138
|
+
asterisk:
|
|
139
|
+
key: "*"
|
|
140
|
+
accessible: { other: "asterisk" }
|
|
141
|
+
at:
|
|
142
|
+
key: "@"
|
|
143
|
+
accessible: { other: "at" }
|
|
144
|
+
backslash:
|
|
145
|
+
key: "\\"
|
|
146
|
+
accessible: { other: "backslash" }
|
|
147
|
+
backtick:
|
|
148
|
+
key: "`"
|
|
149
|
+
accessible: { other: "backtick" }
|
|
150
|
+
caret:
|
|
151
|
+
key: "^"
|
|
152
|
+
accessible: { other: "caret" }
|
|
153
|
+
colon:
|
|
154
|
+
key: ":"
|
|
155
|
+
accessible: { other: "colon" }
|
|
156
|
+
comma:
|
|
157
|
+
key: ","
|
|
158
|
+
accessible: { other: "comma" }
|
|
159
|
+
dash:
|
|
160
|
+
key: "-"
|
|
161
|
+
accessible: { other: "dash" }
|
|
162
|
+
dollar_sign:
|
|
163
|
+
key: "$"
|
|
164
|
+
accessible: { other: "dollar sign" }
|
|
165
|
+
double_quote:
|
|
166
|
+
key: "\""
|
|
167
|
+
accessible: { other: "double quote" }
|
|
168
|
+
equals:
|
|
169
|
+
key: "="
|
|
170
|
+
accessible: { other: "equals" }
|
|
171
|
+
exclamation_point:
|
|
172
|
+
key: "!"
|
|
173
|
+
accessible: { other: "exclamation point" }
|
|
174
|
+
forward_slash:
|
|
175
|
+
key: "/"
|
|
176
|
+
accessible: { other: "forward slash" }
|
|
177
|
+
hash:
|
|
178
|
+
key: "#"
|
|
179
|
+
accessible: { other: "hash" }
|
|
180
|
+
left_angle_bracket:
|
|
181
|
+
key: "<"
|
|
182
|
+
accessible: { other: "left angle bracket" }
|
|
183
|
+
left_bracket:
|
|
184
|
+
key: "["
|
|
185
|
+
accessible: { other: "left bracket" }
|
|
186
|
+
left_curly_brace:
|
|
187
|
+
key: "{"
|
|
188
|
+
accessible: { other: "left curly brace" }
|
|
189
|
+
left_parenthesis:
|
|
190
|
+
key: "("
|
|
191
|
+
accessible: { other: "left parenthesis" }
|
|
192
|
+
percent:
|
|
193
|
+
key: "%"
|
|
194
|
+
accessible: { other: "percent" }
|
|
195
|
+
period:
|
|
196
|
+
key: "."
|
|
197
|
+
accessible: { other: "period" }
|
|
198
|
+
pipe:
|
|
199
|
+
key: "|"
|
|
200
|
+
accessible: { other: "pipe" }
|
|
201
|
+
question_mark:
|
|
202
|
+
key: "?"
|
|
203
|
+
accessible: { other: "question mark" }
|
|
204
|
+
right_angle_bracket:
|
|
205
|
+
key: ">"
|
|
206
|
+
accessible: { other: "right angle bracket" }
|
|
207
|
+
right_bracket:
|
|
208
|
+
key: "]"
|
|
209
|
+
accessible: { other: "right bracket" }
|
|
210
|
+
right_curly_brace:
|
|
211
|
+
key: "}"
|
|
212
|
+
accessible: { other: "right curly brace" }
|
|
213
|
+
right_parenthesis:
|
|
214
|
+
key: ")"
|
|
215
|
+
accessible: { other: "right parenthesis" }
|
|
216
|
+
semicolon:
|
|
217
|
+
key: ";"
|
|
218
|
+
accessible: { other: "semicolon" }
|
|
219
|
+
single_quote:
|
|
220
|
+
key: "'"
|
|
221
|
+
accessible: { other: "single quote" }
|
|
222
|
+
tilde:
|
|
223
|
+
key: "~"
|
|
224
|
+
accessible: { other: "tilde" }
|
|
225
|
+
underscore:
|
|
226
|
+
key: "_"
|
|
227
|
+
accessible: { other: "underscore" }
|
data/config/routes.rb
CHANGED
|
@@ -28,6 +28,7 @@ Primer::ViewComponents::Engine.routes.draw do
|
|
|
28
28
|
post "/action_menu/form_action", to: "action_menu#form_action", as: :action_menu_form_action
|
|
29
29
|
get "/action_menu/deferred", to: "action_menu#deferred", as: :action_menu_deferred
|
|
30
30
|
get "/action_menu/deferred_preload", to: "action_menu#deferred_preload", as: :action_menu_deferred_preload
|
|
31
|
+
get "/action_menu/deferred_form", to: "action_menu#deferred_form", as: :action_menu_deferred_form
|
|
31
32
|
|
|
32
33
|
get "/include_fragment/deferred", to: "include_fragment#deferred", as: :include_fragment_deferred
|
|
33
34
|
end
|
data/lib/primer/accessibility.rb
CHANGED
|
@@ -41,9 +41,8 @@ module Primer
|
|
|
41
41
|
}
|
|
42
42
|
}.freeze
|
|
43
43
|
|
|
44
|
-
# rubocop:disable Style/ClassMethodsDefinitions
|
|
44
|
+
# rubocop:disable-next Style/ClassMethodsDefinitions
|
|
45
45
|
class << self
|
|
46
|
-
# rubocop:enable Style/ClassMethodsDefinitions
|
|
47
46
|
|
|
48
47
|
def ignore_preview?(preview_class)
|
|
49
48
|
IGNORED_PREVIEWS.include?(preview_class)
|
data/lib/primer/classify.rb
CHANGED
|
@@ -98,9 +98,8 @@ module Primer
|
|
|
98
98
|
else
|
|
99
99
|
next if val.nil?
|
|
100
100
|
|
|
101
|
-
# rubocop:disable Style/RescueModifier
|
|
101
|
+
# rubocop:disable-next Style/RescueModifier
|
|
102
102
|
found = (LOOKUP[key][val][0] rescue nil) || validate(key, val, 0)
|
|
103
|
-
# rubocop:enable Style/RescueModifier
|
|
104
103
|
if found
|
|
105
104
|
result << found
|
|
106
105
|
result << TMP_PREFIX_CACHE[found] if TMP_PREFIX_CACHE.key?(found)
|
|
@@ -125,6 +125,51 @@ module Primer
|
|
|
125
125
|
end
|
|
126
126
|
end
|
|
127
127
|
|
|
128
|
+
# Lines start at the label and run through trailing visuals. The first item and
|
|
129
|
+
# the item after a manual divider get none. Hidden items are not supported with
|
|
130
|
+
# dividers. The hidden items here pin what the lines do around them: additional dividers.
|
|
131
|
+
#
|
|
132
|
+
# @label With dividers
|
|
133
|
+
# @hidden
|
|
134
|
+
# @snapshot
|
|
135
|
+
def with_dividers
|
|
136
|
+
render(Primer::Alpha::ActionList.new(aria: { label: "List with dividers" }, show_dividers: true)) do |component|
|
|
137
|
+
component.with_item(label: "Hidden item", hidden: true)
|
|
138
|
+
component.with_item(label: "First visible item")
|
|
139
|
+
component.with_item(label: "Leading visual") do |item|
|
|
140
|
+
item.with_leading_visual_icon(icon: :gear)
|
|
141
|
+
end
|
|
142
|
+
component.with_item(label: "Trailing visual") do |item|
|
|
143
|
+
item.with_trailing_visual_label(scheme: :accent) { "New" }
|
|
144
|
+
end
|
|
145
|
+
component.with_item(label: "Inline description", description_scheme: :inline) do |item|
|
|
146
|
+
item.with_leading_visual_icon(icon: :star)
|
|
147
|
+
item.with_description { "Description" }
|
|
148
|
+
item.with_trailing_visual_icon(icon: :check)
|
|
149
|
+
end
|
|
150
|
+
component.with_item(label: "Block description", description_scheme: :block) do |item|
|
|
151
|
+
item.with_leading_visual_icon(icon: :star)
|
|
152
|
+
item.with_description { "Description" }
|
|
153
|
+
item.with_trailing_visual_icon(icon: :check)
|
|
154
|
+
end
|
|
155
|
+
component.with_item(label: "Disabled item", disabled: true) do |item|
|
|
156
|
+
item.with_leading_visual_icon(icon: :lock)
|
|
157
|
+
end
|
|
158
|
+
component.with_item(label: "Hidden item", hidden: true)
|
|
159
|
+
component.with_item(label: "After a hidden item")
|
|
160
|
+
component.with_item(label: "Form item", href: "/", form_arguments: { method: :post, name: "foo" })
|
|
161
|
+
component.with_divider
|
|
162
|
+
component.with_item(label: "After a divider")
|
|
163
|
+
component.with_divider
|
|
164
|
+
component.with_item(label: "Hidden item – breaks the line rules", hidden: true)
|
|
165
|
+
component.with_item(label: "After a divider and a hidden item")
|
|
166
|
+
component.with_item(label: "Hidden item", hidden: true)
|
|
167
|
+
component.with_divider
|
|
168
|
+
component.with_item(label: "After a collapsed divider")
|
|
169
|
+
component.with_item(label: "Last item")
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
128
173
|
# @label Divider
|
|
129
174
|
#
|
|
130
175
|
# @param scheme [Symbol] select [subtle, filled]
|
|
@@ -534,7 +579,7 @@ module Primer
|
|
|
534
579
|
)) do |component|
|
|
535
580
|
component.with_heading(title: "Action List")
|
|
536
581
|
component.with_item(label: "Item one", href: "/", active: true)
|
|
537
|
-
component.with_item(label: "Item two", href: "/")
|
|
582
|
+
component.with_item(label: "Item two", href: "/")
|
|
538
583
|
component.with_item(label: "Item three", href: "/")
|
|
539
584
|
end
|
|
540
585
|
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<%= render(Primer::Alpha::ActionMenu.new(menu_id: "deferred", preload: preload, src: primer_view_components.action_menu_deferred_path)) do |menu| %>
|
|
2
|
+
<% menu.with_show_button { "Menu with refreshable content" } %>
|
|
3
|
+
<% end %>
|
|
4
|
+
|
|
5
|
+
<%= render(Primer::Beta::Button.new(id: "deferred-refresh-button", ml: 2)) { "Refresh" } %>
|
|
6
|
+
<%= render(Primer::Beta::Button.new(id: "deferred-reload-button", ml: 2)) { "Reload" } %>
|
|
7
|
+
|
|
8
|
+
<%# Used by the "Show dialog" item rendered by ActionMenuController#deferred. %>
|
|
9
|
+
<%= render(Primer::Alpha::Dialog.new(id: "my-dialog", title: "Confirm deletion")) do |d| %>
|
|
10
|
+
<%= render(Primer::Alpha::Dialog::Body.new()) do %>
|
|
11
|
+
Are you sure you want to delete this?
|
|
12
|
+
<% end %>
|
|
13
|
+
<%= render(Primer::Alpha::Dialog::Footer.new()) do %>
|
|
14
|
+
<%= render(Primer::Beta::Button.new(data: { "close-dialog-id": "my-dialog" })) { "Cancel" } %>
|
|
15
|
+
<%= render(Primer::Beta::Button.new(scheme: :danger)) { "Delete" } %>
|
|
16
|
+
<% end %>
|
|
17
|
+
<% end %>
|
|
18
|
+
|
|
19
|
+
<script type="text/javascript">
|
|
20
|
+
(() => {
|
|
21
|
+
let count = 0
|
|
22
|
+
document.getElementById("deferred-refresh-button").addEventListener("click", () => {
|
|
23
|
+
const menu = document.querySelector("action-menu")
|
|
24
|
+
const url = new URL(menu.getAttribute("src"), window.location.href)
|
|
25
|
+
count += 1
|
|
26
|
+
url.searchParams.set("label", `Refreshed ${count}`)
|
|
27
|
+
menu.setAttribute("src", `${url.pathname}${url.search}`)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
document.getElementById("deferred-reload-button").addEventListener("click", () => {
|
|
31
|
+
document.querySelector("action-menu").refresh()
|
|
32
|
+
})
|
|
33
|
+
})()
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%= form_with(url: primer_view_components.action_menu_form_action_path(format: route_format)) do |f| %>
|
|
2
|
+
<%= render(Primer::Alpha::ActionMenu.new(select_variant: select_variant, dynamic_label: true, dynamic_label_prefix: "Strategy", menu_id: "deferred-form", src: primer_view_components.action_menu_deferred_form_path(variant: (select_variant if select_variant == :single)), form_arguments: { builder: f, name: "foo" })) do |menu| %>
|
|
3
|
+
<% menu.with_show_button { "Strategy" } %>
|
|
4
|
+
<% end %>
|
|
5
|
+
<hr>
|
|
6
|
+
<div>
|
|
7
|
+
<%= f.submit(class: "Button--secondary Button--medium Button") %>
|
|
8
|
+
</div>
|
|
9
|
+
<% end %>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<% menu.with_show_button { "Edit" } %>
|
|
5
5
|
<% menu.with_item(label: "Cut") %>
|
|
6
6
|
<% menu.with_item(label: "Copy") %>
|
|
7
|
-
<% menu.with_sub_menu_item(label: "Paste special", anchor_align: sub_menu_anchor_align, anchor_side: sub_menu_anchor_side, anchor_when_narrow: anchor_when_narrow) do |sub_menu| %>
|
|
7
|
+
<% menu.with_sub_menu_item(label: "Paste special", disabled: disable_sub_menu, anchor_align: sub_menu_anchor_align, anchor_side: sub_menu_anchor_side, anchor_when_narrow: anchor_when_narrow) do |sub_menu| %>
|
|
8
8
|
<% sub_menu.with_leading_visual_icon(icon: :"sparkle-fill") %>
|
|
9
9
|
<% sub_menu.with_item(label: "Paste plain text") %>
|
|
10
10
|
<% sub_menu.with_item(label: "Paste formulas") %>
|
|
@@ -310,6 +310,20 @@ module Primer
|
|
|
310
310
|
render_with_template(locals: { nest_in_sub_menu: nest_in_sub_menu })
|
|
311
311
|
end
|
|
312
312
|
|
|
313
|
+
# @label Deferred refresh
|
|
314
|
+
#
|
|
315
|
+
# @param preload toggle
|
|
316
|
+
def deferred_refresh(preload: false)
|
|
317
|
+
render_with_template(locals: { preload: preload.to_s == "true" })
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
# @label Deferred refresh with form
|
|
321
|
+
#
|
|
322
|
+
# @hidden
|
|
323
|
+
def deferred_refresh_form(route_format: :json, select_variant: :multiple)
|
|
324
|
+
render_with_template(locals: { route_format: route_format, select_variant: select_variant.to_sym })
|
|
325
|
+
end
|
|
326
|
+
|
|
313
327
|
# @label With deferred content near the bottom of the viewport
|
|
314
328
|
#
|
|
315
329
|
# @hidden
|
|
@@ -496,19 +510,22 @@ module Primer
|
|
|
496
510
|
# @param anchor_when_narrow [Symbol] select [inherit, bottom, fullscreen, left, right]
|
|
497
511
|
# @param sub_menu_anchor_align [Symbol] select [start, center, end]
|
|
498
512
|
# @param sub_menu_anchor_side [Symbol] select [outside_bottom, outside_top, outside_left, outside_right]
|
|
513
|
+
# @param disable_sub_menu toggle
|
|
499
514
|
def sub_menus(
|
|
500
515
|
anchor_align: Primer::Alpha::ActionMenu::PrimaryMenu::DEFAULT_ANCHOR_ALIGN,
|
|
501
516
|
anchor_side: Primer::Alpha::ActionMenu::PrimaryMenu::DEFAULT_ANCHOR_SIDE,
|
|
502
517
|
anchor_when_narrow: Primer::Alpha::ActionMenu::SubMenu::DEFAULT_ANCHOR_WHEN_NARROW,
|
|
503
518
|
sub_menu_anchor_align: Primer::Alpha::ActionMenu::SubMenu::DEFAULT_ANCHOR_ALIGN,
|
|
504
|
-
sub_menu_anchor_side: Primer::Alpha::ActionMenu::SubMenu::DEFAULT_ANCHOR_SIDE
|
|
519
|
+
sub_menu_anchor_side: Primer::Alpha::ActionMenu::SubMenu::DEFAULT_ANCHOR_SIDE,
|
|
520
|
+
disable_sub_menu: false
|
|
505
521
|
)
|
|
506
522
|
render_with_template(locals: {
|
|
507
523
|
anchor_align: anchor_align.to_sym,
|
|
508
524
|
anchor_side: anchor_side.to_sym,
|
|
509
525
|
anchor_when_narrow: anchor_when_narrow.to_sym,
|
|
510
526
|
sub_menu_anchor_align: sub_menu_anchor_align,
|
|
511
|
-
sub_menu_anchor_side: sub_menu_anchor_side
|
|
527
|
+
sub_menu_anchor_side: sub_menu_anchor_side,
|
|
528
|
+
disable_sub_menu: disable_sub_menu
|
|
512
529
|
})
|
|
513
530
|
end
|
|
514
531
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%= render(Primer::Alpha::ActionList.new(aria: { label: "Comment actions" })) do |list| %>
|
|
2
|
+
<% list.with_item(label: "Add comment") %>
|
|
3
|
+
<% list.with_item(label: "Save") do |item| %>
|
|
4
|
+
<% item.with_trailing_visual_keybinding_hint(keys: "Mod+Enter", data: { platform: "other" }) %>
|
|
5
|
+
<% end %>
|
|
6
|
+
<% list.with_item(label: "Preview") do |item| %>
|
|
7
|
+
<% item.with_trailing_visual_keybinding_hint(keys: "Mod+Shift+p", data: { platform: "other" }) %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% list.with_item(label: "Delete", scheme: :danger) do |item| %>
|
|
10
|
+
<% item.with_trailing_visual_keybinding_hint(keys: "Mod+Backspace", data: { platform: "other" }) %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% end %>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<%= render(Primer::Box.new(display: :flex, style: "flex-direction: column; gap: var(--base-size-16)")) do %>
|
|
2
|
+
<% %i[default primary danger invisible].each do |scheme| %>
|
|
3
|
+
<%= render(Primer::Box.new(display: :flex, style: "gap: var(--base-size-8); align-items: center; flex-wrap: wrap")) do %>
|
|
4
|
+
<% %i[small medium large].each do |size| %>
|
|
5
|
+
<%= render(Primer::Beta::Button.new(scheme: scheme, size: size)) do |button| %>
|
|
6
|
+
<% button.with_trailing_visual_keybinding_hint(keys: "Mod+s", data: { platform: "other" }) %>
|
|
7
|
+
<%= "#{scheme} #{size}" %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% end %>
|
|
10
|
+
<%= render(Primer::Beta::Button.new(scheme: scheme, disabled: true)) do |button| %>
|
|
11
|
+
<% button.with_trailing_visual_keybinding_hint(keys: "Mod+s", data: { platform: "other" }) %>
|
|
12
|
+
<%= "#{scheme} disabled" %>
|
|
13
|
+
<% end %>
|
|
14
|
+
<%= render(Primer::Beta::Button.new(scheme: scheme, inactive: true)) do |button| %>
|
|
15
|
+
<% button.with_trailing_visual_keybinding_hint(keys: "Mod+s", data: { platform: "other" }) %>
|
|
16
|
+
<%= "#{scheme} inactive" %>
|
|
17
|
+
<% end %>
|
|
18
|
+
<% end %>
|
|
19
|
+
<% end %>
|
|
20
|
+
<%= render(Primer::Beta::Button.new(aria: { label: "Save document" })) do |button| %>
|
|
21
|
+
<% button.with_trailing_visual_keybinding_hint(keys: "Mod+s", data: { platform: "other" }) %>
|
|
22
|
+
Save
|
|
23
|
+
<% end %>
|
|
24
|
+
<% end %>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<%= render(Primer::Box.new(display: :flex, style: "gap: var(--base-size-16); align-items: center")) do %>
|
|
2
|
+
<% %w[apple windows other].each do |platform| %>
|
|
3
|
+
<%= render(Primer::Box.new(display: :flex, style: "gap: var(--base-size-8); align-items: center")) do %>
|
|
4
|
+
<%= render(Primer::Beta::Text.new(tag: :span, color: :muted)) { platform } %>
|
|
5
|
+
<%= render(Primer::OpenProject::KeybindingHint.new(keys: "Mod+Alt+Shift+ArrowUp", data: { platform: platform })) %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% end %>
|