primer_view_components 0.0.114 → 0.0.116

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +52 -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/item.rb +6 -6
  8. data/app/components/primer/alpha/auto_complete/auto_complete.html.erb +1 -1
  9. data/app/components/primer/alpha/auto_complete.rb +10 -10
  10. data/app/components/primer/alpha/banner.html.erb +1 -1
  11. data/app/components/primer/alpha/dialog.rb +2 -0
  12. data/app/components/primer/alpha/dropdown/menu.rb +2 -0
  13. data/app/components/primer/alpha/dropdown.html.erb +3 -3
  14. data/app/components/primer/alpha/image_crop.html.erb +1 -1
  15. data/app/components/primer/alpha/layout.css +1 -0
  16. data/app/components/primer/alpha/layout.css.json +1 -0
  17. data/app/components/primer/alpha/layout.css.map +1 -0
  18. data/app/components/primer/alpha/layout.pcss +268 -0
  19. data/app/components/primer/alpha/layout.rb +1 -1
  20. data/app/components/primer/{menu_component.css → alpha/menu.css} +0 -0
  21. data/app/components/primer/alpha/menu.css.json +1 -0
  22. data/app/components/primer/alpha/menu.css.map +1 -0
  23. data/app/components/primer/{menu_component.html.erb → alpha/menu.html.erb} +0 -0
  24. data/app/components/primer/{menu_component.pcss → alpha/menu.pcss} +0 -0
  25. data/app/components/primer/alpha/menu.rb +76 -0
  26. data/app/components/primer/{octicon_symbols_component.html.erb → alpha/octicon_symbols.html.erb} +0 -0
  27. data/app/components/primer/alpha/octicon_symbols.rb +59 -0
  28. data/app/components/primer/alpha/segmented_control.css +1 -1
  29. data/app/components/primer/alpha/segmented_control.css.json +1 -1
  30. data/app/components/primer/alpha/segmented_control.css.map +1 -1
  31. data/app/components/primer/alpha/segmented_control.pcss +12 -0
  32. data/app/components/primer/alpha/segmented_control.rb +5 -5
  33. data/app/components/primer/alpha/tab_panels.rb +6 -6
  34. data/app/components/primer/alpha/toggle_switch.html.erb +2 -2
  35. data/app/components/primer/alpha/toggle_switch.rb +6 -6
  36. data/app/components/primer/alpha/tool_tip.js +77 -69
  37. data/app/components/primer/alpha/tool_tip.ts +63 -51
  38. data/app/components/primer/alpha/underline_panels.rb +6 -6
  39. data/app/components/primer/beta/auto_complete/item.rb +5 -4
  40. data/app/components/primer/beta/auto_complete.rb +15 -13
  41. data/app/components/primer/beta/avatar_stack.rb +2 -0
  42. data/app/components/primer/beta/blankslate.rb +48 -47
  43. data/app/components/primer/beta/border_box/header.rb +2 -0
  44. data/app/components/primer/beta/border_box.rb +2 -0
  45. data/app/components/primer/beta/breadcrumbs.rb +1 -0
  46. data/app/components/primer/beta/button.css +1 -1
  47. data/app/components/primer/beta/button.css.json +1 -1
  48. data/app/components/primer/beta/button.css.map +1 -1
  49. data/app/components/primer/beta/button.pcss +5 -0
  50. data/app/components/primer/beta/button.rb +8 -7
  51. data/app/components/primer/beta/button_group.rb +3 -0
  52. data/app/components/primer/beta/clipboard_copy.html.erb +2 -2
  53. data/app/components/primer/beta/close_button.rb +1 -1
  54. data/app/components/primer/beta/details.rb +6 -3
  55. data/app/components/primer/beta/flash.rb +1 -0
  56. data/app/components/primer/beta/icon_button.html.erb +1 -1
  57. data/app/components/primer/beta/link.rb +1 -0
  58. data/app/components/primer/{octicon_component.html.erb → beta/octicon.html.erb} +0 -0
  59. data/app/components/primer/beta/octicon.rb +89 -0
  60. data/app/components/primer/beta/popover.rb +1 -0
  61. data/app/components/primer/beta/progress_bar.rb +7 -7
  62. data/app/components/primer/beta/relative_time.rb +1 -1
  63. data/app/components/primer/{spinner_component.html.erb → beta/spinner.html.erb} +0 -0
  64. data/app/components/primer/beta/spinner.rb +45 -0
  65. data/app/components/primer/beta/truncate.rb +3 -2
  66. data/app/components/primer/blankslate_component.rb +3 -3
  67. data/app/components/primer/button_component.rb +5 -5
  68. data/app/components/primer/component.rb +1 -0
  69. data/app/components/primer/dropdown_menu_component.rb +3 -3
  70. data/app/components/primer/icon_button.html.erb +2 -2
  71. data/app/components/primer/local_time.rb +2 -0
  72. data/app/components/primer/menu_component.rb +2 -69
  73. data/app/components/primer/navigation/tab_component.rb +2 -2
  74. data/app/components/primer/octicon_component.rb +2 -81
  75. data/app/components/primer/octicon_symbols_component.rb +2 -52
  76. data/app/components/primer/primer.d.ts +2 -0
  77. data/app/components/primer/primer.js +2 -0
  78. data/app/components/primer/primer.pcss +2 -1
  79. data/app/components/primer/primer.ts +2 -0
  80. data/app/components/primer/spinner_component.rb +2 -38
  81. data/app/components/primer/time_ago_component.rb +1 -1
  82. data/app/components/primer/timeline_item_component.rb +2 -2
  83. data/app/forms/immediate_validation_form.rb +29 -0
  84. data/app/forms/multi_input_form.rb +4 -2
  85. data/app/lib/primer/css/layout.css +1 -378
  86. data/app/lib/primer/css/layout.css.json +1 -1
  87. data/app/lib/primer/octicon/cache.rb +1 -1
  88. data/app/lib/primer/view_helper.rb +1 -1
  89. data/lib/primer/deprecations.yml +26 -0
  90. data/lib/primer/forms/builder.rb +47 -8
  91. data/lib/primer/forms/check_box.html.erb +3 -1
  92. data/lib/primer/forms/dsl/form_reference_input.rb +25 -2
  93. data/lib/primer/forms/dsl/input.rb +50 -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/form_reference.html.erb +1 -1
  100. data/lib/primer/forms/form_reference.rb +4 -0
  101. data/lib/primer/forms/multi.html.erb +6 -2
  102. data/lib/primer/forms/primer_multi_input.d.ts +10 -0
  103. data/lib/primer/forms/primer_multi_input.js +45 -0
  104. data/lib/primer/forms/primer_multi_input.ts +46 -0
  105. data/lib/primer/forms/primer_text_field.d.ts +1 -0
  106. data/lib/primer/forms/primer_text_field.js +62 -0
  107. data/lib/primer/forms/primer_text_field.ts +48 -0
  108. data/lib/primer/forms/radio_button.html.erb +3 -1
  109. data/lib/primer/forms/text_field.html.erb +8 -8
  110. data/lib/primer/forms/text_field.rb +11 -0
  111. data/lib/primer/view_components/linters/close_button_component_migration_counter.rb +1 -1
  112. data/lib/primer/view_components/version.rb +1 -1
  113. data/lib/tasks/docs.rake +5 -5
  114. data/lib/tasks/helpers/ast_traverser.rb +1 -1
  115. data/previews/primer/alpha/action_list_preview.rb +1 -1
  116. data/previews/primer/alpha/auto_complete_preview.rb +62 -6
  117. data/previews/primer/alpha/layout_preview.rb +179 -6
  118. data/previews/primer/{menu_component_preview → alpha/menu_preview}/default.html.erb +3 -3
  119. data/previews/primer/{menu_component_preview → alpha/menu_preview}/playground.html.erb +3 -3
  120. data/previews/primer/alpha/menu_preview.rb +14 -0
  121. data/previews/primer/alpha/tab_panels_preview.rb +8 -8
  122. data/previews/primer/alpha/toggle_switch_preview.rb +11 -9
  123. data/previews/primer/beta/auto_complete_preview/with_submit_button.html.erb +1 -1
  124. data/previews/primer/beta/auto_complete_preview.rb +19 -17
  125. data/previews/primer/beta/details_preview.rb +6 -6
  126. data/previews/primer/beta/octicon_preview.rb +24 -0
  127. data/previews/primer/beta/spinner_preview.rb +22 -0
  128. data/previews/primer/forms/forms_preview/immediate_validation_form.html.erb +3 -0
  129. data/previews/primer/forms/forms_preview/multi_input_form.html.erb +12 -1
  130. data/previews/primer/forms/forms_preview.rb +2 -0
  131. data/previews/primer/local_time_component_preview.rb +3 -0
  132. data/previews/primer/time_ago_component_preview.rb +3 -0
  133. data/previews/primer/url_helpers.rb +15 -0
  134. data/static/arguments.json +159 -159
  135. data/static/audited_at.json +4 -0
  136. data/static/constants.json +42 -34
  137. data/static/statuses.json +10 -6
  138. metadata +32 -15
  139. data/app/components/primer/menu_component.css.json +0 -1
  140. data/app/components/primer/menu_component.css.map +0 -1
  141. data/previews/primer/menu_component_preview.rb +0 -12
  142. data/previews/primer/octicon_component_preview.rb +0 -22
  143. data/previews/primer/spinner_component_preview.rb +0 -20
@@ -34,7 +34,7 @@ module Primer
34
34
 
35
35
  # An icon, avatar, SVG, or custom content that will render to the left of the label.
36
36
  #
37
- # To render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by <%= link_to_component(Primer::OcticonComponent) %>.
37
+ # To render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by <%= link_to_component(Primer::Beta::Octicon) %>.
38
38
  #
39
39
  # To render an avatar, call the `with_leading_visual_avatar` method, which accepts the arguments accepted by <%= link_to_component(Primer::Beta::Avatar) %>.
40
40
  #
@@ -42,7 +42,7 @@ module Primer
42
42
  #
43
43
  # To render custom content, call the `with_leading_visual_content` method and pass a block that returns a string.
44
44
  renders_one :leading_visual, types: {
45
- icon: Primer::OcticonComponent,
45
+ icon: Primer::Beta::Octicon,
46
46
  avatar: ->(**kwargs) { Primer::Beta::Avatar.new(**{ **kwargs, size: 16 }) },
47
47
  svg: lambda { |**system_arguments|
48
48
  Primer::BaseComponent.new(tag: :svg, width: "16", height: "16", **system_arguments)
@@ -55,11 +55,11 @@ module Primer
55
55
  # Used internally.
56
56
  #
57
57
  # @private
58
- renders_one :private_leading_action_icon, Primer::OcticonComponent
58
+ renders_one :private_leading_action_icon, Primer::Beta::Octicon
59
59
 
60
60
  # An icon, label, counter, or text to render to the right of the label.
61
61
  #
62
- # To render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by <%= link_to_component(Primer::OcticonComponent) %>.
62
+ # To render an icon, call the `with_leading_visual_icon` method, which accepts the arguments accepted by <%= link_to_component(Primer::Beta::Octicon) %>.
63
63
  #
64
64
  # To render a label, call the `with_leading_visual_label` method, which accepts the arguments accepted by <%= link_to_component(Primer::Beta::Label) %>.
65
65
  #
@@ -70,7 +70,7 @@ module Primer
70
70
  # with_leading_visual_text { "Text here" }`
71
71
  # ```
72
72
  renders_one :trailing_visual, types: {
73
- icon: Primer::OcticonComponent,
73
+ icon: Primer::Beta::Octicon,
74
74
  label: Primer::Beta::Label,
75
75
  counter: Primer::Beta::Counter,
76
76
  text: ->(text) { text }
@@ -79,7 +79,7 @@ module Primer
79
79
  # Used internally.
80
80
  #
81
81
  # @private
82
- renders_one :private_trailing_action_icon, Primer::OcticonComponent
82
+ renders_one :private_trailing_action_icon, Primer::Beta::Octicon
83
83
 
84
84
  # A button rendered after the trailing icon that can be used to show a menu, activate
85
85
  # a dialog, etc.
@@ -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 %>
@@ -66,39 +66,39 @@ module Primer
66
66
  # @description
67
67
  # Labels are stacked by default.
68
68
  # @code
69
- # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input--default", list_id: "fruits-popup--default")) %>
69
+ # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/view-components/rails-app/auto_complete?version=alpha", input_id: "fruits-input--default", list_id: "fruits-popup--default")) %>
70
70
  #
71
71
  # @example With inline label
72
72
  # @description
73
73
  # Labels can be inline by setting `is_label_inline: true`. However, labels will always become stacked on smaller screen sizes.
74
74
  # @code
75
- # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", is_label_inline: true, input_id: "fruits-input--inline-label", list_id: "fruits-popup--inline-label")) %>
75
+ # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/view-components/rails-app/auto_complete?version=alpha", is_label_inline: true, input_id: "fruits-input--inline-label", list_id: "fruits-popup--inline-label")) %>
76
76
  #
77
77
  # @example With non-visible label
78
78
  # @description
79
79
  # A non-visible label may be rendered with `is_label_visible: false`, but it is highly discouraged. See <%= link_to_accessibility %>.
80
80
  # @code
81
- # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input--non-visible-label", list_id: "fruits-popup--non-visible-label", is_label_visible: false)) %>
81
+ # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/view-components/rails-app/auto_complete?version=alpha", input_id: "fruits-input--non-visible-label", list_id: "fruits-popup--non-visible-label", is_label_visible: false)) %>
82
82
  #
83
83
  # @example With icon
84
84
  # @description
85
85
  # To display a search icon, set `with_icon` to `true`.
86
86
  # @code
87
- # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", list_id: "fruits-popup--icon", input_id: "fruits-input--icon", with_icon: true)) %>
87
+ # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/view-components/rails-app/auto_complete?version=alpha", list_id: "fruits-popup--icon", input_id: "fruits-input--icon", with_icon: true)) %>
88
88
  #
89
89
  # @example With icon and non-visible label
90
- # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", list_id: "fruits-popup--icon-no-label", input_id: "fruits-input--icon-no-label", with_icon: true, is_label_visible: false)) %>
90
+ # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/view-components/rails-app/auto_complete?version=alpha", list_id: "fruits-popup--icon-no-label", input_id: "fruits-input--icon-no-label", with_icon: true, is_label_visible: false)) %>
91
91
  #
92
92
  # @example With clear button
93
- # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input--clear", list_id: "fruits-popup--clear", is_clearable: true)) %>
93
+ # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/view-components/rails-app/auto_complete?version=alpha", input_id: "fruits-input--clear", list_id: "fruits-popup--clear", is_clearable: true)) %>
94
94
  #
95
95
  # @example With custom classes for the input
96
- # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input--custom-input", list_id: "fruits-popup--custom-input")) do |c| %>
96
+ # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/view-components/rails-app/auto_complete?version=alpha", input_id: "fruits-input--custom-input", list_id: "fruits-popup--custom-input")) do |c| %>
97
97
  # <% c.with_input(classes: "custom-class") %>
98
98
  # <% end %>
99
99
  #
100
100
  # @example With custom classes for the results
101
- # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input--custom-results", list_id: "fruits-popup--custom-results")) do |c| %>
101
+ # <%= render(Primer::Alpha::AutoComplete.new(label_text: "Fruits", src: "/view-components/rails-app/auto_complete?version=alpha", input_id: "fruits-input--custom-results", list_id: "fruits-popup--custom-results")) do |c| %>
102
102
  # <% c.with_results(classes: "custom-class") do %>
103
103
  # <%= render(Primer::Alpha::AutoComplete::Item.new(selected: true, value: "apple")) do |c| %>
104
104
  # Apple
@@ -136,8 +136,8 @@ module Primer
136
136
 
137
137
  # add `input` and `results` without needing to explicitly call them in the view
138
138
  def before_render
139
- results(classes: "") unless results
140
- input(classes: "") unless input
139
+ with_results(classes: "") unless results?
140
+ with_input(classes: "") unless input?
141
141
  end
142
142
 
143
143
  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 %>
@@ -58,7 +58,9 @@ module Primer
58
58
  )
59
59
  system_arguments[:id] = "dialog-show-#{@system_arguments[:id]}"
60
60
  system_arguments[:data] = (system_arguments[:data] || {}).merge({ "show-dialog-id": @system_arguments[:id] })
61
+ # rubocop:disable Primer/ComponentNameMigration
61
62
  Primer::ButtonComponent.new(**system_arguments)
63
+ # rubocop:enable Primer/ComponentNameMigration
62
64
  }
63
65
 
64
66
  # Header content.
@@ -80,7 +80,9 @@ module Primer
80
80
 
81
81
  def call
82
82
  component = if BUTTON_TAGS.include?(@system_arguments[:tag])
83
+ # rubocop:disable Primer/ComponentNameMigration
83
84
  Primer::ButtonComponent.new(scheme: :link, **@system_arguments)
85
+ # rubocop:enable Primer/ComponentNameMigration
84
86
  else
85
87
  Primer::BaseComponent.new(**@system_arguments)
86
88
  end
@@ -1,9 +1,9 @@
1
- <%= render(Primer::Beta::Details.new(**@system_arguments)) do |c| %>
2
- <% c.summary(**@button_arguments) do %>
1
+ <%= render(Primer::Beta::Details.new(**@system_arguments)) do |component| %>
2
+ <% component.with_summary(**@button_arguments) do %>
3
3
  <%= button %>
4
4
  <% end %>
5
5
 
6
- <% c.body do %>
6
+ <% component.with_body do %>
7
7
  <%= menu %>
8
8
  <% end %>
9
9
  <% end %>
@@ -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
+ }
@@ -215,7 +215,7 @@ module Primer
215
215
  end
216
216
 
217
217
  def render?
218
- main.present? && sidebar.present?
218
+ main? && sidebar?
219
219
  end
220
220
 
221
221
  # The layout's main content.
@@ -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