playbook_ui 12.37.0.pre.alpha.PLAY951collapsiblenav31062 → 12.37.0.pre.alpha.svgiconmethods1064
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_collapsible/_collapsible.scss +0 -6
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +3 -3
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +9 -10
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_color.jsx +2 -2
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.jsx +2 -2
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +8 -4
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.md +1 -1
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_size.jsx +5 -5
- data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +6 -7
- data/app/pb_kits/playbook/pb_collapsible/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_icon/docs/_icon_animate.html.erb +1 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_custom.html.erb +2 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_svg.html.erb +5 -0
- data/app/pb_kits/playbook/pb_icon/docs/example.yml +10 -9
- data/app/pb_kits/playbook/pb_icon/icon.html.erb +3 -3
- data/app/pb_kits/playbook/pb_icon/icon.rb +19 -0
- data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +16 -141
- data/app/pb_kits/playbook/pb_nav/_item.tsx +22 -33
- data/app/pb_kits/playbook/pb_nav/_subtle_mixin.scss +6 -6
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +58 -79
- data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_emphasize.jsx → _collapsible_nav_custom_icons.jsx} +3 -5
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +3 -5
- data/app/pb_kits/playbook/pb_nav/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_nav/item.html.erb +4 -5
- data/app/pb_kits/playbook/pb_nav/item.rb +2 -17
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +4 -10
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +0 -75
- data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.md +0 -3
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +0 -1
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +0 -57
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.md +0 -1
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +0 -23
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.md +0 -1
@@ -1,84 +1,63 @@
|
|
1
|
-
import React from "react"
|
2
|
-
import { Nav, NavItem } from
|
1
|
+
import React from "react"
|
2
|
+
import { Nav, NavItem, useCollapsible } from "../.."
|
3
3
|
|
4
4
|
const CollapsibleNav = (props) => {
|
5
|
+
const navItems = ["Overview", "Albums", "Similar Artists"]
|
6
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
7
|
+
const collapsibles = navItems.map(() => useCollapsible(true))
|
8
|
+
|
9
|
+
const handleMainClick = (index) => {
|
10
|
+
collapsibles.forEach(([, , setCollapsed], idx) => {
|
11
|
+
if (idx === index) {
|
12
|
+
setCollapsed(false)
|
13
|
+
} else {
|
14
|
+
setCollapsed(true)
|
15
|
+
}
|
16
|
+
})
|
17
|
+
}
|
18
|
+
|
19
|
+
|
20
|
+
const handleIconRightClick = (index) => {
|
21
|
+
const [isCollapsed, setCollapsed] = collapsibles[index]
|
22
|
+
setCollapsed(!isCollapsed)
|
23
|
+
}
|
24
|
+
|
5
25
|
return (
|
6
|
-
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
text="Entertainment"
|
43
|
-
{...props}
|
44
|
-
/>
|
45
|
-
<NavItem
|
46
|
-
link="#"
|
47
|
-
text="Food"
|
48
|
-
{...props}
|
49
|
-
/>
|
50
|
-
<NavItem
|
51
|
-
link="#"
|
52
|
-
text="Style"
|
53
|
-
{...props}
|
54
|
-
/>
|
55
|
-
</NavItem>
|
56
|
-
<NavItem
|
57
|
-
collapsible
|
58
|
-
iconLeft="city"
|
59
|
-
iconRight={["plus", "minus"]}
|
60
|
-
link="#"
|
61
|
-
text="Similar Artists"
|
62
|
-
{...props}
|
63
|
-
>
|
64
|
-
<NavItem
|
65
|
-
link="#"
|
66
|
-
text="City"
|
67
|
-
{...props}
|
68
|
-
/>
|
69
|
-
<NavItem
|
70
|
-
link="#"
|
71
|
-
text="People"
|
72
|
-
{...props}
|
73
|
-
/>
|
74
|
-
<NavItem
|
75
|
-
link="#"
|
76
|
-
text="Business"
|
77
|
-
{...props}
|
78
|
-
/>
|
79
|
-
</NavItem>
|
80
|
-
</Nav>
|
81
|
-
);
|
82
|
-
};
|
26
|
+
<>
|
27
|
+
<Nav variant='subtle'>
|
28
|
+
{navItems.map((text, index) => {
|
29
|
+
const [collapsed] = collapsibles[index]
|
30
|
+
return (
|
31
|
+
<NavItem
|
32
|
+
collapsible
|
33
|
+
collapsibleClick={() => handleMainClick(index)}
|
34
|
+
iconLeft="chevron-down"
|
35
|
+
iconRightClick={() => handleIconRightClick(index)}
|
36
|
+
id={`collapsible-nav-item-${index + 1}`}
|
37
|
+
key={index}
|
38
|
+
link="#"
|
39
|
+
text={text}
|
40
|
+
toggleCollapsed={collapsed}
|
41
|
+
{...props}
|
42
|
+
>
|
43
|
+
<NavItem link="#"
|
44
|
+
text="City"
|
45
|
+
{...props}
|
46
|
+
/>
|
47
|
+
<NavItem link="#"
|
48
|
+
text="People"
|
49
|
+
{...props}
|
50
|
+
/>
|
51
|
+
<NavItem link="#"
|
52
|
+
text="Business"
|
53
|
+
{...props}
|
54
|
+
/>
|
55
|
+
</NavItem>
|
56
|
+
);
|
57
|
+
})}
|
58
|
+
</Nav>
|
59
|
+
</>
|
60
|
+
)
|
61
|
+
}
|
83
62
|
|
84
63
|
export default CollapsibleNav
|
@@ -1,12 +1,11 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { Nav, NavItem } from '../..'
|
3
3
|
|
4
|
-
const
|
4
|
+
const CollapsibleNavCustomIcons = (props) => {
|
5
5
|
return (
|
6
6
|
<Nav variant="subtle">
|
7
7
|
<NavItem
|
8
8
|
collapsible
|
9
|
-
emphasized
|
10
9
|
iconLeft="city"
|
11
10
|
iconRight={["plus", "minus"]}
|
12
11
|
link="#"
|
@@ -30,8 +29,8 @@ const CollapsibleNavEmphasize = (props) => {
|
|
30
29
|
/>
|
31
30
|
</NavItem>
|
32
31
|
<NavItem
|
32
|
+
active
|
33
33
|
collapsible
|
34
|
-
emphasized
|
35
34
|
iconLeft="theater-masks"
|
36
35
|
iconRight={["plus", "minus"]}
|
37
36
|
link="#"
|
@@ -56,7 +55,6 @@ const CollapsibleNavEmphasize = (props) => {
|
|
56
55
|
</NavItem>
|
57
56
|
<NavItem
|
58
57
|
collapsible
|
59
|
-
emphasized
|
60
58
|
iconLeft="city"
|
61
59
|
iconRight={["plus", "minus"]}
|
62
60
|
link="#"
|
@@ -83,4 +81,4 @@ const CollapsibleNavEmphasize = (props) => {
|
|
83
81
|
);
|
84
82
|
};
|
85
83
|
|
86
|
-
export default
|
84
|
+
export default CollapsibleNavCustomIcons;
|
@@ -7,8 +7,7 @@ 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
|
11
|
-
- collapsible_nav_emphasize: Collapsible Nav with Emphasize Styling
|
10
|
+
# - collapsible_nav: Subtle With Collapsible
|
12
11
|
- subtle_no_highlight_nav: Subtle No Highlight
|
13
12
|
- bold_vertical_nav: Bold Variant
|
14
13
|
- horizontal_nav: Horizontal Nav
|
@@ -26,9 +25,8 @@ examples:
|
|
26
25
|
- borderless_nav: No Borders
|
27
26
|
- subtle_nav: Subtle Variant
|
28
27
|
- subtle_with_icons_nav: Subtle With Icons
|
29
|
-
- collapsible_nav: Collapsible
|
30
|
-
-
|
31
|
-
- collapsible_nav_custom: Collapsible Nav With Custom Toggling
|
28
|
+
# - collapsible_nav: Subtle With Collapsible
|
29
|
+
# - collapsible_nav_custom_icons: Subtle With Collapsible (No custom toggling)
|
32
30
|
- subtle_no_highlight_nav: Subtle No Highlight
|
33
31
|
- bold_vertical_nav: Bold Variant
|
34
32
|
- horizontal_nav: Horizontal Nav
|
@@ -14,5 +14,4 @@ export { default as NewTab } from './_new_tab.jsx'
|
|
14
14
|
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
|
-
export { default as
|
18
|
-
export { default as CollapsibleNavEmphasize } from "./_collapsible_nav_emphasize.jsx"
|
17
|
+
export { default as CollapsibleNavCustomIcons } from './_collapsible_nav_custom_icons.jsx'
|
@@ -2,20 +2,19 @@
|
|
2
2
|
aria: object.aria,
|
3
3
|
class: object.classname,
|
4
4
|
data: object.data,
|
5
|
-
dark: object.dark,
|
6
5
|
id: object.id) do %>
|
7
6
|
<% if object.collapsible %>
|
8
7
|
<%= 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"
|
8
|
+
<%= pb_rails("collapsible/collapsible_main", props: { name: "default-collapsible-nav", icon: object.collapsible_icons, size: "xs" }) do %>
|
10
9
|
<%= content_tag(object.tag,
|
11
10
|
object.link ? object.link_options : object.options) do %>
|
12
11
|
<% if object.image_url %>
|
13
|
-
<%= pb_rails("image", props: { url: object.image_url, classname: "
|
12
|
+
<%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper" }) %>
|
14
13
|
<% end %>
|
15
14
|
<% if object.icon_left %>
|
16
|
-
<%= pb_rails("icon", props: { icon: object.icon_left, classname: "
|
15
|
+
<%= pb_rails("icon", props: { icon: object.icon_left, classname: "pb_nav_list_item_icon_left", fixed_width: true}) %>
|
17
16
|
<% end %>
|
18
|
-
<span class="
|
17
|
+
<span class="pb_nav_list_item_text">
|
19
18
|
<%= object.text %>
|
20
19
|
</span>
|
21
20
|
<% end %>
|
@@ -4,12 +4,9 @@ module Playbook
|
|
4
4
|
module PbNav
|
5
5
|
class Item < Playbook::KitBase
|
6
6
|
prop :active, type: Playbook::Props::Boolean, default: false
|
7
|
-
prop :bold, type: Playbook::Props::Boolean, default: false
|
8
7
|
prop :collapsible, type: Playbook::Props::Boolean, default: false
|
9
|
-
prop :emphasized, type: Playbook::Props::Boolean, default: false
|
10
8
|
prop :link
|
11
9
|
prop :text
|
12
|
-
prop :collapsible_trail, type: Playbook::Props::Boolean, default: false
|
13
10
|
prop :icon_left
|
14
11
|
prop :icon_right
|
15
12
|
prop :image_url
|
@@ -18,7 +15,7 @@ module Playbook
|
|
18
15
|
default: "_self"
|
19
16
|
def classname
|
20
17
|
if collapsible
|
21
|
-
"pb_collapsible_nav_item #{generate_classname('pb_nav_list_kit_item', active_class
|
18
|
+
"pb_collapsible_nav_item #{generate_classname('pb_nav_list_kit_item', active_class)}"
|
22
19
|
else
|
23
20
|
generate_classname("pb_nav_list_kit_item", active_class)
|
24
21
|
end
|
@@ -30,7 +27,7 @@ module Playbook
|
|
30
27
|
|
31
28
|
def options
|
32
29
|
{
|
33
|
-
class:
|
30
|
+
class: "pb_nav_list_item_link",
|
34
31
|
}.compact
|
35
32
|
end
|
36
33
|
|
@@ -50,18 +47,6 @@ module Playbook
|
|
50
47
|
def active_class
|
51
48
|
active ? "active" : nil
|
52
49
|
end
|
53
|
-
|
54
|
-
def bold_class
|
55
|
-
bold ? "bold" : nil
|
56
|
-
end
|
57
|
-
|
58
|
-
def collapsible_trail_class
|
59
|
-
collapsible_trail ? "collapsible_trail" : nil
|
60
|
-
end
|
61
|
-
|
62
|
-
def emphasized_class
|
63
|
-
emphasized ? "emphasized" : nil
|
64
|
-
end
|
65
50
|
end
|
66
51
|
end
|
67
52
|
end
|