primer_view_components 0.0.38 → 0.0.43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +283 -27
  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/components/primer/auto_complete.rb +4 -2
  6. data/app/components/primer/auto_complete/item.rb +1 -1
  7. data/app/components/primer/avatar_component.rb +22 -3
  8. data/app/components/primer/avatar_stack_component.rb +8 -5
  9. data/app/components/primer/base_button.rb +1 -1
  10. data/app/components/primer/base_component.rb +24 -13
  11. data/app/components/primer/blankslate_component.html.erb +1 -0
  12. data/app/components/primer/blankslate_component.rb +68 -47
  13. data/app/components/primer/border_box_component.rb +1 -1
  14. data/app/components/primer/box_component.rb +1 -1
  15. data/app/components/primer/breadcrumb_component.rb +1 -1
  16. data/app/components/primer/button_component.html.erb +9 -0
  17. data/app/components/primer/button_component.rb +39 -5
  18. data/app/components/primer/button_group.rb +3 -3
  19. data/app/components/primer/button_marketing_component.rb +1 -1
  20. data/app/components/primer/clipboard_copy.rb +1 -1
  21. data/app/components/primer/clipboard_copy_component.js +17 -8
  22. data/app/components/primer/clipboard_copy_component.ts +19 -8
  23. data/app/components/primer/close_button.rb +4 -2
  24. data/app/components/primer/component.rb +22 -3
  25. data/app/components/primer/counter_component.rb +6 -1
  26. data/app/components/primer/details_component.rb +1 -1
  27. data/app/components/primer/dropdown/menu_component.rb +1 -1
  28. data/app/components/primer/dropdown_component.rb +1 -1
  29. data/app/components/primer/flash_component.rb +3 -3
  30. data/app/components/primer/flex_component.rb +28 -1
  31. data/app/components/primer/flex_item_component.rb +20 -1
  32. data/app/components/primer/heading_component.rb +12 -19
  33. data/app/components/primer/hidden_text_expander.rb +4 -4
  34. data/app/components/primer/icon_button.rb +65 -0
  35. data/app/components/primer/image.rb +46 -0
  36. data/app/components/primer/image_crop.d.ts +1 -0
  37. data/app/components/primer/image_crop.html.erb +12 -0
  38. data/app/components/primer/image_crop.js +1 -0
  39. data/app/components/primer/image_crop.rb +36 -0
  40. data/app/components/primer/image_crop.ts +1 -0
  41. data/app/components/primer/label_component.rb +7 -3
  42. data/app/components/primer/layout_component.rb +1 -1
  43. data/app/components/primer/link_component.rb +1 -1
  44. data/app/components/primer/local_time.d.ts +1 -0
  45. data/app/components/primer/local_time.js +1 -0
  46. data/app/components/primer/local_time.rb +59 -0
  47. data/app/components/primer/local_time.ts +1 -0
  48. data/app/components/primer/{markdown_component.rb → markdown.rb} +12 -7
  49. data/app/components/primer/menu_component.rb +1 -1
  50. data/app/components/primer/navigation/tab_component.rb +8 -1
  51. data/app/components/primer/octicon_component.html.erb +7 -0
  52. data/app/components/primer/octicon_component.rb +53 -19
  53. data/app/components/primer/octicon_symbols_component.html.erb +3 -0
  54. data/app/components/primer/octicon_symbols_component.rb +61 -0
  55. data/app/components/primer/popover_component.rb +1 -1
  56. data/app/components/primer/primer.d.ts +2 -0
  57. data/app/components/primer/primer.js +2 -0
  58. data/app/components/primer/primer.ts +2 -0
  59. data/app/components/primer/progress_bar_component.rb +1 -1
  60. data/app/components/primer/spinner_component.rb +3 -3
  61. data/app/components/primer/state_component.rb +1 -1
  62. data/app/components/primer/subhead_component.rb +34 -4
  63. data/app/components/primer/tab_container_component.rb +1 -1
  64. data/app/components/primer/tab_nav_component.html.erb +5 -1
  65. data/app/components/primer/tab_nav_component.rb +63 -10
  66. data/app/components/primer/text_component.rb +6 -3
  67. data/app/components/primer/time_ago_component.rb +1 -1
  68. data/app/components/primer/timeline_item_component.rb +1 -1
  69. data/app/components/primer/{tooltip_component.rb → tooltip.rb} +11 -9
  70. data/app/components/primer/truncate.rb +7 -3
  71. data/app/components/primer/underline_nav_component.html.erb +1 -1
  72. data/app/components/primer/underline_nav_component.rb +18 -2
  73. data/app/lib/primer/classify.rb +27 -39
  74. data/app/lib/primer/classify/cache.rb +35 -15
  75. data/app/lib/primer/classify/flex.rb +111 -0
  76. data/app/lib/primer/classify/functional_border_colors.rb +1 -2
  77. data/app/lib/primer/classify/grid.rb +45 -0
  78. data/app/lib/primer/fetch_or_fallback_helper.rb +2 -2
  79. data/app/lib/primer/octicon/cache.rb +42 -0
  80. data/app/lib/primer/tabbed_component_helper.rb +2 -2
  81. data/app/lib/primer/view_helper.rb +2 -1
  82. data/lib/primer/view_components.rb +1 -1
  83. data/lib/primer/view_components/engine.rb +2 -0
  84. data/lib/primer/view_components/linters.rb +3 -0
  85. data/lib/primer/view_components/linters/button_component_migration_counter.rb +16 -0
  86. data/lib/primer/view_components/linters/flash_component_migration_counter.rb +16 -0
  87. data/lib/primer/view_components/linters/helpers.rb +89 -0
  88. data/lib/primer/view_components/version.rb +1 -1
  89. data/lib/tasks/coverage.rake +14 -0
  90. data/lib/tasks/docs.rake +372 -0
  91. data/lib/tasks/statuses.rake +12 -0
  92. data/lib/yard/docs_helper.rb +57 -0
  93. data/static/statuses.json +54 -1
  94. metadata +62 -11
  95. data/app/components/primer/button_component.rb.orig +0 -138
  96. data/app/components/primer/foo_bar.d.ts +0 -1
  97. data/app/components/primer/foo_bar.js +0 -1
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :statuses do
4
+ task :dump do
5
+ require File.expand_path("./../../demo/config/environment.rb", __dir__)
6
+ require "primer/view_components"
7
+ # Loads all components for `.descendants` to work properly
8
+ Dir["./app/components/primer/**/*.rb"].sort.each { |file| require file }
9
+
10
+ Primer::ViewComponents.dump_statuses
11
+ end
12
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YARD
4
+ # Helper methods to use for yard documentation
5
+ module DocsHelper
6
+ def one_of(enumerable, lower: false)
7
+ values =
8
+ case enumerable
9
+ when Hash
10
+ enumerable.map do |key, value|
11
+ "#{pretty_value(key)} (#{pretty_value(value)})"
12
+ end
13
+ else
14
+ enumerable.map do |key|
15
+ pretty_value(key)
16
+ end
17
+ end
18
+
19
+ prefix = "One of"
20
+ prefix = prefix.downcase if lower
21
+
22
+ "#{prefix} #{values.to_sentence(last_word_connector: ', or ')}."
23
+ end
24
+
25
+ def link_to_system_arguments_docs
26
+ "[System arguments](/system-arguments)"
27
+ end
28
+
29
+ def link_to_typography_docs
30
+ "[Typography](/system-arguments#typography)"
31
+ end
32
+
33
+ def link_to_component(component)
34
+ short_name = component.name.gsub(/Primer|::|Component/, "")
35
+ "[#{short_name}](/components/#{short_name.downcase})"
36
+ end
37
+
38
+ def link_to_octicons
39
+ "[Octicon](https://primer.style/octicons/)"
40
+ end
41
+
42
+ def link_to_heading_practices
43
+ "[Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)"
44
+ end
45
+
46
+ def pretty_value(val)
47
+ case val
48
+ when nil
49
+ "`nil`"
50
+ when Symbol
51
+ "`:#{val}`"
52
+ else
53
+ "`#{val}`"
54
+ end
55
+ end
56
+ end
57
+ end
data/static/statuses.json CHANGED
@@ -1 +1,54 @@
1
- {"Primer::AutoComplete":"beta","Primer::AutoComplete::Item":"beta","Primer::AvatarComponent":"beta","Primer::AvatarStackComponent":"beta","Primer::BaseButton":"beta","Primer::BaseComponent":"beta","Primer::BlankslateComponent":"beta","Primer::BorderBoxComponent":"beta","Primer::BoxComponent":"stable","Primer::BreadcrumbComponent":"beta","Primer::BreadcrumbComponent::ItemComponent":"alpha","Primer::ButtonComponent":"beta","Primer::ButtonGroup":"beta","Primer::ButtonMarketingComponent":"alpha","Primer::ClipboardCopy":"alpha","Primer::CloseButton":"alpha","Primer::CounterComponent":"beta","Primer::DetailsComponent":"beta","Primer::Dropdown::MenuComponent":"alpha","Primer::DropdownComponent":"alpha","Primer::DropdownMenuComponent":"deprecated","Primer::FlashComponent":"beta","Primer::FlexComponent":"alpha","Primer::FlexItemComponent":"alpha","Primer::HeadingComponent":"beta","Primer::HiddenTextExpander":"alpha","Primer::LabelComponent":"beta","Primer::LayoutComponent":"alpha","Primer::LinkComponent":"beta","Primer::MarkdownComponent":"alpha","Primer::MenuComponent":"alpha","Primer::Navigation::TabComponent":"alpha","Primer::OcticonComponent":"beta","Primer::PopoverComponent":"beta","Primer::ProgressBarComponent":"beta","Primer::SpinnerComponent":"beta","Primer::StateComponent":"beta","Primer::SubheadComponent":"beta","Primer::TabContainerComponent":"alpha","Primer::TabNavComponent":"alpha","Primer::TextComponent":"beta","Primer::TimeAgoComponent":"beta","Primer::TimelineItemComponent":"beta","Primer::TimelineItemComponent::BadgeComponent":"alpha","Primer::TooltipComponent":"alpha","Primer::Truncate":"beta","Primer::UnderlineNavComponent":"alpha"}
1
+ {
2
+ "Primer::AutoComplete": "beta",
3
+ "Primer::AutoComplete::Item": "beta",
4
+ "Primer::AvatarComponent": "beta",
5
+ "Primer::AvatarStackComponent": "beta",
6
+ "Primer::BaseButton": "beta",
7
+ "Primer::BaseComponent": "beta",
8
+ "Primer::BlankslateComponent": "beta",
9
+ "Primer::BorderBoxComponent": "beta",
10
+ "Primer::BoxComponent": "stable",
11
+ "Primer::BreadcrumbComponent": "beta",
12
+ "Primer::BreadcrumbComponent::ItemComponent": "alpha",
13
+ "Primer::ButtonComponent": "beta",
14
+ "Primer::ButtonGroup": "beta",
15
+ "Primer::ButtonMarketingComponent": "alpha",
16
+ "Primer::ClipboardCopy": "alpha",
17
+ "Primer::CloseButton": "beta",
18
+ "Primer::CounterComponent": "beta",
19
+ "Primer::DetailsComponent": "beta",
20
+ "Primer::Dropdown::MenuComponent": "alpha",
21
+ "Primer::DropdownComponent": "alpha",
22
+ "Primer::DropdownMenuComponent": "deprecated",
23
+ "Primer::FlashComponent": "beta",
24
+ "Primer::FlexComponent": "deprecated",
25
+ "Primer::FlexItemComponent": "deprecated",
26
+ "Primer::HeadingComponent": "beta",
27
+ "Primer::HiddenTextExpander": "alpha",
28
+ "Primer::IconButton": "beta",
29
+ "Primer::Image": "alpha",
30
+ "Primer::ImageCrop": "alpha",
31
+ "Primer::LabelComponent": "beta",
32
+ "Primer::LayoutComponent": "alpha",
33
+ "Primer::LinkComponent": "beta",
34
+ "Primer::LocalTime": "alpha",
35
+ "Primer::Markdown": "beta",
36
+ "Primer::MenuComponent": "alpha",
37
+ "Primer::Navigation::TabComponent": "alpha",
38
+ "Primer::OcticonComponent": "beta",
39
+ "Primer::OcticonSymbolsComponent": "alpha",
40
+ "Primer::PopoverComponent": "beta",
41
+ "Primer::ProgressBarComponent": "beta",
42
+ "Primer::SpinnerComponent": "beta",
43
+ "Primer::StateComponent": "beta",
44
+ "Primer::SubheadComponent": "beta",
45
+ "Primer::TabContainerComponent": "alpha",
46
+ "Primer::TabNavComponent": "beta",
47
+ "Primer::TextComponent": "beta",
48
+ "Primer::TimeAgoComponent": "beta",
49
+ "Primer::TimelineItemComponent": "beta",
50
+ "Primer::TimelineItemComponent::BadgeComponent": "alpha",
51
+ "Primer::Tooltip": "beta",
52
+ "Primer::Truncate": "beta",
53
+ "Primer::UnderlineNavComponent": "alpha"
54
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: primer_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.38
4
+ version: 0.0.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-26 00:00:00.000000000 Z
11
+ date: 2021-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 5.0.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: octicons_helper
42
+ name: octicons
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -86,6 +86,20 @@ dependencies:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: 0.6.3
89
+ - !ruby/object:Gem::Dependency
90
+ name: axe-core-api
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '4.1'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '4.1'
89
103
  - !ruby/object:Gem::Dependency
90
104
  name: benchmark-ips
91
105
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +134,28 @@ dependencies:
120
134
  requirements:
121
135
  - - '='
122
136
  - !ruby/object:Gem::Version
123
- version: '0.11'
137
+ version: '0.13'
124
138
  type: :development
125
139
  prerelease: false
126
140
  version_requirements: !ruby/object:Gem::Requirement
127
141
  requirements:
128
142
  - - '='
129
143
  - !ruby/object:Gem::Version
130
- version: '0.11'
144
+ version: '0.13'
145
+ - !ruby/object:Gem::Dependency
146
+ name: erb_lint
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
131
159
  - !ruby/object:Gem::Dependency
132
160
  name: listen
133
161
  requirement: !ruby/object:Gem::Requirement
@@ -342,8 +370,8 @@ files:
342
370
  - app/components/primer/box_component.rb
343
371
  - app/components/primer/breadcrumb_component.html.erb
344
372
  - app/components/primer/breadcrumb_component.rb
373
+ - app/components/primer/button_component.html.erb
345
374
  - app/components/primer/button_component.rb
346
- - app/components/primer/button_component.rb.orig
347
375
  - app/components/primer/button_group.html.erb
348
376
  - app/components/primer/button_group.rb
349
377
  - app/components/primer/button_marketing_component.rb
@@ -367,20 +395,32 @@ files:
367
395
  - app/components/primer/flash_component.rb
368
396
  - app/components/primer/flex_component.rb
369
397
  - app/components/primer/flex_item_component.rb
370
- - app/components/primer/foo_bar.d.ts
371
- - app/components/primer/foo_bar.js
372
398
  - app/components/primer/heading_component.rb
373
399
  - app/components/primer/hidden_text_expander.rb
400
+ - app/components/primer/icon_button.rb
401
+ - app/components/primer/image.rb
402
+ - app/components/primer/image_crop.d.ts
403
+ - app/components/primer/image_crop.html.erb
404
+ - app/components/primer/image_crop.js
405
+ - app/components/primer/image_crop.rb
406
+ - app/components/primer/image_crop.ts
374
407
  - app/components/primer/label_component.rb
375
408
  - app/components/primer/layout_component.html.erb
376
409
  - app/components/primer/layout_component.rb
377
410
  - app/components/primer/link_component.rb
378
- - app/components/primer/markdown_component.rb
411
+ - app/components/primer/local_time.d.ts
412
+ - app/components/primer/local_time.js
413
+ - app/components/primer/local_time.rb
414
+ - app/components/primer/local_time.ts
415
+ - app/components/primer/markdown.rb
379
416
  - app/components/primer/menu_component.html.erb
380
417
  - app/components/primer/menu_component.rb
381
418
  - app/components/primer/navigation/tab_component.html.erb
382
419
  - app/components/primer/navigation/tab_component.rb
420
+ - app/components/primer/octicon_component.html.erb
383
421
  - app/components/primer/octicon_component.rb
422
+ - app/components/primer/octicon_symbols_component.html.erb
423
+ - app/components/primer/octicon_symbols_component.rb
384
424
  - app/components/primer/popover_component.html.erb
385
425
  - app/components/primer/popover_component.rb
386
426
  - app/components/primer/primer.d.ts
@@ -406,27 +446,38 @@ files:
406
446
  - app/components/primer/time_ago_component.ts
407
447
  - app/components/primer/timeline_item_component.html.erb
408
448
  - app/components/primer/timeline_item_component.rb
409
- - app/components/primer/tooltip_component.rb
449
+ - app/components/primer/tooltip.rb
410
450
  - app/components/primer/truncate.rb
411
451
  - app/components/primer/underline_nav_component.html.erb
412
452
  - app/components/primer/underline_nav_component.rb
413
453
  - app/lib/primer/class_name_helper.rb
414
454
  - app/lib/primer/classify.rb
415
455
  - app/lib/primer/classify/cache.rb
456
+ - app/lib/primer/classify/flex.rb
416
457
  - app/lib/primer/classify/functional_background_colors.rb
417
458
  - app/lib/primer/classify/functional_border_colors.rb
418
459
  - app/lib/primer/classify/functional_colors.rb
419
460
  - app/lib/primer/classify/functional_text_colors.rb
461
+ - app/lib/primer/classify/grid.rb
420
462
  - app/lib/primer/classify/spacing.rb
421
463
  - app/lib/primer/fetch_or_fallback_helper.rb
422
464
  - app/lib/primer/join_style_arguments_helper.rb
465
+ - app/lib/primer/octicon/cache.rb
423
466
  - app/lib/primer/status/dsl.rb
424
467
  - app/lib/primer/tabbed_component_helper.rb
425
468
  - app/lib/primer/test_selector_helper.rb
426
469
  - app/lib/primer/view_helper.rb
427
470
  - lib/primer/view_components.rb
428
471
  - lib/primer/view_components/engine.rb
472
+ - lib/primer/view_components/linters.rb
473
+ - lib/primer/view_components/linters/button_component_migration_counter.rb
474
+ - lib/primer/view_components/linters/flash_component_migration_counter.rb
475
+ - lib/primer/view_components/linters/helpers.rb
429
476
  - lib/primer/view_components/version.rb
477
+ - lib/tasks/coverage.rake
478
+ - lib/tasks/docs.rake
479
+ - lib/tasks/statuses.rake
480
+ - lib/yard/docs_helper.rb
430
481
  - lib/yard/renders_many_handler.rb
431
482
  - lib/yard/renders_one_handler.rb
432
483
  - static/statuses.json
@@ -450,7 +501,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
450
501
  - !ruby/object:Gem::Version
451
502
  version: '0'
452
503
  requirements: []
453
- rubygems_version: 3.1.2
504
+ rubygems_version: 3.0.3
454
505
  signing_key:
455
506
  specification_version: 4
456
507
  summary: ViewComponents for the Primer Design System
@@ -1,138 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Primer
4
- # Use buttons for actions (e.g. in forms). Use links for destinations, or moving from one page to another.
5
- class ButtonComponent < Primer::Component
6
- status :beta
7
-
8
- DEFAULT_SCHEME = :default
9
- LINK_SCHEME = :link
10
- SCHEME_MAPPINGS = {
11
- DEFAULT_SCHEME => "",
12
- :primary => "btn-primary",
13
- :danger => "btn-danger",
14
- :outline => "btn-outline",
15
- :invisible => "btn-invisible",
16
- LINK_SCHEME => "btn-link"
17
- }.freeze
18
- SCHEME_OPTIONS = SCHEME_MAPPINGS.keys
19
-
20
- DEFAULT_VARIANT = :medium
21
- VARIANT_MAPPINGS = {
22
- :small => "btn-sm",
23
- DEFAULT_VARIANT => "",
24
- :large => "btn-large"
25
- }.freeze
26
- VARIANT_OPTIONS = VARIANT_MAPPINGS.keys
27
-
28
- <<<<<<< HEAD
29
- =======
30
- DEFAULT_TAG = :button
31
- TAG_OPTIONS = [DEFAULT_TAG, :a, :summary].freeze
32
-
33
- DEFAULT_TYPE = :button
34
- TYPE_OPTIONS = [DEFAULT_TYPE, :reset, :submit].freeze
35
-
36
- DEFAULT_ICON_ALIGN = :left
37
- ICON_ALIGN_OPTIONS = [DEFAULT_ICON_ALIGN, :right].freeze
38
-
39
- # Icon to be rendered in the button.
40
- #
41
- # @param align [Symbol] <%= one_of(Primer::ButtonComponent::ICON_ALIGN_OPTIONS) %>
42
- # @param system_arguments [Hash] Same arguments as <%= link_to_component(Primer::OcticonComponent) %>.
43
- renders_one :icon, lambda { |align: DEFAULT_ICON_ALIGN, **system_arguments|
44
- @icon_align = fetch_or_fallback(ICON_ALIGN_OPTIONS, align, DEFAULT_ICON_ALIGN)
45
-
46
- Primer::OcticonComponent.new(**system_arguments)
47
- }
48
-
49
- # Counter to be rendered in the button.
50
- #
51
- # @param system_arguments [Hash] Same arguments as <%= link_to_component(Primer::CounterComponent) %>.
52
- renders_one :counter, Primer::CounterComponent
53
-
54
- >>>>>>> 05bacd3 (add icon and counter slots to button)
55
- # @example Schemes
56
- # <%= render(Primer::ButtonComponent.new) { "Default" } %>
57
- # <%= render(Primer::ButtonComponent.new(scheme: :primary)) { "Primary" } %>
58
- # <%= render(Primer::ButtonComponent.new(scheme: :danger)) { "Danger" } %>
59
- # <%= render(Primer::ButtonComponent.new(scheme: :outline)) { "Outline" } %>
60
- # <%= render(Primer::ButtonComponent.new(scheme: :invisible)) { "Invisible" } %>
61
- # <%= render(Primer::ButtonComponent.new(scheme: :link)) { "Link" } %>
62
- #
63
- # @example Variants
64
- # <%= render(Primer::ButtonComponent.new(variant: :small)) { "Small" } %>
65
- # <%= render(Primer::ButtonComponent.new(variant: :medium)) { "Medium" } %>
66
- # <%= render(Primer::ButtonComponent.new(variant: :large)) { "Large" } %>
67
- #
68
- # @example Block
69
- # <%= render(Primer::ButtonComponent.new(block: :true)) { "Block" } %>
70
- # <%= render(Primer::ButtonComponent.new(block: :true, scheme: :primary)) { "Primary block" } %>
71
- #
72
- # @example With icons
73
- # <%= render(Primer::ButtonComponent.new) do |c| %>
74
- # <% c.icon(icon: :star) %>
75
- # Button
76
- # <% end %>
77
- # <%= render(Primer::ButtonComponent.new) do |c| %>
78
- # <% c.icon(icon: :star, align: :right) %>
79
- # Button
80
- # <% end %>
81
- #
82
- # @example With counter
83
- # <%= render(Primer::ButtonComponent.new) do |c| %>
84
- # <% c.counter(count: 15) %>
85
- # Button
86
- # <% end %>
87
- #
88
- # @example With icons and counter
89
- # <%= render(Primer::ButtonComponent.new) do |c| %>
90
- # <% c.icon(icon: :star) %>
91
- # <% c.counter(count: 15) %>
92
- # Button
93
- # <% end %>
94
- # <%= render(Primer::ButtonComponent.new) do |c| %>
95
- # <% c.icon(icon: :star, align: :right) %>
96
- # <% c.counter(count: 15) %>
97
- # Button
98
- # <% end %>
99
- #
100
- # @param scheme [Symbol] <%= one_of(Primer::ButtonComponent::SCHEME_OPTIONS) %>
101
- # @param variant [Symbol] <%= one_of(Primer::ButtonComponent::VARIANT_OPTIONS) %>
102
- # @param tag [Symbol] <%= one_of(Primer::BaseButton::TAG_OPTIONS) %>
103
- # @param type [Symbol] <%= one_of(Primer::BaseButton::TYPE_OPTIONS) %>
104
- # @param group_item [Boolean] Whether button is part of a ButtonGroup.
105
- # @param block [Boolean] Whether button is full-width with `display: block`.
106
- def initialize(
107
- scheme: DEFAULT_SCHEME,
108
- variant: DEFAULT_VARIANT,
109
- group_item: false,
110
- block: false,
111
- **system_arguments
112
- )
113
- @scheme = scheme
114
- @system_arguments = system_arguments
115
- @system_arguments[:classes] = class_names(
116
- system_arguments[:classes],
117
- SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)],
118
- VARIANT_MAPPINGS[fetch_or_fallback(VARIANT_OPTIONS, variant, DEFAULT_VARIANT)],
119
- "btn" => !link?,
120
- "btn-block" => block,
121
- "BtnGroup-item" => group_item
122
- )
123
- end
124
-
125
- <<<<<<< HEAD
126
- def call
127
- render(Primer::BaseButton.new(**@system_arguments)) { content }
128
- end
129
-
130
- =======
131
- >>>>>>> 05bacd3 (add icon and counter slots to button)
132
- private
133
-
134
- def link?
135
- @scheme == LINK_SCHEME
136
- end
137
- end
138
- end
@@ -1 +0,0 @@
1
- import '@github/details-menu-element';
@@ -1 +0,0 @@
1
- import '@github/details-menu-element';