primer_view_components 0.0.48 → 0.0.52

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +155 -0
  3. data/app/components/primer/base_component.rb +2 -2
  4. data/app/components/primer/beta/avatar.rb +1 -1
  5. data/app/components/primer/{avatar_stack_component.html.erb → beta/avatar_stack.html.erb} +0 -0
  6. data/app/components/primer/beta/avatar_stack.rb +92 -0
  7. data/app/components/primer/beta/truncate.html.erb +5 -0
  8. data/app/components/primer/beta/truncate.rb +110 -0
  9. data/app/components/primer/border_box_component.rb +27 -1
  10. data/app/components/primer/clipboard_copy.html.erb +2 -2
  11. data/app/components/primer/clipboard_copy.rb +1 -1
  12. data/app/components/primer/dropdown.rb +7 -7
  13. data/app/components/primer/icon_button.rb +1 -1
  14. data/app/components/primer/image_crop.html.erb +4 -4
  15. data/app/components/primer/label_component.rb +13 -12
  16. data/app/components/primer/navigation/tab_component.rb +16 -2
  17. data/app/components/primer/progress_bar_component.rb +0 -3
  18. data/app/components/primer/tab_nav_component.rb +4 -3
  19. data/app/components/primer/truncate.rb +1 -1
  20. data/app/components/primer/underline_nav_component.rb +3 -2
  21. data/app/lib/primer/fetch_or_fallback_helper.rb +2 -0
  22. data/app/lib/primer/octicon/cache.rb +1 -1
  23. data/app/lib/primer/tabbed_component_helper.rb +1 -1
  24. data/app/lib/primer/view_helper.rb +1 -0
  25. data/lib/primer/classify.rb +4 -16
  26. data/lib/primer/classify/cache.rb +0 -5
  27. data/lib/primer/classify/flex.rb +1 -1
  28. data/lib/primer/classify/functional_colors.rb +1 -1
  29. data/lib/primer/classify/utilities.rb +51 -13
  30. data/lib/primer/classify/utilities.yml +16 -0
  31. data/lib/primer/classify/validation.rb +18 -0
  32. data/lib/primer/view_components.rb +34 -6
  33. data/lib/primer/view_components/constants.rb +55 -0
  34. data/lib/primer/view_components/linters/argument_mappers/base.rb +100 -0
  35. data/lib/primer/view_components/linters/argument_mappers/button.rb +33 -46
  36. data/lib/primer/view_components/linters/argument_mappers/clipboard_copy.rb +19 -0
  37. data/lib/primer/view_components/linters/argument_mappers/helpers/erb_block.rb +67 -0
  38. data/lib/primer/view_components/linters/argument_mappers/label.rb +49 -0
  39. data/lib/primer/view_components/linters/argument_mappers/system_arguments.rb +6 -5
  40. data/lib/primer/view_components/linters/autocorrectable.rb +30 -0
  41. data/lib/primer/view_components/linters/button_component_migration_counter.rb +9 -23
  42. data/lib/primer/view_components/linters/clipboard_copy_component_migration_counter.rb +21 -0
  43. data/lib/primer/view_components/linters/close_button_component_migration_counter.rb +16 -0
  44. data/lib/primer/view_components/linters/helpers.rb +47 -42
  45. data/lib/primer/view_components/linters/label_component_migration_counter.rb +25 -0
  46. data/lib/primer/view_components/version.rb +1 -1
  47. data/lib/rubocop/config/default.yml +5 -0
  48. data/lib/rubocop/cop/primer.rb +1 -2
  49. data/lib/rubocop/cop/primer/deprecated_arguments.rb +173 -0
  50. data/lib/rubocop/cop/primer/no_tag_memoize.rb +1 -0
  51. data/lib/rubocop/cop/primer/primer_octicon.rb +178 -0
  52. data/lib/rubocop/cop/primer/system_argument_instead_of_class.rb +12 -16
  53. data/lib/tasks/constants.rake +12 -0
  54. data/lib/tasks/coverage.rake +4 -0
  55. data/lib/tasks/docs.rake +27 -25
  56. data/lib/tasks/utilities.rake +9 -13
  57. data/lib/yard/docs_helper.rb +15 -5
  58. data/static/arguments.yml +980 -0
  59. data/static/assets/view-components.svg +18 -0
  60. data/static/classes.yml +182 -0
  61. data/static/constants.json +640 -0
  62. data/static/statuses.json +4 -2
  63. metadata +29 -10
  64. data/app/components/primer/avatar_stack_component.rb +0 -90
@@ -6,8 +6,9 @@ module YARD
6
6
  def one_of(enumerable, lower: false, sort: true)
7
7
  # Sort the array if requested
8
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) }
9
+ enumerable = enumerable.sort do |a, b|
10
+ a.instance_of?(b.class) ? a <=> b : a.class.to_s <=> b.class.to_s
11
+ end
11
12
  end
12
13
 
13
14
  values =
@@ -29,7 +30,7 @@ module YARD
29
30
  end
30
31
 
31
32
  def link_to_accessibility
32
- "[Accessibility](#system-arguments)"
33
+ "[Accessibility](#accessibility)"
33
34
  end
34
35
 
35
36
  def link_to_system_arguments_docs
@@ -41,8 +42,10 @@ module YARD
41
42
  end
42
43
 
43
44
  def link_to_component(component)
44
- short_name = component.name.gsub(/Primer|::|Alpha|Beta|Component/, "")
45
- "[#{short_name}](/components/#{short_name.downcase})"
45
+ (status_module, short_name) = status_module_and_short_name(component)
46
+ status_path = status_module.nil? ? "" : "#{status_module}/"
47
+
48
+ "[#{short_name}](/components/#{status_path}#{short_name.downcase})"
46
49
  end
47
50
 
48
51
  def link_to_octicons
@@ -53,6 +56,13 @@ module YARD
53
56
  "[Learn more about best heading practices (WAI Headings)](https://www.w3.org/WAI/tutorials/page-structure/headings/)"
54
57
  end
55
58
 
59
+ def status_module_and_short_name(component)
60
+ name_with_status = component.name.gsub(/Primer::|Component/, "")
61
+
62
+ m = name_with_status.match(/(?<status>Beta|Alpha|Deprecated)?(?<_colons>::)?(?<name>.*)/)
63
+ [m[:status]&.downcase, m[:name].gsub("::", "")]
64
+ end
65
+
56
66
  def pretty_value(val)
57
67
  case val
58
68
  when nil
@@ -0,0 +1,980 @@
1
+ ---
2
+ - component: ButtonMarketing
3
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/alpha/button_marketing.rb
4
+ parameters:
5
+ - name: scheme
6
+ type: Symbol
7
+ default: "`:default`"
8
+ description: One of `:default`, `:outline`, `:primary`, or `:transparent`.
9
+ - name: variant
10
+ type: Symbol
11
+ default: "`:default`"
12
+ description: One of `:default` and `:large`.
13
+ - name: tag
14
+ type: Symbol
15
+ default: "`:button`"
16
+ description: One of `:a` and `:button`.
17
+ - name: type
18
+ type: Symbol
19
+ default: "`:button`"
20
+ description: One of `:button` and `:submit`.
21
+ - name: system_arguments
22
+ type: Hash
23
+ default: N/A
24
+ description: "[System arguments](/system-arguments)"
25
+ - component: BaseButton
26
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/base_button.rb
27
+ parameters:
28
+ - name: tag
29
+ type: Symbol
30
+ default: "`:button`"
31
+ description: One of `:a`, `:button`, or `:summary`.
32
+ - name: type
33
+ type: Symbol
34
+ default: "`:button`"
35
+ description: One of `:button`, `:reset`, or `:submit`.
36
+ - name: block
37
+ type: Boolean
38
+ default: "`false`"
39
+ description: 'Whether button is full-width with `display: block`.'
40
+ - name: system_arguments
41
+ type: Hash
42
+ default: N/A
43
+ description: "[System arguments](/system-arguments)"
44
+ - component: AutoComplete
45
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/beta/auto_complete.rb
46
+ parameters:
47
+ - name: src
48
+ type: String
49
+ default: N/A
50
+ description: The route to query.
51
+ - name: input_id
52
+ type: String
53
+ default: N/A
54
+ description: Id of the input element.
55
+ - name: list_id
56
+ type: String
57
+ default: N/A
58
+ description: Id of the list element.
59
+ - name: system_arguments
60
+ type: Hash
61
+ default: N/A
62
+ description: "[System arguments](/system-arguments)"
63
+ - component: AutoCompleteItem
64
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/beta/auto_complete/item.rb
65
+ parameters:
66
+ - name: value
67
+ type: String
68
+ default: N/A
69
+ description: Value of the item.
70
+ - name: selected
71
+ type: Boolean
72
+ default: "`false`"
73
+ description: Whether the item is selected.
74
+ - name: disabled
75
+ type: Boolean
76
+ default: "`false`"
77
+ description: Whether the item is disabled.
78
+ - name: system_arguments
79
+ type: Hash
80
+ default: N/A
81
+ description: "[System arguments](/system-arguments)"
82
+ - component: Avatar
83
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/beta/avatar.rb
84
+ parameters:
85
+ - name: src
86
+ type: String
87
+ default: N/A
88
+ description: The source url of the avatar image.
89
+ - name: alt
90
+ type: String
91
+ default: N/A
92
+ description: Passed through to alt on img tag.
93
+ - name: size
94
+ type: Integer
95
+ default: "`20`"
96
+ description: Adds the avatar-small class if less than 24.
97
+ - name: square
98
+ type: Boolean
99
+ default: "`false`"
100
+ description: Used to create a square avatar.
101
+ - name: href
102
+ type: String
103
+ default: "`nil`"
104
+ description: The URL to link to. If used, component will be wrapped by an `<a>`
105
+ tag.
106
+ - name: system_arguments
107
+ type: Hash
108
+ default: N/A
109
+ description: "[System arguments](/system-arguments)"
110
+ - component: AvatarStack
111
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/beta/avatar_stack.rb
112
+ parameters:
113
+ - name: tag
114
+ type: Symbol
115
+ default: "`:div`"
116
+ description: One of `:div` and `:span`.
117
+ - name: align
118
+ type: Symbol
119
+ default: "`:left`"
120
+ description: One of `:left` and `:right`.
121
+ - name: tooltipped
122
+ type: Boolean
123
+ default: "`false`"
124
+ description: Whether to add a tooltip to the stack or not.
125
+ - name: body_arguments
126
+ type: Hash
127
+ default: "`{}`"
128
+ description: Parameters to add to the Body. If `tooltipped` is set, has the same
129
+ arguments as [Tooltip](/components/tooltip). The default tag is `:div` but can
130
+ be changed using `tag:` to one of `:div` and `:span`.
131
+ - name: system_arguments
132
+ type: Hash
133
+ default: N/A
134
+ description: "[System arguments](/system-arguments)"
135
+ - component: Text
136
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/beta/text.rb
137
+ parameters:
138
+ - name: tag
139
+ type: Symbol
140
+ default: "`:span`"
141
+ description: ''
142
+ - name: system_arguments
143
+ type: Hash
144
+ default: N/A
145
+ description: "[System arguments](/system-arguments)"
146
+ - component: Truncate
147
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/beta/truncate.rb
148
+ parameters:
149
+ - name: system_arguments
150
+ type: Hash
151
+ default: N/A
152
+ description: "[System arguments](/system-arguments)"
153
+ - component: Blankslate
154
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/blankslate_component.rb
155
+ parameters:
156
+ - name: title
157
+ type: String
158
+ default: '`""`'
159
+ description: Text that appears in a larger bold font.
160
+ - name: title_tag
161
+ type: Symbol
162
+ default: "`:h3`"
163
+ description: HTML tag to use for title.
164
+ - name: icon
165
+ type: Symbol
166
+ default: '`""`'
167
+ description: Octicon icon to use at top of component.
168
+ - name: icon_size
169
+ type: Symbol
170
+ default: "`:medium`"
171
+ description: One of `:small` (`16`) and `:medium` (`24`).
172
+ - name: image_src
173
+ type: String
174
+ default: '`""`'
175
+ description: Image to display.
176
+ - name: image_alt
177
+ type: String
178
+ default: '`" "`'
179
+ description: Alt text for image.
180
+ - name: description
181
+ type: String
182
+ default: '`""`'
183
+ description: Text that appears below the title. Typically a whole sentence.
184
+ - name: button_text
185
+ type: String
186
+ default: '`""`'
187
+ description: The text of the button.
188
+ - name: button_url
189
+ type: String
190
+ default: '`""`'
191
+ description: The URL where the user will be taken after clicking the button.
192
+ - name: button_classes
193
+ type: String
194
+ default: '`"btn-primary my-3"`'
195
+ description: Classes to apply to action button
196
+ - name: link_text
197
+ type: String
198
+ default: '`""`'
199
+ description: The text of the link.
200
+ - name: link_url
201
+ type: String
202
+ default: '`""`'
203
+ description: The URL where the user will be taken after clicking the link.
204
+ - name: narrow
205
+ type: Boolean
206
+ default: "`false`"
207
+ description: Adds a maximum width.
208
+ - name: large
209
+ type: Boolean
210
+ default: "`false`"
211
+ description: Increases the font size.
212
+ - name: spacious
213
+ type: Boolean
214
+ default: "`false`"
215
+ description: Adds extra padding.
216
+ - name: system_arguments
217
+ type: Hash
218
+ default: N/A
219
+ description: "[System arguments](/system-arguments)"
220
+ - component: BorderBox
221
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/border_box_component.rb
222
+ parameters:
223
+ - name: padding
224
+ type: Symbol
225
+ default: "`:default`"
226
+ description: One of `:condensed`, `:default`, or `:spacious`.
227
+ - name: system_arguments
228
+ type: Hash
229
+ default: N/A
230
+ description: "[System arguments](/system-arguments)"
231
+ - component: Box
232
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/box_component.rb
233
+ parameters:
234
+ - name: system_arguments
235
+ type: Hash
236
+ default: N/A
237
+ description: "[System arguments](/system-arguments)"
238
+ - component: Breadcrumb
239
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/breadcrumb_component.rb
240
+ parameters:
241
+ - name: system_arguments
242
+ type: Hash
243
+ default: N/A
244
+ description: "[System arguments](/system-arguments)"
245
+ - component: Button
246
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/button_component.rb
247
+ parameters:
248
+ - name: scheme
249
+ type: Symbol
250
+ default: "`:default`"
251
+ description: One of `:danger`, `:default`, `:invisible`, `:link`, `:outline`,
252
+ or `:primary`.
253
+ - name: variant
254
+ type: Symbol
255
+ default: "`:medium`"
256
+ description: One of `:large`, `:medium`, or `:small`.
257
+ - name: tag
258
+ type: Symbol
259
+ default: "`:button`"
260
+ description: One of `:a`, `:button`, or `:summary`.
261
+ - name: type
262
+ type: Symbol
263
+ default: "`:button`"
264
+ description: One of `:button`, `:reset`, or `:submit`.
265
+ - name: group_item
266
+ type: Boolean
267
+ default: "`false`"
268
+ description: Whether button is part of a ButtonGroup.
269
+ - name: block
270
+ type: Boolean
271
+ default: "`false`"
272
+ description: 'Whether button is full-width with `display: block`.'
273
+ - name: caret
274
+ type: Boolean
275
+ default: "`false`"
276
+ description: Whether or not to render a caret.
277
+ - name: system_arguments
278
+ type: Hash
279
+ default: N/A
280
+ description: "[System arguments](/system-arguments)"
281
+ - component: ButtonGroup
282
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/button_group.rb
283
+ parameters:
284
+ - name: variant
285
+ type: Symbol
286
+ default: "`:medium`"
287
+ description: One of `:large`, `:medium`, or `:small`.
288
+ - name: system_arguments
289
+ type: Hash
290
+ default: N/A
291
+ description: "[System arguments](/system-arguments)"
292
+ - component: ClipboardCopy
293
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/clipboard_copy.rb
294
+ parameters:
295
+ - name: aria-label
296
+ type: String
297
+ default: N/A
298
+ description: String that will be read to screenreaders when the component is focused
299
+ - name: value
300
+ type: String
301
+ default: "`nil`"
302
+ description: Text to copy into the users clipboard when they click the component.
303
+ - name: for
304
+ type: String
305
+ default: N/A
306
+ description: Element id from where to get the copied value.
307
+ - name: system_arguments
308
+ type: Hash
309
+ default: N/A
310
+ description: "[System arguments](/system-arguments)"
311
+ - component: CloseButton
312
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/close_button.rb
313
+ parameters:
314
+ - name: type
315
+ type: Symbol
316
+ default: "`:button`"
317
+ description: One of `:button` and `:submit`.
318
+ - name: system_arguments
319
+ type: Hash
320
+ default: N/A
321
+ description: "[System arguments](/system-arguments)"
322
+ - component: Counter
323
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/counter_component.rb
324
+ parameters:
325
+ - name: count
326
+ type: Integer, Float::INFINITY, nil
327
+ default: "`0`"
328
+ description: 'The number to be displayed (e.x. # of issues, pull requests)'
329
+ - name: scheme
330
+ type: Symbol
331
+ default: "`:default`"
332
+ description: Color scheme. One of `:default`, `:primary`, or `:secondary`.
333
+ - name: limit
334
+ type: Integer, nil
335
+ default: "`5_000`"
336
+ description: Maximum value to display. Pass `nil` for no limit. (e.x. if `count`
337
+ == 6,000 and `limit` == 5000, counter will display "5,000+")
338
+ - name: hide_if_zero
339
+ type: Boolean
340
+ default: "`false`"
341
+ description: If true, a `hidden` attribute is added to the counter if `count`
342
+ is zero.
343
+ - name: text
344
+ type: String
345
+ default: '`""`'
346
+ description: Text to display instead of count.
347
+ - name: round
348
+ type: Boolean
349
+ default: "`false`"
350
+ description: Whether to apply our standard rounding logic to value.
351
+ - name: system_arguments
352
+ type: Hash
353
+ default: N/A
354
+ description: "[System arguments](/system-arguments)"
355
+ - component: Details
356
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/details_component.rb
357
+ parameters:
358
+ - name: overlay
359
+ type: Symbol
360
+ default: "`:none`"
361
+ description: Dictates the type of overlay to render with. One of `:dark`, `:default`,
362
+ or `:none`.
363
+ - name: reset
364
+ type: Boolean
365
+ default: "`false`"
366
+ description: Defatuls to false. If set to true, it will remove the default caret
367
+ and remove style from the summary element
368
+ - name: system_arguments
369
+ type: Hash
370
+ default: N/A
371
+ description: "[System arguments](/system-arguments)"
372
+ - component: Dropdown
373
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/dropdown.rb
374
+ parameters:
375
+ - name: overlay
376
+ type: Symbol
377
+ default: "`:default`"
378
+ description: One of `:dark`, `:default`, or `:none`.
379
+ - name: with_caret
380
+ type: Boolean
381
+ default: "`false`"
382
+ description: Whether or not a caret should be rendered in the button.
383
+ - name: system_arguments
384
+ type: Hash
385
+ default: N/A
386
+ description: "[System arguments](/system-arguments)"
387
+ - component: DropdownMenu
388
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/dropdown_menu_component.rb
389
+ parameters:
390
+ - name: direction
391
+ type: Symbol
392
+ default: "`:se`"
393
+ description: One of `:e`, `:ne`, `:s`, `:se`, `:sw`, or `:w`.
394
+ - name: scheme
395
+ type: Symbol
396
+ default: "`:default`"
397
+ description: Pass `:dark` for dark mode theming
398
+ - name: header
399
+ type: String
400
+ default: "`nil`"
401
+ description: Optional string to display as the header
402
+ - name: system_arguments
403
+ type: Hash
404
+ default: N/A
405
+ description: "[System arguments](/system-arguments)"
406
+ - component: Flash
407
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/flash_component.rb
408
+ parameters:
409
+ - name: full
410
+ type: Boolean
411
+ default: "`false`"
412
+ description: Whether the component should take up the full width of the screen.
413
+ - name: spacious
414
+ type: Boolean
415
+ default: "`false`"
416
+ description: Whether to add margin to the bottom of the component.
417
+ - name: dismissible
418
+ type: Boolean
419
+ default: "`false`"
420
+ description: Whether the component can be dismissed with an X button.
421
+ - name: icon
422
+ type: Symbol
423
+ default: "`nil`"
424
+ description: Name of Octicon icon to use.
425
+ - name: scheme
426
+ type: Symbol
427
+ default: "`:default`"
428
+ description: One of `:danger`, `:default`, `:success`, or `:warning`.
429
+ - name: system_arguments
430
+ type: Hash
431
+ default: N/A
432
+ description: "[System arguments](/system-arguments)"
433
+ - component: Flex
434
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/flex_component.rb
435
+ parameters:
436
+ - name: justify_content
437
+ type: Symbol
438
+ default: "`JUSTIFY_CONTENT_DEFAULT`"
439
+ description: Use this param to distribute space between and around flex items
440
+ along the main axis of the container. One of `nil`, `:center`, `:flex_end`,
441
+ `:flex_start`, `:space_around`, or `:space_between`.
442
+ - name: inline
443
+ type: Boolean
444
+ default: "`false`"
445
+ description: Defaults to false.
446
+ - name: flex_wrap
447
+ type: Boolean
448
+ default: "`FLEX_WRAP_DEFAULT`"
449
+ description: Defaults to nil.
450
+ - name: align_items
451
+ type: Symbol
452
+ default: "`ALIGN_ITEMS_DEFAULT`"
453
+ description: Use this param to align items on the cross axis. One of `nil`, `:baseline`,
454
+ `:center`, `:end`, `:start`, or `:stretch`.
455
+ - name: direction
456
+ type: Symbol
457
+ default: "`nil`"
458
+ description: Use this param to define the orientation of the main axis (row or
459
+ column). By default, flex items will display in a row. One of `nil`, `:column`,
460
+ `:column_reverse`, `:row`, or `:row_reverse`.
461
+ - name: system_arguments
462
+ type: Hash
463
+ default: N/A
464
+ description: "[System arguments](/system-arguments)"
465
+ - component: FlexItem
466
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/flex_item_component.rb
467
+ parameters:
468
+ - name: flex_auto
469
+ type: Boolean
470
+ default: "`false`"
471
+ description: Fills available space and auto-sizes based on the content. Defaults
472
+ to false
473
+ - name: system_arguments
474
+ type: Hash
475
+ default: N/A
476
+ description: "[System arguments](/system-arguments)"
477
+ - component: Heading
478
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/heading_component.rb
479
+ parameters:
480
+ - name: tag
481
+ type: String
482
+ default: N/A
483
+ description: One of `:h1`, `:h2`, `:h3`, `:h4`, `:h5`, or `:h6`.
484
+ - name: system_arguments
485
+ type: Hash
486
+ default: N/A
487
+ description: "[System arguments](/system-arguments)"
488
+ - component: HiddenTextExpander
489
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/hidden_text_expander.rb
490
+ parameters:
491
+ - name: inline
492
+ type: Boolean
493
+ default: "`false`"
494
+ description: Whether or not the expander is inline.
495
+ - name: button_arguments
496
+ type: Hash
497
+ default: "`{}`"
498
+ description: "[System arguments](/system-arguments) for the button element."
499
+ - name: system_arguments
500
+ type: Hash
501
+ default: N/A
502
+ description: "[System arguments](/system-arguments)"
503
+ - component: IconButton
504
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/icon_button.rb
505
+ parameters:
506
+ - name: scheme
507
+ type: Symbol
508
+ default: "`:default`"
509
+ description: One of `:danger` and `:default`.
510
+ - name: icon
511
+ type: String
512
+ default: N/A
513
+ description: Name of [Octicon](https://primer.style/octicons/) to use.
514
+ - name: tag
515
+ type: Symbol
516
+ default: N/A
517
+ description: One of `:a`, `:button`, or `:summary`.
518
+ - name: type
519
+ type: Symbol
520
+ default: N/A
521
+ description: One of `:button`, `:reset`, or `:submit`.
522
+ - name: box
523
+ type: Boolean
524
+ default: "`false`"
525
+ description: Whether the button is in a [BorderBox](/components/borderbox). If
526
+ `true`, the button will have the `Box-btn-octicon` class.
527
+ - name: system_arguments
528
+ type: Hash
529
+ default: N/A
530
+ description: "[System arguments](/system-arguments)"
531
+ - component: Image
532
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/image.rb
533
+ parameters:
534
+ - name: src
535
+ type: String
536
+ default: N/A
537
+ description: The source url of the image.
538
+ - name: alt
539
+ type: String
540
+ default: N/A
541
+ description: Specifies an alternate text for the image.
542
+ - name: lazy
543
+ type: Boolean
544
+ default: "`false`"
545
+ description: Whether or not to lazily load the image.
546
+ - name: system_arguments
547
+ type: Hash
548
+ default: N/A
549
+ description: "[System arguments](/system-arguments)"
550
+ - component: ImageCrop
551
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/image_crop.rb
552
+ parameters:
553
+ - name: src
554
+ type: String
555
+ default: N/A
556
+ description: The path of the image to crop.
557
+ - name: rounded
558
+ type: Boolean
559
+ default: "`true`"
560
+ description: If the crop mask should be a circle. Defaults to true.
561
+ - name: system_arguments
562
+ type: Hash
563
+ default: N/A
564
+ description: "[System arguments](/system-arguments)"
565
+ - component: Label
566
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/label_component.rb
567
+ parameters:
568
+ - name: tag
569
+ type: Symbol
570
+ default: "`:span`"
571
+ description: One of `:a`, `:div`, `:span`, or `:summary`.
572
+ - name: scheme
573
+ type: Symbol
574
+ default: "`nil`"
575
+ description: One of `:danger`, `:info`, `:orange`, `:primary`, `:purple`, `:secondary`,
576
+ `:success`, or `:warning`.
577
+ - name: variant
578
+ type: Symbol
579
+ default: "`nil`"
580
+ description: One of `nil`, `:inline`, or `:large`.
581
+ - name: system_arguments
582
+ type: Hash
583
+ default: N/A
584
+ description: "[System arguments](/system-arguments)"
585
+ - component: Layout
586
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/layout_component.rb
587
+ parameters:
588
+ - name: responsive
589
+ type: Boolean
590
+ default: "`false`"
591
+ description: Whether to collapse layout to a single column at smaller widths.
592
+ - name: side
593
+ type: Symbol
594
+ default: "`:right`"
595
+ description: Which side to display the sidebar on. One of `:left` and `:right`.
596
+ - name: sidebar_col
597
+ type: Integer
598
+ default: "`3`"
599
+ description: Sidebar column width.
600
+ - name: system_arguments
601
+ type: Hash
602
+ default: N/A
603
+ description: "[System arguments](/system-arguments)"
604
+ - component: Link
605
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/link_component.rb
606
+ parameters:
607
+ - name: tag
608
+ type: String
609
+ default: "`:a`"
610
+ description: One of `:a` and `:span`.
611
+ - name: href
612
+ type: String
613
+ default: "`nil`"
614
+ description: URL to be used for the Link. Required if tag is `:a`. If the requirements
615
+ are not met an error will be raised in non production environments. In production,
616
+ an empty link element will be rendered.
617
+ - name: scheme
618
+ type: Symbol
619
+ default: "`:default`"
620
+ description: One of `:default`, `:primary`, or `:secondary`.
621
+ - name: muted
622
+ type: Boolean
623
+ default: "`false`"
624
+ description: Uses light gray for Link color, and blue on hover.
625
+ - name: underline
626
+ type: Boolean
627
+ default: "`true`"
628
+ description: Whether or not to underline the link.
629
+ - name: system_arguments
630
+ type: Hash
631
+ default: N/A
632
+ description: "[System arguments](/system-arguments)"
633
+ - component: LocalTime
634
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/local_time.rb
635
+ parameters:
636
+ - name: datetime
637
+ type: DateTime
638
+ default: N/A
639
+ description: The date to parse
640
+ - name: initial_text
641
+ type: String
642
+ default: "`nil`"
643
+ description: Text to render before component is initialized
644
+ - name: weekday
645
+ type: Symbol
646
+ default: "`:short`"
647
+ description: One of `:long` and `:short`.
648
+ - name: year
649
+ type: Symbol
650
+ default: "`:numeric`"
651
+ description: One of `:2-digit` and `:numeric`.
652
+ - name: month
653
+ type: Symbol
654
+ default: "`:short`"
655
+ description: One of `:long` and `:short`.
656
+ - name: day
657
+ type: Symbol
658
+ default: "`:numeric`"
659
+ description: One of `:2-digit` and `:numeric`.
660
+ - name: hour
661
+ type: Symbol
662
+ default: "`:numeric`"
663
+ description: One of `:2-digit` and `:numeric`.
664
+ - name: minute
665
+ type: Symbol
666
+ default: "`:numeric`"
667
+ description: One of `:2-digit` and `:numeric`.
668
+ - name: second
669
+ type: Symbol
670
+ default: "`:numeric`"
671
+ description: One of `:2-digit` and `:numeric`.
672
+ - name: time_zone_name
673
+ type: Symbol
674
+ default: "`:short`"
675
+ description: One of `:long` and `:short`.
676
+ - name: system_arguments
677
+ type: Hash
678
+ default: N/A
679
+ description: "[System arguments](/system-arguments)"
680
+ - component: Markdown
681
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/markdown.rb
682
+ parameters:
683
+ - name: tag
684
+ type: Symbol
685
+ default: "`:div`"
686
+ description: One of `:article`, `:div`, or `:td`.
687
+ - name: system_arguments
688
+ type: Hash
689
+ default: N/A
690
+ description: "[System arguments](/system-arguments)"
691
+ - component: Menu
692
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/menu_component.rb
693
+ parameters:
694
+ - name: system_arguments
695
+ type: Hash
696
+ default: N/A
697
+ description: "[System arguments](/system-arguments)"
698
+ - component: NavigationTab
699
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/navigation/tab_component.rb
700
+ parameters:
701
+ - name: list
702
+ type: Boolean
703
+ default: "`false`"
704
+ description: Whether the Tab is an item in a `<ul>` list.
705
+ - name: selected
706
+ type: Boolean
707
+ default: "`false`"
708
+ description: Whether the Tab is selected or not.
709
+ - name: with_panel
710
+ type: Boolean
711
+ default: "`false`"
712
+ description: Whether the Tab has an associated panel.
713
+ - name: panel_id
714
+ type: String
715
+ default: '`""`'
716
+ description: Only applies if `with_panel` is `true`. Unique id of panel.
717
+ - name: icon_classes
718
+ type: Boolean
719
+ default: '`""`'
720
+ description: Classes that must always be applied to icons.
721
+ - name: wrapper_arguments
722
+ type: Hash
723
+ default: "`{}`"
724
+ description: "[System arguments](/system-arguments) to be used in the `<li>` wrapper
725
+ when the tab is an item in a list."
726
+ - name: system_arguments
727
+ type: Hash
728
+ default: N/A
729
+ description: "[System arguments](/system-arguments)"
730
+ - component: Octicon
731
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/octicon_component.rb
732
+ parameters:
733
+ - name: icon_name
734
+ type: Symbol, String
735
+ default: "`nil`"
736
+ description: Name of [Octicon](https://primer.style/octicons/) to use.
737
+ - name: icon
738
+ type: Symbol, String
739
+ default: "`nil`"
740
+ description: Name of [Octicon](https://primer.style/octicons/) to use.
741
+ - name: size
742
+ type: Symbol
743
+ default: "`:small`"
744
+ description: One of `:small` (`16`) and `:medium` (`24`).
745
+ - name: use_symbol
746
+ type: Boolean
747
+ default: "`false`"
748
+ description: EXPERIMENTAL (May change or be removed) - Set to true when using
749
+ with [OcticonSymbols](/components/octiconsymbols).
750
+ - name: system_arguments
751
+ type: Hash
752
+ default: N/A
753
+ description: "[System arguments](/system-arguments)"
754
+ - component: OcticonSymbols
755
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/octicon_symbols_component.rb
756
+ parameters:
757
+ - name: icons
758
+ type: Array<Hash>
759
+ default: "`[]`"
760
+ description: 'List of icons to render, in the format { symbol: :icon_name, size:
761
+ :small }'
762
+ - component: Popover
763
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/popover_component.rb
764
+ parameters:
765
+ - name: system_arguments
766
+ type: Hash
767
+ default: N/A
768
+ description: "[System arguments](/system-arguments)"
769
+ - component: ProgressBar
770
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/progress_bar_component.rb
771
+ parameters:
772
+ - name: size
773
+ type: Symbol
774
+ default: "`:default`"
775
+ description: One of `:default`, `:large`, or `:small`. Increases height.
776
+ - name: system_arguments
777
+ type: Hash
778
+ default: N/A
779
+ description: "[System arguments](/system-arguments)"
780
+ - component: Spinner
781
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/spinner_component.rb
782
+ parameters:
783
+ - name: size
784
+ type: Symbol
785
+ default: "`:medium`"
786
+ description: One of `[:large, 64]`, `[:medium, 32]`, or `[:small, 16]`.
787
+ - name: style
788
+ type: String
789
+ default: "`box-sizing: content-box; color: var(--color-icon-primary);`"
790
+ description: Custom element styles.
791
+ - name: system_arguments
792
+ type: Hash
793
+ default: N/A
794
+ description: "[System arguments](/system-arguments)"
795
+ - component: State
796
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/state_component.rb
797
+ parameters:
798
+ - name: title
799
+ type: String
800
+ default: N/A
801
+ description: "`title` HTML attribute."
802
+ - name: scheme
803
+ type: Symbol
804
+ default: "`:default`"
805
+ description: Background color. One of `:closed`, `:default`, `:green`, `:merged`,
806
+ `:open`, `:purple`, or `:red`.
807
+ - name: tag
808
+ type: Symbol
809
+ default: "`:span`"
810
+ description: HTML tag for element. One of `:div` and `:span`.
811
+ - name: size
812
+ type: Symbol
813
+ default: "`:default`"
814
+ description: One of `:default` and `:small`.
815
+ - name: system_arguments
816
+ type: Hash
817
+ default: N/A
818
+ description: "[System arguments](/system-arguments)"
819
+ - component: Subhead
820
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/subhead_component.rb
821
+ parameters:
822
+ - name: spacious
823
+ type: Boolean
824
+ default: "`false`"
825
+ description: Whether to add spacing to the Subhead.
826
+ - name: hide_border
827
+ type: Boolean
828
+ default: "`false`"
829
+ description: Whether to hide the border under the heading.
830
+ - name: system_arguments
831
+ type: Hash
832
+ default: N/A
833
+ description: "[System arguments](/system-arguments)"
834
+ - component: TabContainer
835
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/tab_container_component.rb
836
+ parameters:
837
+ - name: system_arguments
838
+ type: Hash
839
+ default: N/A
840
+ description: "[System arguments](/system-arguments)"
841
+ - component: TabNav
842
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/tab_nav_component.rb
843
+ parameters:
844
+ - name: label
845
+ type: String
846
+ default: N/A
847
+ description: Used to set the `aria-label` on the top level `<nav>` element.
848
+ - name: with_panel
849
+ type: Boolean
850
+ default: "`false`"
851
+ description: Whether the TabNav should navigate through pages or panels. When
852
+ true, [TabContainer](/components/tabcontainer) is rendered along with JavaScript
853
+ behavior. Additionally, the `tab` slot will render as a button as opposed to
854
+ an anchor.
855
+ - name: body_arguments
856
+ type: Hash
857
+ default: "`{}`"
858
+ description: "[System arguments](/system-arguments) for the body wrapper."
859
+ - name: wrapper_arguments
860
+ type: Hash
861
+ default: "`{}`"
862
+ description: "[System arguments](/system-arguments) for the `TabContainer` wrapper.
863
+ Only applies if `with_panel` is `true`."
864
+ - name: system_arguments
865
+ type: Hash
866
+ default: N/A
867
+ description: "[System arguments](/system-arguments)"
868
+ - component: TimeAgo
869
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/time_ago_component.rb
870
+ parameters:
871
+ - name: time
872
+ type: Time
873
+ default: N/A
874
+ description: The time to be formatted
875
+ - name: micro
876
+ type: Boolean
877
+ default: "`false`"
878
+ description: If true then the text will be formatted in "micro" mode, using as
879
+ few characters as possible
880
+ - name: system_arguments
881
+ type: Hash
882
+ default: N/A
883
+ description: "[System arguments](/system-arguments)"
884
+ - component: TimelineItem
885
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/timeline_item_component.rb
886
+ parameters:
887
+ - name: condensed
888
+ type: Boolean
889
+ default: "`false`"
890
+ description: Reduce the vertical padding and remove the background from the badge
891
+ item. Most commonly used in commits.
892
+ - name: system_arguments
893
+ type: Hash
894
+ default: N/A
895
+ description: "[System arguments](/system-arguments)"
896
+ - component: Tooltip
897
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/tooltip.rb
898
+ parameters:
899
+ - name: label
900
+ type: String
901
+ default: N/A
902
+ description: the text to appear in the tooltip
903
+ - name: direction
904
+ type: String
905
+ default: "`:n`"
906
+ description: Direction of the tooltip. One of `:e`, `:n`, `:ne`, `:nw`, `:s`,
907
+ `:se`, `:sw`, or `:w`.
908
+ - name: align
909
+ type: String
910
+ default: "`:default`"
911
+ description: Align tooltips to the left or right of an element, combined with
912
+ a `direction` to specify north or south. One of `:default`, `:left_1`, `:left_2`,
913
+ `:right_1`, or `:right_2`.
914
+ - name: multiline
915
+ type: Boolean
916
+ default: "`false`"
917
+ description: Use this when you have long content
918
+ - name: no_delay
919
+ type: Boolean
920
+ default: "`false`"
921
+ description: By default the tooltips have a slight delay before appearing. Set
922
+ true to override this
923
+ - name: system_arguments
924
+ type: Hash
925
+ default: N/A
926
+ description: "[System arguments](/system-arguments)"
927
+ - component: Truncate
928
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/truncate.rb
929
+ parameters:
930
+ - name: tag
931
+ type: Symbol
932
+ default: "`:div`"
933
+ description: One of `:div`, `:p`, `:span`, or `:strong`.
934
+ - name: inline
935
+ type: Boolean
936
+ default: "`false`"
937
+ description: Whether the element is inline (or inline-block).
938
+ - name: expandable
939
+ type: Boolean
940
+ default: "`false`"
941
+ description: Whether the entire string should be revealed on hover. Can only be
942
+ used in conjunction with `inline`.
943
+ - name: max_width
944
+ type: Integer
945
+ default: "`nil`"
946
+ description: Sets the max-width of the text.
947
+ - name: system_arguments
948
+ type: Hash
949
+ default: N/A
950
+ description: "[System arguments](/system-arguments)"
951
+ - component: UnderlineNav
952
+ source: https://github.com/primer/view_components/tree/main/app/components/primer/underline_nav_component.rb
953
+ parameters:
954
+ - name: label
955
+ type: String
956
+ default: N/A
957
+ description: The `aria-label` on top level `<nav>` element.
958
+ - name: with_panel
959
+ type: Boolean
960
+ default: "`false`"
961
+ description: Whether the `UnderlineNav` should navigate through pages or panels.
962
+ When true, [TabContainer](/components/tabcontainer) is rendered along with JavaScript
963
+ behavior.
964
+ - name: align
965
+ type: Symbol
966
+ default: "`:left`"
967
+ description: One of `:left` and `:right`. - Defaults to left
968
+ - name: body_arguments
969
+ type: Hash
970
+ default: "`{ tag: BODY_TAG_DEFAULT }`"
971
+ description: "[System arguments](/system-arguments) for the body wrapper."
972
+ - name: wrapper_arguments
973
+ type: Hash
974
+ default: "`{}`"
975
+ description: "[System arguments](/system-arguments) for the `TabContainer` wrapper.
976
+ Only applies if `with_panel` is `true`."
977
+ - name: system_arguments
978
+ type: Hash
979
+ default: N/A
980
+ description: "[System arguments](/system-arguments)"