playbook_ui 13.1.0 → 13.2.0.pre.alpha.PLAY986dateTimeRounding1150

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) 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 +54 -23
  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 +16 -0
  7. data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +58 -58
  8. data/app/pb_kits/playbook/pb_nav/_item.tsx +242 -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 -59
  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.md +1 -1
  18. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +6 -1
  19. data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_emphasize.jsx → _collapsible_nav_item_spacing.jsx} +18 -17
  20. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_item_spacing.md +1 -0
  21. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_with_all_options.html.erb +23 -0
  22. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_with_all_options.jsx +55 -0
  23. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_with_all_options.md +4 -0
  24. data/app/pb_kits/playbook/pb_nav/docs/_nav_with_font_control.html.erb +6 -0
  25. data/app/pb_kits/playbook/pb_nav/docs/_nav_with_font_control.jsx +46 -0
  26. data/app/pb_kits/playbook/pb_nav/docs/_nav_with_font_control.md +4 -0
  27. data/app/pb_kits/playbook/pb_nav/docs/_nav_with_spacing_control.html.erb +6 -0
  28. data/app/pb_kits/playbook/pb_nav/docs/_nav_with_spacing_control.jsx +47 -0
  29. data/app/pb_kits/playbook/pb_nav/docs/_nav_with_spacing_control.md +1 -0
  30. data/app/pb_kits/playbook/pb_nav/docs/_no_highlight_nav.jsx +4 -1
  31. data/app/pb_kits/playbook/pb_nav/docs/_subtle_nav.jsx +4 -1
  32. data/app/pb_kits/playbook/pb_nav/docs/_subtle_with_icons_nav.jsx +4 -1
  33. data/app/pb_kits/playbook/pb_nav/docs/example.yml +10 -5
  34. data/app/pb_kits/playbook/pb_nav/docs/index.js +4 -1
  35. data/app/pb_kits/playbook/pb_nav/item.html.erb +19 -12
  36. data/app/pb_kits/playbook/pb_nav/item.rb +55 -14
  37. data/app/pb_kits/playbook/pb_nav/nav.html.erb +3 -1
  38. data/app/pb_kits/playbook/pb_nav/navTypes.ts +25 -0
  39. data/app/pb_kits/playbook/pb_select/docs/_select_multiple.md +1 -1
  40. data/dist/playbook-rails.js +5 -5
  41. data/lib/playbook/version.rb +2 -2
  42. metadata +20 -11
  43. data/app/pb_kits/playbook/pb_nav/_mixins.scss +0 -5
  44. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +0 -23
  45. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.md +0 -1
@@ -7,10 +7,12 @@ examples:
7
7
  - borderless_nav: No Borders
8
8
  - subtle_nav: Subtle Variant
9
9
  - subtle_with_icons_nav: Subtle With Icons
10
- # - collapsible_nav: Collapsible Nav
11
- # - collapsible_nav_emphasize: Collapsible Nav with Emphasize Styling
12
10
  - subtle_no_highlight_nav: Subtle No Highlight
13
11
  - bold_vertical_nav: Bold Variant
12
+ - nav_with_spacing_control: Nav with Spacing Control
13
+ - nav_with_font_control: Nav With Font Control
14
+ - collapsible_nav: Collapsible Nav
15
+ - collapsible_nav_with_all_options: Collapsible Nav With Options
14
16
  - horizontal_nav: Horizontal Nav
15
17
  - subtle_horizontal_nav: Subtle Horizontal Nav
16
18
  - bold_horizontal_nav: Bold Horizontal Nav
@@ -26,11 +28,14 @@ examples:
26
28
  - borderless_nav: No Borders
27
29
  - subtle_nav: Subtle Variant
28
30
  - subtle_with_icons_nav: Subtle With Icons
29
- # - collapsible_nav: Collapsible Nav
30
- # - collapsible_nav_emphasize: Collapsible Nav with Emphasize Styling
31
- # - collapsible_nav_custom: Collapsible Nav With Custom Toggling
32
31
  - subtle_no_highlight_nav: Subtle No Highlight
33
32
  - bold_vertical_nav: Bold Variant
33
+ - nav_with_spacing_control: Nav with Spacing Control
34
+ - nav_with_font_control: Nav With Font Control
35
+ - collapsible_nav: Collapsible Nav
36
+ - collapsible_nav_with_all_options: Collapsible Nav With Options
37
+ - collapsible_nav_item_spacing: Collapsible Nav With ItemSpacing
38
+ - collapsible_nav_custom: Collapsible Nav With Custom Toggling
34
39
  - horizontal_nav: Horizontal Nav
35
40
  - subtle_horizontal_nav: Subtle Horizontal Nav
36
41
  - bold_horizontal_nav: Bold Horizontal Nav
@@ -15,4 +15,7 @@ export { default as BoldHorizontalNav } from './_bold_horizontal_nav.jsx'
15
15
  export { default as BoldVerticalNav } from './_bold_vertical_nav.jsx'
16
16
  export { default as CollapsibleNav } from './_collapsible_nav.jsx'
17
17
  export { default as CollapsibleNavCustom } from './_collapsible_nav_custom.jsx'
18
- export { default as CollapsibleNavEmphasize } from "./_collapsible_nav_emphasize.jsx"
18
+ export {default as CollapsibleNavWithAllOptions} from "./_collapsible_nav_with_all_options.jsx"
19
+ export { default as NavWithFontControl } from "./_nav_with_font_control.jsx"
20
+ export {default as NavWithSpacingControl } from "./_nav_with_spacing_control.jsx"
21
+ export {default as CollapsibleNavItemSpacing } from "./_collapsible_nav_item_spacing.jsx"
@@ -1,14 +1,15 @@
1
- <%= content_tag(:li,
2
- aria: object.aria,
3
- class: object.classname,
4
- data: object.data,
5
- dark: object.dark,
6
- id: object.id) do %>
7
1
  <% if object.collapsible %>
8
- <%= pb_rails("collapsible", props: { name: "collapsible-nav-example" }) do %>
9
- <%= pb_rails("collapsible/collapsible_main", props: { name: "default-collapsible-nav", icon: object.collapsible_icons, size: "xs", dark: object.dark }) do %>
2
+ <%= pb_rails("collapsible", props: { name: "collapsible-nav-example", classname: object.collapsible_nav_classname }) do %>
3
+ <%= pb_rails("collapsible/collapsible_main", props: { name: "default-collapsible-nav", icon: object.collapsible_icons, size: "xs", dark: object.dark, classname:object.margin_classes }) do %>
10
4
  <%= content_tag(object.tag,
11
- object.link ? object.link_options : object.options) do %>
5
+ aria: object.aria,
6
+ class: object.classname,
7
+ data: object.data,
8
+ dark: object.dark,
9
+ id: object.id,
10
+ href: object.link && object.link,
11
+ target: object.link && object.target
12
+ ) do %>
12
13
  <% if object.image_url %>
13
14
  <%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper_collapsible" }) %>
14
15
  <% end %>
@@ -26,7 +27,14 @@
26
27
  <% end %>
27
28
  <% else %>
28
29
  <%= content_tag(object.tag,
29
- object.link ? object.link_options : object.options) do %>
30
+ aria: object.aria,
31
+ class: object.classname,
32
+ data: object.data,
33
+ dark: object.dark,
34
+ id: object.id,
35
+ href: object.link && object.link,
36
+ target: object.link && object.target
37
+ ) do %>
30
38
  <% if object.image_url %>
31
39
  <%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper" }) %>
32
40
  <% end %>
@@ -40,5 +48,4 @@
40
48
  <%= pb_rails("icon", props: { icon: object.icon_right, classname: "pb_nav_list_item_icon_right", fixed_width: true}) %>
41
49
  <% end %>
42
50
  <% end %>
43
- <% end %>
44
- <% end %>
51
+ <% end %>
@@ -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
+ generate_classname("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
+
@@ -1 +1 @@
1
- We recommend using a typeahead for better UX
1
+ The `multiple` prop enables multiple selections; however, for a better user experience, we recommend our [Typeahead](https://playbook.powerapp.cloud/kits/typeahead/react) kit.