sdr_view_components 0.2.1 → 0.4.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 +31 -1
- data/app/components/sdr_view_components/elements/toast_component.html.erb +5 -13
- data/app/components/sdr_view_components/elements/toast_component.rb +7 -2
- 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/toast_component_preview/disappearing.html.erb +5 -0
- data/spec/components/previews/sdr_view_components/elements/toast_component_preview.rb +2 -0
- 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 +15 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3a3b49086535a4be91b25b4f4a5b68f51c72fd2478f5fc72d54c2b77afe5f7cf
|
|
4
|
+
data.tar.gz: dff1e70705204abaf6202df28826379dd8993d584445506e39f905250fed4795
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a34d248d460b3af61fdb39db821d45620e5444defed6de2505f260cce700b3c6babb9000d10063b98e59a52a171b2df7ca0162bbac8476648efa28b2ee008993
|
|
7
|
+
data.tar.gz: ed9d2ef885985c68e38f640ce30a67382be3cb9f258ac3d03946d896fdcaa651f09acd7059482b3a7f006163730748375a712f498e89832bd87dbe838a293292
|
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')
|
|
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,33 @@ 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
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Toasts */
|
|
121
|
+
@keyframes fade-out {
|
|
122
|
+
0% {
|
|
123
|
+
opacity: 1;
|
|
124
|
+
max-height: 200px;
|
|
125
|
+
visibility: visible;
|
|
126
|
+
}
|
|
127
|
+
79% { opacity: 1; }
|
|
128
|
+
80% { max-height: 200px; }
|
|
129
|
+
|
|
130
|
+
100% {
|
|
131
|
+
opacity: 0;
|
|
132
|
+
max-height: 0;
|
|
133
|
+
visibility: hidden;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.toast-disappear {
|
|
138
|
+
animation: fade-out 5s ease-in forwards;
|
|
139
|
+
}
|
|
140
|
+
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
class="toast align-items-center show"
|
|
3
|
-
role="alert"
|
|
4
|
-
aria-live="assertive"
|
|
5
|
-
aria-atomic="true"
|
|
6
|
-
>
|
|
1
|
+
<%= tag.div class: classes, role: 'alert', aria: { live: 'assertive', atomic: 'true' } do %>
|
|
7
2
|
<%= tag.div class: toast_body_classes do %>
|
|
8
3
|
<div class="d-flex">
|
|
9
4
|
<div
|
|
10
|
-
class="bi bi-exclamation-circle-fill fs-3 me-3 align-self-center d-flex justify-content-center"
|
|
11
|
-
></div>
|
|
5
|
+
class="bi bi-exclamation-circle-fill fs-3 me-3 align-self-center d-flex justify-content-center"></div>
|
|
12
6
|
<div>
|
|
13
7
|
<div class="fw-semibold"><%= title %> </div>
|
|
14
8
|
<% if text.present? %>
|
|
@@ -19,8 +13,7 @@
|
|
|
19
13
|
<% if close_text.present? %>
|
|
20
14
|
<button
|
|
21
15
|
type="button"
|
|
22
|
-
class="btn btn-text text-uppercase text-white"
|
|
23
|
-
>
|
|
16
|
+
class="btn btn-text text-uppercase text-white">
|
|
24
17
|
<%= close_text %>
|
|
25
18
|
</button>
|
|
26
19
|
<% end %>
|
|
@@ -28,9 +21,8 @@
|
|
|
28
21
|
type="button"
|
|
29
22
|
class="btn btn-close btn-close-white"
|
|
30
23
|
aria-label="Close"
|
|
31
|
-
data-bs-dismiss="toast"
|
|
32
|
-
></button>
|
|
24
|
+
data-bs-dismiss="toast"></button>
|
|
33
25
|
</div>
|
|
34
26
|
</div>
|
|
35
27
|
<% end %>
|
|
36
|
-
|
|
28
|
+
<% end %>
|
|
@@ -4,15 +4,20 @@ module SdrViewComponents
|
|
|
4
4
|
module Elements
|
|
5
5
|
# Component for rendering a toast element.
|
|
6
6
|
class ToastComponent < BaseComponent
|
|
7
|
-
def initialize(title:, text: nil, close_text: nil, variant: :black)
|
|
7
|
+
def initialize(title:, text: nil, close_text: nil, variant: :black, disappearing: false)
|
|
8
8
|
@title = title
|
|
9
9
|
@text = text
|
|
10
10
|
@close_text = close_text
|
|
11
11
|
@variant = variant
|
|
12
|
+
@disappearing = disappearing
|
|
12
13
|
super()
|
|
13
14
|
end
|
|
14
15
|
|
|
15
|
-
attr_reader :title, :text, :close_text, :variant
|
|
16
|
+
attr_reader :title, :text, :close_text, :variant, :disappearing
|
|
17
|
+
|
|
18
|
+
def classes
|
|
19
|
+
merge_classes('toast align-items-center show', ('toast-disappear' if disappearing))
|
|
20
|
+
end
|
|
16
21
|
|
|
17
22
|
def toast_body_classes
|
|
18
23
|
merge_classes([background_color], %w[toast-body text-white])
|
|
@@ -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" %>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<%= render SdrViewComponents::Elements::ToastComponent.new(title: 'Alert!', text: 'Non-Disappearing Toast text') %>
|
|
2
|
+
|
|
3
|
+
<%= render SdrViewComponents::Elements::ToastComponent.new(title: 'Alert!', text: 'Disappearing Toast text. Wait 5 secs.', disappearing: true, variant: :green) %>
|
|
4
|
+
|
|
5
|
+
<%= render SdrViewComponents::Elements::ToastComponent.new(title: 'Alert!', text: 'Non-Disappearing Toast text') %>
|
|
@@ -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 %>
|