primer_view_components 0.0.69 → 0.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +96 -0
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/components/primer/alpha/{tooltip.d.ts → tool-tip-element.d.ts} +2 -3
- data/app/components/primer/alpha/{tooltip.js → tool-tip-element.js} +112 -145
- data/app/components/primer/alpha/{tooltip.ts → tool-tip-element.ts} +37 -67
- data/app/components/primer/alpha/tooltip.rb +8 -0
- data/app/components/primer/beta/auto_complete/auto_complete.html.erb +16 -6
- data/app/components/primer/beta/auto_complete.rb +82 -20
- data/app/components/primer/button_component.html.erb +1 -0
- data/app/components/primer/button_component.rb +29 -0
- data/app/components/primer/component.rb +9 -2
- data/app/components/primer/link_component.erb +1 -0
- data/app/components/primer/link_component.rb +29 -4
- data/app/components/primer/primer.d.ts +1 -1
- data/app/components/primer/primer.js +1 -1
- data/app/components/primer/primer.ts +1 -1
- data/lib/primer/classify/utilities.yml +20 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/rubocop/config/default.yml +3 -0
- data/lib/rubocop/cop/primer/deprecated_components.rb +80 -0
- data/lib/tasks/custom_utilities.yml +12 -0
- data/lib/tasks/docs.rake +3 -1
- data/static/arguments.yml +18 -0
- data/static/classes.yml +4 -0
- metadata +12 -10
@@ -13,10 +13,7 @@ module Primer
|
|
13
13
|
# be used unless there is compelling reason not to. A placeholder is not a label.
|
14
14
|
class AutoComplete < Primer::Component
|
15
15
|
status :beta
|
16
|
-
|
17
|
-
# Optional icon to be rendered before the input. Has the same arguments as <%= link_to_component(Primer::OcticonComponent) %>.
|
18
|
-
renders_one :icon, Primer::OcticonComponent
|
19
|
-
|
16
|
+
#
|
20
17
|
# Customizable results list.
|
21
18
|
#
|
22
19
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
@@ -32,14 +29,79 @@ module Primer
|
|
32
29
|
Primer::BaseComponent.new(**system_arguments)
|
33
30
|
}
|
34
31
|
|
32
|
+
# Customizable input used to search for results.
|
33
|
+
# It is preferred to use this slot sparingly - it will be created by default if not explicity added.
|
34
|
+
#
|
35
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
36
|
+
renders_one :input, lambda { |**system_arguments|
|
37
|
+
sanitized_args = deny_tag_argument(**system_arguments)
|
38
|
+
sanitized_args = deny_single_argument(:autofocus, "autofocus is not allowed for accessibility reasons. See https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus#accessibility_considerations for more information.", **sanitized_args)
|
39
|
+
deny_aria_key(
|
40
|
+
:label,
|
41
|
+
"instead of `aria-label`, include `label_text` and set `is_label_visible` to `false` on the component initializer.",
|
42
|
+
**sanitized_args
|
43
|
+
)
|
44
|
+
deny_single_argument(
|
45
|
+
:id,
|
46
|
+
"`id` will always be set to @input_id.",
|
47
|
+
**sanitized_args
|
48
|
+
)
|
49
|
+
deny_single_argument(
|
50
|
+
:name,
|
51
|
+
"Set @input_name on the component initializer instead with `input_name`.",
|
52
|
+
**sanitized_args
|
53
|
+
)
|
54
|
+
sanitized_args[:id] = @input_id
|
55
|
+
sanitized_args[:name] = @input_name
|
56
|
+
sanitized_args[:tag] = :input
|
57
|
+
sanitized_args[:autocomplete] = "off"
|
58
|
+
|
59
|
+
sanitized_args[:type] = :text
|
60
|
+
sanitized_args[:classes] = class_names(
|
61
|
+
"form-control",
|
62
|
+
sanitized_args[:classes]
|
63
|
+
)
|
64
|
+
|
65
|
+
Primer::BaseComponent.new(**sanitized_args)
|
66
|
+
}
|
67
|
+
|
35
68
|
# @example Default
|
36
|
-
#
|
69
|
+
# @description
|
70
|
+
# Labels are stacked by default.
|
71
|
+
# @code
|
72
|
+
# <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input--default", list_id: "fruits-popup--default")) %>
|
73
|
+
#
|
74
|
+
# @example With inline label
|
75
|
+
# @description
|
76
|
+
# Labels can be inline by setting `is_label_inline: true`. However, labels will always become stacked on smaller screen sizes.
|
77
|
+
# @code
|
78
|
+
# <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", is_label_inline: true, input_id: "fruits-input--inline-label", list_id: "fruits-popup--inline-label")) %>
|
79
|
+
#
|
80
|
+
# @example With non-visible label
|
81
|
+
# @description
|
82
|
+
# A non-visible label may be rendered with `is_label_visible: false`, but it is highly discouraged. See <%= link_to_accessibility %>.
|
83
|
+
# @code
|
84
|
+
# <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input--non-visible-label", list_id: "fruits-popup--non-visible-label", is_label_visible: false)) %>
|
85
|
+
#
|
86
|
+
# @example With icon
|
87
|
+
# @description
|
88
|
+
# To display a search icon, set `with_icon` to `true`.
|
89
|
+
# @code
|
90
|
+
# <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", list_id: "fruits-popup--icon", input_id: "fruits-input--icon", with_icon: true)) %>
|
91
|
+
#
|
92
|
+
# @example With icon and non-visible label
|
93
|
+
# <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", list_id: "fruits-popup--icon-no-label", input_id: "fruits-input--icon-no-label", with_icon: true, is_label_visible: false)) %>
|
37
94
|
#
|
38
|
-
# @example With
|
39
|
-
# <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input
|
95
|
+
# @example With clear button
|
96
|
+
# <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input--clear", list_id: "fruits-popup--clear", is_clearable: true)) %>
|
40
97
|
#
|
41
|
-
# @example With
|
42
|
-
# <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input-
|
98
|
+
# @example With custom classes for the input
|
99
|
+
# <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input--custom-input", list_id: "fruits-popup--custom-input")) do |c| %>
|
100
|
+
# <% c.input(classes: "custom-class") %>
|
101
|
+
# <% end %>
|
102
|
+
#
|
103
|
+
# @example With custom classes for the results
|
104
|
+
# <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", input_id: "fruits-input--custom-results", list_id: "fruits-popup--custom-results")) do |c| %>
|
43
105
|
# <% c.results(classes: "custom-class") do %>
|
44
106
|
# <%= render(Primer::Beta::AutoComplete::Item.new(selected: true, value: "apple")) do |c| %>
|
45
107
|
# Apple
|
@@ -50,36 +112,36 @@ module Primer
|
|
50
112
|
# <% end %>
|
51
113
|
# <% end %>
|
52
114
|
#
|
53
|
-
# @example With Icon
|
54
|
-
# <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", list_id: "fruits-popup-4", input_id: "fruits-input-4", position: :relative)) do |c| %>
|
55
|
-
# <% c.icon(icon: :search) %>
|
56
|
-
# <% end %>
|
57
|
-
#
|
58
|
-
# @example With Icon and Non-Visible Label
|
59
|
-
# <%= render(Primer::Beta::AutoComplete.new(label_text: "Fruits", src: "/auto_complete", list_id: "fruits-popup-5", input_id: "fruits-input-5", is_label_visible: false, position: :relative)) do |c| %>
|
60
|
-
# <% c.icon(icon: :search) %>
|
61
|
-
# <% end %>
|
62
115
|
# @param label_text [String] The label of the input.
|
63
116
|
# @param src [String] The route to query.
|
64
117
|
# @param input_id [String] Id of the input element.
|
118
|
+
# @param input_name [String] Optional name of the input element, defaults to `input_id` when not set.
|
65
119
|
# @param list_id [String] Id of the list element.
|
120
|
+
# @param with_icon [Boolean] Controls if a search icon is visible, defaults to `false`.
|
66
121
|
# @param is_label_visible [Boolean] Controls if the label is visible. If `false`, screen reader only text will be added.
|
122
|
+
# @param is_clearable [Boolean] Adds optional clear button.
|
123
|
+
# @param is_label_inline [Boolean] Controls if the label is inline. On smaller screens, label will always become stacked.
|
67
124
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
68
|
-
def initialize(label_text:, src:, list_id:, input_id:, is_label_visible: true, **system_arguments)
|
125
|
+
def initialize(label_text:, src:, list_id:, input_id:, input_name: nil, is_label_visible: true, is_label_inline: false, with_icon: false, is_clearable: false, **system_arguments)
|
69
126
|
@label_text = label_text
|
70
127
|
@list_id = list_id
|
71
128
|
@input_id = input_id
|
129
|
+
@input_name = input_name || input_id
|
72
130
|
@is_label_visible = is_label_visible
|
131
|
+
@with_icon = with_icon
|
132
|
+
@is_clearable = is_clearable
|
73
133
|
|
134
|
+
@label_classes = is_label_inline ? "autocomplete-label-inline" : "autocomplete-label-stacked"
|
74
135
|
@system_arguments = deny_tag_argument(**system_arguments)
|
75
136
|
@system_arguments[:tag] = "auto-complete"
|
76
137
|
@system_arguments[:src] = src
|
77
138
|
@system_arguments[:for] = list_id
|
78
139
|
end
|
79
140
|
|
80
|
-
# add `results` without needing to explicitly call them in the view
|
141
|
+
# add `input` and `results` without needing to explicitly call them in the view
|
81
142
|
def before_render
|
82
143
|
results(classes: "") unless results
|
144
|
+
input(classes: "") unless input
|
83
145
|
end
|
84
146
|
end
|
85
147
|
end
|
@@ -56,6 +56,23 @@ module Primer
|
|
56
56
|
}
|
57
57
|
alias counter trailing_visual_counter # remove alias when all buttons are migrated to new slot names
|
58
58
|
|
59
|
+
# `Tooltip` that appears on mouse hover or keyboard focus over the button. Use tooltips sparingly and as a last resort.
|
60
|
+
# **Important:** This tooltip defaults to `type: :description`. In a few scenarios, `type: :label` may be more appropriate.
|
61
|
+
# Consult the <%= link_to_component(Primer::Alpha::Tooltip) %> documentation for more information.
|
62
|
+
#
|
63
|
+
# @param type [Symbol] (:description) <%= one_of(Primer::Alpha::Tooltip::TYPE_OPTIONS) %>
|
64
|
+
# @param system_arguments [Hash] Same arguments as <%= link_to_component(Primer::Alpha::Tooltip) %>.
|
65
|
+
renders_one :tooltip, lambda { |**system_arguments|
|
66
|
+
raise ArgumentError, "Buttons with a tooltip must have a unique `id` set on the `Button`." if @id.blank? && !Rails.env.production?
|
67
|
+
|
68
|
+
@system_arguments = system_arguments
|
69
|
+
|
70
|
+
@system_arguments[:for_id] = @id
|
71
|
+
@system_arguments[:type] ||= :description
|
72
|
+
|
73
|
+
Primer::Alpha::Tooltip.new(**@system_arguments)
|
74
|
+
}
|
75
|
+
|
59
76
|
# @example Schemes
|
60
77
|
# <%= render(Primer::ButtonComponent.new) { "Default" } %>
|
61
78
|
# <%= render(Primer::ButtonComponent.new(scheme: :primary)) { "Primary" } %>
|
@@ -96,6 +113,15 @@ module Primer
|
|
96
113
|
# Button
|
97
114
|
# <% end %>
|
98
115
|
#
|
116
|
+
# @example With tooltip
|
117
|
+
# @description
|
118
|
+
# Use tooltips sparingly and as a last resort. Consult the <%= link_to_component(Primer::Alpha::Tooltip) %> documentation for more information.
|
119
|
+
# @code
|
120
|
+
# <%= render(Primer::ButtonComponent.new(id: "button-with-tooltip")) do |c| %>
|
121
|
+
# <% c.tooltip(text: "Tooltip text") %>
|
122
|
+
# Button
|
123
|
+
# <% end %>
|
124
|
+
#
|
99
125
|
# @param scheme [Symbol] <%= one_of(Primer::ButtonComponent::SCHEME_OPTIONS) %>
|
100
126
|
# @param variant [Symbol] DEPRECATED. <%= one_of(Primer::ButtonComponent::SIZE_OPTIONS) %>
|
101
127
|
# @param size [Symbol] <%= one_of(Primer::ButtonComponent::SIZE_OPTIONS) %>
|
@@ -118,6 +144,9 @@ module Primer
|
|
118
144
|
@dropdown = dropdown
|
119
145
|
|
120
146
|
@system_arguments = system_arguments
|
147
|
+
|
148
|
+
@id = @system_arguments[:id]
|
149
|
+
|
121
150
|
@system_arguments[:classes] = class_names(
|
122
151
|
system_arguments[:classes],
|
123
152
|
SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)],
|
@@ -102,10 +102,17 @@ module Primer
|
|
102
102
|
def deny_aria_label(tag:, arguments:)
|
103
103
|
return arguments.except!(:skip_aria_label_check) if arguments[:skip_aria_label_check]
|
104
104
|
return if arguments[:role]
|
105
|
-
return unless aria(:label, arguments)
|
106
105
|
return unless INVALID_ARIA_LABEL_TAGS.include?(tag)
|
107
106
|
|
108
|
-
|
107
|
+
deny_aria_key(
|
108
|
+
:label,
|
109
|
+
"Don't use `aria-label` on `#{tag}` elements. See https://www.tpgi.com/short-note-on-aria-label-aria-labelledby-and-aria-describedby/",
|
110
|
+
**arguments
|
111
|
+
)
|
112
|
+
end
|
113
|
+
|
114
|
+
def deny_aria_key(key, help_text, **arguments)
|
115
|
+
raise ArgumentError, help_text if should_raise_aria_error? && aria(key, arguments)
|
109
116
|
end
|
110
117
|
|
111
118
|
def deny_tag_argument(**arguments)
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render Primer::BaseComponent.new(**@system_arguments) do -%><%= content -%><%= tooltip -%><% end %>
|
@@ -15,6 +15,23 @@ module Primer
|
|
15
15
|
DEFAULT_TAG = :a
|
16
16
|
TAG_OPTIONS = [DEFAULT_TAG, :span].freeze
|
17
17
|
|
18
|
+
# `Tooltip` that appears on mouse hover or keyboard focus over the link. Use tooltips sparingly and as a last resort.
|
19
|
+
# **Important:** This tooltip defaults to `type: :description`. In a few scenarios, `type: :label` may be more appropriate.
|
20
|
+
# Consult the <%= link_to_component(Primer::Alpha::Tooltip) %> documentation for more information.
|
21
|
+
#
|
22
|
+
# @param type [Symbol] (:description) <%= one_of(Primer::Alpha::Tooltip::TYPE_OPTIONS) %>
|
23
|
+
# @param system_arguments [Hash] Same arguments as <%= link_to_component(Primer::Alpha::Tooltip) %>.
|
24
|
+
renders_one :tooltip, lambda { |**system_arguments|
|
25
|
+
raise ArgumentError, "Links with a tooltip must have a unique `id` set on the `LinkComponent`." if @id.blank? && !Rails.env.production?
|
26
|
+
|
27
|
+
@system_arguments = system_arguments
|
28
|
+
|
29
|
+
@system_arguments[:for_id] = @id
|
30
|
+
@system_arguments[:type] ||= :description
|
31
|
+
|
32
|
+
Primer::Alpha::Tooltip.new(**@system_arguments)
|
33
|
+
}
|
34
|
+
|
18
35
|
# @example Default
|
19
36
|
# <%= render(Primer::LinkComponent.new(href: "#")) { "Link" } %>
|
20
37
|
#
|
@@ -31,6 +48,15 @@ module Primer
|
|
31
48
|
# @example Span as link
|
32
49
|
# <%= render(Primer::LinkComponent.new(tag: :span)) { "Span as a link" } %>
|
33
50
|
#
|
51
|
+
# @example With tooltip
|
52
|
+
# @description
|
53
|
+
# Use tooltips sparingly and as a last resort. Consult the <%= link_to_component(Primer::Alpha::Tooltip) %> documentation for more information.
|
54
|
+
# @code
|
55
|
+
# <%= render(Primer::LinkComponent.new(href: "#", id: "link-with-tooltip")) do |c| %>
|
56
|
+
# <% c.tooltip(text: "Tooltip text") %>
|
57
|
+
# Link
|
58
|
+
# <% end %>
|
59
|
+
#
|
34
60
|
# @param tag [String] <%= one_of(Primer::LinkComponent::TAG_OPTIONS) %>
|
35
61
|
# @param href [String] URL to be used for the Link. Required if tag is `:a`. If the requirements are not met an error will be raised in non production environments. In production, an empty link element will be rendered.
|
36
62
|
# @param scheme [Symbol] <%= one_of(Primer::LinkComponent::SCHEME_MAPPINGS.keys) %>
|
@@ -39,6 +65,9 @@ module Primer
|
|
39
65
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
40
66
|
def initialize(href: nil, tag: DEFAULT_TAG, scheme: DEFAULT_SCHEME, muted: false, underline: true, **system_arguments)
|
41
67
|
@system_arguments = system_arguments
|
68
|
+
|
69
|
+
@id = @system_arguments[:id]
|
70
|
+
|
42
71
|
@system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG)
|
43
72
|
@system_arguments[:href] = href
|
44
73
|
@system_arguments[:classes] = class_names(
|
@@ -50,10 +79,6 @@ module Primer
|
|
50
79
|
)
|
51
80
|
end
|
52
81
|
|
53
|
-
def call
|
54
|
-
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
55
|
-
end
|
56
|
-
|
57
82
|
def before_render
|
58
83
|
raise ArgumentError, "href is required when using <a> tag" if @system_arguments[:tag] == :a && @system_arguments[:href].nil? && !Rails.env.production?
|
59
84
|
end
|
@@ -98,6 +98,8 @@
|
|
98
98
|
- color-bg-sponsors
|
99
99
|
:sponsors_emphasis:
|
100
100
|
- color-bg-sponsors-emphasis
|
101
|
+
:transparent:
|
102
|
+
- color-bg-transparent
|
101
103
|
:border_color:
|
102
104
|
:default:
|
103
105
|
- color-border-default
|
@@ -1415,6 +1417,12 @@
|
|
1415
1417
|
- hide-lg
|
1416
1418
|
:xl:
|
1417
1419
|
- hide-xl
|
1420
|
+
:whenNarrow:
|
1421
|
+
- hide-whenNarrow
|
1422
|
+
:whenRegular:
|
1423
|
+
- hide-whenRegular
|
1424
|
+
:whenWide:
|
1425
|
+
- hide-whenWide
|
1418
1426
|
:container:
|
1419
1427
|
:sm:
|
1420
1428
|
- container-sm
|
@@ -1553,10 +1561,22 @@
|
|
1553
1561
|
:text_align:
|
1554
1562
|
:right:
|
1555
1563
|
- text-right
|
1564
|
+
- text-sm-right
|
1565
|
+
- text-md-right
|
1566
|
+
- text-lg-right
|
1567
|
+
- text-xl-right
|
1556
1568
|
:left:
|
1557
1569
|
- text-left
|
1570
|
+
- text-sm-left
|
1571
|
+
- text-md-left
|
1572
|
+
- text-lg-left
|
1573
|
+
- text-xl-left
|
1558
1574
|
:center:
|
1559
1575
|
- text-center
|
1576
|
+
- text-sm-center
|
1577
|
+
- text-md-center
|
1578
|
+
- text-lg-center
|
1579
|
+
- text-xl-center
|
1560
1580
|
:font_weight:
|
1561
1581
|
:light:
|
1562
1582
|
- text-light
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rubocop"
|
4
|
+
require "json"
|
5
|
+
require "parser/current"
|
6
|
+
|
7
|
+
module RuboCop
|
8
|
+
module Cop
|
9
|
+
module Primer
|
10
|
+
# This cop ensures that components marked as "deprecated" in `static/statuses.json` are discouraged from use.
|
11
|
+
#
|
12
|
+
# bad
|
13
|
+
# Primer::BlankslateComponent.new(:foo)
|
14
|
+
#
|
15
|
+
# good
|
16
|
+
# Primer::Beta::Blankslate.new(:foo)
|
17
|
+
#
|
18
|
+
# bad
|
19
|
+
# Primer::Tooltip.new(:foo)
|
20
|
+
#
|
21
|
+
# good
|
22
|
+
# Primer::Alpha::Tooltip.new(:foo)
|
23
|
+
class DeprecatedComponents < BaseCop
|
24
|
+
# If there is no alternative to suggest, set the value to nil.
|
25
|
+
COMPONENT_TO_USE_INSTEAD = {
|
26
|
+
"Primer::BlankslateComponent" => "Primer::Beta::Blankslate",
|
27
|
+
"Primer::DropdownMenuComponent" => nil,
|
28
|
+
"Primer::Tooltip" => "Primer::Alpha::Tooltip",
|
29
|
+
"Primer::FlexComponent" => nil,
|
30
|
+
"Primer::FlexItemComponent" => nil
|
31
|
+
}.freeze
|
32
|
+
|
33
|
+
def on_send(node)
|
34
|
+
return unless node.source.include?("Primer::")
|
35
|
+
|
36
|
+
deprecated_components.each do |component|
|
37
|
+
pattern = NodePattern.new("(send #{pattern(component)} :new ...)")
|
38
|
+
add_offense(node, message: message(component)) if pattern.match(node)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
# Converts a string to acceptable rubocop-ast pattern syntax
|
45
|
+
def pattern(component)
|
46
|
+
Parser::CurrentRuby.parse(component)
|
47
|
+
.to_s
|
48
|
+
.gsub("nil", "nil?")
|
49
|
+
.delete("\n")
|
50
|
+
.gsub(" ", " ")
|
51
|
+
end
|
52
|
+
|
53
|
+
def message(component)
|
54
|
+
message = "#{component} has been deprecated and should not be used."
|
55
|
+
message += " Try #{COMPONENT_TO_USE_INSTEAD[component]} instead." if COMPONENT_TO_USE_INSTEAD.fetch(component).present?
|
56
|
+
message
|
57
|
+
end
|
58
|
+
|
59
|
+
def statuses_json
|
60
|
+
JSON.parse(
|
61
|
+
File.read(
|
62
|
+
File.join(File.dirname(__FILE__), "../../../../static/statuses.json")
|
63
|
+
)
|
64
|
+
).freeze
|
65
|
+
end
|
66
|
+
|
67
|
+
def deprecated_components
|
68
|
+
@deprecated_components ||= statuses_json.select { |_, value| value == "deprecated" }.keys.tap do |deprecated_components|
|
69
|
+
deprecated_components.each do |deprecated|
|
70
|
+
unless COMPONENT_TO_USE_INSTEAD.key?(deprecated)
|
71
|
+
raise "Please provide a component that should be used in place of #{deprecated} in COMPONENT_TO_USE_INSTEAD. "\
|
72
|
+
"If there is no alternative, set the value to nil."
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -54,10 +54,22 @@
|
|
54
54
|
:text_align:
|
55
55
|
:right:
|
56
56
|
- text-right
|
57
|
+
- text-sm-right
|
58
|
+
- text-md-right
|
59
|
+
- text-lg-right
|
60
|
+
- text-xl-right
|
57
61
|
:left:
|
58
62
|
- text-left
|
63
|
+
- text-sm-left
|
64
|
+
- text-md-left
|
65
|
+
- text-lg-left
|
66
|
+
- text-xl-left
|
59
67
|
:center:
|
60
68
|
- text-center
|
69
|
+
- text-sm-center
|
70
|
+
- text-md-center
|
71
|
+
- text-lg-center
|
72
|
+
- text-xl-center
|
61
73
|
:font_weight:
|
62
74
|
:light:
|
63
75
|
- text-light
|
data/lib/tasks/docs.rake
CHANGED
@@ -96,7 +96,9 @@ namespace :docs do
|
|
96
96
|
Primer::TimeAgoComponent,
|
97
97
|
Primer::Alpha::UnderlinePanels,
|
98
98
|
Primer::Alpha::TabPanels,
|
99
|
-
Primer::Alpha::Tooltip
|
99
|
+
Primer::Alpha::Tooltip,
|
100
|
+
Primer::ButtonComponent,
|
101
|
+
Primer::LinkComponent
|
100
102
|
]
|
101
103
|
|
102
104
|
all_components = Primer::Component.descendants - [Primer::BaseComponent]
|
data/static/arguments.yml
CHANGED
@@ -201,15 +201,33 @@
|
|
201
201
|
type: String
|
202
202
|
default: N/A
|
203
203
|
description: Id of the input element.
|
204
|
+
- name: input_name
|
205
|
+
type: String
|
206
|
+
default: "`nil`"
|
207
|
+
description: Optional name of the input element, defaults to `input_id` when not
|
208
|
+
set.
|
204
209
|
- name: list_id
|
205
210
|
type: String
|
206
211
|
default: N/A
|
207
212
|
description: Id of the list element.
|
213
|
+
- name: with_icon
|
214
|
+
type: Boolean
|
215
|
+
default: "`false`"
|
216
|
+
description: Controls if a search icon is visible, defaults to `false`.
|
208
217
|
- name: is_label_visible
|
209
218
|
type: Boolean
|
210
219
|
default: "`true`"
|
211
220
|
description: Controls if the label is visible. If `false`, screen reader only
|
212
221
|
text will be added.
|
222
|
+
- name: is_clearable
|
223
|
+
type: Boolean
|
224
|
+
default: "`false`"
|
225
|
+
description: Adds optional clear button.
|
226
|
+
- name: is_label_inline
|
227
|
+
type: Boolean
|
228
|
+
default: "`false`"
|
229
|
+
description: Controls if the label is inline. On smaller screens, label will always
|
230
|
+
become stacked.
|
213
231
|
- name: system_arguments
|
214
232
|
type: Hash
|
215
233
|
default: N/A
|
data/static/classes.yml
CHANGED
@@ -82,7 +82,11 @@
|
|
82
82
|
- ".UnderlineNav-item"
|
83
83
|
- ".UnderlineNav-octicon"
|
84
84
|
- ".anim-rotate"
|
85
|
+
- ".autocomplete-body"
|
86
|
+
- ".autocomplete-embedded-icon-wrap"
|
85
87
|
- ".autocomplete-item"
|
88
|
+
- ".autocomplete-label-inline"
|
89
|
+
- ".autocomplete-label-stacked"
|
86
90
|
- ".autocomplete-results"
|
87
91
|
- ".avatar"
|
88
92
|
- ".avatar-more"
|
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.0.
|
4
|
+
version: 0.0.72
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -366,7 +366,7 @@ dependencies:
|
|
366
366
|
- - "~>"
|
367
367
|
- !ruby/object:Gem::Version
|
368
368
|
version: 0.9.25
|
369
|
-
description:
|
369
|
+
description:
|
370
370
|
email:
|
371
371
|
- opensource+primer_view_components@github.com
|
372
372
|
executables: []
|
@@ -387,10 +387,10 @@ files:
|
|
387
387
|
- app/components/primer/alpha/tab_nav.rb
|
388
388
|
- app/components/primer/alpha/tab_panels.html.erb
|
389
389
|
- app/components/primer/alpha/tab_panels.rb
|
390
|
-
- app/components/primer/alpha/
|
391
|
-
- app/components/primer/alpha/
|
390
|
+
- app/components/primer/alpha/tool-tip-element.d.ts
|
391
|
+
- app/components/primer/alpha/tool-tip-element.js
|
392
|
+
- app/components/primer/alpha/tool-tip-element.ts
|
392
393
|
- app/components/primer/alpha/tooltip.rb
|
393
|
-
- app/components/primer/alpha/tooltip.ts
|
394
394
|
- app/components/primer/alpha/underline_nav.html.erb
|
395
395
|
- app/components/primer/alpha/underline_nav.rb
|
396
396
|
- app/components/primer/alpha/underline_panels.html.erb
|
@@ -462,6 +462,7 @@ files:
|
|
462
462
|
- app/components/primer/label_component.rb
|
463
463
|
- app/components/primer/layout_component.html.erb
|
464
464
|
- app/components/primer/layout_component.rb
|
465
|
+
- app/components/primer/link_component.erb
|
465
466
|
- app/components/primer/link_component.rb
|
466
467
|
- app/components/primer/local_time.d.ts
|
467
468
|
- app/components/primer/local_time.js
|
@@ -550,6 +551,7 @@ files:
|
|
550
551
|
- lib/rubocop/cop/primer/component_name_migration.rb
|
551
552
|
- lib/rubocop/cop/primer/deprecated_arguments.rb
|
552
553
|
- lib/rubocop/cop/primer/deprecated_button_arguments.rb
|
554
|
+
- lib/rubocop/cop/primer/deprecated_components.rb
|
553
555
|
- lib/rubocop/cop/primer/deprecated_label_schemes.rb
|
554
556
|
- lib/rubocop/cop/primer/deprecated_layout_component.rb
|
555
557
|
- lib/rubocop/cop/primer/no_tag_memoize.rb
|
@@ -577,7 +579,7 @@ licenses:
|
|
577
579
|
- MIT
|
578
580
|
metadata:
|
579
581
|
allowed_push_host: https://rubygems.org
|
580
|
-
post_install_message:
|
582
|
+
post_install_message:
|
581
583
|
rdoc_options: []
|
582
584
|
require_paths:
|
583
585
|
- lib
|
@@ -592,8 +594,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
592
594
|
- !ruby/object:Gem::Version
|
593
595
|
version: '0'
|
594
596
|
requirements: []
|
595
|
-
rubygems_version: 3.
|
596
|
-
signing_key:
|
597
|
+
rubygems_version: 3.1.6
|
598
|
+
signing_key:
|
597
599
|
specification_version: 4
|
598
600
|
summary: ViewComponents for the Primer Design System
|
599
601
|
test_files: []
|