primer_view_components 0.0.116 → 0.0.117

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -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.css +1 -1
  8. data/app/components/primer/alpha/action_list.css.json +1 -1
  9. data/app/components/primer/alpha/action_list.css.map +1 -1
  10. data/app/components/primer/alpha/auto_complete/item.rb +4 -4
  11. data/app/components/primer/alpha/auto_complete.rb +6 -6
  12. data/app/components/primer/alpha/dialog.rb +0 -2
  13. data/app/components/primer/alpha/dropdown.rb +53 -53
  14. data/app/components/primer/alpha/hellip_button.rb +41 -0
  15. data/app/components/primer/alpha/hidden_text_expander.rb +1 -1
  16. data/app/components/primer/alpha/layout.rb +48 -48
  17. data/app/components/primer/alpha/menu.css +1 -1
  18. data/app/components/primer/alpha/menu.css.json +1 -1
  19. data/app/components/primer/alpha/menu.css.map +1 -1
  20. data/app/components/primer/alpha/menu.rb +5 -5
  21. data/app/components/primer/alpha/segmented_control.rb +20 -20
  22. data/app/components/primer/{tab_container_component.d.ts → alpha/tab_container.d.ts} +0 -0
  23. data/app/components/primer/{tab_container_component.js → alpha/tab_container.js} +0 -0
  24. data/app/components/primer/alpha/tab_container.rb +43 -0
  25. data/app/components/primer/{tab_container_component.ts → alpha/tab_container.ts} +0 -0
  26. data/app/components/primer/alpha/tab_nav.css +1 -1
  27. data/app/components/primer/alpha/tab_nav.css.json +1 -1
  28. data/app/components/primer/alpha/tab_nav.css.map +1 -1
  29. data/app/components/primer/alpha/tab_nav.rb +32 -32
  30. data/app/components/primer/alpha/tool_tip.js +3 -7
  31. data/app/components/primer/alpha/tool_tip.ts +3 -7
  32. data/app/components/primer/alpha/tooltip.rb +18 -18
  33. data/app/components/primer/alpha/underline_nav.css +1 -1
  34. data/app/components/primer/alpha/underline_nav.css.json +1 -1
  35. data/app/components/primer/alpha/underline_nav.css.map +1 -1
  36. data/app/components/primer/alpha/underline_nav.rb +18 -18
  37. data/app/components/primer/beta/auto_complete/item.rb +2 -3
  38. data/app/components/primer/beta/auto_complete.rb +14 -16
  39. data/app/components/primer/beta/avatar_stack.rb +12 -14
  40. data/app/components/primer/beta/blankslate.rb +0 -1
  41. data/app/components/primer/beta/border_box/header.rb +0 -2
  42. data/app/components/primer/beta/border_box.rb +0 -2
  43. data/app/components/primer/beta/breadcrumbs.css +1 -1
  44. data/app/components/primer/beta/breadcrumbs.css.json +1 -1
  45. data/app/components/primer/beta/breadcrumbs.css.map +1 -1
  46. data/app/components/primer/beta/breadcrumbs.rb +0 -1
  47. data/app/components/primer/beta/button.rb +9 -10
  48. data/app/components/primer/beta/button_group.rb +0 -1
  49. data/app/components/primer/beta/details.rb +0 -1
  50. data/app/components/primer/beta/flash.rb +0 -1
  51. data/app/components/primer/beta/link.rb +2 -3
  52. data/app/components/primer/beta/octicon.rb +0 -1
  53. data/app/components/primer/beta/popover.rb +0 -1
  54. data/app/components/primer/{state_component.css → beta/state.css} +0 -0
  55. data/app/components/primer/beta/state.css.json +1 -0
  56. data/app/components/primer/beta/state.css.map +1 -0
  57. data/app/components/primer/{state_component.pcss → beta/state.pcss} +0 -0
  58. data/app/components/primer/beta/state.rb +76 -0
  59. data/app/components/primer/{subhead_component.css → beta/subhead.css} +0 -0
  60. data/app/components/primer/beta/subhead.css.json +1 -0
  61. data/app/components/primer/beta/subhead.css.map +1 -0
  62. data/app/components/primer/{subhead_component.html.erb → beta/subhead.html.erb} +0 -0
  63. data/app/components/primer/{subhead_component.pcss → beta/subhead.pcss} +0 -0
  64. data/app/components/primer/beta/subhead.rb +135 -0
  65. data/app/components/primer/{timeline_item_component.css → beta/timeline_item.css} +0 -0
  66. data/app/components/primer/beta/timeline_item.css.json +1 -0
  67. data/app/components/primer/beta/timeline_item.css.map +1 -0
  68. data/app/components/primer/{timeline_item_component.html.erb → beta/timeline_item.html.erb} +0 -0
  69. data/app/components/primer/{timeline_item_component.pcss → beta/timeline_item.pcss} +0 -0
  70. data/app/components/primer/beta/timeline_item.rb +90 -0
  71. data/app/components/primer/beta/truncate.css +1 -1
  72. data/app/components/primer/beta/truncate.css.json +1 -1
  73. data/app/components/primer/beta/truncate.css.map +1 -1
  74. data/app/components/primer/beta/truncate.rb +0 -1
  75. data/app/components/primer/button_component.rb +9 -9
  76. data/app/components/primer/component.rb +0 -1
  77. data/app/components/primer/hellip_button.rb +2 -34
  78. data/app/components/primer/navigation/tab_component.rb +16 -16
  79. data/app/components/primer/primer.d.ts +1 -1
  80. data/app/components/primer/primer.js +1 -1
  81. data/app/components/primer/primer.pcss +3 -3
  82. data/app/components/primer/primer.ts +1 -1
  83. data/app/components/primer/state_component.rb +2 -69
  84. data/app/components/primer/subhead_component.rb +2 -128
  85. data/app/components/primer/tab_container_component.rb +2 -36
  86. data/app/components/primer/timeline_item_component.rb +5 -78
  87. data/app/forms/example_toggle_switch_form/example_field_caption.html.erb +1 -0
  88. data/app/forms/example_toggle_switch_form.rb +8 -0
  89. data/app/forms/submit_button_form.rb +4 -4
  90. data/app/lib/primer/tabbed_component_helper.rb +1 -1
  91. data/lib/primer/deprecations.rb +7 -13
  92. data/lib/primer/deprecations.yml +24 -0
  93. data/lib/primer/forms/button.html.erb +2 -2
  94. data/lib/primer/forms/dsl/toggle_switch_input.rb +35 -0
  95. data/lib/primer/forms/toggle_switch.html.erb +17 -0
  96. data/lib/primer/forms/toggle_switch.rb +19 -0
  97. data/lib/primer/forms/toggle_switch_form.rb +74 -0
  98. data/lib/primer/view_components/linters/subhead_component_migration_counter.rb +1 -1
  99. data/lib/primer/view_components/version.rb +1 -1
  100. data/lib/rubocop/cop/primer/component_name_migration.rb +2 -1
  101. data/lib/tasks/docs.rake +6 -6
  102. data/previews/primer/alpha/action_list_preview.rb +44 -44
  103. data/previews/primer/alpha/dropdown_preview.rb +97 -97
  104. data/previews/primer/alpha/hellip_button_preview.rb +24 -0
  105. data/previews/primer/alpha/layout_preview.rb +63 -63
  106. data/previews/primer/alpha/menu_preview/default.html.erb +5 -5
  107. data/previews/primer/alpha/menu_preview/playground.html.erb +5 -5
  108. data/previews/primer/alpha/segmented_control_preview.rb +60 -60
  109. data/previews/primer/alpha/tab_nav_preview.rb +22 -22
  110. data/previews/primer/alpha/tab_panels_preview.rb +2 -2
  111. data/previews/primer/alpha/tooltip_preview/with_multiple_on_a_page.html.erb +6 -6
  112. data/previews/primer/alpha/tooltip_preview.rb +12 -12
  113. data/previews/primer/alpha/underline_nav_preview.rb +4 -4
  114. data/previews/primer/alpha/underline_panels_preview.rb +8 -8
  115. data/previews/primer/beta/auto_complete_item_preview/default.html.erb +2 -2
  116. data/previews/primer/beta/auto_complete_item_preview/playground.html.erb +2 -2
  117. data/previews/primer/beta/auto_complete_item_preview/with_description.html.erb +3 -3
  118. data/previews/primer/beta/auto_complete_preview/with_submit_button.html.erb +2 -2
  119. data/previews/primer/beta/auto_complete_preview.rb +18 -18
  120. data/previews/primer/beta/avatar_stack_preview.rb +32 -32
  121. data/previews/primer/beta/blankslate_preview.rb +40 -40
  122. data/previews/primer/beta/border_box_preview.rb +38 -38
  123. data/previews/primer/beta/breadcrumbs_preview.rb +2 -2
  124. data/previews/primer/beta/button_group_preview.rb +10 -10
  125. data/previews/primer/beta/button_preview/all_schemes.html.erb +4 -4
  126. data/previews/primer/beta/button_preview/invisible_all_visuals.html.erb +16 -16
  127. data/previews/primer/beta/button_preview/leading_visual.html.erb +2 -2
  128. data/previews/primer/beta/button_preview/trailing_action.html.erb +2 -2
  129. data/previews/primer/beta/button_preview/trailing_visual.html.erb +2 -2
  130. data/previews/primer/beta/button_preview/with_tooltip.html.erb +2 -2
  131. data/previews/primer/beta/details_preview.rb +6 -6
  132. data/previews/primer/beta/state_preview.rb +66 -0
  133. data/previews/primer/beta/subhead_preview/actions.html.erb +14 -0
  134. data/previews/primer/beta/subhead_preview.rb +99 -0
  135. data/previews/primer/beta/timeline_item_preview.rb +30 -0
  136. data/previews/primer/forms/forms_preview/example_toggle_switch_form.html.erb +1 -0
  137. data/previews/primer/forms/forms_preview.rb +2 -0
  138. data/static/arguments.json +118 -118
  139. data/static/audited_at.json +6 -0
  140. data/static/constants.json +67 -54
  141. data/static/statuses.json +12 -6
  142. metadata +36 -23
  143. data/app/components/primer/state_component.css.json +0 -1
  144. data/app/components/primer/state_component.css.map +0 -1
  145. data/app/components/primer/subhead_component.css.json +0 -1
  146. data/app/components/primer/subhead_component.css.map +0 -1
  147. data/app/components/primer/timeline_item_component.css.json +0 -1
  148. data/app/components/primer/timeline_item_component.css.map +0 -1
  149. data/previews/primer/hellip_button_preview.rb +0 -22
  150. data/previews/primer/state_component_preview.rb +0 -26
  151. data/previews/primer/subhead_component_preview.rb +0 -40
  152. data/previews/primer/timeline_item_component_preview.rb +0 -28
@@ -1 +1 @@
1
- {"version":3,"sources":["underline_nav.pcss","<no source>"],"names":[],"mappings":"AAEA,cAME,+BAAgC,CADhC,mDAAoD,CAJpD,YAAa,CAMb,6BAA8B,CAL9B,mCAAqC,CACrC,eAAgB,CAChB,iBAeF,CAVE,uBAGE,2CAA4C,CAD5C,6BAA8B,CAD9B,gDAGF,CAEA,gCAEE,8CAA+C,CAD/C,iCAEF,CAGF,mBAEE,kBAAmB,CADnB,YAAa,CAEb,wCAA0C,CAC1C,eACF,CAEA,mBAaE,kBAAmB,CAHnB,wBAA6B,CAC7B,QAAS,CACT,mDAAqD,CANrD,6BAA8B,CAG9B,cAAe,CAPf,YAAa,CAEb,kDAAoD,CACpD,gBAAiB,CAFjB,kEAAoE,CAFpE,iBAAkB,CAMlB,iBAAkB,CAClB,kBA6DF,CAtDE,mFAKE,8CAA+C,CAF/C,6BAA8B,CAG9B,mBAAoB,CAFpB,oBAAqB,CAGrB,4CACF,CAGA,yCAKE,0BAA2B,CAJ3B,aAAc,CAEd,gDAAkD,CADlD,QAAS,CAET,iBAEF,CAIE,0BClEJ,WAAA,YAAA,SAAA,gBAAA,kBAAA,QAAA,4CAAA,UDkE8B,CAI5B,sBACE,yBAGE,yDAA0D,CAF1D,6BAA8B,CAC9B,oBAAqB,CAErB,mCACF,CACF,CAEA,wIAKE,qDAAsD,CADtD,6BAA8B,CAD9B,gDAgBF,CAXE,mJAOE,4CAA6C,CAC7C,mDAAqD,CALrD,uBAAwB,CAGxB,UAAW,CADX,UAAW,CAJX,iBAAkB,CAClB,SAAU,CAOV,6BAA+B,CAL/B,UAMF,CAIJ,qBACE,wBAKF,CAHE,2CACE,aACF,CAGF,sBACE,iBACF,CAEA,oBACE,aAMF,CAHE,uCACE,mCACF,CAGF,sBAIE,0BAA2B,CAD3B,2BAA4B,CAF5B,wBAA0B,CAC1B,iDAGF,CAEA,wBACE,YAAa,CACb,6BACF","file":"underline_nav.css","sourcesContent":["/* UnderlineNav */\n\n.UnderlineNav {\n display: flex;\n min-height: var(--base-size-48, 48px);\n overflow-x: auto;\n overflow-y: hidden;\n box-shadow: inset 0 -1px 0 var(--color-border-muted);\n -webkit-overflow-scrolling: auto;\n justify-content: space-between;\n\n & .Counter {\n margin-left: var(--primer-control-medium-gap, 8px);\n color: var(--color-fg-default);\n background-color: var(--color-neutral-muted);\n }\n\n & .Counter--primary {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-neutral-emphasis);\n }\n}\n\n.UnderlineNav-body {\n display: flex;\n align-items: center;\n gap: var(--primer-control-medium-gap, 8px);\n list-style: none;\n}\n\n.UnderlineNav-item {\n position: relative;\n display: flex;\n padding: 0 var(--primer-control-medium-paddingInline-condensed, 8px);\n font-size: var(--primer-text-body-size-medium, 14px);\n line-height: 30px;\n color: var(--color-fg-default);\n text-align: center;\n white-space: nowrap;\n cursor: pointer;\n background-color: transparent;\n border: 0;\n border-radius: var(--primer-borderRadius-medium, 6px);\n align-items: center;\n\n &:hover,\n &:focus,\n &:focus-visible {\n color: var(--color-fg-default);\n text-decoration: none;\n border-bottom-color: var(--color-neutral-muted);\n outline-offset: -2px;\n transition: border-bottom-color 0.12s ease-out;\n }\n\n /* renders a visibly hidden \"copy\" of the label in bold, reserving box space for when label becomes bold on selected */\n & [data-content]::before {\n display: block;\n height: 0;\n font-weight: var(--base-text-weight-semibold, 600);\n visibility: hidden;\n content: attr(data-content);\n }\n\n /* increase touch target area */\n &::before {\n @mixin minTouchTarget 48px;\n }\n\n /* hover state was \"sticking\" on mobile after click */\n @media (pointer: fine) {\n &:hover {\n color: var(--color-fg-default);\n text-decoration: none;\n background: var(--color-action-list-item-default-hover-bg);\n transition: background 0.12s ease-out;\n }\n }\n\n &.selected,\n &[role='tab'][aria-selected='true'],\n &[aria-current]:not([aria-current='false']) {\n font-weight: var(--base-text-weight-semibold, 600);\n color: var(--color-fg-default);\n border-bottom-color: var(--color-primer-border-active);\n\n /* current/selected underline */\n &::after {\n position: absolute;\n right: 50%;\n bottom: calc(50% - 25px); /* 48px total height / 2 (24px) + 1px */\n width: 100%;\n height: 2px;\n content: '';\n background: var(--color-primer-border-active);\n border-radius: var(--primer-borderRadius-medium, 6px);\n transform: translate(50%, -50%);\n }\n }\n}\n\n.UnderlineNav--right {\n justify-content: flex-end;\n\n & .UnderlineNav-actions {\n flex: 1 1 auto;\n }\n}\n\n.UnderlineNav-actions {\n align-self: center;\n}\n\n.UnderlineNav--full {\n display: block;\n\n /* required for underline to align with additional wrapper element */\n & .UnderlineNav-body {\n min-height: var(--base-size-48, 48px);\n }\n}\n\n.UnderlineNav-octicon {\n display: inline !important;\n margin-right: var(--primer-control-medium-gap, 8px);\n color: var(--color-fg-muted);\n fill: var(--color-fg-muted);\n}\n\n.UnderlineNav-container {\n display: flex;\n justify-content: space-between;\n}\n",null]}
1
+ {"version":3,"sources":["underline_nav.pcss","<no source>"],"names":[],"mappings":"AAEA,cAME,+BAAgC,CADhC,mDAAoD,CAJpD,YAAa,CAMb,6BAA8B,CAL9B,mCAAqC,CACrC,eAAgB,CAChB,iBAeF,CAVE,uBAGE,2CAA4C,CAD5C,6BAA8B,CAD9B,gDAGF,CAEA,gCAEE,8CAA+C,CAD/C,iCAEF,CAGF,mBAEE,kBAAmB,CADnB,YAAa,CAEb,wCAA0C,CAC1C,eACF,CAEA,mBAaE,kBAAmB,CAHnB,wBAA6B,CAC7B,QAAS,CACT,mDAAqD,CANrD,6BAA8B,CAG9B,cAAe,CAPf,YAAa,CAEb,kDAAoD,CACpD,gBAAiB,CAFjB,kEAAoE,CAFpE,iBAAkB,CAMlB,iBAAkB,CAClB,kBA6DF,CAtDE,mFAKE,8CAA+C,CAF/C,6BAA8B,CAG9B,mBAAoB,CAFpB,oBAAqB,CAGrB,4CACF,CAGA,yCAKE,0BAA2B,CAJ3B,aAAc,CAEd,gDAAkD,CADlD,QAAS,CAET,iBAEF,CAIE,0BClEJ,WAAA,YAAA,SAAA,gBAAA,kBAAA,QAAA,4CAAA,UDkE8B,CAI5B,sBACE,yBAGE,yDAA0D,CAF1D,6BAA8B,CAC9B,oBAAqB,CAErB,mCACF,CACF,CAEA,wIAKE,qDAAsD,CADtD,6BAA8B,CAD9B,gDAgBF,CAXE,0JAOE,4CAA6C,CAC7C,mDAAqD,CALrD,uBAAwB,CAGxB,UAAW,CADX,UAAW,CAJX,iBAAkB,CAClB,SAAU,CAOV,6BAA+B,CAL/B,UAMF,CAIJ,qBACE,wBAKF,CAHE,2CACE,aACF,CAGF,sBACE,iBACF,CAEA,oBACE,aAMF,CAHE,uCACE,mCACF,CAGF,sBAIE,0BAA2B,CAD3B,2BAA4B,CAF5B,wBAA0B,CAC1B,iDAGF,CAEA,wBACE,YAAa,CACb,6BACF","file":"underline_nav.css","sourcesContent":["/* UnderlineNav */\n\n.UnderlineNav {\n display: flex;\n min-height: var(--base-size-48, 48px);\n overflow-x: auto;\n overflow-y: hidden;\n box-shadow: inset 0 -1px 0 var(--color-border-muted);\n -webkit-overflow-scrolling: auto;\n justify-content: space-between;\n\n & .Counter {\n margin-left: var(--primer-control-medium-gap, 8px);\n color: var(--color-fg-default);\n background-color: var(--color-neutral-muted);\n }\n\n & .Counter--primary {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-neutral-emphasis);\n }\n}\n\n.UnderlineNav-body {\n display: flex;\n align-items: center;\n gap: var(--primer-control-medium-gap, 8px);\n list-style: none;\n}\n\n.UnderlineNav-item {\n position: relative;\n display: flex;\n padding: 0 var(--primer-control-medium-paddingInline-condensed, 8px);\n font-size: var(--primer-text-body-size-medium, 14px);\n line-height: 30px;\n color: var(--color-fg-default);\n text-align: center;\n white-space: nowrap;\n cursor: pointer;\n background-color: transparent;\n border: 0;\n border-radius: var(--primer-borderRadius-medium, 6px);\n align-items: center;\n\n &:hover,\n &:focus,\n &:focus-visible {\n color: var(--color-fg-default);\n text-decoration: none;\n border-bottom-color: var(--color-neutral-muted);\n outline-offset: -2px;\n transition: border-bottom-color 0.12s ease-out;\n }\n\n /* renders a visibly hidden \"copy\" of the label in bold, reserving box space for when label becomes bold on selected */\n & [data-content]::before {\n display: block;\n height: 0;\n font-weight: var(--base-text-weight-semibold, 600);\n visibility: hidden;\n content: attr(data-content);\n }\n\n /* increase touch target area */\n &::before {\n @mixin minTouchTarget 48px;\n }\n\n /* hover state was \"sticking\" on mobile after click */\n @media (pointer: fine) {\n &:hover {\n color: var(--color-fg-default);\n text-decoration: none;\n background: var(--color-action-list-item-default-hover-bg);\n transition: background 0.12s ease-out;\n }\n }\n\n &.selected,\n &[role='tab'][aria-selected='true'],\n &[aria-current]:not([aria-current='false']) {\n font-weight: var(--base-text-weight-semibold, 600);\n color: var(--color-fg-default);\n border-bottom-color: var(--color-primer-border-active);\n\n /* current/selected underline */\n &::after {\n position: absolute;\n right: 50%;\n bottom: calc(50% - 25px); /* 48px total height / 2 (24px) + 1px */\n width: 100%;\n height: 2px;\n content: '';\n background: var(--color-primer-border-active);\n border-radius: var(--primer-borderRadius-medium, 6px);\n transform: translate(50%, -50%);\n }\n }\n}\n\n.UnderlineNav--right {\n justify-content: flex-end;\n\n & .UnderlineNav-actions {\n flex: 1 1 auto;\n }\n}\n\n.UnderlineNav-actions {\n align-self: center;\n}\n\n.UnderlineNav--full {\n display: block;\n\n /* required for underline to align with additional wrapper element */\n & .UnderlineNav-body {\n min-height: var(--base-size-48, 48px);\n }\n}\n\n.UnderlineNav-octicon {\n display: inline !important;\n margin-right: var(--primer-control-medium-gap, 8px);\n color: var(--color-fg-muted);\n fill: var(--color-fg-muted);\n}\n\n.UnderlineNav-container {\n display: flex;\n justify-content: space-between;\n}\n",null]}
@@ -71,18 +71,18 @@ module Primer
71
71
  #
72
72
  # @example With icons and counters
73
73
  # <%= render(Primer::Alpha::UnderlineNav.new(label: "With icons and counters")) do |component| %>
74
- # <% component.with_tab(href: "#", selected: true) do |t| %>
75
- # <% t.icon(icon: :star) %>
76
- # <% t.text { "Item 1" } %>
74
+ # <% component.with_tab(href: "#", selected: true) do |tab| %>
75
+ # <% tab.with_icon(icon: :star) %>
76
+ # <% tab.with_text { "Item 1" } %>
77
77
  # <% end %>
78
- # <% component.with_tab(href: "#") do |t| %>
79
- # <% t.icon(icon: :star) %>
80
- # <% t.text { "Item 2" } %>
81
- # <% t.counter(count: 10) %>
78
+ # <% component.with_tab(href: "#") do |tab| %>
79
+ # <% tab.with_icon(icon: :star) %>
80
+ # <% tab.with_text { "Item 2" } %>
81
+ # <% tab.with_counter(count: 10) %>
82
82
  # <% end %>
83
- # <% component.with_tab(href: "#") do |t| %>
84
- # <% t.text { "Item 3" } %>
85
- # <% t.counter(count: 10) %>
83
+ # <% component.with_tab(href: "#") do |tab| %>
84
+ # <% tab.with_text { "Item 3" } %>
85
+ # <% tab.with_counter(count: 10) %>
86
86
  # <% end %>
87
87
  # <% component.with_actions do %>
88
88
  # <%= render(Primer::ButtonComponent.new) { "Button!" } %>
@@ -91,11 +91,11 @@ module Primer
91
91
  #
92
92
  # @example Align right
93
93
  # <%= render(Primer::Alpha::UnderlineNav.new(label: "Align right", align: :right)) do |component| %>
94
- # <% component.with_tab(href: "#", selected: true) do |t| %>
95
- # <% t.text { "Item 1" } %>
94
+ # <% component.with_tab(href: "#", selected: true) do |tab| %>
95
+ # <% tab.with_text { "Item 1" } %>
96
96
  # <% end %>
97
- # <% component.with_tab(href: "#") do |t| %>
98
- # <% t.text { "Item 2" } %>
97
+ # <% component.with_tab(href: "#") do |tab| %>
98
+ # <% tab.with_text { "Item 2" } %>
99
99
  # <% end %>
100
100
  # <% component.with_actions do %>
101
101
  # <%= render(Primer::ButtonComponent.new) { "Button!" } %>
@@ -103,10 +103,10 @@ module Primer
103
103
  # <% end %>
104
104
  #
105
105
  # @example Customizing the body
106
- # <%= render(Primer::Alpha::UnderlineNav.new(label: "Default", body_arguments: { classes: "custom-class", border: true, border_color: :accent_emphasis })) do |c| %>
107
- # <% c.with_tab(selected: true, href: "#") { "Tab 1" }%>
108
- # <% c.with_tab(href: "#") { "Tab 2" } %>
109
- # <% c.with_tab(href: "#") { "Tab 3" } %>
106
+ # <%= render(Primer::Alpha::UnderlineNav.new(label: "Default", body_arguments: { classes: "custom-class", border: true, border_color: :accent_emphasis })) do |component| %>
107
+ # <% component.with_tab(selected: true, href: "#") { "Tab 1" }%>
108
+ # <% component.with_tab(href: "#") { "Tab 2" } %>
109
+ # <% component.with_tab(href: "#") { "Tab 3" } %>
110
110
  # <% end %>
111
111
  #
112
112
  # @param tag [Symbol] <%= one_of(Primer::Alpha::UnderlineNav::TAG_OPTIONS) %>
@@ -6,7 +6,6 @@ module Primer
6
6
  class AutoComplete
7
7
  # Use `AutoCompleteItem` to list results of an auto-completed search.
8
8
  class Item < Primer::Component
9
- warn_on_deprecated_slot_setter
10
9
  status :beta
11
10
 
12
11
  ALLOWED_DESCRIPTION_VARIANTS = [:inline, :block].freeze
@@ -36,10 +35,10 @@ module Primer
36
35
  renders_one :description
37
36
 
38
37
  # @example Default
39
- # <%= render(Primer::Beta::AutoComplete::Item.new(selected: true, value: "value")) do |c| %>
38
+ # <%= render(Primer::Beta::AutoComplete::Item.new(selected: true, value: "value")) do %>
40
39
  # Selected
41
40
  # <% end %>
42
- # <%= render(Primer::Beta::AutoComplete::Item.new(value: "value")) do |c| %>
41
+ # <%= render(Primer::Beta::AutoComplete::Item.new(value: "value")) do %>
43
42
  # Not selected
44
43
  # <% end %>
45
44
  #
@@ -12,8 +12,6 @@ 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
16
-
17
15
  status :beta
18
16
 
19
17
  DEFAULT_SIZE = :medium
@@ -96,8 +94,8 @@ module Primer
96
94
  # @description
97
95
  # Display any Octicon as a leading visual within the field
98
96
  # @code
99
- # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", src: "/view-components/rails-app/auto_complete", input_id:"input-id-1", list_id: "list-id-1")) do |c| %>
100
- # <% c.leading_visual_icon(icon: :search) %>
97
+ # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", src: "/view-components/rails-app/auto_complete", input_id:"input-id-1", list_id: "list-id-1")) do |component| %>
98
+ # <% component.with_leading_visual_icon(icon: :search) %>
101
99
  # <% end %>
102
100
  #
103
101
  # @example Trailing action
@@ -110,42 +108,42 @@ module Primer
110
108
  # @description
111
109
  # A non-visible label may be rendered with `visually_hide_label: true`, but it is highly discouraged. See <%= link_to_accessibility %>.
112
110
  # @code
113
- # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-1", list_id: "fruits-popup--custom-result-1", src: "/view-components/rails-app/auto_complete", visually_hide_label: true)) do |c| %>
114
- # <% c.leading_visual_icon(icon: :search) %>
111
+ # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-1", list_id: "fruits-popup--custom-result-1", src: "/view-components/rails-app/auto_complete", visually_hide_label: true)) do |component| %>
112
+ # <% component.with_leading_visual_icon(icon: :search) %>
115
113
  # <% end %>
116
114
  #
117
115
  # @example Full width field
118
116
  # @description
119
117
  # To allow field to span width of its container, set `full_width` to `true`.
120
118
  # @code
121
- # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-2", list_id: "fruits-popup--custom-results-2", src: "/view-components/rails-app/auto_complete", full_width: true)) do |c| %>
122
- # <% c.leading_visual_icon(icon: :search) %>
119
+ # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-2", list_id: "fruits-popup--custom-results-2", src: "/view-components/rails-app/auto_complete", full_width: true)) do |component| %>
120
+ # <% component.with_leading_visual_icon(icon: :search) %>
123
121
  # <% end %>
124
122
  #
125
123
  # @example Inset variant
126
124
  # @description
127
125
  # Use the `inset` variant to change the input background color to be subtle.
128
126
  # @code
129
- # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-2", list_id: "fruits-popup--custom-results-2", src: "/view-components/rails-app/auto_complete", inset: true)) do |c| %>
130
- # <% c.leading_visual_icon(icon: :search) %>
127
+ # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-2", list_id: "fruits-popup--custom-results-2", src: "/view-components/rails-app/auto_complete", inset: true)) do |component| %>
128
+ # <% component.with_leading_visual_icon(icon: :search) %>
131
129
  # <% end %>
132
130
  #
133
131
  # @example Monospace variant
134
132
  # @description
135
133
  # Use the `monospace` variant to change the input font family.
136
134
  # @code
137
- # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-2", list_id: "fruits-popup--custom-results-2", src: "/view-components/rails-app/auto_complete", monospace: true)) do |c| %>
138
- # <% c.leading_visual_icon(icon: :search) %>
135
+ # <%= render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "fruits-input--custom-results-2", list_id: "fruits-popup--custom-results-2", src: "/view-components/rails-app/auto_complete", monospace: true)) do |component| %>
136
+ # <% component.with_leading_visual_icon(icon: :search) %>
139
137
  # <% end %>
140
138
  #
141
139
  # @example With custom classes for the input
142
- # <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/view-components/rails-app/auto_complete", input_id: "fruits-input--custom-input", list_id: "fruits-popup--custom-input")) do |c| %>
143
- # <% c.with_input(classes: "custom-class") %>
140
+ # <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/view-components/rails-app/auto_complete", input_id: "fruits-input--custom-input", list_id: "fruits-popup--custom-input")) do |component| %>
141
+ # <% component.with_input(classes: "custom-class") %>
144
142
  # <% end %>
145
143
  #
146
144
  # @example With custom classes for the results
147
- # <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/view-components/rails-app/auto_complete", input_id: "fruits-input--custom-results", list_id: "fruits-popup--custom-results")) do |c| %>
148
- # <% c.with_results(classes: "custom-class") %>
145
+ # <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/view-components/rails-app/auto_complete", input_id: "fruits-input--custom-results", list_id: "fruits-popup--custom-results")) do |component| %>
146
+ # <% component.with_results(classes: "custom-class") %>
149
147
  # <% end %>
150
148
  #
151
149
  # @param label_text [String] The label of the input.
@@ -4,8 +4,6 @@ module Primer
4
4
  module Beta
5
5
  # Use `AvatarStack` to stack multiple avatars together.
6
6
  class AvatarStack < Primer::Component
7
- warn_on_deprecated_slot_setter
8
-
9
7
  status :beta
10
8
 
11
9
  ALIGN_DEFAULT = :left
@@ -22,24 +20,24 @@ module Primer
22
20
  renders_many :avatars, "Primer::Beta::Avatar"
23
21
 
24
22
  # @example Default
25
- # <%= render(Primer::Beta::AvatarStack.new) do |c| %>
26
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
27
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
28
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
23
+ # <%= render(Primer::Beta::AvatarStack.new) do |component| %>
24
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
25
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
26
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
29
27
  # <% end %>
30
28
  #
31
29
  # @example Align right
32
- # <%= render(Primer::Beta::AvatarStack.new(align: :right)) do |c| %>
33
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
34
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
35
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
30
+ # <%= render(Primer::Beta::AvatarStack.new(align: :right)) do |component| %>
31
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
32
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
33
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
36
34
  # <% end %>
37
35
  #
38
36
  # @example With tooltip
39
- # <%= render(Primer::Beta::AvatarStack.new(tooltipped: true, body_arguments: { label: 'This is a tooltip!' })) do |c| %>
40
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
41
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
42
- # <% c.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
37
+ # <%= render(Primer::Beta::AvatarStack.new(tooltipped: true, body_arguments: { label: 'This is a tooltip!' })) do |component| %>
38
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
39
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
40
+ # <% component.with_avatar(src: Primer::ExampleImage::BASE64_SRC, alt: "@kittenuser") %>
43
41
  # <% end %>
44
42
  #
45
43
  # @param tag [Symbol] <%= one_of(Primer::Beta::AvatarStack::TAG_OPTIONS) %>
@@ -11,7 +11,6 @@ module Primer
11
11
  # - `secondary_action` text should be meaningful out of context and clearly describe the destination. Avoid using vague text like, "Learn more" or "Click here".
12
12
  # - The blankslate can leverage the spinner component, which will communicate to screen reader users that the content is still loading.
13
13
  class Blankslate < Primer::Component
14
- warn_on_deprecated_slot_setter
15
14
  status :beta
16
15
 
17
16
  VISUAL_OPTIONS = %i[icon spinner image].freeze
@@ -7,8 +7,6 @@ module Primer
7
7
  #
8
8
  # @accessibility When using `header.with_title`, set `tag` to one of `h1`, `h2`, `h3`, etc. based on what is appropriate for the page context. <%= link_to_heading_practices %>
9
9
  class Header < Primer::Component
10
- warn_on_deprecated_slot_setter
11
-
12
10
  status :beta
13
11
 
14
12
  TITLE_TAG_FALLBACK = :h2
@@ -4,8 +4,6 @@ module Primer
4
4
  module Beta
5
5
  # `BorderBox` is a Box component with a border.
6
6
  class BorderBox < Primer::Component
7
- warn_on_deprecated_slot_setter
8
-
9
7
  status :beta
10
8
 
11
9
  DEFAULT_PADDING = :default
@@ -1 +1 @@
1
- .breadcrumb-item{display:inline-block;list-style:none;margin-left:-.35em;white-space:nowrap}.breadcrumb-item:after{border-right:.1em solid var(--color-fg-muted);content:"";display:inline-block;height:.8em;margin:0 .5em;transform:rotate(15deg)}.breadcrumb-item:first-child{margin-left:0}:is(.breadcrumb-item-selected,.breadcrumb-item[aria-current]:not([aria-current=false])):after{content:none}.breadcrumb-item-selected a{color:var(--color-fg-default)}
1
+ .breadcrumb-item{display:inline-block;list-style:none;margin-left:-.35em;white-space:nowrap}.breadcrumb-item:after{border-right:.1em solid var(--color-fg-muted);content:"";display:inline-block;height:.8em;margin:0 .5em;transform:rotate(15deg)}.breadcrumb-item:first-child{margin-left:0}.breadcrumb-item-selected:after,.breadcrumb-item[aria-current]:not([aria-current=false]):after{content:none}.breadcrumb-item-selected a{color:var(--color-fg-default)}
@@ -1 +1 @@
1
- {"name":"beta/breadcrumbs","selectors":[".breadcrumb-item",".breadcrumb-item:after",".breadcrumb-item:first-child",":is(.breadcrumb-item-selected",".breadcrumb-item[aria-current]:not([aria-current=false])):after",".breadcrumb-item-selected a"]}
1
+ {"name":"beta/breadcrumbs","selectors":[".breadcrumb-item",".breadcrumb-item:after",".breadcrumb-item:first-child",".breadcrumb-item-selected:after",".breadcrumb-item[aria-current]:not([aria-current=false]):after",".breadcrumb-item-selected a"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["breadcrumbs.pcss"],"names":[],"mappings":"AAAA,iBACE,oBAAqB,CAGrB,eAAgB,CAFhB,kBAAoB,CACpB,kBAeF,CAZE,uBAKE,6CAA+C,CAD/C,UAAW,CAHX,oBAAqB,CACrB,WAAa,CACb,aAAe,CAGf,uBACF,CAEA,6BACE,aACF,CAKA,8FACE,YACF,CAGF,4BACE,6BACF","file":"breadcrumbs.css","sourcesContent":[".breadcrumb-item {\n display: inline-block;\n margin-left: -0.35em;\n white-space: nowrap;\n list-style: none;\n\n &::after {\n display: inline-block;\n height: 0.8em;\n margin: 0 0.5em;\n content: '';\n border-right: 0.1em solid var(--color-fg-muted);\n transform: rotate(15deg);\n }\n\n &:first-child {\n margin-left: 0;\n }\n}\n\n.breadcrumb-item-selected,\n.breadcrumb-item[aria-current]:not([aria-current='false']) {\n &::after {\n content: none;\n }\n}\n\n.breadcrumb-item-selected a {\n color: var(--color-fg-default);\n}\n"]}
1
+ {"version":3,"sources":["breadcrumbs.pcss"],"names":[],"mappings":"AAAA,iBACE,oBAAqB,CAGrB,eAAgB,CAFhB,kBAAoB,CACpB,kBAeF,CAZE,uBAKE,6CAA+C,CAD/C,UAAW,CAHX,oBAAqB,CACrB,WAAa,CACb,aAAe,CAGf,uBACF,CAEA,6BACE,aACF,CAKA,+FACE,YACF,CAGF,4BACE,6BACF","file":"breadcrumbs.css","sourcesContent":[".breadcrumb-item {\n display: inline-block;\n margin-left: -0.35em;\n white-space: nowrap;\n list-style: none;\n\n &::after {\n display: inline-block;\n height: 0.8em;\n margin: 0 0.5em;\n content: '';\n border-right: 0.1em solid var(--color-fg-muted);\n transform: rotate(15deg);\n }\n\n &:first-child {\n margin-left: 0;\n }\n}\n\n.breadcrumb-item-selected,\n.breadcrumb-item[aria-current]:not([aria-current='false']) {\n &::after {\n content: none;\n }\n}\n\n.breadcrumb-item-selected a {\n color: var(--color-fg-default);\n}\n"]}
@@ -17,7 +17,6 @@ module Primer
17
17
  #
18
18
  # For more information on the breadcrumbs pattern implemented by this component, see [WAI-ARIA 1.1 Breadcrumb](https://www.w3.org/TR/wai-aria-practices-1.1/#breadcrumb).
19
19
  class Breadcrumbs < Primer::Component
20
- warn_on_deprecated_slot_setter
21
20
  status :beta
22
21
 
23
22
  PADDING_MESSAGE = "Padding system arguments are not allowed on Breadcrumbs. Consider using margins instead."
@@ -4,7 +4,6 @@ module Primer
4
4
  module Beta
5
5
  # Use `Button` for actions (e.g. in forms). Use links for destinations, or moving from one page to another.
6
6
  class Button < Primer::Component
7
- warn_on_deprecated_slot_setter
8
7
  status :beta
9
8
 
10
9
  DEFAULT_SCHEME = :default
@@ -103,21 +102,21 @@ module Primer
103
102
  # <%= render(Primer::Beta::Button.new(block: :true, scheme: :primary)) { "Primary full width" } %>
104
103
  #
105
104
  # @example With leading visual
106
- # <%= render(Primer::Beta::Button.new) do |c| %>
107
- # <% c.with_leading_visual_icon(icon: :star) %>
105
+ # <%= render(Primer::Beta::Button.new) do |component| %>
106
+ # <% component.with_leading_visual_icon(icon: :star) %>
108
107
  # Button
109
108
  # <% end %>
110
109
  #
111
110
  # @example With trailing visual
112
- # <%= render(Primer::Beta::Button.new) do |c| %>
113
- # <% c.with_trailing_visual_counter(count: 15) %>
111
+ # <%= render(Primer::Beta::Button.new) do |component| %>
112
+ # <% component.with_trailing_visual_counter(count: 15) %>
114
113
  # Button
115
114
  # <% end %>
116
115
  #
117
116
  # @example With leading and trailing visuals
118
- # <%= render(Primer::Beta::Button.new) do |c| %>
119
- # <% c.with_leading_visual_icon(icon: :star) %>
120
- # <% c.with_trailing_visual_counter(count: 15) %>
117
+ # <%= render(Primer::Beta::Button.new) do |component| %>
118
+ # <% component.with_leading_visual_icon(icon: :star) %>
119
+ # <% component.with_trailing_visual_counter(count: 15) %>
121
120
  # Button
122
121
  # <% end %>
123
122
  #
@@ -125,8 +124,8 @@ module Primer
125
124
  # @description
126
125
  # Use tooltips sparingly and as a last resort. Consult the <%= link_to_component(Primer::Alpha::Tooltip) %> documentation for more information.
127
126
  # @code
128
- # <%= render(Primer::Beta::Button.new(id: "button-with-tooltip")) do |c| %>
129
- # <% c.with_tooltip(text: "Tooltip text") %>
127
+ # <%= render(Primer::Beta::Button.new(id: "button-with-tooltip")) do |component| %>
128
+ # <% component.with_tooltip(text: "Tooltip text") %>
130
129
  # Button
131
130
  # <% end %>
132
131
  #
@@ -4,7 +4,6 @@ module Primer
4
4
  module Beta
5
5
  # Use `ButtonGroup` to render a series of buttons.
6
6
  class ButtonGroup < Primer::Component
7
- warn_on_deprecated_slot_setter
8
7
  status :beta
9
8
 
10
9
  # Required list of buttons to be rendered.
@@ -4,7 +4,6 @@ module Primer
4
4
  module Beta
5
5
  # Use `DetailsComponent` to reveal content after clicking a button.
6
6
  class Details < Primer::Component
7
- warn_on_deprecated_slot_setter
8
7
  status :beta
9
8
 
10
9
  BODY_TAG_DEFAULT = :div
@@ -4,7 +4,6 @@ module Primer
4
4
  module Beta
5
5
  # Use `Flash` to inform users of successful or pending actions.
6
6
  class Flash < Primer::Component
7
- warn_on_deprecated_slot_setter
8
7
  status :beta
9
8
 
10
9
  # Optional action content showed on the right side of the component.
@@ -4,7 +4,6 @@ module Primer
4
4
  module Beta
5
5
  # Use `Link` for navigating from one page to another. `Link` styles anchor tags with default blue styling and hover text-decoration.
6
6
  class Link < Primer::Component
7
- warn_on_deprecated_slot_setter
8
7
  status :beta
9
8
 
10
9
  DEFAULT_SCHEME = :default
@@ -51,8 +50,8 @@ module Primer
51
50
  # @description
52
51
  # Use tooltips sparingly and as a last resort. Consult the <%= link_to_component(Primer::Alpha::Tooltip) %> documentation for more information.
53
52
  # @code
54
- # <%= render(Primer::Beta::Link.new(href: "#", id: "link-with-tooltip")) do |c| %>
55
- # <% c.with_tooltip(text: "Tooltip text") %>
53
+ # <%= render(Primer::Beta::Link.new(href: "#", id: "link-with-tooltip")) do |component| %>
54
+ # <% component.with_tooltip(text: "Tooltip text") %>
56
55
  # Link
57
56
  # <% end %>
58
57
  #
@@ -7,7 +7,6 @@ module Primer
7
7
  # `Octicon` renders an <%= link_to_octicons %> with <%= link_to_system_arguments_docs %>.
8
8
  # `Octicon` can also be rendered with the `primer_octicon` helper, which accepts the same arguments.
9
9
  class Octicon < Primer::Component
10
- warn_on_deprecated_slot_setter
11
10
  status :beta
12
11
 
13
12
  SIZE_XSMALL = :xsmall
@@ -6,7 +6,6 @@ module Primer
6
6
  #
7
7
  # By default, the popover renders with absolute positioning, meaning it should usually be wrapped in an element with a relative position in order to be positioned properly. To render the popover with relative positioning, use the relative property.
8
8
  class Popover < Primer::Component
9
- warn_on_deprecated_slot_setter
10
9
  status :beta
11
10
 
12
11
  CARET_DEFAULT = :top
@@ -0,0 +1 @@
1
+ {"name":"beta/state","selectors":[".State",".state",".State--draft",".State--open",".State--merged",".State--closed",".State--small",".State--small .octicon"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["state.pcss"],"names":[],"mappings":"AAIA,cASE,iBAAkB,CAPlB,oBAAqB,CAErB,kDAAoD,CACpD,8CAAgD,CAChD,2DAA6D,CAH7D,kEAAoE,CAIpE,iBAAkB,CAClB,kBAEF,CAEA,4BAIE,8CAA+C,CAC/C,qDAA6D,CAF7D,iCAGF,CAEA,aAEE,2CACF,CAEA,4BAJE,iCAOF,CAHA,eAEE,2CACF,CAEA,eAEE,6CAA8C,CAD9C,iCAEF,CAIA,cAEE,iDAAmD,CACnD,oCAAsC,CAFtC,cAOF,CAHE,uBACE,SACF","file":"state.css","sourcesContent":["/* State */\n\n/* Default 32px */\n\n.state, /* TODO: Deprecate */\n.State {\n display: inline-block;\n padding: 5px var(--primer-control-medium-paddingInline-normal, 12px);\n font-size: var(--primer-text-body-size-medium, 14px);\n font-weight: var(--base-text-weight-medium, 500);\n line-height: var(--primer-control-medium-lineBoxHeight, 20px);\n text-align: center;\n white-space: nowrap;\n border-radius: 2em;\n}\n\n.state, /* TODO: Deprecate */\n.State,\n.State--draft {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-neutral-emphasis);\n border: var(--primer-borderWidth-thin, 1px) solid transparent;\n}\n\n.State--open {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-open-emphasis);\n}\n\n.State--merged {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-done-emphasis);\n}\n\n.State--closed {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-closed-emphasis);\n}\n\n/* Small 24px */\n\n.State--small {\n padding: 0 10px;\n font-size: var(--primer-text-body-size-small, 12px);\n line-height: var(--base-size-24, 24px);\n\n & .octicon {\n width: 1em; /* Ensures different icons don't change State indicator width */\n }\n}\n"]}
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Beta
5
+ # Use `State` for rendering the status of an item.
6
+ class State < Primer::Component
7
+ status :beta
8
+
9
+ SCHEME_DEFAULT = :default
10
+ NEW_SCHEME_MAPPINGS = {
11
+ open: "State--open",
12
+ closed: "State--closed",
13
+ merged: "State--merged"
14
+ }.freeze
15
+
16
+ DEPRECATED_SCHEME_MAPPINGS = {
17
+ SCHEME_DEFAULT => "",
18
+ :green => "State--open",
19
+ :red => "State--closed",
20
+ :purple => "State--merged"
21
+ }.freeze
22
+ SCHEME_MAPPINGS = NEW_SCHEME_MAPPINGS.merge(DEPRECATED_SCHEME_MAPPINGS)
23
+ SCHEME_OPTIONS = SCHEME_MAPPINGS.keys
24
+
25
+ SIZE_DEFAULT = :default
26
+ SIZE_MAPPINGS = {
27
+ SIZE_DEFAULT => "",
28
+ :small => "State--small"
29
+ }.freeze
30
+ SIZE_OPTIONS = SIZE_MAPPINGS.keys
31
+
32
+ TAG_DEFAULT = :span
33
+ TAG_OPTIONS = [TAG_DEFAULT, :div].freeze
34
+
35
+ # @example Default
36
+ # <%= render(Primer::Beta::State.new(title: "title")) { "State" } %>
37
+ #
38
+ # @example Schemes
39
+ # <%= render(Primer::Beta::State.new(title: "title")) { "Default" } %>
40
+ # <%= render(Primer::Beta::State.new(title: "title", scheme: :open)) { "Open" } %>
41
+ # <%= render(Primer::Beta::State.new(title: "title", scheme: :closed)) { "Closed" } %>
42
+ # <%= render(Primer::Beta::State.new(title: "title", scheme: :merged)) { "Merged" } %>
43
+ #
44
+ # @example Sizes
45
+ # <%= render(Primer::Beta::State.new(title: "title")) { "Default" } %>
46
+ # <%= render(Primer::Beta::State.new(title: "title", size: :small)) { "Small" } %>
47
+ #
48
+ # @param title [String] `title` HTML attribute.
49
+ # @param scheme [Symbol] Background color. <%= one_of(Primer::Beta::State::SCHEME_OPTIONS) %>
50
+ # @param tag [Symbol] HTML tag for element. <%= one_of(Primer::Beta::State::TAG_OPTIONS) %>
51
+ # @param size [Symbol] <%= one_of(Primer::Beta::State::SIZE_OPTIONS) %>
52
+ # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
53
+ def initialize(
54
+ title:,
55
+ scheme: SCHEME_DEFAULT,
56
+ tag: TAG_DEFAULT,
57
+ size: SIZE_DEFAULT,
58
+ **system_arguments
59
+ )
60
+ @system_arguments = system_arguments
61
+ @system_arguments[:title] = title
62
+ @system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, TAG_DEFAULT)
63
+ @system_arguments[:classes] = class_names(
64
+ @system_arguments[:classes],
65
+ "State",
66
+ SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme, SCHEME_DEFAULT)],
67
+ SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, SIZE_DEFAULT)]
68
+ )
69
+ end
70
+
71
+ def call
72
+ render(Primer::BaseComponent.new(**@system_arguments)) { content }
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1 @@
1
+ {"name":"beta/subhead","selectors":[".Subhead",".Subhead--spacious",".Subhead-heading",".Subhead-heading--danger",".Subhead-description",".Subhead-actions",".Subhead-actions+.Subhead-description"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["subhead.pcss"],"names":[],"mappings":"AAEA,SAIE,gFAAkF,CAHlF,YAAa,CAIb,kBAAmB,CACnB,wBAAyB,CAHzB,iDAAmD,CADnD,wDAKF,CAGA,mBACE,mCACF,CAGA,iBAGE,aAAc,CAFd,cAAe,CACf,8CAAgD,CAEhD,OACF,CAGA,yBAEE,4BAA6B,CAD7B,gDAEF,CAGA,qBAEE,2BAA4B,CAC5B,WAAY,CAFZ,kDAAoD,CAGpD,OACF,CAGA,iBAEE,iBAAkB,CAClB,wBAAyB,CAFzB,6EAAiF,CAGjF,OAKF,CAHE,sCACE,iCACF","file":"subhead.css","sourcesContent":["/* Subhead */\n\n.Subhead {\n display: flex;\n padding-bottom: var(--primer-stack-padding-condensed, 8px);\n margin-bottom: var(--primer-stack-gap-normal, 16px);\n border-bottom: var(--primer-borderWidth-thin, 1px) solid var(--color-border-muted);\n flex-flow: row wrap;\n justify-content: flex-end; /* Keep actions right aligned. */\n}\n\n/* Modifier class to give a lot of breathing room between sections of content. */\n.Subhead--spacious {\n margin-top: var(--base-size-40, 40px);\n}\n\n/* <h2> sized heading with normal font weight */\n.Subhead-heading {\n font-size: 24px;\n font-weight: var(--base-text-weight-normal, 400);\n flex: 1 1 auto;\n order: 0;\n}\n\n/* Make the text bold and red for dangerous content */\n.Subhead-heading--danger {\n font-weight: var(--base-text-weight-semibold, 600);\n color: var(--color-danger-fg);\n}\n\n/* One-liner of supporting text */\n.Subhead-description {\n font-size: var(--primer-text-body-size-medium, 14px);\n color: var(--color-fg-muted);\n flex: 1 100%;\n order: 2;\n}\n\n/* Add 1 or 2 buttons to the right of the heading */\n.Subhead-actions {\n margin: var(--base-size-4, 4px) 0 var(--base-size-4, 4px) var(--base-size-4, 4px);\n align-self: center;\n justify-content: flex-end;\n order: 1;\n\n & + .Subhead-description {\n margin-top: var(--base-size-4, 4px);\n }\n}\n"]}