primer_view_components 0.0.76 → 0.0.77
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/app/components/primer/{flash_component.html.erb → beta/flash.html.erb} +0 -0
- data/app/components/primer/beta/flash.rb +71 -0
- data/app/components/primer/link_component.rb +6 -0
- data/lib/primer/view_components/linters/argument_mappers/flash.rb +1 -1
- data/lib/primer/view_components/linters/{flash_component_migration_counter.rb → flash_migration_counter.rb} +3 -3
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/tasks/docs.rake +1 -1
- data/static/arguments.yml +27 -27
- data/static/audited_at.json +1 -1
- data/static/constants.json +9 -9
- data/static/statuses.json +1 -1
- metadata +6 -7
- data/app/components/primer/flash_component.rb +0 -69
- data/app/components/primer/link_component.erb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f84596b796b25618ed97b1f6fd73cca3e3d1a379589d06748d167e18a36118b0
|
4
|
+
data.tar.gz: 6d9aa8f0332223a345227263eeae4f71e21724208ceed6fcb7f929e322beb177
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1f71999579298bd8e7649ee0be439be3261b6fd76729bdf69dd771381160c0caad8ce7a2fae10c5df49163ba9aabba6741697c81fa7e868f684a19df86290f2
|
7
|
+
data.tar.gz: 4783a639eb3848cbf1f3cf068c4905751bcdfb9ebc4c58ce10d45c16c5c0a85a6eed3cc689e06771176894590eeecba23aeb0cc37bfd35a57494461e7efdd8a6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.0.77
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#1185](https://github.com/primer/view_components/pull/1185) [`66a15b1a`](https://github.com/primer/view_components/commit/66a15b1a556e9814109317729b729dbee5316594) Thanks [@joelhawksley](https://github.com/joelhawksley)! - Rename FlashComponent to Flash
|
8
|
+
|
9
|
+
* [#1183](https://github.com/primer/view_components/pull/1183) [`84b9e4ef`](https://github.com/primer/view_components/commit/84b9e4ef60c9f0d1c2df830f247f2a55aac82783) Thanks [@camertron](https://github.com/camertron)! - Remove trailing newlines from the output of LinkComponent
|
10
|
+
|
3
11
|
## 0.0.76
|
4
12
|
|
5
13
|
### Patch Changes
|
File without changes
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Beta
|
5
|
+
# Use `Flash` to inform users of successful or pending actions.
|
6
|
+
class Flash < Primer::Component
|
7
|
+
status :beta
|
8
|
+
|
9
|
+
# Optional action content showed on the right side of the component.
|
10
|
+
#
|
11
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
12
|
+
renders_one :action, lambda { |**system_arguments|
|
13
|
+
deny_tag_argument(**system_arguments)
|
14
|
+
system_arguments[:tag] = :div
|
15
|
+
system_arguments[:classes] = class_names(system_arguments[:classes], "flash-action")
|
16
|
+
|
17
|
+
Primer::BaseComponent.new(**system_arguments)
|
18
|
+
}
|
19
|
+
|
20
|
+
DEFAULT_SCHEME = :default
|
21
|
+
SCHEME_MAPPINGS = {
|
22
|
+
DEFAULT_SCHEME => "",
|
23
|
+
:warning => "flash-warn",
|
24
|
+
:danger => "flash-error",
|
25
|
+
:success => "flash-success"
|
26
|
+
}.freeze
|
27
|
+
# @example Schemes
|
28
|
+
# <%= render(Primer::Beta::Flash.new) { "This is a flash message!" } %>
|
29
|
+
# <%= render(Primer::Beta::Flash.new(scheme: :warning)) { "This is a warning flash message!" } %>
|
30
|
+
# <%= render(Primer::Beta::Flash.new(scheme: :danger)) { "This is a danger flash message!" } %>
|
31
|
+
# <%= render(Primer::Beta::Flash.new(scheme: :success)) { "This is a success flash message!" } %>
|
32
|
+
#
|
33
|
+
# @example Full width
|
34
|
+
# <%= render(Primer::Beta::Flash.new(full: true)) { "This is a full width flash message!" } %>
|
35
|
+
#
|
36
|
+
# @example Dismissible
|
37
|
+
# <%= render(Primer::Beta::Flash.new(dismissible: true)) { "This is a dismissible flash message!" } %>
|
38
|
+
#
|
39
|
+
# @example Icon
|
40
|
+
# <%= render(Primer::Beta::Flash.new(icon: :people)) { "This is a flash message with an icon!" } %>
|
41
|
+
#
|
42
|
+
# @example With actions
|
43
|
+
# <%= render(Primer::Beta::Flash.new) do |component| %>
|
44
|
+
# This is a flash message with actions!
|
45
|
+
# <% component.action do %>
|
46
|
+
# <%= render(Primer::ButtonComponent.new(size: :small)) { "Take action" } %>
|
47
|
+
# <% end %>
|
48
|
+
# <% end %>
|
49
|
+
#
|
50
|
+
# @param full [Boolean] Whether the component should take up the full width of the screen.
|
51
|
+
# @param spacious [Boolean] Whether to add margin to the bottom of the component.
|
52
|
+
# @param dismissible [Boolean] Whether the component can be dismissed with an X button.
|
53
|
+
# @param icon [Symbol] Name of Octicon icon to use.
|
54
|
+
# @param scheme [Symbol] <%= one_of(Primer::Beta::Flash::SCHEME_MAPPINGS.keys) %>
|
55
|
+
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
56
|
+
def initialize(full: false, spacious: false, dismissible: false, icon: nil, scheme: DEFAULT_SCHEME, **system_arguments)
|
57
|
+
@icon = icon
|
58
|
+
@dismissible = dismissible
|
59
|
+
@system_arguments = deny_tag_argument(**system_arguments)
|
60
|
+
@system_arguments[:tag] = :div
|
61
|
+
@system_arguments[:classes] = class_names(
|
62
|
+
@system_arguments[:classes],
|
63
|
+
"flash",
|
64
|
+
SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_MAPPINGS.keys, scheme, DEFAULT_SCHEME)],
|
65
|
+
"flash-full": full
|
66
|
+
)
|
67
|
+
@system_arguments[:mb] ||= spacious ? 4 : nil
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -82,5 +82,11 @@ module Primer
|
|
82
82
|
def before_render
|
83
83
|
raise ArgumentError, "href is required when using <a> tag" if @system_arguments[:tag] == :a && @system_arguments[:href].nil? && !Rails.env.production?
|
84
84
|
end
|
85
|
+
|
86
|
+
def call
|
87
|
+
render(Primer::BaseComponent.new(**@system_arguments)) do
|
88
|
+
content.to_s + tooltip.to_s
|
89
|
+
end
|
90
|
+
end
|
85
91
|
end
|
86
92
|
end
|
@@ -8,7 +8,7 @@ module ERBLint
|
|
8
8
|
# Maps classes in a flash element to arguments for the Flash component.
|
9
9
|
class Flash < Base
|
10
10
|
SCHEME_MAPPINGS = Primer::ViewComponents::Constants.get(
|
11
|
-
component: "Primer::
|
11
|
+
component: "Primer::Beta::Flash",
|
12
12
|
constant: "SCHEME_MAPPINGS",
|
13
13
|
symbolize: true
|
14
14
|
).freeze
|
@@ -7,14 +7,14 @@ require_relative "argument_mappers/flash"
|
|
7
7
|
module ERBLint
|
8
8
|
module Linters
|
9
9
|
# Counts the number of times a HTML flash is used instead of the component.
|
10
|
-
class
|
10
|
+
class FlashMigrationCounter < BaseLinter
|
11
11
|
include Autocorrectable
|
12
12
|
|
13
13
|
TAGS = %w[div].freeze
|
14
14
|
CLASSES = %w[flash].freeze
|
15
|
-
MESSAGE = "We are migrating flashes to use [Primer::
|
15
|
+
MESSAGE = "We are migrating flashes to use [Primer::Beta::Flash](https://primer.style/view-components/components/flash), please try to use that instead of raw HTML."
|
16
16
|
ARGUMENT_MAPPER = ArgumentMappers::Flash
|
17
|
-
COMPONENT = "Primer::
|
17
|
+
COMPONENT = "Primer::Beta::Flash"
|
18
18
|
|
19
19
|
def map_arguments(tag, tag_tree)
|
20
20
|
# We can only autocorrect elements with simple text as content.
|
data/lib/tasks/docs.rake
CHANGED
data/static/arguments.yml
CHANGED
@@ -341,6 +341,33 @@
|
|
341
341
|
type: Hash
|
342
342
|
default: N/A
|
343
343
|
description: "[System arguments](/system-arguments)"
|
344
|
+
- component: Flash
|
345
|
+
source: https://github.com/primer/view_components/tree/main/app/components/primer/beta/flash.rb
|
346
|
+
parameters:
|
347
|
+
- name: full
|
348
|
+
type: Boolean
|
349
|
+
default: "`false`"
|
350
|
+
description: Whether the component should take up the full width of the screen.
|
351
|
+
- name: spacious
|
352
|
+
type: Boolean
|
353
|
+
default: "`false`"
|
354
|
+
description: Whether to add margin to the bottom of the component.
|
355
|
+
- name: dismissible
|
356
|
+
type: Boolean
|
357
|
+
default: "`false`"
|
358
|
+
description: Whether the component can be dismissed with an X button.
|
359
|
+
- name: icon
|
360
|
+
type: Symbol
|
361
|
+
default: "`nil`"
|
362
|
+
description: Name of Octicon icon to use.
|
363
|
+
- name: scheme
|
364
|
+
type: Symbol
|
365
|
+
default: "`:default`"
|
366
|
+
description: One of `:danger`, `:default`, `:success`, or `:warning`.
|
367
|
+
- name: system_arguments
|
368
|
+
type: Hash
|
369
|
+
default: N/A
|
370
|
+
description: "[System arguments](/system-arguments)"
|
344
371
|
- component: Text
|
345
372
|
source: https://github.com/primer/view_components/tree/main/app/components/primer/beta/text.rb
|
346
373
|
parameters:
|
@@ -546,33 +573,6 @@
|
|
546
573
|
type: Hash
|
547
574
|
default: N/A
|
548
575
|
description: "[System arguments](/system-arguments)"
|
549
|
-
- component: Flash
|
550
|
-
source: https://github.com/primer/view_components/tree/main/app/components/primer/flash_component.rb
|
551
|
-
parameters:
|
552
|
-
- name: full
|
553
|
-
type: Boolean
|
554
|
-
default: "`false`"
|
555
|
-
description: Whether the component should take up the full width of the screen.
|
556
|
-
- name: spacious
|
557
|
-
type: Boolean
|
558
|
-
default: "`false`"
|
559
|
-
description: Whether to add margin to the bottom of the component.
|
560
|
-
- name: dismissible
|
561
|
-
type: Boolean
|
562
|
-
default: "`false`"
|
563
|
-
description: Whether the component can be dismissed with an X button.
|
564
|
-
- name: icon
|
565
|
-
type: Symbol
|
566
|
-
default: "`nil`"
|
567
|
-
description: Name of Octicon icon to use.
|
568
|
-
- name: scheme
|
569
|
-
type: Symbol
|
570
|
-
default: "`:default`"
|
571
|
-
description: One of `:danger`, `:default`, `:success`, or `:warning`.
|
572
|
-
- name: system_arguments
|
573
|
-
type: Hash
|
574
|
-
default: N/A
|
575
|
-
description: "[System arguments](/system-arguments)"
|
576
576
|
- component: Flex
|
577
577
|
source: https://github.com/primer/view_components/tree/main/app/components/primer/flex_component.rb
|
578
578
|
parameters:
|
data/static/audited_at.json
CHANGED
@@ -18,6 +18,7 @@
|
|
18
18
|
"Primer::Beta::Blankslate": "",
|
19
19
|
"Primer::Beta::Breadcrumbs": "",
|
20
20
|
"Primer::Beta::Breadcrumbs::Item": "",
|
21
|
+
"Primer::Beta::Flash": "",
|
21
22
|
"Primer::Beta::Text": "",
|
22
23
|
"Primer::Beta::Truncate": "",
|
23
24
|
"Primer::Beta::Truncate::TruncateText": "",
|
@@ -35,7 +36,6 @@
|
|
35
36
|
"Primer::Dropdown::Menu": "",
|
36
37
|
"Primer::Dropdown::Menu::Item": "",
|
37
38
|
"Primer::DropdownMenuComponent": "",
|
38
|
-
"Primer::FlashComponent": "",
|
39
39
|
"Primer::FlexComponent": "",
|
40
40
|
"Primer::FlexItemComponent": "",
|
41
41
|
"Primer::HeadingComponent": "",
|
data/static/constants.json
CHANGED
@@ -270,6 +270,15 @@
|
|
270
270
|
},
|
271
271
|
"Primer::Beta::Breadcrumbs::Item": {
|
272
272
|
},
|
273
|
+
"Primer::Beta::Flash": {
|
274
|
+
"DEFAULT_SCHEME": "default",
|
275
|
+
"SCHEME_MAPPINGS": {
|
276
|
+
"default": "",
|
277
|
+
"warning": "flash-warn",
|
278
|
+
"danger": "flash-error",
|
279
|
+
"success": "flash-success"
|
280
|
+
}
|
281
|
+
},
|
273
282
|
"Primer::Beta::Text": {
|
274
283
|
"DEFAULT_TAG": "span"
|
275
284
|
},
|
@@ -427,15 +436,6 @@
|
|
427
436
|
"dark": "dropdown-menu-dark"
|
428
437
|
}
|
429
438
|
},
|
430
|
-
"Primer::FlashComponent": {
|
431
|
-
"DEFAULT_SCHEME": "default",
|
432
|
-
"SCHEME_MAPPINGS": {
|
433
|
-
"default": "",
|
434
|
-
"warning": "flash-warn",
|
435
|
-
"danger": "flash-error",
|
436
|
-
"success": "flash-success"
|
437
|
-
}
|
438
|
-
},
|
439
439
|
"Primer::FlexComponent": {
|
440
440
|
"ALIGN_ITEMS_DEFAULT": null,
|
441
441
|
"ALIGN_ITEMS_MAPPINGS": {
|
data/static/statuses.json
CHANGED
@@ -18,6 +18,7 @@
|
|
18
18
|
"Primer::Beta::Blankslate": "beta",
|
19
19
|
"Primer::Beta::Breadcrumbs": "beta",
|
20
20
|
"Primer::Beta::Breadcrumbs::Item": "alpha",
|
21
|
+
"Primer::Beta::Flash": "beta",
|
21
22
|
"Primer::Beta::Text": "beta",
|
22
23
|
"Primer::Beta::Truncate": "beta",
|
23
24
|
"Primer::Beta::Truncate::TruncateText": "alpha",
|
@@ -35,7 +36,6 @@
|
|
35
36
|
"Primer::Dropdown::Menu": "alpha",
|
36
37
|
"Primer::Dropdown::Menu::Item": "alpha",
|
37
38
|
"Primer::DropdownMenuComponent": "deprecated",
|
38
|
-
"Primer::FlashComponent": "beta",
|
39
39
|
"Primer::FlexComponent": "deprecated",
|
40
40
|
"Primer::FlexItemComponent": "deprecated",
|
41
41
|
"Primer::HeadingComponent": "beta",
|
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.77
|
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-06-
|
11
|
+
date: 2022-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -410,6 +410,8 @@ files:
|
|
410
410
|
- app/components/primer/beta/blankslate.rb
|
411
411
|
- app/components/primer/beta/breadcrumbs.html.erb
|
412
412
|
- app/components/primer/beta/breadcrumbs.rb
|
413
|
+
- app/components/primer/beta/flash.html.erb
|
414
|
+
- app/components/primer/beta/flash.rb
|
413
415
|
- app/components/primer/beta/text.rb
|
414
416
|
- app/components/primer/beta/truncate.html.erb
|
415
417
|
- app/components/primer/beta/truncate.rb
|
@@ -445,8 +447,6 @@ files:
|
|
445
447
|
- app/components/primer/dropdown/menu.ts
|
446
448
|
- app/components/primer/dropdown_menu_component.html.erb
|
447
449
|
- app/components/primer/dropdown_menu_component.rb
|
448
|
-
- app/components/primer/flash_component.html.erb
|
449
|
-
- app/components/primer/flash_component.rb
|
450
450
|
- app/components/primer/flex_component.rb
|
451
451
|
- app/components/primer/flex_item_component.rb
|
452
452
|
- app/components/primer/heading_component.rb
|
@@ -462,7 +462,6 @@ files:
|
|
462
462
|
- app/components/primer/label_component.rb
|
463
463
|
- app/components/primer/layout_component.html.erb
|
464
464
|
- app/components/primer/layout_component.rb
|
465
|
-
- app/components/primer/link_component.erb
|
466
465
|
- app/components/primer/link_component.rb
|
467
466
|
- app/components/primer/local_time.d.ts
|
468
467
|
- app/components/primer/local_time.js
|
@@ -537,7 +536,7 @@ files:
|
|
537
536
|
- lib/primer/view_components/linters/button_component_migration_counter.rb
|
538
537
|
- lib/primer/view_components/linters/clipboard_copy_component_migration_counter.rb
|
539
538
|
- lib/primer/view_components/linters/close_button_component_migration_counter.rb
|
540
|
-
- lib/primer/view_components/linters/
|
539
|
+
- lib/primer/view_components/linters/flash_migration_counter.rb
|
541
540
|
- lib/primer/view_components/linters/helpers/rubocop_helpers.rb
|
542
541
|
- lib/primer/view_components/linters/label_component_migration_counter.rb
|
543
542
|
- lib/primer/view_components/linters/subhead_component_migration_counter.rb
|
@@ -595,7 +594,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
595
594
|
- !ruby/object:Gem::Version
|
596
595
|
version: '0'
|
597
596
|
requirements: []
|
598
|
-
rubygems_version: 3.2.
|
597
|
+
rubygems_version: 3.2.32
|
599
598
|
signing_key:
|
600
599
|
specification_version: 4
|
601
600
|
summary: ViewComponents for the Primer Design System
|
@@ -1,69 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Primer
|
4
|
-
# Use `Flash` to inform users of successful or pending actions.
|
5
|
-
class FlashComponent < Primer::Component
|
6
|
-
status :beta
|
7
|
-
|
8
|
-
# Optional action content showed on the right side of the component.
|
9
|
-
#
|
10
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
11
|
-
renders_one :action, lambda { |**system_arguments|
|
12
|
-
deny_tag_argument(**system_arguments)
|
13
|
-
system_arguments[:tag] = :div
|
14
|
-
system_arguments[:classes] = class_names(system_arguments[:classes], "flash-action")
|
15
|
-
|
16
|
-
Primer::BaseComponent.new(**system_arguments)
|
17
|
-
}
|
18
|
-
|
19
|
-
DEFAULT_SCHEME = :default
|
20
|
-
SCHEME_MAPPINGS = {
|
21
|
-
DEFAULT_SCHEME => "",
|
22
|
-
:warning => "flash-warn",
|
23
|
-
:danger => "flash-error",
|
24
|
-
:success => "flash-success"
|
25
|
-
}.freeze
|
26
|
-
# @example Schemes
|
27
|
-
# <%= render(Primer::FlashComponent.new) { "This is a flash message!" } %>
|
28
|
-
# <%= render(Primer::FlashComponent.new(scheme: :warning)) { "This is a warning flash message!" } %>
|
29
|
-
# <%= render(Primer::FlashComponent.new(scheme: :danger)) { "This is a danger flash message!" } %>
|
30
|
-
# <%= render(Primer::FlashComponent.new(scheme: :success)) { "This is a success flash message!" } %>
|
31
|
-
#
|
32
|
-
# @example Full width
|
33
|
-
# <%= render(Primer::FlashComponent.new(full: true)) { "This is a full width flash message!" } %>
|
34
|
-
#
|
35
|
-
# @example Dismissible
|
36
|
-
# <%= render(Primer::FlashComponent.new(dismissible: true)) { "This is a dismissible flash message!" } %>
|
37
|
-
#
|
38
|
-
# @example Icon
|
39
|
-
# <%= render(Primer::FlashComponent.new(icon: :people)) { "This is a flash message with an icon!" } %>
|
40
|
-
#
|
41
|
-
# @example With actions
|
42
|
-
# <%= render(Primer::FlashComponent.new) do |component| %>
|
43
|
-
# This is a flash message with actions!
|
44
|
-
# <% component.action do %>
|
45
|
-
# <%= render(Primer::ButtonComponent.new(size: :small)) { "Take action" } %>
|
46
|
-
# <% end %>
|
47
|
-
# <% end %>
|
48
|
-
#
|
49
|
-
# @param full [Boolean] Whether the component should take up the full width of the screen.
|
50
|
-
# @param spacious [Boolean] Whether to add margin to the bottom of the component.
|
51
|
-
# @param dismissible [Boolean] Whether the component can be dismissed with an X button.
|
52
|
-
# @param icon [Symbol] Name of Octicon icon to use.
|
53
|
-
# @param scheme [Symbol] <%= one_of(Primer::FlashComponent::SCHEME_MAPPINGS.keys) %>
|
54
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
55
|
-
def initialize(full: false, spacious: false, dismissible: false, icon: nil, scheme: DEFAULT_SCHEME, **system_arguments)
|
56
|
-
@icon = icon
|
57
|
-
@dismissible = dismissible
|
58
|
-
@system_arguments = deny_tag_argument(**system_arguments)
|
59
|
-
@system_arguments[:tag] = :div
|
60
|
-
@system_arguments[:classes] = class_names(
|
61
|
-
@system_arguments[:classes],
|
62
|
-
"flash",
|
63
|
-
SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_MAPPINGS.keys, scheme, DEFAULT_SCHEME)],
|
64
|
-
"flash-full": full
|
65
|
-
)
|
66
|
-
@system_arguments[:mb] ||= spacious ? 4 : nil
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= render Primer::BaseComponent.new(**@system_arguments) do -%><%= content -%><%= tooltip -%><% end %>
|