primer_view_components 0.1.7 → 0.1.9
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/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 +2 -2
- data/app/assets/styles/primer_view_components.css.map +1 -1
- data/app/components/primer/alpha/action_list/divider.rb +1 -1
- data/app/components/primer/alpha/action_list/heading.html.erb +2 -2
- data/app/components/primer/alpha/action_list/heading.rb +9 -5
- data/app/components/primer/alpha/action_list/item.rb +1 -3
- data/app/components/primer/alpha/action_list.css +1 -1
- data/app/components/primer/alpha/action_list.css.json +1 -0
- data/app/components/primer/alpha/action_list.css.map +1 -1
- data/app/components/primer/alpha/action_list.html.erb +1 -0
- data/app/components/primer/alpha/action_list.pcss +5 -0
- data/app/components/primer/alpha/action_list.rb +14 -11
- data/app/components/primer/alpha/action_menu.rb +1 -1
- data/app/components/primer/alpha/dialog.rb +4 -0
- data/app/components/primer/alpha/modal_dialog.js +6 -0
- data/app/components/primer/alpha/modal_dialog.ts +6 -0
- data/app/components/primer/alpha/nav_list/divider.rb +14 -0
- data/app/components/primer/alpha/nav_list/group.html.erb +7 -0
- data/app/components/primer/alpha/nav_list/group.rb +24 -11
- data/app/components/primer/alpha/nav_list/item.rb +4 -0
- data/app/components/primer/alpha/nav_list.d.ts +0 -1
- data/app/components/primer/alpha/nav_list.html.erb +9 -4
- data/app/components/primer/alpha/nav_list.js +3 -4
- data/app/components/primer/alpha/nav_list.rb +87 -10
- data/app/components/primer/alpha/nav_list.ts +3 -2
- data/app/components/primer/alpha/overlay/header.html.erb +5 -3
- data/app/components/primer/alpha/overlay/header.rb +4 -1
- data/app/components/primer/alpha/overlay.css +1 -1
- data/app/components/primer/alpha/overlay.css.json +1 -1
- data/app/components/primer/alpha/overlay.css.map +1 -1
- data/app/components/primer/alpha/overlay.pcss +1 -1
- data/app/components/primer/alpha/overlay.rb +1 -0
- data/app/components/primer/alpha/segmented_control.css +1 -1
- data/app/components/primer/alpha/segmented_control.css.json +2 -2
- data/app/components/primer/alpha/segmented_control.css.map +1 -1
- data/app/components/primer/alpha/segmented_control.pcss +10 -8
- data/app/components/primer/alpha/text_field.css +1 -1
- data/app/components/primer/alpha/text_field.css.json +11 -11
- data/app/components/primer/alpha/text_field.css.map +1 -1
- data/app/components/primer/alpha/text_field.pcss +2 -2
- data/app/components/primer/alpha/toggle_switch.css +1 -1
- data/app/components/primer/alpha/toggle_switch.css.json +11 -11
- data/app/components/primer/alpha/toggle_switch.css.map +1 -1
- data/app/components/primer/alpha/toggle_switch.d.ts +1 -1
- data/app/components/primer/alpha/toggle_switch.html.erb +2 -2
- data/app/components/primer/alpha/toggle_switch.js +44 -42
- data/app/components/primer/alpha/toggle_switch.pcss +4 -4
- data/app/components/primer/alpha/toggle_switch.rb +7 -0
- data/app/components/primer/alpha/toggle_switch.ts +50 -41
- data/app/components/primer/beta/auto_complete.rb +1 -1
- data/app/components/primer/beta/button.css +1 -1
- data/app/components/primer/beta/button.css.json +2 -0
- data/app/components/primer/beta/button.css.map +1 -1
- data/app/components/primer/beta/button.pcss +9 -0
- data/app/components/primer/component.rb +3 -96
- data/app/components/primer/focus_group.js +10 -6
- data/app/components/primer/focus_group.ts +10 -5
- data/app/lib/primer/attributes_helper.rb +105 -0
- data/lib/primer/forms/dsl/input.rb +4 -8
- data/lib/primer/forms/dsl/text_field_input.rb +0 -4
- data/lib/primer/forms/dsl/toggle_switch_input.rb +4 -0
- data/lib/primer/forms/form_control.html.erb +3 -5
- data/lib/primer/forms/primer_base_component_wrapper.html.erb +3 -0
- data/lib/primer/forms/primer_base_component_wrapper.rb +24 -0
- data/lib/primer/forms/text_field.rb +6 -0
- data/lib/primer/forms/toggle_switch.html.erb +3 -3
- data/lib/primer/forms/toggle_switch.rb +6 -2
- data/lib/primer/forms/toggle_switch_input.js +7 -2
- data/lib/primer/forms/toggle_switch_input.ts +9 -2
- data/lib/primer/static/generate_info_arch.rb +3 -0
- data/lib/primer/view_components/version.rb +1 -1
- data/lib/primer/yard/component_manifest.rb +1 -1
- data/lib/primer/yard/lookbook_pages_backend.rb +7 -1
- data/lib/primer/yard/registry.rb +4 -0
- data/previews/primer/alpha/nav_list_preview/trailing_action.html.erb +10 -10
- data/previews/primer/alpha/nav_list_preview.rb +37 -16
- data/previews/primer/alpha/overlay_preview/middle_of_page_with_relative_container.html.erb +19 -0
- data/previews/primer/alpha/overlay_preview.rb +31 -0
- data/previews/primer/beta/button_preview/trailing_counter.html.erb +11 -0
- data/previews/primer/beta/button_preview.rb +15 -0
- data/previews/primer/box_preview.rb +28 -0
- data/static/arguments.json +29 -13
- data/static/audited_at.json +1 -0
- data/static/classes.json +3 -0
- data/static/constants.json +3 -0
- data/static/info_arch.json +448 -20
- data/static/previews.json +43 -0
- data/static/statuses.json +1 -0
- metadata +10 -9
- data/lib/tasks/docs.rake +0 -185
- data/lib/tasks/helpers/ast_processor.rb +0 -44
- data/lib/tasks/helpers/ast_traverser.rb +0 -77
- data/lib/tasks/primer_view_components.rake +0 -47
- data/lib/tasks/static.rake +0 -29
- data/lib/tasks/test.rake +0 -83
- data/lib/tasks/utilities.rake +0 -109
data/lib/tasks/utilities.rake
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
namespace :utilities do
|
4
|
-
task :build do
|
5
|
-
require "yaml"
|
6
|
-
require "json"
|
7
|
-
ENV["RAILS_ENV"] = "test"
|
8
|
-
require File.expand_path("./../../demo/config/environment.rb", __dir__)
|
9
|
-
require "primer/classify/utilities"
|
10
|
-
|
11
|
-
# Keys that are looked for to be included in the utilities.yml file
|
12
|
-
# rubocop:disable Lint/ConstantDefinitionInBlock
|
13
|
-
SUPPORTED_KEYS = [
|
14
|
-
/^anim\b/,
|
15
|
-
/^color-bg\b/,
|
16
|
-
/^color-border\b/,
|
17
|
-
/^color-fg\b/,
|
18
|
-
/^col\b/,
|
19
|
-
/^container\b/,
|
20
|
-
/^clearfix\b/,
|
21
|
-
/^d\b/,
|
22
|
-
/^float\b/,
|
23
|
-
/^height\b/,
|
24
|
-
/^hide\b/,
|
25
|
-
/^m[trblxy]?\b/,
|
26
|
-
/^p[trblxy]?\b/,
|
27
|
-
/^position\b/,
|
28
|
-
/^wb\b/,
|
29
|
-
/^width\b/,
|
30
|
-
/^v\b/
|
31
|
-
].freeze
|
32
|
-
|
33
|
-
BREAKPOINTS = [nil, "sm", "md", "lg", "xl"].freeze
|
34
|
-
# rubocop:enable Lint/ConstantDefinitionInBlock
|
35
|
-
|
36
|
-
utility_data = JSON.parse(File.read("app/lib/primer/css/utilities.css.json"))["selectors"]
|
37
|
-
layout_data = JSON.parse(File.read("app/lib/primer/css/layout.css.json"))["selectors"]
|
38
|
-
css_data = utility_data + layout_data
|
39
|
-
|
40
|
-
output = {}
|
41
|
-
|
42
|
-
css_data.each do |selector|
|
43
|
-
selector.sub!(/^./, "")
|
44
|
-
selector.sub!(/:[^\s]*$/, "")
|
45
|
-
|
46
|
-
# Next if selector has ancestors or sibling selectors
|
47
|
-
next if selector.match?(/[:><~\[.]/)
|
48
|
-
next unless SUPPORTED_KEYS.any? { |key| selector =~ key }
|
49
|
-
|
50
|
-
# Dupe so we still have the selector at the end of slicing it up
|
51
|
-
classname = selector.dup
|
52
|
-
key = ""
|
53
|
-
|
54
|
-
# Look for a replacement key
|
55
|
-
Primer::Classify::Utilities::REPLACEMENT_KEYS.each do |k, v|
|
56
|
-
next unless classname.match?(Regexp.new(k))
|
57
|
-
|
58
|
-
key = v
|
59
|
-
classname.sub!(Regexp.new("#{k}-"), "")
|
60
|
-
end
|
61
|
-
|
62
|
-
# If we didn't find a replacement, grab the first text before hyphen
|
63
|
-
if classname == selector
|
64
|
-
key = classname.split("-").first
|
65
|
-
classname.sub!(/^[^-]+-/, "")
|
66
|
-
end
|
67
|
-
|
68
|
-
# Check if the next bit of the classname is a breakpoint
|
69
|
-
if classname.match?(/^(sm-|md-|lg-|xl-)/)
|
70
|
-
breakpoint = classname.split("-").first
|
71
|
-
classname.sub!(/^[^-]+-/, "")
|
72
|
-
end
|
73
|
-
|
74
|
-
# Change the rest from hyphens to underscores
|
75
|
-
classname.sub!(/-/, "_")
|
76
|
-
|
77
|
-
# convert padding/margin negative values ie n7 to -7
|
78
|
-
classname.sub!(/^n/, "-") if classname.match?(/^n[0-9]/)
|
79
|
-
|
80
|
-
# If key and classname are equal, then classname is boolean
|
81
|
-
classname = true if key == classname
|
82
|
-
|
83
|
-
key = key.to_sym
|
84
|
-
|
85
|
-
if classname.is_a?(String)
|
86
|
-
classname = classname.match?(/\A[-+]?[0-9]+\z/) ? classname.to_i : classname.to_sym
|
87
|
-
end
|
88
|
-
|
89
|
-
if output[key].nil?
|
90
|
-
output[key] = { classname => Array.new(5, nil) }
|
91
|
-
elsif output[key][classname].nil?
|
92
|
-
output[key][classname] = Array.new(5, nil)
|
93
|
-
end
|
94
|
-
|
95
|
-
output[key][classname][BREAKPOINTS.index(breakpoint)] = selector
|
96
|
-
end
|
97
|
-
|
98
|
-
output.transform_values! do |x|
|
99
|
-
x.transform_values { |y| y.reverse.drop_while(&:nil?).reverse }
|
100
|
-
end
|
101
|
-
|
102
|
-
custom_utility_data = YAML.load_file("lib/tasks/custom_utilities.yml")
|
103
|
-
output.merge!(custom_utility_data)
|
104
|
-
|
105
|
-
File.open("lib/primer/classify/utilities.yml", "w") do |f|
|
106
|
-
f.puts YAML.dump(output)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|