primer_view_components 0.0.25 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +90 -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/javascripts/primer_view_components.js.map.orig +5 -0
- data/app/assets/javascripts/primer_view_components.js.orig +6 -0
- data/app/components/primer/auto_complete_component.d.ts +1 -0
- data/app/components/primer/auto_complete_component.html.erb +5 -0
- data/app/components/primer/auto_complete_component.js +1 -0
- data/app/components/primer/auto_complete_component.rb +98 -0
- data/app/components/primer/auto_complete_component.ts +1 -0
- data/app/components/primer/auto_complete_item_component.rb +40 -0
- data/app/components/primer/avatar_component.rb +8 -9
- data/app/components/primer/base_component.rb +6 -14
- data/app/components/primer/blankslate_component.html.erb +1 -5
- data/app/components/primer/blankslate_component.rb +2 -0
- data/app/components/primer/border_box_component.rb +32 -6
- data/app/components/primer/box_component.rb +3 -5
- data/app/components/primer/breadcrumb_component.rb +1 -0
- data/app/components/primer/component.rb +1 -13
- data/app/components/primer/counter_component.rb +17 -9
- data/app/components/primer/details_component.rb +3 -3
- data/app/components/primer/dropdown_menu_component.rb +2 -4
- data/app/components/primer/flash_component.html.erb +2 -2
- data/app/components/primer/flash_component.rb +2 -4
- data/app/components/primer/flex_component.rb +16 -16
- data/app/components/primer/heading_component.rb +1 -1
- data/app/components/primer/label_component.rb +5 -11
- data/app/components/primer/layout_component.html.erb +3 -9
- data/app/components/primer/layout_component.rb +30 -5
- data/app/components/primer/link_component.rb +37 -9
- data/app/components/primer/octicon_component.rb +4 -7
- data/app/components/primer/popover_component.html.erb +3 -7
- data/app/components/primer/popover_component.rb +58 -62
- data/app/components/primer/primer.d.ts +3 -0
- data/app/components/primer/primer.js +2 -0
- data/app/components/primer/primer.ts +2 -0
- data/app/components/primer/progress_bar_component.rb +6 -5
- data/app/components/primer/spinner_component.rb +2 -4
- data/app/components/primer/state_component.rb +2 -4
- data/app/components/primer/subhead_component.rb +2 -4
- data/app/components/primer/tab_container_component.d.ts +1 -0
- data/app/components/primer/text_component.rb +3 -1
- data/app/components/primer/time_ago_component.d.ts +1 -0
- data/app/components/primer/time_ago_component.js +1 -0
- data/app/components/primer/time_ago_component.rb +47 -0
- data/app/components/primer/time_ago_component.ts +1 -0
- data/app/components/primer/timeline_item_component.rb +2 -1
- data/app/components/primer/underline_nav_component.html.erb +5 -5
- data/app/components/primer/underline_nav_component.rb +24 -5
- data/app/lib/primer/classify.rb +13 -16
- data/app/lib/primer/classify/cache.rb +8 -3
- data/app/lib/primer/classify/functional_background_colors.rb +61 -0
- data/app/lib/primer/classify/functional_border_colors.rb +51 -0
- data/app/lib/primer/classify/functional_colors.rb +68 -0
- data/app/lib/primer/classify/functional_text_colors.rb +62 -0
- data/app/lib/primer/fetch_or_fallback_helper.rb +17 -4
- data/app/lib/primer/status/dsl.rb +43 -0
- data/app/lib/primer/test_selector_helper.rb +20 -0
- data/app/lib/primer/view_helper.rb +10 -12
- data/lib/primer/view_components/engine.rb +4 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/static/statuses.json +1 -1
- metadata +37 -4
- data/app/lib/primer/view_helper/dsl.rb +0 -34
@@ -1,22 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Primer
|
4
|
-
# Module to allow shorthand calls for
|
5
|
-
#
|
6
|
-
# Registered components can be called with
|
7
|
-
# `primer(:name, **kwargs) { block }` instead of
|
8
|
-
# `render Primer::NameComponent.new(**kwargs) { block }`
|
4
|
+
# Module to allow shorthand calls for Primer components
|
9
5
|
module ViewHelper
|
10
|
-
extend ActiveSupport::Concern
|
11
|
-
|
12
6
|
class ViewHelperNotFound < StandardError; end
|
13
7
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
8
|
+
HELPERS = {
|
9
|
+
octicon: "Primer::OcticonComponent",
|
10
|
+
heading: "Primer::HeadingComponent",
|
11
|
+
time_ago: "Primer::TimeAgoComponent"
|
12
|
+
}.freeze
|
18
13
|
|
19
|
-
|
14
|
+
HELPERS.each do |name, component|
|
15
|
+
define_method "primer_#{name}" do |**component_args, &block|
|
16
|
+
render component.constantize.new(**component_args), &block
|
17
|
+
end
|
20
18
|
end
|
21
19
|
end
|
22
20
|
end
|
@@ -12,6 +12,10 @@ module Primer
|
|
12
12
|
#{root}/app/lib
|
13
13
|
]
|
14
14
|
|
15
|
+
config.primer_view_components = ActiveSupport::OrderedOptions.new
|
16
|
+
config.primer_view_components.force_functional_colors = true
|
17
|
+
config.primer_view_components.silence_deprecations = false
|
18
|
+
|
15
19
|
initializer "primer_view_components.assets" do |app|
|
16
20
|
app.config.assets.precompile += %w[primer_view_components] if app.config.respond_to?(:assets)
|
17
21
|
end
|
data/static/statuses.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"Primer::AvatarComponent":"beta","Primer::AvatarStackComponent":"alpha","Primer::BaseComponent":"
|
1
|
+
{"Primer::AutoCompleteComponent":"alpha","Primer::AutoCompleteItemComponent":"alpha","Primer::AvatarComponent":"beta","Primer::AvatarStackComponent":"alpha","Primer::BaseComponent":"beta","Primer::BlankslateComponent":"beta","Primer::BorderBoxComponent":"beta","Primer::BoxComponent":"stable","Primer::BreadcrumbComponent":"beta","Primer::BreadcrumbComponent::ItemComponent":"alpha","Primer::ButtonComponent":"alpha","Primer::ButtonGroupComponent":"alpha","Primer::ButtonMarketingComponent":"alpha","Primer::CounterComponent":"beta","Primer::DetailsComponent":"beta","Primer::Dropdown::MenuComponent":"alpha","Primer::DropdownComponent":"alpha","Primer::DropdownMenuComponent":"deprecated","Primer::FlashComponent":"beta","Primer::FlexComponent":"alpha","Primer::FlexItemComponent":"alpha","Primer::HeadingComponent":"beta","Primer::LabelComponent":"beta","Primer::LayoutComponent":"alpha","Primer::LinkComponent":"beta","Primer::MarkdownComponent":"alpha","Primer::MenuComponent":"alpha","Primer::OcticonComponent":"beta","Primer::PopoverComponent":"beta","Primer::ProgressBarComponent":"beta","Primer::SpinnerComponent":"beta","Primer::StateComponent":"beta","Primer::SubheadComponent":"beta","Primer::TabContainerComponent":"alpha","Primer::TabNavComponent":"alpha","Primer::TabNavComponent::TabComponent":"alpha","Primer::TextComponent":"beta","Primer::TimeAgoComponent":"alpha","Primer::TimelineItemComponent":"beta","Primer::TimelineItemComponent::BadgeComponent":"alpha","Primer::TooltipComponent":"alpha","Primer::TruncateComponent":"alpha","Primer::UnderlineNavComponent":"alpha"}
|
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.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octicons_helper
|
@@ -126,6 +126,20 @@ dependencies:
|
|
126
126
|
- - '='
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: 5.6.0
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
name: mocha
|
131
|
+
requirement: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
type: :development
|
137
|
+
prerelease: false
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
129
143
|
- !ruby/object:Gem::Dependency
|
130
144
|
name: pry
|
131
145
|
requirement: !ruby/object:Gem::Requirement
|
@@ -236,6 +250,14 @@ files:
|
|
236
250
|
- README.md
|
237
251
|
- app/assets/javascripts/primer_view_components.js
|
238
252
|
- app/assets/javascripts/primer_view_components.js.map
|
253
|
+
- app/assets/javascripts/primer_view_components.js.map.orig
|
254
|
+
- app/assets/javascripts/primer_view_components.js.orig
|
255
|
+
- app/components/primer/auto_complete_component.d.ts
|
256
|
+
- app/components/primer/auto_complete_component.html.erb
|
257
|
+
- app/components/primer/auto_complete_component.js
|
258
|
+
- app/components/primer/auto_complete_component.rb
|
259
|
+
- app/components/primer/auto_complete_component.ts
|
260
|
+
- app/components/primer/auto_complete_item_component.rb
|
239
261
|
- app/components/primer/avatar_component.rb
|
240
262
|
- app/components/primer/avatar_stack_component.html.erb
|
241
263
|
- app/components/primer/avatar_stack_component.rb
|
@@ -276,6 +298,7 @@ files:
|
|
276
298
|
- app/components/primer/octicon_component.rb
|
277
299
|
- app/components/primer/popover_component.html.erb
|
278
300
|
- app/components/primer/popover_component.rb
|
301
|
+
- app/components/primer/primer.d.ts
|
279
302
|
- app/components/primer/primer.js
|
280
303
|
- app/components/primer/primer.ts
|
281
304
|
- app/components/primer/progress_bar_component.html.erb
|
@@ -286,12 +309,17 @@ files:
|
|
286
309
|
- app/components/primer/state_component.rb
|
287
310
|
- app/components/primer/subhead_component.html.erb
|
288
311
|
- app/components/primer/subhead_component.rb
|
312
|
+
- app/components/primer/tab_container_component.d.ts
|
289
313
|
- app/components/primer/tab_container_component.js
|
290
314
|
- app/components/primer/tab_container_component.rb
|
291
315
|
- app/components/primer/tab_container_component.ts
|
292
316
|
- app/components/primer/tab_nav_component.html.erb
|
293
317
|
- app/components/primer/tab_nav_component.rb
|
294
318
|
- app/components/primer/text_component.rb
|
319
|
+
- app/components/primer/time_ago_component.d.ts
|
320
|
+
- app/components/primer/time_ago_component.js
|
321
|
+
- app/components/primer/time_ago_component.rb
|
322
|
+
- app/components/primer/time_ago_component.ts
|
295
323
|
- app/components/primer/timeline_item_component.html.erb
|
296
324
|
- app/components/primer/timeline_item_component.rb
|
297
325
|
- app/components/primer/tooltip_component.rb
|
@@ -301,10 +329,15 @@ files:
|
|
301
329
|
- app/lib/primer/class_name_helper.rb
|
302
330
|
- app/lib/primer/classify.rb
|
303
331
|
- app/lib/primer/classify/cache.rb
|
332
|
+
- app/lib/primer/classify/functional_background_colors.rb
|
333
|
+
- app/lib/primer/classify/functional_border_colors.rb
|
334
|
+
- app/lib/primer/classify/functional_colors.rb
|
335
|
+
- app/lib/primer/classify/functional_text_colors.rb
|
304
336
|
- app/lib/primer/fetch_or_fallback_helper.rb
|
305
337
|
- app/lib/primer/join_style_arguments_helper.rb
|
338
|
+
- app/lib/primer/status/dsl.rb
|
339
|
+
- app/lib/primer/test_selector_helper.rb
|
306
340
|
- app/lib/primer/view_helper.rb
|
307
|
-
- app/lib/primer/view_helper/dsl.rb
|
308
341
|
- lib/primer/view_components.rb
|
309
342
|
- lib/primer/view_components/engine.rb
|
310
343
|
- lib/primer/view_components/version.rb
|
@@ -331,7 +364,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
331
364
|
- !ruby/object:Gem::Version
|
332
365
|
version: '0'
|
333
366
|
requirements: []
|
334
|
-
rubygems_version: 3.
|
367
|
+
rubygems_version: 3.1.2
|
335
368
|
signing_key:
|
336
369
|
specification_version: 4
|
337
370
|
summary: ViewComponents for the Primer Design System
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "active_support/concern"
|
4
|
-
|
5
|
-
module Primer
|
6
|
-
# :nodoc:
|
7
|
-
module ViewHelper
|
8
|
-
# DSL to allow components to register a View Helper for shorthand calls.
|
9
|
-
#
|
10
|
-
# Example:
|
11
|
-
#
|
12
|
-
# class MyComponent < ViewComponent::Base
|
13
|
-
# include Primer::ViewHelper::Dsl
|
14
|
-
# view_helper :my_component
|
15
|
-
# end
|
16
|
-
module Dsl
|
17
|
-
extend ActiveSupport::Concern
|
18
|
-
|
19
|
-
class ViewHelperAlreadyDefined < StandardError; end
|
20
|
-
|
21
|
-
included do
|
22
|
-
class_attribute :primer_helpers, instance_writer: false, default: {}
|
23
|
-
end
|
24
|
-
|
25
|
-
class_methods do
|
26
|
-
def view_helper(name)
|
27
|
-
raise ViewHelperAlreadyDefined, "#{name} is already defined" if primer_helpers[name].present?
|
28
|
-
|
29
|
-
primer_helpers[name] = self
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|