primer_view_components 0.0.114 → 0.0.115

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +36 -0
  3. data/app/assets/javascripts/primer_view_components.js +1 -1
  4. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  5. data/app/assets/styles/primer_view_components.css +2 -2
  6. data/app/assets/styles/primer_view_components.css.map +1 -1
  7. data/app/components/primer/alpha/action_list/divider.rb +2 -0
  8. data/app/components/primer/alpha/action_list/heading.rb +2 -0
  9. data/app/components/primer/alpha/action_list/item.rb +8 -6
  10. data/app/components/primer/alpha/action_list.rb +1 -0
  11. data/app/components/primer/alpha/auto_complete/auto_complete.html.erb +1 -1
  12. data/app/components/primer/alpha/auto_complete/item.rb +1 -0
  13. data/app/components/primer/alpha/auto_complete.rb +3 -2
  14. data/app/components/primer/alpha/banner.html.erb +1 -1
  15. data/app/components/primer/alpha/banner.rb +1 -0
  16. data/app/components/primer/alpha/button_marketing.rb +2 -0
  17. data/app/components/primer/alpha/dialog.rb +3 -0
  18. data/app/components/primer/alpha/image.rb +1 -0
  19. data/app/components/primer/alpha/image_crop.html.erb +1 -1
  20. data/app/components/primer/alpha/layout.css +1 -0
  21. data/app/components/primer/alpha/layout.css.json +1 -0
  22. data/app/components/primer/alpha/layout.css.map +1 -0
  23. data/app/components/primer/alpha/layout.pcss +268 -0
  24. data/app/components/primer/{menu_component.css → alpha/menu.css} +0 -0
  25. data/app/components/primer/alpha/menu.css.json +1 -0
  26. data/app/components/primer/alpha/menu.css.map +1 -0
  27. data/app/components/primer/{menu_component.html.erb → alpha/menu.html.erb} +0 -0
  28. data/app/components/primer/{menu_component.pcss → alpha/menu.pcss} +0 -0
  29. data/app/components/primer/alpha/menu.rb +76 -0
  30. data/app/components/primer/{octicon_symbols_component.html.erb → alpha/octicon_symbols.html.erb} +0 -0
  31. data/app/components/primer/alpha/octicon_symbols.rb +61 -0
  32. data/app/components/primer/alpha/text_field.rb +1 -0
  33. data/app/components/primer/alpha/toggle_switch.html.erb +2 -2
  34. data/app/components/primer/alpha/toggle_switch.rb +2 -0
  35. data/app/components/primer/alpha/tool_tip.js +77 -69
  36. data/app/components/primer/alpha/tool_tip.ts +63 -51
  37. data/app/components/primer/alpha/tooltip.rb +2 -0
  38. data/app/components/primer/beta/auto_complete/item.rb +4 -4
  39. data/app/components/primer/beta/auto_complete.rb +3 -3
  40. data/app/components/primer/beta/avatar.rb +1 -0
  41. data/app/components/primer/beta/base_button.rb +1 -0
  42. data/app/components/primer/beta/blankslate.rb +5 -5
  43. data/app/components/primer/beta/button.rb +7 -7
  44. data/app/components/primer/beta/clipboard_copy.html.erb +2 -2
  45. data/app/components/primer/beta/clipboard_copy.rb +1 -0
  46. data/app/components/primer/beta/close_button.rb +2 -1
  47. data/app/components/primer/beta/counter.rb +1 -0
  48. data/app/components/primer/beta/heading.rb +1 -0
  49. data/app/components/primer/beta/icon_button.html.erb +1 -1
  50. data/app/components/primer/beta/icon_button.rb +1 -0
  51. data/app/components/primer/beta/label.rb +1 -0
  52. data/app/components/primer/beta/markdown.rb +1 -0
  53. data/app/components/primer/{octicon_component.html.erb → beta/octicon.html.erb} +0 -0
  54. data/app/components/primer/beta/octicon.rb +88 -0
  55. data/app/components/primer/beta/relative_time.rb +2 -1
  56. data/app/components/primer/{spinner_component.html.erb → beta/spinner.html.erb} +0 -0
  57. data/app/components/primer/beta/spinner.rb +46 -0
  58. data/app/components/primer/beta/text.rb +1 -0
  59. data/app/components/primer/blankslate_component.rb +3 -3
  60. data/app/components/primer/box.rb +1 -0
  61. data/app/components/primer/button_component.rb +3 -3
  62. data/app/components/primer/conditional_wrapper.rb +2 -0
  63. data/app/components/primer/hellip_button.rb +2 -0
  64. data/app/components/primer/icon_button.html.erb +2 -2
  65. data/app/components/primer/icon_button.rb +1 -0
  66. data/app/components/primer/layout_component.rb +2 -0
  67. data/app/components/primer/local_time.rb +3 -0
  68. data/app/components/primer/menu_component.rb +2 -69
  69. data/app/components/primer/navigation/tab_component.rb +2 -2
  70. data/app/components/primer/octicon_component.rb +3 -81
  71. data/app/components/primer/octicon_symbols_component.rb +2 -52
  72. data/app/components/primer/primer.d.ts +2 -0
  73. data/app/components/primer/primer.js +2 -0
  74. data/app/components/primer/primer.pcss +2 -1
  75. data/app/components/primer/primer.ts +2 -0
  76. data/app/components/primer/spinner_component.rb +2 -38
  77. data/app/components/primer/state_component.rb +1 -0
  78. data/app/components/primer/subhead_component.rb +2 -0
  79. data/app/components/primer/tab_container_component.rb +2 -0
  80. data/app/components/primer/time_ago_component.rb +2 -1
  81. data/app/components/primer/timeline_item_component.rb +3 -2
  82. data/app/components/primer/tooltip.rb +1 -0
  83. data/app/components/primer/truncate.rb +2 -0
  84. data/app/forms/immediate_validation_form.rb +29 -0
  85. data/app/forms/multi_input_form.rb +4 -2
  86. data/app/lib/primer/css/layout.css +1 -378
  87. data/app/lib/primer/css/layout.css.json +1 -1
  88. data/app/lib/primer/octicon/cache.rb +1 -1
  89. data/app/lib/primer/view_helper.rb +1 -1
  90. data/lib/primer/deprecations.yml +26 -0
  91. data/lib/primer/forms/builder.rb +48 -8
  92. data/lib/primer/forms/check_box.html.erb +3 -1
  93. data/lib/primer/forms/dsl/input.rb +23 -1
  94. data/lib/primer/forms/dsl/multi_input.rb +6 -9
  95. data/lib/primer/forms/dsl/select_list_input.rb +1 -1
  96. data/lib/primer/forms/dsl/text_field_input.rb +31 -1
  97. data/lib/primer/forms/form_control.html.erb +17 -13
  98. data/lib/primer/forms/form_control.rb +2 -0
  99. data/lib/primer/forms/multi.html.erb +6 -2
  100. data/lib/primer/forms/primer_multi_input.d.ts +10 -0
  101. data/lib/primer/forms/primer_multi_input.js +45 -0
  102. data/lib/primer/forms/primer_multi_input.ts +46 -0
  103. data/lib/primer/forms/primer_text_field.d.ts +1 -0
  104. data/lib/primer/forms/primer_text_field.js +62 -0
  105. data/lib/primer/forms/primer_text_field.ts +48 -0
  106. data/lib/primer/forms/radio_button.html.erb +3 -1
  107. data/lib/primer/forms/text_field.html.erb +8 -8
  108. data/lib/primer/forms/text_field.rb +11 -0
  109. data/lib/primer/view_components/linters/close_button_component_migration_counter.rb +1 -1
  110. data/lib/primer/view_components/version.rb +1 -1
  111. data/lib/tasks/docs.rake +5 -5
  112. data/lib/tasks/helpers/ast_traverser.rb +1 -1
  113. data/previews/primer/alpha/action_list_preview.rb +1 -1
  114. data/previews/primer/alpha/auto_complete_preview.rb +62 -6
  115. data/previews/primer/alpha/layout_preview.rb +179 -6
  116. data/previews/primer/{menu_component_preview → alpha/menu_preview}/default.html.erb +3 -3
  117. data/previews/primer/{menu_component_preview → alpha/menu_preview}/playground.html.erb +3 -3
  118. data/previews/primer/alpha/menu_preview.rb +14 -0
  119. data/previews/primer/alpha/toggle_switch_preview.rb +11 -9
  120. data/previews/primer/beta/auto_complete_preview/with_submit_button.html.erb +1 -1
  121. data/previews/primer/beta/auto_complete_preview.rb +19 -17
  122. data/previews/primer/beta/octicon_preview.rb +24 -0
  123. data/previews/primer/beta/spinner_preview.rb +22 -0
  124. data/previews/primer/forms/forms_preview/immediate_validation_form.html.erb +3 -0
  125. data/previews/primer/forms/forms_preview/multi_input_form.html.erb +12 -1
  126. data/previews/primer/forms/forms_preview.rb +2 -0
  127. data/previews/primer/url_helpers.rb +15 -0
  128. data/static/arguments.json +159 -159
  129. data/static/audited_at.json +4 -0
  130. data/static/constants.json +42 -34
  131. data/static/statuses.json +10 -6
  132. metadata +32 -15
  133. data/app/components/primer/menu_component.css.json +0 -1
  134. data/app/components/primer/menu_component.css.map +0 -1
  135. data/previews/primer/menu_component_preview.rb +0 -12
  136. data/previews/primer/octicon_component_preview.rb +0 -22
  137. data/previews/primer/spinner_component_preview.rb +0 -20
@@ -5,6 +5,8 @@ module Primer
5
5
  class ActionList
6
6
  # Section heading rendered above the section contents.
7
7
  class Divider < Primer::Component
8
+ warn_on_deprecated_slot_setter
9
+
8
10
  DEFAULT_SCHEME = :subtle
9
11
  SCHEME_MAPPINGS = {
10
12
  DEFAULT_SCHEME => nil,
@@ -5,6 +5,8 @@ module Primer
5
5
  class ActionList
6
6
  # Heading used to describe each sub list within an action list.
7
7
  class Heading < Primer::Component
8
+ warn_on_deprecated_slot_setter
9
+
8
10
  DEFAULT_SCHEME = :subtle
9
11
  SCHEME_MAPPINGS = {
10
12
  DEFAULT_SCHEME => nil,
@@ -6,6 +6,8 @@ module Primer
6
6
  # An individual `ActionList` item. Items can optionally include leading and/or trailing visuals,
7
7
  # such as icons, avatars, and counters.
8
8
  class Item < Primer::Component
9
+ warn_on_deprecated_slot_setter
10
+
9
11
  DEFAULT_SIZE = :medium
10
12
  SIZE_MAPPINGS = {
11
13
  DEFAULT_SIZE => nil,
@@ -34,7 +36,7 @@ module Primer
34
36
 
35
37
  # An icon, avatar, SVG, or custom content that will render to the left of the label.
36
38
  #
37
- # To render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by <%= link_to_component(Primer::OcticonComponent) %>.
39
+ # To render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by <%= link_to_component(Primer::Beta::Octicon) %>.
38
40
  #
39
41
  # To render an avatar, call the `with_leading_visual_avatar` method, which accepts the arguments accepted by <%= link_to_component(Primer::Beta::Avatar) %>.
40
42
  #
@@ -42,7 +44,7 @@ module Primer
42
44
  #
43
45
  # To render custom content, call the `with_leading_visual_content` method and pass a block that returns a string.
44
46
  renders_one :leading_visual, types: {
45
- icon: Primer::OcticonComponent,
47
+ icon: Primer::Beta::Octicon,
46
48
  avatar: ->(**kwargs) { Primer::Beta::Avatar.new(**{ **kwargs, size: 16 }) },
47
49
  svg: lambda { |**system_arguments|
48
50
  Primer::BaseComponent.new(tag: :svg, width: "16", height: "16", **system_arguments)
@@ -55,11 +57,11 @@ module Primer
55
57
  # Used internally.
56
58
  #
57
59
  # @private
58
- renders_one :private_leading_action_icon, Primer::OcticonComponent
60
+ renders_one :private_leading_action_icon, Primer::Beta::Octicon
59
61
 
60
62
  # An icon, label, counter, or text to render to the right of the label.
61
63
  #
62
- # To render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by <%= link_to_component(Primer::OcticonComponent) %>.
64
+ # To render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by <%= link_to_component(Primer::Beta::Octicon) %>.
63
65
  #
64
66
  # To render a label, call the `with_leading_visual_label` method, which accepts the arguments accepted by <%= link_to_component(Primer::Beta::Label) %>.
65
67
  #
@@ -70,7 +72,7 @@ module Primer
70
72
  # with_leading_visual_text { "Text here" }`
71
73
  # ```
72
74
  renders_one :trailing_visual, types: {
73
- icon: Primer::OcticonComponent,
75
+ icon: Primer::Beta::Octicon,
74
76
  label: Primer::Beta::Label,
75
77
  counter: Primer::Beta::Counter,
76
78
  text: ->(text) { text }
@@ -79,7 +81,7 @@ module Primer
79
81
  # Used internally.
80
82
  #
81
83
  # @private
82
- renders_one :private_trailing_action_icon, Primer::OcticonComponent
84
+ renders_one :private_trailing_action_icon, Primer::Beta::Octicon
83
85
 
84
86
  # A button rendered after the trailing icon that can be used to show a menu, activate
85
87
  # a dialog, etc.
@@ -9,6 +9,7 @@ module Primer
9
9
  # Each item in an action list can be augmented by specifying corresponding leading
10
10
  # and/or trailing visuals.
11
11
  class ActionList < Primer::Component
12
+ warn_on_deprecated_slot_setter
12
13
  status :alpha
13
14
 
14
15
  DEFAULT_ROLE = :list
@@ -9,7 +9,7 @@
9
9
  <span class="autocomplete-body">
10
10
  <% if @with_icon %>
11
11
  <div class="form-control autocomplete-embedded-icon-wrap">
12
- <%= render Primer::OcticonComponent.new(:search) %>
12
+ <%= render Primer::Beta::Octicon.new(:search) %>
13
13
  <% end %>
14
14
  <%= input %>
15
15
  <% if @is_clearable %>
@@ -5,6 +5,7 @@ module Primer
5
5
  class AutoComplete
6
6
  # Use `AutoCompleteItem` to list results of an auto-completed search.
7
7
  class Item < Primer::Component
8
+ warn_on_deprecated_slot_setter
8
9
  status :deprecated
9
10
 
10
11
  # @example Default
@@ -12,6 +12,7 @@ module Primer
12
12
  # However, please note that a visible label should almost always
13
13
  # be used unless there is compelling reason not to. A placeholder is not a label.
14
14
  class AutoComplete < Primer::Component
15
+ warn_on_deprecated_slot_setter
15
16
  status :deprecated
16
17
 
17
18
  # Customizable results list.
@@ -136,8 +137,8 @@ module Primer
136
137
 
137
138
  # add `input` and `results` without needing to explicitly call them in the view
138
139
  def before_render
139
- results(classes: "") unless results
140
- input(classes: "") unless input
140
+ with_results(classes: "") unless results?
141
+ with_input(classes: "") unless input?
141
142
  end
142
143
 
143
144
  private
@@ -2,7 +2,7 @@
2
2
  <%= render(Primer::BaseComponent.new(**@system_arguments)) do %>
3
3
  <% if @icon %>
4
4
  <div class="Banner-visual">
5
- <%= render(Primer::OcticonComponent.new(icon: @icon)) %>
5
+ <%= render(Primer::Beta::Octicon.new(icon: @icon)) %>
6
6
  </div>
7
7
  <% end %>
8
8
  <%= render(Primer::BaseComponent.new(**@message_arguments)) do %>
@@ -4,6 +4,7 @@ module Primer
4
4
  module Alpha
5
5
  # Use `Banner` to highlight important information.
6
6
  class Banner < Primer::Component
7
+ warn_on_deprecated_slot_setter
7
8
  status :alpha
8
9
 
9
10
  # A button or custom content that will render on the right-hand side of the component.
@@ -4,6 +4,8 @@ module Primer
4
4
  module Alpha
5
5
  # Use `ButtonMarketing` for actions (e.g. in forms). Use links for destinations, or moving from one page to another.
6
6
  class ButtonMarketing < Primer::Component
7
+ warn_on_deprecated_slot_setter
8
+
7
9
  DEFAULT_SCHEME = :default
8
10
  SCHEME_MAPPINGS = {
9
11
  DEFAULT_SCHEME => "",
@@ -18,6 +18,7 @@ module Primer
18
18
  # `aria-labelledby` relationship between the title and the unique id of
19
19
  # the dialog.
20
20
  class Dialog < Primer::Component
21
+ warn_on_deprecated_slot_setter
21
22
  status :alpha
22
23
  audited_at "2022-10-10"
23
24
 
@@ -58,7 +59,9 @@ module Primer
58
59
  )
59
60
  system_arguments[:id] = "dialog-show-#{@system_arguments[:id]}"
60
61
  system_arguments[:data] = (system_arguments[:data] || {}).merge({ "show-dialog-id": @system_arguments[:id] })
62
+ # rubocop:disable Primer/ComponentNameMigration
61
63
  Primer::ButtonComponent.new(**system_arguments)
64
+ # rubocop:enable Primer/ComponentNameMigration
62
65
  }
63
66
 
64
67
  # Header content.
@@ -7,6 +7,7 @@ module Primer
7
7
  # @accessibility
8
8
  # Always provide a meaningful `alt`.
9
9
  class Image < Primer::Component
10
+ warn_on_deprecated_slot_setter
10
11
  status :alpha
11
12
 
12
13
  # @example Default
@@ -2,7 +2,7 @@
2
2
  <% if loading.present? %>
3
3
  <%= loading %>
4
4
  <% else %>
5
- <%= render(Primer::SpinnerComponent.new(size: :large, flex: 1, "data-loading-slot": true)) %>
5
+ <%= render(Primer::Beta::Spinner.new(size: :large, flex: 1, "data-loading-slot": true)) %>
6
6
  <% end %>
7
7
 
8
8
  <input autocomplete="off" type="hidden" data-image-crop-input="x" name="cropped_x">
@@ -0,0 +1 @@
1
+ .Layout{--Layout-sidebar-width:220px;--Layout-gutter:16px;display:grid}@media (max-width:calc(544px - 0.02px)){.Layout{grid-auto-flow:row;grid-template-columns:1fr!important}.Layout .Layout-divider,.Layout .Layout-main,.Layout .Layout-sidebar{grid-column:1!important;width:100%!important}.Layout.Layout--sidebarPosition-flowRow-start .Layout-sidebar{grid-row:1}.Layout.Layout--sidebarPosition-flowRow-end .Layout-sidebar,.Layout.Layout--sidebarPosition-flowRow-start .Layout-main{grid-row:2/span 2}.Layout.Layout--sidebarPosition-flowRow-end .Layout-main{grid-row:1}.Layout.Layout--sidebarPosition-flowRow-none .Layout-sidebar{display:none}.Layout.Layout--divided{--Layout-gutter:0}.Layout.Layout--divided .Layout-divider{grid-row:2;height:1px}.Layout.Layout--divided .Layout-divider.Layout-divider--flowRow-hidden{display:none}.Layout.Layout--divided .Layout-divider.Layout-divider--flowRow-shallow{background:var(--color-canvas-inset);border-color:var(--color-border-default);border-style:solid;border-width:var(--primer-borderWidth-thin,1px) 0;height:8px;margin-right:0}.Layout.Layout--divided .Layout-main,.Layout.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-sidebar{grid-row:3/span 1}.Layout.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-main{grid-row:1}}@media (max-width:calc(768px - 0.02px)){.Layout.Layout--flowRow-until-md{grid-auto-flow:row;grid-template-columns:1fr!important}.Layout.Layout--flowRow-until-md .Layout-divider,.Layout.Layout--flowRow-until-md .Layout-main,.Layout.Layout--flowRow-until-md .Layout-sidebar{grid-column:1!important;width:100%!important}.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-start .Layout-sidebar{grid-row:1}.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-end .Layout-sidebar,.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-start .Layout-main{grid-row:2/span 2}.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-end .Layout-main{grid-row:1}.Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-none .Layout-sidebar{display:none}.Layout.Layout--flowRow-until-md.Layout--divided{--Layout-gutter:0}.Layout.Layout--flowRow-until-md.Layout--divided .Layout-divider{grid-row:2;height:1px}.Layout.Layout--flowRow-until-md.Layout--divided .Layout-divider.Layout-divider--flowRow-hidden{display:none}.Layout.Layout--flowRow-until-md.Layout--divided .Layout-divider.Layout-divider--flowRow-shallow{background:var(--color-canvas-inset);border-color:var(--color-border-default);border-style:solid;border-width:var(--primer-borderWidth-thin,1px) 0;height:8px;margin-right:0}.Layout.Layout--flowRow-until-md.Layout--divided .Layout-main,.Layout.Layout--flowRow-until-md.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-sidebar{grid-row:3/span 1}.Layout.Layout--flowRow-until-md.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-main{grid-row:1}}@media (max-width:calc(1012px - 0.02px)){.Layout.Layout--flowRow-until-lg{grid-auto-flow:row;grid-template-columns:1fr!important}.Layout.Layout--flowRow-until-lg .Layout-divider,.Layout.Layout--flowRow-until-lg .Layout-main,.Layout.Layout--flowRow-until-lg .Layout-sidebar{grid-column:1!important;width:100%!important}.Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-start .Layout-sidebar{grid-row:1}.Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-end .Layout-sidebar,.Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-start .Layout-main{grid-row:2/span 2}.Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-end .Layout-main{grid-row:1}.Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-none .Layout-sidebar{display:none}.Layout.Layout--flowRow-until-lg.Layout--divided{--Layout-gutter:0}.Layout.Layout--flowRow-until-lg.Layout--divided .Layout-divider{grid-row:2;height:1px}.Layout.Layout--flowRow-until-lg.Layout--divided .Layout-divider.Layout-divider--flowRow-hidden{display:none}.Layout.Layout--flowRow-until-lg.Layout--divided .Layout-divider.Layout-divider--flowRow-shallow{background:var(--color-canvas-inset);border-color:var(--color-border-default);border-style:solid;border-width:var(--primer-borderWidth-thin,1px) 0;height:8px;margin-right:0}.Layout.Layout--flowRow-until-lg.Layout--divided .Layout-main,.Layout.Layout--flowRow-until-lg.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-sidebar{grid-row:3/span 1}.Layout.Layout--flowRow-until-lg.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-main{grid-row:1}}.Layout{grid-gap:var(--Layout-gutter);grid-auto-flow:column;grid-template-columns:auto 0 minmax(0,calc(100% - var(--Layout-sidebar-width) - var(--Layout-gutter)))}.Layout .Layout-sidebar{grid-column:1}.Layout .Layout-divider{display:none}.Layout .Layout-main{grid-column:2/span 2}@media (min-width:1012px){.Layout{--Layout-gutter:24px}}.Layout.Layout--gutter-none{--Layout-gutter:0px}.Layout.Layout--gutter-condensed{--Layout-gutter:16px}@media (min-width:1012px){.Layout.Layout--gutter-spacious{--Layout-gutter:32px}}@media (min-width:1280px){.Layout.Layout--gutter-spacious{--Layout-gutter:40px}}@media (min-width:544px){.Layout{--Layout-sidebar-width:220px}}@media (min-width:768px){.Layout{--Layout-sidebar-width:256px}}@media (min-width:1012px){.Layout{--Layout-sidebar-width:296px}}@media (min-width:768px){.Layout.Layout--sidebar-narrow{--Layout-sidebar-width:240px}}@media (min-width:1012px){.Layout.Layout--sidebar-narrow{--Layout-sidebar-width:256px}.Layout.Layout--sidebar-wide{--Layout-sidebar-width:320px}}@media (min-width:1280px){.Layout.Layout--sidebar-wide{--Layout-sidebar-width:336px}}.Layout.Layout--sidebarPosition-start .Layout-sidebar{grid-column:1}.Layout.Layout--sidebarPosition-start .Layout-main{grid-column:2/span 2}.Layout.Layout--sidebarPosition-end{grid-template-columns:minmax(0,calc(100% - var(--Layout-sidebar-width) - var(--Layout-gutter))) 0 auto}.Layout.Layout--sidebarPosition-end .Layout-main{grid-column:1}.Layout.Layout--sidebarPosition-end .Layout-sidebar{grid-column:2/span 2}.Layout.Layout--divided .Layout-divider{background:var(--color-border-default);display:block;grid-column:2;margin-right:-1px;width:1px}.Layout.Layout--divided .Layout-main,.Layout.Layout--divided.Layout--sidebarPosition-end .Layout-sidebar{grid-column:3/span 1}.Layout.Layout--divided.Layout--sidebarPosition-end .Layout-main{grid-column:1}.Layout-divider{display:none;width:1px}.Layout-sidebar{width:var(--Layout-sidebar-width)}.Layout-main{min-width:0}.Layout-main .Layout-main-centered-lg,.Layout-main .Layout-main-centered-md,.Layout-main .Layout-main-centered-xl{margin-left:auto;margin-right:auto}.Layout-main .Layout-main-centered-lg>.container-lg,.Layout-main .Layout-main-centered-lg>.container-md,.Layout-main .Layout-main-centered-lg>.container-xl,.Layout-main .Layout-main-centered-md>.container-lg,.Layout-main .Layout-main-centered-md>.container-md,.Layout-main .Layout-main-centered-md>.container-xl,.Layout-main .Layout-main-centered-xl>.container-lg,.Layout-main .Layout-main-centered-xl>.container-md,.Layout-main .Layout-main-centered-xl>.container-xl{margin-left:0}.Layout-main .Layout-main-centered-md{max-width:calc(var(--primer-breakpoint-medium, 768px) + var(--Layout-sidebar-width) + var(--Layout-gutter))}.Layout-main .Layout-main-centered-lg{max-width:calc(var(--primer-breakpoint-large, 1012px) + var(--Layout-sidebar-width) + var(--Layout-gutter))}.Layout-main .Layout-main-centered-xl{max-width:calc(var(--primer-breakpoint-xlarge, 1280px) + var(--Layout-sidebar-width) + var(--Layout-gutter))}
@@ -0,0 +1 @@
1
+ {"name":"alpha/layout","selectors":[".Layout",".Layout .Layout-divider",".Layout .Layout-main",".Layout .Layout-sidebar",".Layout.Layout--sidebarPosition-flowRow-start .Layout-sidebar",".Layout.Layout--sidebarPosition-flowRow-end .Layout-sidebar",".Layout.Layout--sidebarPosition-flowRow-start .Layout-main",".Layout.Layout--sidebarPosition-flowRow-end .Layout-main",".Layout.Layout--sidebarPosition-flowRow-none .Layout-sidebar",".Layout.Layout--divided",".Layout.Layout--divided .Layout-divider",".Layout.Layout--divided .Layout-divider.Layout-divider--flowRow-hidden",".Layout.Layout--divided .Layout-divider.Layout-divider--flowRow-shallow",".Layout.Layout--divided .Layout-main",".Layout.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-sidebar",".Layout.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-main",".Layout.Layout--flowRow-until-md",".Layout.Layout--flowRow-until-md .Layout-divider",".Layout.Layout--flowRow-until-md .Layout-main",".Layout.Layout--flowRow-until-md .Layout-sidebar",".Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-start .Layout-sidebar",".Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-end .Layout-sidebar",".Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-start .Layout-main",".Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-end .Layout-main",".Layout.Layout--flowRow-until-md.Layout--sidebarPosition-flowRow-none .Layout-sidebar",".Layout.Layout--flowRow-until-md.Layout--divided",".Layout.Layout--flowRow-until-md.Layout--divided .Layout-divider",".Layout.Layout--flowRow-until-md.Layout--divided .Layout-divider.Layout-divider--flowRow-hidden",".Layout.Layout--flowRow-until-md.Layout--divided .Layout-divider.Layout-divider--flowRow-shallow",".Layout.Layout--flowRow-until-md.Layout--divided .Layout-main",".Layout.Layout--flowRow-until-md.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-sidebar",".Layout.Layout--flowRow-until-md.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-main",".Layout.Layout--flowRow-until-lg",".Layout.Layout--flowRow-until-lg .Layout-divider",".Layout.Layout--flowRow-until-lg .Layout-main",".Layout.Layout--flowRow-until-lg .Layout-sidebar",".Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-start .Layout-sidebar",".Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-end .Layout-sidebar",".Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-start .Layout-main",".Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-end .Layout-main",".Layout.Layout--flowRow-until-lg.Layout--sidebarPosition-flowRow-none .Layout-sidebar",".Layout.Layout--flowRow-until-lg.Layout--divided",".Layout.Layout--flowRow-until-lg.Layout--divided .Layout-divider",".Layout.Layout--flowRow-until-lg.Layout--divided .Layout-divider.Layout-divider--flowRow-hidden",".Layout.Layout--flowRow-until-lg.Layout--divided .Layout-divider.Layout-divider--flowRow-shallow",".Layout.Layout--flowRow-until-lg.Layout--divided .Layout-main",".Layout.Layout--flowRow-until-lg.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-sidebar",".Layout.Layout--flowRow-until-lg.Layout--divided.Layout--sidebarPosition-flowRow-end .Layout-main",".Layout.Layout--gutter-none",".Layout.Layout--gutter-condensed",".Layout.Layout--gutter-spacious",".Layout.Layout--sidebar-narrow",".Layout.Layout--sidebar-wide",".Layout.Layout--sidebarPosition-start .Layout-sidebar",".Layout.Layout--sidebarPosition-start .Layout-main",".Layout.Layout--sidebarPosition-end",".Layout.Layout--sidebarPosition-end .Layout-main",".Layout.Layout--sidebarPosition-end .Layout-sidebar",".Layout.Layout--divided.Layout--sidebarPosition-end .Layout-sidebar",".Layout.Layout--divided.Layout--sidebarPosition-end .Layout-main",".Layout-divider",".Layout-sidebar",".Layout-main",".Layout-main .Layout-main-centered-lg",".Layout-main .Layout-main-centered-md",".Layout-main .Layout-main-centered-xl",".Layout-main .Layout-main-centered-lg>.container-lg",".Layout-main .Layout-main-centered-lg>.container-md",".Layout-main .Layout-main-centered-lg>.container-xl",".Layout-main .Layout-main-centered-md>.container-lg",".Layout-main .Layout-main-centered-md>.container-md",".Layout-main .Layout-main-centered-md>.container-xl",".Layout-main .Layout-main-centered-xl>.container-lg",".Layout-main .Layout-main-centered-xl>.container-md",".Layout-main .Layout-main-centered-xl>.container-xl"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["layout.pcss"],"names":[],"mappings":"AAgFA,QAGE,4BAA6B,CAC7B,oBAAqB,CAHrB,YAkJF,CA7IE,wCANF,QA7EE,kBAAmB,CACnB,mCA+NF,CA7NE,qEAIE,uBAAyB,CADzB,oBAEF,CAGE,8DACE,UACF,CAQA,uHACE,iBACF,CAEA,yDACE,UACF,CAIA,6DACE,YACF,CAGF,wBAoBA,iBAJA,CAMA,wCAEE,UAAW,CADX,UAeF,CAZE,uEACE,YACF,CAEA,wEAGE,oCAAqC,CACrC,wCAAyC,CACzC,kBAAmB,CACnB,iDAAmD,CALnD,UAAW,CACX,cAKF,CA7BE,iHACE,iBACF,CAEA,yEACE,UACF,CAmCJ,CAGE,wCADF,iCAvFA,kBAAmB,CACnB,mCA0FA,CAxFA,gJAIE,uBAAyB,CADzB,oBAEF,CAGE,uFACE,UACF,CAQA,yKACE,iBACF,CAEA,kFACE,UACF,CAIA,sFACE,YACF,CAGF,iDAoBA,iBAJA,CAMA,iEAEE,UAAW,CADX,UAeF,CAZE,gGACE,YACF,CAEA,iGAGE,oCAAqC,CACrC,wCAAyC,CACzC,kBAAmB,CACnB,iDAAmD,CALnD,UAAW,CACX,cAKF,CA7BE,mKACE,iBACF,CAEA,kGACE,UACF,CAwCF,CAIA,yCADF,iCA7FA,kBAAmB,CACnB,mCAgGA,CA9FA,gJAIE,uBAAyB,CADzB,oBAEF,CAGE,uFACE,UACF,CAQA,yKACE,iBACF,CAEA,kFACE,UACF,CAIA,sFACE,YACF,CAGF,iDAoBA,iBAJA,CAMA,iEAEE,UAAW,CADX,UAeF,CAZE,gGACE,YACF,CAEA,iGAGE,oCAAqC,CACrC,wCAAyC,CACzC,kBAAmB,CACnB,iDAAmD,CALnD,UAAW,CACX,cAKF,CA7BE,mKACE,iBACF,CAEA,kGACE,UACF,CA8CF,CAnBJ,QA0BE,6BAA8B,CAF9B,qBAAsB,CACtB,sGA0HF,CAvHE,wBACE,aACF,CAEA,wBACE,YACF,CAEA,qBACE,oBACF,CAIA,0BA1CF,QA2CI,oBAwGJ,CAvGE,CAEA,4BAEE,mBACF,CAEA,iCACE,oBACF,CAGE,0BADF,gCAEI,oBAMJ,CALE,CAEA,0BALF,gCAMI,oBAEJ,CADE,CAIF,yBAlEF,QAmEI,4BAgFJ,CA/EE,CAEA,yBAtEF,QAuEI,4BA4EJ,CA3EE,CAEA,0BA1EF,QA2EI,4BAwEJ,CAvEE,CAGE,yBADF,+BAEI,4BAMJ,CALE,CAEA,0BALF,+BAMI,4BAEJ,CAEA,6BAEI,4BAMJ,CAXE,CAQA,0BALF,6BAMI,4BAEJ,CADE,CAMA,sDACE,aACF,CAEA,mDACE,oBACF,CAGF,oCACE,sGASF,CAPE,iDACE,aACF,CAEA,oDACE,oBACF,CAMA,wCAKE,sCAAuC,CAJvC,aAAc,CACd,aAAc,CAEd,iBAAkB,CADlB,SAGF,CAOE,yGACE,oBACF,CAEA,iEACE,aACF,CAKN,gBACE,YAAa,CACb,SACF,CAEA,gBACE,iCACF,CAEA,aACE,WA4BF,CAxBE,kHAIE,gBAAiB,CADjB,iBAQF,CALE,odAGE,aACF,CAGF,sCACE,2GACF,CAEA,sCACE,2GACF,CAEA,sCACE,4GACF","file":"layout.css","sourcesContent":["/* Layout */\n\n@define-mixin flow-as-row {\n grid-auto-flow: row;\n grid-template-columns: 1fr !important;\n\n & .Layout-sidebar,\n & .Layout-divider,\n & .Layout-main {\n width: 100% !important;\n grid-column: 1 !important;\n }\n\n &.Layout--sidebarPosition-flowRow-start {\n & .Layout-sidebar {\n grid-row: 1;\n }\n\n & .Layout-main {\n grid-row: 2 / span 2;\n }\n }\n\n &.Layout--sidebarPosition-flowRow-end {\n & .Layout-sidebar {\n grid-row: 2 / span 2;\n }\n\n & .Layout-main {\n grid-row: 1;\n }\n }\n\n &.Layout--sidebarPosition-flowRow-none {\n & .Layout-sidebar {\n display: none;\n }\n }\n\n &.Layout--divided {\n @mixin flow-as-row-divider;\n\n & .Layout-main {\n grid-row: 3 / span 1;\n }\n\n &.Layout--sidebarPosition-flowRow-end {\n & .Layout-sidebar {\n grid-row: 3 / span 1;\n }\n\n & .Layout-main {\n grid-row: 1;\n }\n }\n }\n}\n\n@define-mixin flow-as-row-divider {\n --Layout-gutter: 0;\n\n & .Layout-divider {\n height: 1px;\n grid-row: 2;\n\n &.Layout-divider--flowRow-hidden {\n display: none;\n }\n\n &.Layout-divider--flowRow-shallow {\n height: 8px;\n margin-right: 0;\n background: var(--color-canvas-inset);\n border-color: var(--color-border-default);\n border-style: solid;\n border-width: var(--primer-borderWidth-thin, 1px) 0;\n }\n }\n}\n\n.Layout {\n display: grid;\n\n --Layout-sidebar-width: 220px;\n --Layout-gutter: 16px;\n\n @media (max-width: calc(544px - 0.02px)) {\n @mixin flow-as-row;\n }\n\n &.Layout--flowRow-until-md {\n @media (max-width: calc(768px - 0.02px)) {\n @mixin flow-as-row;\n }\n }\n\n &.Layout--flowRow-until-lg {\n @media (max-width: calc(1012px - 0.02px)) {\n @mixin flow-as-row;\n }\n }\n\n /* Flow as column */\n\n grid-auto-flow: column;\n grid-template-columns: auto 0 minmax(0, calc(100% - var(--Layout-sidebar-width) - var(--Layout-gutter))); /* sidebar column, separator, main column */\n grid-gap: var(--Layout-gutter);\n\n & .Layout-sidebar {\n grid-column: 1;\n }\n\n & .Layout-divider {\n display: none;\n }\n\n & .Layout-main {\n grid-column: 2 / span 2;\n }\n\n /* Gutter spacing */\n\n @media (min-width: 1012px) {\n --Layout-gutter: 24px;\n }\n\n &.Layout--gutter-none {\n /* stylelint-disable-next-line length-zero-no-unit */\n --Layout-gutter: 0px; /* Neds px in value */\n }\n\n &.Layout--gutter-condensed {\n --Layout-gutter: 16px;\n }\n\n &.Layout--gutter-spacious {\n @media (min-width: 1012px) {\n --Layout-gutter: 32px;\n }\n\n @media (min-width: 1280px) {\n --Layout-gutter: 40px;\n }\n }\n\n /* Sidebar width */\n @media (min-width: 544px) {\n --Layout-sidebar-width: 220px;\n }\n\n @media (min-width: 768px) {\n --Layout-sidebar-width: 256px;\n }\n\n @media (min-width: 1012px) {\n --Layout-sidebar-width: 296px;\n }\n\n &.Layout--sidebar-narrow {\n @media (min-width: 768px) {\n --Layout-sidebar-width: 240px;\n }\n\n @media (min-width: 1012px) {\n --Layout-sidebar-width: 256px;\n }\n }\n\n &.Layout--sidebar-wide {\n @media (min-width: 1012px) {\n --Layout-sidebar-width: 320px;\n }\n\n @media (min-width: 1280px) {\n --Layout-sidebar-width: 336px;\n }\n }\n\n /* Sidebar position */\n\n &.Layout--sidebarPosition-start {\n & .Layout-sidebar {\n grid-column: 1;\n }\n\n & .Layout-main {\n grid-column: 2 / span 2;\n }\n }\n\n &.Layout--sidebarPosition-end {\n grid-template-columns: minmax(0, calc(100% - var(--Layout-sidebar-width) - var(--Layout-gutter))) 0 auto;\n\n & .Layout-main {\n grid-column: 1;\n }\n\n & .Layout-sidebar {\n grid-column: 2 / span 2;\n }\n }\n\n /* Sidebar divider */\n\n &.Layout--divided {\n & .Layout-divider {\n display: block;\n grid-column: 2;\n width: 1px;\n margin-right: -1px;\n background: var(--color-border-default);\n }\n\n & .Layout-main {\n grid-column: 3 / span 1;\n }\n\n &.Layout--sidebarPosition-end {\n & .Layout-sidebar {\n grid-column: 3 / span 1;\n }\n\n & .Layout-main {\n grid-column: 1;\n }\n }\n }\n}\n\n.Layout-divider {\n display: none;\n width: 1px;\n}\n\n.Layout-sidebar {\n width: var(--Layout-sidebar-width);\n}\n\n.Layout-main {\n min-width: 0;\n\n /* Centered main column\n ** FIXME: right-aligned sidebar */\n & .Layout-main-centered-md,\n & .Layout-main-centered-lg,\n & .Layout-main-centered-xl {\n margin-right: auto;\n margin-left: auto;\n\n & > .container-md,\n & > .container-lg,\n & > .container-xl {\n margin-left: 0;\n }\n }\n\n & .Layout-main-centered-md {\n max-width: calc(var(--primer-breakpoint-medium, 768px) + var(--Layout-sidebar-width) + var(--Layout-gutter));\n }\n\n & .Layout-main-centered-lg {\n max-width: calc(var(--primer-breakpoint-large, 1012px) + var(--Layout-sidebar-width) + var(--Layout-gutter));\n }\n\n & .Layout-main-centered-xl {\n max-width: calc(var(--primer-breakpoint-xlarge, 1280px) + var(--Layout-sidebar-width) + var(--Layout-gutter));\n }\n}\n"]}
@@ -0,0 +1,268 @@
1
+ /* Layout */
2
+
3
+ @define-mixin flow-as-row {
4
+ grid-auto-flow: row;
5
+ grid-template-columns: 1fr !important;
6
+
7
+ & .Layout-sidebar,
8
+ & .Layout-divider,
9
+ & .Layout-main {
10
+ width: 100% !important;
11
+ grid-column: 1 !important;
12
+ }
13
+
14
+ &.Layout--sidebarPosition-flowRow-start {
15
+ & .Layout-sidebar {
16
+ grid-row: 1;
17
+ }
18
+
19
+ & .Layout-main {
20
+ grid-row: 2 / span 2;
21
+ }
22
+ }
23
+
24
+ &.Layout--sidebarPosition-flowRow-end {
25
+ & .Layout-sidebar {
26
+ grid-row: 2 / span 2;
27
+ }
28
+
29
+ & .Layout-main {
30
+ grid-row: 1;
31
+ }
32
+ }
33
+
34
+ &.Layout--sidebarPosition-flowRow-none {
35
+ & .Layout-sidebar {
36
+ display: none;
37
+ }
38
+ }
39
+
40
+ &.Layout--divided {
41
+ @mixin flow-as-row-divider;
42
+
43
+ & .Layout-main {
44
+ grid-row: 3 / span 1;
45
+ }
46
+
47
+ &.Layout--sidebarPosition-flowRow-end {
48
+ & .Layout-sidebar {
49
+ grid-row: 3 / span 1;
50
+ }
51
+
52
+ & .Layout-main {
53
+ grid-row: 1;
54
+ }
55
+ }
56
+ }
57
+ }
58
+
59
+ @define-mixin flow-as-row-divider {
60
+ --Layout-gutter: 0;
61
+
62
+ & .Layout-divider {
63
+ height: 1px;
64
+ grid-row: 2;
65
+
66
+ &.Layout-divider--flowRow-hidden {
67
+ display: none;
68
+ }
69
+
70
+ &.Layout-divider--flowRow-shallow {
71
+ height: 8px;
72
+ margin-right: 0;
73
+ background: var(--color-canvas-inset);
74
+ border-color: var(--color-border-default);
75
+ border-style: solid;
76
+ border-width: var(--primer-borderWidth-thin, 1px) 0;
77
+ }
78
+ }
79
+ }
80
+
81
+ .Layout {
82
+ display: grid;
83
+
84
+ --Layout-sidebar-width: 220px;
85
+ --Layout-gutter: 16px;
86
+
87
+ @media (max-width: calc(544px - 0.02px)) {
88
+ @mixin flow-as-row;
89
+ }
90
+
91
+ &.Layout--flowRow-until-md {
92
+ @media (max-width: calc(768px - 0.02px)) {
93
+ @mixin flow-as-row;
94
+ }
95
+ }
96
+
97
+ &.Layout--flowRow-until-lg {
98
+ @media (max-width: calc(1012px - 0.02px)) {
99
+ @mixin flow-as-row;
100
+ }
101
+ }
102
+
103
+ /* Flow as column */
104
+
105
+ grid-auto-flow: column;
106
+ grid-template-columns: auto 0 minmax(0, calc(100% - var(--Layout-sidebar-width) - var(--Layout-gutter))); /* sidebar column, separator, main column */
107
+ grid-gap: var(--Layout-gutter);
108
+
109
+ & .Layout-sidebar {
110
+ grid-column: 1;
111
+ }
112
+
113
+ & .Layout-divider {
114
+ display: none;
115
+ }
116
+
117
+ & .Layout-main {
118
+ grid-column: 2 / span 2;
119
+ }
120
+
121
+ /* Gutter spacing */
122
+
123
+ @media (min-width: 1012px) {
124
+ --Layout-gutter: 24px;
125
+ }
126
+
127
+ &.Layout--gutter-none {
128
+ /* stylelint-disable-next-line length-zero-no-unit */
129
+ --Layout-gutter: 0px; /* Neds px in value */
130
+ }
131
+
132
+ &.Layout--gutter-condensed {
133
+ --Layout-gutter: 16px;
134
+ }
135
+
136
+ &.Layout--gutter-spacious {
137
+ @media (min-width: 1012px) {
138
+ --Layout-gutter: 32px;
139
+ }
140
+
141
+ @media (min-width: 1280px) {
142
+ --Layout-gutter: 40px;
143
+ }
144
+ }
145
+
146
+ /* Sidebar width */
147
+ @media (min-width: 544px) {
148
+ --Layout-sidebar-width: 220px;
149
+ }
150
+
151
+ @media (min-width: 768px) {
152
+ --Layout-sidebar-width: 256px;
153
+ }
154
+
155
+ @media (min-width: 1012px) {
156
+ --Layout-sidebar-width: 296px;
157
+ }
158
+
159
+ &.Layout--sidebar-narrow {
160
+ @media (min-width: 768px) {
161
+ --Layout-sidebar-width: 240px;
162
+ }
163
+
164
+ @media (min-width: 1012px) {
165
+ --Layout-sidebar-width: 256px;
166
+ }
167
+ }
168
+
169
+ &.Layout--sidebar-wide {
170
+ @media (min-width: 1012px) {
171
+ --Layout-sidebar-width: 320px;
172
+ }
173
+
174
+ @media (min-width: 1280px) {
175
+ --Layout-sidebar-width: 336px;
176
+ }
177
+ }
178
+
179
+ /* Sidebar position */
180
+
181
+ &.Layout--sidebarPosition-start {
182
+ & .Layout-sidebar {
183
+ grid-column: 1;
184
+ }
185
+
186
+ & .Layout-main {
187
+ grid-column: 2 / span 2;
188
+ }
189
+ }
190
+
191
+ &.Layout--sidebarPosition-end {
192
+ grid-template-columns: minmax(0, calc(100% - var(--Layout-sidebar-width) - var(--Layout-gutter))) 0 auto;
193
+
194
+ & .Layout-main {
195
+ grid-column: 1;
196
+ }
197
+
198
+ & .Layout-sidebar {
199
+ grid-column: 2 / span 2;
200
+ }
201
+ }
202
+
203
+ /* Sidebar divider */
204
+
205
+ &.Layout--divided {
206
+ & .Layout-divider {
207
+ display: block;
208
+ grid-column: 2;
209
+ width: 1px;
210
+ margin-right: -1px;
211
+ background: var(--color-border-default);
212
+ }
213
+
214
+ & .Layout-main {
215
+ grid-column: 3 / span 1;
216
+ }
217
+
218
+ &.Layout--sidebarPosition-end {
219
+ & .Layout-sidebar {
220
+ grid-column: 3 / span 1;
221
+ }
222
+
223
+ & .Layout-main {
224
+ grid-column: 1;
225
+ }
226
+ }
227
+ }
228
+ }
229
+
230
+ .Layout-divider {
231
+ display: none;
232
+ width: 1px;
233
+ }
234
+
235
+ .Layout-sidebar {
236
+ width: var(--Layout-sidebar-width);
237
+ }
238
+
239
+ .Layout-main {
240
+ min-width: 0;
241
+
242
+ /* Centered main column
243
+ ** FIXME: right-aligned sidebar */
244
+ & .Layout-main-centered-md,
245
+ & .Layout-main-centered-lg,
246
+ & .Layout-main-centered-xl {
247
+ margin-right: auto;
248
+ margin-left: auto;
249
+
250
+ & > .container-md,
251
+ & > .container-lg,
252
+ & > .container-xl {
253
+ margin-left: 0;
254
+ }
255
+ }
256
+
257
+ & .Layout-main-centered-md {
258
+ max-width: calc(var(--primer-breakpoint-medium, 768px) + var(--Layout-sidebar-width) + var(--Layout-gutter));
259
+ }
260
+
261
+ & .Layout-main-centered-lg {
262
+ max-width: calc(var(--primer-breakpoint-large, 1012px) + var(--Layout-sidebar-width) + var(--Layout-gutter));
263
+ }
264
+
265
+ & .Layout-main-centered-xl {
266
+ max-width: calc(var(--primer-breakpoint-xlarge, 1280px) + var(--Layout-sidebar-width) + var(--Layout-gutter));
267
+ }
268
+ }
@@ -0,0 +1 @@
1
+ {"name":"alpha/menu","selectors":[".menu",".menu-item",".menu-item:first-child",".menu-item:first-child:before",".menu-item:last-child",".menu-item:last-child:before",".menu-item:hover",".menu-item:active",".menu-item.selected",".menu-item[aria-current]:not([aria-current=false])",".menu-item[aria-selected=true]",":is(.menu-item.selected",".menu-item[aria-current]:not([aria-current=false])):before",".menu-item .octicon",".menu-item .Counter",".menu-item .menu-warning",".menu-item .avatar",".menu-item.alert .Counter",".menu-heading",".menu-heading:hover",".menu-heading:first-child",".menu-heading:last-child"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["menu.pcss"],"names":[],"mappings":"AAIA,MAGE,4CAA6C,CAC7C,2EAA6E,CAC7E,mDAAqD,CAHrD,eAAgB,CADhB,iDAKF,CAEA,WAKE,gFAAkF,CADlF,6BAA8B,CAF9B,aAAc,CACd,yHAA4H,CAF5H,iBA+EF,CAzEE,uBACE,YAAa,CAEb,6DAKF,CAHE,qDAHA,4DAKA,CAGF,sBACE,eAAgB,CAChB,gEAMF,CAHE,mDAFA,+DAIA,CAGF,iBAEE,4CAA6C,CAD7C,oBAEF,CAEA,kBACE,2CACF,CAEA,sGAIE,4CAA6C,CAD7C,cAYF,CATE,kHAOE,kDAAmD,CAJnD,QAAS,CAGT,UAAW,CAFX,MAAO,CAHP,iBAAkB,CAClB,KAAM,CAGN,SAGF,CAGF,oBAGE,2BAA4B,CAD5B,iDAAmD,CAEnD,iBAAkB,CAHlB,UAIF,CAEA,oBACE,WAAY,CACZ,+CACF,CAEA,yBAEE,+BAAgC,CADhC,WAEF,CAEA,mBACE,UAAW,CACX,gDACF,CAGE,0BACE,4BACF,CAIJ,cAQE,gFAAkF,CADlF,6BAA8B,CAN9B,aAAc,CAId,iBAAkB,CAClB,gDAAkD,CAFlD,eAAgB,CADhB,YAAa,CADb,yHAsBF,CAdE,oBACE,oBACF,CAEA,0BACE,4DAA8D,CAC9D,6DACF,CAEA,yBACE,eAAgB,CAEhB,+DAAiE,CADjE,gEAEF","file":"menu.css","sourcesContent":["/* menu */\n\n/* A menu on the side of a page, defaults to left side. e.g. github.com/about */\n\n.menu {\n margin-bottom: var(--primer-stack-gap-normal, 16px);\n list-style: none;\n background-color: var(--color-canvas-default);\n border: var(--primer-borderWidth-thin, 1px) solid var(--color-border-default);\n border-radius: var(--primer-borderRadius-medium, 6px);\n}\n\n.menu-item {\n position: relative;\n display: block;\n padding: var(--primer-control-medium-paddingInline-condensed, 8px) var(--primer-control-medium-paddingInline-spacious, 16px);\n color: var(--color-fg-default);\n border-bottom: var(--primer-borderWidth-thin, 1px) solid var(--color-border-muted);\n\n &:first-child {\n border-top: 0;\n border-top-left-radius: var(--primer-borderRadius-medium, 6px);\n border-top-right-radius: var(--primer-borderRadius-medium, 6px);\n\n &::before {\n border-top-left-radius: var(--primer-borderRadius-medium, 6px);\n }\n }\n\n &:last-child {\n border-bottom: 0;\n border-bottom-right-radius: var(--primer-borderRadius-medium, 6px);\n border-bottom-left-radius: var(--primer-borderRadius-medium, 6px);\n\n &::before {\n border-bottom-left-radius: var(--primer-borderRadius-medium, 6px);\n }\n }\n\n &:hover {\n text-decoration: none;\n background-color: var(--color-neutral-subtle);\n }\n\n &:active {\n background-color: var(--color-canvas-subtle);\n }\n\n &.selected,\n &[aria-selected='true'],\n &[aria-current]:not([aria-current='false']) {\n cursor: default;\n background-color: var(--color-menu-bg-active);\n\n &::before {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: 2px;\n content: '';\n background-color: var(--color-primer-border-active);\n }\n }\n\n & .octicon {\n width: 16px;\n margin-right: var(--primer-control-medium-gap, 8px);\n color: var(--color-fg-muted);\n text-align: center;\n }\n\n & .Counter {\n float: right;\n margin-left: var(--primer-control-small-gap, 4px);\n }\n\n & .menu-warning {\n float: right;\n color: var(--color-attention-fg);\n }\n\n & .avatar {\n float: left;\n margin-right: var(--primer-control-small-gap, 4px);\n }\n\n &.alert {\n & .Counter {\n color: var(--color-danger-fg);\n }\n }\n}\n\n.menu-heading {\n display: block;\n padding: var(--primer-control-medium-paddingInline-condensed, 8px) var(--primer-control-medium-paddingInline-spacious, 16px);\n margin-top: 0;\n margin-bottom: 0;\n font-size: inherit;\n font-weight: var(--base-text-weight-semibold, 600);\n color: var(--color-fg-default);\n border-bottom: var(--primer-borderWidth-thin, 1px) solid var(--color-border-muted);\n\n &:hover {\n text-decoration: none;\n }\n\n &:first-child {\n border-top-left-radius: var(--primer-borderRadius-medium, 6px);\n border-top-right-radius: var(--primer-borderRadius-medium, 6px);\n }\n\n &:last-child {\n border-bottom: 0;\n border-bottom-right-radius: var(--primer-borderRadius-medium, 6px);\n border-bottom-left-radius: var(--primer-borderRadius-medium, 6px);\n }\n}\n"]}
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Alpha
5
+ # Use `Menu` to create vertical lists of navigational links.
6
+ class Menu < Primer::Component
7
+ HEADING_TAG_OPTIONS = [:h1, :h2, :h3, :h4, :h5, :h6].freeze
8
+ HEADING_TAG_FALLBACK = :h2
9
+
10
+ # Optional menu heading
11
+ #
12
+ # @param tag [Symbol] <%= one_of(Primer::Alpha::Menu::HEADING_TAG_OPTIONS) %>
13
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
14
+ renders_one :heading, lambda { |tag:, **system_arguments|
15
+ system_arguments[:tag] = fetch_or_fallback(HEADING_TAG_OPTIONS, tag, HEADING_TAG_FALLBACK)
16
+ system_arguments[:classes] = class_names(
17
+ "menu-heading",
18
+ system_arguments[:classes]
19
+ )
20
+
21
+ Primer::BaseComponent.new(**system_arguments)
22
+ }
23
+
24
+ # Required list of navigational links
25
+ #
26
+ # @param href [String] URL to be used for the Link
27
+ # @param selected [Boolean] Whether the item is the current selection
28
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
29
+ renders_many :items, lambda { |href:, selected: false, **system_arguments|
30
+ deny_tag_argument(**system_arguments)
31
+ system_arguments[:tag] = :a
32
+ system_arguments[:href] = href
33
+ system_arguments[:"aria-current"] = :page if selected
34
+ system_arguments[:classes] = class_names(
35
+ "menu-item",
36
+ system_arguments[:classes]
37
+ )
38
+
39
+ Primer::BaseComponent.new(**system_arguments)
40
+ }
41
+
42
+ # @example Default
43
+ # <%= render(Primer::Alpha::Menu.new) do |c| %>
44
+ # <% c.with_heading(tag: :h2) do %>
45
+ # Heading
46
+ # <% end %>
47
+ # <% c.with_item(selected: true, href: "#url") do %>
48
+ # Item 1
49
+ # <% end %>
50
+ # <% c.with_item(href: "#url") do %>
51
+ # <%= render(Primer::Beta::Octicon.new("check")) %>
52
+ # With Icon
53
+ # <% end %>
54
+ # <% c.with_item(href: "#url") do %>
55
+ # <%= render(Primer::Beta::Octicon.new("check")) %>
56
+ # With Icon and Counter
57
+ # <%= render(Primer::Beta::Counter.new(count: 25)) %>
58
+ # <% end %>
59
+ # <% end %>
60
+ #
61
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
62
+ def initialize(**system_arguments)
63
+ @system_arguments = deny_tag_argument(**system_arguments)
64
+ @system_arguments[:tag] = :nav
65
+ @system_arguments[:classes] = class_names(
66
+ "menu",
67
+ @system_arguments[:classes]
68
+ )
69
+ end
70
+
71
+ def render?
72
+ items.any?
73
+ end
74
+ end
75
+ end
76
+ end