primer_view_components 0.0.111 → 0.0.113
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +68 -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 +3 -1
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.json +1 -1
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/action_list.pcss +0 -15
- data/app/components/primer/alpha/auto_complete.css +1 -0
- data/app/components/primer/alpha/auto_complete.css.json +1 -0
- data/app/components/primer/alpha/auto_complete.css.map +1 -0
- data/app/components/primer/alpha/auto_complete.pcss +118 -0
- data/app/components/primer/alpha/banner.css +1 -1
- data/app/components/primer/alpha/banner.css.map +1 -1
- data/app/components/primer/alpha/banner.pcss +0 -1
- data/app/components/primer/alpha/button_marketing.css +1 -0
- data/app/components/primer/alpha/button_marketing.css.json +1 -0
- data/app/components/primer/alpha/button_marketing.css.map +1 -0
- data/app/components/primer/alpha/button_marketing.pcss +175 -0
- data/app/components/primer/alpha/dialog/body.rb +3 -0
- data/app/components/primer/alpha/dialog/footer.rb +3 -0
- data/app/components/primer/alpha/dialog/header.rb +3 -0
- data/app/components/primer/alpha/dialog.css +1 -0
- data/app/components/primer/alpha/dialog.css.json +1 -0
- data/app/components/primer/alpha/dialog.css.map +1 -0
- data/app/components/primer/alpha/dialog.pcss +484 -0
- data/app/components/primer/alpha/dialog.rb +3 -0
- data/app/components/primer/{dropdown → alpha/dropdown}/menu.d.ts +0 -0
- data/app/components/primer/{dropdown → alpha/dropdown}/menu.html.erb +0 -0
- data/app/components/primer/{dropdown → alpha/dropdown}/menu.js +0 -0
- data/app/components/primer/alpha/dropdown/menu.rb +105 -0
- data/app/components/primer/{dropdown → alpha/dropdown}/menu.ts +0 -0
- data/app/components/primer/alpha/dropdown.css +1 -0
- data/app/components/primer/alpha/dropdown.css.json +1 -0
- data/app/components/primer/{dropdown.css.map → alpha/dropdown.css.map} +1 -1
- data/app/components/primer/{dropdown.d.ts → alpha/dropdown.d.ts} +0 -0
- data/app/components/primer/{dropdown.html.erb → alpha/dropdown.html.erb} +0 -0
- data/app/components/primer/{dropdown.js → alpha/dropdown.js} +0 -0
- data/app/components/primer/{dropdown.pcss → alpha/dropdown.pcss} +1 -1
- data/app/components/primer/alpha/dropdown.rb +154 -0
- data/app/components/primer/{dropdown.ts → alpha/dropdown.ts} +0 -0
- data/app/components/primer/alpha/segmented_control.css +1 -1
- data/app/components/primer/alpha/segmented_control.css.map +1 -1
- data/app/components/primer/alpha/tab_nav.css +1 -0
- data/app/components/primer/alpha/tab_nav.css.json +1 -0
- data/app/components/primer/alpha/tab_nav.css.map +1 -0
- data/app/components/primer/alpha/tab_nav.pcss +100 -0
- data/app/components/primer/alpha/text_field.css +3 -0
- data/app/components/primer/alpha/text_field.css.json +1 -0
- data/app/components/primer/alpha/text_field.css.map +1 -0
- data/app/components/primer/alpha/text_field.pcss +683 -0
- data/app/components/primer/alpha/toggle_switch.d.ts +1 -1
- data/app/components/primer/alpha/toggle_switch.js +7 -4
- data/app/components/primer/alpha/toggle_switch.ts +7 -3
- data/app/components/primer/alpha/underline_nav.css +1 -0
- data/app/components/primer/alpha/underline_nav.css.json +1 -0
- data/app/components/primer/alpha/underline_nav.css.map +1 -0
- data/app/components/primer/alpha/underline_nav.pcss +133 -0
- data/app/components/primer/beta/border_box.css +1 -0
- data/app/components/primer/beta/border_box.css.json +1 -0
- data/app/components/primer/beta/border_box.css.map +1 -0
- data/app/components/primer/beta/border_box.pcss +284 -0
- data/app/components/primer/beta/button_group.css +1 -0
- data/app/components/primer/beta/button_group.css.json +1 -0
- data/app/components/primer/beta/button_group.css.map +1 -0
- data/app/components/primer/beta/button_group.pcss +92 -0
- data/app/components/primer/{clipboard_copy.d.ts → beta/clipboard_copy.d.ts} +0 -0
- data/app/components/primer/{clipboard_copy.html.erb → beta/clipboard_copy.html.erb} +0 -0
- data/app/components/primer/{clipboard_copy.js → beta/clipboard_copy.js} +0 -0
- data/app/components/primer/beta/clipboard_copy.rb +50 -0
- data/app/components/primer/{clipboard_copy.ts → beta/clipboard_copy.ts} +0 -0
- data/app/components/primer/beta/link.css +1 -0
- data/app/components/primer/beta/link.css.json +1 -0
- data/app/components/primer/beta/link.css.map +1 -0
- data/app/components/primer/beta/link.pcss +60 -0
- data/app/components/primer/{popover_component.css → beta/popover.css} +0 -0
- data/app/components/primer/beta/popover.css.json +1 -0
- data/app/components/primer/beta/popover.css.map +1 -0
- data/app/components/primer/{popover_component.html.erb → beta/popover.html.erb} +0 -0
- data/app/components/primer/{popover_component.pcss → beta/popover.pcss} +5 -5
- data/app/components/primer/beta/popover.rb +127 -0
- data/app/components/primer/beta/relative_time.rb +160 -0
- data/app/components/primer/button_component.css +1 -0
- data/app/components/primer/button_component.css.json +1 -0
- data/app/components/primer/button_component.css.map +1 -0
- data/app/components/primer/button_component.pcss +557 -0
- data/app/components/primer/button_component.rb +1 -1
- data/app/components/primer/clipboard_copy.rb +2 -43
- data/app/components/primer/component.rb +6 -2
- data/app/components/primer/dropdown/menu.rb +5 -90
- data/app/components/primer/dropdown.rb +2 -145
- data/app/components/primer/local_time.d.ts +1 -1
- data/app/components/primer/local_time.js +1 -1
- data/app/components/primer/local_time.rb +3 -1
- data/app/components/primer/local_time.ts +1 -1
- data/app/components/primer/menu_component.css +1 -0
- data/app/components/primer/menu_component.css.json +1 -0
- data/app/components/primer/menu_component.css.map +1 -0
- data/app/components/primer/menu_component.pcss +119 -0
- data/app/components/primer/popover_component.rb +3 -120
- data/app/components/primer/primer.d.ts +2 -2
- data/app/components/primer/primer.js +2 -2
- data/app/components/primer/primer.pcss +20 -3
- data/app/components/primer/primer.ts +2 -2
- data/app/components/primer/time_ago_component.d.ts +1 -1
- data/app/components/primer/time_ago_component.js +1 -1
- data/app/components/primer/time_ago_component.rb +2 -1
- data/app/components/primer/time_ago_component.ts +1 -1
- data/app/forms/submit_button_form.rb +8 -2
- data/app/helpers/primer/form_helper.rb +12 -0
- data/lib/postcss_mixins/clearfix.pcss +12 -0
- data/lib/primer/deprecations.rb +96 -24
- data/lib/primer/deprecations.yml +68 -0
- data/lib/primer/forms/base.rb +7 -20
- data/lib/primer/forms/base_component.rb +15 -1
- data/lib/primer/forms/button.html.erb +4 -0
- data/lib/primer/forms/button.rb +68 -0
- data/lib/primer/forms/check_box.html.erb +2 -2
- data/lib/primer/forms/check_box.rb +1 -1
- data/lib/primer/forms/check_box_group.html.erb +2 -2
- data/lib/primer/forms/dsl/button_input.rb +29 -0
- data/lib/primer/forms/dsl/input_methods.rb +7 -2
- data/lib/primer/forms/dsl/submit_button_input.rb +1 -0
- data/lib/primer/forms/dsl/text_field_input.rb +0 -7
- data/lib/primer/forms/radio_button.html.erb +2 -2
- data/lib/primer/forms/radio_button.rb +1 -1
- data/lib/primer/forms/radio_button_group.html.erb +2 -2
- data/lib/primer/forms/select_list.html.erb +1 -1
- data/lib/primer/forms/select_list.rb +4 -1
- data/lib/primer/forms/submit_button.html.erb +1 -4
- data/lib/primer/forms/submit_button.rb +1 -37
- data/lib/primer/forms/text_area.html.erb +1 -1
- data/lib/primer/forms/text_area.rb +5 -1
- data/lib/primer/forms/text_field.html.erb +1 -1
- data/lib/primer/forms/text_field.rb +11 -0
- data/lib/primer/forms/utils.rb +28 -0
- data/lib/primer/view_components/audited.rb +14 -0
- data/lib/primer/view_components/engine.rb +1 -0
- data/lib/primer/view_components/linters/clipboard_copy_component_migration_counter.rb +2 -2
- data/lib/primer/view_components/linters/deprecated_components_counter.rb +15 -4
- data/lib/primer/view_components/linters/helpers/deprecated_components_helpers.rb +3 -18
- data/lib/primer/view_components/linters/severity_schema.rb +14 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/rubocop/cop/primer/component_name_migration.rb +2 -2
- data/lib/tasks/docs.rake +6 -5
- data/previews/primer/alpha/auto_complete_preview.rb +12 -0
- data/previews/primer/alpha/button_marketing_preview.rb +36 -0
- data/previews/primer/alpha/dropdown_preview.rb +210 -0
- data/previews/primer/alpha/segmented_control_preview.rb +9 -6
- data/previews/primer/alpha/tab_nav_preview.rb +55 -0
- data/previews/primer/alpha/text_field_preview.rb +77 -52
- data/previews/primer/beta/border_box_preview.rb +65 -13
- data/previews/primer/beta/clipboard_copy_preview/element.html.erb +2 -0
- data/previews/primer/beta/clipboard_copy_preview.rb +39 -0
- data/previews/primer/beta/link_preview.rb +28 -0
- data/previews/primer/beta/popover_preview.rb +79 -0
- data/previews/primer/beta/relative_time_preview.rb +271 -0
- data/previews/primer/forms/forms_preview.rb +1 -0
- data/static/arguments.json +183 -73
- data/static/audited_at.json +10 -6
- data/static/constants.json +180 -50
- data/static/statuses.json +12 -8
- metadata +86 -29
- data/app/components/primer/dropdown.css +0 -1
- data/app/components/primer/dropdown.css.json +0 -1
- data/app/components/primer/image.rb +0 -7
- data/app/components/primer/popover_component.css.json +0 -1
- data/app/components/primer/popover_component.css.map +0 -1
- data/app/components/primer/progress_bar_component.rb +0 -7
- data/previews/primer/clipboard_copy_preview/element.html.erb +0 -2
- data/previews/primer/clipboard_copy_preview.rb +0 -37
- data/previews/primer/dropdown_preview.rb +0 -208
- data/previews/primer/popover_component_preview.rb +0 -34
@@ -63,62 +63,87 @@ module Primer
|
|
63
63
|
end
|
64
64
|
|
65
65
|
# @label Default
|
66
|
+
def default
|
67
|
+
render(Primer::Alpha::TextField.new(name: "my-text-field", label: "My text field"))
|
68
|
+
end
|
69
|
+
|
70
|
+
# @!group Sizes
|
66
71
|
#
|
67
|
-
# @
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
# @param size [Symbol] select [small, medium, large]
|
72
|
-
# @param show_clear_button toggle
|
73
|
-
# @param clear_button_id text
|
74
|
-
# @param full_width toggle
|
75
|
-
# @param disabled toggle
|
76
|
-
# @param invalid toggle
|
77
|
-
# @param placeholder text
|
78
|
-
# @param inset toggle
|
79
|
-
# @param monospace toggle
|
80
|
-
# @param leading_visual_icon text
|
81
|
-
def default(
|
82
|
-
name: "my-text-field",
|
83
|
-
id: "my-text-field",
|
84
|
-
label: "My text field",
|
85
|
-
visually_hide_label: false,
|
86
|
-
size: Primer::Forms::Dsl::Input::DEFAULT_SIZE.to_s,
|
87
|
-
show_clear_button: false,
|
88
|
-
clear_button_id: "my-text-field-clear-button",
|
89
|
-
full_width: false,
|
90
|
-
disabled: false,
|
91
|
-
invalid: false,
|
92
|
-
placeholder: nil,
|
93
|
-
inset: false,
|
94
|
-
monospace: false,
|
95
|
-
leading_visual_icon: nil
|
96
|
-
)
|
97
|
-
system_arguments = {
|
98
|
-
name: name,
|
99
|
-
id: id,
|
100
|
-
label: label,
|
101
|
-
visually_hide_label: visually_hide_label,
|
102
|
-
size: size,
|
103
|
-
show_clear_button: show_clear_button,
|
104
|
-
clear_button_id: clear_button_id,
|
105
|
-
full_width: full_width,
|
106
|
-
disabled: disabled,
|
107
|
-
invalid: invalid,
|
108
|
-
placeholder: placeholder,
|
109
|
-
inset: inset,
|
110
|
-
monospace: monospace
|
111
|
-
}
|
72
|
+
# @label Small
|
73
|
+
def size_small
|
74
|
+
render(Primer::Alpha::TextField.new(size: :small, visually_hide_label: true, name: "my-text-field", label: "My text field"))
|
75
|
+
end
|
112
76
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
}
|
118
|
-
end
|
77
|
+
# @label Medium
|
78
|
+
def size_medium
|
79
|
+
render(Primer::Alpha::TextField.new(size: :medium, visually_hide_label: true, name: "my-text-field", label: "My text field"))
|
80
|
+
end
|
119
81
|
|
120
|
-
|
82
|
+
# @label Large
|
83
|
+
def size_large
|
84
|
+
render(Primer::Alpha::TextField.new(size: :large, visually_hide_label: true, name: "my-text-field", label: "My text field"))
|
85
|
+
end
|
86
|
+
#
|
87
|
+
# @!endgroup
|
88
|
+
|
89
|
+
# @!group Options
|
90
|
+
#
|
91
|
+
# @label With caption
|
92
|
+
def with_caption
|
93
|
+
render(Primer::Alpha::TextField.new(caption: "With a caption", name: "my-text-field", label: "My text field"))
|
94
|
+
end
|
95
|
+
|
96
|
+
# @label Visually hidden label
|
97
|
+
def visually_hide_label
|
98
|
+
render(Primer::Alpha::TextField.new(visually_hide_label: true, name: "my-text-field", label: "My text field"))
|
99
|
+
end
|
100
|
+
|
101
|
+
# @label Show clear button
|
102
|
+
def show_clear_button
|
103
|
+
render(Primer::Alpha::TextField.new(show_clear_button: true, name: "my-text-field", label: "My text field"))
|
104
|
+
end
|
105
|
+
|
106
|
+
# @label Full width
|
107
|
+
def full_width
|
108
|
+
render(Primer::Alpha::TextField.new(full_width: true, name: "my-text-field", label: "My text field"))
|
109
|
+
end
|
110
|
+
|
111
|
+
# @label Disabled
|
112
|
+
def disabled
|
113
|
+
render(Primer::Alpha::TextField.new(disabled: true, name: "my-text-field", label: "My text field"))
|
114
|
+
end
|
115
|
+
|
116
|
+
# @label Invalid
|
117
|
+
def invalid
|
118
|
+
render(Primer::Alpha::TextField.new(invalid: true, name: "my-text-field", label: "My text field"))
|
119
|
+
end
|
120
|
+
|
121
|
+
# @label With placeholder
|
122
|
+
def with_placeholder
|
123
|
+
render(Primer::Alpha::TextField.new(placeholder: "with a placeholder", name: "my-text-field", label: "My text field"))
|
124
|
+
end
|
125
|
+
|
126
|
+
# @label Inset
|
127
|
+
def inset
|
128
|
+
render(Primer::Alpha::TextField.new(inset: true, name: "my-text-field", label: "My text field"))
|
129
|
+
end
|
130
|
+
|
131
|
+
# @label Monospace
|
132
|
+
def monospace
|
133
|
+
render(Primer::Alpha::TextField.new(monospace: true, name: "my-text-field", label: "My text field"))
|
121
134
|
end
|
135
|
+
|
136
|
+
# @label With leading visual
|
137
|
+
def with_leading_visual
|
138
|
+
render(Primer::Alpha::TextField.new(leading_visual: { icon: :search }, name: "my-text-field", label: "My text field"))
|
139
|
+
end
|
140
|
+
|
141
|
+
# @label With validation message
|
142
|
+
def with_validation_message
|
143
|
+
render(Primer::Alpha::TextField.new(validation_message: "An error occurred!", name: "my-text-field", label: "My text field"))
|
144
|
+
end
|
145
|
+
#
|
146
|
+
# @!endgroup
|
122
147
|
end
|
123
148
|
end
|
124
149
|
end
|
@@ -6,9 +6,22 @@ module Primer
|
|
6
6
|
class BorderBoxPreview < ViewComponent::Preview
|
7
7
|
# @label Playground
|
8
8
|
#
|
9
|
-
# @param padding [Symbol] select [default, condensed]
|
10
|
-
|
9
|
+
# @param padding [Symbol] select [default, condensed, spacious]
|
10
|
+
# @param scheme [Symbol] select [default, neutral, info, warning]
|
11
|
+
def playground(padding: :default, scheme: :default)
|
11
12
|
render(Primer::Beta::BorderBox.new(padding: padding)) do |component|
|
13
|
+
component.header { "Header" }
|
14
|
+
component.body { "Body" }
|
15
|
+
component.row(scheme: scheme) { "#{scheme.to_s.capitalize} row one" }
|
16
|
+
component.row(scheme: scheme) { "#{scheme.to_s.capitalize} row two" }
|
17
|
+
component.row(scheme: scheme) { "#{scheme.to_s.capitalize} row three" }
|
18
|
+
component.footer { "Footer" }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# @label Default
|
23
|
+
def default
|
24
|
+
render(Primer::Beta::BorderBox.new) do |component|
|
12
25
|
component.header { "Header" }
|
13
26
|
component.body { "Body" }
|
14
27
|
component.row { "Row one" }
|
@@ -18,11 +31,34 @@ module Primer
|
|
18
31
|
end
|
19
32
|
end
|
20
33
|
|
21
|
-
# @label
|
34
|
+
# @label Header with title
|
35
|
+
def header_with_title
|
36
|
+
render(Primer::Beta::BorderBox.new) do |component|
|
37
|
+
component.with_header do |h|
|
38
|
+
h.title(tag: :h2) do
|
39
|
+
"Header with title"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
component.body { "Body" }
|
43
|
+
component.footer { "Footer" }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# @label Row colors
|
48
|
+
def row_colors
|
49
|
+
render(Primer::Beta::BorderBox.new) do |component|
|
50
|
+
component.row(scheme: :default) { "Default" }
|
51
|
+
component.row(scheme: :neutral) { "Neutral" }
|
52
|
+
component.row(scheme: :info) { "Info" }
|
53
|
+
component.row(scheme: :warning) { "Warning" }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# @!group Padding
|
22
58
|
#
|
23
|
-
# @
|
24
|
-
def
|
25
|
-
render(Primer::Beta::BorderBox.new
|
59
|
+
# @label Default
|
60
|
+
def padding_default
|
61
|
+
render(Primer::Beta::BorderBox.new) do |component|
|
26
62
|
component.header { "Header" }
|
27
63
|
component.body { "Body" }
|
28
64
|
component.row { "Row one" }
|
@@ -32,15 +68,31 @@ module Primer
|
|
32
68
|
end
|
33
69
|
end
|
34
70
|
|
35
|
-
# @label
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
component.row
|
71
|
+
# @label Condensed
|
72
|
+
def padding_condensed
|
73
|
+
render(Primer::Beta::BorderBox.new(padding: :condensed)) do |component|
|
74
|
+
component.header { "Header" }
|
75
|
+
component.body { "Body" }
|
76
|
+
component.row { "Row one" }
|
77
|
+
component.row { "Row two" }
|
78
|
+
component.row { "Row three" }
|
79
|
+
component.footer { "Footer" }
|
42
80
|
end
|
43
81
|
end
|
82
|
+
|
83
|
+
# @label Spacious
|
84
|
+
def padding_spacious
|
85
|
+
render(Primer::Beta::BorderBox.new(padding: :spacious)) do |component|
|
86
|
+
component.header { "Header" }
|
87
|
+
component.body { "Body" }
|
88
|
+
component.row { "Row one" }
|
89
|
+
component.row { "Row two" }
|
90
|
+
component.row { "Row three" }
|
91
|
+
component.footer { "Footer" }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
#
|
95
|
+
# @!endgroup
|
44
96
|
end
|
45
97
|
end
|
46
98
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Beta
|
5
|
+
# @label ClipboardCopy
|
6
|
+
class ClipboardCopyPreview < ViewComponent::Preview
|
7
|
+
# @label Playground
|
8
|
+
#
|
9
|
+
# @param aria_label [String]
|
10
|
+
# @param value [String]
|
11
|
+
def playground(value: "Text to copy", aria_label: "Copy text to the system clipboard")
|
12
|
+
render(Primer::Beta::ClipboardCopy.new(value: value, "aria-label": aria_label))
|
13
|
+
end
|
14
|
+
|
15
|
+
# @label Default Options
|
16
|
+
#
|
17
|
+
# @param aria_label [String]
|
18
|
+
# @param value [String]
|
19
|
+
def default(value: "Text to copy", aria_label: "Copy text to the system clipboard")
|
20
|
+
render(Primer::Beta::ClipboardCopy.new(value: value, "aria-label": aria_label))
|
21
|
+
end
|
22
|
+
|
23
|
+
# @label With text instead of icons
|
24
|
+
#
|
25
|
+
# @param aria_label [String]
|
26
|
+
# @param value [String]
|
27
|
+
def text(value: "Text to copy", aria_label: "Copy text to the system clipboard")
|
28
|
+
render(Primer::Beta::ClipboardCopy.new(value: value, "aria-label": aria_label)) { "Click to copy!" }
|
29
|
+
end
|
30
|
+
|
31
|
+
# @label Copying from an element
|
32
|
+
#
|
33
|
+
# @param aria_label [String]
|
34
|
+
def element(aria_label: "Copy text to the system clipboard")
|
35
|
+
render_with_template(locals: { aria_label: aria_label })
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -36,6 +36,34 @@ module Primer
|
|
36
36
|
"Link with tooltip"
|
37
37
|
end
|
38
38
|
end
|
39
|
+
|
40
|
+
# @!group Color Scheme
|
41
|
+
#
|
42
|
+
# @label Default
|
43
|
+
def color_scheme_default
|
44
|
+
render(Primer::Beta::Link.new(href: "#")) { "This is a default link color." }
|
45
|
+
end
|
46
|
+
|
47
|
+
# @label Primary
|
48
|
+
def color_scheme_primary
|
49
|
+
render(Primer::Beta::Link.new(href: "#", scheme: :primary)) { "This is a primary link color." }
|
50
|
+
end
|
51
|
+
|
52
|
+
# @label Primary, Muted
|
53
|
+
def color_scheme_primary_muted
|
54
|
+
render(Primer::Beta::Link.new(href: "#", scheme: :primary, muted: true)) { "This is a muted primary link color." }
|
55
|
+
end
|
56
|
+
|
57
|
+
# @label Secondary
|
58
|
+
def color_scheme_secondary
|
59
|
+
render(Primer::Beta::Link.new(href: "#", scheme: :secondary)) { "This is a secondary link color." }
|
60
|
+
end
|
61
|
+
|
62
|
+
# @label Secondary, Muted
|
63
|
+
def color_scheme_secondary_muted
|
64
|
+
render(Primer::Beta::Link.new(href: "#", scheme: :secondary, muted: true)) { "This is a muted secondary link color." }
|
65
|
+
end
|
66
|
+
# @!endgroup
|
39
67
|
end
|
40
68
|
end
|
41
69
|
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Primer
|
4
|
+
module Beta
|
5
|
+
# @label Popover
|
6
|
+
class PopoverPreview < ViewComponent::Preview
|
7
|
+
# @label Playground
|
8
|
+
#
|
9
|
+
# @param caret [Symbol] select [top, right, bottom, left, top_right, top_left, bottom_right, bottom_left, left_bottom, left_top, right_bottom, right_top]
|
10
|
+
def playground(caret: :top)
|
11
|
+
render Primer::Beta::Popover.new do |component|
|
12
|
+
component.with_heading do
|
13
|
+
"Activity feed"
|
14
|
+
end
|
15
|
+
component.with_body(caret: caret) do
|
16
|
+
"This is the Popover body."
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# @label Default
|
22
|
+
#
|
23
|
+
# @param caret [Symbol] select [top, right, bottom, left, top_right, top_left, bottom_right, bottom_left, left_bottom, left_top, right_bottom, right_top]
|
24
|
+
def default(caret: :top)
|
25
|
+
render Primer::Beta::Popover.new do |component|
|
26
|
+
component.with_heading do
|
27
|
+
"Activity feed"
|
28
|
+
end
|
29
|
+
component.with_body(caret: caret) do
|
30
|
+
"This is the Popover body."
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# @label Large
|
36
|
+
def large
|
37
|
+
render Primer::Beta::Popover.new do |component|
|
38
|
+
component.with_body(large: true) do
|
39
|
+
"This is a large Popover body."
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# @!group Directions
|
45
|
+
def bottom_right
|
46
|
+
render Primer::Beta::Popover.new do |component|
|
47
|
+
component.with_body(caret: :bottom_right) do
|
48
|
+
"This is the Popover body."
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def top_right
|
54
|
+
render Primer::Beta::Popover.new do |component|
|
55
|
+
component.with_body(caret: :top_right) do
|
56
|
+
"This is the Popover body."
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def bottom_left
|
62
|
+
render Primer::Beta::Popover.new do |component|
|
63
|
+
component.with_body(caret: :bottom_left) do
|
64
|
+
"This is the Popover body."
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def top_left
|
70
|
+
render Primer::Beta::Popover.new do |component|
|
71
|
+
component.with_body(caret: :top_left) do
|
72
|
+
"This is the Popover body."
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
# @!endgroup
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,271 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Setup Playground to use all available component props
|
4
|
+
# Setup Features to use individual component props and combinations
|
5
|
+
|
6
|
+
module Primer
|
7
|
+
module Beta
|
8
|
+
# @label RelativeTime
|
9
|
+
class RelativeTimePreview < ViewComponent::Preview
|
10
|
+
# @label Playground
|
11
|
+
# @param datetime datetime-local
|
12
|
+
# @param tense [Symbol] select [~, auto, past, future]
|
13
|
+
# @param prefix [String] text
|
14
|
+
# @param second [Symbol] select [~, numeric, two_digit]
|
15
|
+
# @param minute [Symbol] select [~, numeric, two_digit]
|
16
|
+
# @param hour [Symbol] select [~, numeric, two_digit]
|
17
|
+
# @param weekday [Symbol] select [~, long, short, narrow]
|
18
|
+
# @param day [Symbol] select [~, numeric, two_digit]
|
19
|
+
# @param month [Symbol] select [~, numeric, two_digit, short, long, narrow]
|
20
|
+
# @param year [Symbol] select [~, numeric, two_digit]
|
21
|
+
# @param time_zone_name [Symbol] select [~, long, short, short_offset, long_offset, short_generic, long_generic]
|
22
|
+
# @param precision [Symbol] select [~, second, minute, hour, day, month, year]
|
23
|
+
# @param format [Symbol] select [~, auto, micro, elapsed]
|
24
|
+
# @param lang [String] text
|
25
|
+
# @param title [String] text
|
26
|
+
def playground(
|
27
|
+
tense: nil,
|
28
|
+
prefix: nil,
|
29
|
+
second: nil,
|
30
|
+
minute: nil,
|
31
|
+
hour: nil,
|
32
|
+
weekday: nil,
|
33
|
+
day: nil,
|
34
|
+
month: nil,
|
35
|
+
year: nil,
|
36
|
+
time_zone_name: nil,
|
37
|
+
threshold: nil,
|
38
|
+
precision: nil,
|
39
|
+
format: nil,
|
40
|
+
datetime: Time.utc(2020, 1, 1, 0, 0, 0),
|
41
|
+
lang: nil,
|
42
|
+
title: nil
|
43
|
+
)
|
44
|
+
render(Primer::Beta::RelativeTime.new(
|
45
|
+
tense: tense,
|
46
|
+
prefix: prefix,
|
47
|
+
second: second,
|
48
|
+
minute: minute,
|
49
|
+
hour: hour,
|
50
|
+
weekday: weekday,
|
51
|
+
day: day,
|
52
|
+
month: month,
|
53
|
+
year: year,
|
54
|
+
time_zone_name: time_zone_name,
|
55
|
+
threshold: threshold,
|
56
|
+
precision: precision,
|
57
|
+
format: format,
|
58
|
+
datetime: datetime,
|
59
|
+
lang: lang,
|
60
|
+
title: title
|
61
|
+
))
|
62
|
+
end
|
63
|
+
|
64
|
+
# @label Default
|
65
|
+
# @param datetime datetime-local
|
66
|
+
# @param tense [Symbol] select [~, auto, past, future]
|
67
|
+
# @param prefix [String] text
|
68
|
+
# @param second [Symbol] select [~, numeric, two_digit]
|
69
|
+
# @param minute [Symbol] select [~, numeric, two_digit]
|
70
|
+
# @param hour [Symbol] select [~, numeric, two_digit]
|
71
|
+
# @param weekday [Symbol] select [~, long, short, narrow]
|
72
|
+
# @param day [Symbol] select [~, numeric, two_digit]
|
73
|
+
# @param month [Symbol] select [~, numeric, two_digit, short, long, narrow]
|
74
|
+
# @param year [Symbol] select [~, numeric, two_digit]
|
75
|
+
# @param time_zone_name [Symbol] select [~, long, short, short_offset, long_offset, short_generic, long_generic]
|
76
|
+
# @param precision [Symbol] select [~, second, minute, hour, day, month, year]
|
77
|
+
# @param format [Symbol] select [~, auto, micro, elapsed]
|
78
|
+
# @param lang [String] text
|
79
|
+
# @param title [String] text
|
80
|
+
def default(
|
81
|
+
tense: nil,
|
82
|
+
prefix: nil,
|
83
|
+
second: nil,
|
84
|
+
minute: nil,
|
85
|
+
hour: nil,
|
86
|
+
weekday: nil,
|
87
|
+
day: nil,
|
88
|
+
month: nil,
|
89
|
+
year: nil,
|
90
|
+
time_zone_name: nil,
|
91
|
+
threshold: nil,
|
92
|
+
precision: nil,
|
93
|
+
format: nil,
|
94
|
+
datetime: Time.now.utc,
|
95
|
+
lang: nil,
|
96
|
+
title: nil
|
97
|
+
)
|
98
|
+
render(Primer::Beta::RelativeTime.new(
|
99
|
+
tense: tense,
|
100
|
+
prefix: prefix,
|
101
|
+
second: second,
|
102
|
+
minute: minute,
|
103
|
+
hour: hour,
|
104
|
+
weekday: weekday,
|
105
|
+
day: day,
|
106
|
+
month: month,
|
107
|
+
year: year,
|
108
|
+
time_zone_name: time_zone_name,
|
109
|
+
threshold: threshold,
|
110
|
+
precision: precision,
|
111
|
+
format: format,
|
112
|
+
datetime: datetime,
|
113
|
+
lang: lang,
|
114
|
+
title: title
|
115
|
+
))
|
116
|
+
end
|
117
|
+
|
118
|
+
# @label Micro Format
|
119
|
+
# @param datetime datetime-local
|
120
|
+
# @param tense [Symbol] select [~, auto, past, future]
|
121
|
+
# @param prefix [String] text
|
122
|
+
# @param second [Symbol] select [~, numeric, two_digit]
|
123
|
+
# @param minute [Symbol] select [~, numeric, two_digit]
|
124
|
+
# @param hour [Symbol] select [~, numeric, two_digit]
|
125
|
+
# @param weekday [Symbol] select [~, long, short, narrow]
|
126
|
+
# @param day [Symbol] select [~, numeric, two_digit]
|
127
|
+
# @param month [Symbol] select [~, numeric, two_digit, short, long, narrow]
|
128
|
+
# @param year [Symbol] select [~, numeric, two_digit]
|
129
|
+
# @param time_zone_name [Symbol] select [~, long, short, short_offset, long_offset, short_generic, long_generic]
|
130
|
+
# @param precision [Symbol] select [~, second, minute, hour, day, month, year]
|
131
|
+
# @param lang [String] text
|
132
|
+
# @param title [String] text
|
133
|
+
def micro_format(
|
134
|
+
tense: nil,
|
135
|
+
prefix: nil,
|
136
|
+
second: nil,
|
137
|
+
minute: nil,
|
138
|
+
hour: nil,
|
139
|
+
weekday: nil,
|
140
|
+
day: nil,
|
141
|
+
month: nil,
|
142
|
+
year: nil,
|
143
|
+
time_zone_name: nil,
|
144
|
+
threshold: nil,
|
145
|
+
precision: nil,
|
146
|
+
datetime: Time.now.iso8601,
|
147
|
+
lang: nil,
|
148
|
+
title: nil
|
149
|
+
)
|
150
|
+
render(Primer::Beta::RelativeTime.new(
|
151
|
+
tense: tense,
|
152
|
+
prefix: prefix,
|
153
|
+
second: second,
|
154
|
+
minute: minute,
|
155
|
+
hour: hour,
|
156
|
+
weekday: weekday,
|
157
|
+
day: day,
|
158
|
+
month: month,
|
159
|
+
year: year,
|
160
|
+
time_zone_name: time_zone_name,
|
161
|
+
threshold: threshold,
|
162
|
+
precision: precision,
|
163
|
+
format: :micro,
|
164
|
+
datetime: datetime,
|
165
|
+
lang: lang,
|
166
|
+
title: title
|
167
|
+
))
|
168
|
+
end
|
169
|
+
|
170
|
+
# @label Recent Time
|
171
|
+
# @param datetime datetime-local
|
172
|
+
# @param tense [Symbol] select [~, auto, past, future]
|
173
|
+
# @param prefix [String] text
|
174
|
+
# @param second [Symbol] select [~, numeric, two_digit]
|
175
|
+
# @param minute [Symbol] select [~, numeric, two_digit]
|
176
|
+
# @param hour [Symbol] select [~, numeric, two_digit]
|
177
|
+
# @param weekday [Symbol] select [~, long, short, narrow]
|
178
|
+
# @param day [Symbol] select [~, numeric, two_digit]
|
179
|
+
# @param month [Symbol] select [~, numeric, two_digit, short, long, narrow]
|
180
|
+
# @param year [Symbol] select [~, numeric, two_digit]
|
181
|
+
# @param time_zone_name [Symbol] select [~, long, short, short_offset, long_offset, short_generic, long_generic]
|
182
|
+
# @param precision [Symbol] select [~, second, minute, hour, day, month, year]
|
183
|
+
# @param format [Symbol] select [~, auto, micro, elapsed]
|
184
|
+
# @param lang [String] text
|
185
|
+
# @param title [String] text
|
186
|
+
def recent_time(
|
187
|
+
tense: nil,
|
188
|
+
prefix: nil,
|
189
|
+
second: nil,
|
190
|
+
minute: nil,
|
191
|
+
hour: nil,
|
192
|
+
weekday: nil,
|
193
|
+
day: nil,
|
194
|
+
month: nil,
|
195
|
+
year: nil,
|
196
|
+
time_zone_name: nil,
|
197
|
+
threshold: nil,
|
198
|
+
precision: nil,
|
199
|
+
format: nil,
|
200
|
+
datetime: Time.now.iso8601,
|
201
|
+
lang: nil,
|
202
|
+
title: nil
|
203
|
+
)
|
204
|
+
render(Primer::Beta::RelativeTime.new(
|
205
|
+
tense: tense,
|
206
|
+
prefix: prefix,
|
207
|
+
second: second,
|
208
|
+
minute: minute,
|
209
|
+
hour: hour,
|
210
|
+
weekday: weekday,
|
211
|
+
day: day,
|
212
|
+
month: month,
|
213
|
+
year: year,
|
214
|
+
time_zone_name: time_zone_name,
|
215
|
+
threshold: threshold,
|
216
|
+
precision: precision,
|
217
|
+
format: format,
|
218
|
+
datetime: datetime,
|
219
|
+
lang: lang,
|
220
|
+
title: title
|
221
|
+
))
|
222
|
+
end
|
223
|
+
|
224
|
+
# @label Count Down Timer
|
225
|
+
# @param datetime datetime-local
|
226
|
+
# @param tense [Symbol] select [~, auto, past, future]
|
227
|
+
# @param prefix [String] text
|
228
|
+
# @param second [Symbol] select [~, numeric, two_digit]
|
229
|
+
# @param minute [Symbol] select [~, numeric, two_digit]
|
230
|
+
# @param hour [Symbol] select [~, numeric, two_digit]
|
231
|
+
# @param weekday [Symbol] select [~, long, short, narrow]
|
232
|
+
# @param year [Symbol] select [~, numeric, two_digit]
|
233
|
+
# @param time_zone_name [Symbol] select [~, long, short, short_offset, long_offset, short_generic, long_generic]
|
234
|
+
# @param precision [Symbol] select [~, second, minute, hour, day, month, year]
|
235
|
+
# @param lang [String] text
|
236
|
+
# @param title [String] text
|
237
|
+
def count_down_timer(
|
238
|
+
tense: nil,
|
239
|
+
prefix: nil,
|
240
|
+
second: nil,
|
241
|
+
minute: nil,
|
242
|
+
hour: nil,
|
243
|
+
weekday: nil,
|
244
|
+
year: nil,
|
245
|
+
time_zone_name: nil,
|
246
|
+
threshold: nil,
|
247
|
+
precision: nil,
|
248
|
+
datetime: Time.utc(2038, 1, 19, 0o3, 14, 8),
|
249
|
+
lang: nil,
|
250
|
+
title: nil
|
251
|
+
)
|
252
|
+
render(Primer::Beta::RelativeTime.new(
|
253
|
+
tense: tense,
|
254
|
+
prefix: prefix,
|
255
|
+
second: second,
|
256
|
+
minute: minute,
|
257
|
+
hour: hour,
|
258
|
+
weekday: weekday,
|
259
|
+
year: year,
|
260
|
+
time_zone_name: time_zone_name,
|
261
|
+
threshold: threshold,
|
262
|
+
precision: precision,
|
263
|
+
format: :elapsed,
|
264
|
+
datetime: datetime,
|
265
|
+
lang: lang,
|
266
|
+
title: title
|
267
|
+
))
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|