primer_view_components 0.0.40 → 0.0.41
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 +62 -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/auto_complete.rb +2 -0
- data/app/components/primer/avatar_stack_component.rb +2 -2
- data/app/components/primer/base_component.rb +5 -2
- data/app/components/primer/blankslate_component.rb +5 -5
- data/app/components/primer/clipboard_copy_component.js +13 -2
- data/app/components/primer/clipboard_copy_component.ts +15 -2
- data/app/components/primer/flash_component.rb +2 -2
- data/app/components/primer/image.rb +46 -0
- data/app/components/primer/image_crop.rb +1 -1
- data/app/components/primer/label_component.rb +6 -2
- data/app/components/primer/local_time.d.ts +1 -0
- data/app/components/primer/local_time.js +1 -0
- data/app/components/primer/local_time.rb +59 -0
- data/app/components/primer/local_time.ts +1 -0
- data/app/components/primer/navigation/tab_component.rb +8 -1
- data/app/components/primer/octicon_component.rb +13 -11
- data/app/components/primer/primer.d.ts +1 -0
- data/app/components/primer/primer.js +1 -0
- data/app/components/primer/primer.ts +1 -0
- data/app/components/primer/tab_nav_component.html.erb +2 -0
- data/app/components/primer/tab_nav_component.rb +22 -9
- data/app/components/primer/{tooltip_component.rb → tooltip.rb} +10 -8
- data/app/lib/primer/classify.rb +2 -2
- data/app/lib/primer/view_helper.rb +2 -1
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/tasks/docs.rake +4 -1
- data/static/statuses.json +3 -1
- metadata +24 -5
@@ -22,6 +22,9 @@ module Primer
|
|
22
22
|
)
|
23
23
|
}
|
24
24
|
|
25
|
+
# Renders extra content to the `TabNav`. This will be rendered after the tabs.
|
26
|
+
renders_one :extra
|
27
|
+
|
25
28
|
# @example Default
|
26
29
|
# <%= render(Primer::TabNavComponent.new(label: "Default")) do |c| %>
|
27
30
|
# <% c.tab(selected: true, href: "#") { "Tab 1" }%>
|
@@ -68,12 +71,24 @@ module Primer
|
|
68
71
|
# <% end %>
|
69
72
|
# <% end %>
|
70
73
|
#
|
74
|
+
# @example With extra content
|
75
|
+
# <%= render(Primer::TabNavComponent.new(label: "Default")) do |c| %>
|
76
|
+
# <% c.tab(selected: true, href: "#") { "Tab 1" }%>
|
77
|
+
# <% c.tab(href: "#") { "Tab 2" } %>
|
78
|
+
# <% c.tab(href: "#") { "Tab 3" } %>
|
79
|
+
# <% c.extra do %>
|
80
|
+
# <%= render(Primer::ButtonComponent.new(float: :right)) { "Button" } %>
|
81
|
+
# <% end %>
|
82
|
+
# <% end %>
|
83
|
+
#
|
71
84
|
# @param label [String] Used to set the `aria-label` on the top level `<nav>` element.
|
72
85
|
# @param with_panel [Boolean] Whether the TabNav should navigate through pages or panels.
|
86
|
+
# @param body_arguments [Hash] <%= link_to_system_arguments_docs %> for the body wrapper.
|
73
87
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
74
|
-
def initialize(label:, with_panel: false, **system_arguments)
|
88
|
+
def initialize(label:, with_panel: false, body_arguments: {}, **system_arguments)
|
75
89
|
@with_panel = with_panel
|
76
90
|
@system_arguments = system_arguments
|
91
|
+
@body_arguments = body_arguments
|
77
92
|
|
78
93
|
@system_arguments[:tag] ||= :div
|
79
94
|
@system_arguments[:classes] = class_names(
|
@@ -81,15 +96,13 @@ module Primer
|
|
81
96
|
system_arguments[:classes]
|
82
97
|
)
|
83
98
|
|
84
|
-
@body_arguments =
|
85
|
-
|
86
|
-
classes: "tabnav-tabs",
|
87
|
-
aria: {
|
88
|
-
label: label
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
99
|
+
@body_arguments[:tag] = navigation_tag(with_panel)
|
100
|
+
@body_arguments[:"aria-label"] = label
|
92
101
|
@body_arguments[:role] = :tablist if @with_panel
|
102
|
+
@body_arguments[:classes] = class_names(
|
103
|
+
"tabnav-tabs",
|
104
|
+
body_arguments[:classes]
|
105
|
+
)
|
93
106
|
end
|
94
107
|
end
|
95
108
|
end
|
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
module Primer
|
4
4
|
# `Tooltip` is a wrapper component that will apply a tooltip to the provided content.
|
5
|
-
class
|
5
|
+
class Tooltip < Primer::Component
|
6
|
+
status :beta
|
7
|
+
|
6
8
|
DIRECTION_DEFAULT = :n
|
7
9
|
ALIGN_DEFAULT = :default
|
8
10
|
MULTILINE_DEFAULT = false
|
@@ -28,34 +30,34 @@ module Primer
|
|
28
30
|
|
29
31
|
# @example Default
|
30
32
|
# <div class="pt-5">
|
31
|
-
# <%= render(Primer::
|
33
|
+
# <%= render(Primer::Tooltip.new(label: "Even bolder")) { "Default Bold Text" } %>
|
32
34
|
# </div>
|
33
35
|
#
|
34
36
|
# @example Wrapping another component
|
35
37
|
# <div class="pt-5">
|
36
|
-
# <%= render(Primer::
|
38
|
+
# <%= render(Primer::Tooltip.new(label: "Even bolder")) do %>
|
37
39
|
# <%= render(Primer::ButtonComponent.new) { "Bold Button" } %>
|
38
40
|
# <% end %>
|
39
41
|
# </div>
|
40
42
|
#
|
41
43
|
# @example With a direction
|
42
44
|
# <div class="pt-5">
|
43
|
-
# <%= render(Primer::
|
45
|
+
# <%= render(Primer::Tooltip.new(label: "Even bolder", direction: :s)) { "Bold Text With a Direction" } %>
|
44
46
|
# </div>
|
45
47
|
#
|
46
48
|
# @example With an alignment
|
47
49
|
# <div class="pt-5">
|
48
|
-
# <%= render(Primer::
|
50
|
+
# <%= render(Primer::Tooltip.new(label: "Even bolder", direction: :s, alignment: :right_1)) { "Bold Text With an Alignment" } %>
|
49
51
|
# </div>
|
50
52
|
#
|
51
53
|
# @example Without a delay
|
52
54
|
# <div class="pt-5">
|
53
|
-
# <%= render(Primer::
|
55
|
+
# <%= render(Primer::Tooltip.new(label: "Even bolder", direction: :s, no_delay: true)) { "Bold Text without a delay" } %>
|
54
56
|
# </div>
|
55
57
|
#
|
56
58
|
# @param label [String] the text to appear in the tooltip
|
57
|
-
# @param direction [String] Direction of the tooltip. <%= one_of(Primer::
|
58
|
-
# @param align [String] Align tooltips to the left or right of an element, combined with a `direction` to specify north or south. <%= one_of(Primer::
|
59
|
+
# @param direction [String] Direction of the tooltip. <%= one_of(Primer::Tooltip::DIRECTION_OPTIONS) %>
|
60
|
+
# @param align [String] Align tooltips to the left or right of an element, combined with a `direction` to specify north or south. <%= one_of(Primer::Tooltip::ALIGN_MAPPING.keys) %>
|
59
61
|
# @param multiline [Boolean] Use this when you have long content
|
60
62
|
# @param no_delay [Boolean] By default the tooltips have a slight delay before appearing. Set true to override this
|
61
63
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
data/app/lib/primer/classify.rb
CHANGED
@@ -123,13 +123,13 @@ module Primer
|
|
123
123
|
def validated_class_names(classes)
|
124
124
|
return if classes.blank?
|
125
125
|
|
126
|
-
if ENV["RAILS_ENV"] == "development"
|
126
|
+
if ENV["RAILS_ENV"] == "development" && !ENV["PRIMER_WARNINGS_DISABLED"]
|
127
127
|
invalid_class_names =
|
128
128
|
classes.split(" ").each_with_object([]) do |class_name, memo|
|
129
129
|
memo << class_name if INVALID_CLASS_NAME_PREFIXES.any? { |prefix| class_name.start_with?(prefix) }
|
130
130
|
end
|
131
131
|
|
132
|
-
raise ArgumentError, "Use System Arguments (https://primer.style/view-components/system-arguments) instead of Primer CSS class #{'name'.pluralize(invalid_class_names.length)} #{invalid_class_names.to_sentence}. This warning will not be raised in production." if invalid_class_names.any?
|
132
|
+
raise ArgumentError, "Use System Arguments (https://primer.style/view-components/system-arguments) instead of Primer CSS class #{'name'.pluralize(invalid_class_names.length)} #{invalid_class_names.to_sentence}. This warning will not be raised in production. Set PRIMER_WARNINGS_DISABLED=1 to disable this warning." if invalid_class_names.any?
|
133
133
|
end
|
134
134
|
|
135
135
|
classes
|
@@ -8,7 +8,8 @@ module Primer
|
|
8
8
|
HELPERS = {
|
9
9
|
octicon: "Primer::OcticonComponent",
|
10
10
|
heading: "Primer::HeadingComponent",
|
11
|
-
time_ago: "Primer::TimeAgoComponent"
|
11
|
+
time_ago: "Primer::TimeAgoComponent",
|
12
|
+
image: "Primer::Image"
|
12
13
|
}.freeze
|
13
14
|
|
14
15
|
HELPERS.each do |name, component|
|
data/lib/tasks/docs.rake
CHANGED
@@ -47,6 +47,8 @@ namespace :docs do
|
|
47
47
|
registry = YARD::RegistryStore.new
|
48
48
|
registry.load!(".yardoc")
|
49
49
|
components = [
|
50
|
+
Primer::Image,
|
51
|
+
Primer::LocalTime,
|
50
52
|
Primer::OcticonSymbolsComponent,
|
51
53
|
Primer::ImageCrop,
|
52
54
|
Primer::IconButton,
|
@@ -90,12 +92,13 @@ namespace :docs do
|
|
90
92
|
Primer::TextComponent,
|
91
93
|
Primer::TimeAgoComponent,
|
92
94
|
Primer::TimelineItemComponent,
|
93
|
-
Primer::
|
95
|
+
Primer::Tooltip,
|
94
96
|
Primer::Truncate,
|
95
97
|
Primer::UnderlineNavComponent
|
96
98
|
]
|
97
99
|
|
98
100
|
js_components = [
|
101
|
+
Primer::LocalTime,
|
99
102
|
Primer::ImageCrop,
|
100
103
|
Primer::AutoComplete,
|
101
104
|
Primer::ClipboardCopy,
|
data/static/statuses.json
CHANGED
@@ -26,10 +26,12 @@
|
|
26
26
|
"Primer::HeadingComponent": "beta",
|
27
27
|
"Primer::HiddenTextExpander": "alpha",
|
28
28
|
"Primer::IconButton": "beta",
|
29
|
+
"Primer::Image": "alpha",
|
29
30
|
"Primer::ImageCrop": "alpha",
|
30
31
|
"Primer::LabelComponent": "beta",
|
31
32
|
"Primer::LayoutComponent": "alpha",
|
32
33
|
"Primer::LinkComponent": "beta",
|
34
|
+
"Primer::LocalTime": "alpha",
|
33
35
|
"Primer::Markdown": "beta",
|
34
36
|
"Primer::MenuComponent": "alpha",
|
35
37
|
"Primer::Navigation::TabComponent": "alpha",
|
@@ -46,7 +48,7 @@
|
|
46
48
|
"Primer::TimeAgoComponent": "beta",
|
47
49
|
"Primer::TimelineItemComponent": "beta",
|
48
50
|
"Primer::TimelineItemComponent::BadgeComponent": "alpha",
|
49
|
-
"Primer::
|
51
|
+
"Primer::Tooltip": "beta",
|
50
52
|
"Primer::Truncate": "beta",
|
51
53
|
"Primer::UnderlineNavComponent": "alpha"
|
52
54
|
}
|
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.41
|
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: 2021-05-
|
11
|
+
date: 2021-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -86,6 +86,20 @@ dependencies:
|
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: 0.6.3
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: axe-core-api
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '4.1'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '4.1'
|
89
103
|
- !ruby/object:Gem::Dependency
|
90
104
|
name: benchmark-ips
|
91
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,14 +134,14 @@ dependencies:
|
|
120
134
|
requirements:
|
121
135
|
- - '='
|
122
136
|
- !ruby/object:Gem::Version
|
123
|
-
version: '0.
|
137
|
+
version: '0.13'
|
124
138
|
type: :development
|
125
139
|
prerelease: false
|
126
140
|
version_requirements: !ruby/object:Gem::Requirement
|
127
141
|
requirements:
|
128
142
|
- - '='
|
129
143
|
- !ruby/object:Gem::Version
|
130
|
-
version: '0.
|
144
|
+
version: '0.13'
|
131
145
|
- !ruby/object:Gem::Dependency
|
132
146
|
name: listen
|
133
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -370,6 +384,7 @@ files:
|
|
370
384
|
- app/components/primer/heading_component.rb
|
371
385
|
- app/components/primer/hidden_text_expander.rb
|
372
386
|
- app/components/primer/icon_button.rb
|
387
|
+
- app/components/primer/image.rb
|
373
388
|
- app/components/primer/image_crop.d.ts
|
374
389
|
- app/components/primer/image_crop.html.erb
|
375
390
|
- app/components/primer/image_crop.js
|
@@ -379,6 +394,10 @@ files:
|
|
379
394
|
- app/components/primer/layout_component.html.erb
|
380
395
|
- app/components/primer/layout_component.rb
|
381
396
|
- app/components/primer/link_component.rb
|
397
|
+
- app/components/primer/local_time.d.ts
|
398
|
+
- app/components/primer/local_time.js
|
399
|
+
- app/components/primer/local_time.rb
|
400
|
+
- app/components/primer/local_time.ts
|
382
401
|
- app/components/primer/markdown.rb
|
383
402
|
- app/components/primer/menu_component.html.erb
|
384
403
|
- app/components/primer/menu_component.rb
|
@@ -413,7 +432,7 @@ files:
|
|
413
432
|
- app/components/primer/time_ago_component.ts
|
414
433
|
- app/components/primer/timeline_item_component.html.erb
|
415
434
|
- app/components/primer/timeline_item_component.rb
|
416
|
-
- app/components/primer/
|
435
|
+
- app/components/primer/tooltip.rb
|
417
436
|
- app/components/primer/truncate.rb
|
418
437
|
- app/components/primer/underline_nav_component.html.erb
|
419
438
|
- app/components/primer/underline_nav_component.rb
|