primer_view_components 0.0.120 → 0.0.121
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +38 -0
- data/app/components/primer/alpha/segmented_control/item.rb +1 -0
- data/app/components/primer/alpha/segmented_control.rb +30 -0
- data/app/components/primer/alpha/text_field.rb +1 -0
- data/app/components/primer/base_component.rb +3 -3
- data/app/components/primer/beta/close_button.rb +1 -1
- data/app/components/primer/{local_time.d.ts → beta/relative_time.d.ts} +0 -0
- data/app/components/primer/{local_time.js → beta/relative_time.js} +0 -0
- data/app/components/primer/{local_time.ts → beta/relative_time.ts} +0 -0
- data/app/components/primer/component.rb +2 -1
- data/app/components/primer/primer.d.ts +1 -2
- data/app/components/primer/primer.js +1 -2
- data/app/components/primer/primer.ts +1 -2
- data/app/forms/example_toggle_switch_form.rb +1 -1
- data/app/lib/primer/view_helper.rb +0 -1
- data/lib/primer/deprecations.yml +0 -78
- data/lib/primer/forms/acts_as_component.rb +12 -1
- data/lib/primer/forms/toggle_switch_form.rb +10 -3
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/primer/yard/component_manifest.rb +0 -2
- data/lib/tasks/static.rake +22 -0
- data/previews/primer/alpha/auto_complete_preview.rb +6 -6
- data/previews/primer/alpha/segmented_control_preview/with_label_and_caption.html.erb +9 -0
- data/previews/primer/alpha/segmented_control_preview/with_subhead_actions.html.erb +11 -0
- data/previews/primer/alpha/segmented_control_preview.rb +7 -1
- data/previews/primer/alpha/text_field_preview.rb +14 -0
- data/previews/primer/alpha/toggle_switch_preview.rb +9 -9
- data/previews/primer/beta/auto_complete_preview.rb +17 -17
- data/previews/primer/url_helpers.rb +1 -1
- data/static/arguments.json +6 -100
- data/static/audited_at.json +2 -21
- data/static/constants.json +0 -51
- data/static/previews.json +1634 -0
- data/static/statuses.json +0 -19
- metadata +8 -27
- data/app/components/primer/dropdown/menu.rb +0 -14
- data/app/components/primer/dropdown.rb +0 -7
- data/app/components/primer/hellip_button.rb +0 -7
- data/app/components/primer/label_component.rb +0 -7
- data/app/components/primer/link_component.rb +0 -7
- data/app/components/primer/local_time.rb +0 -63
- data/app/components/primer/markdown.rb +0 -7
- data/app/components/primer/menu_component.rb +0 -7
- data/app/components/primer/octicon_component.rb +0 -7
- data/app/components/primer/octicon_symbols_component.rb +0 -7
- data/app/components/primer/popover_component.rb +0 -8
- data/app/components/primer/spinner_component.rb +0 -7
- data/app/components/primer/state_component.rb +0 -7
- data/app/components/primer/subhead_component.rb +0 -7
- data/app/components/primer/tab_container_component.rb +0 -7
- data/app/components/primer/time_ago_component.d.ts +0 -1
- data/app/components/primer/time_ago_component.js +0 -1
- data/app/components/primer/time_ago_component.rb +0 -51
- data/app/components/primer/time_ago_component.ts +0 -1
- data/app/components/primer/timeline_item_component.rb +0 -13
- data/previews/primer/local_time_component_preview.rb +0 -57
- data/previews/primer/time_ago_component_preview.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9a50600b509b2d0196b508f726bd49c3d363325f6e883401252e10501be137f
|
4
|
+
data.tar.gz: d03535e6e7d149e9260276143ecfc9239331a692339fb042d5c0cc1b0ccff4f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79bb3edef7b103d469bab7414855899fa47584038ae5877e0ec09b0421d5e3210e17233fc27e861c7c1797f0f3b644a95a063ceb4f8c31c621874f7a8161796b
|
7
|
+
data.tar.gz: 5e765a6a44aa171f43c96d4b5be73e13138e9ef601f41316c575a122488650937a383ea2025f33537f67ec0b77cbde69d5a6d6fa468903ded54e6dc82953b752
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,43 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.0.121
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#1791](https://github.com/primer/view_components/pull/1791) [`b68cf7f7`](https://github.com/primer/view_components/commit/b68cf7f7d74379765cd373a5ea060204e3cf7db2) Thanks [@jonrohan](https://github.com/jonrohan)! - Removing the deprecated Primer::LocalTime component
|
8
|
+
|
9
|
+
* [#1808](https://github.com/primer/view_components/pull/1808) [`31544417`](https://github.com/primer/view_components/commit/31544417010274b4f8b3b6574587b917a0bbf0e4) Thanks [@joelhawksley](https://github.com/joelhawksley)! - Rename URLHelpers to UrlHelpers to fix console error.
|
10
|
+
|
11
|
+
- [#1788](https://github.com/primer/view_components/pull/1788) [`7ad70066`](https://github.com/primer/view_components/commit/7ad7006651dc4dbbd21f444ad10ee1fdb5c3eeba) Thanks [@camertron](https://github.com/camertron)! - Document TextField's auto_check_src argument
|
12
|
+
|
13
|
+
* [#1784](https://github.com/primer/view_components/pull/1784) [`3b830167`](https://github.com/primer/view_components/commit/3b8301674ccd74e7ae31826a766883a0612a3960) Thanks [@jonrohan](https://github.com/jonrohan)! - Remove unused deprecated component wrappers
|
14
|
+
|
15
|
+
- "Primer::Dropdown::Menu::Item"
|
16
|
+
- "Primer::Dropdown::Menu"
|
17
|
+
- "Primer::Dropdown"
|
18
|
+
- "Primer::HellipButton"
|
19
|
+
- "Primer::LabelComponent"
|
20
|
+
- "Primer::LinkComponent"
|
21
|
+
- "Primer::Markdown"
|
22
|
+
- "Primer::MenuComponent"
|
23
|
+
- "Primer::OcticonComponent"
|
24
|
+
- "Primer::OcticonSymbolsComponent"
|
25
|
+
- "Primer::PopoverComponent"
|
26
|
+
- "Primer::SpinnerComponent"
|
27
|
+
- "Primer::StateComponent"
|
28
|
+
- "Primer::SubheadComponent"
|
29
|
+
- "Primer::TabContainerComponent"
|
30
|
+
- "Primer::TimelineItemComponent::BadgeComponent"
|
31
|
+
- "Primer::TimelineItemComponent"
|
32
|
+
|
33
|
+
- [#1787](https://github.com/primer/view_components/pull/1787) [`972dd7bd`](https://github.com/primer/view_components/commit/972dd7bd92e79b2e8b54555f91770c4c1b280709) Thanks [@neall](https://github.com/neall)! - Allow toggle-switch forms to use caption templates.
|
34
|
+
|
35
|
+
* [#1792](https://github.com/primer/view_components/pull/1792) [`730b0a8d`](https://github.com/primer/view_components/commit/730b0a8d70a9e5bc42856c3f30779ebf0d2b9ac9) Thanks [@jonrohan](https://github.com/jonrohan)! - Removing the deprecated Primer::TimeAgoComponent
|
36
|
+
|
37
|
+
- [#1776](https://github.com/primer/view_components/pull/1776) [`61b28872`](https://github.com/primer/view_components/commit/61b288721a0315bcad4694615c9b34ddad5d10b7) Thanks [@jonrohan](https://github.com/jonrohan)! - Adding aria labeled by and described by check to SegmentedControl component. Marking as accessibility reviewed
|
38
|
+
|
39
|
+
* [#1805](https://github.com/primer/view_components/pull/1805) [`238328a7`](https://github.com/primer/view_components/commit/238328a734cff1322d18c129d340bb5a254bc272) Thanks [@paulcsmith](https://github.com/paulcsmith)! - Update CloseButton to work with more aria-label types
|
40
|
+
|
3
41
|
## 0.0.120
|
4
42
|
|
5
43
|
### Patch Changes
|
@@ -7,6 +7,7 @@ module Primer
|
|
7
7
|
# It wraps the Button and IconButton components to provide the correct styles
|
8
8
|
class Item < Primer::BaseComponent
|
9
9
|
status :alpha
|
10
|
+
audited_at "2023-02-01"
|
10
11
|
|
11
12
|
# @param label [String] The label to use
|
12
13
|
# @param selected [Boolean] Whether the item is selected
|
@@ -3,8 +3,12 @@
|
|
3
3
|
module Primer
|
4
4
|
module Alpha
|
5
5
|
# Use a segmented control to let users select an option from a short list and immediately apply the selection
|
6
|
+
# @accessibility
|
7
|
+
# A `SegmentedControl` should not be used in a form as a replacement for something like a radio group or select.
|
8
|
+
# See the [Accessibility section](https://primer.style/design/components/segmented-control#accessibility) of the SegmentedControl interface guidelines for more details.
|
6
9
|
class SegmentedControl < Primer::Component
|
7
10
|
status :alpha
|
11
|
+
audited_at "2023-02-01"
|
8
12
|
|
9
13
|
FULL_WIDTH_DEFAULT = false
|
10
14
|
HIDE_LABELS_DEFAULT = false
|
@@ -24,6 +28,30 @@ module Primer
|
|
24
28
|
)
|
25
29
|
}
|
26
30
|
|
31
|
+
# @example With a label above and caption below
|
32
|
+
# <%= render(Primer::Box.new(display: :flex, direction: :column)) do %>
|
33
|
+
# <%= render(Primer::BaseComponent.new(tag: "span", id: "scLabel-horiz")) { "File view" } %>
|
34
|
+
# <%= render(Primer::Alpha::SegmentedControl.new("aria-labelledby": "scLabel-horiz", "aria-describedby": "scCaption-horiz")) do |component| %>
|
35
|
+
# <% component.with_item(label: "Preview", selected: true) %>
|
36
|
+
# <% component.with_item(label: "Raw") %>
|
37
|
+
# <% component.with_item(label: "Blame") %>
|
38
|
+
# <% end %>
|
39
|
+
# <%= render(Primer::Beta::Text.new(font_size: :small, mt: 1, color: :muted, id: "scCaption-horiz")) { "Change the way the file is viewed" } %>
|
40
|
+
# <% end %>
|
41
|
+
#
|
42
|
+
# @example With a label and caption on the left
|
43
|
+
# <%= render(Primer::Beta::Subhead.new) do |component| %>
|
44
|
+
# <% component.with_heading(id: "scLabel-vert") { "File view" } %>
|
45
|
+
# <% component.with_description(id: "scCaption-vert") { "Change the way the file is viewed" } %>
|
46
|
+
# <% component.with_actions do %>
|
47
|
+
# <%= render(Primer::Alpha::SegmentedControl.new("aria-labelledby": "scLabel-vert", "aria-describedby": "scCaption-vert")) do |component| %>
|
48
|
+
# <% component.with_item(label: "Preview", selected: true) %>
|
49
|
+
# <% component.with_item(label: "Raw") %>
|
50
|
+
# <% component.with_item(label: "Blame") %>
|
51
|
+
# <% end %>
|
52
|
+
# <% end %>
|
53
|
+
# <% end %>
|
54
|
+
#
|
27
55
|
# @example Basic usage
|
28
56
|
#
|
29
57
|
# <%= render(Primer::Alpha::SegmentedControl.new("aria-label": "File view")) do |component| %>
|
@@ -79,6 +107,8 @@ module Primer
|
|
79
107
|
"SegmentedControl--iconOnly": hide_labels,
|
80
108
|
"SegmentedControl--fullWidth": full_width
|
81
109
|
)
|
110
|
+
|
111
|
+
validate_aria_label
|
82
112
|
end
|
83
113
|
|
84
114
|
def render?
|
@@ -98,6 +98,7 @@ module Primer
|
|
98
98
|
# @param leading_visual [Hash] Renders a leading visual icon before the text field's cursor. The hash will be passed to Primer's [Octicon component](https://primer.style/view-components/components/octicon).
|
99
99
|
# @param validation_message [String] A validation message to display beneath the input. Implicitly sets `invalid` to `true`.
|
100
100
|
# @param label_arguments [Hash] System arugments passed to the Rails builder's `#label` method. These arguments will appear as HTML attributes on the `<label>` tag.
|
101
|
+
# @param auto_check_src [String] When provided, makes a request to the given URL whenever the contents of the text field changes. If the server responds with a non-2xx status code, the response body is used as the validation message.
|
101
102
|
# @param system_arguments [Hash] <%= link_to_system_arguments_docs %>
|
102
103
|
# @param block [Proc] Unused.
|
103
104
|
end
|
@@ -134,12 +134,12 @@ module Primer
|
|
134
134
|
#
|
135
135
|
# | Name | Type | Description |
|
136
136
|
# | :- | :- | :- |
|
137
|
-
# | `font_family` | Symbol | Font
|
137
|
+
# | `font_family` | Symbol | Font family. <%= one_of([:mono]) %> |
|
138
138
|
# | `font_size` | String, Integer, Symbol | <%= one_of(["00", 0, 1, 2, 3, 4, 5, 6, :small, :normal]) %> |
|
139
|
-
# | `font_style` | Symbol | Font
|
139
|
+
# | `font_style` | Symbol | Font style. <%= one_of([:italic]) %> |
|
140
140
|
# | `font_weight` | Symbol | Font weight. <%= one_of([:light, :normal, :bold, :emphasized]) %> |
|
141
141
|
# | `text_align` | Symbol | Text alignment. <%= one_of([:left, :right, :center]) %> |
|
142
|
-
# | `text_transform` | Symbol | Text
|
142
|
+
# | `text_transform` | Symbol | Text transformation. <%= one_of([:uppercase]) %> |
|
143
143
|
# | `underline` | Boolean | Whether text should be underlined. |
|
144
144
|
# | `word_break` | Symbol | Whether to break words on line breaks. <%= one_of(Primer::Classify::Utilities.mappings(:word_break)) %> |
|
145
145
|
#
|
File without changes
|
File without changes
|
File without changes
|
@@ -52,7 +52,8 @@ module Primer
|
|
52
52
|
|
53
53
|
def validate_aria_label
|
54
54
|
aria_label = aria("label", @system_arguments)
|
55
|
-
|
55
|
+
aria_labelledby = aria("labelledby", @system_arguments)
|
56
|
+
raise ArgumentError, "`aria-label` or `aria-labelledby` is required." if aria_label.nil? && aria_labelledby.nil? && !Rails.env.production?
|
56
57
|
end
|
57
58
|
|
58
59
|
def silence_deprecations?
|
@@ -8,9 +8,8 @@ import './alpha/tool_tip';
|
|
8
8
|
import './alpha/x_banner';
|
9
9
|
import './beta/auto_complete/auto_complete';
|
10
10
|
import './beta/clipboard_copy';
|
11
|
-
import './
|
11
|
+
import './beta/relative_time';
|
12
12
|
import './alpha/tab_container';
|
13
|
-
import './time_ago_component';
|
14
13
|
import '../../../lib/primer/forms/primer_multi_input';
|
15
14
|
import '../../../lib/primer/forms/primer_text_field';
|
16
15
|
import '../../../lib/primer/forms/toggle_switch_input';
|
@@ -8,9 +8,8 @@ import './alpha/tool_tip';
|
|
8
8
|
import './alpha/x_banner';
|
9
9
|
import './beta/auto_complete/auto_complete';
|
10
10
|
import './beta/clipboard_copy';
|
11
|
-
import './
|
11
|
+
import './beta/relative_time';
|
12
12
|
import './alpha/tab_container';
|
13
|
-
import './time_ago_component';
|
14
13
|
import '../../../lib/primer/forms/primer_multi_input';
|
15
14
|
import '../../../lib/primer/forms/primer_text_field';
|
16
15
|
import '../../../lib/primer/forms/toggle_switch_input';
|
@@ -8,9 +8,8 @@ import './alpha/tool_tip'
|
|
8
8
|
import './alpha/x_banner'
|
9
9
|
import './beta/auto_complete/auto_complete'
|
10
10
|
import './beta/clipboard_copy'
|
11
|
-
import './
|
11
|
+
import './beta/relative_time'
|
12
12
|
import './alpha/tab_container'
|
13
|
-
import './time_ago_component'
|
14
13
|
import '../../../lib/primer/forms/primer_multi_input'
|
15
14
|
import '../../../lib/primer/forms/primer_text_field'
|
16
15
|
import '../../../lib/primer/forms/toggle_switch_input'
|
@@ -3,6 +3,6 @@
|
|
3
3
|
# :nodoc:
|
4
4
|
class ExampleToggleSwitchForm < Primer::Forms::ToggleSwitchForm
|
5
5
|
def initialize(**system_arguments)
|
6
|
-
super(name: :example_field, label: "Example",
|
6
|
+
super(name: :example_field, label: "Example", **system_arguments)
|
7
7
|
end
|
8
8
|
end
|
data/lib/primer/deprecations.yml
CHANGED
@@ -22,88 +22,10 @@ deprecations:
|
|
22
22
|
replacement: "Primer::Beta::Button"
|
23
23
|
guide: "https://primer.style/view-components/guides/primer_button_component"
|
24
24
|
|
25
|
-
- component: "Primer::Dropdown"
|
26
|
-
autocorrect: true
|
27
|
-
replacement: "Primer::Alpha::Dropdown"
|
28
|
-
|
29
|
-
- component: "Primer::Dropdown::Menu"
|
30
|
-
autocorrect: true
|
31
|
-
replacement: "Primer::Alpha::Dropdown::Menu"
|
32
|
-
|
33
|
-
- component: "Primer::Dropdown::Menu::Item"
|
34
|
-
autocorrect: true
|
35
|
-
replacement: "Primer::Alpha::Dropdown::Menu::Item"
|
36
|
-
|
37
|
-
- component: "Primer::HellipButton"
|
38
|
-
autocorrect: true
|
39
|
-
replacement: "Primer::Alpha::HellipButton"
|
40
|
-
|
41
25
|
- component: "Primer::IconButton"
|
42
26
|
autocorrect: true
|
43
27
|
replacement: "Primer::Beta::IconButton"
|
44
28
|
|
45
|
-
- component: "Primer::LabelComponent"
|
46
|
-
autocorrect: true
|
47
|
-
replacement: "Primer::Beta::Label"
|
48
|
-
|
49
|
-
- component: "Primer::LocalTime"
|
50
|
-
autocorrect: false
|
51
|
-
replacement: "Primer::Beta::RelativeTime"
|
52
|
-
guide: "https://primer.style/view-components/guides/primer_local_time"
|
53
|
-
|
54
|
-
- component: "Primer::LinkComponent"
|
55
|
-
autocorrect: true
|
56
|
-
replacement: "Primer::Beta::Link"
|
57
|
-
|
58
|
-
- component: "Primer::Markdown"
|
59
|
-
autocorrect: true
|
60
|
-
replacement: "Primer::Beta::Markdown"
|
61
|
-
|
62
|
-
- component: "Primer::MenuComponent"
|
63
|
-
autocorrect: true
|
64
|
-
replacement: "Primer::Alpha::Menu"
|
65
|
-
|
66
|
-
- component: "Primer::OcticonComponent"
|
67
|
-
autocorrect: true
|
68
|
-
replacement: "Primer::Beta::Octicon"
|
69
|
-
|
70
|
-
- component: "Primer::OcticonSymbolsComponent"
|
71
|
-
autocorrect: true
|
72
|
-
replacement: "Primer::Alpha::OcticonSymbols"
|
73
|
-
|
74
|
-
- component: "Primer::PopoverComponent"
|
75
|
-
autocorrect: true
|
76
|
-
replacement: "Primer::Beta::Popover"
|
77
|
-
|
78
|
-
- component: "Primer::SpinnerComponent"
|
79
|
-
autocorrect: true
|
80
|
-
replacement: "Primer::Beta::Spinner"
|
81
|
-
|
82
|
-
- component: "Primer::StateComponent"
|
83
|
-
autocorrect: true
|
84
|
-
replacement: "Primer::Beta::State"
|
85
|
-
|
86
|
-
- component: "Primer::SubheadComponent"
|
87
|
-
autocorrect: true
|
88
|
-
replacement: "Primer::Beta::Subhead"
|
89
|
-
|
90
|
-
- component: "Primer::TabContainerComponent"
|
91
|
-
autocorrect: true
|
92
|
-
replacement: "Primer::Alpha::TabContainer"
|
93
|
-
|
94
|
-
- component: "Primer::TimeAgoComponent"
|
95
|
-
autocorrect: false
|
96
|
-
replacement: "Primer::Beta::RelativeTime"
|
97
|
-
guide: "https://primer.style/view-components/guides/primer_time_ago"
|
98
|
-
|
99
|
-
- component: "Primer::TimelineItemComponent"
|
100
|
-
autocorrect: true
|
101
|
-
replacement: "Primer::Beta::TimelineItem"
|
102
|
-
|
103
|
-
- component: "Primer::TimelineItemComponent::BadgeComponent"
|
104
|
-
autocorrect: true
|
105
|
-
replacement: "Primer::Beta::TimelineItem::Badge"
|
106
|
-
|
107
29
|
- component: "Primer::Tooltip"
|
108
30
|
autocorrect: true
|
109
31
|
replacement: "Primer::Alpha::Tooltip"
|
@@ -8,7 +8,7 @@ module Primer
|
|
8
8
|
module ActsAsComponent
|
9
9
|
# :nodoc:
|
10
10
|
module InstanceMethods
|
11
|
-
delegate :render, :content_tag, :output_buffer,
|
11
|
+
delegate :render, :content_tag, :output_buffer, to: :@view_context
|
12
12
|
|
13
13
|
def render_in(view_context, &block)
|
14
14
|
@view_context = view_context
|
@@ -16,6 +16,17 @@ module Primer
|
|
16
16
|
perform_render(&block)
|
17
17
|
end
|
18
18
|
|
19
|
+
# This is necessary to restore the functionality changed by https://github.com/rails/rails/pull/47194.
|
20
|
+
# I would love to remove this at some point, perhaps if we ever decide to replace
|
21
|
+
# ActsAsComponent with view component.
|
22
|
+
def capture(*args, &block)
|
23
|
+
old_buffer = @view_context.output_buffer
|
24
|
+
@view_context.output_buffer = ActionView::OutputBuffer.new
|
25
|
+
@view_context.capture(*args, &block)
|
26
|
+
ensure
|
27
|
+
@view_context.output_buffer = old_buffer
|
28
|
+
end
|
29
|
+
|
19
30
|
# :nocov:
|
20
31
|
def perform_render(&_block)
|
21
32
|
raise NotImplementedError, "subclasses must implement ##{__method__}."
|
@@ -32,8 +32,10 @@ module Primer
|
|
32
32
|
#
|
33
33
|
class ToggleSwitchForm < Primer::Forms::Base
|
34
34
|
# Define the form on subclasses so render(Subclass.new) works as expected.
|
35
|
-
|
36
|
-
|
35
|
+
# (this is called directly on this class, but also on classes
|
36
|
+
# that inherit from this class)
|
37
|
+
def self.define_form_on(klass)
|
38
|
+
klass.form do |toggle_switch_form|
|
37
39
|
input = Dsl::ToggleSwitchInput.new(
|
38
40
|
builder: toggle_switch_form.builder, form: self, **@system_arguments
|
39
41
|
)
|
@@ -42,8 +44,13 @@ module Primer
|
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
47
|
+
def self.inherited(base)
|
48
|
+
super
|
49
|
+
define_form_on(base)
|
50
|
+
end
|
51
|
+
|
45
52
|
# Define the form on self so render(ToggleSwitchForm.new) works as expected.
|
46
|
-
|
53
|
+
define_form_on(self)
|
47
54
|
|
48
55
|
# Override to avoid accepting a builder argument. We create our own builder
|
49
56
|
# on render. See the implementation of render_in below.
|
@@ -13,7 +13,6 @@ module Primer
|
|
13
13
|
Primer::Alpha::Layout => {},
|
14
14
|
Primer::Alpha::HellipButton => {},
|
15
15
|
Primer::Alpha::Image => {},
|
16
|
-
Primer::LocalTime => { js: true },
|
17
16
|
Primer::Alpha::OcticonSymbols => {},
|
18
17
|
Primer::Alpha::ImageCrop => { js: true },
|
19
18
|
Primer::IconButton => { js: true },
|
@@ -54,7 +53,6 @@ module Primer
|
|
54
53
|
Primer::Beta::Subhead => {},
|
55
54
|
Primer::Alpha::TabContainer => { js: true },
|
56
55
|
Primer::Beta::Text => {},
|
57
|
-
Primer::TimeAgoComponent => { js: true },
|
58
56
|
Primer::Beta::TimelineItem => {},
|
59
57
|
Primer::Tooltip => {},
|
60
58
|
Primer::Truncate => {},
|
data/lib/tasks/static.rake
CHANGED
@@ -5,11 +5,33 @@ namespace :static do
|
|
5
5
|
ENV["RAILS_ENV"] = "test"
|
6
6
|
require File.expand_path("./../../demo/config/environment.rb", __dir__)
|
7
7
|
require "primer/view_components"
|
8
|
+
require "lookbook"
|
8
9
|
# Loads all components for `.descendants` to work properly
|
9
10
|
Dir["./app/components/primer/**/*.rb"].sort.each { |file| require file }
|
10
11
|
|
11
12
|
Primer::ViewComponents.dump(:statuses)
|
12
13
|
Primer::ViewComponents.dump(:constants)
|
13
14
|
Primer::ViewComponents.dump(:audited_at)
|
15
|
+
|
16
|
+
previews = Lookbook.previews.map do |preview|
|
17
|
+
{
|
18
|
+
name: preview.name,
|
19
|
+
lookup_path: preview.lookup_path,
|
20
|
+
examples: preview.examples.map { |example|
|
21
|
+
{
|
22
|
+
inspect_path: example.url_path,
|
23
|
+
preview_path: example.url_path.sub("/inspect/", "/preview/"),
|
24
|
+
name: example.name
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
require "json"
|
31
|
+
|
32
|
+
File.open(File.join(Primer::ViewComponents::DEFAULT_STATIC_PATH, "previews.json"), "w") do |f|
|
33
|
+
f.write(JSON.pretty_generate(previews))
|
34
|
+
f.write($INPUT_RECORD_SEPARATOR)
|
35
|
+
end
|
14
36
|
end
|
15
37
|
end
|
@@ -19,7 +19,7 @@ module Primer
|
|
19
19
|
label_text: label_text,
|
20
20
|
input_id: "input-id",
|
21
21
|
list_id: "test-id",
|
22
|
-
src:
|
22
|
+
src: UrlHelpers.autocomplete_index_path(version: "alpha"),
|
23
23
|
is_label_visible: is_label_visible,
|
24
24
|
is_label_inline: is_label_inline,
|
25
25
|
with_icon: with_icon,
|
@@ -42,7 +42,7 @@ module Primer
|
|
42
42
|
label_text: label_text,
|
43
43
|
input_id: "input-id",
|
44
44
|
list_id: "test-id",
|
45
|
-
src:
|
45
|
+
src: UrlHelpers.autocomplete_index_path(version: "alpha"),
|
46
46
|
is_label_visible: is_label_visible,
|
47
47
|
is_label_inline: is_label_inline,
|
48
48
|
with_icon: with_icon,
|
@@ -62,7 +62,7 @@ module Primer
|
|
62
62
|
label_text: "Select a fruit",
|
63
63
|
input_id: "input-id-1",
|
64
64
|
list_id: "test-id-1",
|
65
|
-
src:
|
65
|
+
src: UrlHelpers.autocomplete_index_path(version: "alpha"),
|
66
66
|
is_label_visible: false
|
67
67
|
)
|
68
68
|
)
|
@@ -77,7 +77,7 @@ module Primer
|
|
77
77
|
label_text: "Select a fruit",
|
78
78
|
input_id: "input-id-2",
|
79
79
|
list_id: "test-id-2",
|
80
|
-
src:
|
80
|
+
src: UrlHelpers.autocomplete_index_path(version: "alpha"),
|
81
81
|
is_label_inline: true
|
82
82
|
)
|
83
83
|
)
|
@@ -92,7 +92,7 @@ module Primer
|
|
92
92
|
label_text: "Select a fruit",
|
93
93
|
input_id: "input-id-3",
|
94
94
|
list_id: "test-id-3",
|
95
|
-
src:
|
95
|
+
src: UrlHelpers.autocomplete_index_path(version: "alpha"),
|
96
96
|
with_icon: true
|
97
97
|
)
|
98
98
|
)
|
@@ -107,7 +107,7 @@ module Primer
|
|
107
107
|
label_text: "Select a fruit",
|
108
108
|
input_id: "input-id-4",
|
109
109
|
list_id: "test-id-4",
|
110
|
-
src:
|
110
|
+
src: UrlHelpers.autocomplete_index_path(version: "alpha"),
|
111
111
|
is_clearable: true
|
112
112
|
)
|
113
113
|
)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= render(Primer::Box.new(display: :flex, direction: :column)) do %>
|
2
|
+
<%= render(Primer::BaseComponent.new(tag: "span", id: "scLabel-horiz")) { "File view" } %>
|
3
|
+
<%= render(Primer::Alpha::SegmentedControl.new("aria-labelledby": "scLabel-horiz", "aria-describedby": "scCaption-horiz")) do |component| %>
|
4
|
+
<% component.with_item(label: "Preview", selected: true) %>
|
5
|
+
<% component.with_item(label: "Raw") %>
|
6
|
+
<% component.with_item(label: "Blame") %>
|
7
|
+
<% end %>
|
8
|
+
<%= render(Primer::Beta::Text.new(font_size: :small, mt: 1, color: :muted, id: "scCaption-horiz")) { "Change the way the file is viewed" } %>
|
9
|
+
<% end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= render(Primer::Beta::Subhead.new) do |component| %>
|
2
|
+
<% component.with_heading(id: "scLabel-vert") { "File view" } %>
|
3
|
+
<% component.with_description(id: "scCaption-vert") { "Change the way the file is viewed" } %>
|
4
|
+
<% component.with_actions do %>
|
5
|
+
<%= render(Primer::Alpha::SegmentedControl.new("aria-labelledby": "scLabel-vert", "aria-describedby": "scCaption-vert")) do |component| %>
|
6
|
+
<% component.with_item(label: "Preview", selected: true) %>
|
7
|
+
<% component.with_item(label: "Raw") %>
|
8
|
+
<% component.with_item(label: "Blame") %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
@@ -152,13 +152,19 @@ module Primer
|
|
152
152
|
# NOTE: this preview uses a group to force it's display below the other groups
|
153
153
|
# @!group With link as tag
|
154
154
|
def with_link_as_tag
|
155
|
-
render(Primer::Alpha::SegmentedControl.new) do |component|
|
155
|
+
render(Primer::Alpha::SegmentedControl.new("aria-label": "File view")) do |component|
|
156
156
|
component.with_item(tag: :a, href: "#", label: "Preview", icon: :eye, selected: true)
|
157
157
|
component.with_item(tag: :a, href: "#", label: "Raw", icon: :"file-code")
|
158
158
|
component.with_item(tag: :a, href: "#", label: "Blame", icon: :people)
|
159
159
|
end
|
160
160
|
end
|
161
161
|
# @!endgroup
|
162
|
+
|
163
|
+
# @!group With aria labeled headings
|
164
|
+
def with_subhead_actions; end
|
165
|
+
|
166
|
+
def with_label_and_caption; end
|
167
|
+
# @!endgroup
|
162
168
|
end
|
163
169
|
end
|
164
170
|
end
|
@@ -144,6 +144,20 @@ module Primer
|
|
144
144
|
end
|
145
145
|
#
|
146
146
|
# @!endgroup
|
147
|
+
|
148
|
+
# @!group Auto check
|
149
|
+
#
|
150
|
+
# @label Auto check request ok
|
151
|
+
def with_auto_check_ok
|
152
|
+
render(Primer::Alpha::TextField.new(auto_check_src: UrlHelpers.example_check_ok_path, name: "my-text-field", label: "My text field"))
|
153
|
+
end
|
154
|
+
|
155
|
+
# @label Auto check request error
|
156
|
+
def with_auto_check_error
|
157
|
+
render(Primer::Alpha::TextField.new(auto_check_src: UrlHelpers.example_check_error_path, name: "my-text-field", label: "My text field"))
|
158
|
+
end
|
159
|
+
#
|
160
|
+
# @!endgroup
|
147
161
|
end
|
148
162
|
end
|
149
163
|
end
|
@@ -9,31 +9,31 @@ module Primer
|
|
9
9
|
include ActionView::Helpers::FormTagHelper
|
10
10
|
|
11
11
|
def playground
|
12
|
-
render(ToggleSwitch.new(src:
|
12
|
+
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path))
|
13
13
|
end
|
14
14
|
|
15
15
|
def default
|
16
|
-
render(ToggleSwitch.new(src:
|
16
|
+
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path))
|
17
17
|
end
|
18
18
|
|
19
19
|
def checked
|
20
|
-
render(ToggleSwitch.new(src:
|
20
|
+
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, checked: true))
|
21
21
|
end
|
22
22
|
|
23
23
|
def disabled
|
24
|
-
render(ToggleSwitch.new(src:
|
24
|
+
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, enabled: false))
|
25
25
|
end
|
26
26
|
|
27
27
|
def checked_disabled
|
28
|
-
render(ToggleSwitch.new(src:
|
28
|
+
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, checked: true, enabled: false))
|
29
29
|
end
|
30
30
|
|
31
31
|
def small
|
32
|
-
render(ToggleSwitch.new(src:
|
32
|
+
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, size: :small))
|
33
33
|
end
|
34
34
|
|
35
35
|
def with_status_label_position_end
|
36
|
-
render(ToggleSwitch.new(src:
|
36
|
+
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, status_label_position: :end))
|
37
37
|
end
|
38
38
|
|
39
39
|
def with_a_bad_src
|
@@ -45,11 +45,11 @@ module Primer
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def with_csrf_token
|
48
|
-
render(ToggleSwitch.new(src:
|
48
|
+
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, csrf_token: "let_me_in"))
|
49
49
|
end
|
50
50
|
|
51
51
|
def with_bad_csrf_token
|
52
|
-
render(ToggleSwitch.new(src:
|
52
|
+
render(ToggleSwitch.new(src: UrlHelpers.toggle_switch_index_path, csrf_token: "i_am_a_criminal"))
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|