primer_view_components 0.0.36 → 0.0.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +220 -24
  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 +3 -1
  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 +47 -0
  10. data/app/components/primer/base_component.rb +14 -10
  11. data/app/components/primer/blankslate_component.rb +10 -7
  12. data/app/components/primer/border_box_component.rb +1 -1
  13. data/app/components/primer/box_component.rb +1 -1
  14. data/app/components/primer/breadcrumb_component.rb +1 -1
  15. data/app/components/primer/button_component.html.erb +9 -0
  16. data/app/components/primer/button_component.rb +39 -21
  17. data/app/components/primer/{button_group_component.html.erb → button_group.html.erb} +0 -0
  18. data/app/components/primer/button_group.rb +61 -0
  19. data/app/components/primer/button_marketing_component.rb +4 -9
  20. data/app/components/primer/clipboard_copy.html.erb +8 -0
  21. data/app/components/primer/clipboard_copy.rb +26 -0
  22. data/app/components/primer/clipboard_copy_component.d.ts +1 -0
  23. data/app/components/primer/clipboard_copy_component.js +34 -0
  24. data/app/components/primer/clipboard_copy_component.ts +39 -0
  25. data/app/components/primer/close_button.rb +11 -2
  26. data/app/components/primer/component.rb +21 -2
  27. data/app/components/primer/counter_component.rb +6 -1
  28. data/app/components/primer/details_component.rb +1 -1
  29. data/app/components/primer/dropdown/menu_component.rb +1 -1
  30. data/app/components/primer/dropdown_component.rb +1 -1
  31. data/app/components/primer/flash_component.rb +3 -3
  32. data/app/components/primer/flex_component.rb +28 -1
  33. data/app/components/primer/flex_item_component.rb +20 -1
  34. data/app/components/primer/heading_component.rb +25 -4
  35. data/app/components/primer/hidden_text_expander.rb +2 -4
  36. data/app/components/primer/icon_button.rb +65 -0
  37. data/app/components/primer/image.rb +46 -0
  38. data/app/components/primer/image_crop.d.ts +1 -0
  39. data/app/components/primer/image_crop.html.erb +12 -0
  40. data/app/components/primer/image_crop.js +1 -0
  41. data/app/components/primer/image_crop.rb +36 -0
  42. data/app/components/primer/image_crop.ts +1 -0
  43. data/app/components/primer/label_component.rb +7 -3
  44. data/app/components/primer/layout_component.rb +1 -1
  45. data/app/components/primer/link_component.rb +1 -1
  46. data/app/components/primer/local_time.d.ts +1 -0
  47. data/app/components/primer/local_time.js +1 -0
  48. data/app/components/primer/local_time.rb +59 -0
  49. data/app/components/primer/local_time.ts +1 -0
  50. data/app/components/primer/{markdown_component.rb → markdown.rb} +6 -5
  51. data/app/components/primer/menu_component.rb +1 -1
  52. data/app/components/primer/navigation/tab_component.rb +8 -1
  53. data/app/components/primer/octicon_component.html.erb +7 -0
  54. data/app/components/primer/octicon_component.rb +53 -19
  55. data/app/components/primer/octicon_symbols_component.html.erb +3 -0
  56. data/app/components/primer/octicon_symbols_component.rb +61 -0
  57. data/app/components/primer/popover_component.rb +1 -1
  58. data/app/components/primer/primer.d.ts +3 -0
  59. data/app/components/primer/primer.js +3 -0
  60. data/app/components/primer/primer.ts +3 -0
  61. data/app/components/primer/progress_bar_component.rb +1 -1
  62. data/app/components/primer/spinner_component.rb +3 -3
  63. data/app/components/primer/state_component.rb +2 -2
  64. data/app/components/primer/subhead_component.rb +34 -4
  65. data/app/components/primer/tab_container_component.rb +1 -1
  66. data/app/components/primer/tab_nav_component.html.erb +2 -0
  67. data/app/components/primer/tab_nav_component.rb +23 -10
  68. data/app/components/primer/text_component.rb +6 -3
  69. data/app/components/primer/time_ago_component.rb +1 -1
  70. data/app/components/primer/timeline_item_component.rb +1 -1
  71. data/app/components/primer/{tooltip_component.rb → tooltip.rb} +11 -9
  72. data/app/components/primer/truncate.rb +1 -1
  73. data/app/components/primer/underline_nav_component.rb +1 -1
  74. data/app/lib/primer/classify.rb +11 -36
  75. data/app/lib/primer/classify/cache.rb +20 -15
  76. data/app/lib/primer/classify/flex.rb +111 -0
  77. data/app/lib/primer/classify/functional_border_colors.rb +1 -2
  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/view_helper.rb +2 -1
  81. data/lib/primer/view_components.rb +1 -1
  82. data/lib/primer/view_components/version.rb +1 -1
  83. data/lib/tasks/coverage.rake +14 -0
  84. data/lib/tasks/docs.rake +315 -0
  85. data/lib/tasks/statuses.rake +12 -0
  86. data/lib/yard/docs_helper.rb +57 -0
  87. data/static/statuses.json +54 -1
  88. metadata +50 -11
  89. data/app/components/primer/button_group_component.rb +0 -35
  90. data/app/components/primer/foo_bar.d.ts +0 -1
  91. 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::BaseComponent":"beta","Primer::BlankslateComponent":"beta","Primer::BorderBoxComponent":"beta","Primer::BoxComponent":"stable","Primer::BreadcrumbComponent":"beta","Primer::BreadcrumbComponent::ItemComponent":"alpha","Primer::ButtonComponent":"beta","Primer::ButtonGroupComponent":"alpha","Primer::ButtonMarketingComponent":"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": "alpha",
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.36
4
+ version: 0.0.41
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-15 00:00:00.000000000 Z
11
+ date: 2021-05-17 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,14 @@ 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'
131
145
  - !ruby/object:Gem::Dependency
132
146
  name: listen
133
147
  requirement: !ruby/object:Gem::Requirement
@@ -333,6 +347,7 @@ files:
333
347
  - app/components/primer/avatar_component.rb
334
348
  - app/components/primer/avatar_stack_component.html.erb
335
349
  - app/components/primer/avatar_stack_component.rb
350
+ - app/components/primer/base_button.rb
336
351
  - app/components/primer/base_component.rb
337
352
  - app/components/primer/blankslate_component.html.erb
338
353
  - app/components/primer/blankslate_component.rb
@@ -341,10 +356,16 @@ files:
341
356
  - app/components/primer/box_component.rb
342
357
  - app/components/primer/breadcrumb_component.html.erb
343
358
  - app/components/primer/breadcrumb_component.rb
359
+ - app/components/primer/button_component.html.erb
344
360
  - app/components/primer/button_component.rb
345
- - app/components/primer/button_group_component.html.erb
346
- - app/components/primer/button_group_component.rb
361
+ - app/components/primer/button_group.html.erb
362
+ - app/components/primer/button_group.rb
347
363
  - app/components/primer/button_marketing_component.rb
364
+ - app/components/primer/clipboard_copy.html.erb
365
+ - app/components/primer/clipboard_copy.rb
366
+ - app/components/primer/clipboard_copy_component.d.ts
367
+ - app/components/primer/clipboard_copy_component.js
368
+ - app/components/primer/clipboard_copy_component.ts
348
369
  - app/components/primer/close_button.rb
349
370
  - app/components/primer/component.rb
350
371
  - app/components/primer/counter_component.rb
@@ -360,20 +381,32 @@ files:
360
381
  - app/components/primer/flash_component.rb
361
382
  - app/components/primer/flex_component.rb
362
383
  - app/components/primer/flex_item_component.rb
363
- - app/components/primer/foo_bar.d.ts
364
- - app/components/primer/foo_bar.js
365
384
  - app/components/primer/heading_component.rb
366
385
  - app/components/primer/hidden_text_expander.rb
386
+ - app/components/primer/icon_button.rb
387
+ - app/components/primer/image.rb
388
+ - app/components/primer/image_crop.d.ts
389
+ - app/components/primer/image_crop.html.erb
390
+ - app/components/primer/image_crop.js
391
+ - app/components/primer/image_crop.rb
392
+ - app/components/primer/image_crop.ts
367
393
  - app/components/primer/label_component.rb
368
394
  - app/components/primer/layout_component.html.erb
369
395
  - app/components/primer/layout_component.rb
370
396
  - app/components/primer/link_component.rb
371
- - app/components/primer/markdown_component.rb
397
+ - app/components/primer/local_time.d.ts
398
+ - app/components/primer/local_time.js
399
+ - app/components/primer/local_time.rb
400
+ - app/components/primer/local_time.ts
401
+ - app/components/primer/markdown.rb
372
402
  - app/components/primer/menu_component.html.erb
373
403
  - app/components/primer/menu_component.rb
374
404
  - app/components/primer/navigation/tab_component.html.erb
375
405
  - app/components/primer/navigation/tab_component.rb
406
+ - app/components/primer/octicon_component.html.erb
376
407
  - app/components/primer/octicon_component.rb
408
+ - app/components/primer/octicon_symbols_component.html.erb
409
+ - app/components/primer/octicon_symbols_component.rb
377
410
  - app/components/primer/popover_component.html.erb
378
411
  - app/components/primer/popover_component.rb
379
412
  - app/components/primer/primer.d.ts
@@ -399,13 +432,14 @@ files:
399
432
  - app/components/primer/time_ago_component.ts
400
433
  - app/components/primer/timeline_item_component.html.erb
401
434
  - app/components/primer/timeline_item_component.rb
402
- - app/components/primer/tooltip_component.rb
435
+ - app/components/primer/tooltip.rb
403
436
  - app/components/primer/truncate.rb
404
437
  - app/components/primer/underline_nav_component.html.erb
405
438
  - app/components/primer/underline_nav_component.rb
406
439
  - app/lib/primer/class_name_helper.rb
407
440
  - app/lib/primer/classify.rb
408
441
  - app/lib/primer/classify/cache.rb
442
+ - app/lib/primer/classify/flex.rb
409
443
  - app/lib/primer/classify/functional_background_colors.rb
410
444
  - app/lib/primer/classify/functional_border_colors.rb
411
445
  - app/lib/primer/classify/functional_colors.rb
@@ -413,6 +447,7 @@ files:
413
447
  - app/lib/primer/classify/spacing.rb
414
448
  - app/lib/primer/fetch_or_fallback_helper.rb
415
449
  - app/lib/primer/join_style_arguments_helper.rb
450
+ - app/lib/primer/octicon/cache.rb
416
451
  - app/lib/primer/status/dsl.rb
417
452
  - app/lib/primer/tabbed_component_helper.rb
418
453
  - app/lib/primer/test_selector_helper.rb
@@ -420,6 +455,10 @@ files:
420
455
  - lib/primer/view_components.rb
421
456
  - lib/primer/view_components/engine.rb
422
457
  - lib/primer/view_components/version.rb
458
+ - lib/tasks/coverage.rake
459
+ - lib/tasks/docs.rake
460
+ - lib/tasks/statuses.rake
461
+ - lib/yard/docs_helper.rb
423
462
  - lib/yard/renders_many_handler.rb
424
463
  - lib/yard/renders_one_handler.rb
425
464
  - static/statuses.json
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Primer
4
- # Use ButtonGroupComponent to render a series of buttons.
5
- class ButtonGroupComponent < Primer::Component
6
- # Required list of buttons to be rendered.
7
- #
8
- # @param kwargs [Hash] The same arguments as <%= link_to_component(Primer::ButtonComponent) %>.
9
- renders_many :buttons, ->(**kwargs) { Primer::ButtonComponent.new(group_item: true, **kwargs) }
10
-
11
- # @example Default
12
- # <%= render(Primer::ButtonGroupComponent.new) do |component|
13
- # component.button { "Default" }
14
- # component.button(scheme: :primary) { "Primary" }
15
- # component.button(scheme: :danger) { "Danger" }
16
- # component.button(scheme: :outline) { "Outline" }
17
- # component.button(classes: "my-class") { "Custom class" }
18
- # end %>
19
- #
20
- # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
21
- def initialize(**system_arguments)
22
- @system_arguments = system_arguments
23
- @system_arguments[:tag] ||= :div
24
-
25
- @system_arguments[:classes] = class_names(
26
- "BtnGroup",
27
- system_arguments[:classes]
28
- )
29
- end
30
-
31
- def render?
32
- buttons.any?
33
- end
34
- end
35
- end
@@ -1 +0,0 @@
1
- import '@github/details-menu-element';
@@ -1 +0,0 @@
1
- import '@github/details-menu-element';