primer_view_components 0.0.87 → 0.0.88
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/app/components/primer/alpha/segmented-control-element.d.ts +8 -0
- data/app/components/primer/alpha/segmented-control-element.js +27 -0
- data/app/components/primer/alpha/tooltip.rb +1 -0
- data/app/components/primer/{button_group.html.erb → beta/button_group.html.erb} +0 -0
- data/app/components/primer/beta/button_group.rb +57 -0
- data/app/components/primer/box.rb +25 -0
- data/app/components/primer/box_component.rb +2 -20
- data/app/components/primer/button_group.rb +2 -50
- data/app/components/primer/flex_component.rb +20 -20
- data/app/components/primer/flex_item_component.rb +4 -4
- data/app/components/primer/label_component.rb +31 -10
- data/app/components/primer/popover_component.rb +1 -1
- data/app/components/primer/primer.d.ts +1 -0
- data/app/components/primer/primer.js +1 -0
- data/lib/primer/view_components/linters/argument_mappers/label.rb +11 -4
- data/lib/primer/view_components/linters/helpers/deprecated_components_helpers.rb +2 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/rubocop/cop/primer/component_name_migration.rb +2 -0
- data/lib/rubocop/cop/primer/deprecated_label_variants.rb +71 -0
- data/lib/tasks/docs.rake +2 -2
- data/lib/yard/docs_helper.rb +1 -1
- data/static/arguments.yml +56 -48
- data/static/audited_at.json +2 -0
- data/static/classes.yml +2 -0
- data/static/constants.json +20 -7
- data/static/statuses.json +4 -2
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b26233820f7e3fd5f92dbfe2b73b8ee9d4a59804bd93902bd98ab0cb2896d828
|
4
|
+
data.tar.gz: 114d47251ebb0c4633a0d2b1e59bdddcd85a0c8aba2d2942d52598ef5e62f732
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6c4cff16a390f08f54d246a6e195862fa3572091f955ce74c85e47df31516deec98beb93ad8c4a526d51eb41b8ec1f5ef3c2e934d497fb81e6974e5df781aca
|
7
|
+
data.tar.gz: 1943282801abaaa921514cf116286ad274b7f71ad8e41c8cda9456a9d57364a67039dd9ad53ca2f0108bdefc6e23bbdf56c749e911829a6a4981d1619e9b4167
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.0.88
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#1275](https://github.com/primer/view_components/pull/1275) [`1e9ce95c`](https://github.com/primer/view_components/commit/1e9ce95cdc942acdb51807839b2924731a1ab295) Thanks [@mxriverlynn](https://github.com/mxriverlynn)! - move Primer::ButtonGroup to Primer::Beta::ButtonGroup, update all references, and add deprecated Primer::ButtonGroup for backwards compatibility
|
8
|
+
|
9
|
+
* [#1266](https://github.com/primer/view_components/pull/1266) [`7d2949de`](https://github.com/primer/view_components/commit/7d2949de758b97aa940287a1ceabd5d16209cae2) Thanks [@mxriverlynn](https://github.com/mxriverlynn)! - moving Primer::BoxComponent to Primer::Box and creating deprecated Primer::BoxComponent for backward compatibility
|
10
|
+
|
11
|
+
- [#1281](https://github.com/primer/view_components/pull/1281) [`843061de`](https://github.com/primer/view_components/commit/843061de168a1927a80fd22e7da795c1a9ddaacd) Thanks [@jonrohan](https://github.com/jonrohan)! - Always set `:absolute` position on Primer::Alpha::Tooltip
|
12
|
+
|
13
|
+
* [#934](https://github.com/primer/view_components/pull/934) [`d638fefb`](https://github.com/primer/view_components/commit/d638fefbb55ce9802e91b374903bcde9cc6ab612) Thanks [@pouretrebelle](https://github.com/pouretrebelle)! - Refactor the LabelComponent API
|
14
|
+
|
3
15
|
## 0.0.87
|
4
16
|
|
5
17
|
### Patch Changes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/* eslint-disable custom-elements/no-constructor */
|
2
|
+
export default class SegmentedControlElement extends HTMLElement {
|
3
|
+
constructor() {
|
4
|
+
super();
|
5
|
+
this.addEventListener('click', (event) => {
|
6
|
+
const controls = Array.from(this.querySelectorAll('[role="toolbar"] button')).filter(tab => tab instanceof HTMLElement && tab.closest(this.tagName) === this);
|
7
|
+
if (!(event.target instanceof Element))
|
8
|
+
return;
|
9
|
+
if (event.target.closest(this.tagName) !== this)
|
10
|
+
return;
|
11
|
+
const selectedControl = event.target.closest('button');
|
12
|
+
if (!(selectedControl instanceof HTMLElement) || !selectedControl.closest('[role="toolbar"]'))
|
13
|
+
return;
|
14
|
+
for (const control of controls) {
|
15
|
+
control.classList.remove('SegmentedControl-button--selected');
|
16
|
+
control.setAttribute('aria-current', 'false');
|
17
|
+
}
|
18
|
+
selectedControl.classList.add('SegmentedControl-button--selected');
|
19
|
+
selectedControl.setAttribute('aria-current', 'true');
|
20
|
+
selectedControl.focus();
|
21
|
+
});
|
22
|
+
}
|
23
|
+
}
|
24
|
+
if (!window.customElements.get('segmented-control')) {
|
25
|
+
window.SegmentedControlElement = SegmentedControlElement;
|
26
|
+
window.customElements.define('segmented-control', SegmentedControlElement);
|
27
|
+
}
|
@@ -91,6 +91,7 @@ module Primer
|
|
91
91
|
@system_arguments[:tag] = :"tool-tip"
|
92
92
|
@system_arguments[:style] = join_style_arguments(@system_arguments[:style], "visibility: hidden")
|
93
93
|
@system_arguments[:for] = for_id
|
94
|
+
@system_arguments[:position] = :absolute
|
94
95
|
@system_arguments[:"data-direction"] = fetch_or_fallback(DIRECTION_OPTIONS, direction, DIRECTION_DEFAULT).to_s
|
95
96
|
@system_arguments[:"data-type"] = fetch_or_fallback(TYPE_OPTIONS, type, TYPE_FALLBACK).to_s
|
96
97
|
end
|
File without changes
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Beta
|
5
|
+
# Use `ButtonGroup` to render a series of buttons.
|
6
|
+
class ButtonGroup < Primer::Component
|
7
|
+
status :beta
|
8
|
+
|
9
|
+
# Required list of buttons to be rendered.
|
10
|
+
#
|
11
|
+
# @param kwargs [Hash] The same arguments as <%= link_to_component(Primer::ButtonComponent) %> except for `size` and `group_item`.
|
12
|
+
renders_many :buttons, lambda { |**kwargs|
|
13
|
+
kwargs[:group_item] = true
|
14
|
+
kwargs[:size] = @size
|
15
|
+
|
16
|
+
Primer::ButtonComponent.new(**kwargs)
|
17
|
+
}
|
18
|
+
|
19
|
+
# @example Default
|
20
|
+
#
|
21
|
+
# <%= render(Primer::Beta::ButtonGroup.new) do |component| %>
|
22
|
+
# <% component.button { "Default" } %>
|
23
|
+
# <% component.button(scheme: :primary) { "Primary" } %>
|
24
|
+
# <% component.button(scheme: :danger) { "Danger" } %>
|
25
|
+
# <% component.button(scheme: :outline) { "Outline" } %>
|
26
|
+
# <% component.button(classes: "custom-class") { "Custom class" } %>
|
27
|
+
# <% end %>
|
28
|
+
#
|
29
|
+
# @example Sizes
|
30
|
+
#
|
31
|
+
# <%= render(Primer::Beta::ButtonGroup.new(size: :small)) do |component| %>
|
32
|
+
# <% component.button { "Default" } %>
|
33
|
+
# <% component.button(scheme: :primary) { "Primary" } %>
|
34
|
+
# <% component.button(scheme: :danger) { "Danger" } %>
|
35
|
+
# <% component.button(scheme: :outline) { "Outline" } %>
|
36
|
+
# <% end %>
|
37
|
+
#
|
38
|
+
# @param variant [Symbol] DEPRECATED. <%= one_of(Primer::ButtonComponent::SIZE_OPTIONS) %>
|
39
|
+
# @param size [Symbol] <%= one_of(Primer::ButtonComponent::SIZE_OPTIONS) %>
|
40
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
41
|
+
def initialize(variant: nil, size: Primer::ButtonComponent::DEFAULT_SIZE, **system_arguments)
|
42
|
+
@size = variant || size
|
43
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
44
|
+
@system_arguments[:tag] = :div
|
45
|
+
|
46
|
+
@system_arguments[:classes] = class_names(
|
47
|
+
"BtnGroup",
|
48
|
+
system_arguments[:classes]
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
def render?
|
53
|
+
buttons.any?
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
# `Box` is a basic wrapper component for most layout related needs.
|
5
|
+
class Box < Primer::Component
|
6
|
+
status :stable
|
7
|
+
|
8
|
+
# @example Default
|
9
|
+
# <%= render(Primer::Box.new) { "Your content here" } %>
|
10
|
+
#
|
11
|
+
# @example Color and padding
|
12
|
+
# <%= render(Primer::Box.new(bg: :subtle, p: 3)) { "Hello world" } %>
|
13
|
+
#
|
14
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
15
|
+
def initialize(**system_arguments)
|
16
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
17
|
+
|
18
|
+
@system_arguments[:tag] = :div
|
19
|
+
end
|
20
|
+
|
21
|
+
def call
|
22
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,25 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Primer
|
4
|
-
|
5
|
-
|
6
|
-
status :stable
|
7
|
-
|
8
|
-
# @example Default
|
9
|
-
# <%= render(Primer::BoxComponent.new) { "Your content here" } %>
|
10
|
-
#
|
11
|
-
# @example Color and padding
|
12
|
-
# <%= render(Primer::BoxComponent.new(bg: :subtle, p: 3)) { "Hello world" } %>
|
13
|
-
#
|
14
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
15
|
-
def initialize(**system_arguments)
|
16
|
-
@system_arguments = deny_tag_argument(**system_arguments)
|
17
|
-
|
18
|
-
@system_arguments[:tag] = :div
|
19
|
-
end
|
20
|
-
|
21
|
-
def call
|
22
|
-
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
23
|
-
end
|
4
|
+
class BoxComponent < Primer::Box
|
5
|
+
status :deprecated
|
24
6
|
end
|
25
7
|
end
|
@@ -1,55 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Primer
|
4
|
-
|
5
|
-
|
6
|
-
status :beta
|
7
|
-
|
8
|
-
# Required list of buttons to be rendered.
|
9
|
-
#
|
10
|
-
# @param kwargs [Hash] The same arguments as <%= link_to_component(Primer::ButtonComponent) %> except for `size` and `group_item`.
|
11
|
-
renders_many :buttons, lambda { |**kwargs|
|
12
|
-
kwargs[:group_item] = true
|
13
|
-
kwargs[:size] = @size
|
14
|
-
|
15
|
-
Primer::ButtonComponent.new(**kwargs)
|
16
|
-
}
|
17
|
-
|
18
|
-
# @example Default
|
19
|
-
#
|
20
|
-
# <%= render(Primer::ButtonGroup.new) do |component| %>
|
21
|
-
# <% component.button { "Default" } %>
|
22
|
-
# <% component.button(scheme: :primary) { "Primary" } %>
|
23
|
-
# <% component.button(scheme: :danger) { "Danger" } %>
|
24
|
-
# <% component.button(scheme: :outline) { "Outline" } %>
|
25
|
-
# <% component.button(classes: "custom-class") { "Custom class" } %>
|
26
|
-
# <% end %>
|
27
|
-
#
|
28
|
-
# @example Sizes
|
29
|
-
#
|
30
|
-
# <%= render(Primer::ButtonGroup.new(size: :small)) do |component| %>
|
31
|
-
# <% component.button { "Default" } %>
|
32
|
-
# <% component.button(scheme: :primary) { "Primary" } %>
|
33
|
-
# <% component.button(scheme: :danger) { "Danger" } %>
|
34
|
-
# <% component.button(scheme: :outline) { "Outline" } %>
|
35
|
-
# <% end %>
|
36
|
-
#
|
37
|
-
# @param variant [Symbol] DEPRECATED. <%= one_of(Primer::ButtonComponent::SIZE_OPTIONS) %>
|
38
|
-
# @param size [Symbol] <%= one_of(Primer::ButtonComponent::SIZE_OPTIONS) %>
|
39
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
40
|
-
def initialize(variant: nil, size: Primer::ButtonComponent::DEFAULT_SIZE, **system_arguments)
|
41
|
-
@size = variant || size
|
42
|
-
@system_arguments = deny_tag_argument(**system_arguments)
|
43
|
-
@system_arguments[:tag] = :div
|
44
|
-
|
45
|
-
@system_arguments[:classes] = class_names(
|
46
|
-
"BtnGroup",
|
47
|
-
system_arguments[:classes]
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
def render?
|
52
|
-
buttons.any?
|
53
|
-
end
|
4
|
+
class ButtonGroup < Primer::Beta::ButtonGroup
|
5
|
+
status :deprecated
|
54
6
|
end
|
55
7
|
end
|
@@ -7,7 +7,7 @@ module Primer
|
|
7
7
|
# Boxes](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox).
|
8
8
|
#
|
9
9
|
# @deprecated
|
10
|
-
# Use <%= link_to_component(Primer::
|
10
|
+
# Use <%= link_to_component(Primer::Box) %> instead.
|
11
11
|
#
|
12
12
|
# **Before**:
|
13
13
|
#
|
@@ -22,11 +22,11 @@ module Primer
|
|
22
22
|
# **After**:
|
23
23
|
#
|
24
24
|
# ```erb
|
25
|
-
# <%%= render Primer::
|
26
|
-
# <%%= render Primer::
|
27
|
-
# <%%= render Primer::
|
28
|
-
# <%%= render Primer::
|
29
|
-
# <%%= render Primer::
|
25
|
+
# <%%= render Primer::Box.new(display: :flex, justify_content: :center) %>
|
26
|
+
# <%%= render Primer::Box.new(display: :inline_flex) %>
|
27
|
+
# <%%= render Primer::Box.new(display: :flex, flex_wrap: :wrap) %>
|
28
|
+
# <%%= render Primer::Box.new(display: :flex, align_items: :start) %>
|
29
|
+
# <%%= render Primer::Box.new(display: :flex, direction: :column) %>
|
30
30
|
# ```
|
31
31
|
class FlexComponent < Primer::Component
|
32
32
|
status :deprecated
|
@@ -62,30 +62,30 @@ module Primer
|
|
62
62
|
|
63
63
|
# @example Default
|
64
64
|
# <%= render(Primer::FlexComponent.new(bg: :subtle)) do %>
|
65
|
-
# <%= render(Primer::
|
66
|
-
# <%= render(Primer::
|
67
|
-
# <%= render(Primer::
|
65
|
+
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 1" } %>
|
66
|
+
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 2" } %>
|
67
|
+
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 3" } %>
|
68
68
|
# <% end %>
|
69
69
|
#
|
70
70
|
# @example Justify center
|
71
71
|
# <%= render(Primer::FlexComponent.new(justify_content: :center, bg: :subtle)) do %>
|
72
|
-
# <%= render(Primer::
|
73
|
-
# <%= render(Primer::
|
74
|
-
# <%= render(Primer::
|
72
|
+
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 1" } %>
|
73
|
+
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 2" } %>
|
74
|
+
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 3" } %>
|
75
75
|
# <% end %>
|
76
76
|
#
|
77
77
|
# @example Align end
|
78
78
|
# <%= render(Primer::FlexComponent.new(align_items: :end, bg: :subtle)) do %>
|
79
|
-
# <%= render(Primer::
|
80
|
-
# <%= render(Primer::
|
81
|
-
# <%= render(Primer::
|
79
|
+
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 1" } %>
|
80
|
+
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 2" } %>
|
81
|
+
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 3" } %>
|
82
82
|
# <% end %>
|
83
83
|
#
|
84
84
|
# @example Direction column
|
85
85
|
# <%= render(Primer::FlexComponent.new(direction: :column, bg: :subtle)) do %>
|
86
|
-
# <%= render(Primer::
|
87
|
-
# <%= render(Primer::
|
88
|
-
# <%= render(Primer::
|
86
|
+
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 1" } %>
|
87
|
+
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 2" } %>
|
88
|
+
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 3" } %>
|
89
89
|
# <% end %>
|
90
90
|
#
|
91
91
|
# @param justify_content [Symbol] Use this param to distribute space between and around flex items along the main axis of the container. <%= one_of(Primer::FlexComponent::JUSTIFY_CONTENT_OPTIONS) %>
|
@@ -102,7 +102,7 @@ module Primer
|
|
102
102
|
direction: nil,
|
103
103
|
**system_arguments
|
104
104
|
)
|
105
|
-
deprecated_component_warning(new_class: Primer::
|
105
|
+
deprecated_component_warning(new_class: Primer::Box, version: "0.0.40")
|
106
106
|
|
107
107
|
@align_items = fetch_or_fallback(ALIGN_ITEMS_OPTIONS, align_items, ALIGN_ITEMS_DEFAULT)
|
108
108
|
@justify_content = fetch_or_fallback(JUSTIFY_CONTENT_OPTIONS, justify_content, JUSTIFY_CONTENT_DEFAULT)
|
@@ -122,7 +122,7 @@ module Primer
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def call
|
125
|
-
render(Primer::
|
125
|
+
render(Primer::Box.new(**@system_arguments)) { content }
|
126
126
|
end
|
127
127
|
|
128
128
|
private
|
@@ -5,7 +5,7 @@ module Primer
|
|
5
5
|
# dimensions to fill available space.
|
6
6
|
#
|
7
7
|
# @deprecated
|
8
|
-
# Use <%= link_to_component(Primer::
|
8
|
+
# Use <%= link_to_component(Primer::Box) %> instead.
|
9
9
|
#
|
10
10
|
# **Before**:
|
11
11
|
#
|
@@ -16,7 +16,7 @@ module Primer
|
|
16
16
|
# **After**:
|
17
17
|
#
|
18
18
|
# ```erb
|
19
|
-
# <%%= render Primer::
|
19
|
+
# <%%= render Primer::Box.new(flex: :auto) %>
|
20
20
|
# ```
|
21
21
|
class FlexItemComponent < Primer::Component
|
22
22
|
status :deprecated
|
@@ -38,7 +38,7 @@ module Primer
|
|
38
38
|
# @param flex_auto [Boolean] Fills available space and auto-sizes based on the content. Defaults to <%= Primer::FlexItemComponent::FLEX_AUTO_DEFAULT %>
|
39
39
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
40
40
|
def initialize(flex_auto: FLEX_AUTO_DEFAULT, **system_arguments)
|
41
|
-
deprecated_component_warning(new_class: Primer::
|
41
|
+
deprecated_component_warning(new_class: Primer::Box, version: "0.0.40")
|
42
42
|
|
43
43
|
@system_arguments = system_arguments
|
44
44
|
@system_arguments[:classes] =
|
@@ -49,7 +49,7 @@ module Primer
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def call
|
52
|
-
render(Primer::
|
52
|
+
render(Primer::Box.new(**@system_arguments)) { content }
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -32,11 +32,18 @@ module Primer
|
|
32
32
|
DEPRECATED_SCHEME_OPTIONS = [:info, :warning, :orange, :purple].freeze
|
33
33
|
SCHEME_OPTIONS = (SCHEME_MAPPINGS.keys - DEPRECATED_SCHEME_OPTIONS).freeze
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
DEFAULT_SIZE = :medium
|
36
|
+
SIZE_MAPPINGS = {
|
37
|
+
DEFAULT_SIZE => nil,
|
38
|
+
:large => "Label--large"
|
38
39
|
}.freeze
|
39
|
-
|
40
|
+
SIZE_OPTIONS = SIZE_MAPPINGS.keys
|
41
|
+
|
42
|
+
DEFAULT_VARIANT = :none
|
43
|
+
VARIANT_OPTIONS = [DEFAULT_VARIANT].freeze
|
44
|
+
DEPRECATED_VARIANT_OPTIONS = [:large, :inline].freeze
|
45
|
+
|
46
|
+
INLINE_CLASS = "Label--inline"
|
40
47
|
|
41
48
|
# @example Schemes
|
42
49
|
# <%= render(Primer::LabelComponent.new) { "Default" } %>
|
@@ -50,22 +57,36 @@ module Primer
|
|
50
57
|
# <%= render(Primer::LabelComponent.new(scheme: :done)) { "Done" } %>
|
51
58
|
# <%= render(Primer::LabelComponent.new(scheme: :sponsors)) { "Sponsors" } %>
|
52
59
|
#
|
53
|
-
# @example
|
60
|
+
# @example Sizes
|
61
|
+
# <%= render(Primer::LabelComponent.new) { "Medium" } %>
|
62
|
+
# <%= render(Primer::LabelComponent.new(size: :large)) { "Large" } %>
|
63
|
+
#
|
64
|
+
# @example Inline
|
54
65
|
# <%= render(Primer::LabelComponent.new) { "Default" } %>
|
55
|
-
# <%= render(Primer::LabelComponent.new(
|
66
|
+
# <%= render(Primer::LabelComponent.new(inline: true)) { "Inline" } %>
|
56
67
|
#
|
57
68
|
# @param tag [Symbol] <%= one_of(Primer::LabelComponent::TAG_OPTIONS) %>
|
58
69
|
# @param scheme [Symbol] <%= one_of(Primer::LabelComponent::SCHEME_MAPPINGS.keys) %>
|
59
|
-
# @param
|
70
|
+
# @param size [Symbol] <%= one_of(Primer::LabelComponent::SIZE_OPTIONS) %>
|
71
|
+
# @param inline [Boolean] Whether or not to render this label inline.
|
72
|
+
# @param variant [Symbol] <%= one_of(Primer::LabelComponent::VARIANT_OPTIONS + Primer::LabelComponent::DEPRECATED_VARIANT_OPTIONS) %>
|
60
73
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
61
|
-
|
74
|
+
|
75
|
+
def initialize(tag: DEFAULT_TAG, scheme: DEFAULT_SCHEME, size: DEFAULT_SIZE, inline: false, variant: DEFAULT_VARIANT, **system_arguments)
|
62
76
|
@system_arguments = system_arguments
|
77
|
+
|
78
|
+
@variant = fetch_or_fallback(VARIANT_OPTIONS, variant, nil, deprecated_values: DEPRECATED_VARIANT_OPTIONS)
|
79
|
+
@scheme = fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME, deprecated_values: DEPRECATED_SCHEME_OPTIONS)
|
80
|
+
@size = fetch_or_fallback(SIZE_OPTIONS, size) || @variant == :large ? :large : nil || DEFAULT_SIZE
|
81
|
+
@inline = inline || @variant == :inline
|
82
|
+
|
63
83
|
@system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG)
|
64
84
|
@system_arguments[:classes] = class_names(
|
65
85
|
"Label",
|
66
86
|
system_arguments[:classes],
|
67
|
-
SCHEME_MAPPINGS[
|
68
|
-
|
87
|
+
SCHEME_MAPPINGS[@scheme],
|
88
|
+
SIZE_MAPPINGS[@size],
|
89
|
+
@inline ? INLINE_CLASS : nil
|
69
90
|
)
|
70
91
|
end
|
71
92
|
|
@@ -13,9 +13,9 @@ module ERBLint
|
|
13
13
|
symbolize: true
|
14
14
|
).freeze
|
15
15
|
|
16
|
-
|
16
|
+
SIZE_MAPPINGS = Primer::ViewComponents::Constants.get(
|
17
17
|
component: "Primer::LabelComponent",
|
18
|
-
constant: "
|
18
|
+
constant: "SIZE_MAPPINGS",
|
19
19
|
symbolize: true
|
20
20
|
).freeze
|
21
21
|
|
@@ -24,6 +24,11 @@ module ERBLint
|
|
24
24
|
constant: "DEFAULT_TAG"
|
25
25
|
).freeze
|
26
26
|
|
27
|
+
INLINE_CLASS = Primer::ViewComponents::Constants.get(
|
28
|
+
component: "Primer::LabelComponent",
|
29
|
+
constant: "INLINE_CLASS"
|
30
|
+
).freeze
|
31
|
+
|
27
32
|
ATTRIBUTES = %w[title].freeze
|
28
33
|
|
29
34
|
def attribute_to_args(attribute)
|
@@ -36,8 +41,10 @@ module ERBLint
|
|
36
41
|
|
37
42
|
if SCHEME_MAPPINGS[class_name] && acc[:scheme].nil?
|
38
43
|
acc[:scheme] = SCHEME_MAPPINGS[class_name]
|
39
|
-
elsif
|
40
|
-
acc[:
|
44
|
+
elsif SIZE_MAPPINGS[class_name] && acc[:size].nil?
|
45
|
+
acc[:size] = SIZE_MAPPINGS[class_name]
|
46
|
+
elsif class_name == INLINE_CLASS && acc[:inline].nil?
|
47
|
+
acc[:inline] = true
|
41
48
|
else
|
42
49
|
acc[:classes] << class_name
|
43
50
|
end
|
@@ -7,10 +7,12 @@ module ERBLint
|
|
7
7
|
module DeprecatedComponentsHelpers
|
8
8
|
# If there is no alternative to suggest, set the value to nil
|
9
9
|
COMPONENT_TO_USE_INSTEAD = {
|
10
|
+
"Primer::ButtonGroup" => "Primer::Beta::ButtonGroup",
|
10
11
|
"Primer::Alpha::AutoComplete::Item" => "Primer::Beta::AutoComplete::Item",
|
11
12
|
"Primer::Alpha::AutoComplete" => "Primer::Beta::AutoComplete",
|
12
13
|
"Primer::BlankslateComponent" => "Primer::Beta::Blankslate",
|
13
14
|
"Primer::BorderBoxComponent" => "Primer::Beta::BorderBox",
|
15
|
+
"Primer::BoxComponent" => "Primer::Box",
|
14
16
|
"Primer::DropdownMenuComponent" => nil,
|
15
17
|
"Primer::Tooltip" => "Primer::Alpha::Tooltip",
|
16
18
|
"Primer::FlexComponent" => nil,
|
@@ -15,6 +15,8 @@ module RuboCop
|
|
15
15
|
# Primer::Beta::ComponentName.new()
|
16
16
|
class ComponentNameMigration < BaseCop
|
17
17
|
DEPRECATIONS = {
|
18
|
+
"Primer::BoxComponent" => "Primer::Box",
|
19
|
+
"Primer::ButtonGroup" => "Primer::Beta::ButtonGroup",
|
18
20
|
"Primer::BlankslateComponent" => "Primer::Beta::Blankslate",
|
19
21
|
"Primer::BorderBoxComponent" => "Primer::Beta::BorderBox",
|
20
22
|
"Primer::BaseButton" => "Primer::Beta::BaseButton",
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rubocop"
|
4
|
+
|
5
|
+
# :nocov:
|
6
|
+
module RuboCop
|
7
|
+
module Cop
|
8
|
+
module Primer
|
9
|
+
# This cop ensures that `LabelComponent`s don't use the old `variant` argument.
|
10
|
+
#
|
11
|
+
# bad
|
12
|
+
# Primer::LabelComponent.new(variant: :large)
|
13
|
+
#
|
14
|
+
# good
|
15
|
+
# Primer::LabelComponent.new(size: :large)
|
16
|
+
#
|
17
|
+
# bad
|
18
|
+
# Primer::LabelComponent.new(variant: :inline)
|
19
|
+
#
|
20
|
+
# good
|
21
|
+
# Primer::LabelComponent.new(inline: true)
|
22
|
+
class DeprecatedLabelVariants < BaseCop
|
23
|
+
def on_send(node)
|
24
|
+
return unless label_node?(node)
|
25
|
+
return unless node.arguments?
|
26
|
+
|
27
|
+
# we are looking for hash arguments and they are always last
|
28
|
+
kwargs = node.arguments.last
|
29
|
+
|
30
|
+
return unless kwargs.type == :hash
|
31
|
+
|
32
|
+
kwargs.pairs.each do |pair|
|
33
|
+
# skip if we're not dealing with a symbol or string
|
34
|
+
next if pair.key.type != :sym
|
35
|
+
next unless pair.value.type == :sym || pair.value.type == :str
|
36
|
+
next if pair.key.value != :variant
|
37
|
+
|
38
|
+
case pair.value.value
|
39
|
+
when :large, "large"
|
40
|
+
add_offense(pair, message: "Avoid using `variant: :large` with `LabelComponent`. Use `size: :large` instead.")
|
41
|
+
when :inline, "inline"
|
42
|
+
add_offense(pair, message: "Avoid using `variant: :inline` with `LabelComponent`. Use `inline: true` instead.")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def autocorrect(node)
|
48
|
+
lambda do |corrector|
|
49
|
+
replacement =
|
50
|
+
case node.value.value
|
51
|
+
when :large, "large"
|
52
|
+
"size: :large"
|
53
|
+
when :inline, "inline"
|
54
|
+
"inline: true"
|
55
|
+
end
|
56
|
+
|
57
|
+
corrector.replace(node, replacement)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def label_node?(node)
|
64
|
+
return if node.nil?
|
65
|
+
|
66
|
+
node.method_name == :new && !node.receiver.nil? && node.receiver.const_name == "Primer::LabelComponent"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/tasks/docs.rake
CHANGED
@@ -44,10 +44,10 @@ namespace :docs do
|
|
44
44
|
Primer::Beta::Blankslate,
|
45
45
|
Primer::Beta::BorderBox,
|
46
46
|
Primer::Beta::BorderBox::Header,
|
47
|
-
Primer::
|
47
|
+
Primer::Box,
|
48
48
|
Primer::Beta::Breadcrumbs,
|
49
49
|
Primer::ButtonComponent,
|
50
|
-
Primer::ButtonGroup,
|
50
|
+
Primer::Beta::ButtonGroup,
|
51
51
|
Primer::Alpha::ButtonMarketing,
|
52
52
|
Primer::ClipboardCopy,
|
53
53
|
Primer::CloseButton,
|
data/lib/yard/docs_helper.rb
CHANGED
@@ -28,7 +28,7 @@ module YARD
|
|
28
28
|
prefix = "One of"
|
29
29
|
prefix = prefix.downcase if lower
|
30
30
|
|
31
|
-
"#{prefix} #{values.to_sentence(last_word_connector: ', or ')}."
|
31
|
+
"#{prefix} #{values.to_sentence(two_words_connector: ' or ', last_word_connector: ', or ')}."
|
32
32
|
end
|
33
33
|
|
34
34
|
def link_to_accessibility
|
data/static/arguments.yml
CHANGED
@@ -9,15 +9,15 @@
|
|
9
9
|
- name: variant
|
10
10
|
type: Symbol
|
11
11
|
default: "`:default`"
|
12
|
-
description: One of `:default`
|
12
|
+
description: One of `:default` or `:large`.
|
13
13
|
- name: tag
|
14
14
|
type: Symbol
|
15
15
|
default: "`:button`"
|
16
|
-
description: One of `:a`
|
16
|
+
description: One of `:a` or `:button`.
|
17
17
|
- name: type
|
18
18
|
type: Symbol
|
19
19
|
default: "`:button`"
|
20
|
-
description: One of `:button`
|
20
|
+
description: One of `:button` or `:submit`.
|
21
21
|
- name: system_arguments
|
22
22
|
type: Hash
|
23
23
|
default: N/A
|
@@ -34,7 +34,7 @@
|
|
34
34
|
type: Symbol
|
35
35
|
default: "`:sidebar`"
|
36
36
|
description: Which element to render first in the HTML. This will change the keyboard
|
37
|
-
navigation order. One of `:main`
|
37
|
+
navigation order. One of `:main` or `:sidebar`.
|
38
38
|
- name: gutter
|
39
39
|
type: Symbol
|
40
40
|
default: "`:default`"
|
@@ -50,7 +50,7 @@
|
|
50
50
|
- name: tag
|
51
51
|
type: Symbol
|
52
52
|
default: "`:nav`"
|
53
|
-
description: One of `:div`
|
53
|
+
description: One of `:div` or `:nav`.
|
54
54
|
- name: label
|
55
55
|
type: String
|
56
56
|
default: N/A
|
@@ -75,7 +75,7 @@
|
|
75
75
|
- name: align
|
76
76
|
type: Symbol
|
77
77
|
default: N/A
|
78
|
-
description: One of `:left`
|
78
|
+
description: One of `:left` or `:right`. - Defaults to left
|
79
79
|
- name: body_arguments
|
80
80
|
type: Hash
|
81
81
|
default: "`{}`"
|
@@ -192,7 +192,7 @@
|
|
192
192
|
- name: type
|
193
193
|
type: Symbol
|
194
194
|
default: N/A
|
195
|
-
description: One of `:description`
|
195
|
+
description: One of `:description` or `:label`.
|
196
196
|
- name: direction
|
197
197
|
type: Symbol
|
198
198
|
default: "`:s`"
|
@@ -212,7 +212,7 @@
|
|
212
212
|
- name: tag
|
213
213
|
type: Symbol
|
214
214
|
default: "`:nav`"
|
215
|
-
description: One of `:div`
|
215
|
+
description: One of `:div` or `:nav`.
|
216
216
|
- name: label
|
217
217
|
type: String
|
218
218
|
default: N/A
|
@@ -221,7 +221,7 @@
|
|
221
221
|
- name: align
|
222
222
|
type: Symbol
|
223
223
|
default: "`:left`"
|
224
|
-
description: One of `:left`
|
224
|
+
description: One of `:left` or `:right`. - Defaults to left
|
225
225
|
- name: body_arguments
|
226
226
|
type: Hash
|
227
227
|
default: "`{}`"
|
@@ -241,7 +241,7 @@
|
|
241
241
|
- name: align
|
242
242
|
type: Symbol
|
243
243
|
default: "`:left`"
|
244
|
-
description: One of `:left`
|
244
|
+
description: One of `:left` or `:right`. - Defaults to left
|
245
245
|
- name: body_arguments
|
246
246
|
type: Hash
|
247
247
|
default: "`{}`"
|
@@ -364,7 +364,7 @@
|
|
364
364
|
- name: shape
|
365
365
|
type: Symbol
|
366
366
|
default: "`:circle`"
|
367
|
-
description: Shape of the avatar. One of `:circle`
|
367
|
+
description: Shape of the avatar. One of `:circle` or `:square`.
|
368
368
|
- name: href
|
369
369
|
type: String
|
370
370
|
default: "`nil`"
|
@@ -380,11 +380,11 @@
|
|
380
380
|
- name: tag
|
381
381
|
type: Symbol
|
382
382
|
default: "`:div`"
|
383
|
-
description: One of `:div`
|
383
|
+
description: One of `:div` or `:span`.
|
384
384
|
- name: align
|
385
385
|
type: Symbol
|
386
386
|
default: "`:left`"
|
387
|
-
description: One of `:left`
|
387
|
+
description: One of `:left` or `:right`.
|
388
388
|
- name: tooltipped
|
389
389
|
type: Boolean
|
390
390
|
default: "`false`"
|
@@ -394,7 +394,7 @@
|
|
394
394
|
default: "`{}`"
|
395
395
|
description: Parameters to add to the Body. If `tooltipped` is set, has the same
|
396
396
|
arguments as [Tooltip](/components/tooltip). The default tag is `:div` but can
|
397
|
-
be changed using `tag:` to one of `:div`
|
397
|
+
be changed using `tag:` to one of `:div` or `:span`.
|
398
398
|
- name: system_arguments
|
399
399
|
type: Hash
|
400
400
|
default: N/A
|
@@ -462,6 +462,21 @@
|
|
462
462
|
type: Hash
|
463
463
|
default: N/A
|
464
464
|
description: "[System arguments](/system-arguments)"
|
465
|
+
- component: ButtonGroup
|
466
|
+
source: https://github.com/primer/view_components/tree/main/app/components/primer/beta/button_group.rb
|
467
|
+
parameters:
|
468
|
+
- name: variant
|
469
|
+
type: Symbol
|
470
|
+
default: "`nil`"
|
471
|
+
description: DEPRECATED. One of `:medium` or `:small`.
|
472
|
+
- name: size
|
473
|
+
type: Symbol
|
474
|
+
default: "`:medium`"
|
475
|
+
description: One of `:medium` or `:small`.
|
476
|
+
- name: system_arguments
|
477
|
+
type: Hash
|
478
|
+
default: N/A
|
479
|
+
description: "[System arguments](/system-arguments)"
|
465
480
|
- component: Flash
|
466
481
|
source: https://github.com/primer/view_components/tree/main/app/components/primer/beta/flash.rb
|
467
482
|
parameters:
|
@@ -508,7 +523,7 @@
|
|
508
523
|
default: N/A
|
509
524
|
description: "[System arguments](/system-arguments)"
|
510
525
|
- component: Box
|
511
|
-
source: https://github.com/primer/view_components/tree/main/app/components/primer/
|
526
|
+
source: https://github.com/primer/view_components/tree/main/app/components/primer/box.rb
|
512
527
|
parameters:
|
513
528
|
- name: system_arguments
|
514
529
|
type: Hash
|
@@ -525,11 +540,11 @@
|
|
525
540
|
- name: variant
|
526
541
|
type: Symbol
|
527
542
|
default: "`nil`"
|
528
|
-
description: DEPRECATED. One of `:medium`
|
543
|
+
description: DEPRECATED. One of `:medium` or `:small`.
|
529
544
|
- name: size
|
530
545
|
type: Symbol
|
531
546
|
default: "`:medium`"
|
532
|
-
description: One of `:medium`
|
547
|
+
description: One of `:medium` or `:small`.
|
533
548
|
- name: tag
|
534
549
|
type: Symbol
|
535
550
|
default: "`:button`"
|
@@ -554,21 +569,6 @@
|
|
554
569
|
type: Hash
|
555
570
|
default: N/A
|
556
571
|
description: "[System arguments](/system-arguments)"
|
557
|
-
- component: ButtonGroup
|
558
|
-
source: https://github.com/primer/view_components/tree/main/app/components/primer/button_group.rb
|
559
|
-
parameters:
|
560
|
-
- name: variant
|
561
|
-
type: Symbol
|
562
|
-
default: "`nil`"
|
563
|
-
description: DEPRECATED. One of `:medium` and `:small`.
|
564
|
-
- name: size
|
565
|
-
type: Symbol
|
566
|
-
default: "`:medium`"
|
567
|
-
description: One of `:medium` and `:small`.
|
568
|
-
- name: system_arguments
|
569
|
-
type: Hash
|
570
|
-
default: N/A
|
571
|
-
description: "[System arguments](/system-arguments)"
|
572
572
|
- component: ClipboardCopy
|
573
573
|
source: https://github.com/primer/view_components/tree/main/app/components/primer/clipboard_copy.rb
|
574
574
|
parameters:
|
@@ -594,7 +594,7 @@
|
|
594
594
|
- name: type
|
595
595
|
type: Symbol
|
596
596
|
default: "`:button`"
|
597
|
-
description: One of `:button`
|
597
|
+
description: One of `:button` or `:submit`.
|
598
598
|
- name: system_arguments
|
599
599
|
type: Hash
|
600
600
|
default: N/A
|
@@ -770,7 +770,7 @@
|
|
770
770
|
- name: scheme
|
771
771
|
type: Symbol
|
772
772
|
default: "`:default`"
|
773
|
-
description: One of `:danger`
|
773
|
+
description: One of `:danger` or `:default`.
|
774
774
|
- name: icon
|
775
775
|
type: String
|
776
776
|
default: N/A
|
@@ -854,10 +854,18 @@
|
|
854
854
|
description: One of `:accent`, `:attention`, `:danger`, `:default`, `:done`, `:info`,
|
855
855
|
`:orange`, `:primary`, `:purple`, `:secondary`, `:severe`, `:sponsors`, `:success`,
|
856
856
|
or `:warning`.
|
857
|
+
- name: size
|
858
|
+
type: Symbol
|
859
|
+
default: "`:medium`"
|
860
|
+
description: One of `:large` or `:medium`.
|
861
|
+
- name: inline
|
862
|
+
type: Boolean
|
863
|
+
default: "`false`"
|
864
|
+
description: Whether or not to render this label inline.
|
857
865
|
- name: variant
|
858
866
|
type: Symbol
|
859
|
-
default: "`
|
860
|
-
description: One of
|
867
|
+
default: "`:none`"
|
868
|
+
description: One of `:inline`, `:large`, or `:none`.
|
861
869
|
- name: system_arguments
|
862
870
|
type: Hash
|
863
871
|
default: N/A
|
@@ -872,7 +880,7 @@
|
|
872
880
|
- name: side
|
873
881
|
type: Symbol
|
874
882
|
default: "`:right`"
|
875
|
-
description: Which side to display the sidebar on. One of `:left`
|
883
|
+
description: Which side to display the sidebar on. One of `:left` or `:right`.
|
876
884
|
- name: sidebar_col
|
877
885
|
type: Integer
|
878
886
|
default: "`3`"
|
@@ -887,7 +895,7 @@
|
|
887
895
|
- name: tag
|
888
896
|
type: String
|
889
897
|
default: "`:a`"
|
890
|
-
description: One of `:a`
|
898
|
+
description: One of `:a` or `:span`.
|
891
899
|
- name: href
|
892
900
|
type: String
|
893
901
|
default: "`nil`"
|
@@ -924,35 +932,35 @@
|
|
924
932
|
- name: weekday
|
925
933
|
type: Symbol
|
926
934
|
default: "`:short`"
|
927
|
-
description: One of `:long`
|
935
|
+
description: One of `:long` or `:short`.
|
928
936
|
- name: year
|
929
937
|
type: Symbol
|
930
938
|
default: "`:numeric`"
|
931
|
-
description: One of `:2-digit`
|
939
|
+
description: One of `:2-digit` or `:numeric`.
|
932
940
|
- name: month
|
933
941
|
type: Symbol
|
934
942
|
default: "`:short`"
|
935
|
-
description: One of `:long`
|
943
|
+
description: One of `:long` or `:short`.
|
936
944
|
- name: day
|
937
945
|
type: Symbol
|
938
946
|
default: "`:numeric`"
|
939
|
-
description: One of `:2-digit`
|
947
|
+
description: One of `:2-digit` or `:numeric`.
|
940
948
|
- name: hour
|
941
949
|
type: Symbol
|
942
950
|
default: "`:numeric`"
|
943
|
-
description: One of `:2-digit`
|
951
|
+
description: One of `:2-digit` or `:numeric`.
|
944
952
|
- name: minute
|
945
953
|
type: Symbol
|
946
954
|
default: "`:numeric`"
|
947
|
-
description: One of `:2-digit`
|
955
|
+
description: One of `:2-digit` or `:numeric`.
|
948
956
|
- name: second
|
949
957
|
type: Symbol
|
950
958
|
default: "`:numeric`"
|
951
|
-
description: One of `:2-digit`
|
959
|
+
description: One of `:2-digit` or `:numeric`.
|
952
960
|
- name: time_zone_name
|
953
961
|
type: Symbol
|
954
962
|
default: "`:short`"
|
955
|
-
description: One of `:long`
|
963
|
+
description: One of `:long` or `:short`.
|
956
964
|
- name: system_arguments
|
957
965
|
type: Hash
|
958
966
|
default: N/A
|
@@ -1087,11 +1095,11 @@
|
|
1087
1095
|
- name: tag
|
1088
1096
|
type: Symbol
|
1089
1097
|
default: "`:span`"
|
1090
|
-
description: HTML tag for element. One of `:div`
|
1098
|
+
description: HTML tag for element. One of `:div` or `:span`.
|
1091
1099
|
- name: size
|
1092
1100
|
type: Symbol
|
1093
1101
|
default: "`:default`"
|
1094
|
-
description: One of `:default`
|
1102
|
+
description: One of `:default` or `:small`.
|
1095
1103
|
- name: system_arguments
|
1096
1104
|
type: Hash
|
1097
1105
|
default: N/A
|
data/static/audited_at.json
CHANGED
@@ -22,12 +22,14 @@
|
|
22
22
|
"Primer::Beta::BorderBox::Header": "",
|
23
23
|
"Primer::Beta::Breadcrumbs": "",
|
24
24
|
"Primer::Beta::Breadcrumbs::Item": "",
|
25
|
+
"Primer::Beta::ButtonGroup": "",
|
25
26
|
"Primer::Beta::Flash": "",
|
26
27
|
"Primer::Beta::Text": "",
|
27
28
|
"Primer::Beta::Truncate": "",
|
28
29
|
"Primer::Beta::Truncate::TruncateText": "",
|
29
30
|
"Primer::BlankslateComponent": "",
|
30
31
|
"Primer::BorderBoxComponent": "",
|
32
|
+
"Primer::Box": "",
|
31
33
|
"Primer::BoxComponent": "",
|
32
34
|
"Primer::ButtonComponent": "",
|
33
35
|
"Primer::ButtonGroup": "",
|
data/static/classes.yml
CHANGED
@@ -43,6 +43,7 @@
|
|
43
43
|
- ".Label--attention"
|
44
44
|
- ".Label--danger"
|
45
45
|
- ".Label--done"
|
46
|
+
- ".Label--inline"
|
46
47
|
- ".Label--large"
|
47
48
|
- ".Label--primary"
|
48
49
|
- ".Label--secondary"
|
@@ -211,6 +212,7 @@
|
|
211
212
|
- ".p-3"
|
212
213
|
- ".p-4"
|
213
214
|
- ".p-5"
|
215
|
+
- ".position-absolute"
|
214
216
|
- ".position-relative"
|
215
217
|
- ".pr-2"
|
216
218
|
- ".pt-5"
|
data/static/constants.json
CHANGED
@@ -298,6 +298,8 @@
|
|
298
298
|
},
|
299
299
|
"Primer::Beta::Breadcrumbs::Item": {
|
300
300
|
},
|
301
|
+
"Primer::Beta::ButtonGroup": {
|
302
|
+
},
|
301
303
|
"Primer::Beta::Flash": {
|
302
304
|
"DEFAULT_SCHEME": "default",
|
303
305
|
"SCHEME_MAPPINGS": {
|
@@ -319,6 +321,8 @@
|
|
319
321
|
},
|
320
322
|
"Primer::BorderBoxComponent": {
|
321
323
|
},
|
324
|
+
"Primer::Box": {
|
325
|
+
},
|
322
326
|
"Primer::BoxComponent": {
|
323
327
|
},
|
324
328
|
"Primer::ButtonComponent": {
|
@@ -544,13 +548,20 @@
|
|
544
548
|
},
|
545
549
|
"Primer::LabelComponent": {
|
546
550
|
"DEFAULT_SCHEME": "default",
|
551
|
+
"DEFAULT_SIZE": "medium",
|
547
552
|
"DEFAULT_TAG": "span",
|
553
|
+
"DEFAULT_VARIANT": "none",
|
548
554
|
"DEPRECATED_SCHEME_OPTIONS": [
|
549
555
|
"info",
|
550
556
|
"warning",
|
551
557
|
"orange",
|
552
558
|
"purple"
|
553
559
|
],
|
560
|
+
"DEPRECATED_VARIANT_OPTIONS": [
|
561
|
+
"large",
|
562
|
+
"inline"
|
563
|
+
],
|
564
|
+
"INLINE_CLASS": "Label--inline",
|
554
565
|
"SCHEME_MAPPINGS": {
|
555
566
|
"default": "",
|
556
567
|
"primary": "Label--primary",
|
@@ -579,20 +590,22 @@
|
|
579
590
|
"done",
|
580
591
|
"sponsors"
|
581
592
|
],
|
593
|
+
"SIZE_MAPPINGS": {
|
594
|
+
"medium": null,
|
595
|
+
"large": "Label--large"
|
596
|
+
},
|
597
|
+
"SIZE_OPTIONS": [
|
598
|
+
"medium",
|
599
|
+
"large"
|
600
|
+
],
|
582
601
|
"TAG_OPTIONS": [
|
583
602
|
"span",
|
584
603
|
"summary",
|
585
604
|
"a",
|
586
605
|
"div"
|
587
606
|
],
|
588
|
-
"VARIANT_MAPPINGS": {
|
589
|
-
"large": "Label--large",
|
590
|
-
"inline": "Label--inline"
|
591
|
-
},
|
592
607
|
"VARIANT_OPTIONS": [
|
593
|
-
"
|
594
|
-
"inline",
|
595
|
-
null
|
608
|
+
"none"
|
596
609
|
]
|
597
610
|
},
|
598
611
|
"Primer::LayoutComponent": {
|
data/static/statuses.json
CHANGED
@@ -22,15 +22,17 @@
|
|
22
22
|
"Primer::Beta::BorderBox::Header": "alpha",
|
23
23
|
"Primer::Beta::Breadcrumbs": "beta",
|
24
24
|
"Primer::Beta::Breadcrumbs::Item": "alpha",
|
25
|
+
"Primer::Beta::ButtonGroup": "beta",
|
25
26
|
"Primer::Beta::Flash": "beta",
|
26
27
|
"Primer::Beta::Text": "beta",
|
27
28
|
"Primer::Beta::Truncate": "beta",
|
28
29
|
"Primer::Beta::Truncate::TruncateText": "alpha",
|
29
30
|
"Primer::BlankslateComponent": "deprecated",
|
30
31
|
"Primer::BorderBoxComponent": "deprecated",
|
31
|
-
"Primer::
|
32
|
+
"Primer::Box": "stable",
|
33
|
+
"Primer::BoxComponent": "deprecated",
|
32
34
|
"Primer::ButtonComponent": "beta",
|
33
|
-
"Primer::ButtonGroup": "
|
35
|
+
"Primer::ButtonGroup": "deprecated",
|
34
36
|
"Primer::ClipboardCopy": "beta",
|
35
37
|
"Primer::CloseButton": "beta",
|
36
38
|
"Primer::ConditionalWrapper": "alpha",
|
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.88
|
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-08-
|
11
|
+
date: 2022-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -412,6 +412,8 @@ files:
|
|
412
412
|
- app/components/primer/alpha/button_marketing.rb
|
413
413
|
- app/components/primer/alpha/layout.html.erb
|
414
414
|
- app/components/primer/alpha/layout.rb
|
415
|
+
- app/components/primer/alpha/segmented-control-element.d.ts
|
416
|
+
- app/components/primer/alpha/segmented-control-element.js
|
415
417
|
- app/components/primer/alpha/tab_nav.html.erb
|
416
418
|
- app/components/primer/alpha/tab_nav.rb
|
417
419
|
- app/components/primer/alpha/tab_panels.html.erb
|
@@ -445,6 +447,8 @@ files:
|
|
445
447
|
- app/components/primer/beta/border_box/header.rb
|
446
448
|
- app/components/primer/beta/breadcrumbs.html.erb
|
447
449
|
- app/components/primer/beta/breadcrumbs.rb
|
450
|
+
- app/components/primer/beta/button_group.html.erb
|
451
|
+
- app/components/primer/beta/button_group.rb
|
448
452
|
- app/components/primer/beta/flash.html.erb
|
449
453
|
- app/components/primer/beta/flash.rb
|
450
454
|
- app/components/primer/beta/text.rb
|
@@ -453,10 +457,10 @@ files:
|
|
453
457
|
- app/components/primer/blankslate_component.html.erb
|
454
458
|
- app/components/primer/blankslate_component.rb
|
455
459
|
- app/components/primer/border_box_component.rb
|
460
|
+
- app/components/primer/box.rb
|
456
461
|
- app/components/primer/box_component.rb
|
457
462
|
- app/components/primer/button_component.html.erb
|
458
463
|
- app/components/primer/button_component.rb
|
459
|
-
- app/components/primer/button_group.html.erb
|
460
464
|
- app/components/primer/button_group.rb
|
461
465
|
- app/components/primer/clipboard_copy.html.erb
|
462
466
|
- app/components/primer/clipboard_copy.rb
|
@@ -649,6 +653,7 @@ files:
|
|
649
653
|
- lib/rubocop/cop/primer/deprecated_button_arguments.rb
|
650
654
|
- lib/rubocop/cop/primer/deprecated_components.rb
|
651
655
|
- lib/rubocop/cop/primer/deprecated_label_schemes.rb
|
656
|
+
- lib/rubocop/cop/primer/deprecated_label_variants.rb
|
652
657
|
- lib/rubocop/cop/primer/deprecated_layout_component.rb
|
653
658
|
- lib/rubocop/cop/primer/no_tag_memoize.rb
|
654
659
|
- lib/rubocop/cop/primer/primer_octicon.rb
|