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.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_color.jsx +2 -2
  3. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_default.jsx +2 -2
  4. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +8 -4
  5. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.md +1 -1
  6. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_size.jsx +5 -5
  7. data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +6 -7
  8. data/app/pb_kits/playbook/pb_collapsible/docs/index.js +1 -2
  9. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +58 -85
  10. data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_emphasize.jsx → _collapsible_nav_custom_icons.jsx} +5 -14
  11. data/app/pb_kits/playbook/pb_nav/docs/example.yml +3 -5
  12. data/app/pb_kits/playbook/pb_nav/docs/index.js +1 -2
  13. data/app/pb_kits/playbook/pb_select/docs/_select_data_attributes.html.erb +24 -0
  14. data/app/pb_kits/playbook/pb_select/docs/_select_data_attributes.md +1 -0
  15. data/app/pb_kits/playbook/pb_select/docs/example.yml +1 -0
  16. data/dist/playbook-doc.js +3 -3
  17. metadata +5 -10
  18. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +0 -75
  19. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.md +0 -3
  20. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +0 -1
  21. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +0 -58
  22. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.md +0 -1
  23. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +0 -23
  24. 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: 0d7df649085aee63a54d3d777f3be3a2c3896028344f6dda64c1737372f85bca
4
- data.tar.gz: 9b0f26690e5070472b8e3f87964023603a5e5ae4cde2c72c063ecbd556d819c7
3
+ metadata.gz: 07d96e66096935be57e79f420aaf89d1cc9c21950f6d37a8318efb9954f90d4b
4
+ data.tar.gz: d10d6102fd9f8fd01a3ace6fc774fe107d20527093ba44e96a59d584353d7f90
5
5
  SHA512:
6
- metadata.gz: 12fa1864a771d2082b52c9837499b566d7e2b24f24e0c76578c4bca9dd31becfbeea8a47841004abd1f7292c29665e60064bcce0ad8c6cc86c2c10deaa3479ce
7
- data.tar.gz: 343e0df6742f38765b04a58777884b04673e4d4aeb2169b7ec1df05168b99338574a40fed869b2f4d4a24ab46e83098c7f15a243aa1304d59722b31aa62da928
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 = (props) => (
4
+ const CollapsibleColor = () => (
5
5
  <div>
6
6
  <Collapsible
7
7
  iconColor='default'
8
8
  marginBottom="xs"
9
9
  >
10
- <Collapsible.Main {...props}>
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 = (props) => (
4
+ const CollapsibleDefault = () => (
5
5
  <Collapsible >
6
- <Collapsible.Main {...props}>
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 = (props) => {
4
+ const CollapsibleIcons = () => {
5
+ const [isCollapsed, setIsCollapsed] = useCollapsible(true)
5
6
 
6
7
  return (
7
8
  <>
8
- <Collapsible
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 {...props}>
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
- The `icon` prop allows you to customize your icon sets by passing it an array of any comma-separated pair of icon values. The first icon value will replace the kit's default icon when collapsed (chevron-down), and the second value will replace the default icon when expanded (chevron-up). `icon` also allows you to pass it a single icon as a string, in which case the icon will not toggle with the collapsible state.
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 = (props) => (
4
+ const CollapsibleSize = () => (
5
5
  <div>
6
6
  <Collapsible
7
7
  iconSize="xs"
8
8
  marginBottom="xs"
9
9
  >
10
- <Collapsible.Main {...props}>
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 {...props}>
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 {...props}>
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 {...props}>
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: Icon Size
6
- - collapsible_color: Icon 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: Icon Size
12
- - collapsible_color: Icon 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
- <Nav>
7
- <NavItem
8
- active
9
- collapsible
10
- collapsibleTrail
11
- fontWeight="bolder"
12
- iconLeft="city"
13
- iconRight={["plus", "minus"]}
14
- link="#"
15
- text="Overview"
16
- {...props}
17
- >
18
- <NavItem
19
- link="#"
20
- text="City"
21
- {...props}
22
- />
23
- <NavItem
24
- link="#"
25
- text="People"
26
- {...props}
27
- />
28
- <NavItem
29
- link="#"
30
- text="Business"
31
- {...props}
32
- />
33
- </NavItem>
34
- <NavItem
35
- collapsible
36
- collapsibleTrail
37
- fontWeight="bolder"
38
- iconLeft="theater-masks"
39
- iconRight={["plus", "minus"]}
40
- link="#"
41
- text="Albums"
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 CollapsibleNavEmphasize = (props) => {
4
+ const CollapsibleNavCustomIcons = (props) => {
5
5
  return (
6
- <Nav variant="bold">
6
+ <Nav variant="subtle">
7
7
  <NavItem
8
- active
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 CollapsibleNavEmphasize;
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 Nav
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 Nav
30
- - collapsible_nav_emphasize: Collapsible Nav with Emphasize Styling
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 CollapsibleNavCustom } from './_collapsible_nav_custom.jsx'
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
@@ -11,6 +11,7 @@ examples:
11
11
  - select_error: Select w/ Error
12
12
  - select_inline: Select Inline
13
13
  - select_inline_compact: Select Inline Compact
14
+ - select_data_attributes: Select W/ Data Attributes
14
15
 
15
16
 
16
17