playbook_ui_docs 12.37.0.pre.alpha.PLAY951collapsiblenav31062 → 12.37.0.pre.alpha.PLAYaddingdatapropselectkit1071

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) 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_date/docs/_date_alignment.jsx +2 -2
  10. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +29 -5
  11. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +2 -2
  12. data/app/pb_kits/playbook/pb_date/docs/_date_variants.jsx +5 -5
  13. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +58 -79
  14. data/app/pb_kits/playbook/pb_nav/docs/{_collapsible_nav_emphasize.jsx → _collapsible_nav_custom_icons.jsx} +3 -5
  15. data/app/pb_kits/playbook/pb_nav/docs/example.yml +3 -5
  16. data/app/pb_kits/playbook/pb_nav/docs/index.js +1 -2
  17. data/app/pb_kits/playbook/pb_select/docs/_select_data_attributes.html.erb +24 -0
  18. data/app/pb_kits/playbook/pb_select/docs/_select_data_attributes.md +1 -0
  19. data/app/pb_kits/playbook/pb_select/docs/example.yml +1 -0
  20. data/dist/playbook-doc.js +10 -15
  21. metadata +5 -10
  22. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +0 -75
  23. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.md +0 -3
  24. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +0 -1
  25. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.jsx +0 -57
  26. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_custom.md +0 -1
  27. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_emphasize.html.erb +0 -23
  28. 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: 0be5520fa28bfc41a99c493eb7dd8685b34536124de75e0e6384bad94a052819
4
- data.tar.gz: 127d7fcbbe8660549e07bced2edba82786174b291d3999b454149a5135cc5a29
3
+ metadata.gz: 07d96e66096935be57e79f420aaf89d1cc9c21950f6d37a8318efb9954f90d4b
4
+ data.tar.gz: d10d6102fd9f8fd01a3ace6fc774fe107d20527093ba44e96a59d584353d7f90
5
5
  SHA512:
6
- metadata.gz: d7596c47d39fac8af0476254757fd363f18d2a96922e3da3f2d4d214f03ffba449df97870ed29d30215a1527114b16150b7d14a21541e5f9b3ad147af930c847
7
- data.tar.gz: 9315e4ab92780fe5aba4ad99272ba112060b47fb05e2cb789c91e28e8dc55f38d5b4bac94e7545489a44f62e39a844c0d5ffb9d72d0405a1d776c30ff01142ae
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'
@@ -7,7 +7,7 @@ const DateAlignment = (props) => {
7
7
  <FormattedDate
8
8
  dayOfWeek
9
9
  icon
10
- value="1995-12-25"
10
+ value={new Date('25 Dec 1995')}
11
11
  {...props}
12
12
  />
13
13
 
@@ -17,7 +17,7 @@ const DateAlignment = (props) => {
17
17
  alignment="center"
18
18
  dayOfWeek
19
19
  icon
20
- value="2020-12-25"
20
+ value={new Date('25 Dec 2020')}
21
21
  {...props}
22
22
  />
23
23
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { Date as FormattedDate } from '../../'
2
+ import { Date as FormattedDate, Caption, Title } from '../../'
3
3
 
4
4
  const DateDefault = (props) => {
5
5
  return (
@@ -12,9 +12,20 @@ const DateDefault = (props) => {
12
12
 
13
13
  <br />
14
14
 
15
+ <div style={{display: "flex", columnGap: 4}}>
16
+ <FormattedDate
17
+ size="sm"
18
+ value={"2012-08-03"}
19
+ {...props}
20
+ />
21
+ <Caption>{"(Hyphenated Date)"}</Caption>
22
+ </div>
23
+
24
+ <br />
25
+
15
26
  <FormattedDate
16
27
  size="sm"
17
- value="2012-08-03"
28
+ value={new Date('03 Aug 2012')}
18
29
  {...props}
19
30
  />
20
31
 
@@ -23,7 +34,7 @@ const DateDefault = (props) => {
23
34
  <FormattedDate
24
35
  showDayOfWeek
25
36
  size="sm"
26
- value="2017-12-03"
37
+ value={new Date('03 Dec 2017')}
27
38
  {...props}
28
39
  />
29
40
 
@@ -37,8 +48,21 @@ const DateDefault = (props) => {
37
48
 
38
49
  <br />
39
50
 
51
+ <div style={{display: "flex", columnGap: 4}}>
52
+ <FormattedDate
53
+ value={"2012-08-03"}
54
+ {...props}
55
+ />
56
+ <Title
57
+ size={4}
58
+ text={"(Hyphenated Date)"}
59
+ />
60
+ </div>
61
+
62
+ <br />
63
+
40
64
  <FormattedDate
41
- value="2012-08-03"
65
+ value={new Date('03 Aug 2012')}
42
66
  {...props}
43
67
  />
44
68
 
@@ -46,7 +70,7 @@ const DateDefault = (props) => {
46
70
 
47
71
  <FormattedDate
48
72
  showDayOfWeek
49
- value="2017-12-03"
73
+ value={new Date('03 Dec 2017')}
50
74
  {...props}
51
75
  />
52
76
  </>
@@ -21,7 +21,7 @@ const DateUnstyled = (props) => {
21
21
  <Title size={1}>
22
22
  <FormattedDate
23
23
  unstyled
24
- value="1995-12-25"
24
+ value={new Date('25 Dec 1995')}
25
25
  {...props}
26
26
  />
27
27
  </Title>
@@ -36,7 +36,7 @@ const DateUnstyled = (props) => {
36
36
  showDayOfWeek
37
37
  showIcon
38
38
  unstyled
39
- value="1995-12-25"
39
+ value={new Date('25 Dec 1995')}
40
40
  {...props}
41
41
  />
42
42
  </Caption>
@@ -7,7 +7,7 @@ const DateVariants = (props) => {
7
7
  <FormattedDate
8
8
  showIcon
9
9
  size="sm"
10
- value="1995-12-25"
10
+ value={new Date('25 Dec 1995')}
11
11
  {...props}
12
12
  />
13
13
 
@@ -15,7 +15,7 @@ const DateVariants = (props) => {
15
15
  <br />
16
16
 
17
17
  <FormattedDate
18
- value="1995-12-25"
18
+ value={new Date('25 Dec 1995')}
19
19
  {...props}
20
20
  />
21
21
 
@@ -24,7 +24,7 @@ const DateVariants = (props) => {
24
24
 
25
25
  <FormattedDate
26
26
  showIcon
27
- value="1995-12-25"
27
+ value={new Date('25 Dec 1995')}
28
28
  {...props}
29
29
  />
30
30
 
@@ -33,7 +33,7 @@ const DateVariants = (props) => {
33
33
 
34
34
  <FormattedDate
35
35
  showDayOfWeek
36
- value="1995-12-25"
36
+ value={new Date('25 Dec 1995')}
37
37
  {...props}
38
38
  />
39
39
 
@@ -43,7 +43,7 @@ const DateVariants = (props) => {
43
43
  <FormattedDate
44
44
  showDayOfWeek
45
45
  showIcon
46
- value="1995-12-25"
46
+ value={new Date('25 Dec 1995')}
47
47
  {...props}
48
48
  />
49
49
  </div>
@@ -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
- <Nav variant="subtle">
7
- <NavItem
8
- collapsible
9
- iconLeft="city"
10
- iconRight={["plus", "minus"]}
11
- link="#"
12
- text="Overview"
13
- {...props}
14
- >
15
- <NavItem
16
- link="#"
17
- text="City"
18
- {...props}
19
- />
20
- <NavItem
21
- link="#"
22
- text="People"
23
- {...props}
24
- />
25
- <NavItem
26
- link="#"
27
- text="Business"
28
- {...props}
29
- />
30
- </NavItem>
31
- <NavItem
32
- active
33
- collapsible
34
- iconLeft="theater-masks"
35
- iconRight={["plus", "minus"]}
36
- link="#"
37
- text="Albums"
38
- {...props}
39
- >
40
- <NavItem
41
- link="#"
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 CollapsibleNavEmphasize = (props) => {
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 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