primer_view_components 0.36.2 → 0.36.4

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.
@@ -66,30 +66,45 @@ module Primer
66
66
  @compiled = true
67
67
  end
68
68
 
69
- private
70
-
71
69
  def template_root_path
72
70
  return @template_root_path if defined?(@template_root_path)
73
71
 
74
72
  form_path = Utils.const_source_location(self.name)
75
- @template_root_path = if form_path
76
- File.join(File.dirname(form_path), self.name.demodulize.underscore)
73
+ @template_root_path =
74
+ if form_path
75
+ File.join(File.dirname(form_path), self.name.demodulize.underscore)
76
+ end
77
+ end
78
+
79
+ def base_template_path
80
+ return @base_template_path if defined?(@base_template_path)
81
+ base_path = Utils.const_source_location(self.name)
82
+
83
+ if base_path
84
+ @base_template_path = File.dirname(base_path)
85
+ else
86
+ warn "Could not identify the template for #{self}"
77
87
  end
78
88
  end
79
89
 
90
+ private
91
+
80
92
  def template_globs
81
93
  @template_globs ||= []
82
94
  end
83
95
 
84
96
  def compile_templates_in(template_glob)
85
- pattern = if Pathname(template_glob.glob_pattern).absolute?
86
- template_glob.glob_pattern
87
- else
88
- # skip compilation for anonymous form classes, as in tests
89
- return unless template_root_path
90
-
91
- File.join(template_root_path, template_glob.glob_pattern)
92
- end
97
+ pattern = template_glob.glob_pattern
98
+ pattern = pattern.gsub("%{base_template_path}", base_template_path) if base_template_path
99
+ pattern =
100
+ if Pathname(pattern).absolute?
101
+ pattern
102
+ else
103
+ # skip compilation for anonymous form classes, as in tests
104
+ return unless template_root_path
105
+
106
+ File.join(template_root_path, pattern)
107
+ end
93
108
 
94
109
  template_paths = Dir.glob(pattern)
95
110
 
@@ -117,11 +132,11 @@ module Primer
117
132
  handler = ActionView::Template.handler_for_extension("erb")
118
133
  template = File.read(path)
119
134
  template_params = TemplateParams.new({
120
- source: template,
121
- identifier: __FILE__,
122
- type: "text/html",
123
- format: "text/html"
124
- })
135
+ source: template,
136
+ identifier: __FILE__,
137
+ type: "text/html",
138
+ format: "text/html"
139
+ })
125
140
 
126
141
  # change @output_buffer ivar to output_buffer method call
127
142
  BufferRewriter.rewrite(
@@ -7,18 +7,11 @@ module Primer
7
7
  include Primer::ClassNameHelper
8
8
  extend ActsAsComponent
9
9
 
10
- def self.compile!
11
- base_path = Utils.const_source_location(self.name)
12
-
13
- unless base_path
14
- warn "Could not identify the template for #{base}"
15
- return
16
- end
17
-
18
- dir = File.dirname(base_path)
19
- renders_template File.join(dir, "#{self.name.demodulize.underscore}.html.erb"), :render_template
20
-
21
- super
10
+ def self.inherited(base)
11
+ base.renders_template(
12
+ File.join("%{base_template_path}", "#{base.name.demodulize.underscore}.html.erb"),
13
+ :render_template
14
+ )
22
15
  end
23
16
 
24
17
  delegate :required?, :disabled?, :hidden?, to: :@input
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module Primer
4
2
  module Forms
5
3
  module Dsl
@@ -7,7 +5,7 @@ module Primer
7
5
  class TextFieldInput < Input
8
6
  attr_reader(
9
7
  *%i[
10
- name label show_clear_button leading_visual leading_spinner clear_button_id
8
+ name label show_clear_button leading_visual leading_spinner trailing_visual clear_button_id
11
9
  visually_hide_label inset monospace field_wrap_classes auto_check_src
12
10
  ]
13
11
  )
@@ -20,6 +18,7 @@ module Primer
20
18
 
21
19
  @show_clear_button = system_arguments.delete(:show_clear_button)
22
20
  @leading_visual = system_arguments.delete(:leading_visual)
21
+ @trailing_visual = system_arguments.delete(:trailing_visual)
23
22
  @leading_spinner = !!system_arguments.delete(:leading_spinner)
24
23
  @clear_button_id = system_arguments.delete(:clear_button_id)
25
24
  @inset = system_arguments.delete(:inset)
@@ -48,6 +47,14 @@ module Primer
48
47
  alias inset? inset
49
48
  alias monospace? monospace
50
49
 
50
+ def trailing_visual?
51
+ !!@trailing_visual
52
+ end
53
+
54
+ def leading_visual?
55
+ !!@leading_visual
56
+ end
57
+
51
58
  def to_component
52
59
  TextField.new(input: self)
53
60
  end
@@ -60,10 +67,6 @@ module Primer
60
67
  true
61
68
  end
62
69
 
63
- def leading_visual?
64
- !!@leading_visual
65
- end
66
-
67
70
  def validation_arguments
68
71
  if auto_check_src.present?
69
72
  super.merge(
@@ -17,5 +17,10 @@
17
17
  <%= render(Primer::Beta::Octicon.new(icon: :"x-circle-fill")) %>
18
18
  </button>
19
19
  <% end %>
20
+ <% if @input.trailing_visual %>
21
+ <div class="FormControl-input-trailingVisualWrap">
22
+ <%= render(trailing_visual_component) %>
23
+ </div>
24
+ <% end %>
20
25
  <% end %>
21
26
  <% end %>
@@ -24,9 +24,9 @@ module Primer
24
24
  "FormControl-input-wrap",
25
25
  INPUT_WRAP_SIZE[input.size],
26
26
  "FormControl-input-wrap--trailingAction": @input.show_clear_button?,
27
+ "FormControl-input-wrap--trailingVisual": @input.trailing_visual?,
27
28
  "FormControl-input-wrap--leadingVisual": @input.leading_visual?
28
29
  ),
29
-
30
30
  hidden: @input.hidden?
31
31
  }
32
32
  end
@@ -41,6 +41,42 @@ module Primer
41
41
  )
42
42
  end
43
43
  end
44
+
45
+ def trailing_visual_component
46
+ return @trailing_visual_component if defined?(@trailing_visual_component)
47
+ visual = @input.trailing_visual
48
+
49
+ # Render icon if specified
50
+ @trailing_visual_component =
51
+ if (icon_arguments = visual[:icon])
52
+ Primer::Beta::Octicon.new(**icon_arguments)
53
+ elsif (label_arguments = visual[:label])
54
+ # Render label if specified
55
+ label_arguments[:classes] = class_names(
56
+ label_arguments.delete(:classes),
57
+ "FormControl-input-trailingVisualLabel"
58
+ )
59
+
60
+ text = label_arguments.delete(:text)
61
+ Primer::Beta::Label.new(**label_arguments).with_content(text)
62
+ elsif (counter_arguments = visual[:counter])
63
+ # Render counter if specified
64
+ counter_arguments[:classes] = class_names(
65
+ counter_arguments.delete(:classes),
66
+ "FormControl-input-trailingVisualCounter"
67
+ )
68
+
69
+ Primer::Beta::Counter.new(**counter_arguments)
70
+ elsif (truncate_arguments = visual[:text])
71
+ # Render text if specified
72
+ truncate_arguments[:classes] = class_names(
73
+ truncate_arguments.delete(:classes),
74
+ "FormControl-input-trailingVisualText"
75
+ )
76
+ text = truncate_arguments.delete(:text)
77
+ Primer::Beta::Truncate.new(**truncate_arguments).with_content(text)
78
+ end
79
+ end
44
80
  end
45
81
  end
46
82
  end
@@ -1939,4 +1939,4 @@
1939
1939
  - overflow-y-visible
1940
1940
  - overflow-sm-y-visible
1941
1941
  - overflow-lg-y-visible
1942
- - overflow-xl-y-visible
1942
+ - overflow-xl-y-visible
@@ -6,7 +6,7 @@ module Primer
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 36
9
- PATCH = 2
9
+ PATCH = 4
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -172,6 +172,36 @@ module Primer
172
172
  render(Primer::Alpha::TextField.new(monospace: true, name: "my-text-field", label: "My text field"))
173
173
  end
174
174
 
175
+ # @label With trailing icon
176
+ # @snapshot
177
+ def with_trailing_icon
178
+ render(Primer::Alpha::TextField.new(trailing_visual: { icon: { icon: :search } }, name: "my-text-field", label: "My text field"))
179
+ end
180
+
181
+ # @label With trailing text
182
+ # @snapshot
183
+ def with_trailing_text
184
+ render(Primer::Alpha::TextField.new(trailing_visual: { text: { text: "minute" } }, name: "my-text-field", label: "My text field"))
185
+ end
186
+
187
+ # @label With trailing long text
188
+ # @snapshot
189
+ def with_trailing_long_text
190
+ render(Primer::Alpha::TextField.new(trailing_visual: { text: { text: "Long trailing text" } }, name: "my-text-field", label: "My text field"))
191
+ end
192
+
193
+ # @label With trailing counter
194
+ # @snapshot
195
+ def with_trailing_counter
196
+ render(Primer::Alpha::TextField.new(trailing_visual: { counter: { count: 5 } }, name: "my-text-field", label: "My text field"))
197
+ end
198
+
199
+ # @label With trailing label
200
+ # @snapshot
201
+ def with_trailing_label
202
+ render(Primer::Alpha::TextField.new(trailing_visual: { label: { text: "Hello" } }, name: "my-text-field", label: "My text field"))
203
+ end
204
+
175
205
  # @label With leading visual
176
206
  # @snapshot
177
207
  def with_leading_visual
@@ -9360,6 +9360,71 @@
9360
9360
  ]
9361
9361
  }
9362
9362
  },
9363
+ {
9364
+ "preview_path": "primer/alpha/text_field/with_trailing_icon",
9365
+ "name": "with_trailing_icon",
9366
+ "snapshot": "true",
9367
+ "skip_rules": {
9368
+ "wont_fix": [
9369
+ "region"
9370
+ ],
9371
+ "will_fix": [
9372
+ "color-contrast"
9373
+ ]
9374
+ }
9375
+ },
9376
+ {
9377
+ "preview_path": "primer/alpha/text_field/with_trailing_text",
9378
+ "name": "with_trailing_text",
9379
+ "snapshot": "true",
9380
+ "skip_rules": {
9381
+ "wont_fix": [
9382
+ "region"
9383
+ ],
9384
+ "will_fix": [
9385
+ "color-contrast"
9386
+ ]
9387
+ }
9388
+ },
9389
+ {
9390
+ "preview_path": "primer/alpha/text_field/with_trailing_long_text",
9391
+ "name": "with_trailing_long_text",
9392
+ "snapshot": "true",
9393
+ "skip_rules": {
9394
+ "wont_fix": [
9395
+ "region"
9396
+ ],
9397
+ "will_fix": [
9398
+ "color-contrast"
9399
+ ]
9400
+ }
9401
+ },
9402
+ {
9403
+ "preview_path": "primer/alpha/text_field/with_trailing_counter",
9404
+ "name": "with_trailing_counter",
9405
+ "snapshot": "true",
9406
+ "skip_rules": {
9407
+ "wont_fix": [
9408
+ "region"
9409
+ ],
9410
+ "will_fix": [
9411
+ "color-contrast"
9412
+ ]
9413
+ }
9414
+ },
9415
+ {
9416
+ "preview_path": "primer/alpha/text_field/with_trailing_label",
9417
+ "name": "with_trailing_label",
9418
+ "snapshot": "true",
9419
+ "skip_rules": {
9420
+ "wont_fix": [
9421
+ "region"
9422
+ ],
9423
+ "will_fix": [
9424
+ "color-contrast"
9425
+ ]
9426
+ }
9427
+ },
9363
9428
  {
9364
9429
  "preview_path": "primer/alpha/text_field/with_leading_visual",
9365
9430
  "name": "with_leading_visual",
@@ -14217,6 +14282,30 @@
14217
14282
  "description": "Same arguments as {{#link_to_component}}Primer::Alpha::Tooltip{{/link_to_component}}."
14218
14283
  }
14219
14284
  ]
14285
+ },
14286
+ {
14287
+ "name": "leading_visual",
14288
+ "description": "Leading visuals appear to the left of the link text.\n\nUse:\n\n- `leading_visual_icon` which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}.",
14289
+ "parameters": [
14290
+ {
14291
+ "name": "system_arguments",
14292
+ "type": "Hash",
14293
+ "default": "N/A",
14294
+ "description": "Same arguments as {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}."
14295
+ }
14296
+ ]
14297
+ },
14298
+ {
14299
+ "name": "trailing_visual",
14300
+ "description": "Trailing visuals appear to the right of the link text.\n\nUse:\n\n- `trailing_visual_icon` which accepts the arguments accepted by {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}.",
14301
+ "parameters": [
14302
+ {
14303
+ "name": "system_arguments",
14304
+ "type": "Hash",
14305
+ "default": "N/A",
14306
+ "description": "Same arguments as {{#link_to_component}}Primer::Beta::Octicon{{/link_to_component}}."
14307
+ }
14308
+ ]
14220
14309
  }
14221
14310
  ],
14222
14311
  "methods": [
@@ -14326,6 +14415,32 @@
14326
14415
  "color-contrast"
14327
14416
  ]
14328
14417
  }
14418
+ },
14419
+ {
14420
+ "preview_path": "primer/beta/link/with_leading_icon",
14421
+ "name": "with_leading_icon",
14422
+ "snapshot": "false",
14423
+ "skip_rules": {
14424
+ "wont_fix": [
14425
+ "region"
14426
+ ],
14427
+ "will_fix": [
14428
+ "color-contrast"
14429
+ ]
14430
+ }
14431
+ },
14432
+ {
14433
+ "preview_path": "primer/beta/link/with_trailing_icon",
14434
+ "name": "with_trailing_icon",
14435
+ "snapshot": "false",
14436
+ "skip_rules": {
14437
+ "wont_fix": [
14438
+ "region"
14439
+ ],
14440
+ "will_fix": [
14441
+ "color-contrast"
14442
+ ]
14443
+ }
14329
14444
  }
14330
14445
  ],
14331
14446
  "subcomponents": [
@@ -17388,6 +17503,6 @@
17388
17503
  "component": "BaseComponent",
17389
17504
  "fully_qualified_name": "Primer::BaseComponent",
17390
17505
  "description_md": "All Primer ViewComponents accept a standard set of options called system arguments, mimicking the [styled-system API](https://styled-system.com/table) previously used by [Primer React](https://primer.style/guides/react/system-props).\n\nUnder the hood, system arguments are [mapped](https://github.com/primer/view_components/blob/main/lib/primer/classify.rb) to Primer CSS classes, with any remaining options passed to Rails' [`content_tag`](https://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag).\n\n## Responsive values\n\nTo apply different values across responsive breakpoints, pass an array with up to five values in the order `[default, small, medium, large, xlarge]`. To skip a breakpoint, pass `nil`.\n\nFor example:\n\n```erb\n<%= render Primer::Beta::Heading.new(mt: [0, nil, nil, 4, 2]) do %>\n Hello world\n<% end %>\n```\n\nRenders:\n\n```html\n<h1 class=\"mt-0 mt-lg-4 mt-xl-2\">Hello world</h1>\n```",
17391
- "args_md": "## HTML attributes\n\nUse system arguments to add HTML attributes to elements. For the most part, system arguments map 1:1 to\nHTML attributes. For example, `render(Component.new(title: \"Foo\"))` will result in eg. `<div title=\"foo\">`.\nHowever, ViewComponents applies special handling to certain system arguments. See the table below for details.\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `aria` | `Hash` | Aria attributes: `aria: { label: \"foo\" }` renders `aria-label='foo'`. |\n| `data` | `Hash` | Data attributes: `data: { foo: :bar }` renders `data-foo='bar'`. |\n\n## Utility classes\n\nViewComponents provides a convenient way to add Primer CSS utility classes to HTML elements. Use the shorthand\ndocumented in the tables below instead of adding CSS classes directly.\n\n### Animation\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `animation` | Symbol | One of `:fade_down`, `:fade_in`, `:fade_out`, `:fade_up`, `:grow_x`, `:hover_grow`, `:pulse`, `:pulse_in`, `:rotate`, `:scale_in`, or `:shrink_x`. |\n\n### Border\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `border_bottom` | Integer | Set to `0` to remove the bottom border. |\n| `border_left` | Integer | Set to `0` to remove the left border. |\n| `border_radius` | Integer | One of `0`, `1`, `2`, or `3`. |\n| `border_right` | Integer | Set to `0` to remove the right border. |\n| `border_top` | Integer | Set to `0` to remove the top border. |\n| `border` | Symbol | One of `:bottom`, `:left`, `:right`, `:top`, `:x`, `:y`, or `true`. |\n| `box_shadow` | Boolean, Symbol | Box shadow. One of `:extra_large`, `:large`, `:medium`, `:none`, or `true`. |\n\n### Color\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `bg` | Symbol | Background color. One of `:accent`, `:accent_emphasis`, `:attention`, `:attention_emphasis`, `:closed`, `:closed_emphasis`, `:danger`, `:danger_emphasis`, `:default`, `:done`, `:done_emphasis`, `:emphasis`, `:inset`, `:open`, `:open_emphasis`, `:overlay`, `:severe`, `:severe_emphasis`, `:sponsors`, `:sponsors_emphasis`, `:subtle`, `:success`, `:success_emphasis`, or `:transparent`. |\n| `border_color` | Symbol | Border color. One of `:accent`, `:accent_emphasis`, `:attention`, `:attention_emphasis`, `:closed`, `:closed_emphasis`, `:danger`, `:danger_emphasis`, `:default`, `:done`, `:done_emphasis`, `:muted`, `:open`, `:open_emphasis`, `:severe`, `:severe_emphasis`, `:sponsors`, `:sponsors_emphasis`, `:subtle`, `:success`, or `:success_emphasis`. |\n| `color` | Symbol | Text color. One of `:accent`, `:attention`, `:closed`, `:danger`, `:default`, `:done`, `:inherit`, `:muted`, `:on_emphasis`, `:open`, `:severe`, `:sponsors`, `:subtle`, or `:success`. |\n\n### Flex\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `align_items` | Symbol | One of `:baseline`, `:center`, `:flex_end`, `:flex_start`, or `:stretch`. |\n| `align_self` | Symbol | One of `:auto`, `:baseline`, `:center`, `:end`, `:start`, or `:stretch`. |\n| `direction` | Symbol | One of `:column`, `:column_reverse`, `:row`, or `:row_reverse`. |\n| `flex` | Integer, Symbol | One of `1` or `:auto`. |\n| `flex_grow` | Integer | To enable, set to `0`. |\n| `flex_shrink` | Integer | To enable, set to `0`. |\n| `flex_wrap` | Symbol | One of `:nowrap`, `:reverse`, or `:wrap`. |\n| `justify_content` | Symbol | One of `:center`, `:flex_end`, `:flex_start`, `:space_around`, or `:space_between`. |\n\n### Grid\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `clearfix` | Boolean | Whether to assign the `clearfix` class. |\n| `col` | Integer | Number of columns. One of `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, or `12`. |\n| `container` | Symbol | Size of the container. One of `:lg`, `:md`, `:sm`, or `:xl`. |\n\n### Layout\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `display` | Symbol | One of `:block`, `:flex`, `:inline`, `:inline_block`, `:inline_flex`, `:none`, `:table`, or `:table_cell`. |\n| `w` | Symbol | Sets the element's width. One of `:auto`, `:fit`, or `:full`. |\n| `h` | Symbol | Sets the element's height. One of `:fit` or `:full`. |\n| `hide` | Symbol | Hide the element at a specific breakpoint. One of `:lg`, `:md`, `:sm`, `:whenNarrow`, `:whenRegular`, `:whenWide`, or `:xl`. |\n| `visibility` | Symbol | Visibility. One of `:hidden` or `:visible`. |\n| `vertical_align` | Symbol | One of `:baseline`, `:bottom`, `:middle`, `:text_bottom`, `:text_top`, or `:top`. |\n\n### Position\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `bottom` | Boolean | If `false`, sets `bottom: 0`. |\n| `float` | Symbol | One of `:left`, `:none`, or `:right`. |\n| `left` | Boolean | If `false`, sets `left: 0`. |\n| `position` | Symbol | One of `:absolute`, `:fixed`, `:relative`, `:static`, or `:sticky`. |\n| `right` | Boolean | If `false`, sets `right: 0`. |\n| `top` | Boolean | If `false`, sets `top: 0`. |\n\n### Spacing\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `m` | Integer | Margin. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, or `:auto`. |\n| `mb` | Integer | Margin bottom. One of `-12`, `-11`, `-10`, `-9`, `-8`, `-7`, `-6`, `-5`, `-4`, `-3`, `-2`, `-1`, `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, or `:auto`. |\n| `ml` | Integer | Margin left. One of `-6`, `-5`, `-4`, `-3`, `-2`, `-1`, `0`, `1`, `2`, `3`, `4`, `5`, `6`, or `:auto`. |\n| `mr` | Integer | Margin right. One of `-6`, `-5`, `-4`, `-3`, `-2`, `-1`, `0`, `1`, `2`, `3`, `4`, `5`, `6`, or `:auto`. |\n| `mt` | Integer | Margin top. One of `-12`, `-11`, `-10`, `-9`, `-8`, `-7`, `-6`, `-5`, `-4`, `-3`, `-2`, `-1`, `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, or `:auto`. |\n| `mx` | Integer | Horizontal margins. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, or `:auto`. |\n| `my` | Integer | Vertical margins. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, or `12`. |\n| `p` | Integer | Padding. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, or `:responsive`. |\n| `pb` | Integer | Padding bottom. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, or `12`. |\n| `pl` | Integer | Padding left. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, or `12`. |\n| `pr` | Integer | Padding right. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, or `12`. |\n| `pt` | Integer | Padding top. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, or `12`. |\n| `px` | Integer | Horizontal padding. One of `0`, `1`, `2`, `3`, `4`, `5`, or `6`. |\n| `py` | Integer | Vertical padding. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, or `12`. |\n\n### Typography\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `font_family` | Symbol | Font family. One of `:mono`. |\n| `font_size` | String, Integer, Symbol | One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, `00`, `:normal`, or `:small`. |\n| `font_style` | Symbol | Font style. One of `:italic`. |\n| `font_weight` | Symbol | Font weight. One of `:bold`, `:emphasized`, `:light`, or `:normal`. |\n| `text_align` | Symbol | Text alignment. One of `:center`, `:left`, or `:right`. |\n| `text_transform` | Symbol | Text transformation. One of `:capitalize` or `:uppercase`. |\n| `underline` | Boolean | Whether text should be underlined. |\n| `word_break` | Symbol | Whether to break words on line breaks. One of `:break_all` or `:break_word`. |\n\n### Other\n\n| Name | Type | Description |\n| :- | :- | :- |\n| classes | String | CSS class name value to be concatenated with generated Primer CSS classes. |\n| test_selector | String | Adds `data-test-selector='given value'` in non-Production environments for testing purposes. |"
17506
+ "args_md": "## HTML attributes\n\nUse system arguments to add HTML attributes to elements. For the most part, system arguments map 1:1 to\nHTML attributes. For example, `render(Component.new(title: \"Foo\"))` will result in eg. `<div title=\"foo\">`.\nHowever, ViewComponents applies special handling to certain system arguments. See the table below for details.\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `aria` | `Hash` | Aria attributes: `aria: { label: \"foo\" }` renders `aria-label='foo'`. |\n| `data` | `Hash` | Data attributes: `data: { foo: :bar }` renders `data-foo='bar'`. |\n\n## Utility classes\n\nViewComponents provides a convenient way to add Primer CSS utility classes to HTML elements. Use the shorthand\ndocumented in the tables below instead of adding CSS classes directly.\n\n### Animation\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `animation` | Symbol | One of `:fade_down`, `:fade_in`, `:fade_out`, `:fade_up`, `:grow_x`, `:hover_grow`, `:pulse`, `:pulse_in`, `:rotate`, `:scale_in`, or `:shrink_x`. |\n\n### Border\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `border_bottom` | Integer | Set to `0` to remove the bottom border. |\n| `border_left` | Integer | Set to `0` to remove the left border. |\n| `border_radius` | Integer | One of `0`, `1`, `2`, or `3`. |\n| `border_right` | Integer | Set to `0` to remove the right border. |\n| `border_top` | Integer | Set to `0` to remove the top border. |\n| `border` | Symbol | One of `:bottom`, `:left`, `:right`, `:top`, `:x`, `:y`, or `true`. |\n| `box_shadow` | Boolean, Symbol | Box shadow. One of `:extra_large`, `:large`, `:medium`, `:none`, or `true`. |\n\n### Color\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `bg` | Symbol | Background color. One of `:accent`, `:accent_emphasis`, `:attention`, `:attention_emphasis`, `:closed`, `:closed_emphasis`, `:danger`, `:danger_emphasis`, `:default`, `:done`, `:done_emphasis`, `:emphasis`, `:inset`, `:open`, `:open_emphasis`, `:overlay`, `:severe`, `:severe_emphasis`, `:sponsors`, `:sponsors_emphasis`, `:subtle`, `:success`, `:success_emphasis`, or `:transparent`. |\n| `border_color` | Symbol | Border color. One of `:accent`, `:accent_emphasis`, `:attention`, `:attention_emphasis`, `:closed`, `:closed_emphasis`, `:danger`, `:danger_emphasis`, `:default`, `:done`, `:done_emphasis`, `:muted`, `:open`, `:open_emphasis`, `:severe`, `:severe_emphasis`, `:sponsors`, `:sponsors_emphasis`, `:subtle`, `:success`, or `:success_emphasis`. |\n| `color` | Symbol | Text color. One of `:accent`, `:attention`, `:closed`, `:danger`, `:default`, `:done`, `:inherit`, `:muted`, `:on_emphasis`, `:open`, `:severe`, `:sponsors`, `:subtle`, or `:success`. |\n\n### Flex\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `align_items` | Symbol | One of `:baseline`, `:center`, `:flex_end`, `:flex_start`, or `:stretch`. |\n| `align_self` | Symbol | One of `:auto`, `:baseline`, `:center`, `:end`, `:start`, or `:stretch`. |\n| `direction` | Symbol | One of `:column`, `:column_reverse`, `:row`, or `:row_reverse`. |\n| `flex` | Integer, Symbol | One of `1` or `:auto`. |\n| `flex_grow` | Integer | To enable, set to `0`. |\n| `flex_shrink` | Integer | To enable, set to `0`. |\n| `flex_wrap` | Symbol | One of `:nowrap`, `:reverse`, or `:wrap`. |\n| `justify_content` | Symbol | One of `:center`, `:flex_end`, `:flex_start`, `:space_around`, or `:space_between`. |\n\n### Grid\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `clearfix` | Boolean | Whether to assign the `clearfix` class. |\n| `col` | Integer | Number of columns. One of `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, or `12`. |\n| `container` | Symbol | Size of the container. One of `:lg`, `:md`, `:sm`, or `:xl`. |\n\n### Layout\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `display` | Symbol | One of `:block`, `:flex`, `:inline`, `:inline_block`, `:inline_flex`, `:none`, `:table`, or `:table_cell`. |\n| `w` | Symbol | Sets the element's width. One of `:auto`, `:fit`, or `:full`. |\n| `h` | Symbol | Sets the element's height. One of `:fit` or `:full`. |\n| `hide` | Symbol | Hide the element at a specific breakpoint. One of `:lg`, `:md`, `:sm`, `:whenNarrow`, `:whenRegular`, `:whenWide`, or `:xl`. |\n| `visibility` | Symbol | Visibility. One of `:hidden` or `:visible`. |\n| `vertical_align` | Symbol | One of `:baseline`, `:bottom`, `:middle`, `:text_bottom`, `:text_top`, or `:top`. |\n\n### Position\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `bottom` | Boolean | If `false`, sets `bottom: 0`. |\n| `float` | Symbol | One of `:left`, `:none`, or `:right`. |\n| `left` | Boolean | If `false`, sets `left: 0`. |\n| `position` | Symbol | One of `:absolute`, `:fixed`, `:relative`, `:static`, or `:sticky`. |\n| `right` | Boolean | If `false`, sets `right: 0`. |\n| `top` | Boolean | If `false`, sets `top: 0`. |\n\n### Spacing\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `m` | Integer | Margin. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, or `:auto`. |\n| `mb` | Integer | Margin bottom. One of `-12`, `-11`, `-10`, `-9`, `-8`, `-7`, `-6`, `-5`, `-4`, `-3`, `-2`, `-1`, `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, or `:auto`. |\n| `ml` | Integer | Margin left. One of `-6`, `-5`, `-4`, `-3`, `-2`, `-1`, `0`, `1`, `2`, `3`, `4`, `5`, `6`, or `:auto`. |\n| `mr` | Integer | Margin right. One of `-6`, `-5`, `-4`, `-3`, `-2`, `-1`, `0`, `1`, `2`, `3`, `4`, `5`, `6`, or `:auto`. |\n| `mt` | Integer | Margin top. One of `-12`, `-11`, `-10`, `-9`, `-8`, `-7`, `-6`, `-5`, `-4`, `-3`, `-2`, `-1`, `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, or `:auto`. |\n| `mx` | Integer | Horizontal margins. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, or `:auto`. |\n| `my` | Integer | Vertical margins. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, or `12`. |\n| `p` | Integer | Padding. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, or `:responsive`. |\n| `pb` | Integer | Padding bottom. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, or `12`. |\n| `pl` | Integer | Padding left. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, or `12`. |\n| `pr` | Integer | Padding right. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, or `12`. |\n| `pt` | Integer | Padding top. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, or `12`. |\n| `px` | Integer | Horizontal padding. One of `0`, `1`, `2`, `3`, `4`, `5`, or `6`. |\n| `py` | Integer | Vertical padding. One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, or `12`. |\n\n### Typography\n\n| Name | Type | Description |\n| :- | :- | :- |\n| `font_family` | Symbol | Font family. One of `:mono`. |\n| `font_size` | String, Integer, Symbol | One of `0`, `1`, `2`, `3`, `4`, `5`, `6`, `00`, `:normal`, or `:small`. |\n| `font_style` | Symbol | Font style. One of `:italic`. |\n| `font_weight` | Symbol | Font weight. One of `:bold`, `:emphasized`, `:light`, or `:normal`. |\n| `text_align` | Symbol | Text alignment. One of `:center`, `:left`, or `:right`. |\n| `text_transform` | Symbol | Text transformation. One of `:capitalize` or `:uppercase`. |\n| `underline` | Boolean | Whether text should be underlined. |\n| `word_break` | Symbol | Whether to break words on line breaks. One of `:break_all` or `:break_word`. |\n\n### Other\n\n| Name | Type | Description |\n| :- | :- | :- |\n| classes | String | CSS class name value to be concatenated with generated Primer CSS classes. |\n| test_selector | String | Adds `data-test-selector='given value'` in non-Production environments for testing purposes. |\n| trim | Boolean | Calls `strip` on the content to remove trailing and leading white spaces. |"
17392
17507
  }
17393
17508
  ]
data/static/previews.json CHANGED
@@ -4584,6 +4584,32 @@
4584
4584
  "color-contrast"
4585
4585
  ]
4586
4586
  }
4587
+ },
4588
+ {
4589
+ "preview_path": "primer/beta/link/with_leading_icon",
4590
+ "name": "with_leading_icon",
4591
+ "snapshot": "false",
4592
+ "skip_rules": {
4593
+ "wont_fix": [
4594
+ "region"
4595
+ ],
4596
+ "will_fix": [
4597
+ "color-contrast"
4598
+ ]
4599
+ }
4600
+ },
4601
+ {
4602
+ "preview_path": "primer/beta/link/with_trailing_icon",
4603
+ "name": "with_trailing_icon",
4604
+ "snapshot": "false",
4605
+ "skip_rules": {
4606
+ "wont_fix": [
4607
+ "region"
4608
+ ],
4609
+ "will_fix": [
4610
+ "color-contrast"
4611
+ ]
4612
+ }
4587
4613
  }
4588
4614
  ]
4589
4615
  },
@@ -6987,6 +7013,71 @@
6987
7013
  ]
6988
7014
  }
6989
7015
  },
7016
+ {
7017
+ "preview_path": "primer/alpha/text_field/with_trailing_icon",
7018
+ "name": "with_trailing_icon",
7019
+ "snapshot": "true",
7020
+ "skip_rules": {
7021
+ "wont_fix": [
7022
+ "region"
7023
+ ],
7024
+ "will_fix": [
7025
+ "color-contrast"
7026
+ ]
7027
+ }
7028
+ },
7029
+ {
7030
+ "preview_path": "primer/alpha/text_field/with_trailing_text",
7031
+ "name": "with_trailing_text",
7032
+ "snapshot": "true",
7033
+ "skip_rules": {
7034
+ "wont_fix": [
7035
+ "region"
7036
+ ],
7037
+ "will_fix": [
7038
+ "color-contrast"
7039
+ ]
7040
+ }
7041
+ },
7042
+ {
7043
+ "preview_path": "primer/alpha/text_field/with_trailing_long_text",
7044
+ "name": "with_trailing_long_text",
7045
+ "snapshot": "true",
7046
+ "skip_rules": {
7047
+ "wont_fix": [
7048
+ "region"
7049
+ ],
7050
+ "will_fix": [
7051
+ "color-contrast"
7052
+ ]
7053
+ }
7054
+ },
7055
+ {
7056
+ "preview_path": "primer/alpha/text_field/with_trailing_counter",
7057
+ "name": "with_trailing_counter",
7058
+ "snapshot": "true",
7059
+ "skip_rules": {
7060
+ "wont_fix": [
7061
+ "region"
7062
+ ],
7063
+ "will_fix": [
7064
+ "color-contrast"
7065
+ ]
7066
+ }
7067
+ },
7068
+ {
7069
+ "preview_path": "primer/alpha/text_field/with_trailing_label",
7070
+ "name": "with_trailing_label",
7071
+ "snapshot": "true",
7072
+ "skip_rules": {
7073
+ "wont_fix": [
7074
+ "region"
7075
+ ],
7076
+ "will_fix": [
7077
+ "color-contrast"
7078
+ ]
7079
+ }
7080
+ },
6990
7081
  {
6991
7082
  "preview_path": "primer/alpha/text_field/with_leading_visual",
6992
7083
  "name": "with_leading_visual",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: primer_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.36.2
4
+ version: 0.36.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-19 00:00:00.000000000 Z
11
+ date: 2025-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview