primer_view_components 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +40 -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 +1 -1
  6. data/app/assets/styles/primer_view_components.css.map +1 -1
  7. data/app/components/primer/alpha/action_bar.rb +0 -8
  8. data/app/components/primer/alpha/action_list.css +1 -1
  9. data/app/components/primer/alpha/action_list.css.map +1 -1
  10. data/app/components/primer/alpha/action_menu/action_menu_element.js +8 -1
  11. data/app/components/primer/alpha/action_menu/action_menu_element.ts +10 -1
  12. data/app/components/primer/alpha/action_menu.rb +0 -269
  13. data/app/components/primer/alpha/auto_complete/item.rb +0 -12
  14. data/app/components/primer/alpha/auto_complete.css +1 -1
  15. data/app/components/primer/alpha/auto_complete.css.map +1 -1
  16. data/app/components/primer/alpha/auto_complete.rb +0 -47
  17. data/app/components/primer/alpha/banner.css +1 -1
  18. data/app/components/primer/alpha/banner.css.map +1 -1
  19. data/app/components/primer/alpha/banner.rb +0 -31
  20. data/app/components/primer/alpha/button_marketing.rb +0 -12
  21. data/app/components/primer/alpha/dialog.css +1 -1
  22. data/app/components/primer/alpha/dialog.css.map +1 -1
  23. data/app/components/primer/alpha/dialog.rb +2 -18
  24. data/app/components/primer/alpha/dropdown.css +1 -1
  25. data/app/components/primer/alpha/dropdown.css.map +1 -1
  26. data/app/components/primer/alpha/dropdown.rb +0 -105
  27. data/app/components/primer/alpha/form_control.rb +0 -11
  28. data/app/components/primer/alpha/hellip_button.rb +0 -9
  29. data/app/components/primer/alpha/hidden_text_expander.rb +0 -9
  30. data/app/components/primer/alpha/image.rb +0 -16
  31. data/app/components/primer/alpha/image_crop.rb +0 -11
  32. data/app/components/primer/alpha/layout.css +1 -1
  33. data/app/components/primer/alpha/layout.css.map +1 -1
  34. data/app/components/primer/alpha/layout.pcss +1 -1
  35. data/app/components/primer/alpha/layout.rb +0 -118
  36. data/app/components/primer/alpha/menu.css +1 -1
  37. data/app/components/primer/alpha/menu.css.map +1 -1
  38. data/app/components/primer/alpha/menu.rb +0 -19
  39. data/app/components/primer/alpha/multi_input.rb +0 -33
  40. data/app/components/primer/alpha/nav_list.rb +0 -69
  41. data/app/components/primer/alpha/navigation/tab.rb +0 -35
  42. data/app/components/primer/alpha/octicon_symbols.rb +0 -6
  43. data/app/components/primer/alpha/overlay.rb +0 -14
  44. data/app/components/primer/alpha/segmented_control.css +1 -1
  45. data/app/components/primer/alpha/segmented_control.css.map +1 -1
  46. data/app/components/primer/alpha/segmented_control.rb +0 -61
  47. data/app/components/primer/alpha/tab_container.rb +0 -18
  48. data/app/components/primer/alpha/tab_nav.css +1 -1
  49. data/app/components/primer/alpha/tab_nav.css.map +1 -1
  50. data/app/components/primer/alpha/tab_nav.rb +0 -63
  51. data/app/components/primer/alpha/tab_panels.rb +0 -16
  52. data/app/components/primer/alpha/text_field.css +1 -1
  53. data/app/components/primer/alpha/text_field.css.map +1 -1
  54. data/app/components/primer/alpha/text_field.rb +0 -68
  55. data/app/components/primer/alpha/toggle_switch.css +1 -1
  56. data/app/components/primer/alpha/toggle_switch.css.map +1 -1
  57. data/app/components/primer/alpha/toggle_switch.rb +0 -18
  58. data/app/components/primer/alpha/tooltip.rb +1 -69
  59. data/app/components/primer/alpha/underline_nav.css +1 -1
  60. data/app/components/primer/alpha/underline_nav.css.map +1 -1
  61. data/app/components/primer/alpha/underline_nav.rb +0 -61
  62. data/app/components/primer/alpha/underline_panels.rb +0 -19
  63. data/app/components/primer/beta/auto_complete/item.rb +0 -8
  64. data/app/components/primer/beta/auto_complete.rb +0 -56
  65. data/app/components/primer/beta/avatar.css +1 -1
  66. data/app/components/primer/beta/avatar.css.map +1 -1
  67. data/app/components/primer/beta/avatar.rb +0 -18
  68. data/app/components/primer/beta/avatar_stack.css +1 -1
  69. data/app/components/primer/beta/avatar_stack.css.map +1 -1
  70. data/app/components/primer/beta/avatar_stack.rb +0 -21
  71. data/app/components/primer/beta/base_button.rb +0 -4
  72. data/app/components/primer/beta/blankslate.css +1 -1
  73. data/app/components/primer/beta/blankslate.css.map +1 -1
  74. data/app/components/primer/beta/blankslate.rb +0 -104
  75. data/app/components/primer/beta/border_box/header.rb +4 -11
  76. data/app/components/primer/beta/border_box.css +1 -1
  77. data/app/components/primer/beta/border_box.css.map +1 -1
  78. data/app/components/primer/beta/border_box.html.erb +2 -2
  79. data/app/components/primer/beta/border_box.rb +11 -55
  80. data/app/components/primer/beta/breadcrumbs.rb +0 -7
  81. data/app/components/primer/beta/button.css +1 -1
  82. data/app/components/primer/beta/button.css.map +1 -1
  83. data/app/components/primer/beta/button.pcss +2 -2
  84. data/app/components/primer/beta/button.rb +2 -43
  85. data/app/components/primer/beta/button_group.css +1 -1
  86. data/app/components/primer/beta/button_group.css.map +1 -1
  87. data/app/components/primer/beta/button_group.rb +0 -16
  88. data/app/components/primer/beta/clipboard_copy.rb +0 -12
  89. data/app/components/primer/beta/close_button.rb +0 -3
  90. data/app/components/primer/beta/counter.rb +0 -8
  91. data/app/components/primer/beta/details.rb +0 -11
  92. data/app/components/primer/beta/flash.css +1 -1
  93. data/app/components/primer/beta/flash.css.map +1 -1
  94. data/app/components/primer/beta/flash.rb +1 -23
  95. data/app/components/primer/beta/heading.rb +0 -8
  96. data/app/components/primer/beta/icon_button.rb +0 -21
  97. data/app/components/primer/beta/label.css +1 -1
  98. data/app/components/primer/beta/label.css.map +1 -1
  99. data/app/components/primer/beta/label.rb +0 -20
  100. data/app/components/primer/beta/link.rb +0 -22
  101. data/app/components/primer/beta/markdown.rb +1 -262
  102. data/app/components/primer/beta/octicon.rb +0 -10
  103. data/app/components/primer/beta/popover.css +1 -1
  104. data/app/components/primer/beta/popover.css.map +1 -1
  105. data/app/components/primer/beta/popover.rb +0 -43
  106. data/app/components/primer/beta/progress_bar.rb +1 -22
  107. data/app/components/primer/beta/relative_time.rb +0 -9
  108. data/app/components/primer/beta/spinner.rb +2 -10
  109. data/app/components/primer/beta/state.rb +0 -13
  110. data/app/components/primer/beta/subhead.rb +0 -55
  111. data/app/components/primer/beta/text.rb +0 -4
  112. data/app/components/primer/beta/timeline_item.css +1 -1
  113. data/app/components/primer/beta/timeline_item.css.map +1 -1
  114. data/app/components/primer/beta/timeline_item.rb +0 -9
  115. data/app/components/primer/beta/truncate.rb +0 -50
  116. data/app/components/primer/blankslate_component.rb +0 -76
  117. data/app/components/primer/box.rb +0 -6
  118. data/app/components/primer/button_component.rb +0 -49
  119. data/app/components/primer/conditional_wrapper.rb +2 -17
  120. data/app/components/primer/icon_button.rb +0 -30
  121. data/app/components/primer/layout_component.rb +0 -12
  122. data/app/components/primer/tooltip.rb +0 -27
  123. data/app/components/primer/truncate.rb +0 -19
  124. data/lib/primer/accessibility.rb +1 -1
  125. data/lib/primer/deprecations.yml +3 -3
  126. data/lib/primer/forms/dsl/input.rb +1 -0
  127. data/lib/primer/static/generate_info_arch.rb +1 -0
  128. data/lib/primer/view_components/linters/details_menu_migration.rb +1 -1
  129. data/lib/primer/view_components/linters/migrations/truncate_component.rb +45 -0
  130. data/lib/primer/view_components/linters/tooltipped_migration.rb +1 -1
  131. data/lib/primer/view_components/linters.rb +1 -0
  132. data/lib/primer/view_components/version.rb +1 -1
  133. data/lib/primer/yard.rb +8 -9
  134. data/previews/primer/alpha/tooltip_preview/with_multiple_on_a_page.html.erb +3 -3
  135. data/previews/primer/alpha/tooltip_preview.rb +11 -23
  136. data/static/arguments.json +12 -1
  137. data/static/info_arch.json +122 -14
  138. data/static/previews.json +0 -13
  139. metadata +3 -3
  140. data/lib/primer/yard/legacy_gatsby_backend.rb +0 -233
data/static/previews.json CHANGED
@@ -6158,19 +6158,6 @@
6158
6158
  ]
6159
6159
  }
6160
6160
  },
6161
- {
6162
- "preview_path": "primer/alpha/tooltip/label_tooltip_on_button_with_existing_labelledby",
6163
- "name": "label_tooltip_on_button_with_existing_labelledby",
6164
- "snapshot": "false",
6165
- "skip_rules": {
6166
- "wont_fix": [
6167
- "region"
6168
- ],
6169
- "will_fix": [
6170
- "color-contrast"
6171
- ]
6172
- }
6173
- },
6174
6161
  {
6175
6162
  "preview_path": "primer/alpha/tooltip/description_tooltip_on_button_with_existing_describedby",
6176
6163
  "name": "description_tooltip_on_button_with_existing_describedby",
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.6.0
4
+ version: 0.7.0
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: 2023-08-03 00:00:00.000000000 Z
11
+ date: 2023-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -935,6 +935,7 @@ files:
935
935
  - lib/primer/view_components/linters/helpers/rule_helpers.rb
936
936
  - lib/primer/view_components/linters/label_component_migration_counter.rb
937
937
  - lib/primer/view_components/linters/migrate_deprecated_flash_arguments.rb
938
+ - lib/primer/view_components/linters/migrations/truncate_component.rb
938
939
  - lib/primer/view_components/linters/severity_schema.rb
939
940
  - lib/primer/view_components/linters/subhead_component_migration_counter.rb
940
941
  - lib/primer/view_components/linters/super_in_component_templates.rb
@@ -949,7 +950,6 @@ files:
949
950
  - lib/primer/yard/component_ref.rb
950
951
  - lib/primer/yard/docs_helper.rb
951
952
  - lib/primer/yard/info_arch_docs_helper.rb
952
- - lib/primer/yard/legacy_gatsby_backend.rb
953
953
  - lib/primer/yard/lookbook_docs_helper.rb
954
954
  - lib/primer/yard/lookbook_pages_backend.rb
955
955
  - lib/primer/yard/registry.rb
@@ -1,233 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # rubocop:disable Naming/MethodParameterName
4
-
5
- # :nocov:
6
- module Primer
7
- module Yard
8
- # Backend that generates documentation for the legacy, Gatsby-powered PVC docsite.
9
- class LegacyGatsbyBackend < Backend
10
- class << self
11
- def parse_example_tag(tag)
12
- name = tag.name
13
- description = nil
14
- code = nil
15
-
16
- if tag.text.include?("@description")
17
- splitted = tag.text.split(/@description|@code/)
18
- description = splitted.second.gsub(/^[ \t]{2}/, "").strip
19
- code = splitted.last.gsub(/^[ \t]{2}/, "").strip
20
- else
21
- code = tag.text
22
- end
23
-
24
- [name, description, code]
25
- end
26
- end
27
-
28
- attr_reader :registry, :manifest
29
-
30
- def initialize(registry, manifest)
31
- @registry = registry
32
- @manifest = manifest
33
- end
34
-
35
- def generate
36
- errors = []
37
-
38
- each_component do |component_ref|
39
- component = component_ref.klass
40
- docs = registry.find(component)
41
- status_path = docs.status_module.nil? ? "" : "#{docs.status_module}/"
42
-
43
- metadata = docs.metadata.merge(
44
- source: component_ref.source_url,
45
- lookbook: component_ref.lookbook_url,
46
- path: "docs/content/components/#{status_path}#{docs.short_name.downcase}.md",
47
- example_path: example_path(component),
48
- require_js_path: require_js_path(component)
49
- )
50
-
51
- path = Pathname.new(metadata[:path])
52
- path.dirname.mkpath unless path.dirname.exist?
53
-
54
- File.open(path, "w") do |f|
55
- f.puts("---")
56
- f.puts("title: #{metadata[:title]}")
57
- f.puts("componentId: #{metadata[:component_id]}")
58
- f.puts("status: #{metadata[:status]}")
59
- f.puts("source: #{metadata[:source]}")
60
- f.puts("a11yReviewed: #{metadata[:a11y_reviewed]}")
61
- f.puts("lookbook: #{metadata[:lookbook]}") if preview_exists?(component)
62
- f.puts("---")
63
- f.puts
64
- f.puts("import Example from '#{metadata[:example_path]}'")
65
-
66
- if component_ref.requires_js?
67
- f.puts("import RequiresJSFlash from '#{metadata[:require_js_path]}'")
68
- f.puts
69
- f.puts("<RequiresJSFlash />")
70
- end
71
-
72
- f.puts
73
- f.puts("<!-- Warning: AUTO-GENERATED file, do not edit. Add code comments to your Ruby instead <3 -->")
74
- f.puts
75
- f.puts(view_context.render(inline: docs.base_docstring))
76
-
77
- if docs.tags(:deprecated).any?
78
- f.puts
79
- f.puts("## Deprecation")
80
- docs.tags(:deprecated).each do |tag|
81
- f.puts
82
- f.puts view_context.render(inline: tag.text)
83
- end
84
- end
85
-
86
- if docs.tags(:accessibility).any?
87
- f.puts
88
- f.puts("## Accessibility")
89
- docs.tags(:accessibility).each do |tag|
90
- f.puts
91
- f.puts view_context.render(inline: tag.text)
92
- end
93
- end
94
-
95
- errors << { component.name => { arguments: "No argument documentation found" } } unless docs.params.any?
96
-
97
- f.puts
98
- f.puts("## Arguments")
99
- f.puts
100
- f.puts("| Name | Type | Default | Description |")
101
- f.puts("| :- | :- | :- | :- |")
102
-
103
- documented_params = docs.params.map(&:name)
104
- component_params = component.instance_method(:initialize).parameters.map { |p| p.last.to_s }
105
-
106
- if (documented_params & component_params).size != component_params.size
107
- err = { arguments: {} }
108
- (component_params - documented_params).each do |arg|
109
- err[:arguments][arg] = "Not documented"
110
- end
111
-
112
- errors << { component.name => err }
113
- end
114
-
115
- docs.params.each do |tag|
116
- default_value = pretty_default_value(tag, component)
117
- f.puts("| `#{tag.name}` | `#{tag.types.join(', ')}` | #{default_value} | #{view_context.render(inline: tag.text.squish)} |")
118
- end
119
-
120
- if docs.slot_methods.any?
121
- f.puts
122
- f.puts("## Slots")
123
-
124
- docs.slot_methods.each do |slot_docs|
125
- emit_method(slot_docs, component, f)
126
- end
127
- end
128
-
129
- example_tags = docs.constructor.tags(:example)
130
-
131
- if example_tags.any?
132
- f.puts
133
- f.puts("## Examples")
134
-
135
- example_tags.each do |tag|
136
- name, description, code = parse_example_tag(tag)
137
- f.puts
138
- f.puts("### #{name}")
139
- if description
140
- f.puts
141
- f.puts(view_context.render(inline: description.squish))
142
- end
143
- f.puts
144
- html = view_context.render(inline: code)
145
- f.puts("<Example src=\"#{html.tr('"', "\'").delete("\n")}\" />")
146
- f.puts
147
- f.puts("```erb")
148
- f.puts(code.to_s)
149
- f.puts("```")
150
- end
151
- elsif component_ref.should_have_examples?
152
- errors << { component.name => { example: "No examples found" } }
153
- end
154
- end
155
- end
156
-
157
- # Build system arguments docs from BaseComponent
158
- system_args_docs = registry.find(Primer::BaseComponent)
159
-
160
- File.open("docs/content/system-arguments.md", "w") do |f|
161
- f.puts("---")
162
- f.puts("title: System arguments")
163
- f.puts("---")
164
- f.puts
165
- f.puts("<!-- Warning: AUTO-GENERATED file, do not edit. Add code comments to your Ruby instead <3 -->")
166
- f.puts
167
- f.puts(system_args_docs.base_docstring)
168
- f.puts
169
-
170
- f.puts(view_context.render(inline: system_args_docs.constructor.base_docstring))
171
- end
172
-
173
- errors
174
- end
175
-
176
- private
177
-
178
- def emit_method(method_docs, component, f)
179
- f.puts
180
- f.puts("### `#{method_docs.name}`")
181
-
182
- if method_docs.base_docstring.to_s.present?
183
- f.puts
184
- f.puts(view_context.render(inline: method_docs.base_docstring))
185
- end
186
-
187
- param_tags = method_docs.tags(:param)
188
- if param_tags.any?
189
- f.puts
190
- f.puts("| Name | Type | Default | Description |")
191
- f.puts("| :- | :- | :- | :- |")
192
- end
193
-
194
- param_tags.each do |tag|
195
- f.puts("| `#{tag.name}` | `#{tag.types.join(', ')}` | #{pretty_default_value(tag, component)} | #{view_context.render(inline: tag.text)} |")
196
- end
197
- end
198
-
199
- def each_component(&block)
200
- manifest.each(&block)
201
- end
202
-
203
- def example_path(component)
204
- example_path = "../../src/@primer/gatsby-theme-doctocat/components/example"
205
- example_path = "../#{example_path}" if status_module?(component)
206
- example_path
207
- end
208
-
209
- def require_js_path(component)
210
- require_js_path = "../../src/@primer/gatsby-theme-doctocat/components/requires-js-flash"
211
- require_js_path = "../#{require_js_path}" if status_module?(component)
212
- require_js_path
213
- end
214
-
215
- def preview_exists?(component)
216
- path = component.name.underscore
217
-
218
- File.exist?("previews/#{path}_preview.rb")
219
- end
220
-
221
- def status_module?(component)
222
- (%w[Alpha Beta] & component.name.split("::")).any?
223
- end
224
-
225
- def parse_example_tag(tag)
226
- self.class.parse_example_tag(tag)
227
- end
228
- end
229
- end
230
- end
231
- # :nocov:
232
-
233
- # rubocop:enable Naming/MethodParameterName