primer_view_components 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/components/primer/alpha/action_list/divider.rb +2 -2
- data/app/components/primer/alpha/action_list/heading.rb +1 -1
- data/app/components/primer/alpha/action_list/item.rb +16 -12
- data/app/components/primer/alpha/action_list.html.erb +2 -1
- data/app/components/primer/alpha/action_list.rb +12 -2
- data/app/components/primer/alpha/nav_list.rb +2 -2
- data/app/components/primer/alpha/overlay/header.html.erb +2 -2
- data/app/components/primer/alpha/overlay.rb +10 -3
- data/app/components/primer/truncate.rb +1 -1
- data/lib/primer/deprecations.yml +5 -0
- data/lib/primer/forms/dsl/text_field_input.rb +1 -1
- data/lib/primer/forms/primer_text_field.js +17 -6
- data/lib/primer/forms/primer_text_field.ts +15 -7
- data/lib/primer/forms/text_field.html.erb +3 -3
- data/lib/primer/view_components/version.rb +1 -1
- data/previews/primer/alpha/action_list_preview.rb +35 -15
- data/previews/primer/alpha/nav_list_preview/trailing_action.html.erb +1 -1
- data/previews/primer/alpha/overlay_preview.rb +28 -3
- data/static/arguments.json +1 -1
- data/static/previews.json +10 -5
- data/static/statuses.json +1 -1
- metadata +4 -4
@@ -16,8 +16,8 @@ module Primer
|
|
16
16
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
17
17
|
def initialize(scheme: DEFAULT_SCHEME, **system_arguments)
|
18
18
|
@system_arguments = system_arguments
|
19
|
-
@system_arguments[:tag] = :
|
20
|
-
@system_arguments[:role] = :
|
19
|
+
@system_arguments[:tag] = :li
|
20
|
+
@system_arguments[:role] = :presentation
|
21
21
|
@system_arguments[:'aria-hidden'] = true
|
22
22
|
@scheme = fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)
|
23
23
|
@system_arguments[:classes] = class_names(
|
@@ -84,12 +84,16 @@ module Primer
|
|
84
84
|
# A button rendered after the trailing icon that can be used to show a menu, activate
|
85
85
|
# a dialog, etc.
|
86
86
|
#
|
87
|
-
# @param show_on_hover [Boolean] Whether or not to show the button when the list item is hovered. If `true`, the button will be invisible until hovered. If `false`, the button will always be visible. Defaults to `false`.
|
88
87
|
# @param system_arguments [Hash] The arguments accepted by <%= link_to_component(Primer::Beta::IconButton) %>.
|
89
|
-
renders_one :trailing_action, lambda {
|
90
|
-
|
88
|
+
renders_one :trailing_action, lambda { |**system_arguments|
|
89
|
+
Primer::Beta::IconButton.new(
|
90
|
+
classes: class_names(
|
91
|
+
system_arguments[:classes],
|
92
|
+
"ActionListItem-trailingAction"
|
93
|
+
),
|
91
94
|
|
92
|
-
|
95
|
+
**system_arguments
|
96
|
+
)
|
93
97
|
}
|
94
98
|
|
95
99
|
# `Tooltip` that appears on mouse hover or keyboard focus over the trailing action button. Use tooltips sparingly and as
|
@@ -167,7 +171,6 @@ module Primer
|
|
167
171
|
@truncate_label = truncate_label
|
168
172
|
@disabled = disabled
|
169
173
|
@active = active
|
170
|
-
@trailing_action_on_hover = false
|
171
174
|
@id = id
|
172
175
|
@system_arguments = system_arguments
|
173
176
|
@content_arguments = content_arguments
|
@@ -209,12 +212,14 @@ module Primer
|
|
209
212
|
SIZE_MAPPINGS[@size]
|
210
213
|
)
|
211
214
|
|
212
|
-
|
213
|
-
@
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
215
|
+
unless @content_arguments[:tag]
|
216
|
+
if @href && !@disabled
|
217
|
+
@content_arguments[:tag] = :a
|
218
|
+
@content_arguments[:href] = @href
|
219
|
+
else
|
220
|
+
@content_arguments[:tag] = :button
|
221
|
+
@content_arguments[:onclick] = on_click if on_click
|
222
|
+
end
|
218
223
|
end
|
219
224
|
|
220
225
|
@description_wrapper_arguments = {
|
@@ -231,7 +236,6 @@ module Primer
|
|
231
236
|
@system_arguments[:classes] = class_names(
|
232
237
|
@system_arguments[:classes],
|
233
238
|
"ActionListItem--withActions" => trailing_action.present?,
|
234
|
-
"ActionListItem--trailingActionHover" => @trailing_action_on_hover,
|
235
239
|
"ActionListItem--navActive" => active?
|
236
240
|
)
|
237
241
|
|
@@ -4,7 +4,8 @@
|
|
4
4
|
<% end %>
|
5
5
|
<%= render(Primer::BaseComponent.new(tag: :ul, **@system_arguments)) do %>
|
6
6
|
<% items.each_with_index do |item, index| %>
|
7
|
-
|
7
|
+
<%# the conditions here make sure two dividers are never rendered one after the other %>
|
8
|
+
<% if index > 0 && @show_dividers && !item.is_a?(Divider) && !items[index - 1].is_a?(Divider) %>
|
8
9
|
<%= render(Primer::Alpha::ActionList::Divider.new) %>
|
9
10
|
<% end %>
|
10
11
|
<%= item %>
|
@@ -48,6 +48,15 @@ module Primer
|
|
48
48
|
end
|
49
49
|
}
|
50
50
|
|
51
|
+
# Adds a divider to the list of items.
|
52
|
+
#
|
53
|
+
# @param system_arguments [Hash] The arguments accepted by <%= link_to_component(Primer::Alpha::ActionList::Divider) %>.
|
54
|
+
def with_divider(**system_arguments, &block)
|
55
|
+
# This is a giant hack that should be removed when :items can be converted into a polymorphic slot.
|
56
|
+
# This feature needs to land in view_component first: https://github.com/ViewComponent/view_component/pull/1652
|
57
|
+
set_slot(:items, { renderable: Divider, collection: true }, **system_arguments, &block)
|
58
|
+
end
|
59
|
+
|
51
60
|
# @param role [Boolean] ARIA role describing the function of the list. listbox and menu are a common values.
|
52
61
|
# @param item_classes [String] Additional CSS classes to attach to items.
|
53
62
|
# @param scheme [Symbol] <%= one_of(Primer::Alpha::ActionList::SCHEME_OPTIONS) %>. `inset` children are offset (vertically and horizontally) from list edges. `full` (default) children are flush (vertically and horizontally) with list edges.
|
@@ -81,12 +90,13 @@ module Primer
|
|
81
90
|
# @private
|
82
91
|
def before_render
|
83
92
|
aria_label = aria(:label, @system_arguments)
|
93
|
+
aria_labelledby = aria(:labelledby, @system_arguments)
|
84
94
|
|
85
95
|
if heading.present?
|
86
96
|
@system_arguments[:"aria-labelledby"] = @id
|
87
97
|
raise ArgumentError, "An aria-label should not be provided if a heading is present" if aria_label.present?
|
88
|
-
elsif aria_label.blank?
|
89
|
-
raise ArgumentError, "An aria-label or heading must be provided"
|
98
|
+
elsif aria_label.blank? && aria_labelledby.blank?
|
99
|
+
raise ArgumentError, "An aria-label, aria-labelledby, or heading must be provided"
|
90
100
|
end
|
91
101
|
end
|
92
102
|
|
@@ -94,10 +94,10 @@ module Primer
|
|
94
94
|
# <% component.with_group do |group| %>
|
95
95
|
# <% group.with_heading(title: "My Favorite Foods") %>
|
96
96
|
# <% group.with_item(label: "Popplers", selected_by_ids: :popplers, href: "/foods/popplers") do |item| %>
|
97
|
-
# <% item.with_trailing_action(
|
97
|
+
# <% item.with_trailing_action(icon: "plus", "aria-label": "Add new food", size: :medium) %>
|
98
98
|
# <% end %>
|
99
99
|
# <% group.with_item(label: "Slurm", selected_by_ids: :slurm, href: "/foods/slurm") do |item| %>
|
100
|
-
# <% item.with_trailing_action(
|
100
|
+
# <% item.with_trailing_action(icon: "plus", "aria-label": "Add new food", size: :medium) %>
|
101
101
|
# <% end %>
|
102
102
|
# <% end %>
|
103
103
|
# <% end %>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<%= render Primer::BaseComponent.new(**@system_arguments) do %>
|
2
2
|
<div class="Overlay-headerContentWrap">
|
3
3
|
<div class="Overlay-titleWrap">
|
4
|
-
<h1 class="Overlay-title <% if @visually_hide_title || content.present? %>sr-only<% end %>"><%= @title %></h1>
|
4
|
+
<h1 id="<%= @id %>" class="Overlay-title <% if @visually_hide_title || content.present? %>sr-only<% end %>"><%= @title %></h1>
|
5
5
|
<% if content.present? %>
|
6
6
|
<%= content %>
|
7
7
|
<% elsif @subtitle.present? %>
|
8
|
-
<h2
|
8
|
+
<h2 class="Overlay-description"><%= @subtitle %></h2>
|
9
9
|
<% end %>
|
10
10
|
</div>
|
11
11
|
<div class="Overlay-actionWrap">
|
@@ -89,7 +89,7 @@ module Primer
|
|
89
89
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
90
90
|
renders_one :header, lambda { |divider: false, size: :medium, visually_hide_title: @visually_hide_title, **system_arguments|
|
91
91
|
Primer::Alpha::Overlay::Header.new(
|
92
|
-
id:
|
92
|
+
id: title_id,
|
93
93
|
title: @title,
|
94
94
|
subtitle: @subtitle,
|
95
95
|
size: size,
|
@@ -185,11 +185,14 @@ module Primer
|
|
185
185
|
|
186
186
|
@system_arguments[:popover] = popover
|
187
187
|
@system_arguments[:aria] ||= {}
|
188
|
-
@system_arguments[:aria][:describedby] ||= "#{@id}-description"
|
189
188
|
end
|
190
189
|
|
191
190
|
def before_render
|
192
|
-
|
191
|
+
if header?
|
192
|
+
@system_arguments[:aria][:labelledby] ||= title_id
|
193
|
+
else
|
194
|
+
@system_arguments[:aria][:label] = @title
|
195
|
+
end
|
193
196
|
with_body unless body?
|
194
197
|
end
|
195
198
|
|
@@ -199,6 +202,10 @@ module Primer
|
|
199
202
|
@system_arguments[:id]
|
200
203
|
end
|
201
204
|
|
205
|
+
def title_id
|
206
|
+
"overlay-title-#{overlay_id}"
|
207
|
+
end
|
208
|
+
|
202
209
|
def show_button_id
|
203
210
|
"overlay-show-#{overlay_id}"
|
204
211
|
end
|
data/lib/primer/deprecations.yml
CHANGED
@@ -33,3 +33,8 @@ deprecations:
|
|
33
33
|
- component: "Primer::Tooltip"
|
34
34
|
autocorrect: true
|
35
35
|
replacement: "Primer::Alpha::Tooltip"
|
36
|
+
|
37
|
+
- component: "Primer::Truncate"
|
38
|
+
autocorrect: false
|
39
|
+
replacement: "Primer::Beta::Truncate"
|
40
|
+
guide: "https://primer.style/view-components/guides/primer_truncate"
|
@@ -32,7 +32,7 @@ module Primer
|
|
32
32
|
|
33
33
|
super(**system_arguments)
|
34
34
|
|
35
|
-
add_input_data(:target, "primer-text-field.inputElement")
|
35
|
+
add_input_data(:target, "primer-text-field.inputElement")
|
36
36
|
add_input_classes("FormControl-inset") if inset?
|
37
37
|
add_input_classes("FormControl-monospace") if monospace?
|
38
38
|
end
|
@@ -18,7 +18,10 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
18
18
|
var _PrimerTextFieldElement_abortController;
|
19
19
|
import '@github/auto-check-element';
|
20
20
|
import { controller, target } from '@github/catalyst';
|
21
|
-
|
21
|
+
// eslint-disable-next-line custom-elements/expose-class-on-global
|
22
|
+
let PrimerTextFieldElement =
|
23
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
24
|
+
class PrimerTextFieldElement extends HTMLElement {
|
22
25
|
constructor() {
|
23
26
|
super(...arguments);
|
24
27
|
_PrimerTextFieldElement_abortController.set(this, void 0);
|
@@ -27,22 +30,29 @@ let PrimerTextFieldElement = class PrimerTextFieldElement extends HTMLElement {
|
|
27
30
|
var _a;
|
28
31
|
(_a = __classPrivateFieldGet(this, _PrimerTextFieldElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
|
29
32
|
const { signal } = (__classPrivateFieldSet(this, _PrimerTextFieldElement_abortController, new AbortController(), "f"));
|
30
|
-
this.inputElement.addEventListener('auto-check-success', () => {
|
31
|
-
|
32
|
-
|
33
|
+
this.inputElement.addEventListener('auto-check-success', () => {
|
34
|
+
this.clearError();
|
35
|
+
}, { signal });
|
36
|
+
this.inputElement.addEventListener('auto-check-error', async (event) => {
|
37
|
+
const errorMessage = await event.detail.response.text();
|
38
|
+
this.setError(errorMessage);
|
33
39
|
}, { signal });
|
34
40
|
}
|
35
41
|
disconnectedCallback() {
|
36
42
|
var _a;
|
37
43
|
(_a = __classPrivateFieldGet(this, _PrimerTextFieldElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
|
38
44
|
}
|
45
|
+
clearContents() {
|
46
|
+
this.inputElement.value = '';
|
47
|
+
this.inputElement.focus();
|
48
|
+
}
|
39
49
|
clearError() {
|
40
50
|
this.inputElement.removeAttribute('invalid');
|
41
51
|
this.validationElement.hidden = true;
|
42
|
-
this.validationMessageElement.
|
52
|
+
this.validationMessageElement.textContent = '';
|
43
53
|
}
|
44
54
|
setError(message) {
|
45
|
-
this.validationMessageElement.
|
55
|
+
this.validationMessageElement.textContent = message;
|
46
56
|
this.validationElement.hidden = false;
|
47
57
|
this.inputElement.setAttribute('invalid', 'true');
|
48
58
|
}
|
@@ -59,4 +69,5 @@ __decorate([
|
|
59
69
|
], PrimerTextFieldElement.prototype, "validationMessageElement", void 0);
|
60
70
|
PrimerTextFieldElement = __decorate([
|
61
71
|
controller
|
72
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
62
73
|
], PrimerTextFieldElement);
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import '@github/auto-check-element'
|
2
2
|
import {controller, target} from '@github/catalyst'
|
3
3
|
|
4
|
+
// eslint-disable-next-line custom-elements/expose-class-on-global
|
4
5
|
@controller
|
6
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
5
7
|
class PrimerTextFieldElement extends HTMLElement {
|
6
8
|
@target inputElement: HTMLInputElement
|
7
9
|
@target validationElement: HTMLElement
|
@@ -15,16 +17,17 @@ class PrimerTextFieldElement extends HTMLElement {
|
|
15
17
|
|
16
18
|
this.inputElement.addEventListener(
|
17
19
|
'auto-check-success',
|
18
|
-
() => {
|
20
|
+
() => {
|
21
|
+
this.clearError()
|
22
|
+
},
|
19
23
|
{signal}
|
20
24
|
)
|
21
25
|
|
22
26
|
this.inputElement.addEventListener(
|
23
27
|
'auto-check-error',
|
24
|
-
(event: any) => {
|
25
|
-
event.detail.response.text()
|
26
|
-
|
27
|
-
)
|
28
|
+
async (event: any) => {
|
29
|
+
const errorMessage = await event.detail.response.text()
|
30
|
+
this.setError(errorMessage)
|
28
31
|
},
|
29
32
|
{signal}
|
30
33
|
)
|
@@ -34,14 +37,19 @@ class PrimerTextFieldElement extends HTMLElement {
|
|
34
37
|
this.#abortController?.abort()
|
35
38
|
}
|
36
39
|
|
40
|
+
clearContents() {
|
41
|
+
this.inputElement.value = ''
|
42
|
+
this.inputElement.focus()
|
43
|
+
}
|
44
|
+
|
37
45
|
clearError(): void {
|
38
46
|
this.inputElement.removeAttribute('invalid')
|
39
47
|
this.validationElement.hidden = true
|
40
|
-
this.validationMessageElement.
|
48
|
+
this.validationMessageElement.textContent = ''
|
41
49
|
}
|
42
50
|
|
43
51
|
setError(message: string): void {
|
44
|
-
this.validationMessageElement.
|
52
|
+
this.validationMessageElement.textContent = message
|
45
53
|
this.validationElement.hidden = false
|
46
54
|
this.inputElement.setAttribute('invalid', 'true')
|
47
55
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
<primer-text-field>
|
2
2
|
<%= render(FormControl.new(input: @input)) do %>
|
3
3
|
<%= content_tag(:div, **@field_wrap_arguments) do %>
|
4
4
|
<% if @input.leading_visual %>
|
@@ -10,10 +10,10 @@
|
|
10
10
|
<%= builder.text_field(@input.name, **@input.input_arguments) %>
|
11
11
|
<% end %>
|
12
12
|
<% if @input.show_clear_button? %>
|
13
|
-
<button type="button" id="<%= @input.clear_button_id %>" class="FormControl-input-trailingAction" aria-label="Clear">
|
13
|
+
<button type="button" id="<%= @input.clear_button_id %>" class="FormControl-input-trailingAction" aria-label="Clear" data-action="click:primer-text-field#clearContents">
|
14
14
|
<%= render(Primer::Beta::Octicon.new(icon: :"x-circle-fill")) %>
|
15
15
|
</button>
|
16
16
|
<% end %>
|
17
17
|
<% end %>
|
18
18
|
<% end %>
|
19
|
-
|
19
|
+
</primer-text-field>
|
@@ -89,6 +89,39 @@ module Primer
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
+
# @label With manual dividers
|
93
|
+
#
|
94
|
+
# @param role text
|
95
|
+
# @param scheme [Symbol] select [full, inset]
|
96
|
+
# @param show_dividers toggle
|
97
|
+
def with_manual_dividers(
|
98
|
+
role: Primer::Alpha::ActionList::DEFAULT_ROLE,
|
99
|
+
scheme: Primer::Alpha::ActionList::DEFAULT_SCHEME,
|
100
|
+
show_dividers: false
|
101
|
+
)
|
102
|
+
render(Primer::Alpha::ActionList.new(
|
103
|
+
role: role,
|
104
|
+
scheme: scheme,
|
105
|
+
show_dividers: show_dividers
|
106
|
+
)) do |component|
|
107
|
+
component.with_heading(title: "Action List")
|
108
|
+
component.with_item(label: "Item one", href: "/") do |item|
|
109
|
+
item.with_leading_visual_icon(icon: :gear)
|
110
|
+
end
|
111
|
+
component.with_divider
|
112
|
+
component.with_item(label: "Item two", href: "/") do |item|
|
113
|
+
item.with_leading_visual_icon(icon: :star)
|
114
|
+
end
|
115
|
+
component.with_item(label: "Item three", href: "/") do |item|
|
116
|
+
item.with_leading_visual_icon(icon: :heart)
|
117
|
+
end
|
118
|
+
component.with_divider
|
119
|
+
component.with_item(label: "Item four", href: "/") do |item|
|
120
|
+
item.with_leading_visual_icon(icon: :bug)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
92
125
|
# @label Divider
|
93
126
|
#
|
94
127
|
# @param scheme [Symbol] select [subtle, filled]
|
@@ -135,7 +168,6 @@ module Primer
|
|
135
168
|
# @param private_leading_action_icon [Symbol] octicon
|
136
169
|
# @param private_trailing_action_icon [Symbol] octicon
|
137
170
|
# @param trailing_action toggle
|
138
|
-
# @param trailing_action_on_hover toggle
|
139
171
|
# @param tooltip toggle
|
140
172
|
def item(
|
141
173
|
label: "Label",
|
@@ -156,7 +188,6 @@ module Primer
|
|
156
188
|
trailing_visual_text: nil,
|
157
189
|
private_leading_action_icon: nil,
|
158
190
|
private_trailing_action_icon: nil,
|
159
|
-
trailing_action_on_hover: false,
|
160
191
|
trailing_action: false,
|
161
192
|
tooltip: false
|
162
193
|
)
|
@@ -195,7 +226,7 @@ module Primer
|
|
195
226
|
item.with_private_trailing_action_icon(icon: private_trailing_action_icon)
|
196
227
|
end
|
197
228
|
|
198
|
-
item.with_trailing_action(
|
229
|
+
item.with_trailing_action(icon: "plus", "aria-label": "Button tooltip", size: :medium) if trailing_action && trailing_action != :none
|
199
230
|
|
200
231
|
item.description { description } if description
|
201
232
|
|
@@ -294,18 +325,7 @@ module Primer
|
|
294
325
|
aria: { label: "List heading" }
|
295
326
|
)) do |component|
|
296
327
|
component.with_item(label: "Default item", href: "/") do |item|
|
297
|
-
item.with_trailing_action(
|
298
|
-
end
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
# @label Item [trailing action on hover]
|
303
|
-
def item_trailing_action_hover
|
304
|
-
render(Primer::Alpha::ActionList.new(
|
305
|
-
aria: { label: "List heading" }
|
306
|
-
)) do |component|
|
307
|
-
component.with_item(label: "Default item", href: "/") do |item|
|
308
|
-
item.with_trailing_action(show_on_hover: true, icon: "plus", "aria-label": "Button tooltip", size: :medium)
|
328
|
+
item.with_trailing_action(icon: "plus", "aria-label": "Button tooltip", size: :medium)
|
309
329
|
end
|
310
330
|
end
|
311
331
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<% list.with_group do |group| %>
|
3
3
|
<%= group.with_heading(title: "Shopping list") %>
|
4
4
|
<% group.with_item(label: "Bread", href: "/list/1") do |item| %>
|
5
|
-
<%= item.with_trailing_action(
|
5
|
+
<%= item.with_trailing_action(icon: :plus, aria: { label: "Activate alert" }, name: "bread_button") %>
|
6
6
|
<% end %>
|
7
7
|
<% group.with_item(label: "Cheese", href: "/list/2") do |item| %>
|
8
8
|
<%= item.with_trailing_action(icon: :plus, aria: { label: "Activate alert" }, name: "cheese_button") %>
|
@@ -32,10 +32,10 @@ module Primer
|
|
32
32
|
anchor_offset: anchor_offset,
|
33
33
|
anchor_side: anchor_side,
|
34
34
|
allow_out_of_bounds: allow_out_of_bounds,
|
35
|
-
visually_hide_title: visually_hide_title
|
35
|
+
visually_hide_title: visually_hide_title
|
36
36
|
)) do |d|
|
37
37
|
d.with_header(title: title, size: header_size)
|
38
|
-
if icon.present?
|
38
|
+
if icon.present? && (icon != :none)
|
39
39
|
d.with_show_button(icon: icon, "aria-label": icon.to_s)
|
40
40
|
else
|
41
41
|
d.with_show_button { button_text }
|
@@ -69,7 +69,7 @@ module Primer
|
|
69
69
|
anchor_align: anchor_align,
|
70
70
|
anchor_side: anchor_side,
|
71
71
|
allow_out_of_bounds: allow_out_of_bounds,
|
72
|
-
visually_hide_title: visually_hide_title
|
72
|
+
visually_hide_title: visually_hide_title
|
73
73
|
)) do |d|
|
74
74
|
d.with_header(title: title, size: header_size)
|
75
75
|
d.with_show_button { button_text }
|
@@ -77,6 +77,31 @@ module Primer
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
# @label Menu No Header
|
81
|
+
#
|
82
|
+
# @param size [Symbol] select [auto, small, medium, medium_portrait, large, xlarge]
|
83
|
+
# @param padding [Symbol] select [normal, condensed, none]
|
84
|
+
# @param anchor_align [Symbol] select [start, center, end]
|
85
|
+
# @param anchor_side [Symbol] select [inside_top, inside_bottom, inside_left, inside_right, inside_center, outside_top, outside_bottom, outside_left, outside_right]
|
86
|
+
# @param allow_out_of_bounds [Boolean] toggle
|
87
|
+
#
|
88
|
+
# @param button_text [String] text
|
89
|
+
# @param body_text [String] text
|
90
|
+
def menu_no_header(size: :auto, padding: :normal, anchor_align: :center, anchor_side: :outside_bottom, allow_out_of_bounds: false, button_text: "Show Overlay Menu", body_text: "This is a menu")
|
91
|
+
render(Primer::Alpha::Overlay.new(
|
92
|
+
title: "Menu",
|
93
|
+
role: :menu,
|
94
|
+
size: size,
|
95
|
+
padding: padding,
|
96
|
+
anchor_align: anchor_align,
|
97
|
+
anchor_side: anchor_side,
|
98
|
+
allow_out_of_bounds: allow_out_of_bounds
|
99
|
+
)) do |d|
|
100
|
+
d.with_show_button { button_text }
|
101
|
+
d.with_body { body_text }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
80
105
|
# @label Middle Of Page
|
81
106
|
#
|
82
107
|
# @param title [String] text
|
data/static/arguments.json
CHANGED
@@ -1805,7 +1805,7 @@
|
|
1805
1805
|
},
|
1806
1806
|
{
|
1807
1807
|
"component": "Truncate",
|
1808
|
-
"status": "
|
1808
|
+
"status": "deprecated",
|
1809
1809
|
"source": "https://github.com/primer/view_components/tree/main/app/components/primer/truncate.rb",
|
1810
1810
|
"lookbook": "https://primer.style/view-components/lookbook/inspect/primer/truncate/default/",
|
1811
1811
|
"parameters": [
|
data/static/previews.json
CHANGED
@@ -18,6 +18,11 @@
|
|
18
18
|
"preview_path": "/lookbook/preview/primer/alpha/action_list/leading_visuals",
|
19
19
|
"name": "leading_visuals"
|
20
20
|
},
|
21
|
+
{
|
22
|
+
"inspect_path": "/lookbook/inspect/primer/alpha/action_list/with_manual_dividers",
|
23
|
+
"preview_path": "/lookbook/preview/primer/alpha/action_list/with_manual_dividers",
|
24
|
+
"name": "with_manual_dividers"
|
25
|
+
},
|
21
26
|
{
|
22
27
|
"inspect_path": "/lookbook/inspect/primer/alpha/action_list/divider",
|
23
28
|
"preview_path": "/lookbook/preview/primer/alpha/action_list/divider",
|
@@ -78,11 +83,6 @@
|
|
78
83
|
"preview_path": "/lookbook/preview/primer/alpha/action_list/item_trailing_action",
|
79
84
|
"name": "item_trailing_action"
|
80
85
|
},
|
81
|
-
{
|
82
|
-
"inspect_path": "/lookbook/inspect/primer/alpha/action_list/item_trailing_action_hover",
|
83
|
-
"preview_path": "/lookbook/preview/primer/alpha/action_list/item_trailing_action_hover",
|
84
|
-
"name": "item_trailing_action_hover"
|
85
|
-
},
|
86
86
|
{
|
87
87
|
"inspect_path": "/lookbook/inspect/primer/alpha/action_list/item_danger",
|
88
88
|
"preview_path": "/lookbook/preview/primer/alpha/action_list/item_danger",
|
@@ -1277,6 +1277,11 @@
|
|
1277
1277
|
"preview_path": "/lookbook/preview/primer/alpha/overlay/default",
|
1278
1278
|
"name": "default"
|
1279
1279
|
},
|
1280
|
+
{
|
1281
|
+
"inspect_path": "/lookbook/inspect/primer/alpha/overlay/menu_no_header",
|
1282
|
+
"preview_path": "/lookbook/preview/primer/alpha/overlay/menu_no_header",
|
1283
|
+
"name": "menu_no_header"
|
1284
|
+
},
|
1280
1285
|
{
|
1281
1286
|
"inspect_path": "/lookbook/inspect/primer/alpha/overlay/middle_of_page",
|
1282
1287
|
"preview_path": "/lookbook/preview/primer/alpha/overlay/middle_of_page",
|
data/static/statuses.json
CHANGED
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.1.
|
4
|
+
version: 0.1.2
|
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: 2023-03-
|
11
|
+
date: 2023-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 18.0.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 18.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: view_component
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|