openproject-primer_view_components 0.44.3 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/app/assets/javascripts/app/components/primer/alpha/x_banner.d.ts +5 -0
  4. data/app/assets/javascripts/app/components/primer/open_project/sub_header_element.d.ts +5 -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/banner.rb +6 -0
  10. data/app/components/primer/alpha/overlay.css +1 -1
  11. data/app/components/primer/alpha/overlay.css.json +1 -0
  12. data/app/components/primer/alpha/overlay.css.map +1 -1
  13. data/app/components/primer/alpha/overlay.pcss +4 -0
  14. data/app/components/primer/alpha/select_panel_element.js +6 -4
  15. data/app/components/primer/alpha/select_panel_element.ts +6 -5
  16. data/app/components/primer/alpha/x_banner.d.ts +5 -0
  17. data/app/components/primer/alpha/x_banner.js +4 -3
  18. data/app/components/primer/alpha/x_banner.ts +11 -3
  19. data/app/components/primer/beta/button.css +1 -1
  20. data/app/components/primer/beta/button.css.map +1 -1
  21. data/app/components/primer/beta/button.pcss +1 -1
  22. data/app/components/primer/beta/spinner.html.erb +8 -6
  23. data/app/components/primer/beta/spinner.rb +3 -0
  24. data/app/components/primer/open_project/sub_header.css +1 -1
  25. data/app/components/primer/open_project/sub_header.css.json +3 -1
  26. data/app/components/primer/open_project/sub_header.css.map +1 -1
  27. data/app/components/primer/open_project/sub_header.pcss +12 -0
  28. data/app/components/primer/open_project/sub_header.rb +19 -2
  29. data/app/components/primer/open_project/sub_header_element.d.ts +5 -1
  30. data/app/components/primer/open_project/sub_header_element.js +32 -0
  31. data/app/components/primer/open_project/sub_header_element.ts +39 -1
  32. data/app/lib/primer/attributes_helper.rb +10 -0
  33. data/lib/primer/forms/primer_text_field.js +0 -3
  34. data/lib/primer/forms/primer_text_field.ts +0 -3
  35. data/lib/primer/view_components/linters/base_linter.rb +4 -2
  36. data/lib/primer/view_components/linters/blankslate_component_migration_counter.rb +1 -1
  37. data/lib/primer/view_components/linters/select_menu_migration_counter.rb +14 -0
  38. data/lib/primer/view_components/version.rb +2 -2
  39. data/previews/primer/alpha/select_panel_preview/eventually_local_fetch.html.erb +2 -1
  40. data/previews/primer/alpha/select_panel_preview.rb +3 -2
  41. data/previews/primer/open_project/sub_header_preview.rb +15 -2
  42. data/static/classes.json +3 -0
  43. data/static/info_arch.json +1 -1
  44. metadata +3 -2
@@ -42,13 +42,15 @@ module ERBLint
42
42
 
43
43
  tags.each do |tag|
44
44
  next if tag.closing?
45
- next if self.class::TAGS&.none?(tag.name)
45
+ next if self.class::TAGS.present? && self.class::TAGS&.none?(tag.name)
46
46
 
47
47
  classes = tag.attributes["class"]&.value&.split(" ") || []
48
48
  tag_tree[tag][:offense] = false
49
49
 
50
50
  next if (classes & self.class::DISALLOWED_CLASSES).any?
51
- next unless self.class::CLASSES.blank? || (classes & self.class::CLASSES).any?
51
+ next unless self.class::CLASSES.blank? || classes.any? do |klass|
52
+ self.class::CLASSES.any? { |matcher| matcher === klass } # rubocop:disable Style/CaseEquality
53
+ end
52
54
 
53
55
  args = map_arguments(tag, tag_tree[tag])
54
56
  correction = correction(args)
@@ -6,7 +6,7 @@ module ERBLint
6
6
  module Linters
7
7
  # Counts the number of times a HTML Blankslate is used instead of the component.
8
8
  class BlankslateComponentMigrationCounter < BaseLinter
9
- MESSAGE = "We are migrating Blankslate to use [Primer::Beta::Blankslate](https://primer.style/view-components/components/beta/blankslate), please try to use that instead of raw HTML."
9
+ MESSAGE = "We are migrating Blankslate to use [Primer::Beta::Blankslate](https://primer.style/components/blankslate/rails/beta), please try to use that instead of raw HTML."
10
10
  CLASSES = %w[blankslate].freeze
11
11
  TAGS = %w[div].freeze
12
12
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base_linter"
4
+
5
+ module ERBLint
6
+ module Linters
7
+ # Counts the number of times a HTML SelectMenu is used instead of the SelectPanel component.
8
+ class SelectMenuMigrationCounter < BaseLinter
9
+ MESSAGE = "Please use the [Primer::Alpha::SelectPanel](https://primer.style/components/selectpanel/rails/alpha) component instead of SelectMenu."
10
+ CLASSES = ["SelectMenu", /\ASelectMenu-.*/].freeze
11
+ TAGS = [].freeze
12
+ end
13
+ end
14
+ end
@@ -5,8 +5,8 @@ module Primer
5
5
  module ViewComponents
6
6
  module VERSION
7
7
  MAJOR = 0
8
- MINOR = 44
9
- PATCH = 3
8
+ MINOR = 46
9
+ PATCH = 0
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -5,7 +5,8 @@
5
5
  src: select_panel_items_path,
6
6
  select_variant: :multiple,
7
7
  fetch_strategy: :eventually_local,
8
- open_on_load: open_on_load
8
+ open_on_load: open_on_load,
9
+ show_filter: show_filter,
9
10
  )) do |panel| %>
10
11
  <% panel.with_show_button { "Sci-fi equipment" } %>
11
12
  <% panel.with_footer(show_divider: true) do %>
@@ -77,8 +77,9 @@ module Primer
77
77
  #
78
78
  # @snapshot interactive
79
79
  # @param open_on_load toggle
80
- def eventually_local_fetch(open_on_load: false)
81
- render_with_template(locals: { open_on_load: open_on_load })
80
+ # @param show_filter toggle
81
+ def eventually_local_fetch(open_on_load: false, show_filter: true)
82
+ render_with_template(locals: { open_on_load: open_on_load, show_filter: show_filter })
82
83
  end
83
84
 
84
85
  # @label Remote fetch
@@ -11,10 +11,23 @@ module Primer
11
11
  # @param show_filter_input toggle
12
12
  # @param show_filter_button toggle
13
13
  # @param show_action_button toggle
14
+ # @param show_clear_button toggle
14
15
  # @param text text
15
- def playground(show_filter_input: true, show_filter_button: true, show_action_button: true, text: nil)
16
+ # @param value text
17
+ def playground(
18
+ show_filter_input: true,
19
+ show_clear_button: true,
20
+ show_filter_button: true,
21
+ show_action_button: true,
22
+ text: nil,
23
+ value: nil
24
+ )
16
25
  render(Primer::OpenProject::SubHeader.new) do |component|
17
- component.with_filter_input(name: "filter", label: "Filter") if show_filter_input
26
+ component.with_filter_input(
27
+ name: "filter",
28
+ label: "Filter",
29
+ show_clear_button: show_clear_button,
30
+ value: value) if show_filter_input
18
31
  component.with_filter_button do |button|
19
32
  button.with_trailing_visual_counter(count: "15")
20
33
  "Filter"
data/static/classes.json CHANGED
@@ -591,6 +591,9 @@
591
591
  "SubHeader-filterContainer": [
592
592
  "Primer::OpenProject::SubHeader"
593
593
  ],
594
+ "SubHeader-filterInput_hiddenClearButton": [
595
+ "Primer::OpenProject::SubHeader"
596
+ ],
594
597
  "SubHeader-leftPane": [
595
598
  "Primer::OpenProject::SubHeader"
596
599
  ],
@@ -2425,7 +2425,7 @@
2425
2425
  },
2426
2426
  {
2427
2427
  "fully_qualified_name": "Primer::Alpha::Banner",
2428
- "description": "Use `Banner` to highlight important information.",
2428
+ "description": "Use `Banner` to highlight important information.\n\n### Events\n\n|Name |Type |Bubbles |Cancelable |\n|:---------|:-------------------|:-------|:----------|\n|`dismiss` |`CustomEvent<void>` |No |No |",
2429
2429
  "accessibility_docs": "### Improve discoverability with a heading and landmark\nBanners are made visually prominent with icons and colors to immediately draw attention.\n\nTo ensure the Banner is also easily discoverable for assistive technology users, consider:\n1. Providing a heading inside of the Banner that describes the purpose of the Banner.\n2. Designating the Banner as a `region` landmark. This can be achieved by rendering the Banner as a `section` with an `aria-labelledby` pointing to the heading.\n\n### Communicating feedback\nWhen a Banner is used to communicate feedback, a live region or focus management technique should be in place to ensure that assistive technology users are aware of the feedback, especially when the Banner is shown client-side. Visit the [Banner's Accessibility section](https://primer.style/components/banner#accessibility), or defer to the accessibility team.\n\n#### Approach 1: Announcing a Banner\nA live region announcement can be used to communicate non-critical feedback, such as a success message.\n\nTo successfully trigger a live region announcement for a Banner that is un-`hidden` or dynamically injected onto the page, **do not** set the live region attribute/role on the Banner itself. Instead, it's important to rely on a live region that is already guaranteed to be on the page. Learn more about specific techniques at: [Staff only: Challenges with live regions](https://github.com/github/accessibility/blob/main/docs/coaching-recommendations/toast-flash-banner/accessible-banner-prototype.md#challenges-with-dynamically-inserted-live-region).\n\n#### Approach 2: Focusing a Banner\nFocusing the Banner can be appropriate for critical feedback scenarios, such as a [form validation error summary](https://primer.style/ui-patterns/forms/overview#interactive-summary-of-errors) where the Banner contains actions to help unblock the user.\n\nTo properly focus a Banner, add a `tabindex=\"-1\"` place focus with JavaScript (using the [`focus()` API](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus)).",
2430
2430
  "is_form_component": false,
2431
2431
  "is_published": true,
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.44.3
4
+ version: 0.46.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: 2024-09-06 00:00:00.000000000 Z
12
+ date: 2024-09-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -750,6 +750,7 @@ files:
750
750
  - lib/primer/view_components/linters/migrate_deprecated_flash_arguments.rb
751
751
  - lib/primer/view_components/linters/migrations/iconbutton_component.rb
752
752
  - lib/primer/view_components/linters/migrations/truncate_component.rb
753
+ - lib/primer/view_components/linters/select_menu_migration_counter.rb
753
754
  - lib/primer/view_components/linters/severity_schema.rb
754
755
  - lib/primer/view_components/linters/subhead_component_migration_counter.rb
755
756
  - lib/primer/view_components/linters/super_in_component_templates.rb