openproject-primer_view_components 0.63.0 → 0.64.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a157780e81b4a84c0814e2b933b4f2e2fcf6ad74d549353b058fc8012b57fea
4
- data.tar.gz: 3ab915e6a83249d059e8a95b6a21e3739c8ac6b73bf22486ae2601020e2971e3
3
+ metadata.gz: c14efbdaa174fe50a4ab8910f0d4d15b7395e9cb13f10c437a733205f31a713a
4
+ data.tar.gz: '06395f1e3999aad177aed7b3312f0ce397fdc02893cca1ed55b8788d58ba915f'
5
5
  SHA512:
6
- metadata.gz: a0b70e6823a3bc2d69de91864ccde36d0d8063fda209c829f041e8ba63105c1f3d97acfbed26bba8b8fd53c4e6ddf3f4486199a245653988d308bdceaca5f742
7
- data.tar.gz: 026dbfd7490dfa3e53e43802e45947089ee1c5776d9db4e6eda22e20d914ae979cc7af3b0afb4a0a2266f5d2594d370265c1052072f997642c6a300672e8579a
6
+ metadata.gz: 2c24a2a4acee0ffe10644fa9d1195b2640fac91f77159c9919359b0585e72931d4b541676f3021dcc921c0523a829f21963eda4fb62024fb72d9be700540985b
7
+ data.tar.gz: 8785b506bc36848f1251bff3d7e85631fa9a5b9dd3a4c6b21e1d2333bf79ae8dcef228b6d023b9909a7b051dfb430e1815273b4370618b81e19d7ce9a7b02989
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.64.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#3466](https://github.com/primer/view_components/pull/3466) [`57f6c41`](https://github.com/opf/primer_view_components/commit/57f6c41025de70dfcd6880dab7e881d182e3cbd9) Thanks [@manuelpuyol](https://github.com/manuelpuyol)! - Create Primer::CurrentAttributes allowing apps to set request specific context to components. Update IncludeFragment to add data-nonce when a current nonce is present.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#3447](https://github.com/primer/view_components/pull/3447) [`c2b88cb`](https://github.com/opf/primer_view_components/commit/c2b88cb1d75e86fc0b410e3fc597e48326f471a5) Thanks [@bsatarnejad](https://github.com/bsatarnejad)! - Add a new custom label for close button in dialog header
12
+
13
+ - [#3450](https://github.com/primer/view_components/pull/3450) [`5e86bf4`](https://github.com/opf/primer_view_components/commit/5e86bf422b13a3818def5ceab464f8e362f9021b) Thanks [@francinelucca](https://github.com/francinelucca)! - Fix(SelectPanel): incorrect padding when no filter
14
+
3
15
  ## 0.63.0
4
16
 
5
17
  ### Minor Changes
@@ -13,7 +13,7 @@
13
13
  <% end %>
14
14
  </div>
15
15
  <div class="Overlay-actionWrap">
16
- <%= render Primer::Beta::CloseButton.new(classes: "Overlay-closeButton", "data-close-dialog-id": @id) %>
16
+ <%= render Primer::Beta::CloseButton.new(classes: "Overlay-closeButton", "data-close-dialog-id": @id, aria: { label: @close_label }) %>
17
17
  </div>
18
18
  </div>
19
19
  <%= filter %>
@@ -16,6 +16,8 @@ module Primer
16
16
  }.freeze
17
17
  VARIANT_OPTIONS = VARIANT_MAPPINGS.keys
18
18
 
19
+ DEFAULT_CLOSE_LABEL = "Close"
20
+
19
21
  # Optional filter slot for adding a filter input to the header.
20
22
  #
21
23
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
@@ -48,6 +50,7 @@ module Primer
48
50
  # @param show_divider [Boolean] Show a divider between the header and body.
49
51
  # @param visually_hide_title [Boolean] Visually hide the `title` while maintaining a label for assistive technologies.
50
52
  # @param variant [Symbol] <%= one_of(Primer::Alpha::Dialog::Header::VARIANT_OPTIONS) %>
53
+ # @param close_label [String] The aria-label text of the close "x" button.
51
54
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
52
55
  def initialize(
53
56
  id:,
@@ -56,12 +59,14 @@ module Primer
56
59
  show_divider: false,
57
60
  visually_hide_title: false,
58
61
  variant: DEFAULT_VARIANT,
62
+ close_label: DEFAULT_CLOSE_LABEL,
59
63
  **system_arguments
60
64
  )
61
65
  @id = id
62
66
  @title = title
63
67
  @subtitle = subtitle
64
68
  @visually_hide_title = visually_hide_title
69
+ @close_label = close_label
65
70
  @system_arguments = deny_tag_argument(**system_arguments)
66
71
  @system_arguments[:tag] = :div
67
72
 
@@ -8,14 +8,27 @@ module Primer
8
8
  class IncludeFragment < Primer::Component
9
9
  status :alpha
10
10
 
11
+ ALLOWED_LOADING_VALUES = [:lazy, :eager].freeze
12
+ DEFAULT_LOADING = :eager
13
+
11
14
  # @param src [String] The URL from which to retrieve an HTML element fragment.
12
15
  # @param loading [Symbol] <%= one_of([:lazy, :eager]) %>
16
+ # @param accept [String] What to send as the Accept header.
13
17
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
14
- def initialize(src: nil, loading: :eager, **system_arguments)
18
+ def initialize(src: nil, loading: nil, accept: nil, **system_arguments)
15
19
  @system_arguments = system_arguments
16
20
  @system_arguments[:tag] = "include-fragment"
17
21
  @system_arguments[:loading] = loading
18
22
  @system_arguments[:src] = src
23
+ @system_arguments[:accept] = accept if accept
24
+
25
+ if loading
26
+ @system_arguments[:loading] = fetch_or_fallback(ALLOWED_LOADING_VALUES, loading.to_sym, DEFAULT_LOADING)
27
+ end
28
+
29
+ if Primer::CurrentAttributes.nonce
30
+ @system_arguments[:"data-nonce"] = Primer::CurrentAttributes.nonce
31
+ end
19
32
  end
20
33
 
21
34
  def call
@@ -50,7 +50,7 @@
50
50
  <% end %>
51
51
  <% end %>
52
52
  <% end %>
53
- <%= render Primer::Alpha::Dialog::Body.new(mt: show_filter? ? 0 : 2, p: 0) do %>
53
+ <%= render Primer::Alpha::Dialog::Body.new(p: 0) do %>
54
54
  <focus-group direction="vertical" mnemonics retain>
55
55
  <live-region data-target="select-panel.liveRegion"></live-region>
56
56
  <%= render(Primer::BaseComponent.new(
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ # `Primer::CurrentAttributes` can be used by controllers to set request-bound data
5
+ # that can be propagated to components.
6
+ class CurrentAttributes < ActiveSupport::CurrentAttributes
7
+ attribute :nonce
8
+ end
9
+ end
@@ -5,7 +5,7 @@ module Primer
5
5
  module ViewComponents
6
6
  module VERSION
7
7
  MAJOR = 0
8
- MINOR = 63
8
+ MINOR = 64
9
9
  PATCH = 0
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
@@ -0,0 +1,5 @@
1
+ <%= render(Primer::Alpha::Dialog.new(id: "my-dialog", title: title, subtitle: subtitle, visually_hide_title: false)) do |dialog| %>
2
+ <% dialog.with_header(show_divider: show_divider, close_label: close_label) %>
3
+ <% dialog.with_show_button_content(button_text) %>
4
+ <% dialog.with_body_content("Hello World") %>
5
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <%= render(Primer::Alpha::Dialog.new(id: "my-dialog", title: title, subtitle: subtitle, visually_hide_title: false)) do |dialog| %>
2
+ <% dialog.with_header(show_divider: show_divider, close_scheme: :none) %>
3
+ <% dialog.with_show_button_content(button_text) %>
4
+ <% dialog.with_body_content("Hello World") %>
5
+ <% dialog.with_footer do %>
6
+ <%= render(Primer::Beta::Button.new(data: { "close-dialog-id": "my-dialog" })) { "Close" } %>
7
+ <% end %>
8
+ <% end %>
@@ -302,6 +302,38 @@ module Primer
302
302
  def with_header_filter
303
303
  render_with_template(locals: {})
304
304
  end
305
+
306
+ # @label With custom label for close button of header
307
+ #
308
+ # @param title [String] text
309
+ # @param subtitle [String] text
310
+ # @param button_text [String] text
311
+ # @param show_divider [Boolean] toggle
312
+ # @param close_label [String] text
313
+ def with_header_close_button_label(title: "Test Dialog", subtitle: nil, button_text: "Show Dialog", show_divider: true, close_label: "Close me!")
314
+ render_with_template(locals: {
315
+ title: title,
316
+ subtitle: subtitle,
317
+ button_text: button_text,
318
+ show_divider: show_divider,
319
+ close_label: close_label
320
+ })
321
+ end
322
+
323
+ # @label Without custom label for close button of header
324
+ #
325
+ # @param title [String] text
326
+ # @param subtitle [String] text
327
+ # @param button_text [String] text
328
+ # @param show_divider [Boolean] toggle
329
+ def without_header_close_button_label(title: "Test Dialog", subtitle: nil, button_text: "Show Dialog", show_divider: true)
330
+ render_with_template(locals: {
331
+ title: title,
332
+ subtitle: subtitle,
333
+ button_text: button_text,
334
+ show_divider: show_divider
335
+ })
336
+ end
305
337
  end
306
338
  end
307
339
  end
@@ -10,7 +10,7 @@
10
10
  <%= header.with_breadcrumbs(breadcrumb_items) %>
11
11
  <% if with_actions %>
12
12
  <% header.with_action_icon_button(icon: 'pencil', mobile_icon: 'pencil', label: 'Edit') %>
13
- <% header.with_action_menu(menu_arguments: { anchor_align: :end }, button_arguments: { icon: "op-kebab-vertical", "aria-label": "Menu" }) do |menu, button| %>
13
+ <% header.with_action_menu(menu_arguments: { anchor_align: :end }, button_arguments: { icon: "kebab-horizontal", "aria-label": "Menu" }) do |menu, button| %>
14
14
  <% menu.with_item(label: "Subitem 1") do |item| %>
15
15
  <% item.with_leading_visual_icon(icon: :unlock) %>
16
16
  <% end %>
@@ -3,7 +3,7 @@
3
3
 
4
4
  <% component.with_action_component do %>
5
5
  <%= render Primer::Alpha::ActionMenu.new(menu_id: "menu-1") do |menu|
6
- menu.with_show_button(icon: :"op-kebab-vertical", "aria-label": "Menu")
6
+ menu.with_show_button(icon: :"kebab-horizontal", "aria-label": "Menu")
7
7
  menu.with_item(label: "Subitem 1") do |item|
8
8
  item.with_leading_visual_icon(icon: :paste)
9
9
  end
@@ -1070,6 +1070,12 @@
1070
1070
  "default": "`:medium`",
1071
1071
  "description": "One of `:large` or `:medium`."
1072
1072
  },
1073
+ {
1074
+ "name": "close_label",
1075
+ "type": "String",
1076
+ "default": "`Close`",
1077
+ "description": "The aria-label text of the close \"x\" button."
1078
+ },
1073
1079
  {
1074
1080
  "name": "system_arguments",
1075
1081
  "type": "Hash",
@@ -1374,9 +1380,15 @@
1374
1380
  {
1375
1381
  "name": "loading",
1376
1382
  "type": "Symbol",
1377
- "default": "`:eager`",
1383
+ "default": "`nil`",
1378
1384
  "description": "One of `:eager` or `:lazy`."
1379
1385
  },
1386
+ {
1387
+ "name": "accept",
1388
+ "type": "String",
1389
+ "default": "`nil`",
1390
+ "description": "What to send as the Accept header."
1391
+ },
1380
1392
  {
1381
1393
  "name": "system_arguments",
1382
1394
  "type": "Hash",
@@ -323,6 +323,7 @@
323
323
  "GeneratedSlotMethods": "Primer::Alpha::Dialog::Footer::GeneratedSlotMethods"
324
324
  },
325
325
  "Primer::Alpha::Dialog::Header": {
326
+ "DEFAULT_CLOSE_LABEL": "Close",
326
327
  "DEFAULT_VARIANT": "medium",
327
328
  "GeneratedSlotMethods": "Primer::Alpha::Dialog::Header::GeneratedSlotMethods",
328
329
  "VARIANT_MAPPINGS": {
@@ -392,6 +393,11 @@
392
393
  "GeneratedSlotMethods": "Primer::Alpha::Image::GeneratedSlotMethods"
393
394
  },
394
395
  "Primer::Alpha::IncludeFragment": {
396
+ "ALLOWED_LOADING_VALUES": [
397
+ "lazy",
398
+ "eager"
399
+ ],
400
+ "DEFAULT_LOADING": "eager",
395
401
  "GeneratedSlotMethods": "Primer::Alpha::IncludeFragment::GeneratedSlotMethods"
396
402
  },
397
403
  "Primer::Alpha::Layout": {
@@ -3646,6 +3646,32 @@
3646
3646
  "color-contrast"
3647
3647
  ]
3648
3648
  }
3649
+ },
3650
+ {
3651
+ "preview_path": "primer/alpha/dialog/with_header_close_button_label",
3652
+ "name": "with_header_close_button_label",
3653
+ "snapshot": "false",
3654
+ "skip_rules": {
3655
+ "wont_fix": [
3656
+ "region"
3657
+ ],
3658
+ "will_fix": [
3659
+ "color-contrast"
3660
+ ]
3661
+ }
3662
+ },
3663
+ {
3664
+ "preview_path": "primer/alpha/dialog/without_header_close_button_label",
3665
+ "name": "without_header_close_button_label",
3666
+ "snapshot": "false",
3667
+ "skip_rules": {
3668
+ "wont_fix": [
3669
+ "region"
3670
+ ],
3671
+ "will_fix": [
3672
+ "color-contrast"
3673
+ ]
3674
+ }
3649
3675
  }
3650
3676
  ],
3651
3677
  "subcomponents": [
@@ -3699,6 +3725,12 @@
3699
3725
  "default": "`:medium`",
3700
3726
  "description": "One of `:large` or `:medium`."
3701
3727
  },
3728
+ {
3729
+ "name": "close_label",
3730
+ "type": "String",
3731
+ "default": "`Close`",
3732
+ "description": "The aria-label text of the close \"x\" button."
3733
+ },
3702
3734
  {
3703
3735
  "name": "system_arguments",
3704
3736
  "type": "Hash",
@@ -4702,9 +4734,15 @@
4702
4734
  {
4703
4735
  "name": "loading",
4704
4736
  "type": "Symbol",
4705
- "default": "`:eager`",
4737
+ "default": "`nil`",
4706
4738
  "description": "One of `:eager` or `:lazy`."
4707
4739
  },
4740
+ {
4741
+ "name": "accept",
4742
+ "type": "String",
4743
+ "default": "`nil`",
4744
+ "description": "What to send as the Accept header."
4745
+ },
4708
4746
  {
4709
4747
  "name": "system_arguments",
4710
4748
  "type": "Hash",
data/static/previews.json CHANGED
@@ -3717,6 +3717,32 @@
3717
3717
  "color-contrast"
3718
3718
  ]
3719
3719
  }
3720
+ },
3721
+ {
3722
+ "preview_path": "primer/alpha/dialog/with_header_close_button_label",
3723
+ "name": "with_header_close_button_label",
3724
+ "snapshot": "false",
3725
+ "skip_rules": {
3726
+ "wont_fix": [
3727
+ "region"
3728
+ ],
3729
+ "will_fix": [
3730
+ "color-contrast"
3731
+ ]
3732
+ }
3733
+ },
3734
+ {
3735
+ "preview_path": "primer/alpha/dialog/without_header_close_button_label",
3736
+ "name": "without_header_close_button_label",
3737
+ "snapshot": "false",
3738
+ "skip_rules": {
3739
+ "wont_fix": [
3740
+ "region"
3741
+ ],
3742
+ "will_fix": [
3743
+ "color-contrast"
3744
+ ]
3745
+ }
3720
3746
  }
3721
3747
  ]
3722
3748
  },
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.63.0
4
+ version: 0.64.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: 2025-04-17 00:00:00.000000000 Z
12
+ date: 2025-04-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: 19.23.0
48
+ version: 19.25.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 19.23.0
55
+ version: 19.25.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: view_component
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -653,6 +653,7 @@ files:
653
653
  - app/lib/primer/css/layout.css.json
654
654
  - app/lib/primer/css/utilities.css
655
655
  - app/lib/primer/css/utilities.css.json
656
+ - app/lib/primer/current_attributes.rb
656
657
  - app/lib/primer/experimental_render_helpers.rb
657
658
  - app/lib/primer/experimental_slot_helpers.rb
658
659
  - app/lib/primer/fetch_or_fallback_helper.rb
@@ -890,8 +891,10 @@ files:
890
891
  - previews/primer/alpha/dialog_preview/with_footer.html.erb
891
892
  - previews/primer/alpha/dialog_preview/with_form.html.erb
892
893
  - previews/primer/alpha/dialog_preview/with_header.html.erb
894
+ - previews/primer/alpha/dialog_preview/with_header_close_button_label.html.erb
893
895
  - previews/primer/alpha/dialog_preview/with_header_filter.html.erb
894
896
  - previews/primer/alpha/dialog_preview/with_text_input.html.erb
897
+ - previews/primer/alpha/dialog_preview/without_header_close_button_label.html.erb
895
898
  - previews/primer/alpha/dropdown_preview.rb
896
899
  - previews/primer/alpha/form_control_preview.rb
897
900
  - previews/primer/alpha/form_control_preview/playground.html.erb