playbook_ui 2.8.7 → 2.8.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/packs/examples.js +3 -0
  3. data/app/pb_kits/playbook/packs/kits.js +1 -0
  4. data/app/pb_kits/playbook/pb_avatar/_avatar.jsx +25 -36
  5. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +54 -14
  6. data/app/pb_kits/playbook/pb_bar_graph/barGraphSettings.js +17 -17
  7. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.html.erb +8 -1
  8. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.jsx +30 -8
  9. data/app/pb_kits/playbook/pb_body/_body.jsx +46 -33
  10. data/app/pb_kits/playbook/pb_body/docs/_body_dark.jsx +3 -0
  11. data/app/pb_kits/playbook/pb_body/docs/_body_light.jsx +3 -0
  12. data/app/pb_kits/playbook/pb_button/_button.jsx +106 -37
  13. data/app/pb_kits/playbook/pb_button/docs/_button_accessibility.jsx +15 -0
  14. data/app/pb_kits/playbook/pb_button/docs/_button_block_content.jsx +14 -0
  15. data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +22 -0
  16. data/app/pb_kits/playbook/pb_button/docs/_button_default_dark.jsx +22 -0
  17. data/app/pb_kits/playbook/pb_button/docs/_button_full_width.jsx +13 -0
  18. data/app/pb_kits/playbook/pb_button/docs/_button_link.jsx +23 -0
  19. data/app/pb_kits/playbook/pb_button/docs/_button_loading.jsx +23 -0
  20. data/app/pb_kits/playbook/pb_button/docs/example.yml +8 -4
  21. data/app/pb_kits/playbook/pb_button/docs/index.js +7 -3
  22. data/app/pb_kits/playbook/pb_caption/_caption.jsx +31 -34
  23. data/app/pb_kits/playbook/pb_card/_card.jsx +35 -20
  24. data/app/pb_kits/playbook/pb_card/docs/_card_content.jsx +17 -0
  25. data/app/pb_kits/playbook/pb_card/docs/_card_padding.jsx +23 -0
  26. data/app/pb_kits/playbook/pb_card/docs/_card_selected.jsx +14 -0
  27. data/app/pb_kits/playbook/pb_card/docs/_card_shadow.jsx +23 -0
  28. data/app/pb_kits/playbook/pb_card/docs/example.yml +4 -0
  29. data/app/pb_kits/playbook/pb_card/docs/index.js +4 -0
  30. data/app/pb_kits/playbook/pb_currency/_currency.jsx +67 -18
  31. data/app/pb_kits/playbook/pb_currency/docs/_currency_default.jsx +14 -1
  32. data/app/pb_kits/playbook/pb_currency/docs/_currency_large.jsx +28 -0
  33. data/app/pb_kits/playbook/pb_currency/docs/example.yml +2 -3
  34. data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
  35. data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_default.jsx +1 -3
  36. data/app/pb_kits/playbook/pb_dashboard_value/docs/example.yml +0 -2
  37. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +1 -1
  38. data/app/pb_kits/playbook/pb_icon/docs/_icon_default.jsx +1 -1
  39. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.jsx +1 -3
  40. data/app/pb_kits/playbook/pb_icon_value/docs/_icon_value_default.jsx +1 -3
  41. data/app/pb_kits/playbook/pb_label_pill/docs/_label_pill_default.jsx +1 -3
  42. data/app/pb_kits/playbook/pb_label_value/docs/_label_value_default.jsx +1 -3
  43. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +57 -25
  44. data/app/pb_kits/playbook/pb_line_graph/docs/{_rails.html.erb → _line_graph_default.html.erb} +0 -0
  45. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_default.jsx +34 -0
  46. data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +5 -2
  47. data/app/pb_kits/playbook/pb_line_graph/docs/index.js +1 -0
  48. data/app/pb_kits/playbook/pb_line_graph/lineGraphSettings.js +9 -9
  49. data/app/pb_kits/playbook/pb_list/docs/_list_default.jsx +1 -5
  50. data/app/pb_kits/playbook/pb_message/docs/_message_default.jsx +1 -3
  51. data/app/pb_kits/playbook/pb_online_status/docs/_online_status_default.jsx +1 -3
  52. data/app/pb_kits/playbook/pb_owner/docs/_owner_default.jsx +1 -3
  53. data/app/pb_kits/playbook/pb_owner_phone/docs/_owner_phone_default.jsx +1 -3
  54. data/app/pb_kits/playbook/pb_phone/docs/_phone_default.jsx +1 -3
  55. data/app/pb_kits/playbook/pb_pill/_pill.jsx +22 -16
  56. data/app/pb_kits/playbook/pb_pill/docs/_pill_default.jsx +21 -1
  57. data/app/pb_kits/playbook/pb_progress_simple/docs/_progress_simple_default.jsx +1 -3
  58. data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_default.jsx +1 -3
  59. data/app/pb_kits/playbook/pb_source/docs/_source_default.jsx +1 -3
  60. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.jsx +1 -3
  61. data/app/pb_kits/playbook/pb_stat_change/docs/_stat_change_default.jsx +1 -3
  62. data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.jsx +1 -3
  63. data/app/pb_kits/playbook/pb_table/docs/example.yml +10 -10
  64. data/app/pb_kits/playbook/pb_time/docs/_time_default.html.erb +4 -9
  65. data/app/pb_kits/playbook/pb_time/docs/_time_default.jsx +1 -3
  66. data/app/pb_kits/playbook/pb_time/docs/_time_timestamp.html.erb +16 -0
  67. data/app/pb_kits/playbook/pb_time/docs/example.yml +4 -5
  68. data/app/pb_kits/playbook/pb_time/time.rb +19 -7
  69. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default.jsx +1 -3
  70. data/app/pb_kits/playbook/pb_title/_title.jsx +41 -30
  71. data/app/pb_kits/playbook/pb_title/docs/_title_light.jsx +1 -0
  72. data/app/pb_kits/playbook/pb_title_count/_title_count.scss +2 -2
  73. data/app/pb_kits/playbook/pb_title_count/docs/_title_count_default.jsx +1 -3
  74. data/app/pb_kits/playbook/pb_title_count/title_count.rb +1 -1
  75. data/app/pb_kits/playbook/pb_title_detail/docs/_title_detail_default.jsx +1 -3
  76. data/app/pb_kits/playbook/pb_toggle/_toggle.html.erb +2 -2
  77. data/app/pb_kits/playbook/pb_toggle/_toggle.scss +1 -0
  78. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_default.jsx +1 -4
  79. data/app/pb_kits/playbook/pb_toggle/docs/_toggle_name.html.erb +25 -0
  80. data/app/pb_kits/playbook/pb_toggle/docs/example.yml +1 -1
  81. data/app/pb_kits/playbook/pb_toggle/toggle.rb +28 -11
  82. data/app/pb_kits/playbook/pb_user/docs/_user_default.jsx +1 -3
  83. data/app/pb_kits/playbook/pb_user_badge/docs/_user_badge_default.jsx +1 -3
  84. data/app/pb_kits/playbook/pb_vertical_nav/docs/_default_nav.jsx +1 -5
  85. data/lib/generators/kit/templates/kit_jsx.erb.tt +7 -29
  86. data/lib/playbook/version.rb +1 -1
  87. metadata +19 -7
  88. data/app/pb_kits/playbook/pb_button/docs/_button_dark.jsx +0 -14
  89. data/app/pb_kits/playbook/pb_button/docs/_button_light.jsx +0 -14
  90. data/app/pb_kits/playbook/pb_button/docs/_button_sizes.jsx +0 -14
  91. data/app/pb_kits/playbook/pb_line_graph/docs/_react.html.erb +0 -2
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+ import Button from '../_button.jsx'
3
+
4
+ const ButtonAccessibility = () => (
5
+ <div>
6
+ <Button
7
+ aria={{label: "button"}}
8
+ link="https://google.com"
9
+ tag="a"
10
+ text="Button with ARIA"
11
+ />
12
+ </div>
13
+ )
14
+
15
+ export default ButtonAccessibility
@@ -0,0 +1,14 @@
1
+ import React from 'react'
2
+ import Button from '../_button.jsx'
3
+
4
+ const ButtonBlockContent = () => (
5
+ <div>
6
+ <Button
7
+ fixedWidth
8
+ icon="users"
9
+ text="Button with Block Content"
10
+ />
11
+ </div>
12
+ )
13
+
14
+ export default ButtonBlockContent
@@ -0,0 +1,22 @@
1
+ import React from 'react'
2
+ import Button from '../_button.jsx'
3
+
4
+ const ButtonDefault = () => (
5
+ <div>
6
+ <Button text="Button Primary"/>
7
+ <Button
8
+ text="Button Secondary"
9
+ variant="secondary"
10
+ />
11
+ <Button
12
+ text="Button Link"
13
+ variant="link"
14
+ />
15
+ <Button
16
+ text="Button Disabled"
17
+ disabled
18
+ />
19
+ </div>
20
+ )
21
+
22
+ export default ButtonDefault
@@ -0,0 +1,22 @@
1
+ import React from 'react'
2
+ import Button from '../_button.jsx'
3
+
4
+ const ButtonDefaultDark = () => (
5
+ <div>
6
+ <Button text="Button Primary"/>
7
+ <Button
8
+ text="Button Secondary"
9
+ variant="secondary"
10
+ />
11
+ <Button
12
+ text="Button Link"
13
+ variant="link"
14
+ />
15
+ <Button
16
+ text="Button Disabled"
17
+ disabled
18
+ />
19
+ </div>
20
+ )
21
+
22
+ export default ButtonDefaultDark
@@ -0,0 +1,13 @@
1
+ import React from 'react'
2
+ import Button from '../_button.jsx'
3
+
4
+ const ButtonFullWidth = () => (
5
+ <div>
6
+ <Button
7
+ text="Button Full Width"
8
+ fullWidth
9
+ />
10
+ </div>
11
+ )
12
+
13
+ export default ButtonFullWidth
@@ -0,0 +1,23 @@
1
+ import React from 'react'
2
+ import Button from '../_button.jsx'
3
+
4
+ const ButtonLink = () => (
5
+ <div>
6
+ <Button
7
+ link="https://google.com"
8
+ text="A Tag Button"
9
+ />
10
+ <Button
11
+ link="https://google.com"
12
+ newWindow
13
+ text="Open in New Window"
14
+ />
15
+ <Button
16
+ disabled
17
+ link="https://google.com"
18
+ text="A Tag Button Disabled"
19
+ />
20
+ </div>
21
+ )
22
+
23
+ export default ButtonLink
@@ -0,0 +1,23 @@
1
+ import React from 'react'
2
+ import Button from '../_button.jsx'
3
+
4
+ const ButtonLoading = () => (
5
+ <div>
6
+ <Button
7
+ loading
8
+ text="Button Primary"
9
+ />
10
+ <Button
11
+ loading
12
+ text="Button Secondary"
13
+ variant="secondary"
14
+ />
15
+ <Button
16
+ loading
17
+ text="A Tag Button Disabled"
18
+ variant="link"
19
+ />
20
+ </div>
21
+ )
22
+
23
+ export default ButtonLoading
@@ -1,13 +1,17 @@
1
1
  examples:
2
2
  rails:
3
3
  - button_default: Button Variants
4
+ - button_default_dark: Button Variants Dark
4
5
  - button_full_width: Button Full Width
5
6
  - button_link: Button Links
6
7
  - button_loading: Button Loading
7
8
  - button_block_content: Button Block Content
8
9
  - button_accessibility: Button Accessibility Options
9
- - button_default_dark: Button Variants Dark
10
10
  react:
11
- - button_sizes: Button Sizes
12
- - button_light: Buttons Light UI
13
- - button_dark: Buttons Dark UI
11
+ - button_default: Button Variants
12
+ - button_default_dark: Button Variants Dark
13
+ - button_full_width: Button Full Width
14
+ - button_link: Button Links
15
+ - button_loading: Button Loading
16
+ - button_block_content: Button Block Content
17
+ - button_accessibility: Button Accessibility Options
@@ -1,3 +1,7 @@
1
- export {default as ButtonDark} from './_button_dark.jsx';
2
- export {default as ButtonLight} from './_button_light.jsx';
3
- export {default as ButtonSizes} from './_button_sizes.jsx';
1
+ export {default as ButtonDefault} from './_button_default.jsx'
2
+ export {default as ButtonFullWidth} from './_button_full_width.jsx'
3
+ export {default as ButtonLink} from './_button_link.jsx'
4
+ export {default as ButtonLoading} from './_button_loading.jsx'
5
+ export {default as ButtonBlockContent} from './_button_block_content.jsx'
6
+ export {default as ButtonAccessibility} from './_button_accessibility.jsx'
7
+ export {default as ButtonDefaultDark} from './_button_default_dark.jsx'
@@ -1,39 +1,36 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
1
+ /* @flow */
3
2
 
4
- const propTypes = {
5
- tag: PropTypes.string.isRequired,
6
- text: PropTypes.string.isRequired,
7
- large: PropTypes.bool,
8
- dark: PropTypes.bool
9
- };
3
+ import React from 'react'
10
4
 
11
- const defaultProps = {
12
- tag: "div",
13
- text: "Hello Cool React Caption",
14
- large: false,
15
- dark: false
16
- };
17
-
18
- class Caption extends React.Component {
19
- render() {
20
- const { tag, text, large, dark } = this.props;
21
- const Tag = `${tag}`;
22
- return (
23
- <Tag
24
- className={
25
- `caption` +
26
- (large === true ? "_lg" : "") +
27
- (dark === true ? "_dark" : "")
28
- }
29
- >
30
- {text}
31
- </Tag>
32
- );
33
- }
5
+ type CaptionProps = {
6
+ children: Array<React.ReactNode> | React.ReactNode,
7
+ dark?: Boolean,
8
+ large?: Boolean,
9
+ tag: String,
10
+ text: String,
34
11
  }
35
12
 
36
- Caption.propTypes = propTypes;
37
- Caption.defaultProps = defaultProps;
13
+ const Caption = ({
14
+ children,
15
+ dark=false,
16
+ large=false,
17
+ tag='div',
18
+ text,
19
+ }: CaptionProps) => {
20
+
21
+ const Tag = `${tag}`
22
+
23
+ return (
24
+ <Tag
25
+ className={
26
+ `pb_caption_kit` +
27
+ (large === true ? '_lg' : '') +
28
+ (dark === true ? '_dark' : '')
29
+ }
30
+ >
31
+ {text || children}
32
+ </Tag>
33
+ )
34
+ }
38
35
 
39
- export default Caption;
36
+ export default Caption
@@ -1,25 +1,40 @@
1
- import React from 'react';
2
- import PropTypes from "prop-types";
1
+ /* @flow */
3
2
 
4
- const propTypes = {
5
- children: PropTypes.oneOfType([
6
- PropTypes.arrayOf(PropTypes.node),
7
- PropTypes.node
8
- ])
9
- };
3
+ import React from 'react'
10
4
 
11
- class Card extends React.Component {
12
- render() {
13
- return (
14
- <div className="pb_card">
15
- <div className="pb_card_body">
16
- { this.props.children }
17
- </div>
18
- </div>
19
- )
20
- }
5
+ type CardPropTypes = {
6
+ children: Array<React.ReactNode> | React.ReactNode,
7
+ padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
8
+ selected?: Boolean,
9
+ shadow?: 'none' | 'shallow' | 'default' | 'deep' | 'deeper' | 'deepest',
10
+ }
11
+
12
+ const cardCSS = ({
13
+ selected=false,
14
+ shadow='none',
15
+ }: CardPropTypes) => {
16
+ let css = ''
17
+ css += selected ? '_selected' : '_deselected'
18
+ css += `_shadow_${shadow}`
19
+ return css
20
+ }
21
+
22
+ const bodyCSS = ({padding='md'}: CardPropTypes) => {
23
+ let css = ''
24
+ css += `_${padding}`
25
+ return css
21
26
  }
22
27
 
23
- Card.propTypes = propTypes;
28
+ const Card = (props: CardPropTypes) => {
29
+ const {children} = props
30
+
31
+ return (
32
+ <div className={`pb_card_kit${cardCSS(props)}`}>
33
+ <div className={`pb_card_body_kit${bodyCSS(props)}`}>
34
+ { children }
35
+ </div>
36
+ </div>
37
+ )
38
+ }
24
39
 
25
- export default Card;
40
+ export default Card
@@ -0,0 +1,17 @@
1
+ import React from 'react'
2
+ import Card from '../_card.jsx'
3
+
4
+ function CardContent() {
5
+ return (
6
+ <div>
7
+ <Card>{`Card content`}</Card>
8
+ <br/>
9
+ <Card>{`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis, risus a fringilla luctus, sapien eros sodales ex, quis molestie est nulla non turpis. Vestibulum aliquet at ipsum eget posuere. Morbi sed laoreet erat. Sed commodo posuere lectus, at porta nulla ornare a. Suspendisse quam est, sollicitudin ut enim sit amet, commodo placerat enim. Donec laoreet metus ac mauris pellentesque mattis. Pellentesque luctus vel mauris non aliquam. Mauris hendrerit mattis porttitor. Curabitur vehicula justo non ex consectetur commodo. Quisque posuere aliquet quam. Maecenas malesuada magna mauris, ac tempor metus euismod at.
10
+
11
+ Cras ornare fermentum magna mollis efficitur. Sed vitae nulla vel purus ultrices mollis. Maecenas id nulla id libero faucibus feugiat quis sit amet turpis. In commodo pellentesque risus at fringilla. Integer non interdum leo, non commodo ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mi augue, dignissim at orci vel, egestas aliquam mi. Proin finibus aliquet tempor. Integer cursus, ex quis gravida rhoncus, nisi elit viverra ipsum, non efficitur est ex ac tortor. Praesent vitae odio massa.`}</Card>
12
+ <br/>
13
+ </div>
14
+ )
15
+ }
16
+
17
+ export default CardContent
@@ -0,0 +1,23 @@
1
+ import React from 'react'
2
+ import Card from '../_card.jsx'
3
+
4
+ function CardPadding() {
5
+ return (
6
+ <div>
7
+ <Card padding='none'>{`Card content`}</Card>
8
+ <br/>
9
+ <Card padding='xs'>{`Card content`}</Card>
10
+ <br/>
11
+ <Card padding='sm'>{`Card content`}</Card>
12
+ <br/>
13
+ <Card padding='md'>{`Card content`}</Card>
14
+ <br/>
15
+ <Card padding='lg'>{`Card content`}</Card>
16
+ <br/>
17
+ <Card padding='xl'>{`Card content`}</Card>
18
+ <br/>
19
+ </div>
20
+ )
21
+ }
22
+
23
+ export default CardPadding
@@ -0,0 +1,14 @@
1
+ import React from "react"
2
+ import Card from "../_card.jsx"
3
+
4
+ function CardSelected() {
5
+ return (
6
+ <div>
7
+ <Card>{`Card content`}</Card>
8
+ <br/>
9
+ <Card selected>{`Card content`}</Card>
10
+ </div>
11
+ )
12
+ }
13
+
14
+ export default CardSelected
@@ -0,0 +1,23 @@
1
+ import React from 'react'
2
+ import Card from '../_card.jsx'
3
+
4
+ function CardShadow() {
5
+ return (
6
+ <div>
7
+ <Card shadow='none'>{`Card content`}</Card>
8
+ <br/>
9
+ <Card shadow='shallow'>{`Card content`}</Card>
10
+ <br/>
11
+ <Card shadow='default'>{`Card content`}</Card>
12
+ <br/>
13
+ <Card shadow='deep'>{`Card content`}</Card>
14
+ <br/>
15
+ <Card shadow='deeper'>{`Card content`}</Card>
16
+ <br/>
17
+ <Card shadow='deepest'>{`Card content`}</Card>
18
+ <br/>
19
+ </div>
20
+ )
21
+ }
22
+
23
+ export default CardShadow
@@ -7,3 +7,7 @@ examples:
7
7
  - card_content: Content Size
8
8
  react:
9
9
  - card_light: Default
10
+ - card_selected: Selected
11
+ - card_padding: Padding Size
12
+ - card_shadow: Shadow Size
13
+ - card_content: Content Size
@@ -1 +1,5 @@
1
1
  export {default as CardLight} from './_card_light.jsx';
2
+ export {default as CardSelected} from './_card_selected.jsx';
3
+ export {default as CardPadding} from './_card_padding.jsx';
4
+ export {default as CardShadow} from './_card_shadow.jsx';
5
+ export {default as CardContent} from './_card_content.jsx';
@@ -1,21 +1,70 @@
1
- import React from 'react';
2
- import PropTypes from "prop-types";
3
-
4
- const propTypes = {
5
- className: PropTypes.string,
6
- id: PropTypes.string
7
- };
8
-
9
- class Currency extends React.Component {
10
- render() {
11
- return (
12
- <div className="pb_currency">
13
- <span>{`CURRENCY CONTENT`}</span>
14
- </div>
15
- )
16
- }
1
+ /* @flow */
2
+
3
+ import React from 'react'
4
+ import classnames from 'classnames'
5
+
6
+ import Body from '../pb_body/_body.jsx'
7
+ import Caption from '../pb_caption/_caption.jsx'
8
+ import Title from '../pb_title/_title.jsx'
9
+
10
+ type CurrencyProps = {
11
+ align?: 'left' | 'center' | 'right',
12
+ className: String,
13
+ currencySymbol: '$',
14
+ label?: String,
15
+ separator?: '.' | ',',
16
+ size?: 'sm' | 'lg',
17
+ value?: String,
18
+ unit?: '00',
19
+ }
20
+
21
+ const kitCSS = ({align='left'}: CurrencyProps) => {
22
+ let css = 'pb_currency_kit'
23
+ css += `_${align}`
24
+ return css
25
+ }
26
+
27
+ const bodyCSS = ({}: CurrencyProps) => {
28
+ let css = ''
29
+ return css
17
30
  }
18
31
 
19
- Currency.propTypes = propTypes;
32
+ const symbolCSS = (currencySymbol) => {
33
+ return classnames({
34
+ dollar_sign: currencySymbol === '$',
35
+ })
36
+ }
37
+
38
+ const sizes = {
39
+ lg: 1,
40
+ sm: 2,
41
+ }
42
+
43
+ const Currency = (props: CurrencyProps) => {
44
+ const {
45
+ currencySymbol='$',
46
+ label='',
47
+ separator='.',
48
+ size='sm',
49
+ units='00',
50
+ value,
51
+ } = props
52
+
53
+ return (
54
+ <div className={kitCSS(props)}>
55
+ <Caption>{label}</Caption>
56
+ <div className='pb_currency_wrapper'>
57
+ <Body className={symbolCSS(currencySymbol)}>{currencySymbol}</Body>
58
+ <Title
59
+ className='pb_currency_value'
60
+ size={sizes[size]}
61
+ >
62
+ {`${value}${separator}`}
63
+ </Title>
64
+ <Body className='unit'>{units}</Body>
65
+ </div>
66
+ </div>
67
+ )
68
+ }
20
69
 
21
- export default Currency;
70
+ export default Currency