primer_view_components 0.0.69 → 0.0.70
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 +36 -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.js +121 -121
- data/app/components/primer/alpha/tooltip.rb +8 -0
- data/app/components/primer/alpha/tooltip.ts +13 -7
- 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 +4 -0
- data/app/components/primer/link_component.rb +29 -4
- data/lib/primer/classify/utilities.yml +8 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/tasks/docs.rake +3 -1
- data/static/arguments.yml +18 -0
- data/static/classes.yml +4 -0
- metadata +8 -7
@@ -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)
|
@@ -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
|
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.70
|
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-03-
|
11
|
+
date: 2022-03-30 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: []
|
@@ -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
|
@@ -577,7 +578,7 @@ licenses:
|
|
577
578
|
- MIT
|
578
579
|
metadata:
|
579
580
|
allowed_push_host: https://rubygems.org
|
580
|
-
post_install_message:
|
581
|
+
post_install_message:
|
581
582
|
rdoc_options: []
|
582
583
|
require_paths:
|
583
584
|
- lib
|
@@ -592,8 +593,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
592
593
|
- !ruby/object:Gem::Version
|
593
594
|
version: '0'
|
594
595
|
requirements: []
|
595
|
-
rubygems_version: 3.
|
596
|
-
signing_key:
|
596
|
+
rubygems_version: 3.1.6
|
597
|
+
signing_key:
|
597
598
|
specification_version: 4
|
598
599
|
summary: ViewComponents for the Primer Design System
|
599
600
|
test_files: []
|