playbook_ui_docs 12.37.0.pre.alpha.PLAY951collapsiblenav31078 → 12.37.0.pre.alpha.PLAYaddingdatapropselectkit1071
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/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_nav/docs/_collapsible_nav.jsx +58 -85
- data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_emphasize.jsx → _collapsible_nav_custom_icons.jsx} +5 -14
- 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_select/docs/_select_data_attributes.html.erb +24 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_data_attributes.md +1 -0
- data/app/pb_kits/playbook/pb_select/docs/example.yml +1 -0
- data/dist/playbook-doc.js +3 -3
- metadata +5 -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 -58
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07d96e66096935be57e79f420aaf89d1cc9c21950f6d37a8318efb9954f90d4b
|
4
|
+
data.tar.gz: d10d6102fd9f8fd01a3ace6fc774fe107d20527093ba44e96a59d584353d7f90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d00b5600928314488dfd4c22cf67ada2264e70a3c5b93c6c484b6037310d6ca4d5e2a859a487fa4a7d41183937c4ff47dec826fb51f6b3dcabf24d827feb669a
|
7
|
+
data.tar.gz: a24856ae2b17528c04b506e7f6a18739d8702f6dda09eb54772154d326e4bcc1ecf567ffc96f3544187676c0a71c6f0cfd8eeff876762b0d66b48d4c3e5850aa
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { Collapsible } from '../..'
|
3
3
|
|
4
|
-
const CollapsibleColor = (
|
4
|
+
const CollapsibleColor = () => (
|
5
5
|
<div>
|
6
6
|
<Collapsible
|
7
7
|
iconColor='default'
|
8
8
|
marginBottom="xs"
|
9
9
|
>
|
10
|
-
<Collapsible.Main
|
10
|
+
<Collapsible.Main>
|
11
11
|
<div>{'Default Section'}</div>
|
12
12
|
</Collapsible.Main>
|
13
13
|
<Collapsible.Content>
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { Collapsible } from '../..'
|
3
3
|
|
4
|
-
const CollapsibleDefault = (
|
4
|
+
const CollapsibleDefault = () => (
|
5
5
|
<Collapsible >
|
6
|
-
<Collapsible.Main
|
6
|
+
<Collapsible.Main>
|
7
7
|
<div>{'Main Section'}</div>
|
8
8
|
</Collapsible.Main>
|
9
9
|
<Collapsible.Content>
|
@@ -1,14 +1,18 @@
|
|
1
1
|
import React from 'react'
|
2
|
-
import { Collapsible } from '../..'
|
2
|
+
import { Collapsible, useCollapsible, Button } from '../..'
|
3
3
|
|
4
|
-
const CollapsibleIcons = (
|
4
|
+
const CollapsibleIcons = () => {
|
5
|
+
const [isCollapsed, setIsCollapsed] = useCollapsible(true)
|
5
6
|
|
6
7
|
return (
|
7
8
|
<>
|
8
|
-
<
|
9
|
+
<Button onClick={()=> setIsCollapsed(!isCollapsed)}>
|
10
|
+
{isCollapsed ? "Expand" : "Collapse"}
|
11
|
+
</Button>
|
12
|
+
<Collapsible collapsed={isCollapsed}
|
9
13
|
icon={['plus','minus']}
|
10
14
|
>
|
11
|
-
<Collapsible.Main
|
15
|
+
<Collapsible.Main>
|
12
16
|
<div>{'Main Section'}</div>
|
13
17
|
</Collapsible.Main>
|
14
18
|
<Collapsible.Content>
|
@@ -1,2 +1,2 @@
|
|
1
1
|
##### Prop
|
2
|
-
|
2
|
+
This kit uses 'chevron-up' and 'chevron-down' icons as default for the toggle icons. To customize these icons, use the `icon` prop to pass in an array of two icons, the first will render when the collapisble is closed and the second will render when the collapsible is open. In this example, we are using `icon: ['plus','minus']`
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { Collapsible } from '../..'
|
3
3
|
|
4
|
-
const CollapsibleSize = (
|
4
|
+
const CollapsibleSize = () => (
|
5
5
|
<div>
|
6
6
|
<Collapsible
|
7
7
|
iconSize="xs"
|
8
8
|
marginBottom="xs"
|
9
9
|
>
|
10
|
-
<Collapsible.Main
|
10
|
+
<Collapsible.Main>
|
11
11
|
<div>{'Extra Small Section'}</div>
|
12
12
|
</Collapsible.Main>
|
13
13
|
<Collapsible.Content>
|
@@ -22,7 +22,7 @@ const CollapsibleSize = (props) => (
|
|
22
22
|
iconSize="sm"
|
23
23
|
marginBottom="xs"
|
24
24
|
>
|
25
|
-
<Collapsible.Main
|
25
|
+
<Collapsible.Main>
|
26
26
|
<div>{'Small Section'}</div>
|
27
27
|
</Collapsible.Main>
|
28
28
|
<Collapsible.Content>
|
@@ -36,7 +36,7 @@ const CollapsibleSize = (props) => (
|
|
36
36
|
<Collapsible
|
37
37
|
marginBottom="xs"
|
38
38
|
>
|
39
|
-
<Collapsible.Main
|
39
|
+
<Collapsible.Main>
|
40
40
|
<div>{'Default Section'}</div>
|
41
41
|
</Collapsible.Main>
|
42
42
|
<Collapsible.Content>
|
@@ -51,7 +51,7 @@ const CollapsibleSize = (props) => (
|
|
51
51
|
iconSize="lg"
|
52
52
|
marginBottom="xs"
|
53
53
|
>
|
54
|
-
<Collapsible.Main
|
54
|
+
<Collapsible.Main>
|
55
55
|
<div>{'Large Section'}</div>
|
56
56
|
</Collapsible.Main>
|
57
57
|
<Collapsible.Content>
|
@@ -2,13 +2,12 @@ examples:
|
|
2
2
|
|
3
3
|
rails:
|
4
4
|
- collapsible_default: Default
|
5
|
-
- collapsible_size:
|
6
|
-
- collapsible_color:
|
7
|
-
- collapsible_icons: Custom Icons
|
5
|
+
- collapsible_size: Size
|
6
|
+
- collapsible_color: Color
|
7
|
+
# - collapsible_icons: Custom Icons
|
8
8
|
|
9
9
|
react:
|
10
10
|
- collapsible_default: Default
|
11
|
-
- collapsible_size:
|
12
|
-
- collapsible_color:
|
13
|
-
- collapsible_icons: Custom Icons
|
14
|
-
- collapsible_state: useCollapsible Hook
|
11
|
+
- collapsible_size: Size
|
12
|
+
- collapsible_color: Color
|
13
|
+
# - collapsible_icons: Custom Icons
|
@@ -1,5 +1,4 @@
|
|
1
1
|
export { default as CollapsibleDefault } from './_collapsible_default.jsx'
|
2
2
|
export { default as CollapsibleSize } from './_collapsible_size.jsx'
|
3
3
|
export { default as CollapsibleColor } from './_collapsible_color.jsx'
|
4
|
-
export { default as CollapsibleIcons } from './_collapsible_icons.jsx'
|
5
|
-
export {default as CollapsibleState } from './_collapsible_state.jsx'
|
4
|
+
export { default as CollapsibleIcons } from './_collapsible_icons.jsx'
|
@@ -1,90 +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
|
-
{...props}
|
43
|
-
>
|
44
|
-
<NavItem
|
45
|
-
link="#"
|
46
|
-
text="Entertainment"
|
47
|
-
{...props}
|
48
|
-
/>
|
49
|
-
<NavItem
|
50
|
-
link="#"
|
51
|
-
text="Food"
|
52
|
-
{...props}
|
53
|
-
/>
|
54
|
-
<NavItem
|
55
|
-
link="#"
|
56
|
-
text="Style"
|
57
|
-
{...props}
|
58
|
-
/>
|
59
|
-
</NavItem>
|
60
|
-
<NavItem
|
61
|
-
collapsible
|
62
|
-
collapsibleTrail
|
63
|
-
fontWeight="bolder"
|
64
|
-
iconLeft="city"
|
65
|
-
iconRight={["plus", "minus"]}
|
66
|
-
link="#"
|
67
|
-
text="Similar Artists"
|
68
|
-
{...props}
|
69
|
-
>
|
70
|
-
<NavItem
|
71
|
-
link="#"
|
72
|
-
text="City"
|
73
|
-
{...props}
|
74
|
-
/>
|
75
|
-
<NavItem
|
76
|
-
link="#"
|
77
|
-
text="People"
|
78
|
-
{...props}
|
79
|
-
/>
|
80
|
-
<NavItem
|
81
|
-
link="#"
|
82
|
-
text="Business"
|
83
|
-
{...props}
|
84
|
-
/>
|
85
|
-
</NavItem>
|
86
|
-
</Nav>
|
87
|
-
);
|
88
|
-
};
|
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
|
+
}
|
89
62
|
|
90
63
|
export default CollapsibleNav
|
@@ -1,15 +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
|
-
<Nav variant="
|
6
|
+
<Nav variant="subtle">
|
7
7
|
<NavItem
|
8
|
-
|
9
|
-
collapsible
|
10
|
-
collapsibleTrail
|
11
|
-
fontSize="small"
|
12
|
-
fontWeight="bolder"
|
8
|
+
collapsible
|
13
9
|
iconLeft="city"
|
14
10
|
iconRight={["plus", "minus"]}
|
15
11
|
link="#"
|
@@ -33,10 +29,8 @@ const CollapsibleNavEmphasize = (props) => {
|
|
33
29
|
/>
|
34
30
|
</NavItem>
|
35
31
|
<NavItem
|
32
|
+
active
|
36
33
|
collapsible
|
37
|
-
collapsibleTrail
|
38
|
-
fontSize="small"
|
39
|
-
fontWeight="bolder"
|
40
34
|
iconLeft="theater-masks"
|
41
35
|
iconRight={["plus", "minus"]}
|
42
36
|
link="#"
|
@@ -61,9 +55,6 @@ const CollapsibleNavEmphasize = (props) => {
|
|
61
55
|
</NavItem>
|
62
56
|
<NavItem
|
63
57
|
collapsible
|
64
|
-
collapsibleTrail
|
65
|
-
fontSize="small"
|
66
|
-
fontWeight="bolder"
|
67
58
|
iconLeft="city"
|
68
59
|
iconRight={["plus", "minus"]}
|
69
60
|
link="#"
|
@@ -90,4 +81,4 @@ const CollapsibleNavEmphasize = (props) => {
|
|
90
81
|
);
|
91
82
|
};
|
92
83
|
|
93
|
-
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'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%= pb_rails("select", props: {
|
2
|
+
data: { options: "data_attribute" },
|
3
|
+
label: "Favorite Food",
|
4
|
+
name: "food",
|
5
|
+
options: [
|
6
|
+
{
|
7
|
+
value: "1",
|
8
|
+
value_text: "Burgers",
|
9
|
+
},
|
10
|
+
{
|
11
|
+
value: "2",
|
12
|
+
selected: true,
|
13
|
+
value_text: "Pizza",
|
14
|
+
},
|
15
|
+
{
|
16
|
+
value: "3",
|
17
|
+
value_text: "Tacos",
|
18
|
+
},
|
19
|
+
{
|
20
|
+
value: "4",
|
21
|
+
value_text: "BBQ",
|
22
|
+
},
|
23
|
+
]
|
24
|
+
}) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Inspect the element and notice the data-attribute being added to the `<select>` element
|