primer_view_components 0.0.79 → 0.0.82
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -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/blankslate_component.html.erb +2 -2
- data/app/components/primer/button_component.rb +3 -5
- data/app/components/primer/component.rb +1 -1
- data/app/components/primer/link_component.rb +3 -5
- data/app/components/primer/octicon_component.rb +2 -0
- data/app/components/primer/tab_container_component.d.ts +1 -1
- data/lib/primer/view_components/linters/disallow_action_list.rb +73 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/static/arguments.yml +1 -1
- data/static/constants.json +4 -1
- metadata +4 -3
@@ -5,7 +5,7 @@
|
|
5
5
|
<% elsif @icon.present? %>
|
6
6
|
<%= primer_octicon @icon, size: @icon_size, classes: "blankslate-icon" %>
|
7
7
|
<% elsif @image_src.present? && @image_alt.present? %>
|
8
|
-
<%= image_tag
|
8
|
+
<%= image_tag @image_src.to_s, class: "mb-3", size: "56x56", alt: @image_alt.to_s %>
|
9
9
|
<% end %>
|
10
10
|
|
11
11
|
<% if @title.present? %>
|
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
<% if @link_text.present? && @link_url.present? %>
|
26
26
|
<p>
|
27
|
-
<%= link_to
|
27
|
+
<%= link_to @link_url.to_s do %><%= @link_text %><% end %>
|
28
28
|
</p>
|
29
29
|
<% end %>
|
30
30
|
<% end %>
|
@@ -65,12 +65,10 @@ module Primer
|
|
65
65
|
renders_one :tooltip, lambda { |**system_arguments|
|
66
66
|
raise ArgumentError, "Buttons with a tooltip must have a unique `id` set on the `Button`." if @id.blank? && !Rails.env.production?
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
@system_arguments[:for_id] = @id
|
71
|
-
@system_arguments[:type] ||= :description
|
68
|
+
system_arguments[:for_id] = @id
|
69
|
+
system_arguments[:type] ||= :description
|
72
70
|
|
73
|
-
Primer::Alpha::Tooltip.new(
|
71
|
+
Primer::Alpha::Tooltip.new(**system_arguments)
|
74
72
|
}
|
75
73
|
|
76
74
|
# @example Schemes
|
@@ -6,7 +6,7 @@ module Primer
|
|
6
6
|
# @private
|
7
7
|
class Component < ViewComponent::Base
|
8
8
|
include ViewComponent::SlotableV2 unless ViewComponent::Base < ViewComponent::SlotableV2
|
9
|
-
include ViewComponent::PolymorphicSlots
|
9
|
+
include ViewComponent::PolymorphicSlots unless ViewComponent::Base < ViewComponent::PolymorphicSlots
|
10
10
|
include ClassNameHelper
|
11
11
|
include FetchOrFallbackHelper
|
12
12
|
include TestSelectorHelper
|
@@ -24,12 +24,10 @@ module Primer
|
|
24
24
|
renders_one :tooltip, lambda { |**system_arguments|
|
25
25
|
raise ArgumentError, "Links with a tooltip must have a unique `id` set on the `LinkComponent`." if @id.blank? && !Rails.env.production?
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
@system_arguments[:for_id] = @id
|
30
|
-
@system_arguments[:type] ||= :description
|
27
|
+
system_arguments[:for_id] = @id
|
28
|
+
system_arguments[:type] ||= :description
|
31
29
|
|
32
|
-
Primer::Alpha::Tooltip.new(
|
30
|
+
Primer::Alpha::Tooltip.new(**system_arguments)
|
33
31
|
}
|
34
32
|
|
35
33
|
# @example Default
|
@@ -8,10 +8,12 @@ module Primer
|
|
8
8
|
class OcticonComponent < Primer::Component
|
9
9
|
status :beta
|
10
10
|
|
11
|
+
SIZE_XSMALL = :xsmall
|
11
12
|
SIZE_DEFAULT = :small
|
12
13
|
SIZE_MEDIUM = :medium
|
13
14
|
|
14
15
|
SIZE_MAPPINGS = {
|
16
|
+
SIZE_XSMALL => 12,
|
15
17
|
SIZE_DEFAULT => 16,
|
16
18
|
SIZE_MEDIUM => 24
|
17
19
|
}.freeze
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import '@github/tab-container-element';
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "pathname"
|
4
|
+
require_relative "helpers/rubocop_helpers"
|
5
|
+
|
6
|
+
module ERBLint
|
7
|
+
module Linters
|
8
|
+
# Finds usages of ActionList CSS classes.
|
9
|
+
class DisallowActionList < Linter
|
10
|
+
include ERBLint::LinterRegistry
|
11
|
+
include TagTreeHelpers
|
12
|
+
|
13
|
+
class ConfigSchema < LinterConfig
|
14
|
+
property :ignore_files, accepts: array_of?(String), default: -> { [] }
|
15
|
+
end
|
16
|
+
self.config_schema = ConfigSchema
|
17
|
+
|
18
|
+
def run(processed_source)
|
19
|
+
return if ignored?(processed_source.filename)
|
20
|
+
|
21
|
+
class_regex = /ActionList[\w-]*/
|
22
|
+
tags, * = build_tag_tree(processed_source)
|
23
|
+
|
24
|
+
tags.each do |tag|
|
25
|
+
next if tag.closing?
|
26
|
+
|
27
|
+
classes =
|
28
|
+
if (class_attrib = tag.attributes["class"])
|
29
|
+
loc = class_attrib.value_node.loc
|
30
|
+
loc.source_buffer.source[loc.begin_pos...loc.end_pos]
|
31
|
+
else
|
32
|
+
""
|
33
|
+
end
|
34
|
+
|
35
|
+
indices = [].tap do |results|
|
36
|
+
classes.scan(class_regex) do
|
37
|
+
results << Regexp.last_match.offset(0)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
next if indices.empty?
|
42
|
+
|
43
|
+
indices.each do |(start_idx, end_idx)|
|
44
|
+
new_loc = class_attrib.value_node.loc.with(
|
45
|
+
begin_pos: class_attrib.value_node.loc.begin_pos + start_idx,
|
46
|
+
end_pos: class_attrib.value_node.loc.begin_pos + end_idx
|
47
|
+
)
|
48
|
+
|
49
|
+
add_offense(
|
50
|
+
new_loc,
|
51
|
+
"ActionList classes are only designed to be used by Primer View Components and " \
|
52
|
+
"should be considered private. Please reach out in the #primer-rails Slack channel."
|
53
|
+
)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def ignored?(filename)
|
61
|
+
filename = Pathname(filename)
|
62
|
+
|
63
|
+
begin
|
64
|
+
filename = filename.relative_path_from(Pathname(Dir.getwd))
|
65
|
+
rescue ArgumentError
|
66
|
+
# raised if the filename does not have Dir.getwd as a prefix
|
67
|
+
end
|
68
|
+
|
69
|
+
@config.ignore_files.any? { |pattern| filename.fnmatch?(pattern) }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/static/arguments.yml
CHANGED
@@ -885,7 +885,7 @@
|
|
885
885
|
- name: size
|
886
886
|
type: Symbol
|
887
887
|
default: "`:small`"
|
888
|
-
description: One of `:small` (`16`)
|
888
|
+
description: One of `:xsmall` (`12`), `:small` (`16`), or `:medium` (`24`).
|
889
889
|
- name: use_symbol
|
890
890
|
type: Boolean
|
891
891
|
default: "`false`"
|
data/static/constants.json
CHANGED
@@ -644,14 +644,17 @@
|
|
644
644
|
"Primer::OcticonComponent": {
|
645
645
|
"SIZE_DEFAULT": "small",
|
646
646
|
"SIZE_MAPPINGS": {
|
647
|
+
"xsmall": 12,
|
647
648
|
"small": 16,
|
648
649
|
"medium": 24
|
649
650
|
},
|
650
651
|
"SIZE_MEDIUM": "medium",
|
651
652
|
"SIZE_OPTIONS": [
|
653
|
+
"xsmall",
|
652
654
|
"small",
|
653
655
|
"medium"
|
654
|
-
]
|
656
|
+
],
|
657
|
+
"SIZE_XSMALL": "xsmall"
|
655
658
|
},
|
656
659
|
"Primer::OcticonSymbolsComponent": {
|
657
660
|
},
|
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.82
|
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: 2022-
|
11
|
+
date: 2022-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -536,6 +536,7 @@ files:
|
|
536
536
|
- lib/primer/view_components/linters/button_component_migration_counter.rb
|
537
537
|
- lib/primer/view_components/linters/clipboard_copy_component_migration_counter.rb
|
538
538
|
- lib/primer/view_components/linters/close_button_component_migration_counter.rb
|
539
|
+
- lib/primer/view_components/linters/disallow_action_list.rb
|
539
540
|
- lib/primer/view_components/linters/flash_migration_counter.rb
|
540
541
|
- lib/primer/view_components/linters/helpers/rubocop_helpers.rb
|
541
542
|
- lib/primer/view_components/linters/label_component_migration_counter.rb
|
@@ -594,7 +595,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
594
595
|
- !ruby/object:Gem::Version
|
595
596
|
version: '0'
|
596
597
|
requirements: []
|
597
|
-
rubygems_version: 3.2.
|
598
|
+
rubygems_version: 3.2.22
|
598
599
|
signing_key:
|
599
600
|
specification_version: 4
|
600
601
|
summary: ViewComponents for the Primer Design System
|