playbook_ui_docs 13.8.0.pre.alpha.play845allkitsbytypes1258 → 13.9.0.pre.alpha.PLAY962SingleSelect1261
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_button/docs/_button_reaction.html.erb +1 -1
- data/app/pb_kits/playbook/pb_button/docs/_button_reaction.jsx +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.html.erb +6 -7
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_selected_ids.jsx +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single.html.erb +73 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_single.jsx +87 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +3 -2
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +2 -1
- data/dist/menu.yml +110 -281
- data/dist/pb_doc_helper.rb +28 -68
- data/dist/playbook-doc.js +8 -8
- metadata +4 -2
data/dist/pb_doc_helper.rb
CHANGED
@@ -26,81 +26,41 @@ module PlaybookWebsite
|
|
26
26
|
end
|
27
27
|
|
28
28
|
# Deal with lists of kits, used in Playbook doc and Externally
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
kits.
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
# Filter kits that have at least one component compatible with the type
|
42
|
-
kits.select do |kit|
|
43
|
-
kit["components"].any? { |component| component["platforms"].include?(type) }
|
29
|
+
# rubocop:disable Style/StringConcatenation
|
30
|
+
def pb_kits(type: "rails", limit_examples: false, dark_mode: false, method: get_kits)
|
31
|
+
display_kits = []
|
32
|
+
kits = method
|
33
|
+
kits.each do |kit|
|
34
|
+
if kit.is_a?(Hash)
|
35
|
+
nav_hash_array(kit).each do |sub_kit|
|
36
|
+
display_kits << render_pb_doc_kit(sub_kit, type, limit_examples, false, dark_mode)
|
37
|
+
end
|
38
|
+
else
|
39
|
+
display_kits << render_pb_doc_kit(kit, type, limit_examples, false, dark_mode)
|
40
|
+
end
|
44
41
|
end
|
42
|
+
raw("<div class='pb--docItem'>" + display_kits.join("</div><div class='pb--docItem'>") + "</div>")
|
45
43
|
end
|
44
|
+
# rubocop:enable Style/StringConcatenation
|
46
45
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
components = kit["components"].map { |c| c["name"] }
|
53
|
-
|
54
|
-
all_kits << if components.size == 1
|
55
|
-
components.first
|
56
|
-
else
|
57
|
-
{ kit_name => components }
|
58
|
-
end
|
59
|
-
end
|
46
|
+
# rubocop:disable Naming/AccessorMethodName
|
47
|
+
def get_kits
|
48
|
+
menu = YAML.load_file(Playbook::Engine.root.join("dist/menu.yml"))
|
49
|
+
menu["kits"]
|
50
|
+
end
|
60
51
|
|
61
|
-
|
52
|
+
def get_kits_pb_website
|
53
|
+
menu = YAML.load_file(Rails.root.join("config/menu.yml"))
|
54
|
+
menu["kits"]
|
62
55
|
end
|
56
|
+
# rubocop:enable Naming/AccessorMethodName
|
63
57
|
|
64
58
|
# rubocop:disable Style/OptionalBooleanParameter
|
65
|
-
def render_pb_doc_kit(
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
title = ""
|
71
|
-
|
72
|
-
# Check if parent_kit is nil
|
73
|
-
if parent_kit.nil?
|
74
|
-
title = pb_doc_render_clickable_title(kit_name, type)
|
75
|
-
component_content = raw("<div class='pb--docItem-ui'>
|
76
|
-
#{pb_kit(kit: kit_name, type: type, show_code: code, limit_examples: limit_examples, dark_mode: dark_mode)}</div>")
|
77
|
-
else
|
78
|
-
# Filter components based on the specified type
|
79
|
-
components = parent_kit["components"].select { |component| component["platforms"].include?(type) }
|
80
|
-
|
81
|
-
# If it's a parent with components, accumulate the UI content for child components
|
82
|
-
if components.any?
|
83
|
-
component_content = components.map do |component|
|
84
|
-
component_name = component["name"]
|
85
|
-
title = pb_doc_render_clickable_title(component_name, type) # Use component_name for the title
|
86
|
-
|
87
|
-
# Render the component UI content with the same styles/tags as the parent
|
88
|
-
component_ui = raw("<div class='pb--docItem-ui'>
|
89
|
-
#{pb_kit(kit: component_name, type: type, show_code: code, limit_examples: limit_examples, dark_mode: dark_mode)}
|
90
|
-
</div>")
|
91
|
-
|
92
|
-
# Combine the component name and component UI content
|
93
|
-
"#{title}#{component_ui}"
|
94
|
-
end.join.to_s
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
# Combine the component content and UI content for the parent kit
|
99
|
-
if parent_kit.nil?
|
100
|
-
"#{title}#{component_content}".to_s
|
101
|
-
else
|
102
|
-
component_content.to_s.to_s
|
103
|
-
end
|
59
|
+
def render_pb_doc_kit(kit, type, limit_examples, code = true, dark_mode = false)
|
60
|
+
title = pb_doc_render_clickable_title(kit, type)
|
61
|
+
ui = raw("<div class='pb--docItem-ui'>
|
62
|
+
#{pb_kit(kit: kit, type: type, show_code: code, limit_examples: limit_examples, dark_mode: dark_mode)}</div>")
|
63
|
+
title + ui
|
104
64
|
end
|
105
65
|
# rubocop:enable Style/OptionalBooleanParameter
|
106
66
|
|