primer_view_components 0.0.109 → 0.0.110
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/assets/styles/primer_view_components.css +1 -1
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/{beta → alpha}/banner.css +0 -0
- data/app/components/primer/alpha/banner.css.json +1 -0
- data/app/components/primer/{beta → alpha}/banner.css.map +1 -1
- data/app/components/primer/{beta → alpha}/banner.html.erb +0 -0
- data/app/components/primer/{beta → alpha}/banner.pcss +1 -0
- data/app/components/primer/{beta → alpha}/banner.rb +12 -12
- data/app/components/primer/alpha/segmented_control.css.map +1 -1
- data/app/components/primer/alpha/segmented_control.pcss +1 -0
- data/app/components/primer/alpha/toggle_switch.css +1 -0
- data/app/components/primer/alpha/toggle_switch.css.json +1 -0
- data/app/components/primer/alpha/toggle_switch.css.map +1 -0
- data/app/components/primer/alpha/toggle_switch.pcss +244 -0
- data/app/components/primer/{beta → alpha}/x_banner.d.ts +0 -0
- data/app/components/primer/{beta → alpha}/x_banner.js +0 -0
- data/app/components/primer/{beta → alpha}/x_banner.ts +0 -0
- data/app/components/primer/beta/blankslate.css +1 -0
- data/app/components/primer/beta/blankslate.css.json +1 -0
- data/app/components/primer/beta/blankslate.css.map +1 -0
- data/app/components/primer/beta/blankslate.pcss +90 -0
- data/app/components/primer/beta/breadcrumbs.css +1 -0
- data/app/components/primer/beta/breadcrumbs.css.json +1 -0
- data/app/components/primer/beta/breadcrumbs.css.map +1 -0
- data/app/components/primer/beta/breadcrumbs.pcss +30 -0
- data/app/components/primer/beta/button.css.map +1 -1
- data/app/components/primer/beta/button.pcss +0 -4
- data/app/components/primer/beta/counter.css +1 -0
- data/app/components/primer/beta/counter.css.json +1 -0
- data/app/components/primer/beta/counter.css.map +1 -0
- data/app/components/primer/beta/counter.pcss +35 -0
- data/app/components/primer/beta/label.css +1 -0
- data/app/components/primer/beta/label.css.json +1 -0
- data/app/components/primer/beta/label.css.map +1 -0
- data/app/components/primer/beta/label.pcss +103 -0
- data/app/components/primer/beta/progress_bar.css +1 -0
- data/app/components/primer/beta/progress_bar.css.json +1 -0
- data/app/components/primer/beta/progress_bar.css.map +1 -0
- data/app/components/primer/{progress_bar_component.html.erb → beta/progress_bar.html.erb} +0 -0
- data/app/components/primer/beta/progress_bar.pcss +26 -0
- data/app/components/primer/beta/progress_bar.rb +72 -0
- data/app/components/primer/beta/truncate.css +1 -0
- data/app/components/primer/beta/truncate.css.json +1 -0
- data/app/components/primer/beta/truncate.css.map +1 -0
- data/app/components/primer/beta/truncate.pcss +31 -0
- data/app/components/primer/primer.d.ts +1 -1
- data/app/components/primer/primer.js +1 -1
- data/app/components/primer/primer.pcss +12 -2
- data/app/components/primer/primer.ts +1 -1
- data/app/components/primer/progress_bar_component.rb +2 -65
- data/app/components/primer/state_component.css +1 -0
- data/app/components/primer/state_component.css.json +1 -0
- data/app/components/primer/state_component.css.map +1 -0
- data/app/components/primer/state_component.pcss +50 -0
- data/app/components/primer/subhead_component.css +1 -0
- data/app/components/primer/subhead_component.css.json +1 -0
- data/app/components/primer/subhead_component.css.map +1 -0
- data/app/components/primer/subhead_component.pcss +49 -0
- data/app/components/primer/truncate.css +1 -0
- data/app/components/primer/truncate.css.json +1 -0
- data/app/components/primer/truncate.css.map +1 -0
- data/app/components/primer/truncate.pcss +30 -0
- data/lib/primer/deprecations.rb +2 -1
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/tasks/docs.rake +3 -3
- data/lib/tasks/test.rake +8 -0
- data/previews/primer/alpha/banner_preview/with_action_button.html.erb +4 -0
- data/previews/primer/{beta → alpha}/banner_preview/with_action_content.html.erb +1 -1
- data/previews/primer/alpha/banner_preview.rb +97 -0
- data/previews/primer/alpha/segmented_control_preview.rb +106 -20
- data/previews/primer/beta/counter_preview.rb +55 -8
- data/previews/primer/beta/progress_bar_preview.rb +60 -0
- data/static/arguments.json +76 -76
- data/static/audited_at.json +2 -1
- data/static/constants.json +34 -32
- data/static/statuses.json +3 -2
- metadata +57 -16
- data/app/components/primer/beta/banner.css.json +0 -1
- data/previews/primer/beta/banner_preview/with_action_button.html.erb +0 -4
- data/previews/primer/beta/banner_preview.rb +0 -54
- data/previews/primer/progress_bar_component_preview.rb +0 -28
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/* Progress */
|
2
|
+
|
3
|
+
.Progress {
|
4
|
+
display: flex;
|
5
|
+
height: 8px;
|
6
|
+
overflow: hidden;
|
7
|
+
background-color: var(--color-neutral-muted);
|
8
|
+
border-radius: 6px;
|
9
|
+
outline: 1px solid transparent; /* Support Firefox custom colors */
|
10
|
+
}
|
11
|
+
|
12
|
+
.Progress--large {
|
13
|
+
height: 10px;
|
14
|
+
}
|
15
|
+
|
16
|
+
.Progress--small {
|
17
|
+
height: 5px;
|
18
|
+
}
|
19
|
+
|
20
|
+
.Progress-item {
|
21
|
+
outline: 2px solid transparent; /* Support Firefox custom colors */
|
22
|
+
}
|
23
|
+
|
24
|
+
.Progress-item + .Progress-item {
|
25
|
+
margin-left: 2px;
|
26
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Beta
|
5
|
+
# Use `ProgressBar` to visualize task completion.
|
6
|
+
class ProgressBar < Primer::Component
|
7
|
+
status :beta
|
8
|
+
|
9
|
+
# Use the Item slot to add an item to the progress bar
|
10
|
+
#
|
11
|
+
# @param percentage [Integer] The percent complete
|
12
|
+
# @param bg [Symbol] The background color
|
13
|
+
# @param kwargs [Hash] The same arguments as <%= link_to_system_arguments_docs %>.
|
14
|
+
renders_many :items, lambda { |percentage: 0, bg: :success_emphasis, **system_arguments|
|
15
|
+
deny_tag_argument(**system_arguments)
|
16
|
+
system_arguments[:tag] = :span
|
17
|
+
system_arguments[:bg] = bg
|
18
|
+
system_arguments[:style] = join_style_arguments(system_arguments[:style], "width: #{percentage}%;")
|
19
|
+
system_arguments[:classes] = class_names("Progress-item", system_arguments[:classes])
|
20
|
+
|
21
|
+
Primer::BaseComponent.new(**system_arguments)
|
22
|
+
}
|
23
|
+
|
24
|
+
SIZE_DEFAULT = :default
|
25
|
+
|
26
|
+
SIZE_MAPPINGS = {
|
27
|
+
SIZE_DEFAULT => "",
|
28
|
+
:small => "Progress--small",
|
29
|
+
:large => "Progress--large"
|
30
|
+
}.freeze
|
31
|
+
|
32
|
+
SIZE_OPTIONS = SIZE_MAPPINGS.keys
|
33
|
+
# @example Default
|
34
|
+
# <%= render(Primer::Beta::ProgressBar.new) do |component| %>
|
35
|
+
# <% component.item(percentage: 25) %>
|
36
|
+
# <% end %>
|
37
|
+
#
|
38
|
+
# @example Small
|
39
|
+
# <%= render(Primer::Beta::ProgressBar.new(size: :small)) do |component| %>
|
40
|
+
# <% component.item(bg: :accent_emphasis, percentage: 50) %>
|
41
|
+
# <% end %>
|
42
|
+
#
|
43
|
+
# @example Large
|
44
|
+
# <%= render(Primer::Beta::ProgressBar.new(size: :large)) do |component| %>
|
45
|
+
# <% component.item(bg: :danger_emphasis, percentage: 75) %>
|
46
|
+
# <% end %>
|
47
|
+
#
|
48
|
+
# @example Multiple items
|
49
|
+
# <%= render(Primer::Beta::ProgressBar.new) do |component| %>
|
50
|
+
# <% component.item(percentage: 10) %>
|
51
|
+
# <% component.item(bg: :accent_emphasis, percentage: 20) %>
|
52
|
+
# <% component.item(bg: :danger_emphasis, percentage: 30) %>
|
53
|
+
# <% end %>
|
54
|
+
#
|
55
|
+
# @param size [Symbol] <%= one_of(Primer::Beta::ProgressBar::SIZE_OPTIONS) %> Increases height.
|
56
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
57
|
+
def initialize(size: SIZE_DEFAULT, **system_arguments)
|
58
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
59
|
+
@system_arguments[:classes] = class_names(
|
60
|
+
@system_arguments[:classes],
|
61
|
+
"Progress",
|
62
|
+
SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, SIZE_DEFAULT)]
|
63
|
+
)
|
64
|
+
@system_arguments[:tag] = :span
|
65
|
+
end
|
66
|
+
|
67
|
+
def render?
|
68
|
+
items.any?
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
.Truncate{display:inline-flex;max-width:100%;min-width:0}.Truncate>.Truncate-text{max-width:-moz-fit-content;max-width:fit-content;min-width:1ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:is(.Truncate>.Truncate-text)+.Truncate-text{margin-left:var(--primer-control-small-gap,4px)}.Truncate>.Truncate-text.Truncate-text--primary{flex-basis:200%}.Truncate>.Truncate-text.Truncate-text--expandable:active,.Truncate>.Truncate-text.Truncate-text--expandable:focus,.Truncate>.Truncate-text.Truncate-text--expandable:hover{cursor:pointer;flex-shrink:0;max-width:100%!important}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"name":"beta/truncate","selectors":[".Truncate",".Truncate>.Truncate-text",":is(.Truncate>.Truncate-text)+.Truncate-text",".Truncate>.Truncate-text.Truncate-text--primary",".Truncate>.Truncate-text.Truncate-text--expandable:active",".Truncate>.Truncate-text.Truncate-text--expandable:focus",".Truncate>.Truncate-text.Truncate-text--expandable:hover"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["truncate.pcss"],"names":[],"mappings":"AAEA,UACE,mBAAoB,CAEpB,cAAe,CADf,WA0BF,CAvBE,yBAEE,0BAAsB,CAAtB,qBAAsB,CADtB,aAAc,CAEd,eAAgB,CAChB,sBAAuB,CACvB,kBAiBF,CAfE,6CACE,+CACF,CAEA,gDACE,eACF,CAEA,4KAKE,cAAe,CADf,aAAc,CADd,wBAGF","file":"truncate.css","sourcesContent":["/* Truncate */\n\n.Truncate {\n display: inline-flex;\n min-width: 0;\n max-width: 100%;\n\n & > .Truncate-text {\n min-width: 1ch;\n max-width: fit-content;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n & + .Truncate-text {\n margin-left: var(--primer-control-small-gap, 4px);\n }\n\n &.Truncate-text--primary {\n flex-basis: 200%;\n }\n\n &.Truncate-text--expandable:hover,\n &.Truncate-text--expandable:focus,\n &.Truncate-text--expandable:active {\n max-width: 100% !important;\n flex-shrink: 0;\n cursor: pointer;\n }\n }\n}\n"]}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
/* Truncate */
|
2
|
+
|
3
|
+
.Truncate {
|
4
|
+
display: inline-flex;
|
5
|
+
min-width: 0;
|
6
|
+
max-width: 100%;
|
7
|
+
|
8
|
+
& > .Truncate-text {
|
9
|
+
min-width: 1ch;
|
10
|
+
max-width: fit-content;
|
11
|
+
overflow: hidden;
|
12
|
+
text-overflow: ellipsis;
|
13
|
+
white-space: nowrap;
|
14
|
+
|
15
|
+
& + .Truncate-text {
|
16
|
+
margin-left: var(--primer-control-small-gap, 4px);
|
17
|
+
}
|
18
|
+
|
19
|
+
&.Truncate-text--primary {
|
20
|
+
flex-basis: 200%;
|
21
|
+
}
|
22
|
+
|
23
|
+
&.Truncate-text--expandable:hover,
|
24
|
+
&.Truncate-text--expandable:focus,
|
25
|
+
&.Truncate-text--expandable:active {
|
26
|
+
max-width: 100% !important;
|
27
|
+
flex-shrink: 0;
|
28
|
+
cursor: pointer;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
@@ -4,8 +4,8 @@ import './alpha/nav_list';
|
|
4
4
|
import './alpha/segmented_control';
|
5
5
|
import './alpha/toggle_switch';
|
6
6
|
import './alpha/tool_tip';
|
7
|
+
import './alpha/x_banner';
|
7
8
|
import './beta/auto_complete/auto_complete';
|
8
|
-
import './beta/x_banner';
|
9
9
|
import './clipboard_copy';
|
10
10
|
import './dropdown';
|
11
11
|
import './local_time';
|
@@ -4,8 +4,8 @@ import './alpha/nav_list';
|
|
4
4
|
import './alpha/segmented_control';
|
5
5
|
import './alpha/toggle_switch';
|
6
6
|
import './alpha/tool_tip';
|
7
|
+
import './alpha/x_banner';
|
7
8
|
import './beta/auto_complete/auto_complete';
|
8
|
-
import './beta/x_banner';
|
9
9
|
import './clipboard_copy';
|
10
10
|
import './dropdown';
|
11
11
|
import './local_time';
|
@@ -1,5 +1,15 @@
|
|
1
1
|
/* CSS component styles here */
|
2
2
|
@import "./alpha/action_list.pcss";
|
3
|
-
@import
|
4
|
-
@import "./
|
3
|
+
@import "./alpha/banner.pcss";
|
4
|
+
@import "./alpha/toggle_switch.pcss";
|
5
|
+
@import "./alpha/segmented_control.pcss";
|
6
|
+
@import "./beta/breadcrumbs.pcss";
|
5
7
|
@import "./beta/button.pcss";
|
8
|
+
@import "./beta/counter.pcss";
|
9
|
+
@import "./beta/label.pcss";
|
10
|
+
@import "./beta/blankslate.pcss";
|
11
|
+
@import "./beta/progress_bar.pcss";
|
12
|
+
@import "./beta/truncate.pcss";
|
13
|
+
@import "./state_component.pcss";
|
14
|
+
@import "./subhead_component.pcss";
|
15
|
+
@import "./truncate.pcss";
|
@@ -4,8 +4,8 @@ import './alpha/nav_list'
|
|
4
4
|
import './alpha/segmented_control'
|
5
5
|
import './alpha/toggle_switch'
|
6
6
|
import './alpha/tool_tip'
|
7
|
+
import './alpha/x_banner'
|
7
8
|
import './beta/auto_complete/auto_complete'
|
8
|
-
import './beta/x_banner'
|
9
9
|
import './clipboard_copy'
|
10
10
|
import './dropdown'
|
11
11
|
import './local_time'
|
@@ -1,70 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Primer
|
4
|
-
|
5
|
-
|
6
|
-
status :beta
|
7
|
-
|
8
|
-
# Use the Item slot to add an item to the progress bas
|
9
|
-
#
|
10
|
-
# @param percentage [Integer] The percent complete
|
11
|
-
# @param bg [Symbol] The background color
|
12
|
-
# @param kwargs [Hash] The same arguments as <%= link_to_system_arguments_docs %>.
|
13
|
-
renders_many :items, lambda { |percentage: 0, bg: :success_emphasis, **system_arguments|
|
14
|
-
deny_tag_argument(**system_arguments)
|
15
|
-
system_arguments[:tag] = :span
|
16
|
-
system_arguments[:bg] = bg
|
17
|
-
system_arguments[:style] = join_style_arguments(system_arguments[:style], "width: #{percentage}%;")
|
18
|
-
system_arguments[:classes] = class_names("Progress-item", system_arguments[:classes])
|
19
|
-
|
20
|
-
Primer::BaseComponent.new(**system_arguments)
|
21
|
-
}
|
22
|
-
|
23
|
-
SIZE_DEFAULT = :default
|
24
|
-
|
25
|
-
SIZE_MAPPINGS = {
|
26
|
-
SIZE_DEFAULT => "",
|
27
|
-
:small => "Progress--small",
|
28
|
-
:large => "Progress--large"
|
29
|
-
}.freeze
|
30
|
-
|
31
|
-
SIZE_OPTIONS = SIZE_MAPPINGS.keys
|
32
|
-
# @example Default
|
33
|
-
# <%= render(Primer::ProgressBarComponent.new) do |component| %>
|
34
|
-
# <% component.item(percentage: 25) %>
|
35
|
-
# <% end %>
|
36
|
-
#
|
37
|
-
# @example Small
|
38
|
-
# <%= render(Primer::ProgressBarComponent.new(size: :small)) do |component| %>
|
39
|
-
# <% component.item(bg: :accent_emphasis, percentage: 50) %>
|
40
|
-
# <% end %>
|
41
|
-
#
|
42
|
-
# @example Large
|
43
|
-
# <%= render(Primer::ProgressBarComponent.new(size: :large)) do |component| %>
|
44
|
-
# <% component.item(bg: :danger_emphasis, percentage: 75) %>
|
45
|
-
# <% end %>
|
46
|
-
#
|
47
|
-
# @example Multiple items
|
48
|
-
# <%= render(Primer::ProgressBarComponent.new) do |component| %>
|
49
|
-
# <% component.item(percentage: 10) %>
|
50
|
-
# <% component.item(bg: :accent_emphasis, percentage: 20) %>
|
51
|
-
# <% component.item(bg: :danger_emphasis, percentage: 30) %>
|
52
|
-
# <% end %>
|
53
|
-
#
|
54
|
-
# @param size [Symbol] <%= one_of(Primer::ProgressBarComponent::SIZE_OPTIONS) %> Increases height.
|
55
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
56
|
-
def initialize(size: SIZE_DEFAULT, **system_arguments)
|
57
|
-
@system_arguments = deny_tag_argument(**system_arguments)
|
58
|
-
@system_arguments[:classes] = class_names(
|
59
|
-
@system_arguments[:classes],
|
60
|
-
"Progress",
|
61
|
-
SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, SIZE_DEFAULT)]
|
62
|
-
)
|
63
|
-
@system_arguments[:tag] = :span
|
64
|
-
end
|
65
|
-
|
66
|
-
def render?
|
67
|
-
items.any?
|
68
|
-
end
|
4
|
+
class ProgressBarComponent < Primer::Beta::ProgressBar
|
5
|
+
status :deprecated
|
69
6
|
end
|
70
7
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
.State,.state{border-radius:2em;display:inline-block;font-size:var(--primer-text-body-size-medium,14px);font-weight:var(--base-text-weight-medium,500);line-height:var(--primer-control-medium-lineBoxHeight,20px);padding:5px var(--primer-control-medium-paddingInline-normal,12px);text-align:center;white-space:nowrap}.State,.State--draft,.state{background-color:var(--color-neutral-emphasis);border:var(--primer-borderWidth-thin,1px) solid #0000;color:var(--color-fg-on-emphasis)}.State--open{background-color:var(--color-open-emphasis)}.State--merged,.State--open{color:var(--color-fg-on-emphasis)}.State--merged{background-color:var(--color-done-emphasis)}.State--closed{background-color:var(--color-closed-emphasis);color:var(--color-fg-on-emphasis)}.State--small{font-size:var(--primer-text-body-size-small,12px);line-height:var(--base-size-24,24px);padding:0 10px}.State--small .octicon{width:1em}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"name":"state_component","selectors":[".State",".state",".State--draft",".State--open",".State--merged",".State--closed",".State--small",".State--small .octicon"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["state_component.pcss"],"names":[],"mappings":"AAIA,cASE,iBAAkB,CAPlB,oBAAqB,CAErB,kDAAoD,CACpD,8CAAgD,CAChD,2DAA6D,CAH7D,kEAAoE,CAIpE,iBAAkB,CAClB,kBAEF,CAEA,4BAIE,8CAA+C,CAC/C,qDAA6D,CAF7D,iCAGF,CAEA,aAEE,2CACF,CAEA,4BAJE,iCAOF,CAHA,eAEE,2CACF,CAEA,eAEE,6CAA8C,CAD9C,iCAEF,CAIA,cAEE,iDAAmD,CACnD,oCAAsC,CAFtC,cAOF,CAHE,uBACE,SACF","file":"state_component.css","sourcesContent":["/* State */\n\n/* Default 32px */\n\n.state, /* TODO: Deprecate */\n.State {\n display: inline-block;\n padding: 5px var(--primer-control-medium-paddingInline-normal, 12px);\n font-size: var(--primer-text-body-size-medium, 14px);\n font-weight: var(--base-text-weight-medium, 500);\n line-height: var(--primer-control-medium-lineBoxHeight, 20px);\n text-align: center;\n white-space: nowrap;\n border-radius: 2em;\n}\n\n.state, /* TODO: Deprecate */\n.State,\n.State--draft {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-neutral-emphasis);\n border: var(--primer-borderWidth-thin, 1px) solid transparent;\n}\n\n.State--open {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-open-emphasis);\n}\n\n.State--merged {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-done-emphasis);\n}\n\n.State--closed {\n color: var(--color-fg-on-emphasis);\n background-color: var(--color-closed-emphasis);\n}\n\n/* Small 24px */\n\n.State--small {\n padding: 0 10px;\n font-size: var(--primer-text-body-size-small, 12px);\n line-height: var(--base-size-24, 24px);\n\n & .octicon {\n width: 1em; /* Ensures different icons don't change State indicator width */\n }\n}\n"]}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
/* State */
|
2
|
+
|
3
|
+
/* Default 32px */
|
4
|
+
|
5
|
+
.state, /* TODO: Deprecate */
|
6
|
+
.State {
|
7
|
+
display: inline-block;
|
8
|
+
padding: 5px var(--primer-control-medium-paddingInline-normal, 12px);
|
9
|
+
font-size: var(--primer-text-body-size-medium, 14px);
|
10
|
+
font-weight: var(--base-text-weight-medium, 500);
|
11
|
+
line-height: var(--primer-control-medium-lineBoxHeight, 20px);
|
12
|
+
text-align: center;
|
13
|
+
white-space: nowrap;
|
14
|
+
border-radius: 2em;
|
15
|
+
}
|
16
|
+
|
17
|
+
.state, /* TODO: Deprecate */
|
18
|
+
.State,
|
19
|
+
.State--draft {
|
20
|
+
color: var(--color-fg-on-emphasis);
|
21
|
+
background-color: var(--color-neutral-emphasis);
|
22
|
+
border: var(--primer-borderWidth-thin, 1px) solid transparent;
|
23
|
+
}
|
24
|
+
|
25
|
+
.State--open {
|
26
|
+
color: var(--color-fg-on-emphasis);
|
27
|
+
background-color: var(--color-open-emphasis);
|
28
|
+
}
|
29
|
+
|
30
|
+
.State--merged {
|
31
|
+
color: var(--color-fg-on-emphasis);
|
32
|
+
background-color: var(--color-done-emphasis);
|
33
|
+
}
|
34
|
+
|
35
|
+
.State--closed {
|
36
|
+
color: var(--color-fg-on-emphasis);
|
37
|
+
background-color: var(--color-closed-emphasis);
|
38
|
+
}
|
39
|
+
|
40
|
+
/* Small 24px */
|
41
|
+
|
42
|
+
.State--small {
|
43
|
+
padding: 0 10px;
|
44
|
+
font-size: var(--primer-text-body-size-small, 12px);
|
45
|
+
line-height: var(--base-size-24, 24px);
|
46
|
+
|
47
|
+
& .octicon {
|
48
|
+
width: 1em; /* Ensures different icons don't change State indicator width */
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
.Subhead{border-bottom:var(--primer-borderWidth-thin,1px) solid var(--color-border-muted);display:flex;flex-flow:row wrap;justify-content:flex-end;margin-bottom:var(--primer-stack-gap-normal,16px);padding-bottom:var(--primer-stack-padding-condensed,8px)}.Subhead--spacious{margin-top:var(--base-size-40,40px)}.Subhead-heading{flex:1 1 auto;font-size:24px;font-weight:var(--base-text-weight-normal,400);order:0}.Subhead-heading--danger{color:var(--color-danger-fg);font-weight:var(--base-text-weight-semibold,600)}.Subhead-description{color:var(--color-fg-muted);flex:1 100%;font-size:var(--primer-text-body-size-medium,14px);order:2}.Subhead-actions{align-self:center;justify-content:flex-end;margin:var(--base-size-4,4px) 0 var(--base-size-4,4px) var(--base-size-4,4px);order:1}.Subhead-actions+.Subhead-description{margin-top:var(--base-size-4,4px)}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"name":"subhead_component","selectors":[".Subhead",".Subhead--spacious",".Subhead-heading",".Subhead-heading--danger",".Subhead-description",".Subhead-actions",".Subhead-actions+.Subhead-description"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["subhead_component.pcss"],"names":[],"mappings":"AAEA,SAIE,gFAAkF,CAHlF,YAAa,CAIb,kBAAmB,CACnB,wBAAyB,CAHzB,iDAAmD,CADnD,wDAKF,CAGA,mBACE,mCACF,CAGA,iBAGE,aAAc,CAFd,cAAe,CACf,8CAAgD,CAEhD,OACF,CAGA,yBAEE,4BAA6B,CAD7B,gDAEF,CAGA,qBAEE,2BAA4B,CAC5B,WAAY,CAFZ,kDAAoD,CAGpD,OACF,CAGA,iBAEE,iBAAkB,CAClB,wBAAyB,CAFzB,6EAAiF,CAGjF,OAKF,CAHE,sCACE,iCACF","file":"subhead_component.css","sourcesContent":["/* Subhead */\n\n.Subhead {\n display: flex;\n padding-bottom: var(--primer-stack-padding-condensed, 8px);\n margin-bottom: var(--primer-stack-gap-normal, 16px);\n border-bottom: var(--primer-borderWidth-thin, 1px) solid var(--color-border-muted);\n flex-flow: row wrap;\n justify-content: flex-end; /* Keep actions right aligned. */\n}\n\n/* Modifier class to give a lot of breathing room between sections of content. */\n.Subhead--spacious {\n margin-top: var(--base-size-40, 40px);\n}\n\n/* <h2> sized heading with normal font weight */\n.Subhead-heading {\n font-size: 24px;\n font-weight: var(--base-text-weight-normal, 400);\n flex: 1 1 auto;\n order: 0;\n}\n\n/* Make the text bold and red for dangerous content */\n.Subhead-heading--danger {\n font-weight: var(--base-text-weight-semibold, 600);\n color: var(--color-danger-fg);\n}\n\n/* One-liner of supporting text */\n.Subhead-description {\n font-size: var(--primer-text-body-size-medium, 14px);\n color: var(--color-fg-muted);\n flex: 1 100%;\n order: 2;\n}\n\n/* Add 1 or 2 buttons to the right of the heading */\n.Subhead-actions {\n margin: var(--base-size-4, 4px) 0 var(--base-size-4, 4px) var(--base-size-4, 4px);\n align-self: center;\n justify-content: flex-end;\n order: 1;\n\n & + .Subhead-description {\n margin-top: var(--base-size-4, 4px);\n }\n}\n"]}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
/* Subhead */
|
2
|
+
|
3
|
+
.Subhead {
|
4
|
+
display: flex;
|
5
|
+
padding-bottom: var(--primer-stack-padding-condensed, 8px);
|
6
|
+
margin-bottom: var(--primer-stack-gap-normal, 16px);
|
7
|
+
border-bottom: var(--primer-borderWidth-thin, 1px) solid var(--color-border-muted);
|
8
|
+
flex-flow: row wrap;
|
9
|
+
justify-content: flex-end; /* Keep actions right aligned. */
|
10
|
+
}
|
11
|
+
|
12
|
+
/* Modifier class to give a lot of breathing room between sections of content. */
|
13
|
+
.Subhead--spacious {
|
14
|
+
margin-top: var(--base-size-40, 40px);
|
15
|
+
}
|
16
|
+
|
17
|
+
/* <h2> sized heading with normal font weight */
|
18
|
+
.Subhead-heading {
|
19
|
+
font-size: 24px;
|
20
|
+
font-weight: var(--base-text-weight-normal, 400);
|
21
|
+
flex: 1 1 auto;
|
22
|
+
order: 0;
|
23
|
+
}
|
24
|
+
|
25
|
+
/* Make the text bold and red for dangerous content */
|
26
|
+
.Subhead-heading--danger {
|
27
|
+
font-weight: var(--base-text-weight-semibold, 600);
|
28
|
+
color: var(--color-danger-fg);
|
29
|
+
}
|
30
|
+
|
31
|
+
/* One-liner of supporting text */
|
32
|
+
.Subhead-description {
|
33
|
+
font-size: var(--primer-text-body-size-medium, 14px);
|
34
|
+
color: var(--color-fg-muted);
|
35
|
+
flex: 1 100%;
|
36
|
+
order: 2;
|
37
|
+
}
|
38
|
+
|
39
|
+
/* Add 1 or 2 buttons to the right of the heading */
|
40
|
+
.Subhead-actions {
|
41
|
+
margin: var(--base-size-4, 4px) 0 var(--base-size-4, 4px) var(--base-size-4, 4px);
|
42
|
+
align-self: center;
|
43
|
+
justify-content: flex-end;
|
44
|
+
order: 1;
|
45
|
+
|
46
|
+
& + .Subhead-description {
|
47
|
+
margin-top: var(--base-size-4, 4px);
|
48
|
+
}
|
49
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
.css-truncate .css-truncate-overflow,.css-truncate .css-truncate-target,.css-truncate.css-truncate-overflow,.css-truncate.css-truncate-target{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.css-truncate .css-truncate-target,.css-truncate.css-truncate-target{display:inline-block;max-width:125px;vertical-align:top}.css-truncate.expandable.css-truncate-target:hover,.css-truncate.expandable.zeroclipboard-is-hover .css-truncate-target,.css-truncate.expandable.zeroclipboard-is-hover.css-truncate-target,.css-truncate.expandable:hover .css-truncate-target{max-width:10000px!important}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"name":"truncate","selectors":[".css-truncate .css-truncate-overflow",".css-truncate .css-truncate-target",".css-truncate.css-truncate-overflow",".css-truncate.css-truncate-target",".css-truncate.expandable.css-truncate-target:hover",".css-truncate.expandable.zeroclipboard-is-hover .css-truncate-target",".css-truncate.expandable.zeroclipboard-is-hover.css-truncate-target",".css-truncate.expandable:hover .css-truncate-target"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["truncate.pcss"],"names":[],"mappings":"AAME,8IAIE,eAAgB,CAChB,sBAAuB,CACvB,kBACF,CAGA,qEAEE,oBAAqB,CACrB,eAAgB,CAChB,kBACF,CAEA,gPAIE,2BACF","file":"truncate.css","sourcesContent":["/* CSS truncate */\n\n/* css-truncate will shorten text with an ellipsis. */\n\n.css-truncate {\n /* css-truncate-overflow will shorten text with an ellipsis when overflowing */\n &.css-truncate-overflow,\n & .css-truncate-overflow,\n &.css-truncate-target,\n & .css-truncate-target {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n /* css-truncate-target will shorten text with an ellipsis and a max width */\n &.css-truncate-target,\n & .css-truncate-target {\n display: inline-block;\n max-width: 125px;\n vertical-align: top;\n }\n\n &.expandable.zeroclipboard-is-hover .css-truncate-target,\n &.expandable.zeroclipboard-is-hover.css-truncate-target,\n &.expandable:hover .css-truncate-target,\n &.expandable:hover.css-truncate-target {\n max-width: 10000px !important;\n }\n}\n"]}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
/* CSS truncate */
|
2
|
+
|
3
|
+
/* css-truncate will shorten text with an ellipsis. */
|
4
|
+
|
5
|
+
.css-truncate {
|
6
|
+
/* css-truncate-overflow will shorten text with an ellipsis when overflowing */
|
7
|
+
&.css-truncate-overflow,
|
8
|
+
& .css-truncate-overflow,
|
9
|
+
&.css-truncate-target,
|
10
|
+
& .css-truncate-target {
|
11
|
+
overflow: hidden;
|
12
|
+
text-overflow: ellipsis;
|
13
|
+
white-space: nowrap;
|
14
|
+
}
|
15
|
+
|
16
|
+
/* css-truncate-target will shorten text with an ellipsis and a max width */
|
17
|
+
&.css-truncate-target,
|
18
|
+
& .css-truncate-target {
|
19
|
+
display: inline-block;
|
20
|
+
max-width: 125px;
|
21
|
+
vertical-align: top;
|
22
|
+
}
|
23
|
+
|
24
|
+
&.expandable.zeroclipboard-is-hover .css-truncate-target,
|
25
|
+
&.expandable.zeroclipboard-is-hover.css-truncate-target,
|
26
|
+
&.expandable:hover .css-truncate-target,
|
27
|
+
&.expandable:hover.css-truncate-target {
|
28
|
+
max-width: 10000px !important;
|
29
|
+
}
|
30
|
+
}
|
data/lib/primer/deprecations.rb
CHANGED
@@ -15,7 +15,8 @@ module Primer
|
|
15
15
|
"Primer::CounterComponent" => "Primer::Beta::Counter",
|
16
16
|
"Primer::DropdownMenuComponent" => nil,
|
17
17
|
"Primer::IconButton" => "Primer::Beta::IconButton",
|
18
|
-
"Primer::Tooltip" => "Primer::Alpha::Tooltip"
|
18
|
+
"Primer::Tooltip" => "Primer::Alpha::Tooltip",
|
19
|
+
"Primer::ProgressBarComponent" => "Primer::Beta::ProgressBar"
|
19
20
|
}.freeze
|
20
21
|
|
21
22
|
def self.deprecated?(name)
|
data/lib/tasks/docs.rake
CHANGED
@@ -44,7 +44,7 @@ namespace :docs do
|
|
44
44
|
Primer::Beta::Avatar,
|
45
45
|
Primer::Beta::AvatarStack,
|
46
46
|
Primer::Beta::BaseButton,
|
47
|
-
Primer::
|
47
|
+
Primer::Alpha::Banner,
|
48
48
|
Primer::Beta::Blankslate,
|
49
49
|
Primer::Beta::BorderBox,
|
50
50
|
Primer::Beta::BorderBox::Header,
|
@@ -71,7 +71,7 @@ namespace :docs do
|
|
71
71
|
Primer::Navigation::TabComponent,
|
72
72
|
Primer::OcticonComponent,
|
73
73
|
Primer::PopoverComponent,
|
74
|
-
Primer::
|
74
|
+
Primer::Beta::ProgressBar,
|
75
75
|
Primer::StateComponent,
|
76
76
|
Primer::SpinnerComponent,
|
77
77
|
Primer::SubheadComponent,
|
@@ -103,7 +103,7 @@ namespace :docs do
|
|
103
103
|
Primer::LocalTime,
|
104
104
|
Primer::Alpha::ImageCrop,
|
105
105
|
Primer::Beta::AutoComplete,
|
106
|
-
Primer::
|
106
|
+
Primer::Alpha::Banner,
|
107
107
|
Primer::ClipboardCopy,
|
108
108
|
Primer::TabContainerComponent,
|
109
109
|
Primer::TimeAgoComponent,
|
data/lib/tasks/test.rake
CHANGED
@@ -27,6 +27,14 @@ namespace :test do
|
|
27
27
|
]
|
28
28
|
end
|
29
29
|
|
30
|
+
Rake::TestTask.new(:component_css) do |t|
|
31
|
+
t.warning = false
|
32
|
+
t.libs << "test"
|
33
|
+
t.test_files = FileList[
|
34
|
+
"test/css/**/*_test.rb"
|
35
|
+
]
|
36
|
+
end
|
37
|
+
|
30
38
|
Rake::TestTask.new(:lib) do |t|
|
31
39
|
t.warning = false
|
32
40
|
t.libs << "test"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= render(Primer::
|
1
|
+
<%= render(Primer::Alpha::Banner.new(full: full, dismissible: dismissible, icon: icon, scheme: scheme, reappear: reappear)) do |component| %>
|
2
2
|
<% component.with_action_content do %>
|
3
3
|
<%= render(Primer::Beta::IconButton.new(icon: :pencil, mr: 1, "aria-label": "Edit")) %>
|
4
4
|
<% end %>
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Alpha
|
5
|
+
# @label Banner
|
6
|
+
class BannerPreview < ViewComponent::Preview
|
7
|
+
# @label Playground
|
8
|
+
#
|
9
|
+
# @param full toggle
|
10
|
+
# @param full_when_narrow toggle
|
11
|
+
# @param dismissible toggle
|
12
|
+
# @param icon [Symbol] octicon
|
13
|
+
# @param scheme [Symbol] select [default, warning, danger, success]
|
14
|
+
# @param content text
|
15
|
+
# @param description text
|
16
|
+
# @param reappear [Boolean]
|
17
|
+
def playground(full: false, full_when_narrow: false, dismissible: false, icon: :people, scheme: Primer::Alpha::Banner::DEFAULT_SCHEME, reappear: true, content: "This is a banner!", description: nil)
|
18
|
+
icon = nil if icon == :none
|
19
|
+
render(Primer::Alpha::Banner.new(full: full, full_when_narrow: full_when_narrow, dismissible: dismissible, icon: icon == :none ? nil : icon, scheme: scheme, description: description, reappear: reappear)) { content }
|
20
|
+
end
|
21
|
+
|
22
|
+
# @label Default
|
23
|
+
def default
|
24
|
+
render(Primer::Alpha::Banner.new) { "This is a banner." }
|
25
|
+
end
|
26
|
+
|
27
|
+
# @!group Schemes
|
28
|
+
#
|
29
|
+
# @label Default scheme
|
30
|
+
def scheme_default
|
31
|
+
render(Primer::Alpha::Banner.new) { "This is a default banner." }
|
32
|
+
end
|
33
|
+
|
34
|
+
# @label Danger
|
35
|
+
def scheme_danger
|
36
|
+
render(Primer::Alpha::Banner.new(scheme: :danger)) { "This is a danger banner!" }
|
37
|
+
end
|
38
|
+
|
39
|
+
# @label Success
|
40
|
+
def scheme_success
|
41
|
+
render(Primer::Alpha::Banner.new(scheme: :success)) { "This is a success banner!" }
|
42
|
+
end
|
43
|
+
|
44
|
+
# @label Warning
|
45
|
+
def scheme_warning
|
46
|
+
render(Primer::Alpha::Banner.new(scheme: :warning)) { "This is a warning banner!" }
|
47
|
+
end
|
48
|
+
#
|
49
|
+
# @!endgroup
|
50
|
+
|
51
|
+
# @label Dismissable
|
52
|
+
def dismissable
|
53
|
+
render(Primer::Alpha::Banner.new(dismissable: true, reappear: true)) { "This is a dismissable banner." }
|
54
|
+
end
|
55
|
+
|
56
|
+
# @!group Full Width
|
57
|
+
#
|
58
|
+
# @label Full width
|
59
|
+
def full_width
|
60
|
+
render(Primer::Alpha::Banner.new(full: true)) { "This is a full width banner." }
|
61
|
+
end
|
62
|
+
|
63
|
+
# @label Full width in Narrow Viewport
|
64
|
+
def full_width_in_narrow_viewport
|
65
|
+
render(Primer::Alpha::Banner.new(full: true, full_when_narrow: true)) { "This is a full width banner in a narrow viewport." }
|
66
|
+
end
|
67
|
+
#
|
68
|
+
# @!endgroup
|
69
|
+
|
70
|
+
# @label With action button
|
71
|
+
#
|
72
|
+
# @param full toggle
|
73
|
+
# @param dismissible toggle
|
74
|
+
# @param icon [Symbol] octicon
|
75
|
+
# @param scheme [Symbol] select [default, warning, danger, success]
|
76
|
+
# @param content text
|
77
|
+
# @param reappear [Boolean]
|
78
|
+
def with_action_button(full: false, dismissible: false, icon: :people, scheme: Primer::Alpha::Banner::DEFAULT_SCHEME, reappear: true, content: "This is a banner with an action!")
|
79
|
+
icon = nil if icon == :none
|
80
|
+
render_with_template(locals: { full: full, dismissible: dismissible, icon: icon == :none ? nil : icon, scheme: scheme, content: content, reappear: reappear })
|
81
|
+
end
|
82
|
+
|
83
|
+
# @label With action content
|
84
|
+
#
|
85
|
+
# @param full toggle
|
86
|
+
# @param dismissible toggle
|
87
|
+
# @param icon [Symbol] octicon
|
88
|
+
# @param scheme [Symbol] select [default, warning, danger, success]
|
89
|
+
# @param content text
|
90
|
+
# @param reappear [Boolean]
|
91
|
+
def with_action_content(full: false, dismissible: false, icon: :people, scheme: Primer::Alpha::Banner::DEFAULT_SCHEME, reappear: true, content: "Did you know? Comments can be edited.")
|
92
|
+
icon = nil if icon == :none
|
93
|
+
render_with_template(locals: { full: full, dismissible: dismissible, icon: icon == :none ? nil : icon, scheme: scheme, content: content, reappear: reappear })
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|