openproject-primer_view_components 0.50.1 → 0.52.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 +4 -4
- data/CHANGELOG.md +23 -0
- data/app/assets/javascripts/components/primer/alpha/action_menu/action_menu_element.d.ts +2 -0
- data/app/assets/javascripts/components/primer/open_project/danger_confirmation_dialog_form_helper.d.ts +13 -0
- data/app/assets/javascripts/components/primer/primer.d.ts +2 -0
- data/app/assets/javascripts/components/primer/utils.d.ts +1 -0
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/assets/styles/primer_view_components.css +1 -1
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/alpha/action_list/item.html.erb +1 -4
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.json +2 -6
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/action_list.pcss +10 -43
- data/app/components/primer/alpha/action_menu/action_menu_element.d.ts +2 -0
- data/app/components/primer/alpha/action_menu/action_menu_element.js +31 -1
- data/app/components/primer/alpha/action_menu/action_menu_element.ts +37 -0
- data/app/components/primer/alpha/action_menu.rb +6 -0
- data/app/components/primer/alpha/select_panel_element.js +6 -19
- data/app/components/primer/alpha/select_panel_element.ts +9 -21
- data/app/components/primer/alpha/text_field.css +1 -1
- data/app/components/primer/alpha/text_field.css.json +30 -30
- data/app/components/primer/alpha/text_field.css.map +1 -1
- data/app/components/primer/alpha/text_field.pcss +2 -3
- data/app/components/primer/open_project/danger_confirmation_dialog/confirmation_check_box.rb +44 -0
- data/app/components/primer/open_project/danger_confirmation_dialog/form_wrapper.html.erb +7 -0
- data/app/components/primer/open_project/danger_confirmation_dialog/form_wrapper.rb +26 -0
- data/app/components/primer/open_project/danger_confirmation_dialog.html.erb +19 -0
- data/app/components/primer/open_project/danger_confirmation_dialog.rb +104 -0
- data/app/components/primer/open_project/danger_confirmation_dialog_form_helper.d.ts +13 -0
- data/app/components/primer/open_project/danger_confirmation_dialog_form_helper.js +44 -0
- data/app/components/primer/open_project/danger_confirmation_dialog_form_helper.ts +36 -0
- data/app/components/primer/open_project/feedback_dialog.html.erb +2 -2
- data/app/components/primer/open_project/feedback_dialog.rb +3 -3
- data/app/components/primer/primer.d.ts +2 -0
- data/app/components/primer/primer.js +2 -0
- data/app/components/primer/primer.ts +2 -0
- data/app/components/primer/utils.d.ts +1 -0
- data/app/components/primer/utils.js +16 -0
- data/app/components/primer/utils.ts +16 -0
- data/app/lib/primer/forms/acts_as_component.rb +9 -2
- data/app/lib/primer/forms/base.rb +0 -5
- data/app/lib/primer/forms/base_component.rb +5 -3
- data/app/lib/primer/forms/radio_button_group.html.erb +1 -1
- data/app/lib/primer/forms/utils.rb +16 -1
- data/lib/primer/view_components/version.rb +2 -2
- data/previews/primer/alpha/action_menu_preview/in_scroll_container.html.erb +3 -5
- data/previews/primer/open_project/danger_confirmation_dialog_preview/playground.html.erb +13 -0
- data/previews/primer/open_project/danger_confirmation_dialog_preview/with_additional_details.html.erb +40 -0
- data/previews/primer/open_project/danger_confirmation_dialog_preview/with_form.html.erb +11 -0
- data/previews/primer/open_project/danger_confirmation_dialog_preview/with_form_builder_form.html.erb +13 -0
- data/previews/primer/open_project/danger_confirmation_dialog_preview.rb +71 -0
- data/previews/primer/open_project/feedback_dialog_preview/playground.html.erb +3 -3
- data/previews/primer/open_project/feedback_dialog_preview/{additional_content.html.erb → with_additional_details.html.erb} +1 -1
- data/previews/primer/open_project/feedback_dialog_preview.rb +6 -6
- data/static/classes.json +6 -0
- data/static/info_arch.json +6 -6
- data/static/previews.json +4 -4
- metadata +30 -12
- /data/previews/primer/open_project/feedback_dialog_preview/{custom_footer.html.erb → with_custom_footer.html.erb} +0 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
import {controller, target} from '@github/catalyst'
|
2
|
+
|
3
|
+
const SUBMIT_BUTTON_SELECTOR = 'input[type=submit],button[type=submit],button[data-submit-dialog-id]'
|
4
|
+
|
5
|
+
@controller
|
6
|
+
class DangerConfirmationDialogFormHelperElement extends HTMLElement {
|
7
|
+
@target checkbox: HTMLInputElement
|
8
|
+
|
9
|
+
get submitButton() {
|
10
|
+
return this.querySelector<HTMLInputElement | HTMLButtonElement>(SUBMIT_BUTTON_SELECTOR)!
|
11
|
+
}
|
12
|
+
|
13
|
+
connectedCallback() {
|
14
|
+
this.#reset()
|
15
|
+
}
|
16
|
+
|
17
|
+
toggle(): void {
|
18
|
+
this.submitButton.disabled = !this.checkbox.checked
|
19
|
+
}
|
20
|
+
|
21
|
+
#reset(): void {
|
22
|
+
this.checkbox.checked = false
|
23
|
+
this.toggle()
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
declare global {
|
28
|
+
interface Window {
|
29
|
+
DangerConfirmationDialogFormHelperElement: typeof DangerConfirmationDialogFormHelperElement
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
if (!window.customElements.get('danger-confirmation-dialog-form-helper')) {
|
34
|
+
window.DangerConfirmationDialogFormHelperElement = DangerConfirmationDialogFormHelperElement
|
35
|
+
window.customElements.define('danger-confirmation-dialog-form-helper', DangerConfirmationDialogFormHelperElement)
|
36
|
+
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%= render @dialog do |dialog| %>
|
2
2
|
<% dialog.with_body do %>
|
3
3
|
<%= feedback_message %>
|
4
|
-
<% if
|
5
|
-
<%=
|
4
|
+
<% if additional_details.present? %>
|
5
|
+
<%= additional_details %>
|
6
6
|
<% end %>
|
7
7
|
<% end %>
|
8
8
|
<% dialog.with_footer do %>
|
@@ -17,15 +17,15 @@ module Primer
|
|
17
17
|
Primer::OpenProject::FeedbackMessage.new(icon_arguments: icon_arguments, **system_arguments)
|
18
18
|
}
|
19
19
|
|
20
|
-
# Optional
|
20
|
+
# Optional additional_details like a form input or toast.
|
21
21
|
#
|
22
22
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
23
|
-
renders_one :
|
23
|
+
renders_one :additional_details, lambda { |**system_arguments|
|
24
24
|
deny_tag_argument(**system_arguments)
|
25
25
|
system_arguments[:tag] = :div
|
26
26
|
system_arguments[:classes] = class_names(
|
27
27
|
system_arguments[:classes],
|
28
|
-
"FeedbackDialog-
|
28
|
+
"FeedbackDialog-additionalDetails"
|
29
29
|
)
|
30
30
|
|
31
31
|
system_arguments[:display] ||= :flex
|
@@ -8,6 +8,7 @@ import './dialog_helper';
|
|
8
8
|
import './focus_group';
|
9
9
|
import './scrollable_region';
|
10
10
|
import './shared_events';
|
11
|
+
import './utils';
|
11
12
|
import './alpha/modal_dialog';
|
12
13
|
import './beta/nav_list';
|
13
14
|
import './beta/nav_list_group_element';
|
@@ -27,3 +28,4 @@ import './alpha/select_panel_element';
|
|
27
28
|
import './open_project/page_header_element';
|
28
29
|
import './open_project/zen_mode_button';
|
29
30
|
import './open_project/sub_header_element';
|
31
|
+
import './open_project/danger_confirmation_dialog_form_helper';
|
@@ -8,6 +8,7 @@ import './dialog_helper';
|
|
8
8
|
import './focus_group';
|
9
9
|
import './scrollable_region';
|
10
10
|
import './shared_events';
|
11
|
+
import './utils';
|
11
12
|
import './alpha/modal_dialog';
|
12
13
|
import './beta/nav_list';
|
13
14
|
import './beta/nav_list_group_element';
|
@@ -27,3 +28,4 @@ import './alpha/select_panel_element';
|
|
27
28
|
import './open_project/page_header_element';
|
28
29
|
import './open_project/zen_mode_button';
|
29
30
|
import './open_project/sub_header_element';
|
31
|
+
import './open_project/danger_confirmation_dialog_form_helper';
|
@@ -8,6 +8,7 @@ import './dialog_helper'
|
|
8
8
|
import './focus_group'
|
9
9
|
import './scrollable_region'
|
10
10
|
import './shared_events'
|
11
|
+
import './utils'
|
11
12
|
import './alpha/modal_dialog'
|
12
13
|
import './beta/nav_list'
|
13
14
|
import './beta/nav_list_group_element'
|
@@ -27,3 +28,4 @@ import './alpha/select_panel_element'
|
|
27
28
|
import './open_project/page_header_element'
|
28
29
|
import './open_project/zen_mode_button'
|
29
30
|
import './open_project/sub_header_element'
|
31
|
+
import './open_project/danger_confirmation_dialog_form_helper'
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const observeMutationsUntilConditionMet: (element: Element, condition: () => boolean, body: () => void) => void;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// Waits for condition to return true. If it returns false initially, this function creates a
|
2
|
+
// MutationObserver that calls body() whenever the contents of the component change.
|
3
|
+
export const observeMutationsUntilConditionMet = (element, condition, body) => {
|
4
|
+
if (condition()) {
|
5
|
+
body();
|
6
|
+
}
|
7
|
+
else {
|
8
|
+
const mutationObserver = new MutationObserver(() => {
|
9
|
+
if (condition()) {
|
10
|
+
body();
|
11
|
+
mutationObserver.disconnect();
|
12
|
+
}
|
13
|
+
});
|
14
|
+
mutationObserver.observe(element, { childList: true, subtree: true });
|
15
|
+
}
|
16
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// Waits for condition to return true. If it returns false initially, this function creates a
|
2
|
+
// MutationObserver that calls body() whenever the contents of the component change.
|
3
|
+
export const observeMutationsUntilConditionMet = (element: Element, condition: () => boolean, body: () => void) => {
|
4
|
+
if (condition()) {
|
5
|
+
body()
|
6
|
+
} else {
|
7
|
+
const mutationObserver = new MutationObserver(() => {
|
8
|
+
if (condition()) {
|
9
|
+
body()
|
10
|
+
mutationObserver.disconnect()
|
11
|
+
}
|
12
|
+
})
|
13
|
+
|
14
|
+
mutationObserver.observe(element, {childList: true, subtree: true})
|
15
|
+
}
|
16
|
+
}
|
@@ -50,8 +50,6 @@ module Primer
|
|
50
50
|
TemplateGlob = Struct.new(:glob_pattern, :method_name, :on_compile_callback)
|
51
51
|
TemplateParams = Struct.new(:source, :identifier, :type, :format, keyword_init: true)
|
52
52
|
|
53
|
-
attr_accessor :template_root_path
|
54
|
-
|
55
53
|
def renders_templates(glob_pattern, method_name = nil, &block)
|
56
54
|
template_globs << TemplateGlob.new(glob_pattern, method_name, block)
|
57
55
|
end
|
@@ -70,6 +68,15 @@ module Primer
|
|
70
68
|
|
71
69
|
private
|
72
70
|
|
71
|
+
def template_root_path
|
72
|
+
return @template_root_path if defined?(@template_root_path)
|
73
|
+
|
74
|
+
form_path = Utils.const_source_location(self.name)
|
75
|
+
@template_root_path = if form_path
|
76
|
+
File.join(File.dirname(form_path), self.name.demodulize.underscore)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
73
80
|
def template_globs
|
74
81
|
@template_globs ||= []
|
75
82
|
end
|
@@ -29,11 +29,6 @@ module Primer
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def inherited(base)
|
32
|
-
form_path = Utils.const_source_location(base.name)
|
33
|
-
return unless form_path
|
34
|
-
|
35
|
-
base.template_root_path = File.join(File.dirname(form_path), base.name.demodulize.underscore)
|
36
|
-
|
37
32
|
base.renders_template "after_content.html.erb" do
|
38
33
|
base.instance_variable_set(:@has_after_content, true)
|
39
34
|
end
|
@@ -7,8 +7,8 @@ module Primer
|
|
7
7
|
include Primer::ClassNameHelper
|
8
8
|
extend ActsAsComponent
|
9
9
|
|
10
|
-
def self.
|
11
|
-
base_path = Utils.const_source_location(
|
10
|
+
def self.compile!
|
11
|
+
base_path = Utils.const_source_location(self.name)
|
12
12
|
|
13
13
|
unless base_path
|
14
14
|
warn "Could not identify the template for #{base}"
|
@@ -16,7 +16,9 @@ module Primer
|
|
16
16
|
end
|
17
17
|
|
18
18
|
dir = File.dirname(base_path)
|
19
|
-
|
19
|
+
renders_template File.join(dir, "#{self.name.demodulize.underscore}.html.erb"), :render_template
|
20
|
+
|
21
|
+
super
|
20
22
|
end
|
21
23
|
|
22
24
|
delegate :required?, :disabled?, :hidden?, to: :@input
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="FormControl-radio-group-wrap">
|
2
|
-
<%= content_tag(:fieldset, **@input.input_arguments) do %>
|
2
|
+
<%= content_tag(:fieldset, role: 'radiogroup', **@input.input_arguments) do %>
|
3
3
|
<% if @input.label %>
|
4
4
|
<%= content_tag(:legend, **@input.label_arguments) do %>
|
5
5
|
<%= @input.label %>
|
@@ -14,13 +14,28 @@ module Primer
|
|
14
14
|
# for the file in the configured autoload paths. Doing so relies on Rails' autoloading
|
15
15
|
# conventions, so it should work ok. Zeitwerk also has this information but lacks a
|
16
16
|
# public API to map constants to source files.
|
17
|
+
#
|
18
|
+
# Now that the Ruby bug above has been fixed and released, this method should be used only
|
19
|
+
# as a fallback for older Rubies.
|
17
20
|
def const_source_location(class_name)
|
18
21
|
return nil unless class_name
|
19
22
|
|
23
|
+
if (location = Object.const_source_location(class_name)&.[](0))
|
24
|
+
return location
|
25
|
+
end
|
26
|
+
|
20
27
|
# NOTE: underscore respects namespacing, i.e. will convert Foo::Bar to foo/bar.
|
21
28
|
class_path = "#{class_name.underscore}.rb"
|
22
29
|
|
23
|
-
ActiveSupport::Dependencies
|
30
|
+
# Prefer Zeitwerk-managed paths, falling back to ActiveSupport::Dependencies if Zeitwerk
|
31
|
+
# is disabled or not in use (i.e. the case for older Rails versions).
|
32
|
+
autoload_paths = if Rails.respond_to?(:autoloaders) && Rails.autoloaders.zeitwerk_enabled?
|
33
|
+
Rails.autoloaders.main.dirs
|
34
|
+
else
|
35
|
+
ActiveSupport::Dependencies.autoload_paths
|
36
|
+
end
|
37
|
+
|
38
|
+
autoload_paths.each do |autoload_path|
|
24
39
|
absolute_path = File.join(autoload_path, class_path)
|
25
40
|
return absolute_path if File.exist?(absolute_path)
|
26
41
|
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
<div style="height:
|
2
|
-
|
3
|
-
<div style="position: relative">
|
1
|
+
<div style="height: 1000px; overflow: auto">
|
2
|
+
<div style="height: 400px"></div>
|
4
3
|
<%= render Primer::Alpha::ActionMenu.new(anchor_align: :end) do |c| %>
|
5
4
|
<% c.with_show_button { "Edit" } %>
|
6
5
|
<% c.with_item(tag: :button, type: "button", label: "Rename") %>
|
7
6
|
<% c.with_item(tag: :button, type: "button", scheme: :danger, label: "Remove") %>
|
8
7
|
<% end %>
|
8
|
+
<div style="height: 1400px"></div>
|
9
9
|
</div>
|
10
|
-
|
11
|
-
<div style="height: 1400px"></div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= render(Primer::OpenProject::DangerConfirmationDialog.new(id: "my-dialog")) do |dialog| %>
|
2
|
+
<% dialog.with_show_button { "Click me" } %>
|
3
|
+
<% dialog.with_confirmation_message(icon_arguments: { icon: icon, color: icon_color }) do |message| %>
|
4
|
+
<% message.with_heading(tag: :h2).with_content("Proceed with danger?") %>
|
5
|
+
<% message.with_description_content("This action is not reversible and may cause permanent damage.") if show_description %>
|
6
|
+
<% end %>
|
7
|
+
<% if show_additional_details %>
|
8
|
+
<% dialog.with_additional_details do %>
|
9
|
+
<%= render(Primer::Alpha::Banner.new) { "Some additional details below" } %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<% dialog.with_confirmation_check_box_content(check_box_text) %>
|
13
|
+
<% end %>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<%= render(Primer::OpenProject::DangerConfirmationDialog.new) do |dialog| %>
|
2
|
+
<% dialog.with_show_button { "Click me" } %>
|
3
|
+
<% dialog.with_confirmation_message do |message| %>
|
4
|
+
<% message.with_heading(tag: :h2).with_content("Delete 5 work packages?") %>
|
5
|
+
<% end %>
|
6
|
+
<% dialog.with_additional_details do %>
|
7
|
+
<%= render(Primer::Beta::BorderBox.new(spacious: false)) do |grid| %>
|
8
|
+
<% 5.times do %>
|
9
|
+
<% grid.with_row do %>
|
10
|
+
<%= render(Primer::OpenProject::FlexLayout.new) do |flex|
|
11
|
+
flex.with_column(mr: 2) do
|
12
|
+
render(Primer::Beta::Text.new) do
|
13
|
+
%w(EPIC FEATURE IDEA).sample
|
14
|
+
end
|
15
|
+
end
|
16
|
+
flex.with_column(mr: 2) do
|
17
|
+
work_package_id = rand(999_999)
|
18
|
+
render(Primer::Beta::Link.new(
|
19
|
+
href: "/work_packages/#{work_package_id}"),
|
20
|
+
title: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed volutpat.",
|
21
|
+
target: :_blank,
|
22
|
+
font_size: :small,
|
23
|
+
color: :muted
|
24
|
+
) { "##{work_package_id}" }
|
25
|
+
end
|
26
|
+
flex.with_column do
|
27
|
+
render(Primer::Beta::Label.new(scheme: :accent, size: :medium, inline: true)) do
|
28
|
+
["New", "Confirmed", "In specification"].sample
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end %>
|
32
|
+
<%= render(Primer::Beta::Text.new) do %>
|
33
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed volutpat.
|
34
|
+
<% end %>
|
35
|
+
<% end %>
|
36
|
+
<% end %>
|
37
|
+
<% end %>
|
38
|
+
<% end %>
|
39
|
+
<% dialog.with_confirmation_check_box_content("I understand that this deletion cannot be reversed") %>
|
40
|
+
<% end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= render(Primer::OpenProject::DangerConfirmationDialog.new(
|
2
|
+
title: "Delete dialog",
|
3
|
+
form_arguments: { action: generic_form_submission_path(format: 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 %>
|
data/previews/primer/open_project/danger_confirmation_dialog_preview/with_form_builder_form.html.erb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= form_with(url: generic_form_submission_path(format: 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,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Setup Playground to use all available component props
|
4
|
+
# Setup Features to use individual component props and combinations
|
5
|
+
|
6
|
+
module Primer
|
7
|
+
module OpenProject
|
8
|
+
# @label DangerConfirmationDialog
|
9
|
+
class DangerConfirmationDialogPreview < ViewComponent::Preview
|
10
|
+
# @label Default
|
11
|
+
# @snapshot interactive
|
12
|
+
def default
|
13
|
+
render(Primer::OpenProject::DangerConfirmationDialog.new(title: "Delete dialog")) do |dialog|
|
14
|
+
dialog.with_show_button { "Click me" }
|
15
|
+
dialog.with_confirmation_message do |message|
|
16
|
+
message.with_heading(tag: :h2) { "Permanently delete?" }
|
17
|
+
message.with_description_content("This action is not reversible. Please proceed with caution.")
|
18
|
+
end
|
19
|
+
dialog.with_confirmation_check_box_content("I understand that this deletion cannot be reversed")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# @label Playground
|
24
|
+
# @param icon [Symbol] octicon
|
25
|
+
# @param icon_color [Symbol] select [default, muted, subtle, accent, success, attention, severe, danger, open, closed, done, sponsors, on_emphasis, inherit]
|
26
|
+
# @param show_description toggle
|
27
|
+
# @param show_additional_details toggle
|
28
|
+
# @param check_box_text [String]
|
29
|
+
def playground(
|
30
|
+
icon: :"alert",
|
31
|
+
icon_color: :danger,
|
32
|
+
show_description: true,
|
33
|
+
show_additional_details: false,
|
34
|
+
check_box_text: "I understand that this deletion cannot be reversed"
|
35
|
+
)
|
36
|
+
render_with_template(locals: { icon: icon,
|
37
|
+
icon_color: icon_color,
|
38
|
+
show_description: show_description,
|
39
|
+
show_additional_details: show_additional_details,
|
40
|
+
check_box_text: check_box_text })
|
41
|
+
end
|
42
|
+
|
43
|
+
# @label With form using FormBuilder
|
44
|
+
def with_form_builder_form(route_format: :html)
|
45
|
+
render_with_template(locals: { route_format: route_format })
|
46
|
+
end
|
47
|
+
|
48
|
+
# @label With form
|
49
|
+
def with_form(route_format: :html)
|
50
|
+
render_with_template(locals: { route_format: route_format })
|
51
|
+
end
|
52
|
+
|
53
|
+
# @label With additional details
|
54
|
+
def with_additional_details
|
55
|
+
render_with_template(locals: {})
|
56
|
+
end
|
57
|
+
|
58
|
+
# @label With custom icon
|
59
|
+
def custom_icon
|
60
|
+
render(Primer::OpenProject::DangerConfirmationDialog.new(title: "Delete dialog")) do |dialog|
|
61
|
+
dialog.with_show_button { "Click me" }
|
62
|
+
dialog.with_confirmation_message(icon_arguments: { icon: :"alert-fill" }) do |message|
|
63
|
+
message.with_heading(tag: :h2) { "Permanently delete?" }
|
64
|
+
message.with_description_content("This action is not reversible and will remove all containing sub-tiems. Please proceed with caution.")
|
65
|
+
end
|
66
|
+
dialog.with_confirmation_check_box_content("I understand that this deletion cannot be reversed")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -4,9 +4,9 @@
|
|
4
4
|
<% message.with_heading(tag: :h2).with_content("Awesome!") %>
|
5
5
|
<% message.with_description { "Great! Everything worked well." } if show_description %>
|
6
6
|
<% end %>
|
7
|
-
<% if
|
8
|
-
<% dialog.
|
9
|
-
<%= render(Primer::Alpha::Banner.new) { "Some additional
|
7
|
+
<% if show_additional_details %>
|
8
|
+
<% dialog.with_additional_details(display: :inline) do %>
|
9
|
+
<%= render(Primer::Alpha::Banner.new) { "Some additional details below" } %>
|
10
10
|
<% end %>
|
11
11
|
<% end %>
|
12
12
|
<% if custom_footer %>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<% dialog.with_feedback_message do |message| %>
|
4
4
|
<% message.with_heading(tag: :h2).with_content("Action successful") %>
|
5
5
|
<% end %>
|
6
|
-
<% dialog.
|
6
|
+
<% dialog.with_additional_details do %>
|
7
7
|
<% render(Primer::Beta::Text.new) { "You can render whatever component you want here." } %>
|
8
8
|
<% end %>
|
9
9
|
<% end %>
|
@@ -24,19 +24,19 @@ module Primer
|
|
24
24
|
# @param icon_color [Symbol] select [default, muted, subtle, accent, success, attention, severe, danger, open, closed, done, sponsors, on_emphasis, inherit]
|
25
25
|
# @param loading_state [Boolean] toggle
|
26
26
|
# @param show_description toggle
|
27
|
-
# @param
|
27
|
+
# @param show_additional_details toggle
|
28
28
|
# @param custom_footer toggle
|
29
|
-
def playground(icon: :"check-circle", icon_color: :success, loading_state: false, show_description: true,
|
29
|
+
def playground(icon: :"check-circle", icon_color: :success, loading_state: false, show_description: true, show_additional_details: false, custom_footer: false)
|
30
30
|
render_with_template(locals: { icon: icon,
|
31
31
|
icon_color: icon_color,
|
32
32
|
loading_state: loading_state,
|
33
33
|
show_description: show_description,
|
34
|
-
|
34
|
+
show_additional_details: show_additional_details,
|
35
35
|
custom_footer: custom_footer })
|
36
36
|
end
|
37
37
|
|
38
|
-
# @label With additional
|
39
|
-
def
|
38
|
+
# @label With additional details
|
39
|
+
def with_additional_details
|
40
40
|
render_with_template(locals: {})
|
41
41
|
end
|
42
42
|
|
@@ -52,7 +52,7 @@ module Primer
|
|
52
52
|
end
|
53
53
|
|
54
54
|
# @label With custom footer
|
55
|
-
def
|
55
|
+
def with_custom_footer
|
56
56
|
render_with_template(locals: {})
|
57
57
|
end
|
58
58
|
|
data/static/classes.json
CHANGED
@@ -263,6 +263,9 @@
|
|
263
263
|
"FormControl-check-group-wrap": [
|
264
264
|
"Primer::Alpha::TextField"
|
265
265
|
],
|
266
|
+
"FormControl-checkbox": [
|
267
|
+
"Primer::Alpha::TextField"
|
268
|
+
],
|
266
269
|
"FormControl-checkbox-wrap": [
|
267
270
|
"Primer::Alpha::TextField"
|
268
271
|
],
|
@@ -305,6 +308,9 @@
|
|
305
308
|
"FormControl-monospace": [
|
306
309
|
"Primer::Alpha::TextField"
|
307
310
|
],
|
311
|
+
"FormControl-radio": [
|
312
|
+
"Primer::Alpha::TextField"
|
313
|
+
],
|
308
314
|
"FormControl-radio-group-wrap": [
|
309
315
|
"Primer::Alpha::TextField"
|
310
316
|
],
|
data/static/info_arch.json
CHANGED
@@ -17497,8 +17497,8 @@
|
|
17497
17497
|
]
|
17498
17498
|
},
|
17499
17499
|
{
|
17500
|
-
"name": "
|
17501
|
-
"description": "Optional
|
17500
|
+
"name": "additional_details",
|
17501
|
+
"description": "Optional additional_details like a form input or toast.",
|
17502
17502
|
"parameters": [
|
17503
17503
|
{
|
17504
17504
|
"name": "system_arguments",
|
@@ -17547,8 +17547,8 @@
|
|
17547
17547
|
}
|
17548
17548
|
},
|
17549
17549
|
{
|
17550
|
-
"preview_path": "primer/open_project/feedback_dialog/
|
17551
|
-
"name": "
|
17550
|
+
"preview_path": "primer/open_project/feedback_dialog/with_additional_details",
|
17551
|
+
"name": "with_additional_details",
|
17552
17552
|
"snapshot": "false",
|
17553
17553
|
"skip_rules": {
|
17554
17554
|
"wont_fix": [
|
@@ -17573,8 +17573,8 @@
|
|
17573
17573
|
}
|
17574
17574
|
},
|
17575
17575
|
{
|
17576
|
-
"preview_path": "primer/open_project/feedback_dialog/
|
17577
|
-
"name": "
|
17576
|
+
"preview_path": "primer/open_project/feedback_dialog/with_custom_footer",
|
17577
|
+
"name": "with_custom_footer",
|
17578
17578
|
"snapshot": "false",
|
17579
17579
|
"skip_rules": {
|
17580
17580
|
"wont_fix": [
|
data/static/previews.json
CHANGED
@@ -3680,8 +3680,8 @@
|
|
3680
3680
|
}
|
3681
3681
|
},
|
3682
3682
|
{
|
3683
|
-
"preview_path": "primer/open_project/feedback_dialog/
|
3684
|
-
"name": "
|
3683
|
+
"preview_path": "primer/open_project/feedback_dialog/with_additional_details",
|
3684
|
+
"name": "with_additional_details",
|
3685
3685
|
"snapshot": "false",
|
3686
3686
|
"skip_rules": {
|
3687
3687
|
"wont_fix": [
|
@@ -3706,8 +3706,8 @@
|
|
3706
3706
|
}
|
3707
3707
|
},
|
3708
3708
|
{
|
3709
|
-
"preview_path": "primer/open_project/feedback_dialog/
|
3710
|
-
"name": "
|
3709
|
+
"preview_path": "primer/open_project/feedback_dialog/with_custom_footer",
|
3710
|
+
"name": "with_custom_footer",
|
3711
3711
|
"snapshot": "false",
|
3712
3712
|
"skip_rules": {
|
3713
3713
|
"wont_fix": [
|