sdr_view_components 0.6.0 → 0.8.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/README.md +35 -0
- data/app/assets/sdr_view_components.css +8 -0
- data/app/components/sdr_view_components/elements/navigation/dropdown_divider_component.rb +23 -0
- data/app/components/sdr_view_components/elements/navigation/dropdown_header_component.rb +26 -0
- data/app/components/sdr_view_components/elements/navigation/dropdown_link_component.rb +29 -0
- data/app/components/sdr_view_components/elements/navigation/nav_item_component.rb +8 -3
- data/app/components/sdr_view_components/forms/fieldset_component.html.erb +17 -0
- data/app/components/sdr_view_components/forms/fieldset_component.rb +43 -0
- data/app/components/sdr_view_components/forms/has_one_component.html.erb +7 -0
- data/app/components/sdr_view_components/forms/has_one_component.rb +30 -0
- data/app/components/sdr_view_components/tab_form/tabbed_form_builder.rb +1 -1
- data/lib/sdr_view_components/version.rb +1 -1
- data/spec/components/previews/sdr_view_components/elements/navigation/dropdown_menu_component_preview/default.html.erb +10 -0
- data/spec/components/previews/sdr_view_components/elements/navigation/dropdown_menu_component_preview/with_header_and_divider.html.erb +16 -0
- data/spec/components/previews/sdr_view_components/elements/navigation/dropdown_menu_component_preview.rb +13 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_validation_error.html.erb +1 -0
- data/spec/components/previews/sdr_view_components/forms/fieldset_component_preview/default.html.erb +10 -0
- data/spec/components/previews/sdr_view_components/forms/fieldset_component_preview/hidden_label.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/fieldset_component_preview/mark_required.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/fieldset_component_preview/with_help_link.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/fieldset_component_preview/with_help_text.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/fieldset_component_preview/with_legend_slot.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/fieldset_component_preview/with_tooltip.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/fieldset_component_preview.rb +25 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_validation_error.html.erb +1 -0
- metadata +19 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2a7f0502701fd4d8fa40f595c582e8d3639edd747efabae9a9453386b23c3bff
|
|
4
|
+
data.tar.gz: 17b95f5d8d01a6af4af3dbb8a0d15b9a843a03e44ab8428793de0fae84dcaf79
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6411da75700daee1d917a8bd7bdc47cdebe312af9d63b535a974d5114fee4697024532d7b31fa95150b5f4fa438897df0e97a7500dddfef7907e05a5b0fc1aa8
|
|
7
|
+
data.tar.gz: 4a062e6024b31b4c83439615ecfd6533f293b8798d36327c3dca1280a56ac9e041b205a2e92f6509ba4d5deb78ff460cfc4593ded78feddd4f46395267459ee3
|
data/README.md
CHANGED
|
@@ -125,6 +125,10 @@ Each of the supported components above uses the provided "basic" components:
|
|
|
125
125
|
|
|
126
126
|
At a minimum, each of these components must be provided wih the `form:` and `field_name:` parameters. Additionally, you can provide additional parameters that will be passed to the standard ActionView::Helpers::Tag.
|
|
127
127
|
|
|
128
|
+
#### Fieldset component
|
|
129
|
+
|
|
130
|
+
`SdrViewComponents::Forms::FieldsetComponent` renders a `<fieldset>` for grouping related fields (e.g. a set of checkboxes) that don't belong to a single bound form field. It supports a `label:` (or a `legend` slot for custom markup), `tooltip:`, `mark_required:`, `help_text:`, and a `help_link` slot. Any other keyword arguments (`id:`, `data:`, `aria:`, etc.) are passed through to the `<fieldset>` tag.
|
|
131
|
+
|
|
128
132
|
### Tab form components
|
|
129
133
|
|
|
130
134
|
SdrViewComponents provides components for rendering a tabbed form, where a form's fields are split across tabs rather than shown all at once:
|
|
@@ -185,6 +189,37 @@ See the Lookbook preview for `SdrViewComponents::TabForm::TabListComponent` for
|
|
|
185
189
|
<% render SdrViewComponent::....>
|
|
186
190
|
```
|
|
187
191
|
|
|
192
|
+
### Navigation components
|
|
193
|
+
|
|
194
|
+
SdrViewComponents provides components for building navigation bar items and dropdown menus:
|
|
195
|
+
|
|
196
|
+
- `SdrViewComponents::Elements::Navigation::NavItemComponent` -- a single navigation link (or plain text, if no `path:` is given).
|
|
197
|
+
- `SdrViewComponents::Elements::Navigation::DropdownMenuComponent` -- a Bootstrap dropdown menu. Items are added via `with_item`, and can be any renderable object -- typically one of the components below.
|
|
198
|
+
- `SdrViewComponents::Elements::Navigation::DropdownLinkComponent` -- a link within a dropdown menu (renders with the `dropdown-item` class via `link_to`). Accepts `label:`, `link:`, `classes:`, `disabled:` (adds the `disabled` class), and any additional options passed on to `link_to`.
|
|
199
|
+
- `SdrViewComponents::Elements::Navigation::DropdownHeaderComponent` -- a non-interactive section label within a dropdown menu.
|
|
200
|
+
- `SdrViewComponents::Elements::Navigation::DropdownDividerComponent` -- a horizontal divider between groups of items within a dropdown menu.
|
|
201
|
+
|
|
202
|
+
```erb
|
|
203
|
+
<ul class="navbar-nav">
|
|
204
|
+
<%= render SdrViewComponents::Elements::Navigation::NavItemComponent.new(text: 'Home', path: '/') %>
|
|
205
|
+
|
|
206
|
+
<%= render SdrViewComponents::Elements::Navigation::DropdownMenuComponent.new(text: 'Options') do |dropdown| %>
|
|
207
|
+
<% dropdown.with_item do %>
|
|
208
|
+
<%= render SdrViewComponents::Elements::Navigation::DropdownHeaderComponent.new(text: 'Section 1') %>
|
|
209
|
+
<% end %>
|
|
210
|
+
<% dropdown.with_item do %>
|
|
211
|
+
<%= render SdrViewComponents::Elements::Navigation::DropdownLinkComponent.new(label: 'Action', link: '#') %>
|
|
212
|
+
<% end %>
|
|
213
|
+
<% dropdown.with_item do %>
|
|
214
|
+
<%= render SdrViewComponents::Elements::Navigation::DropdownDividerComponent.new %>
|
|
215
|
+
<% end %>
|
|
216
|
+
<% dropdown.with_item do %>
|
|
217
|
+
<%= render SdrViewComponents::Elements::Navigation::DropdownLinkComponent.new(label: 'Another action', link: '#') %>
|
|
218
|
+
<% end %>
|
|
219
|
+
<% end %>
|
|
220
|
+
</ul>
|
|
221
|
+
```
|
|
222
|
+
|
|
188
223
|
## Component library version
|
|
189
224
|
The [component-library](https://github.com/sul-dlss/component-library/) version is set in `lib/sdr_view_components/configuration.rb`.
|
|
190
225
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
module Navigation
|
|
6
|
+
# Component for rendering a divider within a dropdown menu.
|
|
7
|
+
class DropdownDividerComponent < BaseComponent
|
|
8
|
+
def initialize(classes: [])
|
|
9
|
+
@classes = classes
|
|
10
|
+
super()
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def call
|
|
14
|
+
tag.hr class: classes
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def classes
|
|
18
|
+
merge_classes('dropdown-divider', @classes)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
module Navigation
|
|
6
|
+
# Component for rendering a header within a dropdown menu.
|
|
7
|
+
class DropdownHeaderComponent < BaseComponent
|
|
8
|
+
def initialize(text:, classes: [])
|
|
9
|
+
@text = text
|
|
10
|
+
@classes = classes
|
|
11
|
+
super()
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
attr_reader :text
|
|
15
|
+
|
|
16
|
+
def call
|
|
17
|
+
tag.span text, class: classes, role: 'heading'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def classes
|
|
21
|
+
merge_classes('dropdown-header', @classes)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
module Navigation
|
|
6
|
+
# Component for rendering a link within a dropdown menu.
|
|
7
|
+
class DropdownLinkComponent < BaseComponent
|
|
8
|
+
def initialize(label:, link:, classes: [], disabled: false, **options)
|
|
9
|
+
@label = label
|
|
10
|
+
@link = link
|
|
11
|
+
@classes = classes
|
|
12
|
+
@disabled = disabled
|
|
13
|
+
@options = options
|
|
14
|
+
super()
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
attr_reader :label, :link, :disabled
|
|
18
|
+
|
|
19
|
+
def call
|
|
20
|
+
link_to label, link, class: classes, **@options
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def classes
|
|
24
|
+
merge_classes('dropdown-item', disabled ? 'disabled' : nil, @classes)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -5,10 +5,11 @@ module SdrViewComponents
|
|
|
5
5
|
module Navigation
|
|
6
6
|
# Component for navigation item link.
|
|
7
7
|
class NavItemComponent < BaseComponent
|
|
8
|
-
def initialize(text:, path: nil, data: {})
|
|
8
|
+
def initialize(text:, path: nil, data: {}, classes: [])
|
|
9
9
|
@text = text
|
|
10
10
|
@path = path
|
|
11
11
|
@data = data
|
|
12
|
+
@classes = classes
|
|
12
13
|
super()
|
|
13
14
|
end
|
|
14
15
|
|
|
@@ -17,12 +18,16 @@ module SdrViewComponents
|
|
|
17
18
|
def call
|
|
18
19
|
tag.li class: 'nav-item' do
|
|
19
20
|
if path.present?
|
|
20
|
-
link_to text, path, class:
|
|
21
|
+
link_to text, path, class: classes, data:
|
|
21
22
|
else
|
|
22
|
-
tag.span text, class:
|
|
23
|
+
tag.span text, class: classes
|
|
23
24
|
end
|
|
24
25
|
end
|
|
25
26
|
end
|
|
27
|
+
|
|
28
|
+
def classes
|
|
29
|
+
merge_classes('nav-link', @classes)
|
|
30
|
+
end
|
|
26
31
|
end
|
|
27
32
|
end
|
|
28
33
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%= tag.fieldset class: classes, **options do %>
|
|
2
|
+
<% if legend? || label %>
|
|
3
|
+
<%= tag.legend class: legend_classes do %>
|
|
4
|
+
<% if legend? %>
|
|
5
|
+
<%= legend %>
|
|
6
|
+
<% else %>
|
|
7
|
+
<%= tag.label class: label_classes do %><%= label %><% end %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<%= render SdrViewComponents::Elements::TooltipComponent.new(target_label: label, tooltip:) %>
|
|
10
|
+
<%= help_link if help_link? %>
|
|
11
|
+
<% if help_text.present? %>
|
|
12
|
+
<p class="mb-2"><%= help_text %></p>
|
|
13
|
+
<% end %>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% end %>
|
|
16
|
+
<%= content %>
|
|
17
|
+
<% end %>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Forms
|
|
5
|
+
# Component for rendering a form fieldset.
|
|
6
|
+
class FieldsetComponent < BaseComponent
|
|
7
|
+
renders_one :legend # Provide legend or label
|
|
8
|
+
renders_one :help_link # Optional
|
|
9
|
+
|
|
10
|
+
def initialize(label: nil, hidden_label: false, classes: [], label_classes: [], legend_classes: [], # rubocop:disable Metrics/ParameterLists
|
|
11
|
+
tooltip: nil, mark_required: false, help_text: nil, **options)
|
|
12
|
+
@label = label
|
|
13
|
+
@hidden_label = hidden_label
|
|
14
|
+
@classes = classes
|
|
15
|
+
@label_classes = label_classes
|
|
16
|
+
@legend_classes = legend_classes
|
|
17
|
+
@tooltip = tooltip
|
|
18
|
+
@options = options
|
|
19
|
+
@mark_required = mark_required
|
|
20
|
+
@help_text = help_text
|
|
21
|
+
super()
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
attr_reader :options, :tooltip, :mark_required, :help_text
|
|
25
|
+
|
|
26
|
+
def label_classes
|
|
27
|
+
merge_classes(@label_classes, @hidden_label ? 'visually-hidden' : 'form-label fw-bold')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def label
|
|
31
|
+
mark_label_required(label: @label, mark_required:) if @label.present?
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def classes
|
|
35
|
+
merge_classes('form-fieldset', @classes)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def legend_classes
|
|
39
|
+
merge_classes(@legend_classes)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%= render SdrViewComponents::Forms::FieldsetComponent.new(**fieldset_args) do %>
|
|
2
|
+
<%= tag.div class: 'mb-3' do %>
|
|
3
|
+
<%= form.fields_for field_name do |nested_form| %>
|
|
4
|
+
<%= render form_component.new(form: nested_form, **form_component_args) %>
|
|
5
|
+
<% end %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<% end %>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Forms
|
|
5
|
+
# Encapsulates a has_one (non-repeatable) form.
|
|
6
|
+
class HasOneComponent < BaseComponent
|
|
7
|
+
def initialize(form:, field_name:, form_component:, **args)
|
|
8
|
+
@form = form
|
|
9
|
+
@field_name = field_name
|
|
10
|
+
@form_component = form_component
|
|
11
|
+
@args = args
|
|
12
|
+
super()
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
attr_reader :form, :field_name, :form_component, :args
|
|
16
|
+
|
|
17
|
+
# Returns a hash of arguments for the fieldset component.
|
|
18
|
+
# Includes argument prefixed with 'fieldset_'.
|
|
19
|
+
def fieldset_args
|
|
20
|
+
args_for(args:, prefix: 'fieldset_')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Returns a hash of arguments for the form component.
|
|
24
|
+
# Includes argument prefixed with 'form_'.
|
|
25
|
+
def form_component_args
|
|
26
|
+
args_for(args:, prefix: 'form_')
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -14,7 +14,7 @@ module SdrViewComponents
|
|
|
14
14
|
# created via `fields_for`, by falling back to the parent builder's `id`. Rails' `fields_for`
|
|
15
15
|
# doesn't otherwise propagate the `html: { id: }` option to nested builders.
|
|
16
16
|
class TabbedFormBuilder < ActionView::Helpers::FormBuilder
|
|
17
|
-
FIELD_METHODS = %i[text_field email_field textarea text_area hidden_field file_field radio_button
|
|
17
|
+
FIELD_METHODS = %i[text_field email_field textarea text_area hidden_field file_field radio_button check_box
|
|
18
18
|
date_field].freeze
|
|
19
19
|
|
|
20
20
|
FIELD_METHODS.each do |field_method|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<ul class="navbar-nav">
|
|
2
|
+
<%= render SdrViewComponents::Elements::Navigation::DropdownMenuComponent.new(text: 'Options') do |dropdown| %>
|
|
3
|
+
<% dropdown.with_item do %>
|
|
4
|
+
<%= render SdrViewComponents::Elements::Navigation::DropdownLinkComponent.new(label: 'Action', link: '#') %>
|
|
5
|
+
<% end %>
|
|
6
|
+
<% dropdown.with_item do %>
|
|
7
|
+
<%= render SdrViewComponents::Elements::Navigation::DropdownLinkComponent.new(label: 'Another action', link: '#') %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% end %>
|
|
10
|
+
</ul>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<ul class="navbar-nav">
|
|
2
|
+
<%= render SdrViewComponents::Elements::Navigation::DropdownMenuComponent.new(text: 'Options') do |dropdown| %>
|
|
3
|
+
<% dropdown.with_item do %>
|
|
4
|
+
<%= render SdrViewComponents::Elements::Navigation::DropdownHeaderComponent.new(text: 'Section 1') %>
|
|
5
|
+
<% end %>
|
|
6
|
+
<% dropdown.with_item do %>
|
|
7
|
+
<%= render SdrViewComponents::Elements::Navigation::DropdownLinkComponent.new(label: 'Action', link: '#') %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% dropdown.with_item do %>
|
|
10
|
+
<%= render SdrViewComponents::Elements::Navigation::DropdownDividerComponent.new %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% dropdown.with_item do %>
|
|
13
|
+
<%= render SdrViewComponents::Elements::Navigation::DropdownLinkComponent.new(label: 'Another action', link: '#') %>
|
|
14
|
+
<% end %>
|
|
15
|
+
<% end %>
|
|
16
|
+
</ul>
|
data/spec/components/previews/sdr_view_components/forms/fieldset_component_preview/default.html.erb
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<%= render SdrViewComponents::Forms::FieldsetComponent.new(label: 'Contributors') do %>
|
|
2
|
+
<div class="form-check">
|
|
3
|
+
<input class="form-check-input" type="checkbox" id="contributor1" name="contributor1">
|
|
4
|
+
<label class="form-check-label" for="contributor1">Jane Stanford</label>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="form-check">
|
|
7
|
+
<input class="form-check-input" type="checkbox" id="contributor2" name="contributor2">
|
|
8
|
+
<label class="form-check-label" for="contributor2">Leland Stanford</label>
|
|
9
|
+
</div>
|
|
10
|
+
<% end %>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<%= render SdrViewComponents::Forms::FieldsetComponent.new(label: 'Contributors', hidden_label: true) do %>
|
|
2
|
+
<div class="form-check">
|
|
3
|
+
<input class="form-check-input" type="checkbox" id="contributor1" name="contributor1">
|
|
4
|
+
<label class="form-check-label" for="contributor1">Jane Stanford</label>
|
|
5
|
+
</div>
|
|
6
|
+
<% end %>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<%= render SdrViewComponents::Forms::FieldsetComponent.new(label: 'Contributors', mark_required: true) do %>
|
|
2
|
+
<div class="form-check">
|
|
3
|
+
<input class="form-check-input" type="checkbox" id="contributor1" name="contributor1">
|
|
4
|
+
<label class="form-check-label" for="contributor1">Jane Stanford</label>
|
|
5
|
+
</div>
|
|
6
|
+
<% end %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%= render SdrViewComponents::Forms::FieldsetComponent.new(label: 'Contributors') do |component| %>
|
|
2
|
+
<% component.with_help_link do %>
|
|
3
|
+
<a href="#" class="ms-2">What is a contributor?</a>
|
|
4
|
+
<% end %>
|
|
5
|
+
<div class="form-check">
|
|
6
|
+
<input class="form-check-input" type="checkbox" id="contributor1" name="contributor1">
|
|
7
|
+
<label class="form-check-label" for="contributor1">Jane Stanford</label>
|
|
8
|
+
</div>
|
|
9
|
+
<% end %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%= render SdrViewComponents::Forms::FieldsetComponent.new(
|
|
2
|
+
label: 'Contributors',
|
|
3
|
+
help_text: 'Add every contributor who created this resource.'
|
|
4
|
+
) do %>
|
|
5
|
+
<div class="form-check">
|
|
6
|
+
<input class="form-check-input" type="checkbox" id="contributor1" name="contributor1">
|
|
7
|
+
<label class="form-check-label" for="contributor1">Jane Stanford</label>
|
|
8
|
+
</div>
|
|
9
|
+
<% end %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%= render SdrViewComponents::Forms::FieldsetComponent.new do |component| %>
|
|
2
|
+
<% component.with_legend do %>
|
|
3
|
+
<span class="form-label fw-bold">Contributors <em>(custom legend markup)</em></span>
|
|
4
|
+
<% end %>
|
|
5
|
+
<div class="form-check">
|
|
6
|
+
<input class="form-check-input" type="checkbox" id="contributor1" name="contributor1">
|
|
7
|
+
<label class="form-check-label" for="contributor1">Jane Stanford</label>
|
|
8
|
+
</div>
|
|
9
|
+
<% end %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<%= render SdrViewComponents::Forms::FieldsetComponent.new(
|
|
2
|
+
label: 'Contributors',
|
|
3
|
+
tooltip: 'Select every contributor who created this resource.'
|
|
4
|
+
) do %>
|
|
5
|
+
<div class="form-check">
|
|
6
|
+
<input class="form-check-input" type="checkbox" id="contributor1" name="contributor1">
|
|
7
|
+
<label class="form-check-label" for="contributor1">Jane Stanford</label>
|
|
8
|
+
</div>
|
|
9
|
+
<% end %>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Forms
|
|
5
|
+
class FieldsetComponentPreview < ViewComponent::Preview
|
|
6
|
+
def default; end
|
|
7
|
+
|
|
8
|
+
# @!group Label options
|
|
9
|
+
def hidden_label; end
|
|
10
|
+
|
|
11
|
+
def mark_required; end
|
|
12
|
+
|
|
13
|
+
def with_tooltip; end
|
|
14
|
+
|
|
15
|
+
def with_legend_slot; end
|
|
16
|
+
# @!endgroup
|
|
17
|
+
|
|
18
|
+
# @!group Help
|
|
19
|
+
def with_help_text; end
|
|
20
|
+
|
|
21
|
+
def with_help_link; end
|
|
22
|
+
# @!endgroup
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sdr_view_components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aaron Collier
|
|
@@ -88,6 +88,9 @@ files:
|
|
|
88
88
|
- app/components/sdr_view_components/elements/modal_component.rb
|
|
89
89
|
- app/components/sdr_view_components/elements/nav_link_component.html.erb
|
|
90
90
|
- app/components/sdr_view_components/elements/nav_link_component.rb
|
|
91
|
+
- app/components/sdr_view_components/elements/navigation/dropdown_divider_component.rb
|
|
92
|
+
- app/components/sdr_view_components/elements/navigation/dropdown_header_component.rb
|
|
93
|
+
- app/components/sdr_view_components/elements/navigation/dropdown_link_component.rb
|
|
91
94
|
- app/components/sdr_view_components/elements/navigation/dropdown_menu_component.html.erb
|
|
92
95
|
- app/components/sdr_view_components/elements/navigation/dropdown_menu_component.rb
|
|
93
96
|
- app/components/sdr_view_components/elements/navigation/nav_item_component.rb
|
|
@@ -117,7 +120,11 @@ files:
|
|
|
117
120
|
- app/components/sdr_view_components/forms/checkbox_component.rb
|
|
118
121
|
- app/components/sdr_view_components/forms/field_component.html.erb
|
|
119
122
|
- app/components/sdr_view_components/forms/field_component.rb
|
|
123
|
+
- app/components/sdr_view_components/forms/fieldset_component.html.erb
|
|
124
|
+
- app/components/sdr_view_components/forms/fieldset_component.rb
|
|
120
125
|
- app/components/sdr_view_components/forms/file_component.rb
|
|
126
|
+
- app/components/sdr_view_components/forms/has_one_component.html.erb
|
|
127
|
+
- app/components/sdr_view_components/forms/has_one_component.rb
|
|
121
128
|
- app/components/sdr_view_components/forms/help_text_component.html.erb
|
|
122
129
|
- app/components/sdr_view_components/forms/help_text_component.rb
|
|
123
130
|
- app/components/sdr_view_components/forms/invalid_feedback_component.rb
|
|
@@ -197,6 +204,9 @@ files:
|
|
|
197
204
|
- spec/components/previews/sdr_view_components/elements/modal_component_preview/default.html.erb
|
|
198
205
|
- spec/components/previews/sdr_view_components/elements/modal_component_preview/with_header_and_footer.html.erb
|
|
199
206
|
- spec/components/previews/sdr_view_components/elements/modal_component_preview/without_size.html.erb
|
|
207
|
+
- spec/components/previews/sdr_view_components/elements/navigation/dropdown_menu_component_preview.rb
|
|
208
|
+
- spec/components/previews/sdr_view_components/elements/navigation/dropdown_menu_component_preview/default.html.erb
|
|
209
|
+
- spec/components/previews/sdr_view_components/elements/navigation/dropdown_menu_component_preview/with_header_and_divider.html.erb
|
|
200
210
|
- spec/components/previews/sdr_view_components/elements/progress_bar_component_preview.rb
|
|
201
211
|
- spec/components/previews/sdr_view_components/elements/spinner_component_preview.rb
|
|
202
212
|
- spec/components/previews/sdr_view_components/elements/tabs/tab_list_component_preview.rb
|
|
@@ -242,6 +252,14 @@ files:
|
|
|
242
252
|
- spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_help_text.html.erb
|
|
243
253
|
- spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_label.html.erb
|
|
244
254
|
- spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_validation_error.html.erb
|
|
255
|
+
- spec/components/previews/sdr_view_components/forms/fieldset_component_preview.rb
|
|
256
|
+
- spec/components/previews/sdr_view_components/forms/fieldset_component_preview/default.html.erb
|
|
257
|
+
- spec/components/previews/sdr_view_components/forms/fieldset_component_preview/hidden_label.html.erb
|
|
258
|
+
- spec/components/previews/sdr_view_components/forms/fieldset_component_preview/mark_required.html.erb
|
|
259
|
+
- spec/components/previews/sdr_view_components/forms/fieldset_component_preview/with_help_link.html.erb
|
|
260
|
+
- spec/components/previews/sdr_view_components/forms/fieldset_component_preview/with_help_text.html.erb
|
|
261
|
+
- spec/components/previews/sdr_view_components/forms/fieldset_component_preview/with_legend_slot.html.erb
|
|
262
|
+
- spec/components/previews/sdr_view_components/forms/fieldset_component_preview/with_tooltip.html.erb
|
|
245
263
|
- spec/components/previews/sdr_view_components/forms/file_component_preview.rb
|
|
246
264
|
- spec/components/previews/sdr_view_components/forms/file_component_preview/default.html.erb
|
|
247
265
|
- spec/components/previews/sdr_view_components/forms/file_component_preview/with_additional_container_content.html.erb
|