primer_view_components 0.0.120 → 0.0.122

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 (172) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +58 -0
  3. data/app/assets/styles/primer_view_components.css +2 -2
  4. data/app/assets/styles/primer_view_components.css.map +1 -1
  5. data/app/components/primer/alpha/action_list.css.json +123 -1
  6. data/app/components/primer/alpha/auto_complete.css.json +23 -1
  7. data/app/components/primer/alpha/banner.css.json +24 -1
  8. data/app/components/primer/alpha/button_marketing.css.json +33 -1
  9. data/app/components/primer/alpha/check_box.rb +74 -0
  10. data/app/components/primer/alpha/check_box_group.rb +36 -0
  11. data/app/components/primer/alpha/dialog.css.json +82 -1
  12. data/app/components/primer/alpha/dialog.rb +1 -1
  13. data/app/components/primer/alpha/dropdown.css.json +40 -1
  14. data/app/components/primer/alpha/form_button.rb +32 -0
  15. data/app/components/primer/alpha/form_control.html.erb +26 -0
  16. data/app/components/primer/alpha/form_control.rb +105 -0
  17. data/app/components/primer/alpha/layout.css.json +80 -1
  18. data/app/components/primer/alpha/menu.css.json +28 -1
  19. data/app/components/primer/alpha/multi_input.rb +81 -0
  20. data/app/components/primer/alpha/radio_button.rb +25 -0
  21. data/app/components/primer/alpha/radio_button_group.rb +36 -0
  22. data/app/components/primer/alpha/segmented_control/item.rb +1 -0
  23. data/app/components/primer/alpha/segmented_control.css +1 -1
  24. data/app/components/primer/alpha/segmented_control.css.json +31 -1
  25. data/app/components/primer/alpha/segmented_control.css.map +1 -1
  26. data/app/components/primer/alpha/segmented_control.pcss +43 -12
  27. data/app/components/primer/alpha/segmented_control.rb +30 -0
  28. data/app/components/primer/alpha/select.rb +37 -0
  29. data/app/components/primer/alpha/submit_button.rb +32 -0
  30. data/app/components/primer/alpha/tab_nav.css.json +24 -1
  31. data/app/components/primer/alpha/tab_panels.rb +7 -0
  32. data/app/components/primer/alpha/text_area.rb +24 -0
  33. data/app/components/primer/alpha/text_field.css +2 -2
  34. data/app/components/primer/alpha/text_field.css.json +134 -1
  35. data/app/components/primer/alpha/text_field.css.map +1 -1
  36. data/app/components/primer/alpha/text_field.pcss +27 -0
  37. data/app/components/primer/alpha/text_field.rb +16 -20
  38. data/app/components/primer/alpha/toggle_switch.css +1 -1
  39. data/app/components/primer/alpha/toggle_switch.css.json +40 -1
  40. data/app/components/primer/alpha/toggle_switch.css.map +1 -1
  41. data/app/components/primer/alpha/toggle_switch.pcss +31 -61
  42. data/app/components/primer/alpha/underline_nav.css.json +28 -1
  43. data/app/components/primer/base_component.rb +3 -3
  44. data/app/components/primer/beta/avatar.css.json +17 -1
  45. data/app/components/primer/beta/avatar_stack.css.json +28 -1
  46. data/app/components/primer/beta/blankslate.css.json +22 -1
  47. data/app/components/primer/beta/border_box.css.json +54 -1
  48. data/app/components/primer/beta/breadcrumbs.css.json +11 -1
  49. data/app/components/primer/beta/button.css.json +71 -1
  50. data/app/components/primer/beta/close_button.rb +1 -1
  51. data/app/components/primer/beta/counter.css.json +10 -1
  52. data/app/components/primer/beta/flash.css.json +27 -1
  53. data/app/components/primer/beta/label.css.json +25 -1
  54. data/app/components/primer/beta/link.css.json +19 -1
  55. data/app/components/primer/beta/popover.css.json +39 -1
  56. data/app/components/primer/beta/progress_bar.css.json +10 -1
  57. data/app/components/primer/{local_time.d.ts → beta/relative_time.d.ts} +0 -0
  58. data/app/components/primer/{local_time.js → beta/relative_time.js} +0 -0
  59. data/app/components/primer/{local_time.ts → beta/relative_time.ts} +0 -0
  60. data/app/components/primer/beta/state.css.json +13 -1
  61. data/app/components/primer/beta/subhead.css.json +12 -1
  62. data/app/components/primer/beta/timeline_item.css.json +16 -1
  63. data/app/components/primer/beta/truncate.css.json +12 -1
  64. data/app/components/primer/component.rb +12 -3
  65. data/app/components/primer/primer.d.ts +1 -2
  66. data/app/components/primer/primer.js +1 -2
  67. data/app/components/primer/primer.ts +1 -2
  68. data/app/components/primer/truncate.css.json +13 -1
  69. data/app/forms/example_toggle_switch_form.rb +1 -1
  70. data/app/forms/{select_list_form.rb → select_form.rb} +1 -1
  71. data/app/lib/primer/css/layout.css.json +316 -1
  72. data/app/lib/primer/css/utilities.css.json +1659 -1
  73. data/app/lib/primer/view_helper.rb +0 -1
  74. data/lib/primer/deprecations.yml +0 -78
  75. data/lib/primer/form_components.rb +26 -6
  76. data/lib/primer/forms/acts_as_component.rb +12 -1
  77. data/lib/primer/forms/builder.rb +1 -17
  78. data/lib/primer/forms/button.rb +4 -1
  79. data/lib/primer/forms/check_box_group.html.erb +14 -9
  80. data/lib/primer/forms/check_box_group.rb +5 -0
  81. data/lib/primer/forms/dsl/check_box_group_input.rb +3 -4
  82. data/lib/primer/forms/dsl/input.rb +33 -2
  83. data/lib/primer/forms/dsl/input_methods.rb +49 -1
  84. data/lib/primer/forms/dsl/radio_button_group_input.rb +2 -3
  85. data/lib/primer/forms/dsl/{select_list_input.rb → select_input.rb} +2 -2
  86. data/lib/primer/forms/dsl/text_field_input.rb +7 -5
  87. data/lib/primer/forms/form_control.rb +0 -1
  88. data/lib/primer/forms/group.html.erb +1 -1
  89. data/lib/primer/forms/multi.html.erb +8 -6
  90. data/lib/primer/forms/multi.rb +2 -0
  91. data/lib/primer/forms/radio_button_group.html.erb +14 -9
  92. data/lib/primer/forms/radio_button_group.rb +5 -0
  93. data/lib/primer/forms/{select_list.html.erb → select.html.erb} +0 -0
  94. data/lib/primer/forms/{select_list.rb → select.rb} +2 -2
  95. data/lib/primer/forms/spacing_wrapper.html.erb +1 -1
  96. data/lib/primer/forms/text_area.rb +1 -1
  97. data/lib/primer/forms/text_field.rb +5 -1
  98. data/lib/primer/forms/toggle_switch_form.rb +10 -3
  99. data/lib/primer/forms/utils.rb +20 -0
  100. data/lib/primer/view_components/engine.rb +1 -1
  101. data/lib/primer/view_components/version.rb +1 -1
  102. data/lib/primer/yard/backend.rb +1 -15
  103. data/lib/primer/yard/component_manifest.rb +44 -27
  104. data/lib/primer/yard/component_ref.rb +40 -0
  105. data/lib/primer/yard/docs_helper.rb +16 -2
  106. data/lib/primer/yard/legacy_gatsby_backend.rb +9 -15
  107. data/lib/primer/yard/lookbook_docs_helper.rb +32 -0
  108. data/lib/primer/yard/lookbook_pages_backend.rb +194 -0
  109. data/lib/primer/yard/registry.rb +6 -21
  110. data/lib/primer/yard/renders_many_handler.rb +1 -1
  111. data/lib/primer/yard/renders_one_handler.rb +1 -1
  112. data/lib/primer/yard.rb +14 -0
  113. data/lib/tasks/docs.rake +26 -13
  114. data/lib/tasks/static.rake +22 -0
  115. data/previews/pages/forms/01_introduction.md.erb +44 -0
  116. data/previews/pages/forms/02_getting_started.md.erb +125 -0
  117. data/previews/pages/forms/03_caption_templates.md.erb +30 -0
  118. data/previews/pages/forms/04_after_content.md.erb +39 -0
  119. data/previews/pages/forms/05_groups_layouts.md.erb +22 -0
  120. data/previews/pages/forms/06_miscellaneous_inputs.md.erb +43 -0
  121. data/previews/pages/forms/07_toggle_switch_forms.md.erb +58 -0
  122. data/previews/pages/forms/08_validations.md.erb +28 -0
  123. data/previews/pages/forms/09_compound_forms.md.erb +97 -0
  124. data/previews/primer/alpha/auto_complete_preview.rb +6 -6
  125. data/previews/primer/alpha/check_box_group_preview.rb +89 -0
  126. data/previews/primer/alpha/check_box_preview.rb +62 -0
  127. data/previews/primer/alpha/form_control_preview/playground.html.erb +9 -0
  128. data/previews/primer/alpha/form_control_preview.rb +106 -0
  129. data/previews/primer/alpha/multi_input_preview/playground.html.erb +41 -0
  130. data/previews/primer/alpha/multi_input_preview.rb +80 -0
  131. data/previews/primer/alpha/radio_button_group_preview.rb +83 -0
  132. data/previews/primer/alpha/radio_button_preview.rb +62 -0
  133. data/previews/primer/alpha/segmented_control_preview/with_label_and_caption.html.erb +9 -0
  134. data/previews/primer/alpha/segmented_control_preview/with_subhead_actions.html.erb +11 -0
  135. data/previews/primer/alpha/segmented_control_preview.rb +7 -1
  136. data/previews/primer/alpha/select_preview.rb +130 -0
  137. data/previews/primer/alpha/text_area_preview.rb +87 -0
  138. data/previews/primer/alpha/text_field_preview.rb +24 -1
  139. data/previews/primer/alpha/toggle_switch_preview.rb +9 -9
  140. data/previews/primer/beta/auto_complete_preview.rb +17 -17
  141. data/previews/primer/forms/forms_preview/example_toggle_switch_form.html.erb +2 -2
  142. data/previews/primer/forms/forms_preview/{select_list_form.html.erb → select_form.html.erb} +1 -1
  143. data/previews/primer/forms/forms_preview.rb +3 -1
  144. data/previews/primer/url_helpers.rb +1 -1
  145. data/static/arguments.json +1348 -1412
  146. data/static/audited_at.json +12 -21
  147. data/static/constants.json +20 -51
  148. data/static/previews.json +1812 -0
  149. data/static/statuses.json +10 -19
  150. metadata +47 -32
  151. data/app/components/primer/dropdown/menu.rb +0 -14
  152. data/app/components/primer/dropdown.rb +0 -7
  153. data/app/components/primer/hellip_button.rb +0 -7
  154. data/app/components/primer/label_component.rb +0 -7
  155. data/app/components/primer/link_component.rb +0 -7
  156. data/app/components/primer/local_time.rb +0 -63
  157. data/app/components/primer/markdown.rb +0 -7
  158. data/app/components/primer/menu_component.rb +0 -7
  159. data/app/components/primer/octicon_component.rb +0 -7
  160. data/app/components/primer/octicon_symbols_component.rb +0 -7
  161. data/app/components/primer/popover_component.rb +0 -8
  162. data/app/components/primer/spinner_component.rb +0 -7
  163. data/app/components/primer/state_component.rb +0 -7
  164. data/app/components/primer/subhead_component.rb +0 -7
  165. data/app/components/primer/tab_container_component.rb +0 -7
  166. data/app/components/primer/time_ago_component.d.ts +0 -1
  167. data/app/components/primer/time_ago_component.js +0 -1
  168. data/app/components/primer/time_ago_component.rb +0 -51
  169. data/app/components/primer/time_ago_component.ts +0 -1
  170. data/app/components/primer/timeline_item_component.rb +0 -13
  171. data/previews/primer/local_time_component_preview.rb +0 -57
  172. data/previews/primer/time_ago_component_preview.rb +0 -27
@@ -0,0 +1,130 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Alpha
5
+ # @label Select
6
+ class SelectPreview < ViewComponent::Preview
7
+ # @label Playground
8
+ #
9
+ # @param name text
10
+ # @param id text
11
+ # @param label text
12
+ # @param caption text
13
+ # @param required toggle
14
+ # @param visually_hide_label toggle
15
+ # @param size [Symbol] select [small, medium, large]
16
+ # @param full_width toggle
17
+ # @param disabled toggle
18
+ # @param invalid toggle
19
+ # @param validation_message text
20
+ def playground(
21
+ name: "my-select-list",
22
+ id: "my-select-list",
23
+ label: "Favorite place to visit",
24
+ caption: "They're all good",
25
+ required: false,
26
+ visually_hide_label: false,
27
+ size: Primer::Forms::Dsl::Input::DEFAULT_SIZE.to_s,
28
+ full_width: false,
29
+ disabled: false,
30
+ invalid: false,
31
+ validation_message: nil
32
+ )
33
+ system_arguments = {
34
+ name: name,
35
+ id: id,
36
+ label: label,
37
+ caption: caption,
38
+ required: required,
39
+ visually_hide_label: visually_hide_label,
40
+ size: size,
41
+ full_width: full_width,
42
+ disabled: disabled,
43
+ invalid: invalid,
44
+ validation_message: validation_message
45
+ }
46
+
47
+ render(Primer::Alpha::Select.new(**system_arguments)) do |component|
48
+ component.option(label: "Lopez Island", value: "lopez")
49
+ component.option(label: "Shaw Island", value: "shaw")
50
+ component.option(label: "Orcas Island", value: "orcas")
51
+ component.option(label: "San Juan Island", value: "san_juan")
52
+ end
53
+ end
54
+
55
+ # @label Default
56
+ def default
57
+ render(Primer::Alpha::Select.new(name: "my-select-list", label: "Favorite place to visit")) do |component|
58
+ component.option(label: "Lopez Island", value: "lopez")
59
+ component.option(label: "Shaw Island", value: "shaw")
60
+ component.option(label: "Orcas Island", value: "orcas")
61
+ component.option(label: "San Juan Island", value: "san_juan")
62
+ end
63
+ end
64
+
65
+ # @!group Options
66
+ #
67
+ # @label With caption
68
+ def with_caption
69
+ render(Primer::Alpha::Select.new(caption: "With a caption", name: "my-select-list", label: "Favorite place to visit")) do |component|
70
+ component.option(label: "Lopez Island", value: "lopez")
71
+ component.option(label: "Shaw Island", value: "shaw")
72
+ component.option(label: "Orcas Island", value: "orcas")
73
+ component.option(label: "San Juan Island", value: "san_juan")
74
+ end
75
+ end
76
+
77
+ # @label Visually hidden label
78
+ def visually_hide_label
79
+ render(Primer::Alpha::Select.new(visually_hide_label: true, name: "my-select-list", label: "Favorite place to visit")) do |component|
80
+ component.option(label: "Lopez Island", value: "lopez")
81
+ component.option(label: "Shaw Island", value: "shaw")
82
+ component.option(label: "Orcas Island", value: "orcas")
83
+ component.option(label: "San Juan Island", value: "san_juan")
84
+ end
85
+ end
86
+
87
+ # @label Full width
88
+ def full_width
89
+ render(Primer::Alpha::Select.new(full_width: true, name: "my-select-list", label: "Favorite place to visit")) do |component|
90
+ component.option(label: "Lopez Island", value: "lopez")
91
+ component.option(label: "Shaw Island", value: "shaw")
92
+ component.option(label: "Orcas Island", value: "orcas")
93
+ component.option(label: "San Juan Island", value: "san_juan")
94
+ end
95
+ end
96
+
97
+ # @label Disabled
98
+ def disabled
99
+ render(Primer::Alpha::Select.new(disabled: true, name: "my-select-list", label: "Favorite place to visit")) do |component|
100
+ component.option(label: "Lopez Island", value: "lopez")
101
+ component.option(label: "Shaw Island", value: "shaw")
102
+ component.option(label: "Orcas Island", value: "orcas")
103
+ component.option(label: "San Juan Island", value: "san_juan")
104
+ end
105
+ end
106
+
107
+ # @label Invalid
108
+ def invalid
109
+ render(Primer::Alpha::Select.new(invalid: true, name: "my-select-list", label: "Favorite place to visit")) do |component|
110
+ component.option(label: "Lopez Island", value: "lopez")
111
+ component.option(label: "Shaw Island", value: "shaw")
112
+ component.option(label: "Orcas Island", value: "orcas")
113
+ component.option(label: "San Juan Island", value: "san_juan")
114
+ end
115
+ end
116
+
117
+ # @label With validation message
118
+ def with_validation_message
119
+ render(Primer::Alpha::Select.new(validation_message: "An error occurred!", name: "my-select-list", label: "Favorite place to visit")) do |component|
120
+ component.option(label: "Lopez Island", value: "lopez")
121
+ component.option(label: "Shaw Island", value: "shaw")
122
+ component.option(label: "Orcas Island", value: "orcas")
123
+ component.option(label: "San Juan Island", value: "san_juan")
124
+ end
125
+ end
126
+ #
127
+ # @!endgroup
128
+ end
129
+ end
130
+ end
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Primer
4
+ module Alpha
5
+ # @label TextArea
6
+ class TextAreaPreview < ViewComponent::Preview
7
+ # @label Playground
8
+ #
9
+ # @param name text
10
+ # @param id text
11
+ # @param label text
12
+ # @param caption text
13
+ # @param required toggle
14
+ # @param visually_hide_label toggle
15
+ # @param full_width toggle
16
+ # @param disabled toggle
17
+ # @param invalid toggle
18
+ # @param validation_message text
19
+ def playground(
20
+ name: "my-text-area",
21
+ id: "my-text-area",
22
+ label: "Tell me about yourself",
23
+ caption: "You can trust me, I'm a website",
24
+ required: false,
25
+ visually_hide_label: false,
26
+ full_width: false,
27
+ disabled: false,
28
+ invalid: false,
29
+ validation_message: nil
30
+ )
31
+ system_arguments = {
32
+ name: name,
33
+ id: id,
34
+ label: label,
35
+ caption: caption,
36
+ required: required,
37
+ visually_hide_label: visually_hide_label,
38
+ full_width: full_width,
39
+ disabled: disabled,
40
+ invalid: invalid,
41
+ validation_message: validation_message
42
+ }
43
+
44
+ render(Primer::Alpha::TextArea.new(**system_arguments))
45
+ end
46
+
47
+ # @label Default
48
+ def default
49
+ render(Primer::Alpha::TextArea.new(name: "my-text-area", label: "Tell me about yourself"))
50
+ end
51
+
52
+ # @!group Options
53
+ #
54
+ # @label With caption
55
+ def with_caption
56
+ render(Primer::Alpha::TextArea.new(caption: "With a caption", name: "my-text-area", label: "Tell me about yourself"))
57
+ end
58
+
59
+ # @label Visually hidden label
60
+ def visually_hide_label
61
+ render(Primer::Alpha::TextArea.new(visually_hide_label: true, name: "my-text-area", label: "Tell me about yourself"))
62
+ end
63
+
64
+ # @label Full width
65
+ def full_width
66
+ render(Primer::Alpha::TextArea.new(full_width: true, name: "my-text-area", label: "Tell me about yourself"))
67
+ end
68
+
69
+ # @label Disabled
70
+ def disabled
71
+ render(Primer::Alpha::TextArea.new(disabled: true, name: "my-text-area", label: "Tell me about yourself"))
72
+ end
73
+
74
+ # @label Invalid
75
+ def invalid
76
+ render(Primer::Alpha::TextArea.new(invalid: true, name: "my-text-area", label: "Tell me about yourself"))
77
+ end
78
+
79
+ # @label With validation message
80
+ def with_validation_message
81
+ render(Primer::Alpha::TextArea.new(validation_message: "An error occurred!", name: "my-text-area", label: "Tell me about yourself"))
82
+ end
83
+ #
84
+ # @!endgroup
85
+ end
86
+ end
87
+ end
@@ -9,6 +9,8 @@ module Primer
9
9
  # @param name text
10
10
  # @param id text
11
11
  # @param label text
12
+ # @param caption text
13
+ # @param required toggle
12
14
  # @param visually_hide_label toggle
13
15
  # @param size [Symbol] select [small, medium, large]
14
16
  # @param show_clear_button toggle
@@ -16,14 +18,17 @@ module Primer
16
18
  # @param full_width toggle
17
19
  # @param disabled toggle
18
20
  # @param invalid toggle
21
+ # @param validation_message text
19
22
  # @param placeholder text
20
23
  # @param inset toggle
21
24
  # @param monospace toggle
22
- # @param leading_visual_icon text
25
+ # @param leading_visual_icon octicon
23
26
  def playground(
24
27
  name: "my-text-field",
25
28
  id: "my-text-field",
26
29
  label: "My text field",
30
+ caption: "My text field",
31
+ required: false,
27
32
  visually_hide_label: false,
28
33
  size: Primer::Forms::Dsl::Input::DEFAULT_SIZE.to_s,
29
34
  show_clear_button: false,
@@ -31,6 +36,7 @@ module Primer
31
36
  full_width: false,
32
37
  disabled: false,
33
38
  invalid: false,
39
+ validation_message: nil,
34
40
  placeholder: nil,
35
41
  inset: false,
36
42
  monospace: false,
@@ -40,6 +46,8 @@ module Primer
40
46
  name: name,
41
47
  id: id,
42
48
  label: label,
49
+ caption: caption,
50
+ required: required,
43
51
  visually_hide_label: visually_hide_label,
44
52
  size: size,
45
53
  show_clear_button: show_clear_button,
@@ -47,6 +55,7 @@ module Primer
47
55
  full_width: full_width,
48
56
  disabled: disabled,
49
57
  invalid: invalid,
58
+ validation_message: validation_message,
50
59
  placeholder: placeholder,
51
60
  inset: inset,
52
61
  monospace: monospace
@@ -144,6 +153,20 @@ module Primer
144
153
  end
145
154
  #
146
155
  # @!endgroup
156
+
157
+ # @!group Auto check
158
+ #
159
+ # @label Auto check request ok
160
+ def with_auto_check_ok
161
+ render(Primer::Alpha::TextField.new(auto_check_src: UrlHelpers.example_check_ok_path, name: "my-text-field", label: "My text field"))
162
+ end
163
+
164
+ # @label Auto check request error
165
+ def with_auto_check_error
166
+ render(Primer::Alpha::TextField.new(auto_check_src: UrlHelpers.example_check_error_path, name: "my-text-field", label: "My text field"))
167
+ end
168
+ #
169
+ # @!endgroup
147
170
  end
148
171
  end
149
172
  end
@@ -9,31 +9,31 @@ module Primer
9
9
  include ActionView::Helpers::FormTagHelper
10
10
 
11
11
  def playground
12
- render(ToggleSwitch.new(src: URLHelpers.toggle_switch_index_path))
12
+ render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path))
13
13
  end
14
14
 
15
15
  def default
16
- render(ToggleSwitch.new(src: URLHelpers.toggle_switch_index_path))
16
+ render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path))
17
17
  end
18
18
 
19
19
  def checked
20
- render(ToggleSwitch.new(src: URLHelpers.toggle_switch_index_path, checked: true))
20
+ render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, checked: true))
21
21
  end
22
22
 
23
23
  def disabled
24
- render(ToggleSwitch.new(src: URLHelpers.toggle_switch_index_path, enabled: false))
24
+ render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, enabled: false))
25
25
  end
26
26
 
27
27
  def checked_disabled
28
- render(ToggleSwitch.new(src: URLHelpers.toggle_switch_index_path, checked: true, enabled: false))
28
+ render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, checked: true, enabled: false))
29
29
  end
30
30
 
31
31
  def small
32
- render(ToggleSwitch.new(src: URLHelpers.toggle_switch_index_path, size: :small))
32
+ render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, size: :small))
33
33
  end
34
34
 
35
35
  def with_status_label_position_end
36
- render(ToggleSwitch.new(src: URLHelpers.toggle_switch_index_path, status_label_position: :end))
36
+ render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, status_label_position: :end))
37
37
  end
38
38
 
39
39
  def with_a_bad_src
@@ -45,11 +45,11 @@ module Primer
45
45
  end
46
46
 
47
47
  def with_csrf_token
48
- render(ToggleSwitch.new(src: URLHelpers.toggle_switch_index_path, csrf_token: "let_me_in"))
48
+ render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, csrf_token: "let_me_in"))
49
49
  end
50
50
 
51
51
  def with_bad_csrf_token
52
- render(ToggleSwitch.new(src: URLHelpers.toggle_switch_index_path, csrf_token: "i_am_a_criminal"))
52
+ render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, csrf_token: "i_am_a_criminal"))
53
53
  end
54
54
  end
55
55
  end
@@ -21,7 +21,7 @@ module Primer
21
21
  # @param inset toggle
22
22
  # @param monospace toggle
23
23
  def playground(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :medium, full_width: false, disabled: false, invalid: false, input_id: "input-id", list_id: "list-id", input_name: "input-id", inset: false, monospace: false)
24
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name, inset: inset, monospace: monospace)) do |component|
24
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: UrlHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name, inset: inset, monospace: monospace)) do |component|
25
25
  component.with_leading_visual_icon(icon: :search)
26
26
  end
27
27
  end
@@ -41,7 +41,7 @@ module Primer
41
41
  # @param inset toggle
42
42
  # @param monospace toggle
43
43
  def default(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :medium, full_width: false, disabled: false, invalid: false, input_id: "input-id", list_id: "list-id", input_name: "input-id", inset: false, monospace: false)
44
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name, inset: inset, monospace: monospace)) do |component|
44
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: UrlHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name, inset: inset, monospace: monospace)) do |component|
45
45
  component.with_leading_visual_icon(icon: :search)
46
46
  end
47
47
  end
@@ -87,7 +87,7 @@ module Primer
87
87
  # @param list_id text
88
88
  # @param input_name text
89
89
  def leading_visual(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :medium, full_width: false, disabled: false, invalid: false, input_id: "input-id", list_id: "list-id", input_name: "input-id")
90
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
90
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: UrlHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
91
91
  component.with_leading_visual_icon(icon: :search)
92
92
  end
93
93
  end
@@ -105,7 +105,7 @@ module Primer
105
105
  # @param list_id text
106
106
  # @param input_name text
107
107
  def trailing_action(label_text: "Select a fruit", show_clear_button: true, visually_hide_label: false, placeholder: "Placeholder text", size: :medium, full_width: false, disabled: false, invalid: false, input_id: "input-id", list_id: "list-id", input_name: "input-id")
108
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name))
108
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: UrlHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name))
109
109
  end
110
110
 
111
111
  # @label Full width
@@ -121,7 +121,7 @@ module Primer
121
121
  # @param list_id text
122
122
  # @param input_name text
123
123
  def full_width(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :medium, full_width: true, disabled: false, invalid: false, input_id: "input-id", list_id: "list-id", input_name: "input-id")
124
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
124
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: UrlHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
125
125
  component.with_leading_visual_icon(icon: :search)
126
126
  end
127
127
  end
@@ -139,7 +139,7 @@ module Primer
139
139
  # @param list_id text
140
140
  # @param input_name text
141
141
  def visually_hide_label(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: true, placeholder: "Placeholder text", size: :medium, full_width: false, disabled: false, invalid: false, input_id: "input-id", list_id: "list-id", input_name: "input-id")
142
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
142
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: UrlHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
143
143
  component.with_leading_visual_icon(icon: :search)
144
144
  end
145
145
  end
@@ -158,7 +158,7 @@ module Primer
158
158
  # @param list_id text
159
159
  # @param input_name text
160
160
  def small(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :small, full_width: false, disabled: false, invalid: false, input_id: "input-id-1", list_id: "list-id-1", input_name: "input-id-1")
161
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
161
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: UrlHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
162
162
  component.with_leading_visual_icon(icon: :search)
163
163
  end
164
164
  end
@@ -175,7 +175,7 @@ module Primer
175
175
  # @param list_id text
176
176
  # @param input_name text
177
177
  def medium(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :medium, full_width: false, disabled: false, invalid: false, input_id: "input-id-2", list_id: "list-id-2", input_name: "input-id-2")
178
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
178
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: UrlHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
179
179
  component.with_leading_visual_icon(icon: :search)
180
180
  end
181
181
  end
@@ -192,7 +192,7 @@ module Primer
192
192
  # @param list_id text
193
193
  # @param input_name text
194
194
  def large(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :large, full_width: false, disabled: false, invalid: false, input_id: "input-id-3", list_id: "list-id-3", input_name: "input-id-3")
195
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
195
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: UrlHelpers.autocomplete_index_path, show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name)) do |component|
196
196
  component.with_leading_visual_icon(icon: :search)
197
197
  end
198
198
  end
@@ -212,7 +212,7 @@ module Primer
212
212
  # @param list_id text
213
213
  # @param input_name text
214
214
  def leading_visual_in_results(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :medium, full_width: false, disabled: false, invalid: false, input_id: "input-id", list_id: "list-id", input_name: "input-id")
215
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path(visual: "leading"), show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name))
215
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: UrlHelpers.autocomplete_index_path(visual: "leading"), show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name))
216
216
  end
217
217
 
218
218
  # @label Trailing visual in results
@@ -228,39 +228,39 @@ module Primer
228
228
  # @param list_id text
229
229
  # @param input_name text
230
230
  def trailing_visual_in_results(label_text: "Select a fruit", show_clear_button: false, visually_hide_label: false, placeholder: "Placeholder text", size: :medium, full_width: false, disabled: false, invalid: false, input_id: "input-id", list_id: "list-id", input_name: "input-id")
231
- render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: URLHelpers.autocomplete_index_path(visual: "trailing"), show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name))
231
+ render(Primer::Beta::AutoComplete.new(label_text: label_text, input_id: input_id, list_id: list_id, src: UrlHelpers.autocomplete_index_path(visual: "trailing"), show_clear_button: show_clear_button, visually_hide_label: visually_hide_label, placeholder: placeholder, size: size, full_width: full_width, disabled: disabled, invalid: invalid, input_name: input_name))
232
232
  end
233
233
 
234
234
  # @hidden
235
235
  def with_non_visible_label
236
- render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: URLHelpers.autocomplete_index_path, visually_hide_label: true))
236
+ render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: UrlHelpers.autocomplete_index_path, visually_hide_label: true))
237
237
  end
238
238
 
239
239
  # @hidden
240
240
  def with_icon
241
- render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: URLHelpers.autocomplete_index_path)) do |component|
241
+ render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: UrlHelpers.autocomplete_index_path)) do |component|
242
242
  component.with_leading_visual_icon(icon: :search)
243
243
  end
244
244
  end
245
245
 
246
246
  # @hidden
247
247
  def show_clear_button
248
- render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: URLHelpers.autocomplete_index_path, show_clear_button: true))
248
+ render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: UrlHelpers.autocomplete_index_path, show_clear_button: true))
249
249
  end
250
250
 
251
251
  # @hidden
252
252
  def size_small
253
- render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: URLHelpers.autocomplete_index_path, show_clear_button: false, size: :small))
253
+ render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: UrlHelpers.autocomplete_index_path, show_clear_button: false, size: :small))
254
254
  end
255
255
 
256
256
  # @hidden
257
257
  def monospace
258
- render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: URLHelpers.autocomplete_index_path, show_clear_button: false, monospace: true))
258
+ render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: UrlHelpers.autocomplete_index_path, show_clear_button: false, monospace: true))
259
259
  end
260
260
 
261
261
  # @hidden
262
262
  def inset
263
- render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: URLHelpers.autocomplete_index_path, show_clear_button: false, inset: true))
263
+ render(Primer::Beta::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id", list_id: "test-id", src: UrlHelpers.autocomplete_index_path, show_clear_button: false, inset: true))
264
264
  end
265
265
  end
266
266
  end
@@ -1,3 +1,3 @@
1
- <%= render(ExampleToggleSwitchForm.new(csrf: "let_me_in", src: toggle_switch_index_path, id: "success-toggle")) %>
1
+ <%= render(ExampleToggleSwitchForm.new(csrf: "let_me_in", label: "Good example", src: toggle_switch_index_path, id: "success-toggle")) %>
2
2
  <hr>
3
- <%= render(ExampleToggleSwitchForm.new(csrf: "a_bad_value", src: toggle_switch_index_path, id: "error-toggle")) %>
3
+ <%= render(ExampleToggleSwitchForm.new(csrf: "a_bad_value", label: "Bad example", src: toggle_switch_index_path, id: "error-toggle")) %>
@@ -1,3 +1,3 @@
1
1
  <%= primer_form_with(url: "/foo") do |f| %>
2
- <%= render(SelectListForm.new(f)) %>
2
+ <%= render(SelectForm.new(f)) %>
3
3
  <% end %>
@@ -3,6 +3,8 @@
3
3
  module Primer
4
4
  module Forms
5
5
  # :nodoc:
6
+ #
7
+ # @logical_path primer/
6
8
  class FormsPreview < ViewComponent::Preview
7
9
  def single_text_field_form; end
8
10
 
@@ -22,7 +24,7 @@ module Primer
22
24
 
23
25
  def array_check_box_group_form; end
24
26
 
25
- def select_list_form; end
27
+ def select_form; end
26
28
 
27
29
  def radio_button_with_nested_form; end
28
30
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Primer
4
4
  # :nodoc:
5
- module URLHelpers
5
+ module UrlHelpers
6
6
  class << self
7
7
  # use send to avoid yard warning
8
8
  send :include, Rails.application.routes.url_helpers