sdr_view_components 0.2.0 → 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/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_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 +139 -1
|
@@ -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
|
data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Forms
|
|
5
|
+
module Basic
|
|
6
|
+
class BasicTextAreaComponentPreview < ViewComponent::Preview
|
|
7
|
+
def default; end
|
|
8
|
+
|
|
9
|
+
# @!group Text Area Options
|
|
10
|
+
def with_rows; end
|
|
11
|
+
|
|
12
|
+
def with_placeholder; end
|
|
13
|
+
|
|
14
|
+
def with_required; end
|
|
15
|
+
# @!endgroup
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Forms
|
|
5
|
+
module Basic
|
|
6
|
+
class BasicTextFieldComponentPreview < ViewComponent::Preview
|
|
7
|
+
def default; end
|
|
8
|
+
|
|
9
|
+
# @!group Input Options
|
|
10
|
+
def with_placeholder; end
|
|
11
|
+
|
|
12
|
+
def disabled; end
|
|
13
|
+
|
|
14
|
+
def required; end
|
|
15
|
+
# @!endgroup
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/checked.html.erb
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<% model = SdrViewComponents::Forms::CheckboxComponentPreview::CheckboxPreviewModel.new(test_boolean_field: false) %>
|
|
2
|
+
|
|
3
|
+
<%= form_with(model: model, url: '/example') do |form| %>
|
|
4
|
+
<%= render SdrViewComponents::Forms::CheckboxComponent.new(
|
|
5
|
+
form: form,
|
|
6
|
+
field_name: :test_boolean_field,
|
|
7
|
+
input_checked: true
|
|
8
|
+
) %>
|
|
9
|
+
<% end %>
|
data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/default.html.erb
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<% model = SdrViewComponents::Forms::CheckboxComponentPreview::CheckboxPreviewModel.new(test_boolean_field: false) %>
|
|
2
|
+
|
|
3
|
+
<%= form_with(model: model, url: '/example') do |form| %>
|
|
4
|
+
<%= render SdrViewComponents::Forms::CheckboxComponent.new(
|
|
5
|
+
form: form,
|
|
6
|
+
field_name: :test_boolean_field
|
|
7
|
+
) %>
|
|
8
|
+
<% end %>
|
data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/disabled.html.erb
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<% model = SdrViewComponents::Forms::CheckboxComponentPreview::CheckboxPreviewModel.new(test_boolean_field: false) %>
|
|
2
|
+
|
|
3
|
+
<%= form_with(model: model, url: '/example') do |form| %>
|
|
4
|
+
<%= render SdrViewComponents::Forms::CheckboxComponent.new(
|
|
5
|
+
form: form,
|
|
6
|
+
field_name: :test_boolean_field,
|
|
7
|
+
input_disabled: true
|
|
8
|
+
) %>
|
|
9
|
+
<% end %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<% model = SdrViewComponents::Forms::CheckboxComponentPreview::CheckboxPreviewModel.new(test_boolean_field: false) %>
|
|
2
|
+
|
|
3
|
+
<%= form_with(model: model, url: '/example') do |form| %>
|
|
4
|
+
<%= render SdrViewComponents::Forms::CheckboxComponent.new(
|
|
5
|
+
form: form,
|
|
6
|
+
field_name: :test_boolean_field
|
|
7
|
+
) do |component| %>
|
|
8
|
+
<% component.with_additional_container_content do %>
|
|
9
|
+
<span class="text-info">Extra info: This is additional container content.</span>
|
|
10
|
+
<% end %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% end %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<% model = SdrViewComponents::Forms::CheckboxComponentPreview::CheckboxPreviewModel.new(test_boolean_field: false) %>
|
|
2
|
+
|
|
3
|
+
<%= form_with(model: model, url: '/example') do |form| %>
|
|
4
|
+
<%= render SdrViewComponents::Forms::CheckboxComponent.new(
|
|
5
|
+
form: form,
|
|
6
|
+
field_name: :test_boolean_field,
|
|
7
|
+
help_text: 'This help text appears below the checkbox.',
|
|
8
|
+
variant: :help_text_below
|
|
9
|
+
) %>
|
|
10
|
+
<% end %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<% model = SdrViewComponents::Forms::CheckboxComponentPreview::CheckboxPreviewModel.new(test_boolean_field: false) %>
|
|
2
|
+
|
|
3
|
+
<%= form_with(model: model, url: '/example') do |form| %>
|
|
4
|
+
<%= render SdrViewComponents::Forms::CheckboxComponent.new(
|
|
5
|
+
form: form,
|
|
6
|
+
field_name: :test_boolean_field,
|
|
7
|
+
label_text: 'I agree to the terms and conditions'
|
|
8
|
+
) %>
|
|
9
|
+
<% end %>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<% model = SdrViewComponents::Forms::CheckboxComponentPreview::CheckboxPreviewModel.new(test_boolean_field: false) %>
|
|
2
|
+
<% model.valid? %>
|
|
3
|
+
|
|
4
|
+
<%= form_with(model: model, url: '/example') do |form| %>
|
|
5
|
+
<%= render SdrViewComponents::Forms::CheckboxComponent.new(
|
|
6
|
+
form: form,
|
|
7
|
+
field_name: :test_boolean_field
|
|
8
|
+
) %>
|
|
9
|
+
<% end %>
|