primer_view_components 0.0.39 → 0.0.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +269 -3
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/components/primer/alpha/button_marketing.rb +70 -0
- data/app/components/primer/auto_complete.rb +99 -41
- data/app/components/primer/auto_complete/auto_complete.html.erb +1 -0
- data/app/components/primer/avatar_stack_component.rb +7 -4
- data/app/components/primer/base_component.rb +17 -7
- data/app/components/primer/beta/text.rb +27 -0
- data/app/components/primer/blankslate_component.html.erb +1 -0
- data/app/components/primer/blankslate_component.rb +68 -49
- data/app/components/primer/button_component.rb +3 -2
- data/app/components/primer/button_group.rb +2 -2
- data/app/components/primer/clipboard_copy_component.js +13 -2
- data/app/components/primer/clipboard_copy_component.ts +15 -2
- data/app/components/primer/component.rb +6 -1
- data/app/components/primer/counter_component.rb +6 -1
- data/app/components/primer/details_component.rb +12 -1
- data/app/components/primer/dropdown.d.ts +1 -0
- data/app/components/primer/{dropdown_component.html.erb → dropdown.html.erb} +2 -1
- data/app/components/primer/dropdown.js +1 -0
- data/app/components/primer/dropdown.rb +149 -0
- data/app/components/primer/dropdown.ts +1 -0
- data/app/components/primer/dropdown/menu.d.ts +1 -0
- data/app/components/primer/dropdown/menu.html.erb +25 -0
- data/app/components/primer/dropdown/menu.js +1 -0
- data/app/components/primer/dropdown/menu.rb +99 -0
- data/app/components/primer/dropdown/menu.ts +1 -0
- data/app/components/primer/flash_component.rb +2 -2
- data/app/components/primer/flex_component.rb +27 -0
- data/app/components/primer/flex_item_component.rb +1 -1
- data/app/components/primer/heading_component.rb +11 -18
- data/app/components/primer/hidden_text_expander.rb +3 -3
- data/app/components/primer/icon_button.rb +20 -3
- data/app/components/primer/image.rb +46 -0
- data/app/components/primer/image_crop.d.ts +1 -0
- data/app/components/primer/image_crop.html.erb +12 -0
- data/app/components/primer/image_crop.js +1 -0
- data/app/components/primer/image_crop.rb +36 -0
- data/app/components/primer/image_crop.ts +1 -0
- data/app/components/primer/label_component.rb +6 -2
- data/app/components/primer/local_time.d.ts +1 -0
- data/app/components/primer/local_time.js +1 -0
- data/app/components/primer/local_time.rb +59 -0
- data/app/components/primer/local_time.ts +1 -0
- data/app/components/primer/{markdown_component.rb → markdown.rb} +11 -6
- data/app/components/primer/navigation/tab_component.rb +10 -3
- data/app/components/primer/octicon_component.html.erb +7 -0
- data/app/components/primer/octicon_component.rb +25 -15
- data/app/components/primer/octicon_symbols_component.html.erb +3 -0
- data/app/components/primer/octicon_symbols_component.rb +61 -0
- data/app/components/primer/primer.d.ts +3 -0
- data/app/components/primer/primer.js +3 -0
- data/app/components/primer/primer.ts +3 -0
- data/app/components/primer/spinner_component.rb +4 -2
- data/app/components/primer/subhead_component.rb +34 -4
- data/app/components/primer/tab_nav_component.html.erb +5 -1
- data/app/components/primer/tab_nav_component.rb +62 -9
- data/app/components/primer/{tooltip_component.rb → tooltip.rb} +10 -8
- data/app/components/primer/truncate.rb +6 -2
- data/app/components/primer/underline_nav_component.html.erb +1 -1
- data/app/components/primer/underline_nav_component.rb +17 -1
- data/app/lib/primer/classify.rb +21 -8
- data/app/lib/primer/classify/cache.rb +16 -1
- data/app/lib/primer/classify/grid.rb +45 -0
- data/app/lib/primer/octicon/cache.rb +4 -0
- data/app/lib/primer/tabbed_component_helper.rb +2 -2
- data/app/lib/primer/view_helper.rb +2 -1
- data/lib/primer/view_components.rb +1 -1
- data/lib/primer/view_components/engine.rb +2 -0
- data/lib/primer/view_components/linters.rb +3 -0
- data/lib/primer/view_components/linters/argument_mappers/button.rb +82 -0
- data/lib/primer/view_components/linters/argument_mappers/conversion_error.rb +10 -0
- data/lib/primer/view_components/linters/argument_mappers/system_arguments.rb +46 -0
- data/lib/primer/view_components/linters/button_component_migration_counter.rb +35 -0
- data/lib/primer/view_components/linters/flash_component_migration_counter.rb +16 -0
- data/lib/primer/view_components/linters/helpers.rb +93 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/tasks/coverage.rake +14 -0
- data/lib/tasks/docs.rake +387 -0
- data/lib/tasks/statuses.rake +12 -0
- data/lib/yard/docs_helper.rb +67 -0
- data/static/statuses.json +56 -1
- metadata +72 -13
- data/app/components/primer/button_marketing_component.rb +0 -68
- data/app/components/primer/dropdown/menu_component.html.erb +0 -12
- data/app/components/primer/dropdown/menu_component.rb +0 -46
- data/app/components/primer/dropdown_component.rb +0 -73
- data/app/components/primer/text_component.rb +0 -22
@@ -1,73 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Primer
|
4
|
-
# `Dropdown` is a lightweight context menu for housing navigation and actions.
|
5
|
-
# They're great for instances where you don't need the full power (and code) of the select menu.
|
6
|
-
class DropdownComponent < Primer::Component
|
7
|
-
# Required trigger for the dropdown. Only accepts a content.
|
8
|
-
# Its classes can be customized by the `summary_classes` param in the parent component
|
9
|
-
renders_one :button
|
10
|
-
|
11
|
-
# Required context menu for the dropdown
|
12
|
-
#
|
13
|
-
# @param direction [Symbol] <%= one_of(Primer::Dropdown::MenuComponent::DIRECTION_OPTIONS) %>
|
14
|
-
# @param scheme [Symbol] Pass `:dark` for dark mode theming
|
15
|
-
# @param header [String] Optional string to display as the header
|
16
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
17
|
-
renders_one :menu, Primer::Dropdown::MenuComponent
|
18
|
-
|
19
|
-
# @example Default
|
20
|
-
# <div>
|
21
|
-
# <%= render(Primer::DropdownComponent.new) do |c| %>
|
22
|
-
# <% c.button do %>
|
23
|
-
# Dropdown
|
24
|
-
# <% end %>
|
25
|
-
#
|
26
|
-
# <%= c.menu(header: "Options") do |menu|
|
27
|
-
# menu.item { "Item 1" }
|
28
|
-
# menu.item { "Item 2" }
|
29
|
-
# menu.item(divider: true)
|
30
|
-
# menu.item { "Item 3" }
|
31
|
-
# menu.item { "Item 4" }
|
32
|
-
# end %>
|
33
|
-
# <% end %>
|
34
|
-
# </div>
|
35
|
-
#
|
36
|
-
# @example With Direction
|
37
|
-
# <div>
|
38
|
-
# <%= render(Primer::DropdownComponent.new) do |c| %>
|
39
|
-
# <% c.button do %>
|
40
|
-
# Dropdown
|
41
|
-
# <% end %>
|
42
|
-
#
|
43
|
-
# <%= c.menu(header: "Options", direction: :s) do |menu|
|
44
|
-
# menu.item { "Item 1" }
|
45
|
-
# menu.item { "Item 2" }
|
46
|
-
# menu.item(divider: true)
|
47
|
-
# menu.item { "Item 3" }
|
48
|
-
# menu.item { "Item 4" }
|
49
|
-
# end %>
|
50
|
-
# <% end %>
|
51
|
-
# </div>
|
52
|
-
#
|
53
|
-
# @param overlay [Symbol] <%= one_of(Primer::DetailsComponent::OVERLAY_MAPPINGS.keys) %>
|
54
|
-
# @param reset [Boolean] Whether to hide the default caret on the button
|
55
|
-
# @param summary_classes [String] Custom classes to add to the button
|
56
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
57
|
-
def initialize(overlay: :default, reset: true, summary_classes: "", **system_arguments)
|
58
|
-
@system_arguments = system_arguments
|
59
|
-
@system_arguments[:overlay] = overlay
|
60
|
-
@system_arguments[:reset] = reset
|
61
|
-
@system_arguments[:position] = :relative
|
62
|
-
@system_arguments[:classes] = class_names(
|
63
|
-
@system_arguments[:classes],
|
64
|
-
"dropdown"
|
65
|
-
)
|
66
|
-
@summary_classes = summary_classes
|
67
|
-
end
|
68
|
-
|
69
|
-
def render?
|
70
|
-
button.present? && menu.present?
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Primer
|
4
|
-
# `Text` is a wrapper component that will apply typography styles to the text inside.
|
5
|
-
class TextComponent < Primer::Component
|
6
|
-
status :beta
|
7
|
-
|
8
|
-
# @example Default
|
9
|
-
# <%= render(Primer::TextComponent.new(tag: :p, font_weight: :bold)) { "Bold Text" } %>
|
10
|
-
# <%= render(Primer::TextComponent.new(tag: :p, color: :text_danger)) { "Danger Text" } %>
|
11
|
-
#
|
12
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
13
|
-
def initialize(**system_arguments)
|
14
|
-
@system_arguments = system_arguments
|
15
|
-
@system_arguments[:tag] ||= :span
|
16
|
-
end
|
17
|
-
|
18
|
-
def call
|
19
|
-
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|