playbook_ui 12.39.0.pre.alpha.salesbookmismatchingdate1117 → 13.0.0.pre.alpha.PLAY966collapsiblenav41126

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +1 -1
  3. data/app/pb_kits/playbook/pb_kit/dateTime.ts +41 -48
  4. data/app/pb_kits/playbook/pb_nav/_bold_mixin.scss +16 -14
  5. data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +86 -115
  6. data/app/pb_kits/playbook/pb_nav/_collapsible_trail_mixin.scss +14 -0
  7. data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +58 -57
  8. data/app/pb_kits/playbook/pb_nav/_item.tsx +234 -138
  9. data/app/pb_kits/playbook/pb_nav/_nav.scss +38 -0
  10. data/app/pb_kits/playbook/pb_nav/_nav.tsx +17 -1
  11. data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +9 -11
  12. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +50 -58
  13. data/app/pb_kits/playbook/pb_nav/docs/_block_no_title_nav.jsx +1 -1
  14. data/app/pb_kits/playbook/pb_nav/docs/_borderless_nav.jsx +4 -1
  15. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.html.erb +4 -4
  16. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +4 -10
  17. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +5 -1
  18. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +12 -12
  19. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.jsx +13 -1
  20. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.md +1 -1
  21. data/app/pb_kits/playbook/pb_nav/docs/_no_highlight_nav.jsx +4 -1
  22. data/app/pb_kits/playbook/pb_nav/docs/_subtle_nav.jsx +4 -1
  23. data/app/pb_kits/playbook/pb_nav/docs/_subtle_with_icons_nav.jsx +4 -1
  24. data/app/pb_kits/playbook/pb_nav/docs/example.yml +5 -5
  25. data/app/pb_kits/playbook/pb_nav/item.html.erb +19 -12
  26. data/app/pb_kits/playbook/pb_nav/item.rb +55 -14
  27. data/app/pb_kits/playbook/pb_nav/nav.html.erb +3 -1
  28. data/app/pb_kits/playbook/pb_nav/navTypes.ts +25 -0
  29. data/app/pb_kits/playbook/pb_time/_time.tsx +1 -1
  30. data/dist/playbook-rails.js +2 -2
  31. data/lib/playbook/version.rb +2 -2
  32. metadata +4 -3
  33. data/app/pb_kits/playbook/pb_nav/_mixins.scss +0 -5
@@ -22,31 +22,72 @@ module Playbook
22
22
  default: "_self"
23
23
  def classname
24
24
  if collapsible
25
- "#{generate_classname('pb_nav_list_kit_item', active_class)} #{generate_classname('pb_collapsible_nav_item', active_class, collapsible_trail_class)} #{font_size_class} #{font_weight_class}"
25
+ "#{generate_classname('pb_nav_list_kit_item', active_class)} #{generate_classname('pb_collapsible_nav_item', active_class, collapsible_trail_class)} #{font_size_class} #{font_weight_class} pb_nav_list_item_link_collapsible"
26
26
  else
27
- "#{generate_classname('pb_nav_list_kit_item', active_class)} #{font_size_class} #{font_weight_class}"
27
+ "#{generate_classname('pb_nav_list_kit_item', active_class)} #{font_size_class} #{font_weight_class} pb_nav_list_item_link"
28
28
  end
29
29
  end
30
30
 
31
- def tag
32
- link ? "a" : "div"
31
+ def spacing_props
32
+ if collapsible
33
+ if object.margin || object.margin_x || object.margin_y || object.margin_bottom || object.margin_top || object.margin_right || object.margin_left
34
+ # Call the original method
35
+ original_result = super
36
+
37
+ # Remove p_value, px_value, py_value, etc. based on the object's properties
38
+ margin_classes_to_remove = []
39
+ margin_classes_to_remove << "m_#{object.margin}" if object.margin
40
+ margin_classes_to_remove << "mx_#{object.margin_x}" if object.margin_x
41
+ margin_classes_to_remove << "my_#{object.margin_y}" if object.margin_y
42
+ margin_classes_to_remove << "mb_#{object.margin_bottom}" if object.margin_bottom
43
+ margin_classes_to_remove << "mt_#{object.margin_top}" if object.margin_top
44
+ margin_classes_to_remove << "mr_#{object.margin_right}" if object.margin_right
45
+ margin_classes_to_remove << "ml_#{object.margin_left}" if object.margin_left
46
+
47
+ margin_classes_to_remove.each do |class_to_remove|
48
+ original_result.gsub!(class_to_remove, "")
49
+ end
50
+
51
+ original_result.strip
52
+ else
53
+ super
54
+ end
55
+ else
56
+ super
57
+ end
33
58
  end
34
59
 
35
- def options
36
- {
37
- class: collapsible ? "pb_nav_list_item_link_collapsible" : "pb_nav_list_item_link",
38
- }.compact
60
+ def margin_classes
61
+ margin_attributes = {
62
+ margin: "m",
63
+ margin_x: "mx",
64
+ margin_y: "my",
65
+ margin_bottom: "mb",
66
+ margin_top: "mt",
67
+ margin_right: "mr",
68
+ margin_left: "ml",
69
+ }
70
+
71
+ # rubocop:disable Style/RedundantAssignment
72
+ margin_classes = margin_attributes.map do |attr, class_prefix|
73
+ # rubocop:enable Style/RedundantAssignment
74
+ value = object.public_send(attr)
75
+ " #{class_prefix}_#{value}" if value
76
+ end.compact.join
77
+
78
+ margin_classes
39
79
  end
40
80
 
41
- def link_options
42
- options.merge(
43
- href: link,
44
- target: target
45
- )
81
+ def tag
82
+ link ? "a" : "div"
46
83
  end
47
84
 
48
85
  def collapsible_icons
49
- icon_right.present? ? icon_right : %w[plus minus]
86
+ icon_right.present? && icon_right
87
+ end
88
+
89
+ def collapsible_nav_classname
90
+ "collapsible_nav_wrapper_#{active_class}_#{collapsible_trail_class}"
50
91
  end
51
92
 
52
93
  private
@@ -10,5 +10,7 @@
10
10
  <% end %>
11
11
  <% end %>
12
12
  <% end %>
13
- <ul><%= content.presence %></ul>
13
+ <div class='pb_nav_wrapper'>
14
+ <%= content.presence %>
15
+ </div>
14
16
  <% end %>
@@ -0,0 +1,25 @@
1
+ import { Spacing } from "../types";
2
+
3
+ export type SpacingObject = {
4
+ margin?: Spacing;
5
+ marginBottom?: Spacing;
6
+ marginTop?: Spacing;
7
+ marginRight?: Spacing;
8
+ marginLeft?: Spacing;
9
+ margingX?: Spacing;
10
+ marginY?: Spacing;
11
+ padding?: Spacing;
12
+ paddingBottom?: Spacing;
13
+ paddingTop?: Spacing;
14
+ paddingRight?: Spacing;
15
+ paddingLeft?: Spacing;
16
+ paddingX?: Spacing;
17
+ paddingY?: Spacing;
18
+ };
19
+
20
+ export type NavChildProps = {
21
+ orientation?: "vertical" | "horizontal";
22
+ variant?: "normal" | "subtle";
23
+ itemSpacing?: SpacingObject
24
+ };
25
+
@@ -68,7 +68,7 @@ const Time = (props: TimeProps) => {
68
68
  )
69
69
  )}
70
70
 
71
- <time dateTime={date.toLocaleString()}>
71
+ <time dateTime={date.toString()}>
72
72
  <span>
73
73
  {unstyled
74
74
  ? (