playbook_ui 12.39.0.pre.alpha.PLAY966collapsiblenav41115 → 12.39.0.pre.alpha.salesbookmismatchingdate1114
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_kit/dateTime.ts +41 -36
- data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +24 -18
- data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +1 -1
- data/app/pb_kits/playbook/pb_nav/_item.tsx +140 -227
- data/app/pb_kits/playbook/pb_nav/_mixins.scss +1 -10
- data/app/pb_kits/playbook/pb_nav/_nav.tsx +1 -17
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +5 -5
- data/app/pb_kits/playbook/pb_nav/item.html.erb +0 -15
- data/app/pb_kits/playbook/pb_nav/item.rb +1 -61
- data/app/pb_kits/playbook/pb_nav/nav.html.erb +1 -3
- data/app/pb_kits/playbook/pb_nav/nav.rb +0 -13
- data/app/pb_kits/playbook/pb_time/_time.tsx +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +1 -2
- data/app/pb_kits/playbook/pb_nav/navTypes.ts +0 -25
@@ -5,7 +5,6 @@ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
|
5
5
|
import { globalProps, GlobalProps } from '../utilities/globalProps'
|
6
6
|
|
7
7
|
import Caption from '../pb_caption/_caption'
|
8
|
-
import { SpacingObject, NavChildProps } from './navTypes'
|
9
8
|
|
10
9
|
type NavProps = {
|
11
10
|
aria?: { [key: string]: string },
|
@@ -21,7 +20,6 @@ type NavProps = {
|
|
21
20
|
link?: string,
|
22
21
|
title?: string,
|
23
22
|
variant?: "normal" | "subtle",
|
24
|
-
itemSpacing?: SpacingObject
|
25
23
|
} & GlobalProps
|
26
24
|
|
27
25
|
const Nav = (props: NavProps) => {
|
@@ -39,7 +37,6 @@ const Nav = (props: NavProps) => {
|
|
39
37
|
orientation = 'vertical',
|
40
38
|
title = '',
|
41
39
|
variant = 'normal',
|
42
|
-
itemSpacing,
|
43
40
|
} = props
|
44
41
|
|
45
42
|
const ariaProps = buildAriaProps(aria)
|
@@ -53,19 +50,6 @@ const Nav = (props: NavProps) => {
|
|
53
50
|
className
|
54
51
|
)
|
55
52
|
|
56
|
-
// Map over the children and clone them with orientation, variant and itemSpacing props to gain access to them in navItem
|
57
|
-
const childrenWithProps = React.Children.map(children, (child) => {
|
58
|
-
if (React.isValidElement(child)) {
|
59
|
-
const childProps: NavChildProps = {
|
60
|
-
orientation: orientation,
|
61
|
-
variant: variant,
|
62
|
-
itemSpacing: itemSpacing
|
63
|
-
};
|
64
|
-
return React.cloneElement(child, childProps);
|
65
|
-
}
|
66
|
-
return child;
|
67
|
-
});
|
68
|
-
|
69
53
|
return (
|
70
54
|
<nav
|
71
55
|
{...ariaProps}
|
@@ -88,7 +72,7 @@ const childrenWithProps = React.Children.map(children, (child) => {
|
|
88
72
|
</a>
|
89
73
|
</div>
|
90
74
|
}
|
91
|
-
<ul>{
|
75
|
+
<ul>{children}</ul>
|
92
76
|
</nav>
|
93
77
|
)
|
94
78
|
}
|
@@ -7,8 +7,8 @@ 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
|
10
|
+
# - collapsible_nav: Collapsible Nav
|
11
|
+
# - collapsible_nav_emphasize: Collapsible Nav with Emphasize Styling
|
12
12
|
- subtle_no_highlight_nav: Subtle No Highlight
|
13
13
|
- bold_vertical_nav: Bold Variant
|
14
14
|
- horizontal_nav: Horizontal Nav
|
@@ -26,9 +26,9 @@ examples:
|
|
26
26
|
- borderless_nav: No Borders
|
27
27
|
- subtle_nav: Subtle Variant
|
28
28
|
- 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
|
29
|
+
# - collapsible_nav: Collapsible Nav
|
30
|
+
# - collapsible_nav_emphasize: Collapsible Nav with Emphasize Styling
|
31
|
+
# - collapsible_nav_custom: Collapsible Nav With Custom Toggling
|
32
32
|
- subtle_no_highlight_nav: Subtle No Highlight
|
33
33
|
- bold_vertical_nav: Bold Variant
|
34
34
|
- horizontal_nav: Horizontal Nav
|
@@ -42,18 +42,3 @@
|
|
42
42
|
<% end %>
|
43
43
|
<% end %>
|
44
44
|
<% end %>
|
45
|
-
|
46
|
-
<script>
|
47
|
-
document.addEventListener("DOMContentLoaded", function() {
|
48
|
-
var liElements = document.querySelectorAll('li');
|
49
|
-
|
50
|
-
liElements.forEach(function(liElement) {
|
51
|
-
var orientation = liElement.getAttribute('data-orientation');
|
52
|
-
var variant = liElement.getAttribute('data-variant');
|
53
|
-
if (orientation === "horizontal" && variant === "normal") {
|
54
|
-
liElement.classList.remove('font_regular')
|
55
|
-
liElement.classList.add('font_bold')
|
56
|
-
}
|
57
|
-
})
|
58
|
-
})
|
59
|
-
</script>
|
@@ -28,45 +28,13 @@ module Playbook
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
def spacing_props
|
32
|
-
if object.padding || object.padding_x || object.padding_y || object.padding_bottom || object.padding_top || object.padding_right || object.padding_left || object.margin || object.margin_x || object.margin_y || object.margin_bottom || object.margin_top || object.margin_right || object.margin_left
|
33
|
-
# Call the original method
|
34
|
-
original_result = super
|
35
|
-
|
36
|
-
# Remove p_value, px_value, py_value, etc. based on the object's properties
|
37
|
-
padding_classes_to_remove = []
|
38
|
-
padding_classes_to_remove << "p_#{object.padding}" if object.padding
|
39
|
-
padding_classes_to_remove << "px_#{object.padding_x}" if object.padding_x
|
40
|
-
padding_classes_to_remove << "py_#{object.padding_y}" if object.padding_y
|
41
|
-
padding_classes_to_remove << "pb_#{object.padding_bottom}" if object.padding_bottom
|
42
|
-
padding_classes_to_remove << "pt_#{object.padding_top}" if object.padding_top
|
43
|
-
padding_classes_to_remove << "pr_#{object.padding_right}" if object.padding_right
|
44
|
-
padding_classes_to_remove << "pl_#{object.padding_left}" if object.padding_left
|
45
|
-
padding_classes_to_remove << "m_#{object.margin}" if object.margin
|
46
|
-
padding_classes_to_remove << "mx_#{object.margin_x}" if object.margin_x
|
47
|
-
padding_classes_to_remove << "my_#{object.margin_y}" if object.margin_y
|
48
|
-
padding_classes_to_remove << "mb_#{object.margin_bottom}" if object.margin_bottom
|
49
|
-
padding_classes_to_remove << "mt_#{object.margin_top}" if object.margin_top
|
50
|
-
padding_classes_to_remove << "mr_#{object.margin_right}" if object.margin_right
|
51
|
-
padding_classes_to_remove << "ml_#{object.margin_left}" if object.margin_left
|
52
|
-
|
53
|
-
padding_classes_to_remove.each do |class_to_remove|
|
54
|
-
original_result.gsub!(class_to_remove, "")
|
55
|
-
end
|
56
|
-
|
57
|
-
original_result.strip
|
58
|
-
else
|
59
|
-
super
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
31
|
def tag
|
64
32
|
link ? "a" : "div"
|
65
33
|
end
|
66
34
|
|
67
35
|
def options
|
68
36
|
{
|
69
|
-
class: collapsible ? "pb_nav_list_item_link_collapsible
|
37
|
+
class: collapsible ? "pb_nav_list_item_link_collapsible" : "pb_nav_list_item_link",
|
70
38
|
}.compact
|
71
39
|
end
|
72
40
|
|
@@ -105,34 +73,6 @@ module Playbook
|
|
105
73
|
def font_size_class
|
106
74
|
font_size === "small" ? "font_size_small" : "font_size_normal"
|
107
75
|
end
|
108
|
-
|
109
|
-
def padding_classes
|
110
|
-
spacing_attributes = {
|
111
|
-
padding: "p",
|
112
|
-
padding_x: "px",
|
113
|
-
padding_y: "py",
|
114
|
-
padding_bottom: "pb",
|
115
|
-
padding_top: "pt",
|
116
|
-
padding_right: "pr",
|
117
|
-
padding_left: "pl",
|
118
|
-
margin: "m",
|
119
|
-
margin_x: "mx",
|
120
|
-
margin_y: "my",
|
121
|
-
margin_bottom: "mb",
|
122
|
-
margin_top: "mt",
|
123
|
-
margin_right: "mr",
|
124
|
-
margin_left: "ml",
|
125
|
-
}
|
126
|
-
|
127
|
-
# rubocop:disable Style/RedundantAssignment
|
128
|
-
padding_classes = spacing_attributes.map do |attr, class_prefix|
|
129
|
-
# rubocop:enable Style/RedundantAssignment
|
130
|
-
value = object.public_send(attr)
|
131
|
-
" #{class_prefix}_#{value}" if value
|
132
|
-
end.compact.join
|
133
|
-
|
134
|
-
padding_classes
|
135
|
-
end
|
136
76
|
end
|
137
77
|
end
|
138
78
|
end
|
@@ -13,7 +13,6 @@ module Playbook
|
|
13
13
|
default: "normal"
|
14
14
|
prop :highlight, type: Playbook::Props::Boolean, default: true
|
15
15
|
prop :borderless, type: Playbook::Props::Boolean, default: false
|
16
|
-
prop :item_padding, type: Playbook::Props::Hash, default: {}
|
17
16
|
|
18
17
|
def classname
|
19
18
|
generate_classname("pb_nav_list", variant, orientation, highlight_class, borderless_class)
|
@@ -26,18 +25,6 @@ module Playbook
|
|
26
25
|
def borderless_class
|
27
26
|
borderless ? "borderless" : nil
|
28
27
|
end
|
29
|
-
|
30
|
-
def modified_content
|
31
|
-
parsed_content = Nokogiri::HTML.fragment(content.presence)
|
32
|
-
|
33
|
-
parsed_content.css("li").each do |element|
|
34
|
-
element["data-orientation"] = orientation
|
35
|
-
element["data-variant"] = variant
|
36
|
-
element["data-spacing"] = item_padding
|
37
|
-
end
|
38
|
-
|
39
|
-
parsed_content.to_html
|
40
|
-
end
|
41
28
|
end
|
42
29
|
end
|
43
30
|
end
|