sdr_view_components 0.1.14 → 0.2.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/README.md +55 -38
- data/app/assets/sdr_view_components.css +110 -0
- data/app/components/sdr_view_components/elements/heading_component.rb +3 -1
- data/app/components/sdr_view_components/elements/icon_button_component.rb +10 -0
- data/app/components/sdr_view_components/elements/spinner_component.html.erb +2 -2
- data/app/components/sdr_view_components/elements/spinner_component.rb +5 -4
- data/app/components/sdr_view_components/elements/tabs/pane_component.html.erb +3 -0
- data/app/components/sdr_view_components/elements/tabs/pane_component.rb +27 -0
- data/app/components/sdr_view_components/elements/tabs/tab_component.html.erb +3 -0
- data/app/components/sdr_view_components/elements/tabs/tab_component.rb +42 -0
- data/app/components/sdr_view_components/elements/tabs/tab_list_component.html.erb +9 -0
- data/app/components/sdr_view_components/elements/tabs/tab_list_component.rb +33 -0
- data/app/components/sdr_view_components/elements/toast_component.rb +1 -1
- data/app/components/sdr_view_components/tables/base_table_component.html.erb +32 -0
- data/app/components/sdr_view_components/tables/base_table_component.rb +69 -0
- data/app/components/sdr_view_components/tables/cell_component.html.erb +3 -0
- data/app/components/sdr_view_components/tables/cell_component.rb +21 -0
- data/app/components/sdr_view_components/tables/header_component.html.erb +4 -0
- data/app/components/sdr_view_components/tables/header_component.rb +22 -0
- data/app/components/sdr_view_components/tables/list_cell_component.html.erb +5 -0
- data/app/components/sdr_view_components/tables/list_cell_component.rb +22 -0
- data/app/components/sdr_view_components/tables/raw_table_component.rb +10 -0
- data/app/components/sdr_view_components/tables/row_component.html.erb +24 -0
- data/app/components/sdr_view_components/tables/row_component.rb +32 -0
- data/app/components/sdr_view_components/tables/table_component.rb +10 -0
- data/app/views/layouts/lookbook.html.erb +46 -0
- data/lib/sdr_view_components/configuration.rb +22 -0
- data/lib/sdr_view_components/engine.rb +17 -7
- data/lib/sdr_view_components/error.rb +7 -0
- data/lib/sdr_view_components/version.rb +1 -1
- data/lib/sdr_view_components.rb +2 -0
- 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_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 +9 -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 +9 -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_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 +11 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_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 +9 -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 +9 -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 +12 -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 +163 -6
- data/app/assets/stylesheets/styles.scss +0 -118
- data/app/components/component_support/file_hierarchy.rb +0 -22
- data/app/components/sdr_view_components/forms/button_component.rb +0 -42
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
class HeadingComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Heading Levels
|
|
7
|
+
def h1
|
|
8
|
+
render SdrViewComponents::Elements::HeadingComponent.new(level: :h1, text: 'Page title')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def h2
|
|
12
|
+
render SdrViewComponents::Elements::HeadingComponent.new(level: :h2, text: 'Section heading')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def h3
|
|
16
|
+
render SdrViewComponents::Elements::HeadingComponent.new(level: :h3, text: 'Subsection heading')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def h4
|
|
20
|
+
render SdrViewComponents::Elements::HeadingComponent.new(level: :h4, text: 'Supporting heading')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def h5
|
|
24
|
+
render SdrViewComponents::Elements::HeadingComponent.new(level: :h5, text: 'Minor heading')
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def h6
|
|
28
|
+
render SdrViewComponents::Elements::HeadingComponent.new(level: :h6, text: 'Eyebrow heading')
|
|
29
|
+
end
|
|
30
|
+
# @!endgroup
|
|
31
|
+
|
|
32
|
+
# @!group Variant Styling
|
|
33
|
+
def h2_with_h1_styling
|
|
34
|
+
render SdrViewComponents::Elements::HeadingComponent.new(level: :h2, text: 'Rendered as h2, styled like h1',
|
|
35
|
+
variant: :h1)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def h3_with_h2_styling
|
|
39
|
+
render SdrViewComponents::Elements::HeadingComponent.new(level: :h3, text: 'Rendered as h3, styled like h2',
|
|
40
|
+
variant: :h2)
|
|
41
|
+
end
|
|
42
|
+
# @!endgroup
|
|
43
|
+
|
|
44
|
+
def with_block_content
|
|
45
|
+
render SdrViewComponents::Elements::HeadingComponent.new(level: :h2) do
|
|
46
|
+
'Heading supplied by block content'
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
class IconButtonComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Icon Buttons
|
|
7
|
+
def delete
|
|
8
|
+
render SdrViewComponents::Elements::IconButtonComponent.new(icon: :delete, label: 'Delete item')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def download
|
|
12
|
+
render SdrViewComponents::Elements::IconButtonComponent.new(icon: :download, label: 'Download file')
|
|
13
|
+
end
|
|
14
|
+
# @!endgroup
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/spec/components/previews/sdr_view_components/elements/icon_button_link_component_preview.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
class IconButtonLinkComponentPreview < ViewComponent::Preview
|
|
6
|
+
def default
|
|
7
|
+
render SdrViewComponents::Elements::IconButtonLinkComponent.new(
|
|
8
|
+
icon: :download,
|
|
9
|
+
label: 'Download item',
|
|
10
|
+
link: '/example'
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
data/spec/components/previews/sdr_view_components/elements/modal_component_preview/default.html.erb
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#default-modal-preview">
|
|
2
|
+
Open default modal
|
|
3
|
+
</button>
|
|
4
|
+
|
|
5
|
+
<%= render SdrViewComponents::Elements::ModalComponent.new(id: 'default-modal-preview') do |modal| %>
|
|
6
|
+
<% modal.with_body do %>
|
|
7
|
+
<p class="mb-0">Use this modal to review submission details before publishing.</p>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% end %>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#modal-with-header-and-footer-preview">
|
|
2
|
+
Open modal with header and footer
|
|
3
|
+
</button>
|
|
4
|
+
|
|
5
|
+
<%= render SdrViewComponents::Elements::ModalComponent.new(id: 'modal-with-header-and-footer-preview') do |modal| %>
|
|
6
|
+
<% modal.with_header do %>
|
|
7
|
+
<h2 class="h5 mb-0">Publish item</h2>
|
|
8
|
+
<% end %>
|
|
9
|
+
|
|
10
|
+
<% modal.with_body do %>
|
|
11
|
+
<p>This item is ready to publish to the repository.</p>
|
|
12
|
+
<p class="mb-0">Review the metadata one final time before continuing.</p>
|
|
13
|
+
<% end %>
|
|
14
|
+
|
|
15
|
+
<% modal.with_footer do %>
|
|
16
|
+
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Cancel</button>
|
|
17
|
+
<button type="button" class="btn btn-primary">Publish</button>
|
|
18
|
+
<% end %>
|
|
19
|
+
<% end %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#without-size-modal-preview">
|
|
2
|
+
Open modal without size
|
|
3
|
+
</button>
|
|
4
|
+
|
|
5
|
+
<%= render SdrViewComponents::Elements::ModalComponent.new(id: 'without-size-modal-preview', size: nil) do |modal| %>
|
|
6
|
+
<% modal.with_body do %>
|
|
7
|
+
<p class="mb-0">This example renders the modal without an explicit size class.</p>
|
|
8
|
+
<% end %>
|
|
9
|
+
<% end %>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
class ModalComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Sizes
|
|
7
|
+
def default; end
|
|
8
|
+
|
|
9
|
+
def without_size; end
|
|
10
|
+
# @!endgroup
|
|
11
|
+
|
|
12
|
+
def with_header_and_footer; end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
class ProgressBarComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Variants
|
|
7
|
+
def default
|
|
8
|
+
render SdrViewComponents::Elements::ProgressBarComponent.new(
|
|
9
|
+
label: 'Digitization progress',
|
|
10
|
+
percent: 45
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def primary
|
|
15
|
+
render SdrViewComponents::Elements::ProgressBarComponent.new(
|
|
16
|
+
label: 'Digitization progress',
|
|
17
|
+
percent: 45,
|
|
18
|
+
variant: :primary
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def secondary
|
|
23
|
+
render SdrViewComponents::Elements::ProgressBarComponent.new(
|
|
24
|
+
label: 'Digitization progress',
|
|
25
|
+
percent: 45,
|
|
26
|
+
variant: :secondary
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def success
|
|
31
|
+
render SdrViewComponents::Elements::ProgressBarComponent.new(
|
|
32
|
+
label: 'Digitization progress',
|
|
33
|
+
percent: 45,
|
|
34
|
+
variant: :success
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def danger
|
|
39
|
+
render SdrViewComponents::Elements::ProgressBarComponent.new(
|
|
40
|
+
label: 'Digitization progress',
|
|
41
|
+
percent: 45,
|
|
42
|
+
variant: :danger
|
|
43
|
+
)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def warning
|
|
47
|
+
render SdrViewComponents::Elements::ProgressBarComponent.new(
|
|
48
|
+
label: 'Digitization progress',
|
|
49
|
+
percent: 45,
|
|
50
|
+
variant: :warning
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def info
|
|
55
|
+
render SdrViewComponents::Elements::ProgressBarComponent.new(
|
|
56
|
+
label: 'Digitization progress',
|
|
57
|
+
percent: 45,
|
|
58
|
+
variant: :info
|
|
59
|
+
)
|
|
60
|
+
end
|
|
61
|
+
# @!endgroup
|
|
62
|
+
|
|
63
|
+
# @!group Percent Complete
|
|
64
|
+
def twenty_five_percent
|
|
65
|
+
render SdrViewComponents::Elements::ProgressBarComponent.new(
|
|
66
|
+
label: 'File transfer progress',
|
|
67
|
+
percent: 25
|
|
68
|
+
)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def complete
|
|
72
|
+
render SdrViewComponents::Elements::ProgressBarComponent.new(
|
|
73
|
+
label: 'File transfer progress',
|
|
74
|
+
percent: 100
|
|
75
|
+
)
|
|
76
|
+
end
|
|
77
|
+
# @!endgroup
|
|
78
|
+
|
|
79
|
+
# @!group Striping
|
|
80
|
+
def striped
|
|
81
|
+
render SdrViewComponents::Elements::ProgressBarComponent.new(
|
|
82
|
+
label: 'Metadata review progress',
|
|
83
|
+
percent: 60
|
|
84
|
+
)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def solid
|
|
88
|
+
render SdrViewComponents::Elements::ProgressBarComponent.new(
|
|
89
|
+
label: 'Metadata review progress',
|
|
90
|
+
percent: 60,
|
|
91
|
+
striped: false
|
|
92
|
+
)
|
|
93
|
+
end
|
|
94
|
+
# @!endgroup
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
class SpinnerComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Variants
|
|
7
|
+
def default
|
|
8
|
+
render SdrViewComponents::Elements::SpinnerComponent.new
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def primary
|
|
12
|
+
render SdrViewComponents::Elements::SpinnerComponent.new(variant: :primary)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def secondary
|
|
16
|
+
render SdrViewComponents::Elements::SpinnerComponent.new(variant: :secondary)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def success
|
|
20
|
+
render SdrViewComponents::Elements::SpinnerComponent.new(variant: :success)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def danger
|
|
24
|
+
render SdrViewComponents::Elements::SpinnerComponent.new(variant: :danger)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def warning
|
|
28
|
+
render SdrViewComponents::Elements::SpinnerComponent.new(variant: :warning)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def info
|
|
32
|
+
render SdrViewComponents::Elements::SpinnerComponent.new(variant: :info)
|
|
33
|
+
end
|
|
34
|
+
# @!endgroup
|
|
35
|
+
|
|
36
|
+
# @!group Messages
|
|
37
|
+
def custom_message
|
|
38
|
+
render SdrViewComponents::Elements::SpinnerComponent.new(message: 'Preparing deposit package...')
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def hidden_message
|
|
42
|
+
render SdrViewComponents::Elements::SpinnerComponent.new(
|
|
43
|
+
message: 'Preparing deposit package...',
|
|
44
|
+
hide_message: true
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
# @!endgroup
|
|
48
|
+
|
|
49
|
+
# @!group Message Position
|
|
50
|
+
def message_on_bottom
|
|
51
|
+
render SdrViewComponents::Elements::SpinnerComponent.new(
|
|
52
|
+
message: 'Indexing files...',
|
|
53
|
+
message_position: :bottom
|
|
54
|
+
)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def message_on_top
|
|
58
|
+
render SdrViewComponents::Elements::SpinnerComponent.new(
|
|
59
|
+
message: 'Indexing files...',
|
|
60
|
+
message_position: :top
|
|
61
|
+
)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def message_on_left
|
|
65
|
+
render SdrViewComponents::Elements::SpinnerComponent.new(
|
|
66
|
+
message: 'Indexing files...',
|
|
67
|
+
message_position: :left
|
|
68
|
+
)
|
|
69
|
+
end
|
|
70
|
+
# @!endgroup
|
|
71
|
+
|
|
72
|
+
def spinning_image
|
|
73
|
+
render SdrViewComponents::Elements::SpinnerComponent.new(
|
|
74
|
+
message: 'Uploading image derivatives...',
|
|
75
|
+
image_path: "#{SdrViewComponents.configuration.component_library_url}/styles/Rosette.svg",
|
|
76
|
+
height: 64,
|
|
77
|
+
width: 64,
|
|
78
|
+
speed: 1.5
|
|
79
|
+
)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%= render SdrViewComponents::Elements::Tabs::TabListComponent.new do |tab_list| %>
|
|
2
|
+
<% tab_list.with_tab(label: 'Details', id: 'details-tab', pane_id: 'details-pane', active: true) %>
|
|
3
|
+
<% tab_list.with_tab(label: 'History', id: 'history-tab', pane_id: 'history-pane') %>
|
|
4
|
+
|
|
5
|
+
<% tab_list.with_pane(id: 'details-pane', tab_id: 'details-tab', active: true) do %>
|
|
6
|
+
<p>Details pane content.</p>
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
<% tab_list.with_pane(id: 'history-pane', tab_id: 'history-tab') do %>
|
|
10
|
+
<p>History pane content.</p>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% end %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%= render SdrViewComponents::Elements::Tabs::TabListComponent.new(variant: :underline) do |tab_list| %>
|
|
2
|
+
<% tab_list.with_tab(label: 'Details', id: 'details-tab', pane_id: 'details-pane', active: true) %>
|
|
3
|
+
<% tab_list.with_tab(label: 'History', id: 'history-tab', pane_id: 'history-pane') %>
|
|
4
|
+
|
|
5
|
+
<% tab_list.with_pane(id: 'details-pane', tab_id: 'details-tab', active: true) do %>
|
|
6
|
+
<p>Details pane content.</p>
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
<% tab_list.with_pane(id: 'history-pane', tab_id: 'history-tab') do %>
|
|
10
|
+
<p>History pane content.</p>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% end %>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<%= render SdrViewComponents::Elements::Tabs::TabListComponent.new do |tab_list| %>
|
|
2
|
+
<% tab_list.with_tab(label: 'Details', id: 'details-tab', pane_id: 'details-pane', active: true) %>
|
|
3
|
+
<% tab_list.with_tab(label: 'History', id: 'history-tab', pane_id: 'history-pane') %>
|
|
4
|
+
|
|
5
|
+
<% tab_list.with_header do %>
|
|
6
|
+
<p class="mt-3 mb-2 fst-italic">Choose one of the tabs.</p>
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
<% tab_list.with_pane(id: 'details-pane', tab_id: 'details-tab', active: true) do %>
|
|
10
|
+
<p>Details pane content.</p>
|
|
11
|
+
<% end %>
|
|
12
|
+
|
|
13
|
+
<% tab_list.with_pane(id: 'history-pane', tab_id: 'history-tab') do %>
|
|
14
|
+
<p>History pane content.</p>
|
|
15
|
+
<% end %>
|
|
16
|
+
<% end %>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
module Tabs
|
|
6
|
+
class TabListComponentPreview < ViewComponent::Preview
|
|
7
|
+
# @!group Variants
|
|
8
|
+
def default_variant; end
|
|
9
|
+
def underline_variant; end
|
|
10
|
+
# @!endgroup
|
|
11
|
+
|
|
12
|
+
def with_header; end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
class ToastComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Variants
|
|
7
|
+
def default
|
|
8
|
+
render SdrViewComponents::Elements::ToastComponent.new(title: 'Alert!', text: 'Black Toast text')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def red
|
|
12
|
+
render SdrViewComponents::Elements::ToastComponent.new(title: 'Alert!', text: 'Red Toast text', variant: :red)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def green
|
|
16
|
+
render SdrViewComponents::Elements::ToastComponent.new(title: 'Alert!', text: 'Green Toast text', variant: :green)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def poppy
|
|
20
|
+
render SdrViewComponents::Elements::ToastComponent.new(title: 'Alert!', text: 'Poppy Toast text', variant: :poppy)
|
|
21
|
+
end
|
|
22
|
+
# @!endgroup
|
|
23
|
+
|
|
24
|
+
def with_close_text
|
|
25
|
+
render SdrViewComponents::Elements::ToastComponent.new(title: 'Alert!', text: 'Black Toast text', close_text: 'Undo')
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%= render SdrViewComponents::Elements::TooltipComponent.new(
|
|
2
|
+
target_label: 'Collection title',
|
|
3
|
+
tooltip: 'Use the public collection title shown to repository users.'
|
|
4
|
+
) %>
|
|
5
|
+
|
|
6
|
+
<script>
|
|
7
|
+
window.addEventListener('load', () => {
|
|
8
|
+
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
|
9
|
+
;[...tooltipTriggerList].forEach((tooltipTriggerEl) => {
|
|
10
|
+
window.bootstrap.Tooltip.getOrCreateInstance(tooltipTriggerEl)
|
|
11
|
+
})
|
|
12
|
+
})
|
|
13
|
+
</script>
|
data/spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Forms
|
|
5
|
+
module Basic
|
|
6
|
+
class BasicCheckboxComponentPreview < ViewComponent::Preview
|
|
7
|
+
def default; end
|
|
8
|
+
|
|
9
|
+
# @!group Checkbox State
|
|
10
|
+
def checked; end
|
|
11
|
+
|
|
12
|
+
def disabled; end
|
|
13
|
+
# @!endgroup
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Forms
|
|
5
|
+
module Basic
|
|
6
|
+
class BasicFileComponentPreview < ViewComponent::Preview
|
|
7
|
+
def default; end
|
|
8
|
+
|
|
9
|
+
# @!group File Input Options
|
|
10
|
+
def with_accept
|
|
11
|
+
# Demonstrates accept attribute to filter file types (e.g., images only)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def with_multiple
|
|
15
|
+
# Demonstrates multiple attribute for uploading multiple files
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def with_required
|
|
19
|
+
# Demonstrates required attribute
|
|
20
|
+
end
|
|
21
|
+
# @!endgroup
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Forms
|
|
5
|
+
module Basic
|
|
6
|
+
class BasicRadioButtonComponentPreview < ViewComponent::Preview
|
|
7
|
+
def default; end
|
|
8
|
+
|
|
9
|
+
# @!group Radio button state
|
|
10
|
+
def checked; end
|
|
11
|
+
|
|
12
|
+
def disabled; end
|
|
13
|
+
# @!endgroup
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|