openproject-primer_view_components 0.52.2 → 0.52.4

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.
@@ -9,8 +9,8 @@
9
9
  <% if trailing_visual %>
10
10
  <span class="Button-visual Button-trailingVisual">
11
11
  <% if @trailing_visual_counter %>
12
+ <span class="d-flex" aria-hidden="true"><%= trailing_visual %></span>
12
13
  <span class="sr-only">(<%= trailing_visual %>)</span>
13
- <%= trailing_visual %>
14
14
  <% else %>
15
15
  <%= trailing_visual %>
16
16
  <% end %>
@@ -70,7 +70,7 @@ module Primer
70
70
  label: Primer::Beta::Label,
71
71
  counter: lambda { |**system_arguments|
72
72
  @trailing_visual_counter = true
73
- Primer::Beta::Counter.new("aria-hidden": true, **system_arguments)
73
+ Primer::Beta::Counter.new(**system_arguments)
74
74
  }
75
75
  }
76
76
 
@@ -108,6 +108,7 @@ module Primer
108
108
  # @param align_content [Symbol] <%= one_of(Primer::Beta::Button::ALIGN_CONTENT_OPTIONS) %>
109
109
  # @param tag [Symbol] (Primer::Beta::BaseButton::DEFAULT_TAG) <%= one_of(Primer::Beta::BaseButton::TAG_OPTIONS) %>
110
110
  # @param type [Symbol] (Primer::Beta::BaseButton::DEFAULT_TYPE) <%= one_of(Primer::Beta::BaseButton::TYPE_OPTIONS) %>
111
+ # @param inactive [Boolean] Whether the button looks visually disabled, but can still accept all the same interactions as an enabled button.
111
112
  # @param disabled [Boolean] Whether or not the button is disabled. If true, this option forces `tag:` to `:button`.
112
113
  # @param label_wrap [Boolean] Whether or not the button label text wraps and the button height expands.
113
114
  # @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
@@ -11,8 +11,8 @@
11
11
  <% end %>
12
12
  </scrollable-region>
13
13
  <%= render(Primer::Alpha::Dialog::Footer.new(show_divider: false)) do %>
14
- <%= render(Primer::Beta::Button.new(data: { "close-dialog-id": dialog_id })) { I18n.t("button_cancel") } %>
15
- <%= render(Primer::Beta::Button.new(type: (@form_wrapper.shows_form? ? :submit : :button), scheme: :danger, data: { "submit-dialog-id": dialog_id })) { I18n.t("button_delete_permanently") } %>
14
+ <%= render(Primer::Beta::Button.new(data: { "close-dialog-id": dialog_id })) { @cancel_button_text } %>
15
+ <%= render(Primer::Beta::Button.new(type: (@form_wrapper.shows_form? ? :submit : :button), scheme: :danger, data: { "submit-dialog-id": dialog_id })) { @confirm_button_text } %>
16
16
  <% end %>
17
17
  <% end %>
18
18
  </danger-confirmation-dialog-form-helper>
@@ -67,12 +67,17 @@ module Primer
67
67
  def initialize(
68
68
  form_arguments: {},
69
69
  id: self.class.generate_id,
70
+ confirm_button_text: I18n.t("button_delete_permanently"),
71
+ cancel_button_text: I18n.t("button_cancel"),
70
72
  **system_arguments
71
73
  )
72
74
  @check_box_name = form_arguments.delete(:name) || "confirm_dangerous_action"
73
75
  @form_wrapper = FormWrapper.new(**form_arguments)
74
76
  @dialog_id = id.to_s
75
77
 
78
+ @confirm_button_text = confirm_button_text
79
+ @cancel_button_text = cancel_button_text
80
+
76
81
  @system_arguments = system_arguments
77
82
  @system_arguments[:id] = @dialog_id
78
83
  @system_arguments[:classes] = class_names(
@@ -6,7 +6,7 @@ module Primer
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 52
9
- PATCH = 2
9
+ PATCH = 4
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -65,7 +65,7 @@ module Primer
65
65
 
66
66
  # @label Tooltip with Primer::Beta::Link
67
67
  def tooltip_with_link(direction: :s, tooltip_text: "You can press a button")
68
- render(Primer::Beta::Link.new(href: "#link-with-tooltip", id: "link-with-tooltip")) do |component|
68
+ render(Primer::Beta::Link.new(href: "#link-with-tooltip", id: "link-with-tooltip", underline: true)) do |component|
69
69
  component.with_tooltip(text: tooltip_text, direction: direction)
70
70
  "Button"
71
71
  end
@@ -1,4 +1,6 @@
1
- <%= render(Primer::OpenProject::DangerConfirmationDialog.new(id: "my-dialog")) do |dialog| %>
1
+ <%= render(Primer::OpenProject::DangerConfirmationDialog.new(id: "my-dialog",
2
+ confirm_button_text: confirm_button_text,
3
+ cancel_button_text: cancel_button_text)) do |dialog| %>
2
4
  <% dialog.with_show_button { "Click me" } %>
3
5
  <% dialog.with_confirmation_message(icon_arguments: { icon: icon, color: icon_color }) do |message| %>
4
6
  <% message.with_heading(tag: :h2).with_content("Proceed with danger?") %>
@@ -1,6 +1,6 @@
1
1
  <%= render(Primer::OpenProject::DangerConfirmationDialog.new(
2
2
  title: "Delete dialog",
3
- form_arguments: { action: generic_form_submission_path(format: route_format) }
3
+ form_arguments: { action: "" } # Use the correct form action here.
4
4
  )) do |dialog| %>
5
5
  <% dialog.with_show_button { "Click me" } %>
6
6
  <% dialog.with_confirmation_message do |message|
@@ -1,4 +1,5 @@
1
- <%= form_with(url: generic_form_submission_path(format: route_format)) do |f| %>
1
+ <!-- Use the correct form URL here. -->
2
+ <%= form_with(url: "") do |f| %>
2
3
  <%= render(Primer::OpenProject::DangerConfirmationDialog.new(
3
4
  title: "Delete dialog",
4
5
  form_arguments: { builder: f, name: "confirm_very_dangerous_action" }
@@ -0,0 +1,13 @@
1
+ <%= form_with(url: generic_form_submission_path(route_format)) do |f| %>
2
+ <%= render(Primer::OpenProject::DangerConfirmationDialog.new(
3
+ title: "Delete dialog",
4
+ form_arguments: { builder: f, name: "confirm_very_dangerous_action" }
5
+ )) do |dialog| %>
6
+ <% dialog.with_show_button { "Click me" } %>
7
+ <% dialog.with_confirmation_message do |message|
8
+ message.with_heading(tag: :h2).with_content("Permanently delete?")
9
+ message.with_description_content("This action is not reversible. Please proceed with caution.")
10
+ end %>
11
+ <% dialog.with_confirmation_check_box_content("I understand that this deletion cannot be reversed") %>
12
+ <% end %>
13
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <%= render(Primer::OpenProject::DangerConfirmationDialog.new(
2
+ title: "Delete dialog",
3
+ form_arguments: { action: generic_form_submission_path(route_format) }
4
+ )) do |dialog| %>
5
+ <% dialog.with_show_button { "Click me" } %>
6
+ <% dialog.with_confirmation_message do |message|
7
+ message.with_heading(tag: :h2).with_content("Permanently delete?")
8
+ message.with_description_content("This action is not reversible. Please proceed with caution.")
9
+ end %>
10
+ <% dialog.with_confirmation_check_box_content("I understand that this deletion cannot be reversed") %>
11
+ <% end %>
@@ -25,18 +25,24 @@ module Primer
25
25
  # @param icon_color [Symbol] select [default, muted, subtle, accent, success, attention, severe, danger, open, closed, done, sponsors, on_emphasis, inherit]
26
26
  # @param show_description toggle
27
27
  # @param show_additional_details toggle
28
+ # @param confirm_button_text [String]
29
+ # @param cancel_button_text [String]
28
30
  # @param check_box_text [String]
29
31
  def playground(
30
32
  icon: :"alert",
31
33
  icon_color: :danger,
32
34
  show_description: true,
33
35
  show_additional_details: false,
36
+ confirm_button_text: "Understood",
37
+ cancel_button_text: "NO!",
34
38
  check_box_text: "I understand that this deletion cannot be reversed"
35
39
  )
36
40
  render_with_template(locals: { icon: icon,
37
41
  icon_color: icon_color,
38
42
  show_description: show_description,
39
43
  show_additional_details: show_additional_details,
44
+ confirm_button_text: confirm_button_text,
45
+ cancel_button_text: cancel_button_text,
40
46
  check_box_text: check_box_text })
41
47
  end
42
48
 
@@ -66,6 +72,18 @@ module Primer
66
72
  dialog.with_confirmation_check_box_content("I understand that this deletion cannot be reversed")
67
73
  end
68
74
  end
75
+
76
+ # @label With form using FormBuilder for testing puposes
77
+ # @hidden
78
+ def with_form_builder_form_test(route_format: :html)
79
+ render_with_template(locals: { route_format: route_format })
80
+ end
81
+
82
+ # @label With form for testing purposes
83
+ # @hidden
84
+ def with_form_test(route_format: :html)
85
+ render_with_template(locals: { route_format: route_format })
86
+ end
69
87
  end
70
88
  end
71
89
  end
@@ -3646,6 +3646,12 @@
3646
3646
  "default": "`:button`",
3647
3647
  "description": "One of `:button`, `:reset`, or `:submit`."
3648
3648
  },
3649
+ {
3650
+ "name": "inactive",
3651
+ "type": "Boolean",
3652
+ "default": "N/A",
3653
+ "description": "Whether the button looks visually disabled, but can still accept all the same interactions as an enabled button."
3654
+ },
3649
3655
  {
3650
3656
  "name": "disabled",
3651
3657
  "type": "Boolean",
@@ -12186,6 +12186,12 @@
12186
12186
  "default": "`:button`",
12187
12187
  "description": "One of `:button`, `:reset`, or `:submit`."
12188
12188
  },
12189
+ {
12190
+ "name": "inactive",
12191
+ "type": "Boolean",
12192
+ "default": "N/A",
12193
+ "description": "Whether the button looks visually disabled, but can still accept all the same interactions as an enabled button."
12194
+ },
12189
12195
  {
12190
12196
  "name": "disabled",
12191
12197
  "type": "Boolean",
@@ -17667,6 +17673,32 @@
17667
17673
  "color-contrast"
17668
17674
  ]
17669
17675
  }
17676
+ },
17677
+ {
17678
+ "preview_path": "primer/open_project/danger_confirmation_dialog/with_form_builder_form_test",
17679
+ "name": "with_form_builder_form_test",
17680
+ "snapshot": "false",
17681
+ "skip_rules": {
17682
+ "wont_fix": [
17683
+ "region"
17684
+ ],
17685
+ "will_fix": [
17686
+ "color-contrast"
17687
+ ]
17688
+ }
17689
+ },
17690
+ {
17691
+ "preview_path": "primer/open_project/danger_confirmation_dialog/with_form_test",
17692
+ "name": "with_form_test",
17693
+ "snapshot": "false",
17694
+ "skip_rules": {
17695
+ "wont_fix": [
17696
+ "region"
17697
+ ],
17698
+ "will_fix": [
17699
+ "color-contrast"
17700
+ ]
17701
+ }
17670
17702
  }
17671
17703
  ],
17672
17704
  "subcomponents": [
data/static/previews.json CHANGED
@@ -3191,6 +3191,32 @@
3191
3191
  "color-contrast"
3192
3192
  ]
3193
3193
  }
3194
+ },
3195
+ {
3196
+ "preview_path": "primer/open_project/danger_confirmation_dialog/with_form_builder_form_test",
3197
+ "name": "with_form_builder_form_test",
3198
+ "snapshot": "false",
3199
+ "skip_rules": {
3200
+ "wont_fix": [
3201
+ "region"
3202
+ ],
3203
+ "will_fix": [
3204
+ "color-contrast"
3205
+ ]
3206
+ }
3207
+ },
3208
+ {
3209
+ "preview_path": "primer/open_project/danger_confirmation_dialog/with_form_test",
3210
+ "name": "with_form_test",
3211
+ "snapshot": "false",
3212
+ "skip_rules": {
3213
+ "wont_fix": [
3214
+ "region"
3215
+ ],
3216
+ "will_fix": [
3217
+ "color-contrast"
3218
+ ]
3219
+ }
3194
3220
  }
3195
3221
  ]
3196
3222
  },
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.52.2
4
+ version: 0.52.4
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-01-17 00:00:00.000000000 Z
12
+ date: 2025-01-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -1032,6 +1032,8 @@ files:
1032
1032
  - previews/primer/open_project/danger_confirmation_dialog_preview/with_additional_details.html.erb
1033
1033
  - previews/primer/open_project/danger_confirmation_dialog_preview/with_form.html.erb
1034
1034
  - previews/primer/open_project/danger_confirmation_dialog_preview/with_form_builder_form.html.erb
1035
+ - previews/primer/open_project/danger_confirmation_dialog_preview/with_form_builder_form_test.html.erb
1036
+ - previews/primer/open_project/danger_confirmation_dialog_preview/with_form_test.html.erb
1035
1037
  - previews/primer/open_project/drag_handle_preview.rb
1036
1038
  - previews/primer/open_project/feedback_dialog_preview.rb
1037
1039
  - previews/primer/open_project/feedback_dialog_preview/playground.html.erb