openproject-primer_view_components 0.93.0 → 0.95.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 +14 -0
- 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/open_project/collapsible_section.html.erb +7 -7
- data/app/components/primer/open_project/collapsible_section.rb +17 -2
- data/app/components/primer/open_project/color_swatch.css +1 -0
- data/app/components/primer/open_project/color_swatch.css.json +6 -0
- data/app/components/primer/open_project/color_swatch.css.map +1 -0
- data/app/components/primer/open_project/color_swatch.pcss +8 -0
- data/app/components/primer/open_project/color_swatch.rb +57 -0
- data/app/components/primer/open_project/inset_box.css +1 -0
- data/app/components/primer/open_project/inset_box.css.json +9 -0
- data/app/components/primer/open_project/inset_box.css.map +1 -0
- data/app/components/primer/open_project/inset_box.html.erb +46 -0
- data/app/components/primer/open_project/inset_box.pcss +24 -0
- data/app/components/primer/open_project/inset_box.rb +63 -0
- data/app/components/primer/primer.pcss +2 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/previews/primer/open_project/collapsible_section_preview/non_collapsible.html.erb +10 -0
- data/previews/primer/open_project/collapsible_section_preview/playground.html.erb +1 -1
- data/previews/primer/open_project/collapsible_section_preview.rb +13 -2
- data/previews/primer/open_project/color_swatch_preview.rb +27 -0
- data/previews/primer/open_project/inset_box_preview.rb +85 -0
- data/static/arguments.json +58 -2
- data/static/audited_at.json +2 -0
- data/static/classes.json +15 -0
- data/static/classnames.cjs +5 -0
- data/static/classnames.js +5 -0
- data/static/constants.json +33 -0
- data/static/info_arch.json +304 -2
- data/static/previews.json +159 -0
- data/static/statuses.json +2 -0
- metadata +15 -1
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<%= render(Primer::BaseComponent.new(**@system_arguments)) do %>
|
|
2
2
|
<%= render(Primer::OpenProject::FlexLayout.new) do |flex| %>
|
|
3
|
-
<%= flex.with_row(
|
|
4
|
-
id: @title_id,
|
|
5
|
-
data: { action: "click:collapsible-section#toggle" }) do %>
|
|
3
|
+
<%= flex.with_row(**trigger_arguments) do %>
|
|
6
4
|
<%= render(Primer::OpenProject::FlexLayout.new(display: :flex, align_items: :center)) do |header| %>
|
|
7
5
|
<%= header.with_column(id: @heading_id) do %>
|
|
8
6
|
<%= title %>
|
|
@@ -10,10 +8,12 @@
|
|
|
10
8
|
<%= header.with_column do %>
|
|
11
9
|
<%= caption %>
|
|
12
10
|
<% end %>
|
|
13
|
-
|
|
14
|
-
<%=
|
|
15
|
-
<%= render(Primer::Beta::
|
|
16
|
-
|
|
11
|
+
<% if @collapsible %>
|
|
12
|
+
<%= header.with_column do %>
|
|
13
|
+
<%= render(Primer::Beta::Button.new(**@toggle_button_arguments)) do %>
|
|
14
|
+
<%= render(Primer::Beta::Octicon.new(icon: "chevron-up", hidden: @collapsed, data: { target: "collapsible-section.arrowUp" })) %>
|
|
15
|
+
<%= render(Primer::Beta::Octicon.new(icon: "chevron-down", hidden: !@collapsed, data: { target: "collapsible-section.arrowDown" })) %>
|
|
16
|
+
<% end %>
|
|
17
17
|
<% end %>
|
|
18
18
|
<% end %>
|
|
19
19
|
<%= header.with_column(flex: 1, text_align: :right) do %>
|
|
@@ -47,14 +47,19 @@ module Primer
|
|
|
47
47
|
Primer::BaseComponent.new(tag: :div, **system_arguments)
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
COLLAPSED_OPTIONS = [false, true, :locked].freeze
|
|
51
|
+
|
|
50
52
|
# @param id [String] The unique ID of the collapsible section.
|
|
51
|
-
# @param collapsed [Boolean]
|
|
53
|
+
# @param collapsed [Boolean, Symbol] The initial state of the section. `false` renders it open and toggleable, `true` renders it collapsed and toggleable, and `:locked` keeps it permanently open with the toggle disabled.
|
|
52
54
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
|
53
55
|
def initialize(id: self.class.generate_id, collapsed: false, **system_arguments)
|
|
56
|
+
collapsed = fetch_or_fallback(COLLAPSED_OPTIONS, collapsed, false)
|
|
57
|
+
|
|
54
58
|
@title_id = "#{id}-title"
|
|
55
59
|
@content_id = "#{id}-content"
|
|
56
60
|
@heading_id = "#{id}-heading"
|
|
57
|
-
@
|
|
61
|
+
@collapsible = collapsed != :locked
|
|
62
|
+
@collapsed = collapsed == true
|
|
58
63
|
|
|
59
64
|
@system_arguments = deny_tag_argument(**system_arguments)
|
|
60
65
|
@system_arguments[:tag] = "collapsible-section"
|
|
@@ -78,6 +83,16 @@ module Primer
|
|
|
78
83
|
|
|
79
84
|
private
|
|
80
85
|
|
|
86
|
+
def trigger_arguments
|
|
87
|
+
return { id: @title_id } unless @collapsible
|
|
88
|
+
|
|
89
|
+
{
|
|
90
|
+
classes: "CollapsibleSection--triggerArea",
|
|
91
|
+
id: @title_id,
|
|
92
|
+
data: { action: "click:collapsible-section#toggle" }
|
|
93
|
+
}
|
|
94
|
+
end
|
|
95
|
+
|
|
81
96
|
def render?
|
|
82
97
|
raise ArgumentError, "Title must be present" unless title.present?
|
|
83
98
|
raise ArgumentError, "Collapsible content must be present" unless collapsible_content.present?
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ColorSwatch--indicator{border:var(--borderWidth-thin) solid var(--borderColor-default);border-radius:var(--borderRadius-small);height:var(--base-size-12);width:var(--base-size-12)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["color_swatch.pcss"],"names":[],"mappings":"AAEA,wBACE,+DAAgE,CAChE,uCAAwC,CACxC,0BAA2B,CAC3B,yBACF","file":"color_swatch.css","sourcesContent":["/* CSS for ColorSwatch */\n\n.ColorSwatch--indicator {\n border: var(--borderWidth-thin) solid var(--borderColor-default);\n border-radius: var(--borderRadius-small);\n height: var(--base-size-12);\n width: var(--base-size-12);\n}\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Primer
|
|
4
|
+
module OpenProject
|
|
5
|
+
# Displays a small colored indicator for a given hex color code, optionally
|
|
6
|
+
# showing the hex value next to it.
|
|
7
|
+
class ColorSwatch < Primer::Component
|
|
8
|
+
status :open_project
|
|
9
|
+
|
|
10
|
+
# @param hexcode [String] The hex color code to display, e.g. `#FF0000`.
|
|
11
|
+
# @param show_value [Boolean] Whether to display the hex value next to the swatch.
|
|
12
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
|
13
|
+
def initialize(hexcode:, show_value: false, **system_arguments)
|
|
14
|
+
@hexcode = hexcode
|
|
15
|
+
@show_value = show_value
|
|
16
|
+
@system_arguments = system_arguments
|
|
17
|
+
@system_arguments[:align_items] ||= :center
|
|
18
|
+
|
|
19
|
+
@system_arguments[:classes] = class_names(
|
|
20
|
+
@system_arguments[:classes],
|
|
21
|
+
"ColorSwatch"
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def call
|
|
26
|
+
render(Primer::OpenProject::FlexLayout.new(**@system_arguments)) do |flex|
|
|
27
|
+
flex.with_column do
|
|
28
|
+
render(Primer::BaseComponent.new(**swatch_arguments))
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
if show_value?
|
|
32
|
+
flex.with_column do
|
|
33
|
+
render(Primer::Beta::Text.new(tag: :span, ml: 2)) { hexcode }
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
attr_reader :hexcode
|
|
42
|
+
|
|
43
|
+
def show_value?
|
|
44
|
+
@show_value
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def swatch_arguments
|
|
48
|
+
{
|
|
49
|
+
tag: :div,
|
|
50
|
+
classes: "ColorSwatch--indicator",
|
|
51
|
+
aria: { hidden: true },
|
|
52
|
+
style: "background-color: #{hexcode}"
|
|
53
|
+
}
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.InsetBox--title-container{display:flex;align-items:center;gap:var(--base-size-8);margin-bottom:var(--base-size-8)}.InsetBox--body{display:grid;grid-template-areas:"content clip_board_copy" "actions actions";grid-template-columns:1fr auto;grid-template-rows:auto auto auto;align-items:center}.InsetBox--body--clip_board_copy{align-self:flex-start}.InsetBox--actions{gap:var(--base-size-8)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["inset_box.pcss"],"names":[],"mappings":"AAEA,2BACE,YAAa,CACb,kBAAmB,CACnB,sBAAuB,CACvB,gCACF,CAEA,gBACE,YAAa,CACb,+DAAgE,CAChE,8BAA+B,CAC/B,iCAAkC,CAClC,kBACF,CAEA,iCACE,qBACF,CAEA,mBACE,sBACF","file":"inset_box.css","sourcesContent":["/* CSS for InsetBox */\n\n.InsetBox--title-container {\n display: flex;\n align-items: center;\n gap: var(--base-size-8);\n margin-bottom: var(--base-size-8);\n}\n\n.InsetBox--body {\n display: grid;\n grid-template-areas: \"content clip_board_copy\" \"actions actions\";\n grid-template-columns: 1fr auto;\n grid-template-rows: auto auto auto;\n align-items: center;\n}\n\n.InsetBox--body--clip_board_copy {\n align-self: flex-start;\n}\n\n.InsetBox--actions {\n gap: var(--base-size-8);\n}\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<%= render(
|
|
2
|
+
Primer::Box.new(
|
|
3
|
+
border: @border,
|
|
4
|
+
border_radius: 2,
|
|
5
|
+
p: 3,
|
|
6
|
+
**@scheme_arguments,
|
|
7
|
+
**@system_arguments
|
|
8
|
+
)
|
|
9
|
+
) do %>
|
|
10
|
+
<% if title? || title_icon? %>
|
|
11
|
+
<div class="InsetBox--title-container">
|
|
12
|
+
<%= title_icon %>
|
|
13
|
+
<%= title %>
|
|
14
|
+
</div>
|
|
15
|
+
<% end %>
|
|
16
|
+
|
|
17
|
+
<%= render(Primer::OpenProject::GridLayout.new(css_class: "InsetBox--body", tag: :div)) do |grid| %>
|
|
18
|
+
<% if clipboard_copy_button?
|
|
19
|
+
grid.with_area(:clip_board_copy) do
|
|
20
|
+
render(clipboard_copy_button)
|
|
21
|
+
end
|
|
22
|
+
end %>
|
|
23
|
+
|
|
24
|
+
<% grid.with_area(:content, overflow: :hidden) do
|
|
25
|
+
content
|
|
26
|
+
end %>
|
|
27
|
+
|
|
28
|
+
<% if actions.any? %>
|
|
29
|
+
<% grid.with_area(:actions) do %>
|
|
30
|
+
<%= render(
|
|
31
|
+
Primer::Box.new(
|
|
32
|
+
display: :flex,
|
|
33
|
+
align_items: :center,
|
|
34
|
+
flex_wrap: :wrap,
|
|
35
|
+
mt: 2,
|
|
36
|
+
classes: "InsetBox--actions"
|
|
37
|
+
)
|
|
38
|
+
) do %>
|
|
39
|
+
<% actions.each do |action| %>
|
|
40
|
+
<%= action %>
|
|
41
|
+
<% end %>
|
|
42
|
+
<% end %>
|
|
43
|
+
<% end %>
|
|
44
|
+
<% end %>
|
|
45
|
+
<% end %>
|
|
46
|
+
<% end %>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* CSS for InsetBox */
|
|
2
|
+
|
|
3
|
+
.InsetBox--title-container {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: var(--base-size-8);
|
|
7
|
+
margin-bottom: var(--base-size-8);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.InsetBox--body {
|
|
11
|
+
display: grid;
|
|
12
|
+
grid-template-areas: "content clip_board_copy" "actions actions";
|
|
13
|
+
grid-template-columns: 1fr auto;
|
|
14
|
+
grid-template-rows: auto auto auto;
|
|
15
|
+
align-items: center;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.InsetBox--body--clip_board_copy {
|
|
19
|
+
align-self: flex-start;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.InsetBox--actions {
|
|
23
|
+
gap: var(--base-size-8);
|
|
24
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Primer
|
|
4
|
+
module OpenProject
|
|
5
|
+
# A box with an inset background, used to call out a piece of content such
|
|
6
|
+
# as a tip, a warning, or a code snippet, optionally with a title, icon and actions.
|
|
7
|
+
class InsetBox < Primer::Component
|
|
8
|
+
status :open_project
|
|
9
|
+
|
|
10
|
+
DEFAULT_SCHEME = :default
|
|
11
|
+
SCHEME_MAPPINGS = {
|
|
12
|
+
DEFAULT_SCHEME => { bg: :inset },
|
|
13
|
+
info: { bg: :accent, border_color: :accent },
|
|
14
|
+
warning: { bg: :attention, border_color: :attention },
|
|
15
|
+
danger: { bg: :danger, border_color: :danger },
|
|
16
|
+
success: { bg: :success, border_color: :success }
|
|
17
|
+
}.freeze
|
|
18
|
+
|
|
19
|
+
attr_reader :border, :scheme_arguments, :system_arguments
|
|
20
|
+
|
|
21
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
|
22
|
+
renders_one :title_icon, Primer::Beta::Octicon
|
|
23
|
+
|
|
24
|
+
# @param tag [Symbol] <%= one_of(Primer::Beta::Heading::TAG_OPTIONS) %>
|
|
25
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
|
26
|
+
renders_one :title, lambda { |tag: :h3, **system_arguments|
|
|
27
|
+
Primer::Beta::Heading.new(tag: tag, font_size: 5, font_weight: :semibold, **system_arguments)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
|
31
|
+
renders_many :actions, types: {
|
|
32
|
+
button: lambda { |**system_arguments|
|
|
33
|
+
Primer::Beta::Button.new(**system_arguments)
|
|
34
|
+
},
|
|
35
|
+
menu: lambda { |**system_arguments|
|
|
36
|
+
Primer::Alpha::ActionMenu.new(**system_arguments)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
|
41
|
+
renders_one :clipboard_copy_button, lambda { |**system_arguments|
|
|
42
|
+
system_arguments[:scheme] ||= :invisible
|
|
43
|
+
system_arguments[:size] = :small
|
|
44
|
+
system_arguments[:ml] = 2
|
|
45
|
+
Primer::Beta::ClipboardCopyButton.new(**system_arguments)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
# @param border [Boolean] Whether to render a border around the box.
|
|
49
|
+
# @param scheme [Symbol] <%= one_of(Primer::OpenProject::InsetBox::SCHEME_MAPPINGS.keys) %>
|
|
50
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
|
51
|
+
def initialize(border: true, scheme: DEFAULT_SCHEME, **system_arguments)
|
|
52
|
+
@border = border
|
|
53
|
+
@scheme_arguments = SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_MAPPINGS.keys, scheme, DEFAULT_SCHEME)]
|
|
54
|
+
@system_arguments = system_arguments
|
|
55
|
+
|
|
56
|
+
@system_arguments[:classes] = class_names(
|
|
57
|
+
@system_arguments[:classes],
|
|
58
|
+
"InsetBox"
|
|
59
|
+
)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<%= render(Primer::OpenProject::CollapsibleSection.new(collapsed: :locked)) do |section| %>
|
|
2
|
+
<% section.with_title { "Feedback" } %>
|
|
3
|
+
<% section.with_collapsible_content do %>
|
|
4
|
+
<%= render(Primer::Alpha::Banner.new(mb: 3)) { "Please take one minute time to answer this question" } %>
|
|
5
|
+
<%= primer_form_with(url: "/foo") do |f| %>
|
|
6
|
+
<%= render(RadioButtonGroupForm.new(f)) %>
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
<% end %>
|
|
10
|
+
<% end %>
|
|
@@ -10,10 +10,12 @@ module Primer
|
|
|
10
10
|
# @label Playground
|
|
11
11
|
# @param caption [String] text
|
|
12
12
|
# @param show_additional_information [Boolean] toggle
|
|
13
|
-
|
|
13
|
+
# @param collapsed [String] select ["false", "true", "locked"]
|
|
14
|
+
def playground(caption: "(optional)", show_additional_information: false, collapsed: "false")
|
|
15
|
+
collapsed = { "false" => false, "true" => true, "locked" => :locked }.fetch(collapsed)
|
|
14
16
|
render_with_template(
|
|
15
17
|
template: "primer/open_project/collapsible_section_preview/playground",
|
|
16
|
-
locals: { caption: caption, show_additional_information: show_additional_information}
|
|
18
|
+
locals: { caption: caption, show_additional_information: show_additional_information, collapsed: collapsed }
|
|
17
19
|
)
|
|
18
20
|
end
|
|
19
21
|
|
|
@@ -53,6 +55,15 @@ module Primer
|
|
|
53
55
|
)
|
|
54
56
|
end
|
|
55
57
|
|
|
58
|
+
# @label Non-collapsible
|
|
59
|
+
# @snapshot
|
|
60
|
+
def non_collapsible
|
|
61
|
+
render_with_template(
|
|
62
|
+
template: "primer/open_project/collapsible_section_preview/non_collapsible",
|
|
63
|
+
locals: { }
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
|
|
56
67
|
# @label With link in title
|
|
57
68
|
# @hidden
|
|
58
69
|
def with_link_in_title
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Primer
|
|
4
|
+
module OpenProject
|
|
5
|
+
# @label ColorSwatch
|
|
6
|
+
class ColorSwatchPreview < ViewComponent::Preview
|
|
7
|
+
# @label Playground
|
|
8
|
+
# @param hexcode [String] text
|
|
9
|
+
# @param show_value [Boolean] toggle
|
|
10
|
+
def playground(hexcode: "#CC0000", show_value: false)
|
|
11
|
+
render(Primer::OpenProject::ColorSwatch.new(hexcode: hexcode, show_value: show_value))
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# @label Default
|
|
15
|
+
# @snapshot
|
|
16
|
+
def default
|
|
17
|
+
render(Primer::OpenProject::ColorSwatch.new(hexcode: "#CC0000"))
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# @label With value
|
|
21
|
+
# @snapshot
|
|
22
|
+
def with_value
|
|
23
|
+
render(Primer::OpenProject::ColorSwatch.new(hexcode: "#CC0000", show_value: true))
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Primer
|
|
4
|
+
module OpenProject
|
|
5
|
+
# @label InsetBox
|
|
6
|
+
class InsetBoxPreview < ViewComponent::Preview
|
|
7
|
+
# @label Playground
|
|
8
|
+
# @param border [Boolean] toggle
|
|
9
|
+
# @param scheme [Symbol] select [default, info, warning, danger, success]
|
|
10
|
+
# @param show_title [Boolean] toggle
|
|
11
|
+
# @param show_icon [Boolean] toggle
|
|
12
|
+
# @param show_actions [Boolean] toggle
|
|
13
|
+
# @param show_clipboard_copy_button [Boolean] toggle
|
|
14
|
+
def playground(border: true, scheme: :default, show_title: true, show_icon: false, show_actions: false, show_clipboard_copy_button: false)
|
|
15
|
+
render(Primer::OpenProject::InsetBox.new(border: border, scheme: scheme)) do |component|
|
|
16
|
+
component.with_title_icon(icon: :info) if show_icon
|
|
17
|
+
component.with_title { "Title" } if show_title
|
|
18
|
+
component.with_clipboard_copy_button(value: "Copyable value", "aria-label": "Copy value") if show_clipboard_copy_button
|
|
19
|
+
|
|
20
|
+
component.with_action_button(scheme: :default) { "Action" } if show_actions
|
|
21
|
+
|
|
22
|
+
"This is the content of the inset box."
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# @label Default
|
|
27
|
+
# @snapshot
|
|
28
|
+
def default
|
|
29
|
+
render(Primer::OpenProject::InsetBox.new) do |component|
|
|
30
|
+
component.with_title { "Title" }
|
|
31
|
+
"This is the content of the inset box."
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# @label With scheme
|
|
36
|
+
# @snapshot
|
|
37
|
+
def with_scheme
|
|
38
|
+
render(Primer::OpenProject::InsetBox.new(scheme: :warning)) do |component|
|
|
39
|
+
component.with_title { "Watch out" }
|
|
40
|
+
"This is a warning message."
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# @label With icon
|
|
45
|
+
# @snapshot
|
|
46
|
+
def with_icon
|
|
47
|
+
render(Primer::OpenProject::InsetBox.new) do |component|
|
|
48
|
+
component.with_title_icon(icon: :info)
|
|
49
|
+
component.with_title { "Title" }
|
|
50
|
+
"This is the content of the inset box."
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# @label With clipboard copy button
|
|
55
|
+
# @snapshot
|
|
56
|
+
def with_clipboard_copy_button
|
|
57
|
+
render(Primer::OpenProject::InsetBox.new) do |component|
|
|
58
|
+
component.with_title { "Title" }
|
|
59
|
+
component.with_clipboard_copy_button(value: "Copyable value", "aria-label": "Copy value")
|
|
60
|
+
"This is the content of the inset box."
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# @label With actions
|
|
65
|
+
# @snapshot
|
|
66
|
+
def with_actions
|
|
67
|
+
render(Primer::OpenProject::InsetBox.new) do |component|
|
|
68
|
+
component.with_title { "Title" }
|
|
69
|
+
component.with_action_button(scheme: :default) { "Edit" }
|
|
70
|
+
component.with_action_button(scheme: :danger) { "Delete" }
|
|
71
|
+
"This is the content of the inset box."
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# @label Without border
|
|
76
|
+
# @snapshot
|
|
77
|
+
def without_border
|
|
78
|
+
render(Primer::OpenProject::InsetBox.new(border: false)) do |component|
|
|
79
|
+
component.with_title { "Title" }
|
|
80
|
+
"This is the content of the inset box."
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
data/static/arguments.json
CHANGED
|
@@ -5961,9 +5961,9 @@
|
|
|
5961
5961
|
},
|
|
5962
5962
|
{
|
|
5963
5963
|
"name": "collapsed",
|
|
5964
|
-
"type": "Boolean",
|
|
5964
|
+
"type": "Boolean, Symbol",
|
|
5965
5965
|
"default": "`false`",
|
|
5966
|
-
"description": "
|
|
5966
|
+
"description": "The initial state of the section. `false` renders it open and toggleable, `true` renders it collapsed and toggleable, and `:locked` keeps it permanently open with the toggle disabled."
|
|
5967
5967
|
},
|
|
5968
5968
|
{
|
|
5969
5969
|
"name": "system_arguments",
|
|
@@ -6127,6 +6127,34 @@
|
|
|
6127
6127
|
}
|
|
6128
6128
|
]
|
|
6129
6129
|
},
|
|
6130
|
+
{
|
|
6131
|
+
"component": "OpenProject::ColorSwatch",
|
|
6132
|
+
"status": "open_project",
|
|
6133
|
+
"a11y_reviewed": false,
|
|
6134
|
+
"short_name": "OpenProjectColorSwatch",
|
|
6135
|
+
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/color_swatch.rb",
|
|
6136
|
+
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/color_swatch/default/",
|
|
6137
|
+
"parameters": [
|
|
6138
|
+
{
|
|
6139
|
+
"name": "hexcode",
|
|
6140
|
+
"type": "String",
|
|
6141
|
+
"default": "N/A",
|
|
6142
|
+
"description": "The hex color code to display, e.g. `#FF0000`."
|
|
6143
|
+
},
|
|
6144
|
+
{
|
|
6145
|
+
"name": "show_value",
|
|
6146
|
+
"type": "Boolean",
|
|
6147
|
+
"default": "`false`",
|
|
6148
|
+
"description": "Whether to display the hex value next to the swatch."
|
|
6149
|
+
},
|
|
6150
|
+
{
|
|
6151
|
+
"name": "system_arguments",
|
|
6152
|
+
"type": "Hash",
|
|
6153
|
+
"default": "N/A",
|
|
6154
|
+
"description": "[System arguments](/system-arguments)"
|
|
6155
|
+
}
|
|
6156
|
+
]
|
|
6157
|
+
},
|
|
6130
6158
|
{
|
|
6131
6159
|
"component": "OpenProject::DangerDialog",
|
|
6132
6160
|
"status": "open_project",
|
|
@@ -6543,6 +6571,34 @@
|
|
|
6543
6571
|
}
|
|
6544
6572
|
]
|
|
6545
6573
|
},
|
|
6574
|
+
{
|
|
6575
|
+
"component": "OpenProject::InsetBox",
|
|
6576
|
+
"status": "open_project",
|
|
6577
|
+
"a11y_reviewed": false,
|
|
6578
|
+
"short_name": "OpenProjectInsetBox",
|
|
6579
|
+
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/inset_box.rb",
|
|
6580
|
+
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/inset_box/default/",
|
|
6581
|
+
"parameters": [
|
|
6582
|
+
{
|
|
6583
|
+
"name": "border",
|
|
6584
|
+
"type": "Boolean",
|
|
6585
|
+
"default": "`true`",
|
|
6586
|
+
"description": "Whether to render a border around the box."
|
|
6587
|
+
},
|
|
6588
|
+
{
|
|
6589
|
+
"name": "scheme",
|
|
6590
|
+
"type": "Symbol",
|
|
6591
|
+
"default": "`:default`",
|
|
6592
|
+
"description": "One of `:danger`, `:default`, `:info`, `:success`, or `:warning`."
|
|
6593
|
+
},
|
|
6594
|
+
{
|
|
6595
|
+
"name": "system_arguments",
|
|
6596
|
+
"type": "Hash",
|
|
6597
|
+
"default": "N/A",
|
|
6598
|
+
"description": "[System arguments](/system-arguments)"
|
|
6599
|
+
}
|
|
6600
|
+
]
|
|
6601
|
+
},
|
|
6546
6602
|
{
|
|
6547
6603
|
"component": "OpenProject::PageHeader",
|
|
6548
6604
|
"status": "open_project",
|
data/static/audited_at.json
CHANGED
|
@@ -147,6 +147,7 @@
|
|
|
147
147
|
"Primer::OpenProject::BorderGrid::Cell": "",
|
|
148
148
|
"Primer::OpenProject::CollapsibleSection": "",
|
|
149
149
|
"Primer::OpenProject::ColorField": "",
|
|
150
|
+
"Primer::OpenProject::ColorSwatch": "",
|
|
150
151
|
"Primer::OpenProject::DangerDialog": "",
|
|
151
152
|
"Primer::OpenProject::DangerDialog::ConfirmationCheckBox": "",
|
|
152
153
|
"Primer::OpenProject::DangerDialog::FormWrapper": "",
|
|
@@ -163,6 +164,7 @@
|
|
|
163
164
|
"Primer::OpenProject::Heading": "",
|
|
164
165
|
"Primer::OpenProject::InlineMessage": "",
|
|
165
166
|
"Primer::OpenProject::InputGroup": "",
|
|
167
|
+
"Primer::OpenProject::InsetBox": "",
|
|
166
168
|
"Primer::OpenProject::PageHeader": "",
|
|
167
169
|
"Primer::OpenProject::PageHeader::Dialog": "",
|
|
168
170
|
"Primer::OpenProject::PageHeader::Menu": "",
|
data/static/classes.json
CHANGED
|
@@ -268,6 +268,9 @@
|
|
|
268
268
|
"ColorField": [
|
|
269
269
|
"Primer::OpenProject::ColorField"
|
|
270
270
|
],
|
|
271
|
+
"ColorSwatch--indicator": [
|
|
272
|
+
"Primer::OpenProject::ColorSwatch"
|
|
273
|
+
],
|
|
271
274
|
"Counter": [
|
|
272
275
|
"Primer::Beta::Counter"
|
|
273
276
|
],
|
|
@@ -388,6 +391,18 @@
|
|
|
388
391
|
"InputGroup": [
|
|
389
392
|
"Primer::OpenProject::InputGroup"
|
|
390
393
|
],
|
|
394
|
+
"InsetBox--actions": [
|
|
395
|
+
"Primer::OpenProject::InsetBox"
|
|
396
|
+
],
|
|
397
|
+
"InsetBox--body": [
|
|
398
|
+
"Primer::OpenProject::InsetBox"
|
|
399
|
+
],
|
|
400
|
+
"InsetBox--body--clip_board_copy": [
|
|
401
|
+
"Primer::OpenProject::InsetBox"
|
|
402
|
+
],
|
|
403
|
+
"InsetBox--title-container": [
|
|
404
|
+
"Primer::OpenProject::InsetBox"
|
|
405
|
+
],
|
|
391
406
|
"Label": [
|
|
392
407
|
"Primer::Beta::Label"
|
|
393
408
|
],
|
data/static/classnames.cjs
CHANGED
|
@@ -126,6 +126,7 @@ module.exports = new Set([
|
|
|
126
126
|
'ColorField-picker',
|
|
127
127
|
'ColorField-swatch',
|
|
128
128
|
'ColorField-wrap',
|
|
129
|
+
'ColorSwatch--indicator',
|
|
129
130
|
'Counter',
|
|
130
131
|
'Counter--primary',
|
|
131
132
|
'Counter--secondary',
|
|
@@ -196,6 +197,10 @@ module.exports = new Set([
|
|
|
196
197
|
'InputGroup-input-width--xlarge',
|
|
197
198
|
'InputGroup-input-width--xsmall',
|
|
198
199
|
'InputGroup-input-width--xxlarge',
|
|
200
|
+
'InsetBox--actions',
|
|
201
|
+
'InsetBox--body',
|
|
202
|
+
'InsetBox--body--clip_board_copy',
|
|
203
|
+
'InsetBox--title-container',
|
|
199
204
|
'Label',
|
|
200
205
|
'Label--accent',
|
|
201
206
|
'Label--attention',
|
data/static/classnames.js
CHANGED
|
@@ -126,6 +126,7 @@ const classNames = new Set([
|
|
|
126
126
|
'ColorField-picker',
|
|
127
127
|
'ColorField-swatch',
|
|
128
128
|
'ColorField-wrap',
|
|
129
|
+
'ColorSwatch--indicator',
|
|
129
130
|
'Counter',
|
|
130
131
|
'Counter--primary',
|
|
131
132
|
'Counter--secondary',
|
|
@@ -196,6 +197,10 @@ const classNames = new Set([
|
|
|
196
197
|
'InputGroup-input-width--xlarge',
|
|
197
198
|
'InputGroup-input-width--xsmall',
|
|
198
199
|
'InputGroup-input-width--xxlarge',
|
|
200
|
+
'InsetBox--actions',
|
|
201
|
+
'InsetBox--body',
|
|
202
|
+
'InsetBox--body--clip_board_copy',
|
|
203
|
+
'InsetBox--title-container',
|
|
199
204
|
'Label',
|
|
200
205
|
'Label--accent',
|
|
201
206
|
'Label--attention',
|