playbook_ui 2.8.8 → 2.8.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -289
- data/app/pb_kits/playbook/packs/index.js +6 -0
- data/app/pb_kits/playbook/pb_body/_body.jsx +4 -4
- data/app/pb_kits/playbook/pb_button/_button_mixins.scss +1 -1
- data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +75 -17
- data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_align.jsx +31 -0
- data/app/pb_kits/playbook/pb_dashboard_value/docs/_dashboard_value_default.jsx +20 -1
- data/app/pb_kits/playbook/pb_dashboard_value/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_dashboard_value/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date/date.rb +16 -2
- data/app/pb_kits/playbook/pb_date/docs/_date_default.html.erb +7 -0
- data/app/pb_kits/playbook/pb_icon/_icon.jsx +87 -18
- data/app/pb_kits/playbook/pb_icon/docs/_icon_animate.jsx +14 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_border.jsx +12 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_icon/docs/_icon_default_dark.jsx +12 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_flip.jsx +14 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_pull.jsx +13 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_rotate.jsx +14 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_sizes.jsx +27 -0
- data/app/pb_kits/playbook/pb_icon/docs/example.yml +8 -1
- data/app/pb_kits/playbook/pb_icon/docs/index.js +7 -0
- data/app/pb_kits/playbook/pb_pill/_pill.jsx +19 -12
- data/app/pb_kits/playbook/pb_pill/_pill.scss +1 -1
- data/app/pb_kits/playbook/pb_pill/pill.rb +1 -3
- data/app/pb_kits/playbook/pb_stat_change/_stat_change.jsx +78 -18
- data/app/pb_kits/playbook/pb_stat_change/docs/_stat_change_default.jsx +11 -1
- data/app/pb_kits/playbook/pb_stat_value/_stat_value.jsx +44 -16
- data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_unit.jsx +10 -0
- data/app/pb_kits/playbook/pb_stat_value/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_stat_value/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_toggle/_toggle.html.erb +1 -1
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_custom.html.erb +3 -0
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_custom_radio.html.erb +22 -0
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_name.html.erb +14 -18
- data/app/pb_kits/playbook/pb_toggle/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_toggle/toggle.rb +19 -5
- data/lib/playbook/version.rb +1 -1
- metadata +13 -2
@@ -0,0 +1,31 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import DashboardValue from "../_dashboard_value.jsx"
|
3
|
+
|
4
|
+
function DashboardValueAlign() {
|
5
|
+
return (
|
6
|
+
<div>
|
7
|
+
<DashboardValue
|
8
|
+
stat_label={{label: "Top Title Value"}}
|
9
|
+
stat_value={{value: "1,428", unit: "appts"}}
|
10
|
+
stat_change={{change: "decrease", value: "26.1%"}} />
|
11
|
+
|
12
|
+
<br/><br/>
|
13
|
+
|
14
|
+
<DashboardValue
|
15
|
+
align="center"
|
16
|
+
stat_label={{label: "Top Title Value"}}
|
17
|
+
stat_value={{value: "1,428", unit: "appts"}}
|
18
|
+
stat_change={{change: "decrease", value: "26.1%"}} />
|
19
|
+
|
20
|
+
<br/><br/>
|
21
|
+
|
22
|
+
<DashboardValue
|
23
|
+
align="right"
|
24
|
+
stat_label={{label: "Top Title Value"}}
|
25
|
+
stat_value={{value: "1,428", unit: "appts"}}
|
26
|
+
stat_change={{change: "decrease", value: "26.1%"}} />
|
27
|
+
</div>
|
28
|
+
)
|
29
|
+
}
|
30
|
+
|
31
|
+
export default DashboardValueAlign;
|
@@ -3,7 +3,26 @@ import DashboardValue from "../_dashboard_value.jsx"
|
|
3
3
|
|
4
4
|
function DashboardValueDefault() {
|
5
5
|
return (
|
6
|
-
<
|
6
|
+
<div>
|
7
|
+
<DashboardValue
|
8
|
+
stat_label={{label: "Decreased Value"}}
|
9
|
+
stat_value={{value: "1,428", unit: "appts"}}
|
10
|
+
stat_change={{change: "decrease", value: "26.1%"}} />
|
11
|
+
|
12
|
+
<br/><br/>
|
13
|
+
|
14
|
+
<DashboardValue
|
15
|
+
stat_label={{label: "Increased Value"}}
|
16
|
+
stat_value={{value: "938", unit: "homes"}}
|
17
|
+
stat_change={{change: "increase", value: "26.1%"}} />
|
18
|
+
|
19
|
+
<br/><br/>
|
20
|
+
|
21
|
+
<DashboardValue
|
22
|
+
stat_label={{label: "Neutral Value"}}
|
23
|
+
stat_value={{value: "261", unit: "windows"}}
|
24
|
+
stat_change={{value: "26.1%"}} />
|
25
|
+
</div>
|
7
26
|
)
|
8
27
|
}
|
9
28
|
|
@@ -28,7 +28,14 @@ module Playbook
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def display_value
|
31
|
-
size
|
31
|
+
case size
|
32
|
+
when "lg"
|
33
|
+
display_value_lg
|
34
|
+
when "sm"
|
35
|
+
display_value_sm
|
36
|
+
else
|
37
|
+
display_value_xs
|
38
|
+
end
|
32
39
|
end
|
33
40
|
|
34
41
|
def kit_class
|
@@ -67,7 +74,7 @@ module Playbook
|
|
67
74
|
end
|
68
75
|
|
69
76
|
def size
|
70
|
-
size_options = %w[lg sm]
|
77
|
+
size_options = %w[lg sm xs]
|
71
78
|
one_of_value(configured_size, size_options, "sm")
|
72
79
|
end
|
73
80
|
|
@@ -82,6 +89,13 @@ module Playbook
|
|
82
89
|
end
|
83
90
|
end
|
84
91
|
|
92
|
+
def display_value_xs
|
93
|
+
if is_set? configured_timestamp
|
94
|
+
pb_value = Playbook::PbTitle::Title.new(size: 4, text: text)
|
95
|
+
ApplicationController.renderer.render(partial: pb_value, as: :object)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
85
99
|
def display_value_sm
|
86
100
|
if is_set? configured_timestamp
|
87
101
|
pb_value = Playbook::PbTitle::Title.new(size: 4, text: icon + text)
|
@@ -1,21 +1,90 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
1
|
+
/* @flow */
|
2
|
+
|
3
|
+
import React from 'react'
|
4
|
+
import classnames from 'classnames'
|
5
|
+
|
6
|
+
type IconProps = {
|
7
|
+
aria?: Object,
|
8
|
+
border?: Boolean,
|
9
|
+
className?: String,
|
10
|
+
fixedWidth?: Boolean,
|
11
|
+
flip?: 'horizontal' | 'vertical' | 'both' | 'none',
|
12
|
+
icon: String,
|
13
|
+
id?: String,
|
14
|
+
inverse?: Boolean,
|
15
|
+
listItem?: Boolean,
|
16
|
+
pull?: 'left' | 'right' | 'none',
|
17
|
+
pulse?: Boolean,
|
18
|
+
rotation?: 90 | 180 | 270,
|
19
|
+
size?: 'lg' | 'xs' | 'sm' | '1x' | '2x' | '3x' | '4x' | '5x' | '6x' | '7x' | '8x' | '9x' | '10x',
|
20
|
+
spin?: Boolean
|
17
21
|
}
|
18
22
|
|
19
|
-
Icon
|
23
|
+
const Icon = (props: IconProps) => {
|
24
|
+
const {
|
25
|
+
aria,
|
26
|
+
border=false,
|
27
|
+
className,
|
28
|
+
fixedWidth=true,
|
29
|
+
flip=false,
|
30
|
+
icon,
|
31
|
+
id,
|
32
|
+
inverse=false,
|
33
|
+
listItem=false,
|
34
|
+
pull,
|
35
|
+
pulse=false,
|
36
|
+
rotation,
|
37
|
+
size,
|
38
|
+
spin=false
|
39
|
+
} = props
|
40
|
+
|
41
|
+
const hClass = "fa-flip-horizontal"
|
42
|
+
const vClass = "fa-flip-vertical"
|
43
|
+
|
44
|
+
const flipClass = (function(flip) {
|
45
|
+
switch(flip) {
|
46
|
+
case 'horizontal':
|
47
|
+
return hClass;
|
48
|
+
case 'vertical':
|
49
|
+
return vClass;
|
50
|
+
case 'both':
|
51
|
+
return `${vClass} ${hClass}`;
|
52
|
+
default:
|
53
|
+
return '';
|
54
|
+
}
|
55
|
+
})(flip)
|
56
|
+
|
57
|
+
const iconClass = icon !== '' && icon !== undefined ? `fa-${icon}` : ''
|
58
|
+
const borderClass = border ? 'fa-border' : ''
|
59
|
+
const fixedWidthClass = fixedWidth ? 'fa-fw' : ''
|
60
|
+
const inverseClass = inverse ? 'fa-inverse' : ''
|
61
|
+
const listItemClass = listItem ? 'fa-li' : ''
|
62
|
+
const pullClass = pull !== '' && pull !== undefined ? `fa-pull-${pull}` : ''
|
63
|
+
const pulseClass = pulse ? 'fa-pulse' : ''
|
64
|
+
const rotationClass = rotation !== '' && rotation !== undefined ? `fa-rotate-${rotation}` : ''
|
65
|
+
const sizeClass = size !== '' && size !== undefined ? `fa-${size}` : ''
|
66
|
+
const spinClass = spin ? 'fa-spin' : ''
|
67
|
+
|
68
|
+
const iconCss = classnames(
|
69
|
+
'pb_icon_kit',
|
70
|
+
'far',
|
71
|
+
iconClass,
|
72
|
+
borderClass,
|
73
|
+
fixedWidthClass,
|
74
|
+
flipClass,
|
75
|
+
inverseClass,
|
76
|
+
listItemClass,
|
77
|
+
pullClass,
|
78
|
+
pulseClass,
|
79
|
+
rotationClass,
|
80
|
+
sizeClass,
|
81
|
+
spinClass,
|
82
|
+
className
|
83
|
+
)
|
84
|
+
|
85
|
+
return (
|
86
|
+
<i id={id} className={iconCss}></i>
|
87
|
+
)
|
88
|
+
}
|
20
89
|
|
21
|
-
export default Icon
|
90
|
+
export default Icon
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import Icon from "../_icon.jsx"
|
3
|
+
|
4
|
+
function IconAnimate() {
|
5
|
+
return (
|
6
|
+
<div>
|
7
|
+
<p><Icon icon="spinner" size="2x" spin fixedWidth /> <span>Spin</span></p>
|
8
|
+
<br/>
|
9
|
+
<p><Icon icon="spinner" size="2x" pulse fixedWidth /> <span>Pulse</span></p>
|
10
|
+
</div>
|
11
|
+
)
|
12
|
+
}
|
13
|
+
|
14
|
+
export default IconAnimate;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import Icon from "../_icon.jsx"
|
3
|
+
|
4
|
+
function IconFlip() {
|
5
|
+
return (
|
6
|
+
<div>
|
7
|
+
<Icon icon="question-circle" flip="horizontal" size="2x" fixedWidth />
|
8
|
+
<Icon icon="question-circle" flip="vertical" size="2x" fixedWidth />
|
9
|
+
<Icon icon="question-circle" flip="both" size="2x" fixedWidth />
|
10
|
+
</div>
|
11
|
+
)
|
12
|
+
}
|
13
|
+
|
14
|
+
export default IconFlip;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import Icon from "../_icon.jsx"
|
3
|
+
|
4
|
+
function IconPull() {
|
5
|
+
return (
|
6
|
+
<div>
|
7
|
+
<Icon icon="arrow-left" pull="left" size="2x" fixedWidth />
|
8
|
+
<Icon icon="arrow-right" pull="right" size="2x" fixedWidth />
|
9
|
+
</div>
|
10
|
+
)
|
11
|
+
}
|
12
|
+
|
13
|
+
export default IconPull;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import Icon from "../_icon.jsx"
|
3
|
+
|
4
|
+
function IconRotate() {
|
5
|
+
return (
|
6
|
+
<div>
|
7
|
+
<Icon icon="user" rotation={90} size="2x" fixedWidth />
|
8
|
+
<Icon icon="user" rotation={180} size="2x" fixedWidth />
|
9
|
+
<Icon icon="user" rotation={270} size="2x" fixedWidth />
|
10
|
+
</div>
|
11
|
+
)
|
12
|
+
}
|
13
|
+
|
14
|
+
export default IconRotate;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import React from "react"
|
2
|
+
import Icon from "../_icon.jsx"
|
3
|
+
|
4
|
+
function IconSizes() {
|
5
|
+
return (
|
6
|
+
<div>
|
7
|
+
<p><Icon icon="user" size="lg" /> <span>Large</span></p>
|
8
|
+
<p><Icon icon="user" size="sm" /> <span>Small</span></p>
|
9
|
+
<p><Icon icon="user" size="xs" /> <span>XSmall</span></p>
|
10
|
+
|
11
|
+
<br/><br/>
|
12
|
+
|
13
|
+
<p><Icon icon="user" size="1x" /> <span>1x</span></p>
|
14
|
+
<p><Icon icon="user" size="2x" /> <span>2x</span></p>
|
15
|
+
<p><Icon icon="user" size="3x" /> <span>3x</span></p>
|
16
|
+
<p><Icon icon="user" size="4x" /> <span>4x</span></p>
|
17
|
+
<p><Icon icon="user" size="5x" /> <span>5x</span></p>
|
18
|
+
<p><Icon icon="user" size="6x" /> <span>6x</span></p>
|
19
|
+
<p><Icon icon="user" size="7x" /> <span>7x</span></p>
|
20
|
+
<p><Icon icon="user" size="8x" /> <span>8x</span></p>
|
21
|
+
<p><Icon icon="user" size="9x" /> <span>9x</span></p>
|
22
|
+
<p><Icon icon="user" size="10x" /> <span>10x</span></p>
|
23
|
+
</div>
|
24
|
+
)
|
25
|
+
}
|
26
|
+
|
27
|
+
export default IconSizes;
|
@@ -9,4 +9,11 @@ examples:
|
|
9
9
|
- icon_sizes: Icon Sizes
|
10
10
|
- icon_default_dark: Icon Default Dark
|
11
11
|
react:
|
12
|
-
- icon_default: Default
|
12
|
+
- icon_default: Icon Default
|
13
|
+
- icon_rotate: Icon Rotate
|
14
|
+
- icon_flip: Icon Flip
|
15
|
+
- icon_animate: Icon Animation
|
16
|
+
- icon_pull: Icon Pull
|
17
|
+
- icon_border: Icon Border
|
18
|
+
- icon_sizes: Icon Sizes
|
19
|
+
- icon_default_dark: Icon Default Dark
|
@@ -1 +1,8 @@
|
|
1
1
|
export {default as IconDefault} from './_icon_default.jsx';
|
2
|
+
export {default as IconRotate} from './_icon_rotate.jsx';
|
3
|
+
export {default as IconFlip} from './_icon_flip.jsx';
|
4
|
+
export {default as IconAnimate} from './_icon_animate.jsx';
|
5
|
+
export {default as IconPull} from './_icon_pull.jsx';
|
6
|
+
export {default as IconBorder} from './_icon_border.jsx';
|
7
|
+
export {default as IconSizes} from './_icon_sizes.jsx';
|
8
|
+
export {default as IconDefaultDark} from './_icon_default_dark.jsx';
|
@@ -2,7 +2,9 @@
|
|
2
2
|
/*eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */
|
3
3
|
|
4
4
|
import React from 'react'
|
5
|
-
|
5
|
+
|
6
|
+
import classnames from 'classnames'
|
7
|
+
import Title from '../pb_title/_title.jsx'
|
6
8
|
|
7
9
|
type PillProps = {
|
8
10
|
className?: String,
|
@@ -11,17 +13,22 @@ type PillProps = {
|
|
11
13
|
variant?: 'success' | 'warning' | 'error' | 'info' | 'neutral',
|
12
14
|
}
|
13
15
|
|
14
|
-
const Pill = ({
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
const Pill = ({
|
17
|
+
className,
|
18
|
+
id,
|
19
|
+
text,
|
20
|
+
variant='neutral'
|
21
|
+
}: PillProps) => {
|
22
|
+
const css = classnames([
|
23
|
+
`pb_pill_kit_${variant}`,
|
24
|
+
className,
|
25
|
+
])
|
21
26
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
27
|
+
return (
|
28
|
+
<div className={css}>
|
29
|
+
<Title size={4} className="pb_pill_text" text={text} />
|
30
|
+
</div>
|
31
|
+
)
|
32
|
+
}
|
26
33
|
|
27
34
|
export default Pill
|
@@ -22,9 +22,7 @@ module Playbook
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def display_text
|
25
|
-
pb_text = Playbook::
|
26
|
-
text
|
27
|
-
end
|
25
|
+
pb_text = Playbook::PbTitle::Title.new(size: 4, text: text, classname: "pb_pill_text")
|
28
26
|
ApplicationController.renderer.render(partial: pb_text, as: :object)
|
29
27
|
end
|
30
28
|
|