primer_view_components 0.0.123 → 0.1.0
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 +16 -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 +2 -2
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/alpha/action_list/item.rb +4 -0
- data/app/components/primer/alpha/action_list.css.json +41 -0
- data/app/components/primer/alpha/auto_complete.css.json +11 -0
- data/app/components/primer/alpha/banner.css.json +14 -0
- data/app/components/primer/alpha/button_marketing.css.json +10 -0
- data/app/components/primer/alpha/dialog.css.json +63 -0
- data/app/components/primer/alpha/dropdown.css.json +21 -0
- data/app/components/primer/alpha/layout.css.json +27 -0
- data/app/components/primer/alpha/menu.css.json +11 -0
- data/app/components/primer/alpha/nav_list/item.rb +3 -1
- data/app/components/primer/alpha/nav_list/section.rb +4 -4
- data/app/components/primer/alpha/nav_list.js +3 -0
- data/app/components/primer/alpha/nav_list.rb +2 -2
- data/app/components/primer/alpha/nav_list.ts +4 -0
- data/app/components/primer/alpha/overlay/body.rb +26 -0
- data/app/components/primer/alpha/overlay/footer.rb +41 -0
- data/app/components/primer/alpha/overlay/header.html.erb +15 -0
- data/app/components/primer/alpha/overlay/header.rb +47 -0
- data/app/components/primer/alpha/overlay.css +1 -0
- data/app/components/primer/alpha/overlay.css.json +11 -0
- data/app/components/primer/alpha/overlay.css.map +1 -0
- data/app/components/primer/alpha/overlay.html.erb +11 -0
- data/app/components/primer/alpha/overlay.pcss +14 -0
- data/app/components/primer/alpha/overlay.rb +194 -0
- data/app/components/primer/alpha/segmented_control.css.json +15 -0
- data/app/components/primer/alpha/tab_nav.css.json +10 -0
- data/app/components/primer/alpha/text_field.css.json +38 -0
- data/app/components/primer/alpha/toggle_switch.css.json +16 -0
- data/app/components/primer/alpha/underline_nav.css.json +13 -0
- data/app/components/primer/anchored_position.d.ts +27 -0
- data/app/components/primer/anchored_position.js +149 -0
- data/app/components/primer/anchored_position.ts +167 -0
- data/app/components/primer/beta/avatar.css.json +14 -0
- data/app/components/primer/beta/avatar_stack.css.json +9 -0
- data/app/components/primer/beta/blankslate.css.json +12 -0
- data/app/components/primer/beta/border_box.css.json +32 -0
- data/app/components/primer/beta/breadcrumbs.css.json +4 -0
- data/app/components/primer/beta/button.css.json +22 -0
- data/app/components/primer/beta/counter.css.json +6 -0
- data/app/components/primer/beta/flash.css.json +15 -0
- data/app/components/primer/beta/flash.html.erb +1 -2
- data/app/components/primer/beta/label.css.json +20 -0
- data/app/components/primer/beta/link.css.json +8 -0
- data/app/components/primer/beta/popover.css.json +18 -0
- data/app/components/primer/beta/progress_bar.css.json +6 -0
- data/app/components/primer/beta/state.css.json +10 -0
- data/app/components/primer/beta/subhead.css.json +8 -0
- data/app/components/primer/beta/timeline_item.css.json +9 -0
- data/app/components/primer/beta/truncate.css.json +6 -0
- data/app/components/primer/primer.d.ts +2 -0
- data/app/components/primer/primer.js +2 -0
- data/app/components/primer/primer.pcss +3 -0
- data/app/components/primer/primer.ts +2 -0
- data/app/components/primer/truncate.css.json +7 -0
- data/app/lib/primer/css/layout.css.json +263 -0
- data/app/lib/primer/css/utilities.css.json +1636 -0
- data/lib/primer/view_components/linters/base_linter.rb +1 -1
- data/lib/primer/view_components/linters/disallow_component_css_counter.rb +30 -0
- data/lib/primer/view_components/version.rb +2 -2
- data/lib/primer/yard/component_manifest.rb +1 -0
- data/previews/primer/alpha/overlay_preview/middle_of_page.html.erb +17 -0
- data/previews/primer/alpha/overlay_preview.rb +107 -0
- data/static/arguments.json +104 -0
- data/static/audited_at.json +4 -0
- data/static/classes.json +311 -0
- data/static/constants.json +102 -0
- data/static/previews.json +21 -0
- data/static/statuses.json +4 -0
- metadata +19 -2
@@ -128,6 +128,7 @@ module Primer
|
|
128
128
|
# @param parent [Primer::Alpha::ActionList::Item] This item's parent item. `nil` if this item is at the root. Used internally.
|
129
129
|
# @param label [String] Item label.
|
130
130
|
# @param label_classes [String] CSS classes that will be added to the label.
|
131
|
+
# @param label_arguments [Hash] <%= link_to_system_arguments_docs %> used to construct the label.
|
131
132
|
# @param content_arguments [Hash] <%= link_to_system_arguments_docs %> used to construct the item's anchor or button tag.
|
132
133
|
# @param truncate_label [Boolean] Truncate label with ellipsis.
|
133
134
|
# @param href [String] Link URL.
|
@@ -144,6 +145,7 @@ module Primer
|
|
144
145
|
list:,
|
145
146
|
label:,
|
146
147
|
label_classes: nil,
|
148
|
+
label_arguments: {},
|
147
149
|
content_arguments: {},
|
148
150
|
parent: nil,
|
149
151
|
truncate_label: false,
|
@@ -191,8 +193,10 @@ module Primer
|
|
191
193
|
@system_arguments[:data][:targets] = "#{list_class.custom_element_name}.items"
|
192
194
|
|
193
195
|
@label_arguments = {
|
196
|
+
**label_arguments,
|
194
197
|
classes: class_names(
|
195
198
|
label_classes,
|
199
|
+
label_arguments[:classes],
|
196
200
|
"ActionListItem-label",
|
197
201
|
"ActionListItem-label--truncate" => @truncate_label
|
198
202
|
)
|
@@ -119,5 +119,46 @@
|
|
119
119
|
".ActionList-sectionDivider--filled",
|
120
120
|
".ActionList-sectionDivider--filled:empty",
|
121
121
|
".ActionList-sectionDivider--filled:first-child"
|
122
|
+
],
|
123
|
+
"classes": [
|
124
|
+
"ActionListWrap",
|
125
|
+
"ActionListWrap--inset",
|
126
|
+
"ActionListWrap--divided",
|
127
|
+
"ActionListItem-label",
|
128
|
+
"ActionListItem-descriptionWrap--inline",
|
129
|
+
"ActionList-sectionDivider",
|
130
|
+
"ActionListItem",
|
131
|
+
"ActionListItem--navActive",
|
132
|
+
"ActionListItem--hasSubItem",
|
133
|
+
"ActionListContent",
|
134
|
+
"ActionListItem-multiSelectCheckmark",
|
135
|
+
"ActionListItem-singleSelectCheckmark",
|
136
|
+
"ActionListItem-multiSelectIcon",
|
137
|
+
"ActionListItem-multiSelectIconRect",
|
138
|
+
"ActionListItem-description",
|
139
|
+
"ActionListItem-visual",
|
140
|
+
"ActionListItem--danger",
|
141
|
+
"ActionList--subGroup",
|
142
|
+
"ActionListContent--visual16",
|
143
|
+
"ActionListContent--visual20",
|
144
|
+
"ActionListContent--visual24",
|
145
|
+
"ActionListItem-collapseIcon",
|
146
|
+
"ActionListContent--hasActiveSubItem",
|
147
|
+
"ActionListContent--sizeLarge",
|
148
|
+
"ActionListContent--sizeXLarge",
|
149
|
+
"ActionListContent--blockDescription",
|
150
|
+
"ActionListItem-action--leading",
|
151
|
+
"ActionListItem-visual--leading",
|
152
|
+
"ActionListItem-visual--trailing",
|
153
|
+
"ActionListItem-action--trailing",
|
154
|
+
"ActionListItem-descriptionWrap",
|
155
|
+
"ActionListItem-action",
|
156
|
+
"ActionListItem-label--truncate",
|
157
|
+
"ActionListItem--subItem",
|
158
|
+
"ActionListItem--withActions",
|
159
|
+
"ActionListItem-trailingAction",
|
160
|
+
"ActionListItem--trailingActionHover",
|
161
|
+
"ActionList-sectionDivider-title",
|
162
|
+
"ActionList-sectionDivider--filled"
|
122
163
|
]
|
123
164
|
}
|
@@ -19,5 +19,16 @@
|
|
19
19
|
".autocomplete-item.navigation-focus *",
|
20
20
|
".autocomplete-item.selected *",
|
21
21
|
".autocomplete-item[aria-selected=true] *"
|
22
|
+
],
|
23
|
+
"classes": [
|
24
|
+
"autocomplete-label-stacked",
|
25
|
+
"autocomplete-label-inline",
|
26
|
+
"autocomplete-body",
|
27
|
+
"autocomplete-embedded-icon-wrap",
|
28
|
+
"form-control",
|
29
|
+
"autocomplete-results",
|
30
|
+
"autocomplete-item",
|
31
|
+
"navigation-focus",
|
32
|
+
"selected"
|
22
33
|
]
|
23
34
|
}
|
@@ -20,5 +20,19 @@
|
|
20
20
|
".Banner.Banner--success .Banner-visual .octicon",
|
21
21
|
".Banner.Banner--full",
|
22
22
|
".Banner.Banner--full-whenNarrow"
|
23
|
+
],
|
24
|
+
"classes": [
|
25
|
+
"Banner",
|
26
|
+
"Banner-actions",
|
27
|
+
"Banner-visual",
|
28
|
+
"octicon",
|
29
|
+
"Banner-message",
|
30
|
+
"Banner-title",
|
31
|
+
"Banner-close",
|
32
|
+
"Banner--warning",
|
33
|
+
"Banner--error",
|
34
|
+
"Banner--success",
|
35
|
+
"Banner--full",
|
36
|
+
"Banner--full-whenNarrow"
|
23
37
|
]
|
24
38
|
}
|
@@ -29,5 +29,15 @@
|
|
29
29
|
".btn-signup-mktg:focus-visible",
|
30
30
|
".btn-small-mktg",
|
31
31
|
".btn-large-mktg"
|
32
|
+
],
|
33
|
+
"classes": [
|
34
|
+
"btn-mktg",
|
35
|
+
"focus",
|
36
|
+
"disabled",
|
37
|
+
"btn-muted-mktg",
|
38
|
+
"btn-subtle-mktg",
|
39
|
+
"btn-signup-mktg",
|
40
|
+
"btn-small-mktg",
|
41
|
+
"btn-large-mktg"
|
32
42
|
]
|
33
43
|
}
|
@@ -78,5 +78,68 @@
|
|
78
78
|
".Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-top-whenNarrow>.Overlay-whenNarrow",
|
79
79
|
".Overlay-backdrop--full-whenNarrow",
|
80
80
|
".Overlay-backdrop--full-whenNarrow .Overlay"
|
81
|
+
],
|
82
|
+
"classes": [
|
83
|
+
"Overlay--hidden",
|
84
|
+
"Overlay--visibilityHidden",
|
85
|
+
"Overlay",
|
86
|
+
"Overlay--size-auto",
|
87
|
+
"Overlay--size-full",
|
88
|
+
"Overlay--size-xsmall",
|
89
|
+
"Overlay--size-small",
|
90
|
+
"Overlay--size-small-portrait",
|
91
|
+
"Overlay--size-medium",
|
92
|
+
"Overlay--size-medium-portrait",
|
93
|
+
"Overlay--size-large",
|
94
|
+
"Overlay--size-xlarge",
|
95
|
+
"Overlay--height-auto",
|
96
|
+
"Overlay--height-xsmall",
|
97
|
+
"Overlay--height-small",
|
98
|
+
"Overlay--height-medium",
|
99
|
+
"Overlay--height-large",
|
100
|
+
"Overlay--height-xlarge",
|
101
|
+
"Overlay--width-auto",
|
102
|
+
"Overlay--width-small",
|
103
|
+
"Overlay--width-medium",
|
104
|
+
"Overlay--width-large",
|
105
|
+
"Overlay--width-xlarge",
|
106
|
+
"Overlay--width-xxlarge",
|
107
|
+
"Overlay--motion-scaleFade",
|
108
|
+
"Overlay-form",
|
109
|
+
"Overlay-header",
|
110
|
+
"Overlay-header--divided",
|
111
|
+
"Overlay-body",
|
112
|
+
"Overlay-header--large",
|
113
|
+
"Overlay-headerContentWrap",
|
114
|
+
"Overlay-titleWrap",
|
115
|
+
"Overlay-title",
|
116
|
+
"Overlay-description",
|
117
|
+
"Overlay-actionWrap",
|
118
|
+
"Overlay-body--paddingCondensed",
|
119
|
+
"Overlay-body--paddingNone",
|
120
|
+
"Overlay-footer",
|
121
|
+
"Overlay-footer--divided",
|
122
|
+
"Overlay-footer--alignStart",
|
123
|
+
"Overlay-footer--alignCenter",
|
124
|
+
"Overlay-footer--alignEnd",
|
125
|
+
"Overlay-closeButton",
|
126
|
+
"close-button",
|
127
|
+
"Overlay-backdrop--center",
|
128
|
+
"Overlay-backdrop--anchor",
|
129
|
+
"Overlay-backdrop--side",
|
130
|
+
"Overlay-backdrop--placement-left",
|
131
|
+
"Overlay-backdrop--placement-right",
|
132
|
+
"Overlay-backdrop--placement-bottom",
|
133
|
+
"Overlay-backdrop--placement-top",
|
134
|
+
"Overlay-backdrop--full",
|
135
|
+
"Overlay-backdrop--center-whenNarrow",
|
136
|
+
"Overlay-backdrop--anchor-whenNarrow",
|
137
|
+
"Overlay-backdrop--side-whenNarrow",
|
138
|
+
"Overlay-backdrop--placement-left-whenNarrow",
|
139
|
+
"Overlay-whenNarrow",
|
140
|
+
"Overlay-backdrop--placement-right-whenNarrow",
|
141
|
+
"Overlay-backdrop--placement-bottom-whenNarrow",
|
142
|
+
"Overlay-backdrop--placement-top-whenNarrow",
|
143
|
+
"Overlay-backdrop--full-whenNarrow"
|
81
144
|
]
|
82
145
|
}
|
@@ -36,5 +36,26 @@
|
|
36
36
|
".dropdown-menu-sw:after",
|
37
37
|
".dropdown-menu-se:before",
|
38
38
|
".dropdown-menu-se:after"
|
39
|
+
],
|
40
|
+
"classes": [
|
41
|
+
"dropdown",
|
42
|
+
"dropdown-caret",
|
43
|
+
"dropdown-menu",
|
44
|
+
"dropdown-menu-no-overflow",
|
45
|
+
"dropdown-item",
|
46
|
+
"octicon",
|
47
|
+
"color-fg-",
|
48
|
+
"Label",
|
49
|
+
"btn-link",
|
50
|
+
"dropdown-signout",
|
51
|
+
"dropdown-divider",
|
52
|
+
"dropdown-header",
|
53
|
+
"octicon-check",
|
54
|
+
"dropdown-menu-w",
|
55
|
+
"dropdown-menu-e",
|
56
|
+
"dropdown-menu-ne",
|
57
|
+
"dropdown-menu-s",
|
58
|
+
"dropdown-menu-sw",
|
59
|
+
"dropdown-menu-se"
|
39
60
|
]
|
40
61
|
}
|
@@ -76,5 +76,32 @@
|
|
76
76
|
".Layout-main .Layout-main-centered-xl>.container-lg",
|
77
77
|
".Layout-main .Layout-main-centered-xl>.container-md",
|
78
78
|
".Layout-main .Layout-main-centered-xl>.container-xl"
|
79
|
+
],
|
80
|
+
"classes": [
|
81
|
+
"Layout",
|
82
|
+
"Layout-divider",
|
83
|
+
"Layout-main",
|
84
|
+
"Layout-sidebar",
|
85
|
+
"Layout--sidebarPosition-flowRow-start",
|
86
|
+
"Layout--sidebarPosition-flowRow-end",
|
87
|
+
"Layout--sidebarPosition-flowRow-none",
|
88
|
+
"Layout--divided",
|
89
|
+
"Layout-divider--flowRow-hidden",
|
90
|
+
"Layout-divider--flowRow-shallow",
|
91
|
+
"Layout--flowRow-until-md",
|
92
|
+
"Layout--flowRow-until-lg",
|
93
|
+
"Layout--gutter-none",
|
94
|
+
"Layout--gutter-condensed",
|
95
|
+
"Layout--gutter-spacious",
|
96
|
+
"Layout--sidebar-narrow",
|
97
|
+
"Layout--sidebar-wide",
|
98
|
+
"Layout--sidebarPosition-start",
|
99
|
+
"Layout--sidebarPosition-end",
|
100
|
+
"Layout-main-centered-lg",
|
101
|
+
"Layout-main-centered-md",
|
102
|
+
"Layout-main-centered-xl",
|
103
|
+
"container-lg",
|
104
|
+
"container-md",
|
105
|
+
"container-xl"
|
79
106
|
]
|
80
107
|
}
|
@@ -24,5 +24,16 @@
|
|
24
24
|
".menu-heading:hover",
|
25
25
|
".menu-heading:first-child",
|
26
26
|
".menu-heading:last-child"
|
27
|
+
],
|
28
|
+
"classes": [
|
29
|
+
"menu",
|
30
|
+
"menu-item",
|
31
|
+
"selected",
|
32
|
+
"octicon",
|
33
|
+
"Counter",
|
34
|
+
"menu-warning",
|
35
|
+
"avatar",
|
36
|
+
"alert",
|
37
|
+
"menu-heading"
|
27
38
|
]
|
28
39
|
}
|
@@ -53,7 +53,7 @@ module Primer
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def active?
|
56
|
-
item_active?(self)
|
56
|
+
item_active?(self) && items.empty?
|
57
57
|
end
|
58
58
|
|
59
59
|
# Cause this item to show its list of sub items when rendered.
|
@@ -75,6 +75,8 @@ module Primer
|
|
75
75
|
|
76
76
|
raise "Cannot render a trailing action for an item with subitems" if items.present? && trailing_action.present?
|
77
77
|
|
78
|
+
raise "Cannot pass `selected_by_ids:` for an item with subitems, since parent items cannot be selected" if items.present? && @selected_by_ids.present?
|
79
|
+
|
78
80
|
return if items.blank?
|
79
81
|
|
80
82
|
@content_arguments[:tag] = :button
|
@@ -28,10 +28,10 @@ module Primer
|
|
28
28
|
system_arguments[:data][:action] = "click:nav-list#showMore"
|
29
29
|
system_arguments[:data][:"current-page"] = "1"
|
30
30
|
system_arguments[:data][:"total-pages"] = pages.to_s
|
31
|
-
system_arguments[:
|
32
|
-
system_arguments[:
|
33
|
-
|
34
|
-
|
31
|
+
system_arguments[:label_arguments] = {
|
32
|
+
**system_arguments[:label_arguments] || {},
|
33
|
+
color: :accent
|
34
|
+
}
|
35
35
|
|
36
36
|
component_klass.new(list: self, src: src, **system_arguments)
|
37
37
|
}
|
@@ -157,6 +157,9 @@ _NavListElement_instances = new WeakSet(), _NavListElement_parseHTML = function
|
|
157
157
|
var _a;
|
158
158
|
// First we compare the selected link to data-item-id for each nav item
|
159
159
|
for (const navItem of this.items) {
|
160
|
+
if (navItem.classList.contains('ActionListItem--hasSubItem')) {
|
161
|
+
continue;
|
162
|
+
}
|
160
163
|
const keys = ((_a = navItem.getAttribute('data-item-id')) === null || _a === void 0 ? void 0 : _a.split(' ')) || [];
|
161
164
|
if (keys.includes(itemId)) {
|
162
165
|
return navItem;
|
@@ -67,7 +67,7 @@ module Primer
|
|
67
67
|
# <%= render(Primer::Alpha::NavList.new(selected_item_id: :email_notifications)) do |component| %>
|
68
68
|
# <% component.with_section(aria: { label: "Account settings" }) do |section| %>
|
69
69
|
# <% section.with_heading(title: "Account Settings") %>
|
70
|
-
# <% section.with_item(label: "Notification settings"
|
70
|
+
# <% section.with_item(label: "Notification settings") do |item| %>
|
71
71
|
# <% item.with_leading_visual_icon(icon: :bell) %>
|
72
72
|
# <% item.with_item(label: "Email", selected_by_ids: :email_notifications, href: "/account/notifications/email") do |subitem| %>
|
73
73
|
# <% subitem.with_trailing_visual_icon(icon: :mail) %>
|
@@ -76,7 +76,7 @@ module Primer
|
|
76
76
|
# <% subitem.with_trailing_visual_icon(icon: :"device-mobile") %>
|
77
77
|
# <% end %>
|
78
78
|
# <% end %>
|
79
|
-
# <% section.with_item(label: "Messages"
|
79
|
+
# <% section.with_item(label: "Messages") do |item| %>
|
80
80
|
# <% item.with_leading_visual_icon(icon: :bookmark) %>
|
81
81
|
# <% item.with_item(label: "Inbox", href: "/account/messages/inbox") do |subitem| %>
|
82
82
|
# <% subitem.with_trailing_visual_counter(count: 10) %>
|
@@ -162,6 +162,10 @@ export class NavListElement extends HTMLElement {
|
|
162
162
|
#findSelectedNavItemById(itemId: string): HTMLElement | null {
|
163
163
|
// First we compare the selected link to data-item-id for each nav item
|
164
164
|
for (const navItem of this.items) {
|
165
|
+
if (navItem.classList.contains('ActionListItem--hasSubItem')) {
|
166
|
+
continue
|
167
|
+
}
|
168
|
+
|
165
169
|
const keys = navItem.getAttribute('data-item-id')?.split(' ') || []
|
166
170
|
|
167
171
|
if (keys.includes(itemId)) {
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Alpha
|
5
|
+
class Overlay
|
6
|
+
# A `Overlay::Body` is a compositional component, used to render the
|
7
|
+
# Body of an overlay. See <%= link_to_component(Primer::Alpha::Overlay) %>.
|
8
|
+
class Body < Primer::Component
|
9
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
10
|
+
def initialize(padding: DEFAULT_PADDING, **system_arguments)
|
11
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
12
|
+
@system_arguments[:tag] = :div
|
13
|
+
@system_arguments[:classes] = class_names(
|
14
|
+
"Overlay-body",
|
15
|
+
PADDING_MAPPINGS[fetch_or_fallback(PADDING_OPTIONS, padding, DEFAULT_PADDING)],
|
16
|
+
system_arguments[:classes]
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
def call
|
21
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Alpha
|
5
|
+
class Overlay
|
6
|
+
DEFAULT_ALIGN_CONTENT = :end
|
7
|
+
ALIGN_CONTENT_MAPPINGS = {
|
8
|
+
:start => "Overlay-footer--alignStart",
|
9
|
+
:center => "Overlay-footer--alignCenter",
|
10
|
+
DEFAULT_ALIGN_CONTENT => "Overlay-footer--alignEnd"
|
11
|
+
}.freeze
|
12
|
+
ALIGN_CONTENT_OPTIONS = ALIGN_CONTENT_MAPPINGS.keys
|
13
|
+
|
14
|
+
# A `Overlay::Footer` is a compositional component, used to render the
|
15
|
+
# Footer of an overlay. See <%= link_to_component(Primer::Alpha::Overlay) %>.
|
16
|
+
class Footer < Primer::Component
|
17
|
+
# @param show_divider [Boolean] Show a divider between the footer and body.
|
18
|
+
# @param align_content [Symbol] The alginment of contents. <%= one_of(Primer::Alpha::Overlay::ALIGN_CONTENT_OPTIONS) %>
|
19
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
20
|
+
def initialize(
|
21
|
+
show_divider: false,
|
22
|
+
align_content: DEFAULT_ALIGN_CONTENT,
|
23
|
+
**system_arguments
|
24
|
+
)
|
25
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
26
|
+
@system_arguments[:tag] = :div
|
27
|
+
@system_arguments[:classes] = class_names(
|
28
|
+
"Overlay-footer",
|
29
|
+
ALIGN_CONTENT_MAPPINGS[fetch_or_fallback(ALIGN_CONTENT_OPTIONS, align_content, DEFAULT_ALIGN_CONTENT)],
|
30
|
+
{ "Overlay-footer--divided": show_divider },
|
31
|
+
system_arguments[:classes]
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
def call
|
36
|
+
render(Primer::BaseComponent.new(**@system_arguments)) { content }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= render Primer::BaseComponent.new(**@system_arguments) do %>
|
2
|
+
<div class="Overlay-headerContentWrap">
|
3
|
+
<div class="Overlay-titleWrap">
|
4
|
+
<h1 class="Overlay-title <% if @visually_hide_title || content.present? %>sr-only<% end %>"><%= @title %></h1>
|
5
|
+
<% if content.present? %>
|
6
|
+
<%= content %>
|
7
|
+
<% elsif @subtitle.present? %>
|
8
|
+
<h2 id="<%= @id %>-description" class="Overlay-description"><%= @subtitle %></h2>
|
9
|
+
<% end %>
|
10
|
+
</div>
|
11
|
+
<div class="Overlay-actionWrap">
|
12
|
+
<%= render Primer::Beta::CloseButton.new(classes: "Overlay-closeButton", "popoverhidetarget": @id) %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Alpha
|
5
|
+
class Overlay
|
6
|
+
# A `Overlay::Header` is a compositional component, used to render the
|
7
|
+
# Header of an overlay. See <%= link_to_component(Primer::Alpha::Overlay) %>.
|
8
|
+
class Header < Primer::Component
|
9
|
+
DEFAULT_SIZE = :medium
|
10
|
+
SIZE_MAPPINGS = {
|
11
|
+
DEFAULT_SIZE => nil,
|
12
|
+
:large => "Overlay-header--large"
|
13
|
+
}.freeze
|
14
|
+
SIZE_OPTIONS = SIZE_MAPPINGS.keys
|
15
|
+
|
16
|
+
# @param title [String] Describes the content of the Overlay.
|
17
|
+
# @param subtitle [String] Provides dditional context for the Overlay, also setting the `aria-describedby` attribute.
|
18
|
+
# @param size [Symbol] The size of the Header. <%= one_of(Primer::Alpha::Overlay::Header::SIZE_OPTIONS) %>
|
19
|
+
# @param divider [Boolean] Show a divider between the header and body.
|
20
|
+
# @param visually_hide_title [Boolean] Visually hide the `title` while maintaining a label for assistive technologies.
|
21
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
22
|
+
def initialize(
|
23
|
+
id:,
|
24
|
+
title:,
|
25
|
+
subtitle: nil,
|
26
|
+
size: DEFAULT_SIZE,
|
27
|
+
divider: false,
|
28
|
+
visually_hide_title: false,
|
29
|
+
**system_arguments
|
30
|
+
)
|
31
|
+
@id = id
|
32
|
+
@title = title
|
33
|
+
@subtitle = subtitle
|
34
|
+
@visually_hide_title = visually_hide_title
|
35
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
36
|
+
@system_arguments[:tag] = :header
|
37
|
+
@system_arguments[:classes] = class_names(
|
38
|
+
"Overlay-header",
|
39
|
+
{ "Overlay-header--divided": divider },
|
40
|
+
SIZE_MAPPINGS[fetch_or_fallback(SIZE_OPTIONS, size, DEFAULT_SIZE)],
|
41
|
+
system_arguments[:classes]
|
42
|
+
)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
.Overlay[popover]{border-width:0;padding:0;position:absolute}.Overlay[popover]:not(:open){display:none}anchored-position{display:block}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["overlay.pcss"],"names":[],"mappings":"AAAA,kBACE,cAAe,CACf,SAAU,CACV,iBACF,CAGA,6BACE,YACF,CAEA,kBACE,aACF","file":"overlay.css","sourcesContent":[".Overlay[popover] {\n border-width: 0;\n padding: 0;\n position: absolute;\n}\n\n/* stylelint-disable-next-line selector-pseudo-class-no-unknown */\n.Overlay[popover]:not(:open) {\n display: none;\n}\n\nanchored-position {\n display: block;\n}\n"]}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
.Overlay[popover] {
|
2
|
+
border-width: 0;
|
3
|
+
padding: 0;
|
4
|
+
position: absolute;
|
5
|
+
}
|
6
|
+
|
7
|
+
/* stylelint-disable-next-line selector-pseudo-class-no-unknown */
|
8
|
+
.Overlay[popover]:not(:open) {
|
9
|
+
display: none;
|
10
|
+
}
|
11
|
+
|
12
|
+
anchored-position {
|
13
|
+
display: block;
|
14
|
+
}
|