playbook_ui_docs 13.29.0.pre.alpha.removeduplicatekitexampleclass3063 → 13.30.0.pre.alpha.PBNTR353draggablev53136

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.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_horizontal.html.erb +58 -0
  3. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_horizontal.jsx +68 -0
  4. data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +2 -0
  5. data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +1 -0
  6. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx +3 -2
  7. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.md +2 -2
  8. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers.jsx +13 -8
  9. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers.md +1 -0
  10. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.jsx +23 -35
  11. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.md +5 -0
  12. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx +7 -7
  13. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.md +7 -1
  14. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx +11 -9
  15. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.md +7 -0
  16. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.html.erb +24 -0
  17. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.jsx +40 -0
  18. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +7 -0
  19. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_multi_directional.html.erb +11 -0
  20. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_multi_directional.jsx +36 -0
  21. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_multi_directional.md +5 -0
  22. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +8 -0
  23. data/app/pb_kits/playbook/pb_overlay/docs/index.js +2 -0
  24. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column_rails.html.erb +32 -33
  25. data/dist/app/components/playbook/pb_docs/kit_example.rb +94 -0
  26. data/dist/menu.yml +5 -1
  27. data/dist/playbook-doc.js +9 -9
  28. metadata +16 -2
@@ -0,0 +1,8 @@
1
+ examples:
2
+ react:
3
+ - overlay_default: Default
4
+ - overlay_multi_directional: Multi-directional
5
+
6
+ rails:
7
+ - overlay_default: Default
8
+ - overlay_multi_directional: Multi-directional
@@ -0,0 +1,2 @@
1
+ export { default as OverlayDefault } from './_overlay_default.jsx'
2
+ export { default as OverlayMultiDirectional } from './_overlay_multi_directional.jsx'
@@ -1,34 +1,33 @@
1
- <%= pb_rails("table") do %>
2
- <thead>
3
- <tr>
4
- <th>Column 1</th>
5
- <th>Column 2</th>
6
- <th>Column 3</th>
7
- <th align="center">Rating</th>
8
- <th align="right">Money</th>
9
- </tr>
10
- </thead>
11
- <tbody>
12
- <tr>
13
- <td>Value 1</td>
14
- <td>Value 2</td>
15
- <td>Value 3</td>
16
- <td align="center">3</td>
17
- <td align="right">$57.32</td>
18
- </tr>
19
- <tr>
20
- <td>Value 1</td>
21
- <td>Value 2</td>
22
- <td>Value 3</td>
23
- <td align="center">2</td>
24
- <td align="right">$5,657.08</td>
25
- </tr>
26
- <tr>
27
- <td>Value 1</td>
28
- <td>Value 2</td>
29
- <td>Value 3</td>
30
- <td align="center">4</td>
31
- <td align="right">$358.77</td>
32
- </tr>
33
- </tbody>
1
+ <%= pb_rails("table") do %> <%= pb_rails("table/table_head") do %>
2
+ <%= pb_rails("table/table_row") do %>
3
+ <%= pb_rails("table/table_header", props: { text: "Column 1"}) %>
4
+ <%= pb_rails("table/table_header", props: { text: "Column 2"}) %>
5
+ <%= pb_rails("table/table_header", props: { text: "Column 3"}) %>
6
+ <%= pb_rails("table/table_header", props: { text: "Rating", text_align: "center" }) %>
7
+ <%= pb_rails("table/table_header", props: { text: "Money", text_align: "right" }) %>
8
+ <% end %>
9
+ <% end %>
10
+ <%= pb_rails("table/table_body") do %>
11
+ <%= pb_rails("table/table_row") do %>
12
+ <%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
13
+ <%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
14
+ <%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
15
+ <%= pb_rails("table/table_cell", props: { text: "3", text_align: "center" }) %>
16
+ <%= pb_rails("table/table_cell", props: { text: "$57.32", text_align: "right" }) %>
17
+ <% end %>
18
+ <%= pb_rails("table/table_row") do %>
19
+ <%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
20
+ <%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
21
+ <%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
22
+ <%= pb_rails("table/table_cell", props: { text: "2", text_align: "center" }) %>
23
+ <%= pb_rails("table/table_cell", props: { text: "$5,657.08", text_align: "right" }) %>
24
+ <% end %>
25
+ <%= pb_rails("table/table_row") do %>
26
+ <%= pb_rails("table/table_cell", props: { text: "Value 1"}) %>
27
+ <%= pb_rails("table/table_cell", props: { text: "Value 2"}) %>
28
+ <%= pb_rails("table/table_cell", props: { text: "Value 3"}) %>
29
+ <%= pb_rails("table/table_cell", props: { text: "4", text_align: "center" }) %>
30
+ <%= pb_rails("table/table_cell", props: { text: "$358.77", text_align: "right" }) %>
31
+ <% end %>
32
+ <% end %>
34
33
  <% end %>
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rubocop:disable Style/CaseLikeIf
4
+ module Playbook
5
+ module PbDocs
6
+ class KitExample < Playbook::KitBase
7
+ prop :kit, type: Playbook::Props::String, required: true
8
+ prop :example_title, type: Playbook::Props::String, required: true
9
+ prop :example_key, type: Playbook::Props::String, required: true
10
+ prop :show_code, type: Playbook::Props::Boolean, default: true
11
+ prop :type, type: Playbook::Props::Enum, values: %w[rails react swift], default: "rails"
12
+ prop :dark, type: Playbook::Props::Boolean, default: false
13
+
14
+ include PlaybookWebsite::Markdown::Helper
15
+
16
+ def example
17
+ if type == "rails"
18
+ render inline: source
19
+ elsif type == "react"
20
+ react_component example_key.camelize, { dark: dark }
21
+ elsif type == "swift"
22
+ ## render the markdown file
23
+ render inline: source
24
+ end
25
+ end
26
+
27
+ def description
28
+ @description ||= read_kit_file("docs", "_#{example_key}.md")
29
+ end
30
+
31
+ def highlighter
32
+ type.eql?("rails") ? "erb" : "react"
33
+ end
34
+
35
+ def source
36
+ @source ||= begin
37
+ extension = if type == "rails"
38
+ "html.erb"
39
+ else
40
+ type == "swift" ? "swift" : "jsx"
41
+ end
42
+ stringified_code = read_kit_file("docs", "_#{example_key}.#{extension}")
43
+ sanitize_code(stringified_code)
44
+ end
45
+ end
46
+
47
+ def tsx_source
48
+ read_kit_file("", "_#{example_key}.tsx")
49
+ end
50
+
51
+ private
52
+
53
+ def sanitize_code(stringified_code)
54
+ stringified_code = stringified_code.gsub('"../.."', '"playbook-ui"')
55
+ .gsub('"../../"', '"playbook-ui"')
56
+ .gsub("'../../'", "'playbook-ui'")
57
+ .gsub("'../..'", "'playbook-ui'")
58
+ .gsub(%r{from "../.*}, "from 'playbook-ui'")
59
+ .gsub(%r{from '../.*}, "from 'playbook-ui'")
60
+ .gsub("'../../../../../../playbook-website/app/javascript/scripts/custom-icons'", "'your-directory/custom-icons.js'")
61
+ stringified_code = dark ? stringified_code.gsub("{...props}", "dark") : stringified_code.gsub(/\s*{...props}\s*\n/, "\n")
62
+ if stringified_code.include?("props: { ")
63
+ stringified_code = stringified_code.gsub("props: {", "props: {dark: true,") if type == "rails" && dark
64
+ elsif type == "rails" && dark
65
+ stringified_code = stringified_code.gsub("props: {", "props: {\n dark: true,")
66
+ end
67
+ stringified_code.gsub(" {...props}", "")
68
+ end
69
+
70
+ def read_kit_file(folder, file_name)
71
+ name_array = file_name.split(".")
72
+ path = ::Playbook.kit_path(kit, folder, file_name)
73
+ if name_array[1] != "md"
74
+ (path.exist? ? path.read : "")
75
+ else
76
+ if path.exist?
77
+ path.read
78
+ elsif type == "rails"
79
+ name_array[0] += "_rails"
80
+ file_name = name_array.join(".")
81
+ path = ::Playbook.kit_path(kit, folder, file_name)
82
+ elsif type == "react"
83
+ name_array[0] += "_react"
84
+ file_name = name_array.join(".")
85
+ path = ::Playbook.kit_path(kit, folder, file_name)
86
+ end
87
+ (path.exist? ? path.read : "")
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+
94
+ # rubocop:enable Style/CaseLikeIf
data/dist/menu.yml CHANGED
@@ -352,6 +352,9 @@ kits:
352
352
  platforms: *web
353
353
  description:
354
354
  status: "stable"
355
+ - name: "overlay"
356
+ platforms: *web
357
+ status: "stable"
355
358
  - name: "draggable"
356
359
  platforms: *react_only
357
360
  description:
@@ -467,4 +470,5 @@ kits:
467
470
  status: "stable"
468
471
  - name: "user"
469
472
  platforms: *web
470
- description: This kit was created for having a systematic way of displaying users with avatar, titles, name and territory. This is a versatile kit with features than can be added to display more info.
473
+ description: This kit was created for having a systematic way of displaying users with avatar, titles, name and territory. This is a versatile kit with features than can be added to display more info.
474
+ status: "stable"