openproject-primer_view_components 0.79.1 → 0.80.1
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 +18 -0
- data/app/assets/javascripts/components/primer/open_project/avatar_fallback.d.ts +20 -7
- 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/open_project/avatar_fallback.d.ts +20 -7
- data/app/components/primer/open_project/avatar_fallback.js +47 -44
- data/app/components/primer/open_project/avatar_fallback.ts +49 -38
- data/app/components/primer/open_project/avatar_with_fallback.rb +11 -12
- data/app/components/primer/open_project/fieldset.html.erb +8 -0
- data/app/components/primer/open_project/fieldset.rb +66 -0
- data/app/components/primer/open_project/inline_message.css +1 -0
- data/app/components/primer/open_project/inline_message.css.json +13 -0
- data/app/components/primer/open_project/inline_message.css.map +1 -0
- data/app/components/primer/open_project/inline_message.html.erb +4 -0
- data/app/components/primer/open_project/inline_message.pcss +42 -0
- data/app/components/primer/open_project/inline_message.rb +65 -0
- data/app/components/primer/open_project/page_header.rb +18 -1
- data/app/components/primer/primer.pcss +1 -0
- data/app/lib/primer/forms/dsl/fieldset_group_input.rb +35 -0
- data/app/lib/primer/forms/dsl/form_object.rb +4 -0
- data/app/lib/primer/forms/fieldset_group.html.erb +10 -0
- data/app/lib/primer/forms/fieldset_group.rb +54 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/previews/primer/forms_preview/fieldset_group_form.html.erb +40 -0
- data/previews/primer/forms_preview.rb +3 -0
- data/previews/primer/open_project/inline_message_preview/default.html.erb +5 -0
- data/previews/primer/open_project/inline_message_preview/playground.html.erb +5 -0
- data/previews/primer/open_project/inline_message_preview.rb +22 -0
- data/static/arguments.json +67 -2
- data/static/audited_at.json +3 -0
- data/static/classes.json +6 -0
- data/static/constants.json +22 -0
- data/static/form_previews.json +5 -0
- data/static/info_arch.json +145 -3
- data/static/previews.json +34 -0
- data/static/statuses.json +3 -0
- metadata +17 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Primer
|
|
4
|
+
module Forms
|
|
5
|
+
module Dsl
|
|
6
|
+
# :nodoc:
|
|
7
|
+
class FieldsetGroupInput < Input
|
|
8
|
+
include Primer::Forms::Dsl::InputMethods
|
|
9
|
+
include InputMethods
|
|
10
|
+
|
|
11
|
+
attr_reader :builder, :form, :system_arguments
|
|
12
|
+
|
|
13
|
+
def initialize(builder:, form:, **system_arguments)
|
|
14
|
+
@builder = builder
|
|
15
|
+
@form = form
|
|
16
|
+
@system_arguments = system_arguments
|
|
17
|
+
|
|
18
|
+
yield(self) if block_given?
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def to_component
|
|
22
|
+
FieldsetGroup.new(inputs: inputs, builder: builder, form: form, **@system_arguments)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def type
|
|
26
|
+
:group
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def input?
|
|
30
|
+
true
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -19,6 +19,10 @@ module Primer
|
|
|
19
19
|
def group(**options, &block)
|
|
20
20
|
add_input InputGroup.new(builder: @builder, form: @form, **options, &block)
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
def fieldset_group(**options, &block)
|
|
24
|
+
add_input FieldsetGroupInput.new(builder: @builder, form: @form, **options, &block)
|
|
25
|
+
end
|
|
22
26
|
end
|
|
23
27
|
end
|
|
24
28
|
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<%= render(Primer::BaseComponent.new(**@system_arguments)) do %>
|
|
2
|
+
<%= render(Primer::OpenProject::Fieldset.new(**@fieldset_arguments)) do %>
|
|
3
|
+
<%=
|
|
4
|
+
render(Primer::Beta::Subhead.new) do |component|
|
|
5
|
+
component.with_heading(**@heading_arguments).with_content(@title)
|
|
6
|
+
end
|
|
7
|
+
%>
|
|
8
|
+
<%= render(Primer::Forms::Group.new(**@group_arguments)) %>
|
|
9
|
+
<% end %>
|
|
10
|
+
<% end %>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Primer
|
|
4
|
+
module Forms
|
|
5
|
+
# :nodoc:
|
|
6
|
+
class FieldsetGroup < BaseComponent
|
|
7
|
+
##
|
|
8
|
+
# @param title [String] The title displayed as the heading for the fieldset
|
|
9
|
+
# @param inputs [Array<Primer::Forms::Dsl::Input>] Array of form inputs to be grouped
|
|
10
|
+
# @param builder [ActionView::Helpers::FormBuilder] The form builder instance
|
|
11
|
+
# @param form [Primer::Forms::BaseForm] The form object
|
|
12
|
+
# @param layout [Symbol] Layout style for the input group (default: :default_layout)
|
|
13
|
+
# @param heading_arguments [Hash] Arguments passed to the heading component
|
|
14
|
+
# @option heading_arguments [String] :id The ID for the heading element
|
|
15
|
+
# @option heading_arguments [Symbol] :tag The HTML tag for the heading (default: :h3)
|
|
16
|
+
# @option heading_arguments [Symbol] :size The size of the heading (default: :medium)
|
|
17
|
+
# @param group_arguments [Hash] Arguments passed to the input group component
|
|
18
|
+
# @param system_arguments [Hash] Additional system arguments passed to the section wrapper
|
|
19
|
+
def initialize( # rubocop:disable Metrics/AbcSize
|
|
20
|
+
title:,
|
|
21
|
+
inputs:,
|
|
22
|
+
builder:,
|
|
23
|
+
form:,
|
|
24
|
+
layout: Primer::Forms::Group::DEFAULT_LAYOUT,
|
|
25
|
+
heading_arguments: {},
|
|
26
|
+
group_arguments: {},
|
|
27
|
+
**system_arguments
|
|
28
|
+
)
|
|
29
|
+
super()
|
|
30
|
+
|
|
31
|
+
@title = title
|
|
32
|
+
|
|
33
|
+
@heading_arguments = heading_arguments
|
|
34
|
+
@heading_arguments[:id] ||= "subhead-#{SecureRandom.uuid}"
|
|
35
|
+
@heading_arguments[:tag] ||= :h3
|
|
36
|
+
@heading_arguments[:size] ||= :medium
|
|
37
|
+
|
|
38
|
+
@fieldset_arguments = {
|
|
39
|
+
legend_text: @title,
|
|
40
|
+
visually_hide_legend: true,
|
|
41
|
+
aria: { labelledby: @heading_arguments[:id] }
|
|
42
|
+
}
|
|
43
|
+
@group_arguments = group_arguments.merge(inputs:, builder:, form:, layout:)
|
|
44
|
+
|
|
45
|
+
@system_arguments = system_arguments
|
|
46
|
+
@system_arguments[:tag] = :section
|
|
47
|
+
@system_arguments[:mb] ||= 4
|
|
48
|
+
@system_arguments[:aria] ||= {}
|
|
49
|
+
@system_arguments[:aria][:labelledby] = @heading_arguments[:id]
|
|
50
|
+
@system_arguments[:hidden] = :none if inputs.all?(&:hidden?)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<%
|
|
2
|
+
fieldset_group_form = Class.new(ApplicationForm) do
|
|
3
|
+
form do |f|
|
|
4
|
+
f.fieldset_group(
|
|
5
|
+
title: "Delivery preferences",
|
|
6
|
+
caption: "These settings affect how we contact you"
|
|
7
|
+
) do |g|
|
|
8
|
+
g.text_field(
|
|
9
|
+
name: :ultimate_answer,
|
|
10
|
+
label: "Ultimate answer",
|
|
11
|
+
required: true,
|
|
12
|
+
caption: "The answer to life, the universe, and everything"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
g.select_list(
|
|
16
|
+
name: :window,
|
|
17
|
+
label: "Delivery window",
|
|
18
|
+
include_blank: true
|
|
19
|
+
) do |list|
|
|
20
|
+
list.option(label: "Morning", value: "morning")
|
|
21
|
+
list.option(label: "Afternoon", value: "afternoon")
|
|
22
|
+
list.option(label: "Evening", value: "evening")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
g.text_field(
|
|
26
|
+
name: :hours,
|
|
27
|
+
label: "Hours",
|
|
28
|
+
type: :number,
|
|
29
|
+
required: true,
|
|
30
|
+
trailing_visual: { text: { text: "min" } },
|
|
31
|
+
input_width: :xsmall
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
%>
|
|
37
|
+
|
|
38
|
+
<%= primer_form_with(url: "/foo") do |f| %>
|
|
39
|
+
<%= render(fieldset_group_form.new(f)) %>
|
|
40
|
+
<% end %>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Primer
|
|
4
|
+
module OpenProject
|
|
5
|
+
class InlineMessagePreview < ViewComponent::Preview
|
|
6
|
+
# @label Default
|
|
7
|
+
# @snapshot
|
|
8
|
+
def default
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# @label Playground
|
|
12
|
+
# @param scheme [Symbol] select [warning, critical, unavailable, success]
|
|
13
|
+
# @param size [Symbol] select [small, medium]
|
|
14
|
+
def playground(
|
|
15
|
+
scheme: :warning,
|
|
16
|
+
size: :medium
|
|
17
|
+
)
|
|
18
|
+
render_with_template(locals: { scheme: scheme, size: size })
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
data/static/arguments.json
CHANGED
|
@@ -5775,13 +5775,13 @@
|
|
|
5775
5775
|
"name": "src",
|
|
5776
5776
|
"type": "String",
|
|
5777
5777
|
"default": "`nil`",
|
|
5778
|
-
"description": "The source
|
|
5778
|
+
"description": "The source URL of the avatar image. When provided, JavaScript will test-load it in the background and swap to it on success. When nil or blank, only the fallback SVG is displayed."
|
|
5779
5779
|
},
|
|
5780
5780
|
{
|
|
5781
5781
|
"name": "alt",
|
|
5782
5782
|
"type": "String",
|
|
5783
5783
|
"default": "`nil`",
|
|
5784
|
-
"description": "Alt text for the avatar. Used for accessibility and to generate initials
|
|
5784
|
+
"description": "Alt text for the avatar. Used for accessibility and to generate initials for the fallback SVG."
|
|
5785
5785
|
},
|
|
5786
5786
|
{
|
|
5787
5787
|
"name": "size",
|
|
@@ -6058,6 +6058,43 @@
|
|
|
6058
6058
|
}
|
|
6059
6059
|
]
|
|
6060
6060
|
},
|
|
6061
|
+
{
|
|
6062
|
+
"component": "OpenProject::Fieldset",
|
|
6063
|
+
"status": "open_project",
|
|
6064
|
+
"a11y_reviewed": false,
|
|
6065
|
+
"short_name": "OpenProjectFieldset",
|
|
6066
|
+
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/fieldset.rb",
|
|
6067
|
+
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/fieldset/default/",
|
|
6068
|
+
"parameters": [
|
|
6069
|
+
{
|
|
6070
|
+
"name": "legend_text",
|
|
6071
|
+
"type": "String",
|
|
6072
|
+
"default": "`nil`",
|
|
6073
|
+
"description": "A legend should be short and concise. The String will also be read by assistive technology."
|
|
6074
|
+
},
|
|
6075
|
+
{
|
|
6076
|
+
"name": "visually_hide_legend",
|
|
6077
|
+
"type": "Boolean",
|
|
6078
|
+
"default": "`false`",
|
|
6079
|
+
"description": "Controls if the legend is visible. If `true`, screen reader only text will be added."
|
|
6080
|
+
},
|
|
6081
|
+
{
|
|
6082
|
+
"name": "system_arguments",
|
|
6083
|
+
"type": "Hash",
|
|
6084
|
+
"default": "N/A",
|
|
6085
|
+
"description": "[System arguments](/system-arguments)"
|
|
6086
|
+
}
|
|
6087
|
+
]
|
|
6088
|
+
},
|
|
6089
|
+
{
|
|
6090
|
+
"component": "OpenProject::Fieldset::Legend",
|
|
6091
|
+
"status": "open_project",
|
|
6092
|
+
"a11y_reviewed": false,
|
|
6093
|
+
"short_name": "OpenProjectFieldsetLegend",
|
|
6094
|
+
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/fieldset/legend_component.rb",
|
|
6095
|
+
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/fieldset/legend/default/",
|
|
6096
|
+
"parameters": []
|
|
6097
|
+
},
|
|
6061
6098
|
{
|
|
6062
6099
|
"component": "OpenProject::FilterableTreeView",
|
|
6063
6100
|
"status": "alpha",
|
|
@@ -6220,6 +6257,34 @@
|
|
|
6220
6257
|
}
|
|
6221
6258
|
]
|
|
6222
6259
|
},
|
|
6260
|
+
{
|
|
6261
|
+
"component": "OpenProject::InlineMessage",
|
|
6262
|
+
"status": "open_project",
|
|
6263
|
+
"a11y_reviewed": false,
|
|
6264
|
+
"short_name": "OpenProjectInlineMessage",
|
|
6265
|
+
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/inline_message.rb",
|
|
6266
|
+
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/inline_message/default/",
|
|
6267
|
+
"parameters": [
|
|
6268
|
+
{
|
|
6269
|
+
"name": "scheme",
|
|
6270
|
+
"type": "Symbol",
|
|
6271
|
+
"default": "N/A",
|
|
6272
|
+
"description": "One of `:critical`, `:success`, `:unavailable`, or `:warning`."
|
|
6273
|
+
},
|
|
6274
|
+
{
|
|
6275
|
+
"name": "size",
|
|
6276
|
+
"type": "Symbol",
|
|
6277
|
+
"default": "`:medium`",
|
|
6278
|
+
"description": "One of `:medium` or `:small`."
|
|
6279
|
+
},
|
|
6280
|
+
{
|
|
6281
|
+
"name": "system_arguments",
|
|
6282
|
+
"type": "Hash",
|
|
6283
|
+
"default": "N/A",
|
|
6284
|
+
"description": "[System arguments](/system-arguments)"
|
|
6285
|
+
}
|
|
6286
|
+
]
|
|
6287
|
+
},
|
|
6223
6288
|
{
|
|
6224
6289
|
"component": "OpenProject::InputGroup",
|
|
6225
6290
|
"status": "open_project",
|
data/static/audited_at.json
CHANGED
|
@@ -151,12 +151,15 @@
|
|
|
151
151
|
"Primer::OpenProject::DragHandle": "",
|
|
152
152
|
"Primer::OpenProject::FeedbackDialog": "",
|
|
153
153
|
"Primer::OpenProject::FeedbackMessage": "",
|
|
154
|
+
"Primer::OpenProject::Fieldset": "",
|
|
155
|
+
"Primer::OpenProject::Fieldset::LegendComponent": "",
|
|
154
156
|
"Primer::OpenProject::FilterableTreeView": "",
|
|
155
157
|
"Primer::OpenProject::FilterableTreeView::SubTree": "",
|
|
156
158
|
"Primer::OpenProject::FlexLayout": "",
|
|
157
159
|
"Primer::OpenProject::GridLayout": "",
|
|
158
160
|
"Primer::OpenProject::GridLayout::Area": "",
|
|
159
161
|
"Primer::OpenProject::Heading": "",
|
|
162
|
+
"Primer::OpenProject::InlineMessage": "",
|
|
160
163
|
"Primer::OpenProject::InputGroup": "",
|
|
161
164
|
"Primer::OpenProject::PageHeader": "",
|
|
162
165
|
"Primer::OpenProject::PageHeader::Dialog": "",
|
data/static/classes.json
CHANGED
|
@@ -352,6 +352,12 @@
|
|
|
352
352
|
"FormControl-warning": [
|
|
353
353
|
"Primer::Alpha::TextField"
|
|
354
354
|
],
|
|
355
|
+
"InlineMessage": [
|
|
356
|
+
"Primer::OpenProject::InlineMessage"
|
|
357
|
+
],
|
|
358
|
+
"InlineMessageIcon": [
|
|
359
|
+
"Primer::OpenProject::InlineMessage"
|
|
360
|
+
],
|
|
355
361
|
"InputGroup": [
|
|
356
362
|
"Primer::OpenProject::InputGroup"
|
|
357
363
|
],
|
data/static/constants.json
CHANGED
|
@@ -1751,6 +1751,13 @@
|
|
|
1751
1751
|
"Primer::OpenProject::FeedbackMessage": {
|
|
1752
1752
|
"GeneratedSlotMethods": "Primer::OpenProject::FeedbackMessage::GeneratedSlotMethods"
|
|
1753
1753
|
},
|
|
1754
|
+
"Primer::OpenProject::Fieldset": {
|
|
1755
|
+
"GeneratedSlotMethods": "Primer::OpenProject::Fieldset::GeneratedSlotMethods",
|
|
1756
|
+
"LegendComponent": "Primer::OpenProject::Fieldset::LegendComponent"
|
|
1757
|
+
},
|
|
1758
|
+
"Primer::OpenProject::Fieldset::LegendComponent": {
|
|
1759
|
+
"GeneratedSlotMethods": "Primer::OpenProject::Fieldset::LegendComponent::GeneratedSlotMethods"
|
|
1760
|
+
},
|
|
1754
1761
|
"Primer::OpenProject::FilterableTreeView": {
|
|
1755
1762
|
"DEFAULT_FILTER_INPUT_ARGUMENTS": {
|
|
1756
1763
|
"name": "filter",
|
|
@@ -1810,6 +1817,20 @@
|
|
|
1810
1817
|
"Primer::OpenProject::Heading": {
|
|
1811
1818
|
"GeneratedSlotMethods": "Primer::OpenProject::Heading::GeneratedSlotMethods"
|
|
1812
1819
|
},
|
|
1820
|
+
"Primer::OpenProject::InlineMessage": {
|
|
1821
|
+
"DEFAULT_SIZE": "medium",
|
|
1822
|
+
"GeneratedSlotMethods": "Primer::OpenProject::InlineMessage::GeneratedSlotMethods",
|
|
1823
|
+
"SCHEME_OPTIONS": [
|
|
1824
|
+
"warning",
|
|
1825
|
+
"critical",
|
|
1826
|
+
"success",
|
|
1827
|
+
"unavailable"
|
|
1828
|
+
],
|
|
1829
|
+
"SIZE_OPTIONS": [
|
|
1830
|
+
"small",
|
|
1831
|
+
"medium"
|
|
1832
|
+
]
|
|
1833
|
+
},
|
|
1813
1834
|
"Primer::OpenProject::InputGroup": {
|
|
1814
1835
|
"DEFAULT_INPUT_WIDTH": "auto",
|
|
1815
1836
|
"GeneratedSlotMethods": "Primer::OpenProject::InputGroup::GeneratedSlotMethods",
|
|
@@ -1845,6 +1866,7 @@
|
|
|
1845
1866
|
"none",
|
|
1846
1867
|
"flex"
|
|
1847
1868
|
],
|
|
1869
|
+
"DEFAULT_BUTTON_ACTION_SIZE": "medium",
|
|
1848
1870
|
"DEFAULT_HEADER_VARIANT": "medium",
|
|
1849
1871
|
"DEFAULT_LEADING_ACTION_DISPLAY": [
|
|
1850
1872
|
"none",
|
data/static/form_previews.json
CHANGED
|
@@ -18,6 +18,11 @@
|
|
|
18
18
|
"name": "custom_width_fields_form",
|
|
19
19
|
"snapshot": "false"
|
|
20
20
|
},
|
|
21
|
+
{
|
|
22
|
+
"preview_path": "primer/forms/fieldset_group_form",
|
|
23
|
+
"name": "fieldset_group_form",
|
|
24
|
+
"snapshot": "true"
|
|
25
|
+
},
|
|
21
26
|
{
|
|
22
27
|
"preview_path": "primer/forms/text_field_and_checkbox_form",
|
|
23
28
|
"name": "text_field_and_checkbox_form",
|
data/static/info_arch.json
CHANGED
|
@@ -18866,7 +18866,7 @@
|
|
|
18866
18866
|
},
|
|
18867
18867
|
{
|
|
18868
18868
|
"fully_qualified_name": "Primer::OpenProject::AvatarWithFallback",
|
|
18869
|
-
"description": "OpenProject-specific Avatar component that extends Primer::Beta::Avatar\nto support fallback rendering with initials when no image source is provided.\n\
|
|
18869
|
+
"description": "OpenProject-specific Avatar component that extends Primer::Beta::Avatar\nto support fallback rendering with initials when no image source is provided.\n\nUses a \"fallback first\" pattern for flicker-free loading:\n1. Always renders fallback SVG as initial <img> src (visible immediately)\n2. Client-side JS test-loads the real URL in background\n3. On success, swaps to real image; on failure, fallback stays visible\n\nThis approach is inspired by OpenProject's Angular PrincipalRendererService.",
|
|
18870
18870
|
"accessibility_docs": null,
|
|
18871
18871
|
"is_form_component": false,
|
|
18872
18872
|
"is_published": true,
|
|
@@ -18882,13 +18882,13 @@
|
|
|
18882
18882
|
"name": "src",
|
|
18883
18883
|
"type": "String",
|
|
18884
18884
|
"default": "`nil`",
|
|
18885
|
-
"description": "The source
|
|
18885
|
+
"description": "The source URL of the avatar image. When provided, JavaScript will test-load it in the background and swap to it on success. When nil or blank, only the fallback SVG is displayed."
|
|
18886
18886
|
},
|
|
18887
18887
|
{
|
|
18888
18888
|
"name": "alt",
|
|
18889
18889
|
"type": "String",
|
|
18890
18890
|
"default": "`nil`",
|
|
18891
|
-
"description": "Alt text for the avatar. Used for accessibility and to generate initials
|
|
18891
|
+
"description": "Alt text for the avatar. Used for accessibility and to generate initials for the fallback SVG."
|
|
18892
18892
|
},
|
|
18893
18893
|
{
|
|
18894
18894
|
"name": "size",
|
|
@@ -20079,6 +20079,83 @@
|
|
|
20079
20079
|
],
|
|
20080
20080
|
"subcomponents": []
|
|
20081
20081
|
},
|
|
20082
|
+
{
|
|
20083
|
+
"fully_qualified_name": "Primer::OpenProject::Fieldset",
|
|
20084
|
+
"description": "A low-level component for building fieldsets with unopinionated styling.\n\nThis component is not designed to be used directly, but rather a primitive for\nauthors of other components and form controls.",
|
|
20085
|
+
"accessibility_docs": null,
|
|
20086
|
+
"is_form_component": false,
|
|
20087
|
+
"is_published": true,
|
|
20088
|
+
"requires_js": false,
|
|
20089
|
+
"component": "OpenProject::Fieldset",
|
|
20090
|
+
"status": "open_project",
|
|
20091
|
+
"a11y_reviewed": false,
|
|
20092
|
+
"short_name": "OpenProjectFieldset",
|
|
20093
|
+
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/fieldset.rb",
|
|
20094
|
+
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/fieldset/default/",
|
|
20095
|
+
"parameters": [
|
|
20096
|
+
{
|
|
20097
|
+
"name": "legend_text",
|
|
20098
|
+
"type": "String",
|
|
20099
|
+
"default": "`nil`",
|
|
20100
|
+
"description": "A legend should be short and concise. The String will also be read by assistive technology."
|
|
20101
|
+
},
|
|
20102
|
+
{
|
|
20103
|
+
"name": "visually_hide_legend",
|
|
20104
|
+
"type": "Boolean",
|
|
20105
|
+
"default": "`false`",
|
|
20106
|
+
"description": "Controls if the legend is visible. If `true`, screen reader only text will be added."
|
|
20107
|
+
},
|
|
20108
|
+
{
|
|
20109
|
+
"name": "system_arguments",
|
|
20110
|
+
"type": "Hash",
|
|
20111
|
+
"default": "N/A",
|
|
20112
|
+
"description": "{{link_to_system_arguments_docs}}"
|
|
20113
|
+
}
|
|
20114
|
+
],
|
|
20115
|
+
"slots": [
|
|
20116
|
+
{
|
|
20117
|
+
"name": "legend",
|
|
20118
|
+
"description": null,
|
|
20119
|
+
"parameters": []
|
|
20120
|
+
}
|
|
20121
|
+
],
|
|
20122
|
+
"methods": [
|
|
20123
|
+
{
|
|
20124
|
+
"name": "legend_text",
|
|
20125
|
+
"description": "Returns the value of attribute legend_text.",
|
|
20126
|
+
"parameters": [],
|
|
20127
|
+
"return_types": []
|
|
20128
|
+
}
|
|
20129
|
+
],
|
|
20130
|
+
"previews": [],
|
|
20131
|
+
"subcomponents": []
|
|
20132
|
+
},
|
|
20133
|
+
{
|
|
20134
|
+
"fully_qualified_name": "Primer::OpenProject::Fieldset::LegendComponent",
|
|
20135
|
+
"description": "",
|
|
20136
|
+
"accessibility_docs": null,
|
|
20137
|
+
"is_form_component": false,
|
|
20138
|
+
"is_published": true,
|
|
20139
|
+
"requires_js": false,
|
|
20140
|
+
"component": "OpenProject::Fieldset::Legend",
|
|
20141
|
+
"status": "open_project",
|
|
20142
|
+
"a11y_reviewed": false,
|
|
20143
|
+
"short_name": "OpenProjectFieldsetLegend",
|
|
20144
|
+
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/fieldset/legend_component.rb",
|
|
20145
|
+
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/fieldset/legend/default/",
|
|
20146
|
+
"parameters": [],
|
|
20147
|
+
"slots": [],
|
|
20148
|
+
"methods": [
|
|
20149
|
+
{
|
|
20150
|
+
"name": "text",
|
|
20151
|
+
"description": "Returns the value of attribute text.",
|
|
20152
|
+
"parameters": [],
|
|
20153
|
+
"return_types": []
|
|
20154
|
+
}
|
|
20155
|
+
],
|
|
20156
|
+
"previews": [],
|
|
20157
|
+
"subcomponents": []
|
|
20158
|
+
},
|
|
20082
20159
|
{
|
|
20083
20160
|
"fully_qualified_name": "Primer::OpenProject::FilterableTreeView",
|
|
20084
20161
|
"description": "A TreeView and associated filter controls for searching nested hierarchies.\n\n## Filter controls\n\n`FilterableTreeView`s can be filtered using two controls, both present in the toolbar above the tree:\n\n1. A free-form query string from a text input field.\n2. A `SegmentedControl` with two options (by default):\n 1. The \"Selected\" option causes the component to only show checked nodes, provided they also satisfy the other\n filter criteria described here.\n 2. The \"All\" option causes the component to show all nodes, provided they also satisfy the other filter\n criteria described here.\n\n## Custom filter modes\n\nIn addition to the default filter modes of `'all'` and `'selected'` described above, `FilterableTreeView` supports\nadding custom filter modes. Adding a filter mode will cause its label to appear in the `SegmentedControl` in the\ntoolbar, and will be passed as the third argument to the filter function (see below).\n\nHere's how to add a custom filter mode in addition to the default ones:\n\n```erb\n<%= render(Primer::OpenProject::FilterableTreeView.new) do |tree_view| %>\n <%# remove this line to prevent adding the default modes %>\n <% tree_view.with_default_filter_modes %>\n <% tree_view.with_filter_mode(name: \"Custom\", system_arguments)\n<% end %>\n```\n\n## Filter behavior\n\nBy default, matching node text is identified by looking for an exact substring match, operating on a lowercased\nversion of both the query string and the node text. For more information, and to provide a customized filter\nfunction, please see the section titled \"Customizing the filter function\" below.\n\nNodes that match the filter appear as normal; nodes that do not match are presented as follows:\n\n1. Leaf nodes are hidden.\n2. Sub-tree nodes with no matching children are hidden.\n3. Sub-tree nodes with at least one matching child are disabled but still visible.\n\n## Checking behavior\n\nBy default, checking a node in a `FilterableTreeView` checks only that node (i.e. no child nodes are checked).\nTo aide in checking children in deeply nested or highly populated hierarchies, a third control exists in the\ntoolbar: the \"Include sub-items\" check box. If this feature is turned on, checking sub-tree nodes causes all\nchildren, both leaf and sub-tree nodes, to also be checked recursively. Moreover, turning this feature on will\ncause the children of any previously checked nodes to be checked recursively. Unchecking a node while in\n\"Include sub-items\" mode will restore that sub-tree and all its children to their previously checked state, so as\nnot to permanently override a user's selections. Unchecking the \"Include sub-items\" check box has a similar effect,\ni.e. restores all previous user selections under currently checked sub-trees.\n\n## JavaScript API\n\n`FilterableTreeView` does not yet have an extensive JavaScript API, but this may change in the future as the\ncomponent is further developed to fit additional use-cases.\n\n### Customizing the filter function\n\nThe filter function can be customized by setting the value of the `filterFn` property to a function with the\nfollowing signature:\n\n```typescript\nexport type FilterFn = (node: HTMLElement, query: string, filterMode?: string) => Range[] | null\n```\n\nThis function will be called once for each node in the tree every time filter controls change (i.e. when the\nfilter mode or query string are altered). The function is called with the following arguments:\n\n|Argument |Description |\n|:-----------|:----------------------------------------------------------------|\n|`node` |The HTML node element, i.e. the element with `role=treeitem` set.|\n|`query` |The query string. |\n|`filterMode`|The filter mode, either `'all'` or `'selected'`. |\n\nThe component expects the filter function to return specific values depending on the type of match:\n\n1. No match - return `null`\n2. Match but no highlights (eg. when the query string is empty) - return an empty array\n3. Match with highlights - return a non-empty array of `Range` objects\n\nExample:\n\n```javascript\nconst filterableTreeView = document.querySelector('filterable-tree-view')\nfilterableTreeView.filterFn = (node, query, filterMode) => {\n // custom filter implementation here\n}\n```\n\nYou can read about `Range` objects here: https://developer.mozilla.org/en-US/docs/Web/API/Range.\n\nFor a complete example demonstrating how to implement a working filter function complete with range highlighting,\nsee the default filter function available in the `FilterableTreeViewElement` JavaScript class, which is part of\nthe Primer source code.\n\n### Events\n\nCurrently `FilterableTreeView` does not emit any events aside from the events already emitted by the `TreeView`\ncomponent.",
|
|
@@ -20571,6 +20648,71 @@
|
|
|
20571
20648
|
],
|
|
20572
20649
|
"subcomponents": []
|
|
20573
20650
|
},
|
|
20651
|
+
{
|
|
20652
|
+
"fully_qualified_name": "Primer::OpenProject::InlineMessage",
|
|
20653
|
+
"description": "A simple component to render warning text.\n\nThe warning text is rendered in the \"attention\" Primer color and\nuses a leading alert Octicon for additional emphasis. This component\nis designed to be used \"inline\", e.g. table cells, and in places\nwhere a Banner component might be overkill.",
|
|
20654
|
+
"accessibility_docs": null,
|
|
20655
|
+
"is_form_component": false,
|
|
20656
|
+
"is_published": true,
|
|
20657
|
+
"requires_js": false,
|
|
20658
|
+
"component": "OpenProject::InlineMessage",
|
|
20659
|
+
"status": "open_project",
|
|
20660
|
+
"a11y_reviewed": false,
|
|
20661
|
+
"short_name": "OpenProjectInlineMessage",
|
|
20662
|
+
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/inline_message.rb",
|
|
20663
|
+
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/inline_message/default/",
|
|
20664
|
+
"parameters": [
|
|
20665
|
+
{
|
|
20666
|
+
"name": "scheme",
|
|
20667
|
+
"type": "Symbol",
|
|
20668
|
+
"default": "N/A",
|
|
20669
|
+
"description": "One of `:critical`, `:success`, `:unavailable`, or `:warning`."
|
|
20670
|
+
},
|
|
20671
|
+
{
|
|
20672
|
+
"name": "size",
|
|
20673
|
+
"type": "Symbol",
|
|
20674
|
+
"default": "`:medium`",
|
|
20675
|
+
"description": "One of `:medium` or `:small`."
|
|
20676
|
+
},
|
|
20677
|
+
{
|
|
20678
|
+
"name": "system_arguments",
|
|
20679
|
+
"type": "Hash",
|
|
20680
|
+
"default": "N/A",
|
|
20681
|
+
"description": "{{link_to_system_arguments_docs}}"
|
|
20682
|
+
}
|
|
20683
|
+
],
|
|
20684
|
+
"slots": [],
|
|
20685
|
+
"methods": [],
|
|
20686
|
+
"previews": [
|
|
20687
|
+
{
|
|
20688
|
+
"preview_path": "primer/open_project/inline_message/default",
|
|
20689
|
+
"name": "default",
|
|
20690
|
+
"snapshot": "true",
|
|
20691
|
+
"skip_rules": {
|
|
20692
|
+
"wont_fix": [
|
|
20693
|
+
"region"
|
|
20694
|
+
],
|
|
20695
|
+
"will_fix": [
|
|
20696
|
+
"color-contrast"
|
|
20697
|
+
]
|
|
20698
|
+
}
|
|
20699
|
+
},
|
|
20700
|
+
{
|
|
20701
|
+
"preview_path": "primer/open_project/inline_message/playground",
|
|
20702
|
+
"name": "playground",
|
|
20703
|
+
"snapshot": "false",
|
|
20704
|
+
"skip_rules": {
|
|
20705
|
+
"wont_fix": [
|
|
20706
|
+
"region"
|
|
20707
|
+
],
|
|
20708
|
+
"will_fix": [
|
|
20709
|
+
"color-contrast"
|
|
20710
|
+
]
|
|
20711
|
+
}
|
|
20712
|
+
}
|
|
20713
|
+
],
|
|
20714
|
+
"subcomponents": []
|
|
20715
|
+
},
|
|
20574
20716
|
{
|
|
20575
20717
|
"fully_qualified_name": "Primer::OpenProject::InputGroup",
|
|
20576
20718
|
"description": "`InputGroup` is composed of a text field input with a trailing action",
|
data/static/previews.json
CHANGED
|
@@ -5104,6 +5104,40 @@
|
|
|
5104
5104
|
}
|
|
5105
5105
|
]
|
|
5106
5106
|
},
|
|
5107
|
+
{
|
|
5108
|
+
"name": "inline_message",
|
|
5109
|
+
"component": "OpenProject::InlineMessage",
|
|
5110
|
+
"status": "open_project",
|
|
5111
|
+
"lookup_path": "primer/open_project/inline_message",
|
|
5112
|
+
"examples": [
|
|
5113
|
+
{
|
|
5114
|
+
"preview_path": "primer/open_project/inline_message/default",
|
|
5115
|
+
"name": "default",
|
|
5116
|
+
"snapshot": "true",
|
|
5117
|
+
"skip_rules": {
|
|
5118
|
+
"wont_fix": [
|
|
5119
|
+
"region"
|
|
5120
|
+
],
|
|
5121
|
+
"will_fix": [
|
|
5122
|
+
"color-contrast"
|
|
5123
|
+
]
|
|
5124
|
+
}
|
|
5125
|
+
},
|
|
5126
|
+
{
|
|
5127
|
+
"preview_path": "primer/open_project/inline_message/playground",
|
|
5128
|
+
"name": "playground",
|
|
5129
|
+
"snapshot": "false",
|
|
5130
|
+
"skip_rules": {
|
|
5131
|
+
"wont_fix": [
|
|
5132
|
+
"region"
|
|
5133
|
+
],
|
|
5134
|
+
"will_fix": [
|
|
5135
|
+
"color-contrast"
|
|
5136
|
+
]
|
|
5137
|
+
}
|
|
5138
|
+
}
|
|
5139
|
+
]
|
|
5140
|
+
},
|
|
5107
5141
|
{
|
|
5108
5142
|
"name": "input_group",
|
|
5109
5143
|
"component": "OpenProject::InputGroup",
|
data/static/statuses.json
CHANGED
|
@@ -151,12 +151,15 @@
|
|
|
151
151
|
"Primer::OpenProject::DragHandle": "open_project",
|
|
152
152
|
"Primer::OpenProject::FeedbackDialog": "open_project",
|
|
153
153
|
"Primer::OpenProject::FeedbackMessage": "open_project",
|
|
154
|
+
"Primer::OpenProject::Fieldset": "open_project",
|
|
155
|
+
"Primer::OpenProject::Fieldset::LegendComponent": "open_project",
|
|
154
156
|
"Primer::OpenProject::FilterableTreeView": "alpha",
|
|
155
157
|
"Primer::OpenProject::FilterableTreeView::SubTree": "alpha",
|
|
156
158
|
"Primer::OpenProject::FlexLayout": "open_project",
|
|
157
159
|
"Primer::OpenProject::GridLayout": "open_project",
|
|
158
160
|
"Primer::OpenProject::GridLayout::Area": "open_project",
|
|
159
161
|
"Primer::OpenProject::Heading": "open_project",
|
|
162
|
+
"Primer::OpenProject::InlineMessage": "open_project",
|
|
160
163
|
"Primer::OpenProject::InputGroup": "open_project",
|
|
161
164
|
"Primer::OpenProject::PageHeader": "open_project",
|
|
162
165
|
"Primer::OpenProject::PageHeader::Dialog": "open_project",
|