playbook_ui 4.17.0.pre.alpha1 → 4.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -6
- data/app/pb_kits/playbook/_playbook.scss +3 -0
- data/app/pb_kits/playbook/data/menu.yml +1 -0
- data/app/pb_kits/playbook/index.js +1 -4
- data/app/pb_kits/playbook/packs/examples.js +2 -0
- data/app/pb_kits/playbook/packs/site_styles/docs/_markdown.scss +1 -1
- data/app/pb_kits/playbook/pb_avatar/_avatar.jsx +24 -15
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_status.jsx +45 -0
- data/app/pb_kits/playbook/pb_avatar/docs/example.yml +6 -5
- data/app/pb_kits/playbook/pb_avatar/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.html.erb +32 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +78 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.scss +63 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.rb +44 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.html.erb +15 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.jsx +19 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.html.erb +8 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.jsx +13 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_on_click.jsx +15 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_onclick.html.erb +14 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.html.erb +27 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.jsx +29 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_tooltip.html.erb +11 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/example.yml +16 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/index.js +4 -0
- data/app/pb_kits/playbook/pb_badge/_badge.jsx +20 -14
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +3 -2
- data/app/pb_kits/playbook/pb_body/_body.jsx +2 -1
- data/app/pb_kits/playbook/pb_body/docs/_body_light.jsx +4 -0
- data/app/pb_kits/playbook/pb_button/_button.jsx +2 -1
- data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +6 -0
- data/app/pb_kits/playbook/pb_caption/_caption.jsx +19 -17
- data/app/pb_kits/playbook/pb_card/_card.html.erb +1 -1
- data/app/pb_kits/playbook/pb_card/_card.jsx +35 -38
- data/app/pb_kits/playbook/pb_card/_card.scss +0 -10
- data/app/pb_kits/playbook/pb_card/card.rb +9 -3
- data/app/pb_kits/playbook/pb_card/card_body.rb +1 -5
- data/app/pb_kits/playbook/pb_card/card_header.rb +0 -3
- data/app/pb_kits/playbook/pb_card/docs/_card_light.html.erb +2 -1
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +17 -18
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +4 -1
- data/app/pb_kits/playbook/pb_contact/_contact.html.erb +16 -3
- data/app/pb_kits/playbook/pb_contact/_contact.jsx +58 -34
- data/app/pb_kits/playbook/pb_contact/docs/_contact_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_contact/docs/_contact_default.jsx +1 -0
- data/app/pb_kits/playbook/pb_currency/_currency.html.erb +1 -0
- data/app/pb_kits/playbook/pb_currency/_currency.jsx +37 -21
- data/app/pb_kits/playbook/pb_currency/docs/_currency_dark.html.erb +3 -3
- data/app/pb_kits/playbook/pb_currency/docs/_currency_dark.jsx +2 -3
- data/app/pb_kits/playbook/pb_currency/docs/_currency_large.jsx +2 -3
- data/app/pb_kits/playbook/pb_currency/docs/_currency_medium.jsx +2 -2
- data/app/pb_kits/playbook/pb_currency/docs/_currency_small.html.erb +1 -1
- data/app/pb_kits/playbook/pb_currency/docs/_currency_small.jsx +5 -2
- data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +2 -2
- data/app/pb_kits/playbook/pb_date/_date.jsx +39 -15
- data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +3 -1
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.jsx +43 -37
- data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_default.jsx +2 -2
- data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.jsx +6 -16
- data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.jsx +21 -18
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.jsx +30 -33
- data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.jsx +10 -15
- data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx +8 -8
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.jsx +13 -23
- data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.jsx +16 -14
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.jsx +13 -12
- data/app/pb_kits/playbook/pb_flex/_flex.jsx +35 -20
- data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +6 -9
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +14 -19
- data/app/pb_kits/playbook/pb_hashtag/_hashtag.jsx +26 -22
- data/app/pb_kits/playbook/pb_highlight/_highlight.jsx +13 -12
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.jsx +85 -80
- data/app/pb_kits/playbook/pb_icon/_icon.jsx +54 -33
- data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.jsx +13 -9
- data/app/pb_kits/playbook/pb_icon_value/_icon_value.jsx +16 -20
- data/app/pb_kits/playbook/pb_image/_image.jsx +12 -10
- data/app/pb_kits/playbook/pb_label_pill/_label_pill.jsx +15 -25
- data/app/pb_kits/playbook/pb_label_value/_label_value.jsx +10 -17
- data/app/pb_kits/playbook/pb_layout/_layout.jsx +49 -45
- data/app/pb_kits/playbook/pb_layout/_layout.scss +76 -57
- data/app/pb_kits/playbook/pb_layout/docs/_layout_collection.html.erb +54 -0
- data/app/pb_kits/playbook/pb_layout/docs/_layout_collection.jsx +27 -0
- data/app/pb_kits/playbook/pb_layout/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_layout/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_layout/layout.rb +10 -2
- data/app/pb_kits/playbook/pb_legend/_legend.jsx +17 -15
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +3 -2
- data/app/pb_kits/playbook/pb_list/_list.jsx +24 -21
- data/app/pb_kits/playbook/pb_list/docs/_description.md +7 -1
- data/app/pb_kits/playbook/pb_list/docs/_list_layout_left.html.erb +8 -0
- data/app/pb_kits/playbook/pb_list/docs/_list_layout_right.html.erb +8 -0
- data/app/pb_kits/playbook/pb_list/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.jsx +21 -19
- data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +4 -11
- data/app/pb_kits/playbook/pb_message/_message.jsx +15 -11
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.jsx +10 -10
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.jsx +7 -19
- data/app/pb_kits/playbook/pb_nav/_nav.jsx +17 -14
- data/app/pb_kits/playbook/pb_online_status/_online_status.jsx +5 -13
- data/app/pb_kits/playbook/pb_person/_person.jsx +5 -11
- data/app/pb_kits/playbook/pb_person_contact/_person_contact.jsx +20 -20
- data/app/pb_kits/playbook/pb_pill/_pill.jsx +5 -10
- data/app/pb_kits/playbook/pb_popover/_popover.jsx +52 -41
- data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx +16 -12
- data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +15 -12
- data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +17 -10
- data/app/pb_kits/playbook/pb_radio/_radio.jsx +3 -1
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.jsx +19 -13
- data/app/pb_kits/playbook/pb_select/_select.jsx +4 -2
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.jsx +12 -7
- data/app/pb_kits/playbook/pb_stat_change/_stat_change.jsx +14 -13
- data/app/pb_kits/playbook/pb_stat_value/_stat_value.jsx +2 -1
- data/app/pb_kits/playbook/pb_table/_table.jsx +29 -28
- data/app/pb_kits/playbook/pb_table/_table.scss +1 -1
- data/app/pb_kits/playbook/pb_table/_table_row.jsx +6 -7
- data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.html.erb +52 -8
- data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.jsx +52 -8
- data/app/pb_kits/playbook/pb_table/docs/_table_side_highlight.md +3 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +3 -5
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +2 -1
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.jsx +38 -18
- data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.jsx +12 -11
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.jsx +7 -14
- data/app/pb_kits/playbook/pb_title/_title.jsx +12 -13
- data/app/pb_kits/playbook/pb_title/docs/_title_light.html.erb +1 -1
- data/app/pb_kits/playbook/pb_title_count/_title_count.jsx +49 -28
- data/app/pb_kits/playbook/pb_title_count/docs/_title_count_align.jsx +31 -0
- data/app/pb_kits/playbook/pb_title_count/docs/_title_count_default.jsx +13 -2
- data/app/pb_kits/playbook/pb_title_count/docs/example.yml +4 -5
- data/app/pb_kits/playbook/pb_title_count/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_title_detail/_title_detail.jsx +7 -18
- data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +9 -11
- data/app/pb_kits/playbook/pb_user/_user.jsx +37 -37
- data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +7 -7
- data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.jsx +32 -30
- data/app/pb_kits/playbook/props.rb +48 -0
- data/app/pb_kits/playbook/tokens/_spacing.scss +1 -0
- data/app/pb_kits/playbook/utilities/_spacing.scss +42 -0
- data/app/pb_kits/playbook/utilities/spacing.js +33 -0
- data/app/views/playbook/samples/dashboards/index.html.erb +3 -1
- data/lib/playbook/version.rb +1 -1
- data/lib/tasks/pb_release.rake +0 -2
- metadata +28 -6
@@ -0,0 +1,19 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { AvatarActionButton } from '../../'
|
3
|
+
|
4
|
+
const AvatarActionButtonActions = () => (
|
5
|
+
<div className="pb--doc-demo-row">
|
6
|
+
<AvatarActionButton
|
7
|
+
action="add"
|
8
|
+
imageUrl="https://randomuser.me/api/portraits/women/8.jpg"
|
9
|
+
name="Sophia Carden"
|
10
|
+
/>
|
11
|
+
<AvatarActionButton
|
12
|
+
action="remove"
|
13
|
+
imageUrl="https://randomuser.me/api/portraits/women/8.jpg"
|
14
|
+
name="Sophia Carden"
|
15
|
+
/>
|
16
|
+
</div>
|
17
|
+
)
|
18
|
+
|
19
|
+
export default AvatarActionButtonActions
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { AvatarActionButton } from '../../'
|
3
|
+
|
4
|
+
const AvatarActionButtonDefault = () => (
|
5
|
+
<div className="pb--doc-demo-row">
|
6
|
+
<AvatarActionButton
|
7
|
+
imageUrl="https://randomuser.me/api/portraits/women/8.jpg"
|
8
|
+
name="Sophia Carden"
|
9
|
+
/>
|
10
|
+
</div>
|
11
|
+
)
|
12
|
+
|
13
|
+
export default AvatarActionButtonDefault
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { AvatarActionButton } from '../../'
|
3
|
+
|
4
|
+
const AvatarActionButtonOnClick = () => (
|
5
|
+
<div className="pb--doc-demo-row">
|
6
|
+
<AvatarActionButton
|
7
|
+
imageUrl="https://randomuser.me/api/portraits/women/8.jpg"
|
8
|
+
linkUrl="https://www.google.com"
|
9
|
+
name="Sophia Carden"
|
10
|
+
onClick={() => alert('clicked!')}
|
11
|
+
/>
|
12
|
+
</div>
|
13
|
+
)
|
14
|
+
|
15
|
+
export default AvatarActionButtonOnClick
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="pb--doc-demo-row">
|
2
|
+
|
3
|
+
<%= pb_rails("avatar_action_button", props: {
|
4
|
+
name: "Sophia Carden",
|
5
|
+
id: "clickable",
|
6
|
+
link_url: "http://www.google.com",
|
7
|
+
image_url: "https://randomuser.me/api/portraits/women/8.jpg",
|
8
|
+
}) %>
|
9
|
+
|
10
|
+
<%= javascript_tag do %>
|
11
|
+
document.querySelector('#clickable').addEventListener('click', () => alert('clickable clicked!'))
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
</div>
|
data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.html.erb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
<div class="pb--doc-demo-row">
|
2
|
+
|
3
|
+
<%= pb_rails("avatar_action_button", props: {
|
4
|
+
name: "Sophia Carden",
|
5
|
+
image_url: "https://randomuser.me/api/portraits/women/8.jpg",
|
6
|
+
placement: "bottom_left"
|
7
|
+
}) %>
|
8
|
+
|
9
|
+
<%= pb_rails("avatar_action_button", props: {
|
10
|
+
name: "Sophia Carden",
|
11
|
+
image_url: "https://randomuser.me/api/portraits/women/8.jpg",
|
12
|
+
placement: "bottom_right"
|
13
|
+
}) %>
|
14
|
+
|
15
|
+
<%= pb_rails("avatar_action_button", props: {
|
16
|
+
name: "Sophia Carden",
|
17
|
+
image_url: "https://randomuser.me/api/portraits/women/8.jpg",
|
18
|
+
placement: "top_left"
|
19
|
+
}) %>
|
20
|
+
|
21
|
+
<%= pb_rails("avatar_action_button", props: {
|
22
|
+
name: "Sophia Carden",
|
23
|
+
image_url: "https://randomuser.me/api/portraits/women/8.jpg",
|
24
|
+
placement: "top_right"
|
25
|
+
}) %>
|
26
|
+
|
27
|
+
</div>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { AvatarActionButton } from '../../'
|
3
|
+
|
4
|
+
const AvatarActionButtonPlacement = () => (
|
5
|
+
<div className="pb--doc-demo-row">
|
6
|
+
<AvatarActionButton
|
7
|
+
imageUrl="https://randomuser.me/api/portraits/women/8.jpg"
|
8
|
+
name="Sophia Carden"
|
9
|
+
placement="bottom_left"
|
10
|
+
/>
|
11
|
+
<AvatarActionButton
|
12
|
+
imageUrl="https://randomuser.me/api/portraits/women/8.jpg"
|
13
|
+
name="Sophia Carden"
|
14
|
+
placement="bottom_right"
|
15
|
+
/>
|
16
|
+
<AvatarActionButton
|
17
|
+
imageUrl="https://randomuser.me/api/portraits/women/8.jpg"
|
18
|
+
name="Sophia Carden"
|
19
|
+
placement="top_left"
|
20
|
+
/>
|
21
|
+
<AvatarActionButton
|
22
|
+
imageUrl="https://randomuser.me/api/portraits/women/8.jpg"
|
23
|
+
name="Sophia Carden"
|
24
|
+
placement="top_right"
|
25
|
+
/>
|
26
|
+
</div>
|
27
|
+
)
|
28
|
+
|
29
|
+
export default AvatarActionButtonPlacement
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="pb--doc-demo-row">
|
2
|
+
|
3
|
+
<%= pb_rails("avatar_action_button", props: {
|
4
|
+
name: "Sophia Carden",
|
5
|
+
link_url: "http://www.google.com",
|
6
|
+
image_url: "https://randomuser.me/api/portraits/women/8.jpg",
|
7
|
+
tooltip_text: "Tooltip Text",
|
8
|
+
tooltip_id: "avatar_1",
|
9
|
+
}) %>
|
10
|
+
|
11
|
+
</div>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
examples:
|
2
|
+
|
3
|
+
rails:
|
4
|
+
- avatar_action_button_default: Default
|
5
|
+
- avatar_action_button_placement: Placement
|
6
|
+
- avatar_action_button_actions: Actions
|
7
|
+
- avatar_action_button_tooltip: Tooltip
|
8
|
+
- avatar_action_button_onclick: On Click
|
9
|
+
|
10
|
+
|
11
|
+
react:
|
12
|
+
- avatar_action_button_default: Default
|
13
|
+
- avatar_action_button_placement: Placement
|
14
|
+
- avatar_action_button_actions: Actions
|
15
|
+
- avatar_action_button_on_click: On Click
|
16
|
+
|
@@ -0,0 +1,4 @@
|
|
1
|
+
export { default as AvatarActionButtonDefault } from './_avatar_action_button_default.jsx'
|
2
|
+
export { default as AvatarActionButtonPlacement } from './_avatar_action_button_placement.jsx'
|
3
|
+
export { default as AvatarActionButtonActions } from './_avatar_action_button_actions.jsx'
|
4
|
+
export { default as AvatarActionButtonOnClick } from './_avatar_action_button_on_click.jsx'
|
@@ -3,27 +3,33 @@
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { buildCss } from '../utilities/props'
|
6
|
+
import { spacing } from '../utilities/spacing.js'
|
6
7
|
|
7
8
|
type BadgeProps = {
|
8
9
|
className?: String,
|
9
10
|
dark?: Boolean,
|
10
11
|
id?: String,
|
11
12
|
text?: String,
|
12
|
-
variant?:
|
13
|
-
rounded?: Boolean
|
13
|
+
variant?: "success" | "warning" | "error" | "info" | "neutral",
|
14
|
+
rounded?: Boolean,
|
14
15
|
}
|
15
|
-
const Badge = ({
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
const Badge = (props: BadgeProps) => {
|
17
|
+
const {
|
18
|
+
className,
|
19
|
+
dark = false,
|
20
|
+
id,
|
21
|
+
text,
|
22
|
+
variant = 'neutral',
|
23
|
+
rounded = false,
|
24
|
+
} = props
|
25
|
+
const css = classnames(
|
26
|
+
className,
|
27
|
+
buildCss('pb_badge_kit', variant, {
|
28
|
+
rounded: rounded,
|
29
|
+
dark: dark,
|
30
|
+
}),
|
31
|
+
spacing(props)
|
32
|
+
)
|
27
33
|
|
28
34
|
return (
|
29
35
|
<div
|
@@ -1,8 +1,9 @@
|
|
1
1
|
/* @flow */
|
2
2
|
|
3
3
|
import React from 'react'
|
4
|
-
|
4
|
+
import classnames from 'classnames'
|
5
5
|
import { pbChart } from '../'
|
6
|
+
import { spacing } from '../utilities/spacing.js'
|
6
7
|
|
7
8
|
type BarGraphProps = {
|
8
9
|
axisTitle: String,
|
@@ -69,7 +70,7 @@ export default class BarGraph extends React.Component
|
|
69
70
|
|
70
71
|
return (
|
71
72
|
<div
|
72
|
-
className={className}
|
73
|
+
className={classnames(className, spacing(this.props))}
|
73
74
|
id={id}
|
74
75
|
/>
|
75
76
|
)
|
@@ -3,6 +3,7 @@
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { Highlight } from '../'
|
6
|
+
import { spacing } from '../utilities/spacing.js'
|
6
7
|
|
7
8
|
type BodyProps = {
|
8
9
|
className?: String,
|
@@ -44,7 +45,7 @@ const Body = (props: BodyProps) => {
|
|
44
45
|
const Tag = `${tag}`
|
45
46
|
|
46
47
|
return (
|
47
|
-
<Tag className={classnames(bodyCSS(props), className)}>
|
48
|
+
<Tag className={classnames(bodyCSS(props), className, spacing(props))}>
|
48
49
|
<If condition={highlighting}>
|
49
50
|
<Highlight highlightedText={highlightedText}>{text || children}</Highlight>
|
50
51
|
<Else />
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
|
+
import { spacing } from '../utilities/spacing.js'
|
5
6
|
|
6
7
|
import Icon from '../pb_icon/_icon.jsx'
|
7
8
|
|
@@ -83,7 +84,7 @@ const Button = (props: ButtonPropTypes) => {
|
|
83
84
|
} = props
|
84
85
|
|
85
86
|
const buttonAria = buttonAriaProps(props)
|
86
|
-
const css = classnames(buttonClassName(props), className)
|
87
|
+
const css = classnames(buttonClassName(props), className, spacing(props))
|
87
88
|
const loadingIcon = (
|
88
89
|
<div className="loading-icon">
|
89
90
|
<Icon
|
@@ -22,7 +22,13 @@ const ButtonDefault = () => (
|
|
22
22
|
onClick={() => alert('button clicked!')}
|
23
23
|
text="Button Disabled"
|
24
24
|
/>
|
25
|
+
<Button
|
26
|
+
disabled
|
27
|
+
onClick={() => alert('button clicked!')}
|
28
|
+
text="Button Disabled"
|
29
|
+
/>
|
25
30
|
</div>
|
31
|
+
|
26
32
|
)
|
27
33
|
|
28
34
|
export default ButtonDefault
|
@@ -3,35 +3,37 @@
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { buildCss } from '../utilities/props'
|
6
|
+
import { spacing } from '../utilities/spacing.js'
|
6
7
|
|
7
8
|
type CaptionProps = {
|
8
9
|
className?: String,
|
9
10
|
children: Array<React.ReactNode> | React.ReactNode,
|
10
11
|
dark?: Boolean,
|
11
|
-
size?:
|
12
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl",
|
12
13
|
tag: String,
|
13
14
|
text: String,
|
14
15
|
}
|
15
16
|
|
16
|
-
const Caption = ({
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
const Caption = (props: CaptionProps) => {
|
18
|
+
const {
|
19
|
+
className,
|
20
|
+
children,
|
21
|
+
dark = false,
|
22
|
+
size = 'md',
|
23
|
+
tag = 'div',
|
24
|
+
text,
|
25
|
+
} = props
|
24
26
|
const Tag = `${tag}`
|
25
27
|
|
26
|
-
const css = classnames(
|
27
|
-
'
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
{text || children}
|
33
|
-
</Tag>
|
28
|
+
const css = classnames(
|
29
|
+
buildCss('pb_caption_kit', size, {
|
30
|
+
dark: dark,
|
31
|
+
}),
|
32
|
+
className,
|
33
|
+
spacing(props)
|
34
34
|
)
|
35
|
+
|
36
|
+
return <Tag className={css}>{text || children}</Tag>
|
35
37
|
}
|
36
38
|
|
37
39
|
export default Caption
|
@@ -5,6 +5,6 @@
|
|
5
5
|
aria: object.aria,
|
6
6
|
dark: object.dark) do %>
|
7
7
|
<% if object.children %>
|
8
|
-
<%= pb_rails("card/card_body", props: { padding: object.
|
8
|
+
<%= pb_rails("card/card_body", props: { padding: object.body_padding, children: object.children }) %>
|
9
9
|
<% end %>
|
10
10
|
<% end %>
|
@@ -1,99 +1,96 @@
|
|
1
1
|
/* @flow */
|
2
2
|
|
3
3
|
import React from 'react'
|
4
|
+
import { get } from 'lodash'
|
4
5
|
import classnames from 'classnames'
|
5
6
|
import { buildCss } from '../utilities/props'
|
7
|
+
import { spacing } from '../utilities/spacing.js'
|
6
8
|
|
7
9
|
type CardPropTypes = {
|
8
10
|
children: Array<React.ReactNode> | React.ReactNode,
|
9
11
|
className?: String,
|
10
12
|
highlight?: {
|
11
|
-
position?:
|
12
|
-
color?: String
|
13
|
+
position?: "side" | "top",
|
14
|
+
color?: String,
|
13
15
|
},
|
14
|
-
padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
|
15
16
|
selected?: Boolean,
|
16
|
-
shadow?:
|
17
|
+
shadow?: "none" | "deep" | "deeper" | "deepest",
|
17
18
|
dark?: Boolean,
|
18
19
|
}
|
19
20
|
|
20
21
|
type CardHeaderProps = {
|
21
22
|
children: Array<React.ReactNode> | React.ReactNode,
|
22
23
|
className?: String,
|
23
|
-
padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
|
24
24
|
categoryColor?: Number,
|
25
25
|
}
|
26
26
|
|
27
27
|
type CardBodyProps = {
|
28
28
|
children: Array<React.ReactNode> | React.ReactNode | String,
|
29
29
|
className?: String,
|
30
|
-
padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
|
31
30
|
}
|
32
31
|
|
33
32
|
// Header component
|
34
|
-
const Header = ({
|
35
|
-
children,
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
}: CardHeaderProps) => {
|
40
|
-
const headerCSS = buildCss('pb_card_header_kit', padding, `category_${categoryColor}`)
|
33
|
+
const Header = (props: CardHeaderProps) => {
|
34
|
+
const { children, className, categoryColor = 1 } = props
|
35
|
+
const headerCSS = buildCss('pb_card_header_kit', `category_${categoryColor}`)
|
36
|
+
|
37
|
+
const headerSpacing = spacing(props) ? spacing(props) : 'p_sm'
|
41
38
|
return (
|
42
|
-
<div className={classnames(headerCSS, className)}>
|
39
|
+
<div className={classnames(headerCSS, className, headerSpacing)}>
|
43
40
|
{children}
|
44
41
|
</div>
|
45
42
|
)
|
46
43
|
}
|
47
44
|
|
48
45
|
// Body component
|
49
|
-
const Body = ({
|
50
|
-
children,
|
51
|
-
|
52
|
-
|
53
|
-
}: CardBodyProps) => {
|
54
|
-
const bodyCSS = buildCss('pb_card_body_kit', padding)
|
46
|
+
const Body = (props: CardBodyProps) => {
|
47
|
+
const { children, className } = props
|
48
|
+
const bodyCSS = buildCss('pb_card_body_kit')
|
49
|
+
const bodySpacing = spacing(props) ? spacing(props) : 'p_md'
|
55
50
|
return (
|
56
|
-
<div className={classnames(bodyCSS, className)}>
|
51
|
+
<div className={classnames(bodyCSS, className, bodySpacing)}>
|
57
52
|
{children}
|
58
53
|
</div>
|
59
54
|
)
|
60
55
|
}
|
61
56
|
|
62
|
-
const Card = ({
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
}
|
71
|
-
const bodyCSS = buildCss('pb_card_body_kit'
|
57
|
+
const Card = (props: CardPropTypes) => {
|
58
|
+
const {
|
59
|
+
children,
|
60
|
+
className,
|
61
|
+
dark = false,
|
62
|
+
highlight = {},
|
63
|
+
selected = false,
|
64
|
+
shadow = 'none',
|
65
|
+
} = props
|
66
|
+
const bodyCSS = buildCss('pb_card_body_kit')
|
72
67
|
const cardCss = buildCss('pb_card_kit', `shadow_${shadow}`, {
|
73
|
-
|
68
|
+
dark: dark,
|
74
69
|
selected,
|
75
70
|
deselected: !selected,
|
76
71
|
[`highlight_${highlight.position}`]: highlight.position,
|
77
72
|
[`highlight_${highlight.color}`]: highlight.color,
|
78
73
|
})
|
74
|
+
const cardSpacing = spacing(props) ? spacing(props) : 'p_md'
|
79
75
|
|
80
76
|
// coerce to array
|
81
|
-
const cardChildren =
|
77
|
+
const cardChildren =
|
78
|
+
typeof children === 'object' && children.length ? children : [children]
|
82
79
|
|
83
80
|
const subComponentTags = (tagName) => {
|
84
|
-
return cardChildren.filter((c) =>
|
85
|
-
|
86
|
-
|
81
|
+
return cardChildren.filter((c) => (
|
82
|
+
get(c, 'type.displayName') === tagName
|
83
|
+
)).map((child, i) => {
|
87
84
|
return React.cloneElement(child, { key: `${tagName.toLowerCase()}-${i}` })
|
88
85
|
})
|
89
86
|
}
|
90
87
|
|
91
|
-
const nonHeaderChildren = cardChildren.filter((child) =>
|
88
|
+
const nonHeaderChildren = cardChildren.filter((child) => (get(child, 'type.displayName') !== 'Header'))
|
92
89
|
|
93
90
|
return (
|
94
91
|
<div className={classnames(cardCss, className)}>
|
95
92
|
{subComponentTags('Header')}
|
96
|
-
<div className={bodyCSS}>
|
93
|
+
<div className={classnames(bodyCSS, cardSpacing)}>
|
97
94
|
{nonHeaderChildren}
|
98
95
|
</div>
|
99
96
|
</div>
|