playbook_ui 10.21.0.pre.alpha.na1 → 10.21.1.pre.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_avatar/{_avatar.jsx → _avatar.tsx} +12 -13
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.jsx +1 -1
- data/app/pb_kits/playbook/pb_background/_background.jsx +8 -3
- data/app/pb_kits/playbook/pb_background/_background.scss +24 -8
- data/app/pb_kits/playbook/pb_background/background.rb +6 -6
- data/app/pb_kits/playbook/pb_background/docs/_background_image.html.erb +50 -2
- data/app/pb_kits/playbook/pb_background/docs/_background_image.jsx +71 -28
- data/app/pb_kits/playbook/pb_background/docs/_background_image.md +1 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +5 -1
- data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +1 -0
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumb_item.jsx +1 -1
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.jsx +1 -1
- data/app/pb_kits/playbook/pb_button/_button.jsx +5 -4
- data/app/pb_kits/playbook/pb_button/_button.scss +18 -1
- data/app/pb_kits/playbook/pb_button/button.rb +11 -3
- data/app/pb_kits/playbook/pb_button/button.test.js +13 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size.html.erb +3 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size.jsx +26 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_size.md +1 -0
- data/app/pb_kits/playbook/pb_button/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_button/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.jsx +1 -1
- data/app/pb_kits/playbook/pb_caption/_caption.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/_card.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/card.html.erb +1 -1
- data/app/pb_kits/playbook/pb_card/card.rb +88 -0
- data/app/pb_kits/playbook/pb_card/card_body.rb +1 -1
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +3 -0
- data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +1 -0
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.jsx +1 -1
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.jsx +1 -1
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.jsx +1 -1
- data/app/pb_kits/playbook/pb_currency/_currency.jsx +24 -3
- data/app/pb_kits/playbook/pb_currency/currency.rb +12 -3
- data/app/pb_kits/playbook/pb_currency/currency.test.js +35 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.html.erb +27 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.jsx +44 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +1 -1
- data/app/pb_kits/playbook/pb_currency/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_currency/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +215 -0
- data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/_dialog.jsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_body.jsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.jsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.jsx +1 -1
- data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.jsx +1 -1
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.jsx +17 -10
- data/app/pb_kits/playbook/pb_file_upload/fileupload.test.js +40 -0
- data/app/pb_kits/playbook/pb_filter/Filter/FilterBackground.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/_flex.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/_flex_item.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/docs/_flex_align.jsx +1 -1
- data/app/pb_kits/playbook/pb_flex/flex_item.rb +2 -24
- data/app/pb_kits/playbook/pb_form_group/_form_group.jsx +1 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +2 -0
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +2 -2
- data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +3 -0
- data/app/pb_kits/playbook/pb_gauge/gauge.rb +1 -0
- data/app/pb_kits/playbook/pb_highlight/_highlight.jsx +1 -1
- data/app/pb_kits/playbook/pb_icon/_icon.jsx +1 -1
- data/app/pb_kits/playbook/pb_icon/icon.rb +1 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.jsx +1 -1
- data/app/pb_kits/playbook/pb_image/_image.scss +3 -3
- data/app/pb_kits/playbook/pb_image/{_image.jsx → _image.tsx} +11 -15
- data/app/pb_kits/playbook/pb_image/docs/{_default_image.jsx → _default_image.tsx} +1 -1
- data/app/pb_kits/playbook/pb_image/docs/index.js +4 -4
- data/app/pb_kits/playbook/pb_image/image.rb +1 -1
- data/app/pb_kits/playbook/pb_image/image.test.js +1 -1
- data/app/pb_kits/playbook/pb_label_pill/_label_pill.jsx +1 -1
- data/app/pb_kits/playbook/pb_layout/_layout.jsx +1 -1
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +5 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +1 -0
- data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +1 -0
- data/app/pb_kits/playbook/pb_list/_list.jsx +1 -1
- data/app/pb_kits/playbook/pb_list/_list_item.jsx +1 -1
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.jsx +1 -1
- data/app/pb_kits/playbook/pb_online_status/{_online_status.jsx → _online_status.tsx} +4 -6
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.jsx +2 -1
- data/app/pb_kits/playbook/pb_pill/_pill.jsx +1 -1
- data/app/pb_kits/playbook/pb_popover/_popover.jsx +3 -5
- data/app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb +7 -7
- data/app/pb_kits/playbook/pb_popover/index.js +4 -9
- data/app/pb_kits/playbook/pb_popover/popover.html.erb +1 -1
- data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.jsx +1 -1
- data/app/pb_kits/playbook/pb_progress_step/_progress_step.jsx +1 -1
- data/app/pb_kits/playbook/pb_radio/_radio.jsx +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +83 -93
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default.jsx +15 -8
- data/app/pb_kits/playbook/pb_table/_table.jsx +1 -1
- data/app/pb_kits/playbook/pb_table/_table_row.jsx +1 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.jsx +4 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +1 -1
- data/app/pb_kits/playbook/pb_text_input/text_input.test.js +14 -0
- data/app/pb_kits/playbook/pb_textarea/_textarea.jsx +1 -0
- data/app/pb_kits/playbook/pb_time/_time.jsx +1 -1
- data/app/pb_kits/playbook/pb_title/_title.jsx +1 -1
- data/app/pb_kits/playbook/pb_toggle/_toggle.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +1 -1
- data/app/pb_kits/playbook/pb_user_badge/_user_badge.jsx +1 -1
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.jsx +1 -1
- data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.jsx +1 -1
- data/app/pb_kits/playbook/plugins/pb_chart.js +8 -4
- data/app/pb_kits/playbook/utilities/_align_content.scss +29 -0
- data/app/pb_kits/playbook/utilities/_align_items.scss +35 -0
- data/app/pb_kits/playbook/utilities/_align_self.scss +29 -0
- data/app/pb_kits/playbook/utilities/_flex.scss +15 -0
- data/app/pb_kits/playbook/utilities/_flex_direction.scss +19 -0
- data/app/pb_kits/playbook/utilities/_flex_grow.scss +9 -0
- data/app/pb_kits/playbook/utilities/_flex_shrink.scss +9 -0
- data/app/pb_kits/playbook/utilities/_flex_wrap.scss +14 -0
- data/app/pb_kits/playbook/utilities/_flexbox.scss +11 -0
- data/app/pb_kits/playbook/utilities/_justify_content.scss +23 -0
- data/app/pb_kits/playbook/utilities/_justify_self.scss +19 -0
- data/app/pb_kits/playbook/utilities/_order.scss +55 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +274 -0
- data/app/pb_kits/playbook/utilities/{props.js → props.ts} +9 -7
- data/lib/playbook/align_content.rb +29 -0
- data/lib/playbook/align_items.rb +29 -0
- data/lib/playbook/align_self.rb +29 -0
- data/lib/playbook/classnames.rb +11 -0
- data/lib/playbook/flex.rb +29 -0
- data/lib/playbook/flex_direction.rb +29 -0
- data/lib/playbook/flex_grow.rb +29 -0
- data/lib/playbook/flex_shrink.rb +29 -0
- data/lib/playbook/flex_wrap.rb +29 -0
- data/lib/playbook/justify_content.rb +29 -0
- data/lib/playbook/justify_self.rb +29 -0
- data/lib/playbook/kit_base.rb +22 -0
- data/lib/playbook/order.rb +29 -0
- data/lib/playbook/version.rb +2 -2
- metadata +40 -9
- data/app/pb_kits/playbook/types.js +0 -4
- data/app/pb_kits/playbook/utilities/globalProps.js +0 -97
@@ -4,7 +4,7 @@ import React from 'react'
|
|
4
4
|
import classnames from 'classnames'
|
5
5
|
|
6
6
|
import { buildCss } from '../../utilities/props'
|
7
|
-
import { globalProps } from '../../utilities/globalProps
|
7
|
+
import { globalProps } from '../../utilities/globalProps'
|
8
8
|
|
9
9
|
import Flex from '../../pb_flex/_flex'
|
10
10
|
import SectionSeparator from '../../pb_section_separator/_section_separator'
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import React, { useContext } from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { buildAriaProps, buildCss, buildDataProps } from '../../utilities/props'
|
6
|
-
import { globalProps } from '../../utilities/globalProps
|
6
|
+
import { globalProps } from '../../utilities/globalProps'
|
7
7
|
|
8
8
|
import { CloseIcon } from '../_close_icon'
|
9
9
|
import { DialogContext } from '../_dialog_context'
|
@@ -4,7 +4,7 @@ import React, { useCallback } from 'react'
|
|
4
4
|
import { useDropzone } from 'react-dropzone'
|
5
5
|
import classnames from 'classnames'
|
6
6
|
|
7
|
-
import { buildCss, noop } from '../utilities/props'
|
7
|
+
import { buildCss, buildDataProps, noop } from '../utilities/props'
|
8
8
|
import { globalProps } from '../utilities/globalProps'
|
9
9
|
import type { Callback } from '../types'
|
10
10
|
|
@@ -14,15 +14,17 @@ import Card from '../pb_card/_card'
|
|
14
14
|
type FileUploadProps = {
|
15
15
|
accept?: array<string>,
|
16
16
|
className?: string,
|
17
|
+
data?: object,
|
17
18
|
acceptedFilesDescription?: string,
|
18
19
|
onFilesAccepted: Callback,
|
19
20
|
}
|
20
21
|
|
21
22
|
const FileUpload = (props: FileUploadProps) => {
|
22
23
|
const {
|
23
|
-
accept =
|
24
|
+
accept = null,
|
24
25
|
acceptedFilesDescription = '',
|
25
26
|
className,
|
27
|
+
data = {},
|
26
28
|
onFilesAccepted = noop,
|
27
29
|
} = props
|
28
30
|
const onDrop = useCallback((files) => {
|
@@ -34,17 +36,22 @@ const FileUpload = (props: FileUploadProps) => {
|
|
34
36
|
onDrop,
|
35
37
|
})
|
36
38
|
|
37
|
-
const acceptedFileTypes =
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
const acceptedFileTypes = () => {
|
40
|
+
return accept.map((fileType) => {
|
41
|
+
if (fileType.startsWith('image/')) {
|
42
|
+
return fileType.replace('image/', ' ')
|
43
|
+
} else {
|
44
|
+
return fileType
|
45
|
+
}
|
46
|
+
})
|
47
|
+
}
|
48
|
+
|
49
|
+
const dataProps = buildDataProps(data)
|
44
50
|
|
45
51
|
return (
|
46
52
|
<div
|
47
53
|
className={classnames(buildCss('pb_file_upload_kit'), globalProps(props), className)}
|
54
|
+
{...dataProps}
|
48
55
|
{...getRootProps()}
|
49
56
|
>
|
50
57
|
<Card>
|
@@ -53,7 +60,7 @@ const FileUpload = (props: FileUploadProps) => {
|
|
53
60
|
<If condition={isDragActive}>
|
54
61
|
<p>{'Drop the files here ...'}</p>
|
55
62
|
<Else />
|
56
|
-
<p>{`Choose a file or drag it here. The accepted file types are: ${acceptedFilesDescription || acceptedFileTypes}`}</p>
|
63
|
+
<p>{accept === null ? 'Choose a file or drag it here' : `Choose a file or drag it here. The accepted file types are: ${acceptedFilesDescription || acceptedFileTypes()}`}</p>
|
57
64
|
</If>
|
58
65
|
</Body>
|
59
66
|
</Card>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
3
|
+
|
4
|
+
import FileUpload from './_file_upload'
|
5
|
+
|
6
|
+
const testid = 'fileupload-test'
|
7
|
+
|
8
|
+
test('returns namespaced class name', () => {
|
9
|
+
render(
|
10
|
+
<FileUpload
|
11
|
+
data={{ testid: testid }}
|
12
|
+
/>
|
13
|
+
)
|
14
|
+
|
15
|
+
const kit = screen.getByTestId(testid)
|
16
|
+
expect(kit).toHaveClass('pb_file_upload_kit')
|
17
|
+
})
|
18
|
+
|
19
|
+
test('shows default drag text', () => {
|
20
|
+
render(
|
21
|
+
<FileUpload
|
22
|
+
data={{ testid: testid }}
|
23
|
+
/>
|
24
|
+
)
|
25
|
+
|
26
|
+
const kit = screen.getByTestId(testid)
|
27
|
+
expect(kit).toHaveTextContent('Choose a file or drag it here')
|
28
|
+
})
|
29
|
+
|
30
|
+
test('shows type-specific drag text', () => {
|
31
|
+
render(
|
32
|
+
<FileUpload
|
33
|
+
accept={['image/svg+xml']}
|
34
|
+
data={{ testid: testid }}
|
35
|
+
/>
|
36
|
+
)
|
37
|
+
|
38
|
+
const kit = screen.getByTestId(testid)
|
39
|
+
expect(kit).toHaveTextContent('Choose a file or drag it here. The accepted file types are: svg+xml')
|
40
|
+
})
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { buildCss, buildDataProps } from '../utilities/props'
|
6
|
-
import { globalProps } from '../utilities/globalProps
|
6
|
+
import { globalProps } from '../utilities/globalProps'
|
7
7
|
type FlexProps = {
|
8
8
|
children: array<React.ReactNode> | React.ReactNode,
|
9
9
|
className?: string,
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import React from 'react'
|
3
3
|
import classnames from 'classnames'
|
4
4
|
import { buildCss } from '../utilities/props'
|
5
|
-
import { globalProps } from '../utilities/globalProps
|
5
|
+
import { globalProps } from '../utilities/globalProps'
|
6
6
|
type FlexItemPropTypes = {
|
7
7
|
children: array<React.ReactNode> | React.ReactNode,
|
8
8
|
fixedSize: string,
|
@@ -8,17 +8,11 @@ module Playbook
|
|
8
8
|
default: false
|
9
9
|
prop :shrink, type: Playbook::Props::Boolean,
|
10
10
|
default: false
|
11
|
-
|
12
|
-
values: %w[0 1 2 3 4 5 6 7 8 9 10 11 12 none],
|
13
|
-
default: "none"
|
11
|
+
|
14
12
|
prop :overflow, type: Playbook::Props::Enum,
|
15
13
|
values: %w[auto hidden inherit initial scroll visible] + [nil],
|
16
14
|
default: nil
|
17
15
|
|
18
|
-
prop :order, type: Playbook::Props::Enum,
|
19
|
-
values: %w[1 2 3 4 5 6 7 8 9 10 11 12 first none],
|
20
|
-
default: "none"
|
21
|
-
|
22
16
|
prop :align_self, type: Playbook::Props::Enum,
|
23
17
|
values: %w[start center end stretch] + [nil],
|
24
18
|
default: nil
|
@@ -27,7 +21,7 @@ module Playbook
|
|
27
21
|
default: false
|
28
22
|
|
29
23
|
def classname
|
30
|
-
generate_classname("pb_flex_item_kit", fixed_size_class, grow_class, shrink_class,
|
24
|
+
generate_classname("pb_flex_item_kit", fixed_size_class, grow_class, shrink_class, display_flex_class) + overflow_class + align_self_class
|
31
25
|
end
|
32
26
|
|
33
27
|
def style_value
|
@@ -59,22 +53,6 @@ module Playbook
|
|
59
53
|
def shrink_class
|
60
54
|
shrink ? "shrink" : nil
|
61
55
|
end
|
62
|
-
|
63
|
-
def flex_class
|
64
|
-
if flex == "none"
|
65
|
-
nil
|
66
|
-
else
|
67
|
-
"flex_#{flex}"
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def order_class
|
72
|
-
if order == "none"
|
73
|
-
""
|
74
|
-
else
|
75
|
-
"order_#{order}"
|
76
|
-
end
|
77
|
-
end
|
78
56
|
end
|
79
57
|
end
|
80
58
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
6
|
-
import { globalProps } from '../utilities/globalProps
|
6
|
+
import { globalProps } from '../utilities/globalProps'
|
7
7
|
|
8
8
|
type FormGroupProps = {
|
9
9
|
aria?: object,
|
@@ -41,6 +41,7 @@
|
|
41
41
|
border-bottom-right-radius: 0;
|
42
42
|
border-top-right-radius: 0;
|
43
43
|
min-height: 45px;
|
44
|
+
margin-bottom: 16px;
|
44
45
|
}
|
45
46
|
|
46
47
|
& > [class^=pb_button_kit]:not(:first-child) {
|
@@ -48,6 +49,7 @@
|
|
48
49
|
border-top-left-radius: 0;
|
49
50
|
border-left-width: 0;
|
50
51
|
min-height: 45px;
|
52
|
+
margin-bottom: 16px;
|
51
53
|
}
|
52
54
|
|
53
55
|
& > [class^=pb_date_picker_kit]:not(:last-child) {
|
@@ -3,8 +3,8 @@ import React from 'react'
|
|
3
3
|
import classnames from 'classnames'
|
4
4
|
import Title from '../pb_title/_title.jsx'
|
5
5
|
import Icon from '../pb_icon/_icon.jsx'
|
6
|
-
import Avatar from '../pb_avatar/_avatar
|
7
|
-
import { globalProps } from '../utilities/globalProps
|
6
|
+
import Avatar from '../pb_avatar/_avatar'
|
7
|
+
import { globalProps } from '../utilities/globalProps'
|
8
8
|
|
9
9
|
type FormPillProps = {
|
10
10
|
className?: string,
|
@@ -12,6 +12,7 @@ type GaugeProps = {
|
|
12
12
|
aria: Object,
|
13
13
|
className?: string,
|
14
14
|
chartData?: array,
|
15
|
+
dark?: Boolean,
|
15
16
|
data?: Object,
|
16
17
|
disableAnimation: boolean,
|
17
18
|
fullCircle: boolean,
|
@@ -33,6 +34,7 @@ const Gauge = (props: GaugeProps) => {
|
|
33
34
|
aria = {},
|
34
35
|
className,
|
35
36
|
chartData = [{ name: 'Name', value: 0 }],
|
37
|
+
dark = false,
|
36
38
|
data = {},
|
37
39
|
disableAnimation = false,
|
38
40
|
fullCircle = false,
|
@@ -67,6 +69,7 @@ const Gauge = (props: GaugeProps) => {
|
|
67
69
|
id: id,
|
68
70
|
chartData: formattedChartData,
|
69
71
|
circumference: fullCircle ? [0, 360] : [-100, 100],
|
72
|
+
dark,
|
70
73
|
disableAnimation: disableAnimation,
|
71
74
|
height: height,
|
72
75
|
min: min,
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import Highlighter from 'react-highlight-words'
|
4
4
|
import React from 'react'
|
5
5
|
import classnames from 'classnames'
|
6
|
-
import { globalProps } from '../utilities/globalProps
|
6
|
+
import { globalProps } from '../utilities/globalProps'
|
7
7
|
|
8
8
|
type HighlightProps = {
|
9
9
|
className?: string,
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { buildAriaProps, buildDataProps } from '../utilities/props'
|
6
|
-
import { globalProps } from '../utilities/globalProps
|
6
|
+
import { globalProps } from '../utilities/globalProps'
|
7
7
|
|
8
8
|
type IconProps = {
|
9
9
|
aria?: object,
|
@@ -73,7 +73,7 @@ module Playbook
|
|
73
73
|
|
74
74
|
def render_svg(path)
|
75
75
|
if File.extname(path) == ".svg"
|
76
|
-
doc = Nokogiri::XML(open(path)) # rubocop:disable Security/Open
|
76
|
+
doc = Nokogiri::XML(URI.open(path)) # rubocop:disable Security/Open
|
77
77
|
svg = doc.at_css "svg"
|
78
78
|
svg["class"] = "pb_custom_icon " + object.custom_icon_classname
|
79
79
|
raw doc
|
@@ -4,7 +4,7 @@ import React from 'react'
|
|
4
4
|
import classnames from 'classnames'
|
5
5
|
|
6
6
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
7
|
-
import { globalProps } from '../utilities/globalProps
|
7
|
+
import { globalProps } from '../utilities/globalProps'
|
8
8
|
|
9
9
|
import Body from '../pb_body/_body'
|
10
10
|
import Caption from '../pb_caption/_caption'
|
@@ -14,7 +14,7 @@ $image-sizes: (
|
|
14
14
|
object-fit: cover;
|
15
15
|
|
16
16
|
@each $name, $size in $image-sizes {
|
17
|
-
&[class*=
|
17
|
+
&[class*=size_#{$name}] {
|
18
18
|
width: $size;
|
19
19
|
height: $size;
|
20
20
|
object-fit: cover;
|
@@ -35,7 +35,7 @@ $image-sizes: (
|
|
35
35
|
transition: opacity 300ms ease-in;
|
36
36
|
}
|
37
37
|
}
|
38
|
-
|
38
|
+
|
39
39
|
&.blur {
|
40
40
|
filter: blur(5px);
|
41
41
|
&.lazyloaded {
|
@@ -44,7 +44,7 @@ $image-sizes: (
|
|
44
44
|
transition: filter 300ms ease-in;
|
45
45
|
}
|
46
46
|
}
|
47
|
-
|
47
|
+
|
48
48
|
&.scale {
|
49
49
|
opacity: 0;
|
50
50
|
transform: scale(0.9);
|
@@ -1,24 +1,22 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
import classnames from 'classnames'
|
5
|
-
import { globalProps } from '../utilities/globalProps
|
3
|
+
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
6
4
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
7
5
|
|
8
|
-
type
|
6
|
+
type ImageType = {
|
9
7
|
alt?: string,
|
10
|
-
aria?:
|
8
|
+
aria?: {[key: string]: string},
|
11
9
|
className?: string,
|
12
|
-
data?:
|
10
|
+
data?: {[key: string]: string},
|
13
11
|
id?: string,
|
14
|
-
onError?: () =>
|
15
|
-
size
|
12
|
+
onError?: () => void,
|
13
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl",
|
16
14
|
rounded?: boolean,
|
17
|
-
transition
|
18
|
-
url
|
19
|
-
}
|
15
|
+
transition?: "blur" | "fade" | "scale",
|
16
|
+
url?: string,
|
17
|
+
} & GlobalProps
|
20
18
|
|
21
|
-
const Image = (props:
|
19
|
+
const Image = (props: ImageType) => {
|
22
20
|
const {
|
23
21
|
alt = '',
|
24
22
|
aria = {},
|
@@ -34,7 +32,7 @@ const Image = (props: ImageProps) => {
|
|
34
32
|
|
35
33
|
const ariaProps = buildAriaProps(aria)
|
36
34
|
const classes = classnames(
|
37
|
-
buildCss('pb_image_kit', size),
|
35
|
+
buildCss('pb_image_kit', size ? `size_${size}` : null),
|
38
36
|
'lazyload',
|
39
37
|
transition,
|
40
38
|
{ rounded },
|
@@ -52,9 +50,7 @@ const Image = (props: ImageProps) => {
|
|
52
50
|
data-src={url}
|
53
51
|
id={id}
|
54
52
|
onError={onError}
|
55
|
-
rounded={+rounded}
|
56
53
|
src={url}
|
57
|
-
transition={transition}
|
58
54
|
/>
|
59
55
|
)
|
60
56
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { default as DefaultImage } from './_default_image
|
2
|
-
export { default as RoundedImage } from './_rounded_image
|
3
|
-
export { default as CustomErrorImage } from './_custom_error_image
|
4
|
-
export { default as TransitionImage } from './_transition_image
|
1
|
+
export { default as DefaultImage } from './_default_image'
|
2
|
+
export { default as RoundedImage } from './_rounded_image'
|
3
|
+
export { default as CustomErrorImage } from './_custom_error_image'
|
4
|
+
export { default as TransitionImage } from './_transition_image'
|
@@ -26,7 +26,7 @@ test('default classname', () => {
|
|
26
26
|
|
27
27
|
test('size = xs', () => {
|
28
28
|
const kit = renderKit(Image, props, { size: 'xs' })
|
29
|
-
expect(kit).toHaveClass('
|
29
|
+
expect(kit).toHaveClass('pb_image_kit_size_xs lazyload')
|
30
30
|
})
|
31
31
|
|
32
32
|
test('transition = blur', () => {
|
@@ -4,7 +4,7 @@ import React from 'react'
|
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
6
6
|
|
7
|
-
import { globalProps } from '../utilities/globalProps
|
7
|
+
import { globalProps } from '../utilities/globalProps'
|
8
8
|
|
9
9
|
type LayoutPropTypes = {
|
10
10
|
aria?: object,
|
@@ -3,11 +3,12 @@
|
|
3
3
|
import React from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
|
6
|
-
import { globalProps } from '../utilities/globalProps
|
6
|
+
import { globalProps } from '../utilities/globalProps'
|
7
7
|
import pbChart from '../plugins/pb_chart'
|
8
8
|
|
9
9
|
type LineGraphProps = {
|
10
10
|
axisTitle?: string,
|
11
|
+
dark?: Boolean,
|
11
12
|
xAxisCategories: array,
|
12
13
|
yAxisMin: number,
|
13
14
|
yAxisMax: number,
|
@@ -31,6 +32,7 @@ type LineGraphProps = {
|
|
31
32
|
export default class LineGraph extends React.Component<LineGraphProps> {
|
32
33
|
static defaultProps = {
|
33
34
|
className: 'pb_bar_graph',
|
35
|
+
dark: false,
|
34
36
|
gradient: false,
|
35
37
|
type: 'line',
|
36
38
|
legend: false,
|
@@ -40,6 +42,7 @@ export default class LineGraph extends React.Component<LineGraphProps> {
|
|
40
42
|
componentDidMount() {
|
41
43
|
const {
|
42
44
|
axisTitle,
|
45
|
+
dark,
|
43
46
|
xAxisCategories,
|
44
47
|
yAxisMin,
|
45
48
|
yAxisMax,
|
@@ -60,6 +63,7 @@ export default class LineGraph extends React.Component<LineGraphProps> {
|
|
60
63
|
axisTitle: axisTitle,
|
61
64
|
chartData: chartData,
|
62
65
|
colors: colors,
|
66
|
+
dark,
|
63
67
|
id: id,
|
64
68
|
pointStart: pointStart,
|
65
69
|
subtitle: subTitle,
|
@@ -11,6 +11,7 @@ const LineGraphDefault = (props) => (
|
|
11
11
|
<LineGraph
|
12
12
|
axisTitle="Number of Employees"
|
13
13
|
chartData={data}
|
14
|
+
height="300px"
|
14
15
|
id="line-fixed-height"
|
15
16
|
title="Fixed Height (300px)"
|
16
17
|
xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import React, { type Node } from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
6
|
-
import { globalProps } from '../utilities/globalProps
|
6
|
+
import { globalProps } from '../utilities/globalProps'
|
7
7
|
|
8
8
|
type ListProps = {
|
9
9
|
aria?: object,
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import React, { type Node } from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
6
|
-
import { globalProps } from '../utilities/globalProps
|
6
|
+
import { globalProps } from '../utilities/globalProps'
|
7
7
|
|
8
8
|
type ListItemProps = {
|
9
9
|
aria?: object,
|
@@ -4,7 +4,7 @@ import React from 'react'
|
|
4
4
|
import classnames from 'classnames'
|
5
5
|
|
6
6
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
7
|
-
import { globalProps } from '../utilities/globalProps
|
7
|
+
import { globalProps } from '../utilities/globalProps'
|
8
8
|
|
9
9
|
import Avatar from '../pb_avatar/_avatar'
|
10
10
|
|
@@ -1,18 +1,16 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
import classnames from 'classnames'
|
5
|
-
import { globalProps } from '../utilities/globalProps
|
3
|
+
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
6
4
|
|
7
5
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
8
6
|
|
9
7
|
type OnlineStatusProps = {
|
10
|
-
aria?:
|
8
|
+
aria?: {[key: string]: string},
|
11
9
|
className?: string,
|
12
|
-
data?:
|
10
|
+
data?: {[key: string]: string | number},
|
13
11
|
id?: string,
|
14
12
|
status?: "online" | "offline" | "away",
|
15
|
-
}
|
13
|
+
} & GlobalProps
|
16
14
|
|
17
15
|
const OnlineStatus = (props: OnlineStatusProps) => {
|
18
16
|
const {
|
@@ -1,10 +1,11 @@
|
|
1
1
|
/* @flow */
|
2
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
2
3
|
|
3
4
|
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
4
5
|
import classnames from 'classnames'
|
5
6
|
|
6
7
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
7
|
-
import { globalProps } from '../utilities/globalProps
|
8
|
+
import { globalProps } from '../utilities/globalProps'
|
8
9
|
|
9
10
|
import useZxcvbn from './useZxcvbn'
|
10
11
|
import useHaveIBeenPwned from './useHaveIBeenPwned'
|
@@ -5,7 +5,7 @@ import React from 'react'
|
|
5
5
|
import classnames from 'classnames'
|
6
6
|
import Title from '../pb_title/_title.jsx'
|
7
7
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
8
|
-
import { globalProps } from '../utilities/globalProps
|
8
|
+
import { globalProps } from '../utilities/globalProps'
|
9
9
|
|
10
10
|
type PillProps = {
|
11
11
|
aria?: object,
|
@@ -13,7 +13,7 @@ import {
|
|
13
13
|
import { buildAriaProps, buildCss, buildDataProps, noop } from '../utilities/props'
|
14
14
|
|
15
15
|
import classnames from 'classnames'
|
16
|
-
import { globalProps } from '../utilities/globalProps
|
16
|
+
import { globalProps } from '../utilities/globalProps'
|
17
17
|
|
18
18
|
type PbPopoverProps = {
|
19
19
|
aria?: object,
|
@@ -150,16 +150,14 @@ export default class PbReactPopover extends React.Component<PbPopoverProps> {
|
|
150
150
|
const targetIsReference =
|
151
151
|
target.closest('.pb_popover_reference_wrapper') !== null
|
152
152
|
|
153
|
-
if (targetIsReference) return
|
154
|
-
|
155
153
|
switch (closeOnClick) {
|
156
154
|
case 'outside':
|
157
|
-
if (!targetIsPopover) {
|
155
|
+
if (!targetIsPopover || targetIsReference) {
|
158
156
|
shouldClosePopover(true)
|
159
157
|
}
|
160
158
|
break
|
161
159
|
case 'inside':
|
162
|
-
if (targetIsPopover) {
|
160
|
+
if (targetIsPopover || targetIsReference) {
|
163
161
|
shouldClosePopover(true)
|
164
162
|
}
|
165
163
|
break
|