primer_view_components 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +66 -0
  3. data/app/assets/javascripts/app/components/primer/alpha/action_menu/action_menu_element.d.ts +3 -2
  4. data/app/assets/javascripts/app/components/primer/alpha/x_banner.d.ts +3 -1
  5. data/app/assets/javascripts/primer_view_components.js +1 -1
  6. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  7. data/app/assets/styles/primer_view_components.css +1 -1
  8. data/app/assets/styles/primer_view_components.css.map +1 -1
  9. data/app/components/primer/alpha/action_list/item.rb +17 -6
  10. data/app/components/primer/alpha/action_list.css +1 -1
  11. data/app/components/primer/alpha/action_list.css.json +2 -0
  12. data/app/components/primer/alpha/action_list.css.map +1 -1
  13. data/app/components/primer/alpha/action_list.pcss +4 -2
  14. data/app/components/primer/alpha/action_list.rb +61 -6
  15. data/app/components/primer/alpha/action_menu/action_menu_element.d.ts +3 -2
  16. data/app/components/primer/alpha/action_menu/action_menu_element.js +9 -2
  17. data/app/components/primer/alpha/action_menu/action_menu_element.ts +10 -5
  18. data/app/components/primer/alpha/action_menu/list.rb +63 -34
  19. data/app/components/primer/alpha/action_menu.rb +12 -0
  20. data/app/components/primer/alpha/banner.html.erb +1 -1
  21. data/app/components/primer/alpha/banner.rb +13 -9
  22. data/app/components/primer/alpha/dialog.css +1 -1
  23. data/app/components/primer/alpha/dialog.css.map +1 -1
  24. data/app/components/primer/alpha/dialog.pcss +2 -1
  25. data/app/components/primer/alpha/modal_dialog.js +1 -1
  26. data/app/components/primer/alpha/modal_dialog.ts +1 -1
  27. data/app/components/primer/alpha/nav_list/group.rb +12 -3
  28. data/app/components/primer/alpha/nav_list.rb +80 -16
  29. data/app/components/primer/alpha/tool_tip.js +3 -3
  30. data/app/components/primer/alpha/tool_tip.ts +3 -3
  31. data/app/components/primer/alpha/x_banner.d.ts +3 -1
  32. data/app/components/primer/alpha/x_banner.js +24 -10
  33. data/app/components/primer/alpha/x_banner.ts +14 -12
  34. data/app/components/primer/base_component.rb +1 -1
  35. data/app/components/primer/beta/avatar.rb +1 -1
  36. data/app/components/primer/beta/button.css +1 -1
  37. data/app/components/primer/beta/button.css.map +1 -1
  38. data/app/components/primer/beta/button.pcss +1 -1
  39. data/app/components/primer/beta/counter.css +1 -1
  40. data/app/components/primer/beta/counter.css.map +1 -1
  41. data/app/components/primer/beta/counter.pcss +1 -1
  42. data/app/components/primer/beta/state.css +1 -1
  43. data/app/components/primer/beta/state.css.map +1 -1
  44. data/app/components/primer/beta/state.pcss +3 -3
  45. data/app/forms/submit_button_form.rb +1 -1
  46. data/lib/primer/classify/utilities.yml +2 -0
  47. data/lib/primer/forms/button.rb +0 -5
  48. data/lib/primer/forms/dsl/input.rb +2 -0
  49. data/lib/primer/view_components/version.rb +1 -1
  50. data/lib/primer/yard/lookbook_pages_backend.rb +31 -0
  51. data/lib/tasks/custom_utilities.yml +2 -0
  52. data/previews/primer/alpha/action_list_preview.rb +89 -17
  53. data/previews/primer/alpha/action_menu_preview.rb +79 -37
  54. data/previews/primer/alpha/banner_preview/with_action_button.html.erb +1 -1
  55. data/previews/primer/alpha/banner_preview/with_action_content.html.erb +1 -1
  56. data/previews/primer/alpha/banner_preview.rb +11 -14
  57. data/previews/primer/alpha/nav_list_preview.rb +17 -0
  58. data/static/arguments.json +6 -12
  59. data/static/constants.json +6 -0
  60. data/static/info_arch.json +371 -22
  61. data/static/previews.json +15 -2
  62. metadata +2 -2
@@ -8,15 +8,14 @@ module Primer
8
8
  #
9
9
  # @param full toggle
10
10
  # @param full_when_narrow toggle
11
- # @param dismissible toggle
11
+ # @param dismiss_scheme [Symbol] select [none, remove, hide]
12
12
  # @param icon [Symbol] octicon
13
13
  # @param scheme [Symbol] select [default, warning, danger, success]
14
14
  # @param content text
15
15
  # @param description text
16
- # @param reappear [Boolean]
17
- def playground(full: false, full_when_narrow: false, dismissible: false, icon: :people, scheme: Primer::Alpha::Banner::DEFAULT_SCHEME, reappear: true, content: "This is a banner!", description: nil)
16
+ def playground(full: false, full_when_narrow: false, dismiss_scheme: Primer::Alpha::Banner::DEFAULT_DISMISS_SCHEME, icon: :people, scheme: Primer::Alpha::Banner::DEFAULT_SCHEME, content: "This is a banner!", description: nil)
18
17
  icon = nil if icon == :none
19
- render(Primer::Alpha::Banner.new(full: full, full_when_narrow: full_when_narrow, dismissible: dismissible, icon: icon == :none ? nil : icon, scheme: scheme, description: description, reappear: reappear)) { content }
18
+ render(Primer::Alpha::Banner.new(full: full, full_when_narrow: full_when_narrow, dismiss_scheme: dismiss_scheme, icon: icon == :none ? nil : icon, scheme: scheme, description: description)) { content }
20
19
  end
21
20
 
22
21
  # @label Default
@@ -54,8 +53,8 @@ module Primer
54
53
 
55
54
  # @label Dismissable
56
55
  # @snapshot
57
- def dismissable
58
- render(Primer::Alpha::Banner.new(dismissible: true, reappear: true)) { "This is a dismissable banner." }
56
+ def dismissible
57
+ render(Primer::Alpha::Banner.new(dismiss_scheme: :hide, reappear: true)) { "This is a dismissable banner." }
59
58
  end
60
59
 
61
60
  # @!group Full Width
@@ -76,29 +75,27 @@ module Primer
76
75
  # @label With action button
77
76
  #
78
77
  # @param full toggle
79
- # @param dismissible toggle
78
+ # @param dismiss_scheme [Symbol] select [none, remove, hide]
80
79
  # @param icon [Symbol] octicon
81
80
  # @param scheme [Symbol] select [default, warning, danger, success]
82
81
  # @param content text
83
- # @param reappear [Boolean]
84
82
  # @snapshot
85
- def with_action_button(full: false, dismissible: false, icon: :people, scheme: Primer::Alpha::Banner::DEFAULT_SCHEME, reappear: true, content: "This is a banner with an action!")
83
+ def with_action_button(full: false, dismiss_scheme: Primer::Alpha::Banner::DEFAULT_DISMISS_SCHEME, icon: :people, scheme: Primer::Alpha::Banner::DEFAULT_SCHEME, content: "This is a banner with an action!")
86
84
  icon = nil if icon == :none
87
- render_with_template(locals: { full: full, dismissible: dismissible, icon: icon == :none ? nil : icon, scheme: scheme, content: content, reappear: reappear })
85
+ render_with_template(locals: { full: full, dismiss_scheme: dismiss_scheme, icon: icon == :none ? nil : icon, scheme: scheme, content: content })
88
86
  end
89
87
 
90
88
  # @label With action content
91
89
  #
92
90
  # @param full toggle
93
- # @param dismissible toggle
91
+ # @param dismiss_scheme [Symbol] select [none, remove, hide]
94
92
  # @param icon [Symbol] octicon
95
93
  # @param scheme [Symbol] select [default, warning, danger, success]
96
94
  # @param content text
97
- # @param reappear [Boolean]
98
95
  # @snapshot
99
- def with_action_content(full: false, dismissible: false, icon: :people, scheme: Primer::Alpha::Banner::DEFAULT_SCHEME, reappear: true, content: "Did you know? Comments can be edited.")
96
+ def with_action_content(full: false, dismiss_scheme: Primer::Alpha::Banner::DEFAULT_DISMISS_SCHEME, icon: :people, scheme: Primer::Alpha::Banner::DEFAULT_SCHEME, content: "Did you know? Comments can be edited.")
100
97
  icon = nil if icon == :none
101
- render_with_template(locals: { full: full, dismissible: dismissible, icon: icon == :none ? nil : icon, scheme: scheme, content: content, reappear: reappear })
98
+ render_with_template(locals: { full: full, dismiss_scheme: dismiss_scheme, icon: icon == :none ? nil : icon, scheme: scheme, content: content })
102
99
  end
103
100
  end
104
101
  end
@@ -50,6 +50,15 @@ module Primer
50
50
  list.with_group do |group|
51
51
  group.with_heading(title: "Access")
52
52
 
53
+ group.with_avatar_item(
54
+ src: "https://avatars.githubusercontent.com/u/103004183?v=4",
55
+ username: "hulk_smash",
56
+ full_name: "Bruce Banner",
57
+ full_name_scheme: :inline,
58
+ href: "/profile",
59
+ avatar_arguments: { shape: :square }
60
+ )
61
+
53
62
  group.with_item(label: "Collaborators and teams", href: "/collaborators", selected_by_ids: :collaborators) do |item|
54
63
  item.with_leading_visual_icon(icon: :people)
55
64
  end
@@ -82,6 +91,14 @@ module Primer
82
91
  list.with_item(label: "Change password", href: "/change_password") do |item|
83
92
  item.with_leading_visual_icon(icon: :key)
84
93
  end
94
+
95
+ list.with_avatar_item(
96
+ src: "https://avatars.githubusercontent.com/u/103004183?v=4",
97
+ username: "hulk_smash",
98
+ full_name: "Bruce Banner",
99
+ full_name_scheme: :inline,
100
+ href: "/profile"
101
+ )
85
102
  end
86
103
  end
87
104
 
@@ -270,7 +270,7 @@
270
270
  "name": "description_scheme",
271
271
  "type": "Symbol",
272
272
  "default": "`:block`",
273
- "description": "Display description inline with label, or block on the next line."
273
+ "description": "Display description inline with label, or block on the next line. One of `:block` or `:inline`."
274
274
  },
275
275
  {
276
276
  "name": "active",
@@ -521,10 +521,10 @@
521
521
  "description": "Whether the component should take up the full width of the screen when rendered inside smaller viewports."
522
522
  },
523
523
  {
524
- "name": "dismissible",
525
- "type": "Boolean",
526
- "default": "`false`",
527
- "description": "Whether the component can be dismissed with an \"x\" button."
524
+ "name": "dismiss_scheme",
525
+ "type": "Symbol",
526
+ "default": "`:none`",
527
+ "description": "Whether the component can be dismissed with an \"x\" button. One of `:hide`, `:none`, or `:remove`."
528
528
  },
529
529
  {
530
530
  "name": "description",
@@ -544,12 +544,6 @@
544
544
  "default": "`:default`",
545
545
  "description": "One of `:danger`, `:default`, `:success`, or `:warning`."
546
546
  },
547
- {
548
- "name": "reappear",
549
- "type": "Boolean",
550
- "default": "`false`",
551
- "description": "Whether or not the flash banner should reappear after being dismissed. Only for use in test and preview environments."
552
- },
553
547
  {
554
548
  "name": "system_arguments",
555
549
  "type": "Hash",
@@ -2986,7 +2980,7 @@
2986
2980
  {
2987
2981
  "name": "alt",
2988
2982
  "type": "String",
2989
- "default": "N/A",
2983
+ "default": "`nil`",
2990
2984
  "description": "Passed through to alt on img tag."
2991
2985
  },
2992
2986
  {
@@ -146,6 +146,7 @@
146
146
  "Primer::Alpha::AutoComplete::Item": {
147
147
  },
148
148
  "Primer::Alpha::Banner": {
149
+ "DEFAULT_DISMISS_SCHEME": "none",
149
150
  "DEFAULT_ICONS": {
150
151
  "default": "bell",
151
152
  "warning": "alert",
@@ -153,6 +154,11 @@
153
154
  "success": "check-circle"
154
155
  },
155
156
  "DEFAULT_SCHEME": "default",
157
+ "DISMISS_SCHEMES": [
158
+ "none",
159
+ "remove",
160
+ "hide"
161
+ ],
156
162
  "LEGACY_SCHEME_MAPPINGS": {
157
163
  "default": "",
158
164
  "warning": "flash-warn",