openproject-primer_view_components 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -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_list.css +1 -1
  8. data/app/components/primer/alpha/action_list.css.json +1 -0
  9. data/app/components/primer/alpha/action_list.css.map +1 -1
  10. data/app/components/primer/alpha/action_list.pcss +6 -0
  11. data/app/components/primer/alpha/action_menu/action_menu_element.js +37 -6
  12. data/app/components/primer/alpha/action_menu/action_menu_element.ts +39 -5
  13. data/app/components/primer/alpha/dialog.rb +2 -1
  14. data/app/components/primer/beta/button.css +1 -1
  15. data/app/components/primer/beta/button.css.json +1 -0
  16. data/app/components/primer/beta/button.css.map +1 -1
  17. data/app/components/primer/beta/button.pcss +4 -0
  18. data/app/components/primer/beta/button.rb +6 -1
  19. data/app/components/primer/beta/flash.css +1 -1
  20. data/app/components/primer/beta/flash.css.map +1 -1
  21. data/app/components/primer/beta/flash.html.erb +1 -3
  22. data/app/components/primer/beta/flash.pcss +1 -2
  23. data/app/components/primer/component.rb +1 -1
  24. data/app/lib/primer/fetch_or_fallback_helper.rb +1 -1
  25. data/lib/primer/view_components/linters/details_menu_migration.rb +1 -1
  26. data/lib/primer/view_components/linters/tooltipped_migration.rb +1 -1
  27. data/lib/primer/view_components/version.rb +1 -1
  28. data/lib/primer/view_components.rb +18 -0
  29. data/previews/primer/beta/button_preview/leading_visual.html.erb +2 -2
  30. data/previews/primer/beta/button_preview/leading_visual_svg.html.erb +12 -0
  31. data/previews/primer/beta/button_preview/trailing_counter.html.erb +1 -1
  32. data/previews/primer/beta/button_preview/trailing_visual.html.erb +1 -1
  33. data/previews/primer/beta/button_preview.rb +22 -0
  34. data/static/info_arch.json +14 -1
  35. data/static/previews.json +13 -0
  36. metadata +3 -2
@@ -31,8 +31,7 @@
31
31
  /* Close button */
32
32
  .flash-close:not(.Banner-close) {
33
33
  float: right;
34
- padding: var(--control-medium-paddingInline-spacious);
35
- margin: calc(var(--control-medium-paddingInline-spacious) * -1);
34
+ margin-top: calc(var(--base-size-4) * -1);
36
35
  text-align: center;
37
36
  cursor: pointer;
38
37
 
@@ -52,7 +52,7 @@ module Primer
52
52
  message += " and will be removed in v#{version}." if version
53
53
  message += " Use #{new_class.name} instead." if new_class
54
54
 
55
- ActiveSupport::Deprecation.warn(message)
55
+ ::Primer::ViewComponents.deprecation.warn(message)
56
56
  end
57
57
 
58
58
  def validate_aria_label
@@ -29,7 +29,7 @@ module Primer
29
29
  if allowed_values.include?(given_value)
30
30
  given_value
31
31
  elsif deprecated_values&.include?(given_value)
32
- ActiveSupport::Deprecation.warn("#{given_value} is deprecated and will be removed in a future version.") unless Rails.env.production? || silence_deprecations?
32
+ ::Primer::ViewComponents.deprecation.warn("#{given_value} is deprecated and will be removed in a future version.") unless Rails.env.production? || silence_deprecations?
33
33
 
34
34
  given_value
35
35
  else
@@ -11,7 +11,7 @@ module ERBLint
11
11
  include Helpers::RuleHelpers
12
12
 
13
13
  MIGRATE_FROM_DETAILS_MENU = "<details-menu> has been deprecated. Please instead use Primer::Alpha::ActionMenu" \
14
- "https://primer.style/design/components/action-menu/rails/alpha"
14
+ " https://primer.style/design/components/action-menu/rails/alpha"
15
15
  DETAILS_MENU_RUBY_PATTERN = /tag:?\s+:"details-menu"/.freeze
16
16
 
17
17
  def run(processed_source)
@@ -10,7 +10,7 @@ module ERBLint
10
10
  include LinterRegistry
11
11
  include Helpers::RuleHelpers
12
12
 
13
- MIGRATE_TO_NEWER_TOOLTIP = ".tooltipped has been deprecated. There are major accessibility concerns with using this tooltip so please take action. See https://github.com/primer/view_components/blob/main/docs/content/guides/accessibility/tooltipped_migration.md."
13
+ MIGRATE_TO_NEWER_TOOLTIP = ".tooltipped has been deprecated. There are major accessibility concerns with using this tooltip so please take action. See https://primer.style/design/guides/development/rails/migration-guides/primer-css-tooltipped."
14
14
  TOOLTIPPED_RUBY_PATTERN = /classes:.*tooltipped|class:.*tooltipped/.freeze
15
15
 
16
16
  def run(processed_source)
@@ -5,7 +5,7 @@ module Primer
5
5
  module ViewComponents
6
6
  module VERSION
7
7
  MAJOR = 0
8
- MINOR = 7
8
+ MINOR = 8
9
9
  PATCH = 0
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
@@ -7,9 +7,27 @@ require "primer/view_components/engine"
7
7
  module Primer
8
8
  # :nodoc:
9
9
  module ViewComponents
10
+ DEPRECATION_HORIZON = "1.0"
11
+
10
12
  # primer/view_components root directory.
11
13
  def self.root
12
14
  Pathname(File.expand_path(File.join("..", ".."), __dir__))
13
15
  end
16
+
17
+ # Skip coverage here because only one branch will execute depending on what
18
+ # Rails version you're running.
19
+
20
+ # :nocov:
21
+ def self.deprecation
22
+ @deprecation ||=
23
+ if Rails.application.respond_to?(:deprecators)
24
+ Rails.application.deprecators[:primer_view_components] ||= ActiveSupport::Deprecation.new(
25
+ DEPRECATION_HORIZON, "primer_view_components"
26
+ )
27
+ else
28
+ ActiveSupport::Deprecation.instance
29
+ end
30
+ end
31
+ # :nocov:
14
32
  end
15
33
  end
@@ -2,9 +2,9 @@
2
2
  scheme: scheme,
3
3
  size: size,
4
4
  block: block,
5
- id: id,
5
+ id: "button-preview",
6
6
  align_content: align_content
7
7
  )) do |component| %>
8
8
  <% component.with_leading_visual_icon(icon: :search) %>
9
- Button
9
+ Search
10
10
  <% end %>
@@ -0,0 +1,12 @@
1
+ <%= render(Primer::Beta::Button.new(
2
+ scheme: scheme,
3
+ size: size,
4
+ block: block,
5
+ id: "button-preview",
6
+ align_content: align_content
7
+ )) do |component| %>
8
+ <% component.with_leading_visual_svg do %>
9
+ <path d="M8 16a2 2 0 001.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 008 16z"></path><path fill-rule="evenodd" d="M8 1.5A3.5 3.5 0 004.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.018.018 0 00-.003.01l.001.006c0 .002.002.004.004.006a.017.017 0 00.006.004l.007.001h10.964l.007-.001a.016.016 0 00.006-.004.016.016 0 00.004-.006l.001-.007a.017.017 0 00-.003-.01l-1.703-2.554a1.75 1.75 0 01-.294-.97V5A3.5 3.5 0 008 1.5zM3 5a5 5 0 0110 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.518 1.518 0 0113.482 13H2.518a1.518 1.518 0 01-1.263-2.36l1.703-2.554A.25.25 0 003 7.947V5z"></path>
10
+ <% end %>
11
+ Button
12
+ <% end %>
@@ -7,5 +7,5 @@
7
7
  )) do |component| %>
8
8
  <% component.with_leading_visual_icon(icon: :star) %>
9
9
  <% component.with_trailing_visual_counter(count: 15) %>
10
- Button
10
+ Star
11
11
  <% end %>
@@ -7,5 +7,5 @@
7
7
  tag: tag
8
8
  )) do |component| %>
9
9
  <% component.with_trailing_visual_counter(count: "15") %>
10
- Button
10
+ Comment
11
11
  <% end %>
@@ -264,6 +264,28 @@ module Primer
264
264
  })
265
265
  end
266
266
 
267
+ # @label Leading visual SVG
268
+ # @param scheme select [default, primary, danger, invisible, link]
269
+ # @param size select [small, medium]
270
+ # @param block toggle
271
+ # @param align_content select [center, start]
272
+ # @snapshot
273
+ def leading_visual_svg(
274
+ scheme: :invisible,
275
+ size: :medium,
276
+ block: false,
277
+ id: "button-preview",
278
+ align_content: :center
279
+ )
280
+ render_with_template(locals: {
281
+ scheme: scheme,
282
+ size: size,
283
+ block: block,
284
+ id: id,
285
+ align_content: align_content
286
+ })
287
+ end
288
+
267
289
  # @label Trailing action
268
290
  # @param block toggle
269
291
  # @param align_content select [center, start]
@@ -10495,7 +10495,7 @@
10495
10495
  "slots": [
10496
10496
  {
10497
10497
  "name": "leading_visual",
10498
- "description": "Leading visuals appear to the left of the button text.\n\nUse:\n\n- `leading_visual_icon` for a {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}.",
10498
+ "description": "Leading visuals appear to the left of the button text.\n\nUse:\n\n- `leading_visual_icon` for a {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}.\n\n- `leading_visual_svg` to render a SVG.",
10499
10499
  "parameters": [
10500
10500
  {
10501
10501
  "name": "system_arguments",
@@ -10708,6 +10708,19 @@
10708
10708
  ]
10709
10709
  }
10710
10710
  },
10711
+ {
10712
+ "preview_path": "primer/beta/button/leading_visual_svg",
10713
+ "name": "leading_visual_svg",
10714
+ "snapshot": "true",
10715
+ "skip_rules": {
10716
+ "wont_fix": [
10717
+ "region"
10718
+ ],
10719
+ "will_fix": [
10720
+ "color-contrast"
10721
+ ]
10722
+ }
10723
+ },
10711
10724
  {
10712
10725
  "preview_path": "primer/beta/button/trailing_action",
10713
10726
  "name": "trailing_action",
data/static/previews.json CHANGED
@@ -2046,6 +2046,19 @@
2046
2046
  ]
2047
2047
  }
2048
2048
  },
2049
+ {
2050
+ "preview_path": "primer/beta/button/leading_visual_svg",
2051
+ "name": "leading_visual_svg",
2052
+ "snapshot": "true",
2053
+ "skip_rules": {
2054
+ "wont_fix": [
2055
+ "region"
2056
+ ],
2057
+ "will_fix": [
2058
+ "color-contrast"
2059
+ ]
2060
+ }
2061
+ },
2049
2062
  {
2050
2063
  "preview_path": "primer/beta/button/trailing_action",
2051
2064
  "name": "trailing_action",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openproject-primer_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-08-16 00:00:00.000000000 Z
12
+ date: 2023-09-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -1062,6 +1062,7 @@ files:
1062
1062
  - previews/primer/beta/button_preview/all_schemes.html.erb
1063
1063
  - previews/primer/beta/button_preview/invisible_all_visuals.html.erb
1064
1064
  - previews/primer/beta/button_preview/leading_visual.html.erb
1065
+ - previews/primer/beta/button_preview/leading_visual_svg.html.erb
1065
1066
  - previews/primer/beta/button_preview/trailing_action.html.erb
1066
1067
  - previews/primer/beta/button_preview/trailing_counter.html.erb
1067
1068
  - previews/primer/beta/button_preview/trailing_visual.html.erb