primer_view_components 0.0.101 → 0.0.102
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/components/primer/alpha/action_list.rb +0 -2
- data/app/components/primer/alpha/nav_list/item.rb +1 -1
- data/app/components/primer/alpha/toggle_switch.d.ts +2 -1
- data/app/components/primer/alpha/toggle_switch.js +0 -1
- data/app/components/primer/alpha/toggle_switch.ts +1 -1
- data/app/components/primer/alpha/tool-tip-element.d.ts +23 -0
- data/app/components/primer/alpha/tool-tip-element.js +352 -0
- data/app/components/primer/clipboard_copy_component.d.ts +1 -0
- data/app/components/primer/clipboard_copy_component.js +43 -0
- data/app/components/primer/layout_component.html.erb +1 -2
- data/app/components/primer/layout_component.rb +2 -0
- data/lib/primer/deprecations.rb +0 -2
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/tasks/docs.rake +0 -2
- data/lib/tasks/test.rake +21 -1
- data/previews/primer/alpha/underline_nav_preview.rb +1 -1
- data/static/arguments.json +0 -60
- data/static/audited_at.json +0 -2
- data/static/constants.json +0 -60
- data/static/statuses.json +0 -2
- metadata +11 -9
- data/app/components/primer/flex_component.rb +0 -146
- data/app/components/primer/flex_item_component.rb +0 -55
data/static/constants.json
CHANGED
@@ -671,66 +671,6 @@
|
|
671
671
|
"dark": "dropdown-menu-dark"
|
672
672
|
}
|
673
673
|
},
|
674
|
-
"Primer::FlexComponent": {
|
675
|
-
"ALIGN_ITEMS_DEFAULT": null,
|
676
|
-
"ALIGN_ITEMS_MAPPINGS": {
|
677
|
-
"start": "flex-items-start",
|
678
|
-
"end": "flex-items-end",
|
679
|
-
"center": "flex-items-center",
|
680
|
-
"baseline": "flex-items-baseline",
|
681
|
-
"stretch": "flex-items-stretch"
|
682
|
-
},
|
683
|
-
"ALIGN_ITEMS_OPTIONS": [
|
684
|
-
null,
|
685
|
-
"start",
|
686
|
-
"end",
|
687
|
-
"center",
|
688
|
-
"baseline",
|
689
|
-
"stretch"
|
690
|
-
],
|
691
|
-
"ALLOWED_DIRECTIONS": [
|
692
|
-
null,
|
693
|
-
"column",
|
694
|
-
"column_reverse",
|
695
|
-
"row",
|
696
|
-
"row_reverse"
|
697
|
-
],
|
698
|
-
"DEFAULT_DIRECTION": null,
|
699
|
-
"FLEX_WRAP_DEFAULT": null,
|
700
|
-
"FLEX_WRAP_OPTIONS": [
|
701
|
-
null,
|
702
|
-
true,
|
703
|
-
false
|
704
|
-
],
|
705
|
-
"INLINE_DEFAULT": false,
|
706
|
-
"INLINE_OPTIONS": [
|
707
|
-
false,
|
708
|
-
true
|
709
|
-
],
|
710
|
-
"JUSTIFY_CONTENT_DEFAULT": null,
|
711
|
-
"JUSTIFY_CONTENT_MAPPINGS": {
|
712
|
-
"flex_start": "flex-justify-start",
|
713
|
-
"flex_end": "flex-justify-end",
|
714
|
-
"center": "flex-justify-center",
|
715
|
-
"space_between": "flex-justify-between",
|
716
|
-
"space_around": "flex-justify-around"
|
717
|
-
},
|
718
|
-
"JUSTIFY_CONTENT_OPTIONS": [
|
719
|
-
null,
|
720
|
-
"flex_start",
|
721
|
-
"flex_end",
|
722
|
-
"center",
|
723
|
-
"space_between",
|
724
|
-
"space_around"
|
725
|
-
]
|
726
|
-
},
|
727
|
-
"Primer::FlexItemComponent": {
|
728
|
-
"FLEX_AUTO_ALLOWED_VALUES": [
|
729
|
-
false,
|
730
|
-
true
|
731
|
-
],
|
732
|
-
"FLEX_AUTO_DEFAULT": false
|
733
|
-
},
|
734
674
|
"Primer::HeadingComponent": {
|
735
675
|
},
|
736
676
|
"Primer::HellipButton": {
|
data/static/statuses.json
CHANGED
@@ -60,8 +60,6 @@
|
|
60
60
|
"Primer::Dropdown::Menu": "alpha",
|
61
61
|
"Primer::Dropdown::Menu::Item": "alpha",
|
62
62
|
"Primer::DropdownMenuComponent": "deprecated",
|
63
|
-
"Primer::FlexComponent": "deprecated",
|
64
|
-
"Primer::FlexItemComponent": "deprecated",
|
65
63
|
"Primer::HeadingComponent": "deprecated",
|
66
64
|
"Primer::HellipButton": "alpha",
|
67
65
|
"Primer::HiddenTextExpander": "deprecated",
|
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.102
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -394,7 +394,7 @@ dependencies:
|
|
394
394
|
- - "~>"
|
395
395
|
- !ruby/object:Gem::Version
|
396
396
|
version: 0.9.25
|
397
|
-
description:
|
397
|
+
description:
|
398
398
|
email:
|
399
399
|
- opensource+primer_view_components@github.com
|
400
400
|
executables: []
|
@@ -452,6 +452,8 @@ files:
|
|
452
452
|
- app/components/primer/alpha/toggle_switch.js
|
453
453
|
- app/components/primer/alpha/toggle_switch.rb
|
454
454
|
- app/components/primer/alpha/toggle_switch.ts
|
455
|
+
- app/components/primer/alpha/tool-tip-element.d.ts
|
456
|
+
- app/components/primer/alpha/tool-tip-element.js
|
455
457
|
- app/components/primer/alpha/tool_tip.d.ts
|
456
458
|
- app/components/primer/alpha/tool_tip.js
|
457
459
|
- app/components/primer/alpha/tool_tip.ts
|
@@ -508,6 +510,8 @@ files:
|
|
508
510
|
- app/components/primer/clipboard_copy.js
|
509
511
|
- app/components/primer/clipboard_copy.rb
|
510
512
|
- app/components/primer/clipboard_copy.ts
|
513
|
+
- app/components/primer/clipboard_copy_component.d.ts
|
514
|
+
- app/components/primer/clipboard_copy_component.js
|
511
515
|
- app/components/primer/close_button.rb
|
512
516
|
- app/components/primer/component.rb
|
513
517
|
- app/components/primer/conditional_wrapper.rb
|
@@ -526,8 +530,6 @@ files:
|
|
526
530
|
- app/components/primer/dropdown/menu.ts
|
527
531
|
- app/components/primer/dropdown_menu_component.html.erb
|
528
532
|
- app/components/primer/dropdown_menu_component.rb
|
529
|
-
- app/components/primer/flex_component.rb
|
530
|
-
- app/components/primer/flex_item_component.rb
|
531
533
|
- app/components/primer/heading_component.rb
|
532
534
|
- app/components/primer/hellip_button.rb
|
533
535
|
- app/components/primer/hidden_text_expander.rb
|
@@ -813,7 +815,7 @@ licenses:
|
|
813
815
|
- MIT
|
814
816
|
metadata:
|
815
817
|
allowed_push_host: https://rubygems.org
|
816
|
-
post_install_message:
|
818
|
+
post_install_message:
|
817
819
|
rdoc_options: []
|
818
820
|
require_paths:
|
819
821
|
- lib
|
@@ -828,8 +830,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
828
830
|
- !ruby/object:Gem::Version
|
829
831
|
version: '0'
|
830
832
|
requirements: []
|
831
|
-
rubygems_version: 3.
|
832
|
-
signing_key:
|
833
|
+
rubygems_version: 3.2.22
|
834
|
+
signing_key:
|
833
835
|
specification_version: 4
|
834
836
|
summary: ViewComponents for the Primer Design System
|
835
837
|
test_files: []
|
@@ -1,146 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Primer
|
4
|
-
# Use `Flex` to make an element lay out its content using the flexbox model.
|
5
|
-
# Before using these utilities, you should be familiar with CSS3 Flexible Box
|
6
|
-
# spec. If you are not, check out MDN's guide [Using CSS Flexible
|
7
|
-
# Boxes](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox).
|
8
|
-
#
|
9
|
-
# @deprecated
|
10
|
-
# Use <%= link_to_component(Primer::Box) %> instead.
|
11
|
-
#
|
12
|
-
# **Before**:
|
13
|
-
#
|
14
|
-
# ```erb
|
15
|
-
# <%%= render Primer::FlexComponent.new(justify_content: :center) %>
|
16
|
-
# <%%= render Primer::FlexComponent.new(inline: true) %>
|
17
|
-
# <%%= render Primer::FlexComponent.new(flex_wrap: true) %>
|
18
|
-
# <%%= render Primer::FlexComponent.new(align_items: :start) %>
|
19
|
-
# <%%= render Primer::FlexComponent.new(direction: :column) %>
|
20
|
-
# ```
|
21
|
-
#
|
22
|
-
# **After**:
|
23
|
-
#
|
24
|
-
# ```erb
|
25
|
-
# <%%= render Primer::Box.new(display: :flex, justify_content: :center) %>
|
26
|
-
# <%%= render Primer::Box.new(display: :inline_flex) %>
|
27
|
-
# <%%= render Primer::Box.new(display: :flex, flex_wrap: :wrap) %>
|
28
|
-
# <%%= render Primer::Box.new(display: :flex, align_items: :start) %>
|
29
|
-
# <%%= render Primer::Box.new(display: :flex, direction: :column) %>
|
30
|
-
# ```
|
31
|
-
class FlexComponent < Primer::Component
|
32
|
-
status :deprecated
|
33
|
-
|
34
|
-
JUSTIFY_CONTENT_DEFAULT = nil
|
35
|
-
JUSTIFY_CONTENT_MAPPINGS = {
|
36
|
-
flex_start: "flex-justify-start",
|
37
|
-
flex_end: "flex-justify-end",
|
38
|
-
center: "flex-justify-center",
|
39
|
-
space_between: "flex-justify-between",
|
40
|
-
space_around: "flex-justify-around"
|
41
|
-
}.freeze
|
42
|
-
JUSTIFY_CONTENT_OPTIONS = [JUSTIFY_CONTENT_DEFAULT, *JUSTIFY_CONTENT_MAPPINGS.keys].freeze
|
43
|
-
|
44
|
-
ALIGN_ITEMS_DEFAULT = nil
|
45
|
-
ALIGN_ITEMS_MAPPINGS = {
|
46
|
-
start: "flex-items-start",
|
47
|
-
end: "flex-items-end",
|
48
|
-
center: "flex-items-center",
|
49
|
-
baseline: "flex-items-baseline",
|
50
|
-
stretch: "flex-items-stretch"
|
51
|
-
}.freeze
|
52
|
-
ALIGN_ITEMS_OPTIONS = [ALIGN_ITEMS_DEFAULT, *ALIGN_ITEMS_MAPPINGS.keys].freeze
|
53
|
-
|
54
|
-
INLINE_DEFAULT = false
|
55
|
-
INLINE_OPTIONS = [INLINE_DEFAULT, true].freeze
|
56
|
-
|
57
|
-
FLEX_WRAP_DEFAULT = nil
|
58
|
-
FLEX_WRAP_OPTIONS = [FLEX_WRAP_DEFAULT, true, false].freeze
|
59
|
-
|
60
|
-
DEFAULT_DIRECTION = nil
|
61
|
-
ALLOWED_DIRECTIONS = [DEFAULT_DIRECTION, :column, :column_reverse, :row, :row_reverse].freeze
|
62
|
-
|
63
|
-
# @example Default
|
64
|
-
# <%= render(Primer::FlexComponent.new(bg: :subtle)) do %>
|
65
|
-
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 1" } %>
|
66
|
-
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 2" } %>
|
67
|
-
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 3" } %>
|
68
|
-
# <% end %>
|
69
|
-
#
|
70
|
-
# @example Justify center
|
71
|
-
# <%= render(Primer::FlexComponent.new(justify_content: :center, bg: :subtle)) do %>
|
72
|
-
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 1" } %>
|
73
|
-
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 2" } %>
|
74
|
-
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 3" } %>
|
75
|
-
# <% end %>
|
76
|
-
#
|
77
|
-
# @example Align end
|
78
|
-
# <%= render(Primer::FlexComponent.new(align_items: :end, bg: :subtle)) do %>
|
79
|
-
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 1" } %>
|
80
|
-
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 2" } %>
|
81
|
-
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 3" } %>
|
82
|
-
# <% end %>
|
83
|
-
#
|
84
|
-
# @example Direction column
|
85
|
-
# <%= render(Primer::FlexComponent.new(direction: :column, bg: :subtle)) do %>
|
86
|
-
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 1" } %>
|
87
|
-
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 2" } %>
|
88
|
-
# <%= render(Primer::Box.new(p: 5, bg: :subtle, classes: "border")) { "Item 3" } %>
|
89
|
-
# <% end %>
|
90
|
-
#
|
91
|
-
# @param justify_content [Symbol] Use this param to distribute space between and around flex items along the main axis of the container. <%= one_of(Primer::FlexComponent::JUSTIFY_CONTENT_OPTIONS) %>
|
92
|
-
# @param inline [Boolean] Defaults to false.
|
93
|
-
# @param flex_wrap [Boolean] Defaults to nil.
|
94
|
-
# @param align_items [Symbol] Use this param to align items on the cross axis. <%= one_of(Primer::FlexComponent::ALIGN_ITEMS_OPTIONS) %>
|
95
|
-
# @param direction [Symbol] Use this param to define the orientation of the main axis (row or column). By default, flex items will display in a row. <%= one_of(Primer::FlexComponent::ALLOWED_DIRECTIONS) %>
|
96
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
97
|
-
def initialize(
|
98
|
-
justify_content: JUSTIFY_CONTENT_DEFAULT,
|
99
|
-
inline: INLINE_DEFAULT,
|
100
|
-
flex_wrap: FLEX_WRAP_DEFAULT,
|
101
|
-
align_items: ALIGN_ITEMS_DEFAULT,
|
102
|
-
direction: nil,
|
103
|
-
**system_arguments
|
104
|
-
)
|
105
|
-
deprecated_component_warning(new_class: Primer::Box, version: "0.0.40")
|
106
|
-
|
107
|
-
@align_items = fetch_or_fallback(ALIGN_ITEMS_OPTIONS, align_items, ALIGN_ITEMS_DEFAULT)
|
108
|
-
@justify_content = fetch_or_fallback(JUSTIFY_CONTENT_OPTIONS, justify_content, JUSTIFY_CONTENT_DEFAULT)
|
109
|
-
@flex_wrap = fetch_or_fallback(FLEX_WRAP_OPTIONS, flex_wrap, FLEX_WRAP_DEFAULT)
|
110
|
-
|
111
|
-
# Support direction argument that is an array
|
112
|
-
@direction =
|
113
|
-
if (Array(direction) - ALLOWED_DIRECTIONS).empty?
|
114
|
-
direction
|
115
|
-
else
|
116
|
-
DEFAULT_DIRECTION
|
117
|
-
end
|
118
|
-
|
119
|
-
@system_arguments = system_arguments.merge({ direction: @direction }.compact)
|
120
|
-
@system_arguments[:classes] = class_names(@system_arguments[:classes], component_class_names)
|
121
|
-
@system_arguments[:display] = fetch_or_fallback(INLINE_OPTIONS, inline, INLINE_DEFAULT) ? :inline_flex : :flex
|
122
|
-
end
|
123
|
-
|
124
|
-
def call
|
125
|
-
render(Primer::Box.new(**@system_arguments)) { content }
|
126
|
-
end
|
127
|
-
|
128
|
-
private
|
129
|
-
|
130
|
-
def component_class_names
|
131
|
-
out = []
|
132
|
-
out << JUSTIFY_CONTENT_MAPPINGS[@justify_content]
|
133
|
-
out << ALIGN_ITEMS_MAPPINGS[@align_items]
|
134
|
-
|
135
|
-
out <<
|
136
|
-
case @flex_wrap
|
137
|
-
when true
|
138
|
-
"flex-wrap"
|
139
|
-
when false
|
140
|
-
"flex-nowrap"
|
141
|
-
end
|
142
|
-
|
143
|
-
out.compact.join(" ")
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Primer
|
4
|
-
# Use `FlexItem` to specify the ability of a flex item to alter its
|
5
|
-
# dimensions to fill available space.
|
6
|
-
#
|
7
|
-
# @deprecated
|
8
|
-
# Use <%= link_to_component(Primer::Box) %> instead.
|
9
|
-
#
|
10
|
-
# **Before**:
|
11
|
-
#
|
12
|
-
# ```erb
|
13
|
-
# <%%= render Primer::FlexItemComponent.new(flex_auto: :auto) %>
|
14
|
-
# ```
|
15
|
-
#
|
16
|
-
# **After**:
|
17
|
-
#
|
18
|
-
# ```erb
|
19
|
-
# <%%= render Primer::Box.new(flex: :auto) %>
|
20
|
-
# ```
|
21
|
-
class FlexItemComponent < Primer::Component
|
22
|
-
status :deprecated
|
23
|
-
|
24
|
-
FLEX_AUTO_DEFAULT = false
|
25
|
-
FLEX_AUTO_ALLOWED_VALUES = [FLEX_AUTO_DEFAULT, true].freeze
|
26
|
-
|
27
|
-
# @example Default
|
28
|
-
# <%= render(Primer::FlexComponent.new) do %>
|
29
|
-
# <%= render(Primer::FlexItemComponent.new) do %>
|
30
|
-
# Item 1
|
31
|
-
# <% end %>
|
32
|
-
#
|
33
|
-
# <%= render(Primer::FlexItemComponent.new(flex_auto: true)) do %>
|
34
|
-
# Item 2
|
35
|
-
# <% end %>
|
36
|
-
# <% end %>
|
37
|
-
#
|
38
|
-
# @param flex_auto [Boolean] Fills available space and auto-sizes based on the content. Defaults to <%= Primer::FlexItemComponent::FLEX_AUTO_DEFAULT %>
|
39
|
-
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
40
|
-
def initialize(flex_auto: FLEX_AUTO_DEFAULT, **system_arguments)
|
41
|
-
deprecated_component_warning(new_class: Primer::Box, version: "0.0.40")
|
42
|
-
|
43
|
-
@system_arguments = system_arguments
|
44
|
-
@system_arguments[:classes] =
|
45
|
-
class_names(
|
46
|
-
@system_arguments[:classes],
|
47
|
-
"flex-auto" => fetch_or_fallback(FLEX_AUTO_ALLOWED_VALUES, flex_auto, FLEX_AUTO_DEFAULT)
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
def call
|
52
|
-
render(Primer::Box.new(**@system_arguments)) { content }
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|