sdr_view_components 0.2.1 → 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/tooltip_component_preview/default.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview/checked.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview/default.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview/disabled.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/default.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/with_accept.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/with_multiple.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/with_required.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/checked.html.erb +5 -5
- data/spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/default.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/disabled.html.erb +5 -5
- 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 +3 -3
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_placeholder.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_required.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_rows.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/default.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/disabled.html.erb +5 -5
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/required.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/with_placeholder.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/checked.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/default.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/disabled.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_additional_container_content.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_help_text.html.erb +5 -5
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_label.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_validation_error.html.erb +3 -4
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/default.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_additional_container_content.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_help_text.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_help_text_below.html.erb +5 -5
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_label.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_multiple.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_validation_error.html.erb +3 -4
- data/spec/components/previews/sdr_view_components/forms/help_text_component_preview/with_text.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/label_component_preview/default.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/label_component_preview/hidden_label.html.erb +5 -5
- data/spec/components/previews/sdr_view_components/forms/label_component_preview/with_caption.html.erb +5 -5
- data/spec/components/previews/sdr_view_components/forms/label_component_preview/with_tooltip.html.erb +5 -5
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/default.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_additional_container_content.html.erb +5 -5
- 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 +5 -5
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_help_text_below.html.erb +6 -6
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_label.html.erb +5 -5
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_validation_error.html.erb +5 -6
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview.rb +4 -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 +3 -3
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/default.html.erb +2 -2
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/info.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/primary.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/secondary.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/success.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/warning.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/with_block_content_and_value.html.erb +2 -2
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/with_form_id.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/default.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_additional_container_content.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_help_text.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_help_text_below.html.erb +5 -5
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_hidden_label.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_mark_required.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_validation_error.html.erb +3 -4
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/default.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/disabled.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/label_hidden.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/marked_required.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/required.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_additional_container_content.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_help_text.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_help_text_below.html.erb +5 -5
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_placeholder.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_validation_error.html.erb +3 -4
- data/spec/components/previews/sdr_view_components/forms/toggle_component_preview/default.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/forms/toggle_component_preview/with_validation_error.html.erb +3 -4
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_first_value_and_values.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_tooltip.html.erb +4 -4
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_value.html.erb +3 -3
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_values.html.erb +3 -3
- metadata +14 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 69a8ea2f413d71c60cab404598d4e5f0b65c4c0bf7b4aa332e657ea4ea3fae61
|
|
4
|
+
data.tar.gz: db647210ffedcfbec61c8a16602b3a0b25de94faf04c595c5b00dfdafdbd9321
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1bd2d7d88d402446d0d033ba6d189eb7b211efe4357110244b908a4f603a4824e104af724d518d2e8a4b86d243e5a06e37971cdd4b526e2279e54de45e1bb8f9
|
|
7
|
+
data.tar.gz: 7bd1f0afcc43c17014331278c1e9515c4f4fd2c857ad5f02f5944327ab30074e2885fd8b7017188dd46f8f8b2b0300225e918d53666d1d0e109717bf11c77c55
|
data/Rakefile
CHANGED
|
@@ -6,10 +6,36 @@ APP_RAKEFILE = File.expand_path('spec/dummy/Rakefile', __dir__)
|
|
|
6
6
|
load 'rails/tasks/engine.rake'
|
|
7
7
|
|
|
8
8
|
require 'bundler/gem_tasks'
|
|
9
|
-
require 'rspec/core/rake_task'
|
|
10
|
-
require 'rubocop/rake_task'
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
begin
|
|
11
|
+
require 'rubocop/rake_task'
|
|
12
|
+
RuboCop::RakeTask.new
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
desc 'Run erblint against ERB files'
|
|
15
|
+
task erblint: :environment do
|
|
16
|
+
puts 'Running ERB linter...'
|
|
17
|
+
sh('bin/erb_lint --lint-all --format compact')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
desc 'Run linter against style files'
|
|
21
|
+
task stylelint: :environment do
|
|
22
|
+
puts 'Running style linter...'
|
|
23
|
+
sh('yarn run stylelint')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
desc 'Run herb against ERB files'
|
|
27
|
+
task herb: :environment do
|
|
28
|
+
puts 'Running ERB linter...'
|
|
29
|
+
sh('bin/herb analyze app --no-timing --non-interactive')
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
desc 'Run all configured linters'
|
|
33
|
+
task lint: %i[rubocop erblint herb]
|
|
34
|
+
|
|
35
|
+
# clear the default task injected by rspec
|
|
36
|
+
task(:default).clear
|
|
37
|
+
|
|
38
|
+
task default: %i[lint spec] # rubocop:disable Rake/DuplicateTask
|
|
39
|
+
rescue LoadError
|
|
40
|
+
# should only be here when gem group development and test aren't installed
|
|
41
|
+
end
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
.nav-underline .nav-link:not(.active) {
|
|
70
|
-
color:
|
|
70
|
+
color: rgb(var(--bs-link-color-rgb), var(--bs-link-opacity, 1));
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
.nav-underline .nav-link.active {
|
|
@@ -108,3 +108,11 @@ table.table-data th {
|
|
|
108
108
|
width: fit-content;
|
|
109
109
|
white-space: nowrap;
|
|
110
110
|
}
|
|
111
|
+
|
|
112
|
+
/* Radio buttons */
|
|
113
|
+
|
|
114
|
+
/* Inputs / labels are rendered in the opposite order than BS styles expect. */
|
|
115
|
+
.form-check-label:has(+ .form-check-input:disabled), .form-check-label:has(+ .form-check-input[disabled]) {
|
|
116
|
+
cursor: default;
|
|
117
|
+
opacity: .5;
|
|
118
|
+
}
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
class="toast align-items-center show"
|
|
3
3
|
role="alert"
|
|
4
4
|
aria-live="assertive"
|
|
5
|
-
aria-atomic="true"
|
|
6
|
-
>
|
|
5
|
+
aria-atomic="true">
|
|
7
6
|
<%= tag.div class: toast_body_classes do %>
|
|
8
7
|
<div class="d-flex">
|
|
9
8
|
<div
|
|
10
|
-
class="bi bi-exclamation-circle-fill fs-3 me-3 align-self-center d-flex justify-content-center"
|
|
11
|
-
></div>
|
|
9
|
+
class="bi bi-exclamation-circle-fill fs-3 me-3 align-self-center d-flex justify-content-center"></div>
|
|
12
10
|
<div>
|
|
13
11
|
<div class="fw-semibold"><%= title %> </div>
|
|
14
12
|
<% if text.present? %>
|
|
@@ -19,8 +17,7 @@
|
|
|
19
17
|
<% if close_text.present? %>
|
|
20
18
|
<button
|
|
21
19
|
type="button"
|
|
22
|
-
class="btn btn-text text-uppercase text-white"
|
|
23
|
-
>
|
|
20
|
+
class="btn btn-text text-uppercase text-white">
|
|
24
21
|
<%= close_text %>
|
|
25
22
|
</button>
|
|
26
23
|
<% end %>
|
|
@@ -28,8 +25,7 @@
|
|
|
28
25
|
type="button"
|
|
29
26
|
class="btn btn-close btn-close-white"
|
|
30
27
|
aria-label="Close"
|
|
31
|
-
data-bs-dismiss="toast"
|
|
32
|
-
></button>
|
|
28
|
+
data-bs-dismiss="toast"></button>
|
|
33
29
|
</div>
|
|
34
30
|
</div>
|
|
35
31
|
<% end %>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Forms
|
|
5
|
+
# Component for form select field
|
|
6
|
+
class BasicSelectFieldComponent < BasicComponent
|
|
7
|
+
def initialize(form:, field_name:, options:, prompt: false, classes: [], **args) # rubocop:disable Metrics/ParameterLists
|
|
8
|
+
@options = options
|
|
9
|
+
@prompt = prompt
|
|
10
|
+
super(form:, field_name:, classes:, **args)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
attr_reader :options, :prompt
|
|
14
|
+
|
|
15
|
+
def call
|
|
16
|
+
form.select field_name, options, { prompt: }, { class: classes, **args }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def classes
|
|
20
|
+
merge_classes('form-select', @classes)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Forms
|
|
5
|
+
# Component for form select fields
|
|
6
|
+
class SelectFieldComponent < FieldComponent
|
|
7
|
+
def initialize(options:, prompt: false, **)
|
|
8
|
+
@options = options
|
|
9
|
+
@prompt = prompt
|
|
10
|
+
super(**)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
attr_reader :options, :prompt
|
|
14
|
+
|
|
15
|
+
def input_component
|
|
16
|
+
SdrViewComponents::Forms::BasicSelectFieldComponent.new(form:, field_name:, options:, prompt:, **input_args)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
<%= form.radio_button field_name, value, type: 'radio', class: 'btn-check', data: %>
|
|
2
|
-
<%= form.label
|
|
2
|
+
<%= form.label(field_name, label, value:, class: label_classes) %>
|
|
@@ -27,8 +27,7 @@
|
|
|
27
27
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
|
|
28
28
|
<link
|
|
29
29
|
rel="stylesheet"
|
|
30
|
-
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css"
|
|
31
|
-
>
|
|
30
|
+
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
|
|
32
31
|
<%= tag.link rel: 'icon', href: "#{SdrViewComponents.configuration.component_library_url}/styles/icon.png", type: 'image/png' %>
|
|
33
32
|
<%= tag.link rel: 'icon', href: "#{SdrViewComponents.configuration.component_library_url}/styles/icon.svg", type: 'image/svg+xml' %>
|
|
34
33
|
<%= tag.link rel: 'apple-touch-icon', href: "#{SdrViewComponents.configuration.component_library_url}/styles/icon.png" %>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%= render SdrViewComponents::Elements::TooltipComponent.new(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
) %>
|
|
2
|
+
target_label: 'Collection title',
|
|
3
|
+
tooltip: 'Use the public collection title shown to repository users.'
|
|
4
|
+
) %>
|
|
5
5
|
|
|
6
6
|
<script>
|
|
7
7
|
window.addEventListener('load', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%= form_with(url: '/example', scope: :preferences) do |form| %>
|
|
2
2
|
<%= render SdrViewComponents::Forms::BasicCheckboxComponent.new(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
form: form,
|
|
4
|
+
field_name: :receive_updates,
|
|
5
|
+
checked: true
|
|
6
|
+
) %>
|
|
7
7
|
<% end %>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%= form_with(url: '/example', scope: :preferences) do |form| %>
|
|
2
2
|
<%= render SdrViewComponents::Forms::BasicCheckboxComponent.new(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
form: form,
|
|
4
|
+
field_name: :receive_updates,
|
|
5
|
+
disabled: true
|
|
6
|
+
) %>
|
|
7
7
|
<% end %>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<%= form_with(url: '/example', scope: :preferences) do |form| %>
|
|
2
2
|
<%= render SdrViewComponents::Forms::BasicRadioButtonComponent.new(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
form: form,
|
|
4
|
+
field_name: :delivery_method,
|
|
5
|
+
value: 'email',
|
|
6
|
+
checked: true
|
|
7
|
+
) %>
|
|
8
8
|
<% end %>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%= form_with(url: '/example', scope: :preferences) do |form| %>
|
|
2
2
|
<%= render SdrViewComponents::Forms::BasicRadioButtonComponent.new(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
form: form,
|
|
4
|
+
field_name: :delivery_method,
|
|
5
|
+
value: 'email'
|
|
6
|
+
) %>
|
|
7
7
|
<% end %>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<%= form_with(url: '/example', scope: :preferences) do |form| %>
|
|
2
2
|
<%= render SdrViewComponents::Forms::BasicRadioButtonComponent.new(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
form: form,
|
|
4
|
+
field_name: :delivery_method,
|
|
5
|
+
value: 'email',
|
|
6
|
+
disabled: true
|
|
7
|
+
) %>
|
|
8
8
|
<% end %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%= form_with(url: '/example', scope: :resource) do |form| %>
|
|
2
|
+
<%= render SdrViewComponents::Forms::BasicSelectFieldComponent.new(
|
|
3
|
+
form: form,
|
|
4
|
+
field_name: :type,
|
|
5
|
+
options: [
|
|
6
|
+
%w[Book book],
|
|
7
|
+
%w[Image image],
|
|
8
|
+
%w[Map map]
|
|
9
|
+
],
|
|
10
|
+
prompt: 'Choose a resource type'
|
|
11
|
+
) %>
|
|
12
|
+
<% end %>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%= form_with(url: '/example', scope: :feedback) do |form| %>
|
|
2
2
|
<%= render SdrViewComponents::Forms::BasicTextAreaComponent.new(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
form: form,
|
|
4
|
+
field_name: :comments,
|
|
5
|
+
placeholder: 'Add a note about this item'
|
|
6
|
+
) %>
|
|
7
7
|
<% end %>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%= form_with(url: '/example', scope: :feedback) do |form| %>
|
|
2
2
|
<%= render SdrViewComponents::Forms::BasicTextAreaComponent.new(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
form: form,
|
|
4
|
+
field_name: :comments,
|
|
5
|
+
required: true
|
|
6
|
+
) %>
|
|
7
7
|
<% end %>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<%= form_with(url: '/example', scope: :item) do |form| %>
|
|
2
2
|
<%= render SdrViewComponents::Forms::BasicTextFieldComponent.new(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
form: form,
|
|
4
|
+
field_name: :title,
|
|
5
|
+
disabled: true,
|
|
6
|
+
placeholder: 'This field is unavailable'
|
|
7
|
+
) %>
|
|
8
8
|
<% end %>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%= form_with(url: '/example', scope: :item) do |form| %>
|
|
2
2
|
<%= render SdrViewComponents::Forms::BasicTextFieldComponent.new(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
form: form,
|
|
4
|
+
field_name: :title,
|
|
5
|
+
placeholder: 'Enter a descriptive title'
|
|
6
|
+
) %>
|
|
7
7
|
<% end %>
|
data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/checked.html.erb
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
<%= form_with(model: model, url: '/example') do |form| %>
|
|
4
4
|
<%= render SdrViewComponents::Forms::CheckboxComponent.new(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
form: form,
|
|
6
|
+
field_name: :test_boolean_field,
|
|
7
|
+
input_checked: true
|
|
8
|
+
) %>
|
|
9
9
|
<% end %>
|
data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/disabled.html.erb
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
<%= form_with(model: model, url: '/example') do |form| %>
|
|
4
4
|
<%= render SdrViewComponents::Forms::CheckboxComponent.new(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
form: form,
|
|
6
|
+
field_name: :test_boolean_field,
|
|
7
|
+
input_disabled: true
|
|
8
|
+
) %>
|
|
9
9
|
<% end %>
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
<%= form_with(model: model, url: '/example') do |form| %>
|
|
4
4
|
<%= render SdrViewComponents::Forms::CheckboxComponent.new(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
form: form,
|
|
6
|
+
field_name: :test_boolean_field
|
|
7
|
+
) do |component| %>
|
|
8
8
|
<% component.with_additional_container_content do %>
|
|
9
9
|
<span class="text-info">Extra info: This is additional container content.</span>
|
|
10
10
|
<% end %>
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
<%= form_with(model: model, url: '/example') do |form| %>
|
|
4
4
|
<%= render SdrViewComponents::Forms::CheckboxComponent.new(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
10
|
<% end %>
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
<%= form_with(model: model, url: '/example') do |form| %>
|
|
4
4
|
<%= render SdrViewComponents::Forms::CheckboxComponent.new(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
form: form,
|
|
6
|
+
field_name: :test_boolean_field,
|
|
7
|
+
label_text: 'I agree to the terms and conditions'
|
|
8
|
+
) %>
|
|
9
9
|
<% end %>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<% model = SdrViewComponents::Forms::CheckboxComponentPreview::CheckboxPreviewModel.new(test_boolean_field: false) %>
|
|
2
|
-
<% model.valid? %>
|
|
3
2
|
|
|
4
3
|
<%= form_with(model: model, url: '/example') do |form| %>
|
|
5
4
|
<%= render SdrViewComponents::Forms::CheckboxComponent.new(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
form: form,
|
|
6
|
+
field_name: :test_boolean_field
|
|
7
|
+
) %>
|
|
9
8
|
<% end %>
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
<%= form_with(model: model, url: '/upload') do |form| %>
|
|
4
4
|
<%= render SdrViewComponents::Forms::FileComponent.new(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
form: form,
|
|
6
|
+
field_name: :file
|
|
7
|
+
) do |component| %>
|
|
8
8
|
<% component.with_additional_container_content do %>
|
|
9
9
|
<div class="alert alert-info mt-2" role="alert">
|
|
10
10
|
<strong>Note:</strong> Accepted file types are PDF, DOC, and DOCX only.
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
<%= form_with(model: model, url: '/upload') do |form| %>
|
|
4
4
|
<%= render SdrViewComponents::Forms::FileComponent.new(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
form: form,
|
|
6
|
+
field_name: :file,
|
|
7
|
+
help_text: 'Select a file to upload. Maximum file size: 10MB.'
|
|
8
|
+
) %>
|
|
9
9
|
<% end %>
|