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.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +31 -5
  3. data/app/assets/sdr_view_components.css +9 -1
  4. data/app/components/sdr_view_components/elements/toast_component.html.erb +4 -8
  5. data/app/components/sdr_view_components/forms/basic_select_field_component.rb +24 -0
  6. data/app/components/sdr_view_components/forms/select_field_component.rb +20 -0
  7. data/app/components/sdr_view_components/forms/toggle_component.html.erb +1 -1
  8. data/app/components/sdr_view_components/forms/toggle_option_component.html.erb +1 -1
  9. data/app/components/sdr_view_components/tables/row_component.html.erb +1 -1
  10. data/app/views/layouts/lookbook.html.erb +1 -2
  11. data/lib/sdr_view_components/version.rb +1 -1
  12. data/spec/components/previews/sdr_view_components/elements/tooltip_component_preview/default.html.erb +3 -3
  13. data/spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview/checked.html.erb +4 -4
  14. data/spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview/default.html.erb +3 -3
  15. data/spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview/disabled.html.erb +4 -4
  16. data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/default.html.erb +3 -3
  17. data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/with_accept.html.erb +4 -4
  18. data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/with_multiple.html.erb +4 -4
  19. data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/with_required.html.erb +4 -4
  20. data/spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/checked.html.erb +5 -5
  21. data/spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/default.html.erb +4 -4
  22. data/spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/disabled.html.erb +5 -5
  23. data/spec/components/previews/sdr_view_components/forms/basic/basic_select_field_component_preview/default.html.erb +11 -0
  24. data/spec/components/previews/sdr_view_components/forms/basic/basic_select_field_component_preview/with_prompt.html.erb +12 -0
  25. data/spec/components/previews/sdr_view_components/forms/basic/basic_select_field_component_preview.rb +13 -0
  26. data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/default.html.erb +3 -3
  27. data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_placeholder.html.erb +4 -4
  28. data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_required.html.erb +4 -4
  29. data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_rows.html.erb +4 -4
  30. data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/default.html.erb +3 -3
  31. data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/disabled.html.erb +5 -5
  32. data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/required.html.erb +4 -4
  33. data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/with_placeholder.html.erb +4 -4
  34. data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/checked.html.erb +4 -4
  35. data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/default.html.erb +3 -3
  36. data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/disabled.html.erb +4 -4
  37. data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_additional_container_content.html.erb +3 -3
  38. data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_help_text.html.erb +5 -5
  39. data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_label.html.erb +4 -4
  40. data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_validation_error.html.erb +3 -4
  41. data/spec/components/previews/sdr_view_components/forms/file_component_preview/default.html.erb +3 -3
  42. data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_additional_container_content.html.erb +3 -3
  43. data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_help_text.html.erb +4 -4
  44. data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_help_text_below.html.erb +5 -5
  45. data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_label.html.erb +4 -4
  46. data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_multiple.html.erb +4 -4
  47. data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_validation_error.html.erb +3 -4
  48. data/spec/components/previews/sdr_view_components/forms/help_text_component_preview/with_text.html.erb +3 -3
  49. data/spec/components/previews/sdr_view_components/forms/label_component_preview/default.html.erb +4 -4
  50. data/spec/components/previews/sdr_view_components/forms/label_component_preview/hidden_label.html.erb +5 -5
  51. data/spec/components/previews/sdr_view_components/forms/label_component_preview/with_caption.html.erb +5 -5
  52. data/spec/components/previews/sdr_view_components/forms/label_component_preview/with_tooltip.html.erb +5 -5
  53. data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/default.html.erb +4 -4
  54. data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_additional_container_content.html.erb +5 -5
  55. data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_disabled_label.html.erb +11 -0
  56. data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_help_text.html.erb +5 -5
  57. data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_help_text_below.html.erb +6 -6
  58. data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_label.html.erb +5 -5
  59. data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_validation_error.html.erb +5 -6
  60. data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview.rb +4 -0
  61. data/spec/components/previews/sdr_view_components/forms/select_field_component_preview/default.html.erb +13 -0
  62. data/spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_additional_container_content.html.erb +19 -0
  63. data/spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_help_text.html.erb +14 -0
  64. data/spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_help_text_below.html.erb +15 -0
  65. data/spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_prompt.html.erb +14 -0
  66. data/spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_validation_error.html.erb +15 -0
  67. data/spec/components/previews/sdr_view_components/forms/select_field_component_preview.rb +30 -0
  68. data/spec/components/previews/sdr_view_components/forms/submit_component_preview/danger.html.erb +3 -3
  69. data/spec/components/previews/sdr_view_components/forms/submit_component_preview/default.html.erb +2 -2
  70. data/spec/components/previews/sdr_view_components/forms/submit_component_preview/info.html.erb +3 -3
  71. data/spec/components/previews/sdr_view_components/forms/submit_component_preview/primary.html.erb +3 -3
  72. data/spec/components/previews/sdr_view_components/forms/submit_component_preview/secondary.html.erb +3 -3
  73. data/spec/components/previews/sdr_view_components/forms/submit_component_preview/success.html.erb +3 -3
  74. data/spec/components/previews/sdr_view_components/forms/submit_component_preview/warning.html.erb +3 -3
  75. data/spec/components/previews/sdr_view_components/forms/submit_component_preview/with_block_content_and_value.html.erb +2 -2
  76. data/spec/components/previews/sdr_view_components/forms/submit_component_preview/with_form_id.html.erb +3 -3
  77. data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/default.html.erb +3 -3
  78. data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_additional_container_content.html.erb +3 -3
  79. data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_help_text.html.erb +4 -4
  80. data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_help_text_below.html.erb +5 -5
  81. data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_hidden_label.html.erb +4 -4
  82. data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_mark_required.html.erb +4 -4
  83. data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_validation_error.html.erb +3 -4
  84. data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/default.html.erb +3 -3
  85. data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/disabled.html.erb +4 -4
  86. data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/label_hidden.html.erb +4 -4
  87. data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/marked_required.html.erb +4 -4
  88. data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/required.html.erb +4 -4
  89. data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_additional_container_content.html.erb +3 -3
  90. data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_help_text.html.erb +4 -4
  91. data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_help_text_below.html.erb +5 -5
  92. data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_placeholder.html.erb +4 -4
  93. data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_validation_error.html.erb +3 -4
  94. data/spec/components/previews/sdr_view_components/forms/toggle_component_preview/default.html.erb +3 -3
  95. data/spec/components/previews/sdr_view_components/forms/toggle_component_preview/with_validation_error.html.erb +3 -4
  96. data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_first_value_and_values.html.erb +3 -3
  97. data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_tooltip.html.erb +4 -4
  98. data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_value.html.erb +3 -3
  99. data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_values.html.erb +3 -3
  100. metadata +14 -1
@@ -2,8 +2,8 @@
2
2
 
3
3
  <%= form_with(model: model, url: '/example') do |form| %>
4
4
  <%= render SdrViewComponents::Forms::TextFieldComponent.new(
5
- form: form,
6
- field_name: :title,
7
- input_required: true
8
- ) %>
5
+ form: form,
6
+ field_name: :title,
7
+ input_required: 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::TextFieldComponent.new(
5
- form: form,
6
- field_name: :title
7
- ) do |component| %>
5
+ form: form,
6
+ field_name: :title
7
+ ) do |component| %>
8
8
  <% component.with_additional_container_content do %>
9
9
  <span class="text-info">Suggested: keep titles under 80 characters.</span>
10
10
  <% end %>
@@ -2,8 +2,8 @@
2
2
 
3
3
  <%= form_with(model: model, url: '/example') do |form| %>
4
4
  <%= render SdrViewComponents::Forms::TextFieldComponent.new(
5
- form: form,
6
- field_name: :title,
7
- help_text: 'Use a concise title that will make sense to end users.'
8
- ) %>
5
+ form: form,
6
+ field_name: :title,
7
+ help_text: 'Use a concise title that will make sense to end users.'
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::TextFieldComponent.new(
5
- form: form,
6
- field_name: :title,
7
- variant: :help_text_below,
8
- help_text: 'Help text appears below the field when using the help_text_below variant.'
9
- ) %>
5
+ form: form,
6
+ field_name: :title,
7
+ variant: :help_text_below,
8
+ help_text: 'Help text appears below the field when using the help_text_below variant.'
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::TextFieldComponent.new(
5
- form: form,
6
- field_name: :title,
7
- input_placeholder: 'Enter a descriptive title'
8
- ) %>
5
+ form: form,
6
+ field_name: :title,
7
+ input_placeholder: 'Enter a descriptive title'
8
+ ) %>
9
9
  <% end %>
@@ -1,9 +1,8 @@
1
1
  <% model = SdrViewComponents::Forms::TextFieldComponentPreview::TextFieldPreviewModel.new(title: nil) %>
2
- <% model.valid? %>
3
2
 
4
3
  <%= form_with(model: model, url: '/example') do |form| %>
5
4
  <%= render SdrViewComponents::Forms::TextFieldComponent.new(
6
- form: form,
7
- field_name: :title
8
- ) %>
5
+ form: form,
6
+ field_name: :title
7
+ ) %>
9
8
  <% end %>
@@ -2,9 +2,9 @@
2
2
 
3
3
  <%= form_with(model: model, url: '/example') do |form| %>
4
4
  <%= render SdrViewComponents::Forms::ToggleComponent.new(
5
- form: form,
6
- field_name: :audience
7
- ) do |component| %>
5
+ form: form,
6
+ field_name: :audience
7
+ ) do |component| %>
8
8
  <% component.with_left_toggle_option(form:, field_name: :audience, label: 'Collections', value: 'collections') %>
9
9
  <% component.with_right_toggle_option(form:, field_name: :audience, label: 'Items', value: 'items') %>
10
10
  <% end %>
@@ -1,11 +1,10 @@
1
1
  <% model = SdrViewComponents::Forms::ToggleComponentPreview::TogglePreviewModel.new(audience: nil) %>
2
- <% model.valid? %>
3
2
 
4
3
  <%= form_with(model: model, url: '/example') do |form| %>
5
4
  <%= render SdrViewComponents::Forms::ToggleComponent.new(
6
- form: form,
7
- field_name: :audience
8
- ) do |component| %>
5
+ form: form,
6
+ field_name: :audience
7
+ ) do |component| %>
9
8
  <% component.with_left_toggle_option(form:, field_name: :audience, label: 'Collections', value: 'collections') %>
10
9
  <% component.with_right_toggle_option(form:, field_name: :audience, label: 'Items', value: 'items') %>
11
10
  <% end %>
@@ -1,8 +1,8 @@
1
1
  <table class="table">
2
2
  <tbody>
3
3
  <%= render SdrViewComponents::Tables::RowComponent.new(
4
- first_value: 'File set',
5
- values: ['Preserved', 'Published']
6
- ) %>
4
+ first_value: 'File set',
5
+ values: %w[Preserved Published]
6
+ ) %>
7
7
  </tbody>
8
8
  </table>
@@ -1,10 +1,10 @@
1
1
  <table class="table">
2
2
  <tbody>
3
3
  <%= render SdrViewComponents::Tables::RowComponent.new(
4
- label: 'Embargo',
5
- value: 'Ends 2027-01-15',
6
- tooltip: 'Date when the item becomes visible to the public.'
7
- ) %>
4
+ label: 'Embargo',
5
+ value: 'Ends 2027-01-15',
6
+ tooltip: 'Date when the item becomes visible to the public.'
7
+ ) %>
8
8
  </tbody>
9
9
  </table>
10
10
 
@@ -1,8 +1,8 @@
1
1
  <table class="table">
2
2
  <tbody>
3
3
  <%= render SdrViewComponents::Tables::RowComponent.new(
4
- label: 'Collection',
5
- value: 'Manuscript Division'
6
- ) %>
4
+ label: 'Collection',
5
+ value: 'Manuscript Division'
6
+ ) %>
7
7
  </tbody>
8
8
  </table>
@@ -1,8 +1,8 @@
1
1
  <table class="table">
2
2
  <tbody>
3
3
  <%= render SdrViewComponents::Tables::RowComponent.new(
4
- label: 'Access',
5
- values: ['Stanford users', 'World']
6
- ) %>
4
+ label: 'Access',
5
+ values: ['Stanford users', 'World']
6
+ ) %>
7
7
  </tbody>
8
8
  </table>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sdr_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Collier
@@ -111,6 +111,7 @@ files:
111
111
  - app/components/sdr_view_components/forms/basic_component.rb
112
112
  - app/components/sdr_view_components/forms/basic_file_component.rb
113
113
  - app/components/sdr_view_components/forms/basic_radio_button_component.rb
114
+ - app/components/sdr_view_components/forms/basic_select_field_component.rb
114
115
  - app/components/sdr_view_components/forms/basic_text_area_component.rb
115
116
  - app/components/sdr_view_components/forms/basic_text_field_component.rb
116
117
  - app/components/sdr_view_components/forms/checkbox_component.rb
@@ -124,6 +125,7 @@ files:
124
125
  - app/components/sdr_view_components/forms/label_component.html.erb
125
126
  - app/components/sdr_view_components/forms/label_component.rb
126
127
  - app/components/sdr_view_components/forms/radio_button_component.rb
128
+ - app/components/sdr_view_components/forms/select_field_component.rb
127
129
  - app/components/sdr_view_components/forms/submit_component.html.erb
128
130
  - app/components/sdr_view_components/forms/submit_component.rb
129
131
  - app/components/sdr_view_components/forms/text_area_component.rb
@@ -203,6 +205,9 @@ files:
203
205
  - spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/checked.html.erb
204
206
  - spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/default.html.erb
205
207
  - spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/disabled.html.erb
208
+ - spec/components/previews/sdr_view_components/forms/basic/basic_select_field_component_preview.rb
209
+ - spec/components/previews/sdr_view_components/forms/basic/basic_select_field_component_preview/default.html.erb
210
+ - spec/components/previews/sdr_view_components/forms/basic/basic_select_field_component_preview/with_prompt.html.erb
206
211
  - spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview.rb
207
212
  - spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/default.html.erb
208
213
  - spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_placeholder.html.erb
@@ -240,10 +245,18 @@ files:
240
245
  - spec/components/previews/sdr_view_components/forms/radio_button_component_preview.rb
241
246
  - spec/components/previews/sdr_view_components/forms/radio_button_component_preview/default.html.erb
242
247
  - spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_additional_container_content.html.erb
248
+ - spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_disabled_label.html.erb
243
249
  - spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_help_text.html.erb
244
250
  - spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_help_text_below.html.erb
245
251
  - spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_label.html.erb
246
252
  - spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_validation_error.html.erb
253
+ - spec/components/previews/sdr_view_components/forms/select_field_component_preview.rb
254
+ - spec/components/previews/sdr_view_components/forms/select_field_component_preview/default.html.erb
255
+ - spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_additional_container_content.html.erb
256
+ - spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_help_text.html.erb
257
+ - spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_help_text_below.html.erb
258
+ - spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_prompt.html.erb
259
+ - spec/components/previews/sdr_view_components/forms/select_field_component_preview/with_validation_error.html.erb
247
260
  - spec/components/previews/sdr_view_components/forms/submit_component_preview.rb
248
261
  - spec/components/previews/sdr_view_components/forms/submit_component_preview/danger.html.erb
249
262
  - spec/components/previews/sdr_view_components/forms/submit_component_preview/default.html.erb