primer_view_components 0.0.112 → 0.0.114
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +46 -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 -1
- data/app/components/primer/alpha/auto_complete.css.map +1 -1
- data/app/components/primer/alpha/auto_complete.pcss +1 -1
- 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 +2 -2
- 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/alpha/segmented_control.css +1 -1
- data/app/components/primer/alpha/segmented_control.css.map +1 -1
- 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/{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/markdown.rb +290 -0
- data/app/components/primer/beta/popover.css.map +1 -1
- data/app/components/primer/beta/popover.pcss +5 -5
- data/app/components/primer/beta/relative_time.rb +160 -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 +4 -0
- 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/markdown.rb +2 -283
- data/app/components/primer/primer.d.ts +1 -1
- data/app/components/primer/primer.js +1 -1
- data/app/components/primer/primer.pcss +8 -0
- data/app/components/primer/primer.ts +1 -1
- 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 -26
- data/lib/primer/deprecations.yml +72 -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/helpers/deprecated_components_helpers.rb +3 -18
- 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 +4 -3
- data/previews/primer/alpha/auto_complete_preview.rb +12 -0
- data/previews/primer/alpha/segmented_control_preview.rb +9 -6
- data/previews/primer/alpha/text_field_preview.rb +77 -52
- 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/{markdown_preview.rb → beta/markdown_preview.rb} +14 -12
- data/previews/primer/beta/relative_time_preview.rb +271 -0
- data/previews/primer/forms/forms_preview.rb +1 -0
- data/static/arguments.json +163 -53
- data/static/audited_at.json +7 -4
- data/static/constants.json +132 -6
- data/static/statuses.json +6 -3
- metadata +28 -9
- data/previews/primer/clipboard_copy_preview/element.html.erb +0 -2
- data/previews/primer/clipboard_copy_preview.rb +0 -37
data/lib/tasks/docs.rake
CHANGED
@@ -29,6 +29,7 @@ namespace :docs do
|
|
29
29
|
# Rails controller for rendering arbitrary ERB
|
30
30
|
view_context = ApplicationController.new.tap { |c| c.request = ActionDispatch::TestRequest.create }.view_context
|
31
31
|
components = [
|
32
|
+
Primer::Beta::RelativeTime,
|
32
33
|
Primer::Beta::IconButton,
|
33
34
|
Primer::Beta::Button,
|
34
35
|
Primer::Alpha::SegmentedControl,
|
@@ -53,7 +54,7 @@ namespace :docs do
|
|
53
54
|
Primer::ButtonComponent,
|
54
55
|
Primer::Beta::ButtonGroup,
|
55
56
|
Primer::Alpha::ButtonMarketing,
|
56
|
-
Primer::ClipboardCopy,
|
57
|
+
Primer::Beta::ClipboardCopy,
|
57
58
|
Primer::Beta::CloseButton,
|
58
59
|
Primer::Beta::Counter,
|
59
60
|
Primer::Beta::Details,
|
@@ -66,7 +67,7 @@ namespace :docs do
|
|
66
67
|
Primer::Beta::Label,
|
67
68
|
Primer::LayoutComponent,
|
68
69
|
Primer::Beta::Link,
|
69
|
-
Primer::Markdown,
|
70
|
+
Primer::Beta::Markdown,
|
70
71
|
Primer::MenuComponent,
|
71
72
|
Primer::Navigation::TabComponent,
|
72
73
|
Primer::OcticonComponent,
|
@@ -104,7 +105,7 @@ namespace :docs do
|
|
104
105
|
Primer::Alpha::ImageCrop,
|
105
106
|
Primer::Beta::AutoComplete,
|
106
107
|
Primer::Alpha::Banner,
|
107
|
-
Primer::ClipboardCopy,
|
108
|
+
Primer::Beta::ClipboardCopy,
|
108
109
|
Primer::TabContainerComponent,
|
109
110
|
Primer::TimeAgoComponent,
|
110
111
|
Primer::Alpha::UnderlinePanels,
|
@@ -11,7 +11,9 @@ module Primer
|
|
11
11
|
# @param with_icon toggle
|
12
12
|
# @param is_clearable toggle
|
13
13
|
def playground(label_text: "Select a fruit", is_label_visible: true, is_label_inline: false, with_icon: false, is_clearable: false)
|
14
|
+
# rubocop:disable Primer/ComponentNameMigration
|
14
15
|
render(Primer::Alpha::AutoComplete.new(label_text: label_text, input_id: "input-id", list_id: "test-id", src: "/auto_complete?version=alpha", is_label_visible: is_label_visible, is_label_inline: is_label_inline, with_icon: with_icon, is_clearable: is_clearable))
|
16
|
+
# rubocop:enable Primer/ComponentNameMigration
|
15
17
|
end
|
16
18
|
|
17
19
|
# @label Default Options
|
@@ -21,29 +23,39 @@ module Primer
|
|
21
23
|
# @param with_icon toggle
|
22
24
|
# @param is_clearable toggle
|
23
25
|
def default(label_text: "Select a fruit", is_label_visible: true, is_label_inline: false, with_icon: false, is_clearable: false)
|
26
|
+
# rubocop:disable Primer/ComponentNameMigration
|
24
27
|
render(Primer::Alpha::AutoComplete.new(label_text: label_text, input_id: "input-id", list_id: "test-id", src: "/auto_complete?version=alpha", is_label_visible: is_label_visible, is_label_inline: is_label_inline, with_icon: with_icon, is_clearable: is_clearable))
|
28
|
+
# rubocop:enable Primer/ComponentNameMigration
|
25
29
|
end
|
26
30
|
|
27
31
|
# @!group More examples
|
28
32
|
|
29
33
|
# @label AutoComplete with non-visible label
|
30
34
|
def with_non_visible_label
|
35
|
+
# rubocop:disable Primer/ComponentNameMigration
|
31
36
|
render(Primer::Alpha::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id-1", list_id: "test-id-1", src: "/auto_complete?version=alpha", is_label_visible: false))
|
37
|
+
# rubocop:enable Primer/ComponentNameMigration
|
32
38
|
end
|
33
39
|
|
34
40
|
# @label AutoComplete with inline label
|
35
41
|
def with_inline_label
|
42
|
+
# rubocop:disable Primer/ComponentNameMigration
|
36
43
|
render(Primer::Alpha::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id-2", list_id: "test-id-2", src: "/auto_complete?version=alpha", is_label_inline: true))
|
44
|
+
# rubocop:enable Primer/ComponentNameMigration
|
37
45
|
end
|
38
46
|
|
39
47
|
# @label AutoComplete with search icon
|
40
48
|
def with_icon
|
49
|
+
# rubocop:disable Primer/ComponentNameMigration
|
41
50
|
render(Primer::Alpha::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id-3", list_id: "test-id-3", src: "/auto_complete?version=alpha", with_icon: true))
|
51
|
+
# rubocop:enable Primer/ComponentNameMigration
|
42
52
|
end
|
43
53
|
|
44
54
|
# @label AutoComplete with clear button
|
45
55
|
def with_clear_button
|
56
|
+
# rubocop:disable Primer/ComponentNameMigration
|
46
57
|
render(Primer::Alpha::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id-4", list_id: "test-id-4", src: "/auto_complete?version=alpha", is_clearable: true))
|
58
|
+
# rubocop:enable Primer/ComponentNameMigration
|
47
59
|
end
|
48
60
|
|
49
61
|
# @!endgroup
|
@@ -34,8 +34,9 @@ module Primer
|
|
34
34
|
|
35
35
|
# @!group Full width
|
36
36
|
# @label Size small
|
37
|
-
|
38
|
-
|
37
|
+
# @param hide_labels [Boolean] toggle
|
38
|
+
def full_width_small(hide_labels: false)
|
39
|
+
render(Primer::Alpha::SegmentedControl.new("aria-label": "File view", hide_labels: hide_labels, full_width: true, size: :small)) do |c|
|
39
40
|
c.with_item(label: "Preview", selected: true)
|
40
41
|
c.with_item(label: "Raw")
|
41
42
|
c.with_item(label: "Blame")
|
@@ -43,8 +44,9 @@ module Primer
|
|
43
44
|
end
|
44
45
|
|
45
46
|
# @label Size medium
|
46
|
-
|
47
|
-
|
47
|
+
# @param hide_labels [Boolean] toggle
|
48
|
+
def full_width_medium(hide_labels: false)
|
49
|
+
render(Primer::Alpha::SegmentedControl.new("aria-label": "File view", hide_labels: hide_labels, full_width: true, size: :medium)) do |c|
|
48
50
|
c.with_item(label: "Preview", selected: true)
|
49
51
|
c.with_item(label: "Raw")
|
50
52
|
c.with_item(label: "Blame")
|
@@ -52,8 +54,9 @@ module Primer
|
|
52
54
|
end
|
53
55
|
|
54
56
|
# @label Size large
|
55
|
-
|
56
|
-
|
57
|
+
# @param hide_labels [Boolean] toggle
|
58
|
+
def full_width_large(hide_labels: false)
|
59
|
+
render(Primer::Alpha::SegmentedControl.new("aria-label": "File view", hide_labels: hide_labels, full_width: true, size: :large)) do |c|
|
57
60
|
c.with_item(label: "Preview", selected: true)
|
58
61
|
c.with_item(label: "Raw")
|
59
62
|
c.with_item(label: "Blame")
|
@@ -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
|
@@ -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
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Primer
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
module Beta
|
5
|
+
# @label Markdown
|
6
|
+
class MarkdownPreview < ViewComponent::Preview
|
7
|
+
MD_FIXTURE = %(
|
7
8
|
<p>Text can be <b>bold</b>, <i>italic</i>, or <s>strikethrough</s>. <a href=\"https://github.com\">Links </a> should be blue with no underlines (unless hovered over).</p>
|
8
9
|
|
9
10
|
<p>There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs. There should be whitespace between paragraphs.</p>
|
@@ -274,17 +275,18 @@ module Primer
|
|
274
275
|
<pre><code>This is the final element on the page and there should be no margin below this.</code></pre>
|
275
276
|
).html_safe # rubocop:disable Rails/OutputSafety
|
276
277
|
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
278
|
+
# @label Playground
|
279
|
+
def playground
|
280
|
+
render(Primer::Beta::Markdown.new) do
|
281
|
+
MD_FIXTURE
|
282
|
+
end
|
281
283
|
end
|
282
|
-
end
|
283
284
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
285
|
+
# @label Default Options
|
286
|
+
def default
|
287
|
+
render(Primer::Beta::Markdown.new) do
|
288
|
+
MD_FIXTURE
|
289
|
+
end
|
288
290
|
end
|
289
291
|
end
|
290
292
|
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
|