sdr_view_components 0.2.0 → 0.3.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/Rakefile +31 -5
- data/app/assets/sdr_view_components.css +9 -1
- data/app/components/sdr_view_components/elements/toast_component.html.erb +4 -8
- data/app/components/sdr_view_components/forms/basic_select_field_component.rb +24 -0
- data/app/components/sdr_view_components/forms/select_field_component.rb +20 -0
- data/app/components/sdr_view_components/forms/toggle_component.html.erb +1 -1
- data/app/components/sdr_view_components/forms/toggle_option_component.html.erb +1 -1
- data/app/components/sdr_view_components/tables/row_component.html.erb +1 -1
- data/app/views/layouts/lookbook.html.erb +1 -2
- data/lib/sdr_view_components/version.rb +1 -1
- data/spec/components/previews/sdr_view_components/elements/alert_component_preview.rb +71 -0
- data/spec/components/previews/sdr_view_components/elements/banner_component_preview.rb +58 -0
- data/spec/components/previews/sdr_view_components/elements/breadcrumb_nav_component_preview.rb +52 -0
- data/spec/components/previews/sdr_view_components/elements/button_component_preview.rb +71 -0
- data/spec/components/previews/sdr_view_components/elements/button_form_component_preview.rb +97 -0
- data/spec/components/previews/sdr_view_components/elements/button_link_component_preview.rb +81 -0
- data/spec/components/previews/sdr_view_components/elements/card_component_preview.rb +41 -0
- data/spec/components/previews/sdr_view_components/elements/heading_component_preview.rb +51 -0
- data/spec/components/previews/sdr_view_components/elements/horizontal_rule_component_preview/default.html.erb +5 -0
- data/spec/components/previews/sdr_view_components/elements/horizontal_rule_component_preview.rb +9 -0
- data/spec/components/previews/sdr_view_components/elements/icon_button_component_preview.rb +17 -0
- data/spec/components/previews/sdr_view_components/elements/icon_button_link_component_preview.rb +15 -0
- data/spec/components/previews/sdr_view_components/elements/modal_component_preview/default.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/elements/modal_component_preview/with_header_and_footer.html.erb +19 -0
- data/spec/components/previews/sdr_view_components/elements/modal_component_preview/without_size.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/elements/modal_component_preview.rb +15 -0
- data/spec/components/previews/sdr_view_components/elements/progress_bar_component_preview.rb +97 -0
- data/spec/components/previews/sdr_view_components/elements/spinner_component_preview.rb +83 -0
- data/spec/components/previews/sdr_view_components/elements/tabs/tab_list_component_preview/default_variant.html.erb +12 -0
- data/spec/components/previews/sdr_view_components/elements/tabs/tab_list_component_preview/underline_variant.html.erb +12 -0
- data/spec/components/previews/sdr_view_components/elements/tabs/tab_list_component_preview/with_header.html.erb +16 -0
- data/spec/components/previews/sdr_view_components/elements/tabs/tab_list_component_preview.rb +16 -0
- data/spec/components/previews/sdr_view_components/elements/toast_component_preview.rb +29 -0
- data/spec/components/previews/sdr_view_components/elements/tooltip_component_preview/default.html.erb +13 -0
- data/spec/components/previews/sdr_view_components/elements/tooltip_component_preview.rb +9 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview/checked.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview/default.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview/disabled.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview.rb +17 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/default.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/with_accept.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/with_multiple.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/with_required.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview.rb +25 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/checked.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/default.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/disabled.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview.rb +17 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_select_field_component_preview/default.html.erb +11 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_select_field_component_preview/with_prompt.html.erb +12 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_select_field_component_preview.rb +13 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/default.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_placeholder.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_required.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_rows.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview.rb +19 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/default.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/disabled.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/required.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/with_placeholder.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview.rb +19 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/checked.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/default.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/disabled.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_additional_container_content.html.erb +12 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_help_text.html.erb +10 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_label.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_validation_error.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview.rb +33 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/default.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_additional_container_content.html.erb +14 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_help_text.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_help_text_below.html.erb +10 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_label.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_multiple.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_validation_error.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview.rb +32 -0
- data/spec/components/previews/sdr_view_components/forms/help_text_component_preview/with_block_content.html.erb +3 -0
- data/spec/components/previews/sdr_view_components/forms/help_text_component_preview/with_text.html.erb +4 -0
- data/spec/components/previews/sdr_view_components/forms/help_text_component_preview.rb +13 -0
- data/spec/components/previews/sdr_view_components/forms/label_component_preview/default.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/label_component_preview/hidden_label.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/label_component_preview/with_caption.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/label_component_preview/with_tooltip.html.erb +17 -0
- data/spec/components/previews/sdr_view_components/forms/label_component_preview.rb +17 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/default.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_additional_container_content.html.erb +14 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_disabled_label.html.erb +11 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_help_text.html.erb +10 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_help_text_below.html.erb +11 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_label.html.erb +10 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_validation_error.html.erb +10 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview.rb +34 -0
- data/spec/components/previews/sdr_view_components/forms/select_field_component_preview/default.html.erb +13 -0
- data/spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_additional_container_content.html.erb +19 -0
- data/spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_help_text.html.erb +14 -0
- data/spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_help_text_below.html.erb +15 -0
- data/spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_prompt.html.erb +14 -0
- data/spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_validation_error.html.erb +15 -0
- data/spec/components/previews/sdr_view_components/forms/select_field_component_preview.rb +30 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/danger.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/default.html.erb +5 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/info.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/primary.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/secondary.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/success.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/warning.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/with_block_content_and_value.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/with_form_id.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview.rb +29 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/default.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_additional_container_content.html.erb +12 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_help_text.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_help_text_below.html.erb +10 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_hidden_label.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_mark_required.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_validation_error.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview.rb +32 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/default.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/disabled.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/label_hidden.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/marked_required.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/required.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_additional_container_content.html.erb +12 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_help_text.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_help_text_below.html.erb +10 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_placeholder.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_validation_error.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview.rb +40 -0
- data/spec/components/previews/sdr_view_components/forms/toggle_component_preview/default.html.erb +11 -0
- data/spec/components/previews/sdr_view_components/forms/toggle_component_preview/with_validation_error.html.erb +11 -0
- data/spec/components/previews/sdr_view_components/forms/toggle_component_preview.rb +20 -0
- data/spec/components/previews/sdr_view_components/structure/footer_component_preview.rb +11 -0
- data/spec/components/previews/sdr_view_components/structure/header_component_preview/dark_variant.html.erb +15 -0
- data/spec/components/previews/sdr_view_components/structure/header_component_preview/dark_variant_with_background_color.html.erb +15 -0
- data/spec/components/previews/sdr_view_components/structure/header_component_preview/light_variant.html.erb +15 -0
- data/spec/components/previews/sdr_view_components/structure/header_component_preview/no_rosette.html.erb +15 -0
- data/spec/components/previews/sdr_view_components/structure/header_component_preview/white_variant.html.erb +15 -0
- data/spec/components/previews/sdr_view_components/structure/header_component_preview.rb +16 -0
- data/spec/components/previews/sdr_view_components/tables/cell_component_preview/default.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/tables/cell_component_preview/with_colspan.html.erb +17 -0
- data/spec/components/previews/sdr_view_components/tables/cell_component_preview.rb +11 -0
- data/spec/components/previews/sdr_view_components/tables/header_component_preview/default.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/tables/header_component_preview/with_tooltip.html.erb +19 -0
- data/spec/components/previews/sdr_view_components/tables/header_component_preview.rb +11 -0
- data/spec/components/previews/sdr_view_components/tables/list_cell_component_preview/with_item_values.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/tables/list_cell_component_preview/with_items.html.erb +11 -0
- data/spec/components/previews/sdr_view_components/tables/list_cell_component_preview.rb +27 -0
- data/spec/components/previews/sdr_view_components/tables/raw_table_component_preview/default.html.erb +26 -0
- data/spec/components/previews/sdr_view_components/tables/raw_table_component_preview.rb +9 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/label_only.html.erb +5 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_cells.html.erb +13 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_first_value_and_values.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_label_content.html.erb +11 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_tooltip.html.erb +18 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_value.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_values.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview.rb +21 -0
- data/spec/components/previews/sdr_view_components/tables/table_component_preview.rb +81 -0
- metadata +152 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Tables
|
|
5
|
+
class ListCellComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Item sources
|
|
7
|
+
|
|
8
|
+
def with_item_values
|
|
9
|
+
render_with_template(locals: {
|
|
10
|
+
item_values: ['Published', 'Preserved', 'Available in SearchWorks']
|
|
11
|
+
})
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def with_items
|
|
15
|
+
render_with_template(locals: {
|
|
16
|
+
items: [
|
|
17
|
+
'Created by Digital Production Group',
|
|
18
|
+
'Reviewed by Metadata Services',
|
|
19
|
+
'Updated last week'
|
|
20
|
+
]
|
|
21
|
+
})
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# @!endgroup
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<%= render(SdrViewComponents::Tables::RawTableComponent.new(label: 'Custom Row Content')) do |component| %>
|
|
2
|
+
<% component.with_header(label: 'Item') %>
|
|
3
|
+
<% component.with_header(label: 'Status') %>
|
|
4
|
+
<% component.with_header(label: 'Description') %>
|
|
5
|
+
<% component.with_row do %>
|
|
6
|
+
<tr>
|
|
7
|
+
<td>Item 1</td>
|
|
8
|
+
<td><strong>Complete</strong></td>
|
|
9
|
+
<td>Custom HTML rendering</td>
|
|
10
|
+
</tr>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% component.with_row do %>
|
|
13
|
+
<tr>
|
|
14
|
+
<td>Item 2</td>
|
|
15
|
+
<td><em>In Progress</em></td>
|
|
16
|
+
<td><code>RawTableComponent</code> demo</td>
|
|
17
|
+
</tr>
|
|
18
|
+
<% end %>
|
|
19
|
+
<% component.with_row do %>
|
|
20
|
+
<tr>
|
|
21
|
+
<td>Item 3</td>
|
|
22
|
+
<td><u>Pending</u></td>
|
|
23
|
+
<td>Arbitrary HTML content</td>
|
|
24
|
+
</tr>
|
|
25
|
+
<% end %>
|
|
26
|
+
<% end %>
|
data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_cells.html.erb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<% row = SdrViewComponents::Tables::RowComponent.new(label: 'Content files') %>
|
|
2
|
+
<% row.with_cell do %>
|
|
3
|
+
image-0001.tif
|
|
4
|
+
<% end %>
|
|
5
|
+
<% row.with_cell do %>
|
|
6
|
+
image-0002.tif
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
<table class="table">
|
|
10
|
+
<tbody>
|
|
11
|
+
<%= render row %>
|
|
12
|
+
</tbody>
|
|
13
|
+
</table>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<% row = SdrViewComponents::Tables::RowComponent.new(value: 'Submitted') %>
|
|
2
|
+
<% row.with_label_content do %>
|
|
3
|
+
<strong>Deposit status</strong><br>
|
|
4
|
+
<small>Current workflow step</small>
|
|
5
|
+
<% end %>
|
|
6
|
+
|
|
7
|
+
<table class="table">
|
|
8
|
+
<tbody>
|
|
9
|
+
<%= render row %>
|
|
10
|
+
</tbody>
|
|
11
|
+
</table>
|
data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_tooltip.html.erb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<table class="table">
|
|
2
|
+
<tbody>
|
|
3
|
+
<%= render SdrViewComponents::Tables::RowComponent.new(
|
|
4
|
+
label: 'Embargo',
|
|
5
|
+
value: 'Ends 2027-01-15',
|
|
6
|
+
tooltip: 'Date when the item becomes visible to the public.'
|
|
7
|
+
) %>
|
|
8
|
+
</tbody>
|
|
9
|
+
</table>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
window.addEventListener('load', () => {
|
|
13
|
+
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
|
14
|
+
;[...tooltipTriggerList].forEach((tooltipTriggerEl) => {
|
|
15
|
+
window.bootstrap.Tooltip.getOrCreateInstance(tooltipTriggerEl)
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Tables
|
|
5
|
+
class RowComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Values
|
|
7
|
+
def with_values; end
|
|
8
|
+
def with_value; end
|
|
9
|
+
def with_cells; end
|
|
10
|
+
def with_first_value_and_values; end
|
|
11
|
+
# @!endgroup
|
|
12
|
+
|
|
13
|
+
# @!group Labels
|
|
14
|
+
def label_only; end
|
|
15
|
+
def with_label_content; end
|
|
16
|
+
# @!endgroup
|
|
17
|
+
|
|
18
|
+
def with_tooltip; end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Tables
|
|
5
|
+
class TableComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Variants
|
|
7
|
+
|
|
8
|
+
def h3_variant
|
|
9
|
+
render(SdrViewComponents::Tables::TableComponent.new(label: 'Sample Data')) do |component|
|
|
10
|
+
component.with_row(label: 'Item 1', values: ['Value A', 'Value B', 'Value C'])
|
|
11
|
+
component.with_row(label: 'Item 2', values: ['Value D', 'Value E', 'Value F'])
|
|
12
|
+
component.with_row(label: 'Item 3', values: ['Value G', 'Value H', 'Value I'])
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def data_variant
|
|
17
|
+
render(SdrViewComponents::Tables::TableComponent.new(label: 'Data Records', variant: :data)) do |component|
|
|
18
|
+
component.with_row(label: 'Record 1', values: %w[Alpha Beta Gamma])
|
|
19
|
+
component.with_row(label: 'Record 2', values: %w[Delta Epsilon Zeta])
|
|
20
|
+
component.with_row(label: 'Record 3', values: %w[Eta Theta Iota])
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# @!endgroup
|
|
25
|
+
|
|
26
|
+
# @!group Headers and Caption
|
|
27
|
+
|
|
28
|
+
def with_headers
|
|
29
|
+
render(SdrViewComponents::Tables::TableComponent.new(label: 'Headers Example')) do |component|
|
|
30
|
+
component.with_header(label: 'Column 1')
|
|
31
|
+
component.with_header(label: 'Column 2')
|
|
32
|
+
component.with_header(label: 'Column 3')
|
|
33
|
+
component.with_row(label: 'Row 1', values: ['Data 1', 'Data 2', 'Data 3'])
|
|
34
|
+
component.with_row(label: 'Row 2', values: ['Data 4', 'Data 5', 'Data 6'])
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def with_caption
|
|
39
|
+
render(SdrViewComponents::Tables::TableComponent.new) do |component|
|
|
40
|
+
component.with_caption { 'Table Caption: Financial Summary' }
|
|
41
|
+
component.with_header(label: 'Month')
|
|
42
|
+
component.with_header(label: 'Revenue')
|
|
43
|
+
component.with_header(label: 'Expenses')
|
|
44
|
+
component.with_row(label: 'January', values: ['$50,000', '$35,000'])
|
|
45
|
+
component.with_row(label: 'February', values: ['$55,000', '$38,000'])
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def show_label_false
|
|
50
|
+
render(SdrViewComponents::Tables::TableComponent.new(label: 'This label is hidden',
|
|
51
|
+
show_label: false)) do |component|
|
|
52
|
+
component.with_row(label: 'Data Row', values: ['Value 1', 'Value 2', 'Value 3'])
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# @!endgroup
|
|
57
|
+
|
|
58
|
+
def empty_message
|
|
59
|
+
render(SdrViewComponents::Tables::TableComponent.new(
|
|
60
|
+
label: 'No Data Available',
|
|
61
|
+
empty_message: 'No records found. Please try again later.'
|
|
62
|
+
))
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def responsive # rubocop:disable Metrics/MethodLength
|
|
66
|
+
render(SdrViewComponents::Tables::TableComponent.new(
|
|
67
|
+
label: 'Responsive Table',
|
|
68
|
+
responsive: true
|
|
69
|
+
)) do |component|
|
|
70
|
+
component.with_header(label: 'Row')
|
|
71
|
+
component.with_header(label: 'Column 1')
|
|
72
|
+
component.with_header(label: 'Column 2')
|
|
73
|
+
component.with_header(label: 'Column 3')
|
|
74
|
+
component.with_header(label: 'Column 4')
|
|
75
|
+
component.with_row(label: 'Row 1', values: ['Data 1', 'Data 2', 'Data 3', 'Data 4'])
|
|
76
|
+
component.with_row(label: 'Row 2', values: ['Data 5', 'Data 6', 'Data 7', 'Data 8'])
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
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.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aaron Collier
|
|
@@ -111,6 +111,7 @@ files:
|
|
|
111
111
|
- app/components/sdr_view_components/forms/basic_component.rb
|
|
112
112
|
- app/components/sdr_view_components/forms/basic_file_component.rb
|
|
113
113
|
- app/components/sdr_view_components/forms/basic_radio_button_component.rb
|
|
114
|
+
- app/components/sdr_view_components/forms/basic_select_field_component.rb
|
|
114
115
|
- app/components/sdr_view_components/forms/basic_text_area_component.rb
|
|
115
116
|
- app/components/sdr_view_components/forms/basic_text_field_component.rb
|
|
116
117
|
- app/components/sdr_view_components/forms/checkbox_component.rb
|
|
@@ -124,6 +125,7 @@ files:
|
|
|
124
125
|
- app/components/sdr_view_components/forms/label_component.html.erb
|
|
125
126
|
- app/components/sdr_view_components/forms/label_component.rb
|
|
126
127
|
- app/components/sdr_view_components/forms/radio_button_component.rb
|
|
128
|
+
- app/components/sdr_view_components/forms/select_field_component.rb
|
|
127
129
|
- app/components/sdr_view_components/forms/submit_component.html.erb
|
|
128
130
|
- app/components/sdr_view_components/forms/submit_component.rb
|
|
129
131
|
- app/components/sdr_view_components/forms/text_area_component.rb
|
|
@@ -165,6 +167,155 @@ files:
|
|
|
165
167
|
- lib/sdr_view_components/helpers.rb
|
|
166
168
|
- lib/sdr_view_components/helpers/icon_helper.rb
|
|
167
169
|
- lib/sdr_view_components/version.rb
|
|
170
|
+
- spec/components/previews/sdr_view_components/elements/alert_component_preview.rb
|
|
171
|
+
- spec/components/previews/sdr_view_components/elements/banner_component_preview.rb
|
|
172
|
+
- spec/components/previews/sdr_view_components/elements/breadcrumb_nav_component_preview.rb
|
|
173
|
+
- spec/components/previews/sdr_view_components/elements/button_component_preview.rb
|
|
174
|
+
- spec/components/previews/sdr_view_components/elements/button_form_component_preview.rb
|
|
175
|
+
- spec/components/previews/sdr_view_components/elements/button_link_component_preview.rb
|
|
176
|
+
- spec/components/previews/sdr_view_components/elements/card_component_preview.rb
|
|
177
|
+
- spec/components/previews/sdr_view_components/elements/heading_component_preview.rb
|
|
178
|
+
- spec/components/previews/sdr_view_components/elements/horizontal_rule_component_preview.rb
|
|
179
|
+
- spec/components/previews/sdr_view_components/elements/horizontal_rule_component_preview/default.html.erb
|
|
180
|
+
- spec/components/previews/sdr_view_components/elements/icon_button_component_preview.rb
|
|
181
|
+
- spec/components/previews/sdr_view_components/elements/icon_button_link_component_preview.rb
|
|
182
|
+
- spec/components/previews/sdr_view_components/elements/modal_component_preview.rb
|
|
183
|
+
- spec/components/previews/sdr_view_components/elements/modal_component_preview/default.html.erb
|
|
184
|
+
- spec/components/previews/sdr_view_components/elements/modal_component_preview/with_header_and_footer.html.erb
|
|
185
|
+
- spec/components/previews/sdr_view_components/elements/modal_component_preview/without_size.html.erb
|
|
186
|
+
- spec/components/previews/sdr_view_components/elements/progress_bar_component_preview.rb
|
|
187
|
+
- spec/components/previews/sdr_view_components/elements/spinner_component_preview.rb
|
|
188
|
+
- spec/components/previews/sdr_view_components/elements/tabs/tab_list_component_preview.rb
|
|
189
|
+
- spec/components/previews/sdr_view_components/elements/tabs/tab_list_component_preview/default_variant.html.erb
|
|
190
|
+
- spec/components/previews/sdr_view_components/elements/tabs/tab_list_component_preview/underline_variant.html.erb
|
|
191
|
+
- spec/components/previews/sdr_view_components/elements/tabs/tab_list_component_preview/with_header.html.erb
|
|
192
|
+
- spec/components/previews/sdr_view_components/elements/toast_component_preview.rb
|
|
193
|
+
- spec/components/previews/sdr_view_components/elements/tooltip_component_preview.rb
|
|
194
|
+
- spec/components/previews/sdr_view_components/elements/tooltip_component_preview/default.html.erb
|
|
195
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview.rb
|
|
196
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview/checked.html.erb
|
|
197
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview/default.html.erb
|
|
198
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview/disabled.html.erb
|
|
199
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview.rb
|
|
200
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/default.html.erb
|
|
201
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/with_accept.html.erb
|
|
202
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/with_multiple.html.erb
|
|
203
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/with_required.html.erb
|
|
204
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview.rb
|
|
205
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/checked.html.erb
|
|
206
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/default.html.erb
|
|
207
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/disabled.html.erb
|
|
208
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_select_field_component_preview.rb
|
|
209
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_select_field_component_preview/default.html.erb
|
|
210
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_select_field_component_preview/with_prompt.html.erb
|
|
211
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview.rb
|
|
212
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/default.html.erb
|
|
213
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_placeholder.html.erb
|
|
214
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_required.html.erb
|
|
215
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_rows.html.erb
|
|
216
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview.rb
|
|
217
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/default.html.erb
|
|
218
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/disabled.html.erb
|
|
219
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/required.html.erb
|
|
220
|
+
- spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/with_placeholder.html.erb
|
|
221
|
+
- spec/components/previews/sdr_view_components/forms/checkbox_component_preview.rb
|
|
222
|
+
- spec/components/previews/sdr_view_components/forms/checkbox_component_preview/checked.html.erb
|
|
223
|
+
- spec/components/previews/sdr_view_components/forms/checkbox_component_preview/default.html.erb
|
|
224
|
+
- spec/components/previews/sdr_view_components/forms/checkbox_component_preview/disabled.html.erb
|
|
225
|
+
- spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_additional_container_content.html.erb
|
|
226
|
+
- spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_help_text.html.erb
|
|
227
|
+
- spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_label.html.erb
|
|
228
|
+
- spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_validation_error.html.erb
|
|
229
|
+
- spec/components/previews/sdr_view_components/forms/file_component_preview.rb
|
|
230
|
+
- spec/components/previews/sdr_view_components/forms/file_component_preview/default.html.erb
|
|
231
|
+
- spec/components/previews/sdr_view_components/forms/file_component_preview/with_additional_container_content.html.erb
|
|
232
|
+
- spec/components/previews/sdr_view_components/forms/file_component_preview/with_help_text.html.erb
|
|
233
|
+
- spec/components/previews/sdr_view_components/forms/file_component_preview/with_help_text_below.html.erb
|
|
234
|
+
- spec/components/previews/sdr_view_components/forms/file_component_preview/with_label.html.erb
|
|
235
|
+
- spec/components/previews/sdr_view_components/forms/file_component_preview/with_multiple.html.erb
|
|
236
|
+
- spec/components/previews/sdr_view_components/forms/file_component_preview/with_validation_error.html.erb
|
|
237
|
+
- spec/components/previews/sdr_view_components/forms/help_text_component_preview.rb
|
|
238
|
+
- spec/components/previews/sdr_view_components/forms/help_text_component_preview/with_block_content.html.erb
|
|
239
|
+
- spec/components/previews/sdr_view_components/forms/help_text_component_preview/with_text.html.erb
|
|
240
|
+
- spec/components/previews/sdr_view_components/forms/label_component_preview.rb
|
|
241
|
+
- spec/components/previews/sdr_view_components/forms/label_component_preview/default.html.erb
|
|
242
|
+
- spec/components/previews/sdr_view_components/forms/label_component_preview/hidden_label.html.erb
|
|
243
|
+
- spec/components/previews/sdr_view_components/forms/label_component_preview/with_caption.html.erb
|
|
244
|
+
- spec/components/previews/sdr_view_components/forms/label_component_preview/with_tooltip.html.erb
|
|
245
|
+
- spec/components/previews/sdr_view_components/forms/radio_button_component_preview.rb
|
|
246
|
+
- spec/components/previews/sdr_view_components/forms/radio_button_component_preview/default.html.erb
|
|
247
|
+
- spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_additional_container_content.html.erb
|
|
248
|
+
- spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_disabled_label.html.erb
|
|
249
|
+
- spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_help_text.html.erb
|
|
250
|
+
- spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_help_text_below.html.erb
|
|
251
|
+
- spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_label.html.erb
|
|
252
|
+
- spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_validation_error.html.erb
|
|
253
|
+
- spec/components/previews/sdr_view_components/forms/select_field_component_preview.rb
|
|
254
|
+
- spec/components/previews/sdr_view_components/forms/select_field_component_preview/default.html.erb
|
|
255
|
+
- spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_additional_container_content.html.erb
|
|
256
|
+
- spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_help_text.html.erb
|
|
257
|
+
- spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_help_text_below.html.erb
|
|
258
|
+
- spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_prompt.html.erb
|
|
259
|
+
- spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_validation_error.html.erb
|
|
260
|
+
- spec/components/previews/sdr_view_components/forms/submit_component_preview.rb
|
|
261
|
+
- spec/components/previews/sdr_view_components/forms/submit_component_preview/danger.html.erb
|
|
262
|
+
- spec/components/previews/sdr_view_components/forms/submit_component_preview/default.html.erb
|
|
263
|
+
- spec/components/previews/sdr_view_components/forms/submit_component_preview/info.html.erb
|
|
264
|
+
- spec/components/previews/sdr_view_components/forms/submit_component_preview/primary.html.erb
|
|
265
|
+
- spec/components/previews/sdr_view_components/forms/submit_component_preview/secondary.html.erb
|
|
266
|
+
- spec/components/previews/sdr_view_components/forms/submit_component_preview/success.html.erb
|
|
267
|
+
- spec/components/previews/sdr_view_components/forms/submit_component_preview/warning.html.erb
|
|
268
|
+
- spec/components/previews/sdr_view_components/forms/submit_component_preview/with_block_content_and_value.html.erb
|
|
269
|
+
- spec/components/previews/sdr_view_components/forms/submit_component_preview/with_form_id.html.erb
|
|
270
|
+
- spec/components/previews/sdr_view_components/forms/text_area_component_preview.rb
|
|
271
|
+
- spec/components/previews/sdr_view_components/forms/text_area_component_preview/default.html.erb
|
|
272
|
+
- spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_additional_container_content.html.erb
|
|
273
|
+
- spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_help_text.html.erb
|
|
274
|
+
- spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_help_text_below.html.erb
|
|
275
|
+
- spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_hidden_label.html.erb
|
|
276
|
+
- spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_mark_required.html.erb
|
|
277
|
+
- spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_validation_error.html.erb
|
|
278
|
+
- spec/components/previews/sdr_view_components/forms/text_field_component_preview.rb
|
|
279
|
+
- spec/components/previews/sdr_view_components/forms/text_field_component_preview/default.html.erb
|
|
280
|
+
- spec/components/previews/sdr_view_components/forms/text_field_component_preview/disabled.html.erb
|
|
281
|
+
- spec/components/previews/sdr_view_components/forms/text_field_component_preview/label_hidden.html.erb
|
|
282
|
+
- spec/components/previews/sdr_view_components/forms/text_field_component_preview/marked_required.html.erb
|
|
283
|
+
- spec/components/previews/sdr_view_components/forms/text_field_component_preview/required.html.erb
|
|
284
|
+
- spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_additional_container_content.html.erb
|
|
285
|
+
- spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_help_text.html.erb
|
|
286
|
+
- spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_help_text_below.html.erb
|
|
287
|
+
- spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_placeholder.html.erb
|
|
288
|
+
- spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_validation_error.html.erb
|
|
289
|
+
- spec/components/previews/sdr_view_components/forms/toggle_component_preview.rb
|
|
290
|
+
- spec/components/previews/sdr_view_components/forms/toggle_component_preview/default.html.erb
|
|
291
|
+
- spec/components/previews/sdr_view_components/forms/toggle_component_preview/with_validation_error.html.erb
|
|
292
|
+
- spec/components/previews/sdr_view_components/structure/footer_component_preview.rb
|
|
293
|
+
- spec/components/previews/sdr_view_components/structure/header_component_preview.rb
|
|
294
|
+
- spec/components/previews/sdr_view_components/structure/header_component_preview/dark_variant.html.erb
|
|
295
|
+
- spec/components/previews/sdr_view_components/structure/header_component_preview/dark_variant_with_background_color.html.erb
|
|
296
|
+
- spec/components/previews/sdr_view_components/structure/header_component_preview/light_variant.html.erb
|
|
297
|
+
- spec/components/previews/sdr_view_components/structure/header_component_preview/no_rosette.html.erb
|
|
298
|
+
- spec/components/previews/sdr_view_components/structure/header_component_preview/white_variant.html.erb
|
|
299
|
+
- spec/components/previews/sdr_view_components/tables/cell_component_preview.rb
|
|
300
|
+
- spec/components/previews/sdr_view_components/tables/cell_component_preview/default.html.erb
|
|
301
|
+
- spec/components/previews/sdr_view_components/tables/cell_component_preview/with_colspan.html.erb
|
|
302
|
+
- spec/components/previews/sdr_view_components/tables/header_component_preview.rb
|
|
303
|
+
- spec/components/previews/sdr_view_components/tables/header_component_preview/default.html.erb
|
|
304
|
+
- spec/components/previews/sdr_view_components/tables/header_component_preview/with_tooltip.html.erb
|
|
305
|
+
- spec/components/previews/sdr_view_components/tables/list_cell_component_preview.rb
|
|
306
|
+
- spec/components/previews/sdr_view_components/tables/list_cell_component_preview/with_item_values.html.erb
|
|
307
|
+
- spec/components/previews/sdr_view_components/tables/list_cell_component_preview/with_items.html.erb
|
|
308
|
+
- spec/components/previews/sdr_view_components/tables/raw_table_component_preview.rb
|
|
309
|
+
- spec/components/previews/sdr_view_components/tables/raw_table_component_preview/default.html.erb
|
|
310
|
+
- spec/components/previews/sdr_view_components/tables/row_component_preview.rb
|
|
311
|
+
- spec/components/previews/sdr_view_components/tables/row_component_preview/label_only.html.erb
|
|
312
|
+
- spec/components/previews/sdr_view_components/tables/row_component_preview/with_cells.html.erb
|
|
313
|
+
- spec/components/previews/sdr_view_components/tables/row_component_preview/with_first_value_and_values.html.erb
|
|
314
|
+
- spec/components/previews/sdr_view_components/tables/row_component_preview/with_label_content.html.erb
|
|
315
|
+
- spec/components/previews/sdr_view_components/tables/row_component_preview/with_tooltip.html.erb
|
|
316
|
+
- spec/components/previews/sdr_view_components/tables/row_component_preview/with_value.html.erb
|
|
317
|
+
- spec/components/previews/sdr_view_components/tables/row_component_preview/with_values.html.erb
|
|
318
|
+
- spec/components/previews/sdr_view_components/tables/table_component_preview.rb
|
|
168
319
|
homepage: https://github.com/sul-dlss/sdr_view_components
|
|
169
320
|
licenses: []
|
|
170
321
|
metadata:
|