playbook_ui 12.23.0 → 12.24.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown756

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_swift.md +1 -0
  3. data/app/pb_kits/playbook/pb_avatar/docs/example.yml +2 -0
  4. data/app/pb_kits/playbook/pb_card/_card.tsx +1 -0
  5. data/app/pb_kits/playbook/pb_date/_date.tsx +96 -42
  6. data/app/pb_kits/playbook/pb_date/date.html.erb +22 -2
  7. data/app/pb_kits/playbook/pb_date/date.rb +2 -0
  8. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.html.erb +30 -0
  9. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +47 -0
  10. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.md +1 -0
  11. data/app/pb_kits/playbook/pb_date/docs/example.yml +4 -4
  12. data/app/pb_kits/playbook/pb_date/docs/index.js +1 -0
  13. data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +26 -0
  14. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +99 -95
  15. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +3 -2
  16. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +1 -1
  17. data/app/pb_kits/playbook/pb_date_picker/date_picker.test.js +44 -1
  18. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +34 -2
  19. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick.html.erb +8 -0
  20. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick.jsx +18 -0
  21. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -0
  22. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +2 -1
  23. data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +164 -0
  24. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_calendar_input_icon.scss +3 -2
  25. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_quick_pick_styles.scss +75 -0
  26. data/app/pb_kits/playbook/pb_docs/kit_example.html.erb +6 -1
  27. data/app/pb_kits/playbook/pb_docs/kit_example.rb +13 -4
  28. data/app/pb_kits/playbook/pb_nav/_item.tsx +1 -1
  29. data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +1 -1
  30. data/app/pb_kits/playbook/pb_time/_time.tsx +71 -35
  31. data/app/pb_kits/playbook/pb_time/docs/_time_unstyled.html.erb +37 -0
  32. data/app/pb_kits/playbook/pb_time/docs/_time_unstyled.jsx +58 -0
  33. data/app/pb_kits/playbook/pb_time/docs/_time_unstyled.md +1 -0
  34. data/app/pb_kits/playbook/pb_time/docs/example.yml +2 -0
  35. data/app/pb_kits/playbook/pb_time/docs/index.js +1 -0
  36. data/app/pb_kits/playbook/pb_time/time.html.erb +26 -7
  37. data/app/pb_kits/playbook/pb_time/time.rb +2 -0
  38. data/app/pb_kits/playbook/pb_title/_title.scss +3 -1
  39. data/app/pb_kits/playbook/pb_title/_title.tsx +3 -2
  40. data/app/pb_kits/playbook/pb_title/docs/_title_light_weight.html.erb +1 -0
  41. data/app/pb_kits/playbook/pb_title/docs/_title_light_weight.jsx +11 -6
  42. data/app/pb_kits/playbook/pb_title/docs/_title_light_weight.md +2 -2
  43. data/app/pb_kits/playbook/pb_title/title.rb +10 -3
  44. data/app/pb_kits/playbook/pb_title/title.test.js +3 -3
  45. data/app/pb_kits/playbook/tokens/_screen_sizes.scss +19 -0
  46. data/app/pb_kits/playbook/utilities/_spacing.scss +27 -1
  47. data/app/pb_kits/playbook/utilities/globalProps.ts +61 -16
  48. data/dist/playbook-rails.js +323 -0
  49. data/lib/playbook/pb_doc_helper.rb +4 -1
  50. data/lib/playbook/spacing.rb +20 -5
  51. data/lib/playbook/version.rb +2 -2
  52. data/lib/playbook.rb +1 -2
  53. metadata +23 -41
  54. data/app/pb_kits/playbook/pb_docs/kit_api.html.erb +0 -311
  55. data/app/pb_kits/playbook/pb_docs/kit_api.rb +0 -149
  56. data/lib/playbook/markdown/helper.rb +0 -132
  57. data/lib/playbook/markdown.rb +0 -3
@@ -1,149 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Playbook
4
- module PbDocs
5
- class KitApi < Playbook::KitBase
6
- prop :kit, type: Playbook::Props::String, required: true
7
-
8
- def kit_local_props
9
- local = []
10
- kit_props.each do |key, value|
11
- value.kit != Playbook::KitBase && local.push({ key: key, value: value })
12
- end
13
- local
14
- end
15
-
16
- def padding_margin_values
17
- %w[none xxs xs sm md lg xl]
18
- end
19
-
20
- def local_prop_data
21
- local_props = {}
22
-
23
- kit_local_props.each do |key, _value|
24
- name = key[:value].instance_variable_get(:@name)
25
- type = key[:value].class.to_s.split("::").last
26
- default = key[:value].instance_variable_get(:@default)
27
- values = key[:value].instance_variable_get(:@values)
28
- local_props[name.to_sym] = { "type": type, "default": default, "values": values }
29
- end
30
- local_props
31
- end
32
-
33
- def kit_global_props
34
- global_props = {}
35
- global_prop_names = []
36
- global_prop_values = {}
37
- global_props_with_values = {}
38
- global_props_without_values = []
39
- parent_child_object = {}
40
- updated_global_props_with_values = {}
41
-
42
- # extracts the modules from kit_base.rb, which is where we import all the global props that we inject into every rails kit
43
- pb_module = Playbook::KitBase.included_modules.select { |mod| mod.to_s.include?("Playbook::") }
44
-
45
- # loops through the kits and extracts each prop with its values and pushes that to the global_props hash
46
- kit_props.each do |key, value|
47
- value.kit == Playbook::KitBase && global_props[key.to_sym] = value
48
- end
49
-
50
- # loops through the global_props and extracts the name of each prop and pushes that to global_prop_names array
51
- global_props.each do |name, _values|
52
- global_prop_names.push(name)
53
- end
54
-
55
- # Loops through each module in pb_module and searches for methods that end in _values, as these methods hold the values for each prop
56
- # we then save the values and type and push that to the values hash as a key value pair
57
- pb_module.each do |mod|
58
- mod.instance_methods.each do |method_name|
59
- next unless method_name.to_s.end_with?("_values")
60
-
61
- value = send(method_name)
62
- type = value.class
63
- global_prop_values[method_name.to_s.chomp("_values").to_sym] = { "type": type, "values": value }
64
- end
65
- end
66
-
67
- # loops through the global_prop_names array
68
- # then loops through the global_prop_values hash and extracts the values that have the same name found in global_prop_names
69
- # this loop helps ensure only global props values are actually extracted, as there could be other methods that end in _values in the modules we are iterating over
70
- # these verified global props with values are then pushed to the global_props_with_values hash
71
- global_prop_names.each do |name, _prop|
72
- global_prop_values.each do |key, value|
73
- global_props_with_values[key] = value if key == name
74
- end
75
- end
76
-
77
- # now we grab all the global_prop_names that do not have a matching key in global_prop_values.
78
- # This gives us any global prop that did not have any predefined value. like classname and dark
79
- global_props_without_values = global_prop_names - global_prop_values.keys
80
-
81
- # Loops through each module in pb_module and searches for methods that end in _options, as these methods hold all the props in the module
82
- # save the prop names prop values and and parent module name to parent_child_object hash
83
- # this is a comprehensive list of all parent module and children props for edge cases like spacing.rb, that is not named after the props it represents
84
- pb_module.each do |mod|
85
- mod.instance_methods.each do |method_name|
86
- next unless method_name.to_s.end_with?("_options")
87
-
88
- props = send(method_name)
89
- parent = mod.to_s.split("::").last
90
- values = send("#{parent.underscore}_values")
91
- parent_child_object[parent] = { "props": props, "values": values }
92
- end
93
- end
94
-
95
- # loops through each object in parent_child_object and extracts its children (props and values)
96
- # loops through each child and extracts the individual props
97
- # Checks if the props match any of the props in global_props_without_values
98
- # if it does, then we push that prop to global_props_with_values hash
99
- # This extracts the props in the spacing.rb file and any file that is not named after the props it represents
100
- parent_child_object.each do |_parent, children|
101
- children.each do |_child, props|
102
- props.each do |prop, _value|
103
- type = children[:values].class
104
- values = children[:values]
105
- global_props_with_values[prop] = { "type": type, "values": values } if global_props_without_values.include?(prop)
106
- end
107
- end
108
- end
109
-
110
- # loop through the global_props hash and the global_props_with_values hash.
111
- # extract the props from global_props that are not found in global_props_with_values into updated_global_props_with_values
112
- # This is the last piece that grabs the global props that did not have values at all, like classname and dark, and adds it to our hash
113
- global_props.each do |prop, value|
114
- unless global_props_with_values.include?(prop)
115
- type = value.class.to_s.split("::").last
116
- updated_global_props_with_values[prop] = { "type": type }
117
- end
118
- end
119
-
120
- # Merge updated_global_props_with_values into global_props_with_values
121
- # global_props_with_values will now hold all the global props thier values and type
122
- global_props_with_values.merge!(updated_global_props_with_values)
123
-
124
- global_props_with_values
125
- end
126
-
127
- def global_prop_data
128
- global_props = {}
129
-
130
- kit_global_props.each do |key, value|
131
- type = value[:type]
132
- values = value[:values]
133
- global_props[key] = { "type": type, "values": values }
134
- end
135
- global_props
136
- end
137
-
138
- def kit_props
139
- kit_class.props
140
- end
141
-
142
- private
143
-
144
- def kit_class
145
- @kit_class ||= Playbook::KitResolver.resolve(kit.to_s)
146
- end
147
- end
148
- end
149
- end
@@ -1,132 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "redcarpet"
4
- require "rouge"
5
- require "rouge/plugins/redcarpet"
6
- require "action_view"
7
-
8
- module Playbook
9
- module Markdown
10
- module Helper
11
- def self.call(template, _source)
12
- markdown(template.source)
13
- end
14
-
15
- def render_markdown(text)
16
- # rubocop:disable Security/Eval
17
- eval(Playbook::Markdown::Helper.markdown(text))
18
- # rubocop:enable Security/Eval
19
- end
20
-
21
- def self.markdown(text)
22
- options = {
23
- filter_html: false,
24
- hard_wrap: true,
25
- link_attributes: { rel: "nofollow", target: "_blank" },
26
- space_after_headers: true,
27
- fenced_code_blocks: true,
28
- no_styles: false,
29
- safe_links_only: true,
30
- }
31
-
32
- extensions = {
33
- lax_spacing: true,
34
- no_intra_emphasis: true,
35
- autolink: true,
36
- superscript: true,
37
- fenced_code_blocks: true,
38
- tables: true,
39
- disable_indented_code_blocks: false,
40
- strikethrough: true,
41
- underline: true,
42
- highlight: true,
43
- footnotes: true,
44
- with_toc_data: true,
45
- }
46
-
47
- renderer = HTMLBlockCode.new(options)
48
- # toc_renderer = Redcarpet::Render::HTML_TOC.new(with_toc_data: true)
49
- # @TOC = Redcarpet::Markdown.new(toc_renderer)
50
- # puts "TOC: #{@TOC.inspect}"
51
- markdown = Redcarpet::Markdown.new(renderer, extensions)
52
- "#{markdown.render(text).inspect}.html_safe;"
53
- end
54
-
55
- def rouge(text, language)
56
- formatter = Rouge::Formatters::HTML.new(scope: ".highlight")
57
- lexer = Rouge::Lexer.find(language)
58
- formatter.format(lexer.lex(text))
59
- end
60
-
61
- class HTML < Redcarpet::Render::HTML
62
- include Rouge::Plugins::Redcarpet
63
- end
64
-
65
- def rouge_markdown(text)
66
- render_options = {
67
- filter_html: true,
68
- hard_wrap: true,
69
- link_attributes: { rel: "nofollow" },
70
- }
71
- renderer = HTML.new(render_options)
72
-
73
- extensions = {
74
- autolink: true,
75
- fenced_code_blocks: true,
76
- lax_spacing: true,
77
- no_intra_emphasis: true,
78
- strikethrough: true,
79
- superscript: true,
80
- }
81
- markdown = Redcarpet::Markdown.new(renderer, extensions)
82
- markdown.render(text)
83
- end
84
- end
85
-
86
- class HTMLWithPants < Redcarpet::Render::HTML
87
- include Redcarpet::Render::SmartyPants
88
- end
89
-
90
- class HTML < Redcarpet::Render::HTML
91
- include Rouge::Plugins::Redcarpet
92
- end
93
-
94
- class HTMLBlockCode < Redcarpet::Render::HTML
95
- include ActionView::Helpers::AssetTagHelper
96
-
97
- # def block_code(code, language)
98
- # "\n.nf\n#{normal_text(rouge(code, language))}\n.fi\n"
99
- # end
100
-
101
- def table(header, body)
102
- "<table class='pb_table table-sm table-responsive-collapse table-card table-collapse-sm'>" \
103
- "<thead>#{header}</thead>" \
104
- "<tbody>#{body}</tbody>" \
105
- "</table>"
106
- end
107
-
108
- def header(title, level)
109
- @headers ||= []
110
- permalink = title.gsub(/\W+/, "-")
111
- if @headers.include?(permalink)
112
- permalink += "_1"
113
- loop do
114
- break unless @headers.include?(permalink)
115
-
116
- permalink.gsub!(/_(\d+)$/, "_#{Regexp.last_match(1).to_i + 1}")
117
- end
118
- end
119
- @headers << permalink
120
- permalink_markup = %(<a name="#{permalink}" class="markdown-header-anchor" )
121
- permalink_markup += %(href="##{permalink}"><span class="far fa-link markdown-header-anchor-icon"></span></a>)
122
- %(\n<h#{level} id="#{permalink}">#{title} #{permalink_markup}</h#{level}>\n)
123
- end
124
-
125
- def image(link, title, alt_text)
126
- return nil if link.nil?
127
-
128
- %(<a href="#{link}" target="_blank">#{image_tag(link, title: title, alt: alt_text, class: 'imageloader lazyload')}</a>)
129
- end
130
- end
131
- end
132
- end
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "playbook/markdown/helper"