primer_view_components 0.0.40 → 0.0.45

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +239 -1
  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/alpha/button_marketing.rb +70 -0
  6. data/app/components/primer/auto_complete.rb +99 -41
  7. data/app/components/primer/auto_complete/auto_complete.html.erb +1 -0
  8. data/app/components/primer/{auto_complete/auto_component.d.ts → auto_complete_component.d.ts} +0 -0
  9. data/app/components/primer/{auto_complete/auto_component.js → auto_complete_component.js} +0 -0
  10. data/app/components/primer/avatar_stack_component.rb +2 -2
  11. data/app/components/primer/base_component.rb +31 -21
  12. data/app/components/primer/beta/text.rb +27 -0
  13. data/app/components/primer/blankslate_component.html.erb +1 -0
  14. data/app/components/primer/blankslate_component.rb +65 -46
  15. data/app/components/primer/button_component.rb +3 -2
  16. data/app/components/primer/button_group.rb +1 -1
  17. data/app/components/primer/clipboard_copy.rb +25 -7
  18. data/app/components/primer/clipboard_copy_component.js +13 -2
  19. data/app/components/primer/clipboard_copy_component.ts +15 -2
  20. data/app/components/primer/component.rb +1 -1
  21. data/app/components/primer/details_component.rb +12 -1
  22. data/app/components/primer/details_menu_component.d.ts +1 -0
  23. data/app/components/primer/details_menu_component.js +1 -0
  24. data/app/components/primer/dropdown.d.ts +1 -0
  25. data/app/components/primer/{dropdown_component.html.erb → dropdown.html.erb} +2 -1
  26. data/app/components/primer/dropdown.js +1 -0
  27. data/app/components/primer/dropdown.rb +149 -0
  28. data/app/components/primer/dropdown.ts +1 -0
  29. data/app/components/primer/dropdown/menu.d.ts +1 -0
  30. data/app/components/primer/dropdown/menu.html.erb +25 -0
  31. data/app/components/primer/dropdown/menu.js +1 -0
  32. data/app/components/primer/dropdown/menu.rb +99 -0
  33. data/app/components/primer/dropdown/menu.ts +1 -0
  34. data/app/components/primer/flash_component.rb +2 -2
  35. data/app/components/primer/heading_component.rb +1 -1
  36. data/app/components/primer/hidden_text_expander.rb +2 -2
  37. data/app/components/primer/icon_button.rb +1 -1
  38. data/app/components/primer/image.rb +46 -0
  39. data/app/components/primer/image_crop.rb +2 -2
  40. data/app/components/primer/label_component.rb +6 -2
  41. data/app/components/primer/local_time.d.ts +1 -0
  42. data/app/components/primer/local_time.js +1 -0
  43. data/app/components/primer/local_time.rb +59 -0
  44. data/app/components/primer/local_time.ts +1 -0
  45. data/app/components/primer/markdown.rb +6 -2
  46. data/app/components/primer/navigation/tab_component.rb +10 -3
  47. data/app/components/primer/octicon_component.rb +15 -12
  48. data/app/components/primer/primer.d.ts +2 -0
  49. data/app/components/primer/primer.js +2 -0
  50. data/app/components/primer/primer.ts +2 -0
  51. data/app/components/primer/spinner_component.rb +2 -0
  52. data/app/components/primer/tab_nav_component.html.erb +5 -1
  53. data/app/components/primer/tab_nav_component.rb +62 -9
  54. data/app/components/primer/{tooltip_component.rb → tooltip.rb} +10 -8
  55. data/app/components/primer/truncate.rb +6 -2
  56. data/app/components/primer/underline_nav_component.html.erb +1 -1
  57. data/app/components/primer/underline_nav_component.rb +17 -1
  58. data/app/lib/primer/classify.rb +35 -12
  59. data/app/lib/primer/classify/cache.rb +12 -17
  60. data/app/lib/primer/classify/grid.rb +45 -0
  61. data/app/lib/primer/classify/utilities.rb +137 -0
  62. data/app/lib/primer/classify/utilities.yml +1147 -0
  63. data/app/lib/primer/tabbed_component_helper.rb +2 -2
  64. data/app/lib/primer/view_helper.rb +2 -1
  65. data/lib/primer/view_components/engine.rb +2 -0
  66. data/lib/primer/view_components/linters.rb +3 -0
  67. data/lib/primer/view_components/linters/argument_mappers/button.rb +82 -0
  68. data/lib/primer/view_components/linters/argument_mappers/conversion_error.rb +10 -0
  69. data/lib/primer/view_components/linters/argument_mappers/system_arguments.rb +48 -0
  70. data/lib/primer/view_components/linters/button_component_migration_counter.rb +39 -0
  71. data/lib/primer/view_components/linters/flash_component_migration_counter.rb +16 -0
  72. data/lib/primer/view_components/linters/helpers.rb +191 -0
  73. data/lib/primer/view_components/version.rb +1 -1
  74. data/lib/tasks/docs.rake +184 -109
  75. data/lib/tasks/utilities.rake +99 -0
  76. data/lib/yard/docs_helper.rb +12 -2
  77. data/static/statuses.json +10 -6
  78. metadata +65 -14
  79. data/app/components/primer/button_marketing_component.rb +0 -68
  80. data/app/components/primer/dropdown/menu_component.html.erb +0 -12
  81. data/app/components/primer/dropdown/menu_component.rb +0 -46
  82. data/app/components/primer/dropdown_component.rb +0 -73
  83. data/app/components/primer/text_component.rb +0 -25
  84. data/app/lib/primer/classify/spacing.rb +0 -63
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :utilities do
4
+ task :build do
5
+ require "yaml"
6
+ require "json"
7
+ require File.expand_path("./../../demo/config/environment.rb", __dir__)
8
+
9
+ # Keys that are looked for to be included in the utilities.yml file
10
+ SUPPORTED_KEYS = %i[
11
+ hide
12
+ float
13
+ m mt mr mb ml mx my
14
+ p pt pr pb pl px py
15
+ ].freeze
16
+
17
+ # Replacements for some classnames that end up being a different argument key
18
+ REPLACEMENT_KEYS = {
19
+ "^v-align" => "vertical_align",
20
+ "^d" => "display",
21
+ "^wb" => "word_break",
22
+ "^v" => "visibility"
23
+ }.freeze
24
+
25
+ BREAKPOINTS = [nil, "sm", "md", "lg", "xl"].freeze
26
+
27
+ css_data =
28
+ JSON.parse(
29
+ File.read(
30
+ File.join(
31
+ __FILE__.split("lib/tasks/utilities.rake")[0], "/node_modules/@primer/css/dist/stats/utilities.json"
32
+ )
33
+ )
34
+ )["selectors"]["values"]
35
+
36
+ output = {}
37
+
38
+ css_data.each do |selector|
39
+ selector.sub!(/^./, "")
40
+ # Next if selector has ancestors or sibling selectors
41
+ next if selector.match?(/[:><~\[\.]/)
42
+ next unless SUPPORTED_KEYS.any? { |key| selector.start_with?("#{key}-") }
43
+
44
+ # Dupe so we still have the selector at the end of slicing it up
45
+ classname = selector.dup
46
+ key = ""
47
+
48
+ # Look for a replacement key
49
+ REPLACEMENT_KEYS.each do |k, v|
50
+ next unless classname.match?(Regexp.new(k))
51
+
52
+ key = v
53
+ classname.sub!(Regexp.new(k + "-"), "")
54
+ end
55
+
56
+ # If we didn't find a replacement, grab the first text before hyphen
57
+ if classname == selector
58
+ key = classname.split("-").first
59
+ classname.sub!(/^[^-]+-/, "")
60
+ end
61
+
62
+ # Check if the next bit of the classname is a breakpoint
63
+ if classname.match?(/^(sm-|md-|lg-|xl-)/)
64
+ breakpoint = classname.split("-").first
65
+ classname.sub!(/^[^-]+-/, "")
66
+ end
67
+
68
+ # Change the rest from hypens to underscores
69
+ classname.sub!(/\-/, "_")
70
+
71
+ # convert padding/margin negative values ie n7 to -7
72
+ classname.sub!(/^n/, "-") if classname.match?(/^n[0-9]/)
73
+
74
+ key = key.to_sym
75
+
76
+ classname = if classname.match?(/\A[-+]?[0-9]+\z/)
77
+ classname.to_i
78
+ else
79
+ classname.to_sym
80
+ end
81
+
82
+ if output[key].nil?
83
+ output[key] = { classname => Array.new(5, nil) }
84
+ elsif output[key][classname].nil?
85
+ output[key][classname] = Array.new(5, nil)
86
+ end
87
+
88
+ output[key][classname][BREAKPOINTS.index(breakpoint)] = selector
89
+ end
90
+
91
+ output.transform_values! do |x|
92
+ x.transform_values { |y| y.reverse.drop_while(&:nil?).reverse }
93
+ end
94
+
95
+ File.open("app/lib/primer/classify/utilities.yml", "w") do |f|
96
+ f.puts YAML.dump(output)
97
+ end
98
+ end
99
+ end
@@ -3,7 +3,13 @@
3
3
  module YARD
4
4
  # Helper methods to use for yard documentation
5
5
  module DocsHelper
6
- def one_of(enumerable, lower: false)
6
+ def one_of(enumerable, lower: false, sort: true)
7
+ # Sort the array if requested
8
+ if sort
9
+ compare = ->(a, b) { a.class == b.class ? a <=> b : a.class.to_s <=> b.class.to_s }
10
+ enumerable = enumerable.sort { |a, b| compare.call(a, b) }
11
+ end
12
+
7
13
  values =
8
14
  case enumerable
9
15
  when Hash
@@ -14,7 +20,7 @@ module YARD
14
20
  enumerable.map do |key|
15
21
  pretty_value(key)
16
22
  end
17
- end
23
+ end
18
24
 
19
25
  prefix = "One of"
20
26
  prefix = prefix.downcase if lower
@@ -22,6 +28,10 @@ module YARD
22
28
  "#{prefix} #{values.to_sentence(last_word_connector: ', or ')}."
23
29
  end
24
30
 
31
+ def link_to_accessibility
32
+ "[Accessibility](#system-arguments)"
33
+ end
34
+
25
35
  def link_to_system_arguments_docs
26
36
  "[System arguments](/system-arguments)"
27
37
  end
data/static/statuses.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
+ "Primer::Alpha::ButtonMarketing": "alpha",
2
3
  "Primer::AutoComplete": "beta",
4
+ "Primer::AutoComplete::Input": "alpha",
3
5
  "Primer::AutoComplete::Item": "beta",
4
6
  "Primer::AvatarComponent": "beta",
5
7
  "Primer::AvatarStackComponent": "beta",
6
8
  "Primer::BaseButton": "beta",
7
9
  "Primer::BaseComponent": "beta",
10
+ "Primer::Beta::Text": "beta",
8
11
  "Primer::BlankslateComponent": "beta",
9
12
  "Primer::BorderBoxComponent": "beta",
10
13
  "Primer::BoxComponent": "stable",
@@ -12,13 +15,13 @@
12
15
  "Primer::BreadcrumbComponent::ItemComponent": "alpha",
13
16
  "Primer::ButtonComponent": "beta",
14
17
  "Primer::ButtonGroup": "beta",
15
- "Primer::ButtonMarketingComponent": "alpha",
16
18
  "Primer::ClipboardCopy": "alpha",
17
19
  "Primer::CloseButton": "beta",
18
20
  "Primer::CounterComponent": "beta",
19
21
  "Primer::DetailsComponent": "beta",
20
- "Primer::Dropdown::MenuComponent": "alpha",
21
- "Primer::DropdownComponent": "alpha",
22
+ "Primer::Dropdown": "alpha",
23
+ "Primer::Dropdown::Menu": "alpha",
24
+ "Primer::Dropdown::Menu::Item": "alpha",
22
25
  "Primer::DropdownMenuComponent": "deprecated",
23
26
  "Primer::FlashComponent": "beta",
24
27
  "Primer::FlexComponent": "deprecated",
@@ -26,10 +29,12 @@
26
29
  "Primer::HeadingComponent": "beta",
27
30
  "Primer::HiddenTextExpander": "alpha",
28
31
  "Primer::IconButton": "beta",
32
+ "Primer::Image": "alpha",
29
33
  "Primer::ImageCrop": "alpha",
30
34
  "Primer::LabelComponent": "beta",
31
35
  "Primer::LayoutComponent": "alpha",
32
36
  "Primer::LinkComponent": "beta",
37
+ "Primer::LocalTime": "alpha",
33
38
  "Primer::Markdown": "beta",
34
39
  "Primer::MenuComponent": "alpha",
35
40
  "Primer::Navigation::TabComponent": "alpha",
@@ -41,12 +46,11 @@
41
46
  "Primer::StateComponent": "beta",
42
47
  "Primer::SubheadComponent": "beta",
43
48
  "Primer::TabContainerComponent": "alpha",
44
- "Primer::TabNavComponent": "alpha",
45
- "Primer::TextComponent": "beta",
49
+ "Primer::TabNavComponent": "beta",
46
50
  "Primer::TimeAgoComponent": "beta",
47
51
  "Primer::TimelineItemComponent": "beta",
48
52
  "Primer::TimelineItemComponent::BadgeComponent": "alpha",
49
- "Primer::TooltipComponent": "alpha",
53
+ "Primer::Tooltip": "beta",
50
54
  "Primer::Truncate": "beta",
51
55
  "Primer::UnderlineNavComponent": "alpha"
52
56
  }
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.40
4
+ version: 0.0.45
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-05-06 00:00:00.000000000 Z
11
+ date: 2021-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -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
@@ -322,19 +350,21 @@ files:
322
350
  - README.md
323
351
  - app/assets/javascripts/primer_view_components.js
324
352
  - app/assets/javascripts/primer_view_components.js.map
353
+ - app/components/primer/alpha/button_marketing.rb
325
354
  - app/components/primer/auto_complete.rb
326
355
  - app/components/primer/auto_complete/auto_complete.d.ts
327
356
  - app/components/primer/auto_complete/auto_complete.html.erb
328
357
  - app/components/primer/auto_complete/auto_complete.js
329
358
  - app/components/primer/auto_complete/auto_complete.ts
330
- - app/components/primer/auto_complete/auto_component.d.ts
331
- - app/components/primer/auto_complete/auto_component.js
332
359
  - app/components/primer/auto_complete/item.rb
360
+ - app/components/primer/auto_complete_component.d.ts
361
+ - app/components/primer/auto_complete_component.js
333
362
  - app/components/primer/avatar_component.rb
334
363
  - app/components/primer/avatar_stack_component.html.erb
335
364
  - app/components/primer/avatar_stack_component.rb
336
365
  - app/components/primer/base_button.rb
337
366
  - app/components/primer/base_component.rb
367
+ - app/components/primer/beta/text.rb
338
368
  - app/components/primer/blankslate_component.html.erb
339
369
  - app/components/primer/blankslate_component.rb
340
370
  - app/components/primer/border_box_component.html.erb
@@ -346,7 +376,6 @@ files:
346
376
  - app/components/primer/button_component.rb
347
377
  - app/components/primer/button_group.html.erb
348
378
  - app/components/primer/button_group.rb
349
- - app/components/primer/button_marketing_component.rb
350
379
  - app/components/primer/clipboard_copy.html.erb
351
380
  - app/components/primer/clipboard_copy.rb
352
381
  - app/components/primer/clipboard_copy_component.d.ts
@@ -357,10 +386,18 @@ files:
357
386
  - app/components/primer/counter_component.rb
358
387
  - app/components/primer/details_component.html.erb
359
388
  - app/components/primer/details_component.rb
360
- - app/components/primer/dropdown/menu_component.html.erb
361
- - app/components/primer/dropdown/menu_component.rb
362
- - app/components/primer/dropdown_component.html.erb
363
- - app/components/primer/dropdown_component.rb
389
+ - app/components/primer/details_menu_component.d.ts
390
+ - app/components/primer/details_menu_component.js
391
+ - app/components/primer/dropdown.d.ts
392
+ - app/components/primer/dropdown.html.erb
393
+ - app/components/primer/dropdown.js
394
+ - app/components/primer/dropdown.rb
395
+ - app/components/primer/dropdown.ts
396
+ - app/components/primer/dropdown/menu.d.ts
397
+ - app/components/primer/dropdown/menu.html.erb
398
+ - app/components/primer/dropdown/menu.js
399
+ - app/components/primer/dropdown/menu.rb
400
+ - app/components/primer/dropdown/menu.ts
364
401
  - app/components/primer/dropdown_menu_component.html.erb
365
402
  - app/components/primer/dropdown_menu_component.rb
366
403
  - app/components/primer/flash_component.html.erb
@@ -370,6 +407,7 @@ files:
370
407
  - app/components/primer/heading_component.rb
371
408
  - app/components/primer/hidden_text_expander.rb
372
409
  - app/components/primer/icon_button.rb
410
+ - app/components/primer/image.rb
373
411
  - app/components/primer/image_crop.d.ts
374
412
  - app/components/primer/image_crop.html.erb
375
413
  - app/components/primer/image_crop.js
@@ -379,6 +417,10 @@ files:
379
417
  - app/components/primer/layout_component.html.erb
380
418
  - app/components/primer/layout_component.rb
381
419
  - app/components/primer/link_component.rb
420
+ - app/components/primer/local_time.d.ts
421
+ - app/components/primer/local_time.js
422
+ - app/components/primer/local_time.rb
423
+ - app/components/primer/local_time.ts
382
424
  - app/components/primer/markdown.rb
383
425
  - app/components/primer/menu_component.html.erb
384
426
  - app/components/primer/menu_component.rb
@@ -406,14 +448,13 @@ files:
406
448
  - app/components/primer/tab_container_component.ts
407
449
  - app/components/primer/tab_nav_component.html.erb
408
450
  - app/components/primer/tab_nav_component.rb
409
- - app/components/primer/text_component.rb
410
451
  - app/components/primer/time_ago_component.d.ts
411
452
  - app/components/primer/time_ago_component.js
412
453
  - app/components/primer/time_ago_component.rb
413
454
  - app/components/primer/time_ago_component.ts
414
455
  - app/components/primer/timeline_item_component.html.erb
415
456
  - app/components/primer/timeline_item_component.rb
416
- - app/components/primer/tooltip_component.rb
457
+ - app/components/primer/tooltip.rb
417
458
  - app/components/primer/truncate.rb
418
459
  - app/components/primer/underline_nav_component.html.erb
419
460
  - app/components/primer/underline_nav_component.rb
@@ -425,7 +466,9 @@ files:
425
466
  - app/lib/primer/classify/functional_border_colors.rb
426
467
  - app/lib/primer/classify/functional_colors.rb
427
468
  - app/lib/primer/classify/functional_text_colors.rb
428
- - app/lib/primer/classify/spacing.rb
469
+ - app/lib/primer/classify/grid.rb
470
+ - app/lib/primer/classify/utilities.rb
471
+ - app/lib/primer/classify/utilities.yml
429
472
  - app/lib/primer/fetch_or_fallback_helper.rb
430
473
  - app/lib/primer/join_style_arguments_helper.rb
431
474
  - app/lib/primer/octicon/cache.rb
@@ -435,10 +478,18 @@ files:
435
478
  - app/lib/primer/view_helper.rb
436
479
  - lib/primer/view_components.rb
437
480
  - lib/primer/view_components/engine.rb
481
+ - lib/primer/view_components/linters.rb
482
+ - lib/primer/view_components/linters/argument_mappers/button.rb
483
+ - lib/primer/view_components/linters/argument_mappers/conversion_error.rb
484
+ - lib/primer/view_components/linters/argument_mappers/system_arguments.rb
485
+ - lib/primer/view_components/linters/button_component_migration_counter.rb
486
+ - lib/primer/view_components/linters/flash_component_migration_counter.rb
487
+ - lib/primer/view_components/linters/helpers.rb
438
488
  - lib/primer/view_components/version.rb
439
489
  - lib/tasks/coverage.rake
440
490
  - lib/tasks/docs.rake
441
491
  - lib/tasks/statuses.rake
492
+ - lib/tasks/utilities.rake
442
493
  - lib/yard/docs_helper.rb
443
494
  - lib/yard/renders_many_handler.rb
444
495
  - lib/yard/renders_one_handler.rb
@@ -1,68 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Primer
4
- # Use `ButtonMarketing` for actions (e.g. in forms). Use links for destinations, or moving from one page to another.
5
- class ButtonMarketingComponent < Primer::Component
6
- DEFAULT_SCHEME = :default
7
- SCHEME_MAPPINGS = {
8
- DEFAULT_SCHEME => "",
9
- :primary => "btn-primary-mktg",
10
- :outline => "btn-outline-mktg",
11
- :transparent => "btn-transparent"
12
- }.freeze
13
- SCHEME_OPTIONS = SCHEME_MAPPINGS.keys
14
-
15
- DEFAULT_VARIANT = :default
16
- VARIANT_MAPPINGS = {
17
- DEFAULT_VARIANT => "",
18
- :large => "btn-large-mktg"
19
- }.freeze
20
- VARIANT_OPTIONS = VARIANT_MAPPINGS.keys
21
-
22
- DEFAULT_TAG = :button
23
- TAG_OPTIONS = [DEFAULT_TAG, :a].freeze
24
-
25
- DEFAULT_TYPE = :button
26
- TYPE_OPTIONS = [DEFAULT_TYPE, :submit].freeze
27
-
28
- # @example Schemes
29
- # <%= render(Primer::ButtonMarketingComponent.new(mr: 2)) { "Default" } %>
30
- # <%= render(Primer::ButtonMarketingComponent.new(scheme: :primary, mr: 2)) { "Primary" } %>
31
- # <%= render(Primer::ButtonMarketingComponent.new(scheme: :outline)) { "Outline" } %>
32
- # <div class="color-bg-canvas-inverse">
33
- # <%= render(Primer::ButtonMarketingComponent.new(scheme: :transparent)) { "Transparent" } %>
34
- # </div>
35
- #
36
- # @example Sizes
37
- # <%= render(Primer::ButtonMarketingComponent.new(mr: 2)) { "Default" } %>
38
- # <%= render(Primer::ButtonMarketingComponent.new(variant: :large)) { "Large" } %>
39
- #
40
- # @param scheme [Symbol] <%= one_of(Primer::ButtonMarketingComponent::SCHEME_OPTIONS) %>
41
- # @param variant [Symbol] <%= one_of(Primer::ButtonMarketingComponent::VARIANT_OPTIONS) %>
42
- # @param tag [Symbol] <%= one_of(Primer::ButtonMarketingComponent::TAG_OPTIONS) %>
43
- # @param type [Symbol] <%= one_of(Primer::ButtonMarketingComponent::TYPE_OPTIONS) %>
44
- # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
45
- def initialize(
46
- scheme: DEFAULT_SCHEME,
47
- variant: DEFAULT_VARIANT,
48
- tag: DEFAULT_TAG,
49
- type: DEFAULT_TYPE,
50
- **system_arguments
51
- )
52
- @system_arguments = system_arguments
53
- @system_arguments[:block] = false
54
- @system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG)
55
- @system_arguments[:type] = fetch_or_fallback(TYPE_OPTIONS, type, DEFAULT_TYPE)
56
- @system_arguments[:classes] = class_names(
57
- "btn-mktg",
58
- SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)],
59
- VARIANT_MAPPINGS[fetch_or_fallback(VARIANT_OPTIONS, variant, DEFAULT_VARIANT)],
60
- system_arguments[:classes]
61
- )
62
- end
63
-
64
- def call
65
- render(Primer::BaseButton.new(**@system_arguments)) { content }
66
- end
67
- end
68
- end
@@ -1,12 +0,0 @@
1
- <%= render Primer::BaseComponent.new(**@system_arguments) do %>
2
- <% if @header.present? %>
3
- <div class="dropdown-header">
4
- <%= @header %>
5
- </div>
6
- <% end %>
7
- <ul>
8
- <% items.each do |item| %>
9
- <%= item %>
10
- <% end %>
11
- </ul>
12
- <% end %>