playbook_ui 11.9.0.pre.alpha.fileupload1 → 11.9.0
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/pb_checkbox/_checkbox.scss +10 -0
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +2 -2
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +5 -28
- data/app/pb_kits/playbook/pb_file_upload/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_file_upload/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_file_upload/fileupload.test.js +3 -3
- data/app/pb_kits/playbook/pb_filter/_filter.scss +0 -2
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +1 -0
- data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.scss +6 -0
- data/app/pb_kits/playbook/pb_selectable_list/selectable_list_item.rb +1 -1
- data/app/pb_kits/playbook/pb_table/_table.jsx +5 -3
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +4 -4
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +1 -2
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.html.erb +23 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.jsx +47 -0
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.md +1 -0
- data/lib/playbook/version.rb +2 -2
- metadata +5 -5
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_max_size.jsx +0 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7907cac22ab4a319dd70e7433325da9f079abbbf23808f11a98048070e86919
|
4
|
+
data.tar.gz: 8eadc10503563e32ef0502098d32fbda57590a6296ebace53df424b135293fcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6288cbbe9397dbdf6e68f938453e5cb5211e0b56afd13fac33641c5e366a4a4116695b0da162d5cb3066ebb5a5721914af339490bd37f5150f03a3811c75cd29
|
7
|
+
data.tar.gz: 9c4f76436d01fb6ffad7d3be1473be696360ba68d55b9e06d82861be97d1a5cfbe8e60767989c5689b67e2dce7a35a7c098ccce66c055cd8ff119a581d2a74fd
|
@@ -87,6 +87,11 @@ $transition: $transition_cubic;
|
|
87
87
|
border-color: $error_dark;
|
88
88
|
}
|
89
89
|
}
|
90
|
+
&.pb_checkbox_kit_error {
|
91
|
+
> .pb_checkbox_checkmark {
|
92
|
+
border-color: $error_dark;
|
93
|
+
}
|
94
|
+
}
|
90
95
|
}
|
91
96
|
|
92
97
|
&.error {
|
@@ -94,4 +99,9 @@ $transition: $transition_cubic;
|
|
94
99
|
border-color: $error;
|
95
100
|
}
|
96
101
|
}
|
102
|
+
&.pb_checkbox_kit_error {
|
103
|
+
> .pb_checkbox_checkmark {
|
104
|
+
border-color: $error;
|
105
|
+
}
|
106
|
+
}
|
97
107
|
}
|
@@ -45,7 +45,7 @@ const Checkbox = (props: CheckboxProps): JSX.Element => {
|
|
45
45
|
const ariaProps = buildAriaProps(aria)
|
46
46
|
const classes = classnames(
|
47
47
|
buildCss('pb_checkbox_kit', checked ? 'checked' : null, error ? 'error' : null, indeterminate? 'indeterminate' : null),
|
48
|
-
globalProps(props),
|
48
|
+
globalProps(props),
|
49
49
|
className
|
50
50
|
)
|
51
51
|
|
@@ -59,7 +59,7 @@ const Checkbox = (props: CheckboxProps): JSX.Element => {
|
|
59
59
|
const checkboxChildren = () => {
|
60
60
|
if (children)
|
61
61
|
return (children)
|
62
|
-
else
|
62
|
+
else
|
63
63
|
return (
|
64
64
|
<input
|
65
65
|
defaultChecked={checked}
|
@@ -12,42 +12,26 @@ import Card from '../pb_card/_card'
|
|
12
12
|
type FileUploadProps = {
|
13
13
|
accept?: string[],
|
14
14
|
className?: string,
|
15
|
-
data?:
|
15
|
+
data?: object,
|
16
16
|
acceptedFilesDescription?: string,
|
17
|
-
maxSize?: number,
|
18
17
|
onFilesAccepted: Callback<File, File>,
|
19
|
-
onFilesRejected: Callback<string, string>,
|
20
18
|
}
|
21
19
|
|
22
|
-
const
|
23
|
-
return `${fileSize / 1e+6} MB`
|
24
|
-
}
|
25
|
-
|
26
|
-
const FileUpload = (props: FileUploadProps): React.ReactElement => {
|
20
|
+
const FileUpload = (props: FileUploadProps) => {
|
27
21
|
const {
|
28
22
|
accept = null,
|
29
23
|
acceptedFilesDescription = '',
|
30
24
|
className,
|
31
25
|
data = {},
|
32
|
-
maxSize,
|
33
26
|
onFilesAccepted = noop,
|
34
|
-
onFilesRejected = noop,
|
35
27
|
} = props
|
36
28
|
|
37
|
-
const onDrop = useCallback((files) =>
|
38
|
-
|
39
|
-
}, [onFilesAccepted])
|
40
|
-
const { getRootProps, getInputProps, isDragActive, rejectedFiles } = useDropzone({
|
29
|
+
const onDrop = useCallback((files) => onFilesAccepted(files), []);
|
30
|
+
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
41
31
|
accept,
|
42
|
-
maxSize,
|
43
32
|
onDrop,
|
44
33
|
})
|
45
34
|
|
46
|
-
const getMaxFileSizeText = () => `Max file size is ${getFormattedFileSize(maxSize)}.`
|
47
|
-
|
48
|
-
const isFileTooLarge = maxSize && rejectedFiles.length > 0 && rejectedFiles[0].size > maxSize;
|
49
|
-
if (isFileTooLarge) onFilesRejected(`File size is too large! ${getMaxFileSizeText()}`)
|
50
|
-
|
51
35
|
const acceptedFileTypes = () => {
|
52
36
|
return accept.map((fileType) => {
|
53
37
|
if (fileType.startsWith('image/')) {
|
@@ -60,13 +44,6 @@ const FileUpload = (props: FileUploadProps): React.ReactElement => {
|
|
60
44
|
|
61
45
|
const dataProps = buildDataProps(data)
|
62
46
|
|
63
|
-
const getDescription = () => {
|
64
|
-
let msg = ""
|
65
|
-
accept === null ? msg += 'Choose a file or drag it here.' : msg += `Choose a file or drag it here. The accepted file types are: ${acceptedFilesDescription || acceptedFileTypes()}.`
|
66
|
-
if (maxSize) msg += ` ${getMaxFileSizeText()}`
|
67
|
-
return msg
|
68
|
-
}
|
69
|
-
|
70
47
|
return (
|
71
48
|
<div
|
72
49
|
className={classnames(buildCss('pb_file_upload_kit'), globalProps(props), className)}
|
@@ -79,7 +56,7 @@ const FileUpload = (props: FileUploadProps): React.ReactElement => {
|
|
79
56
|
{isDragActive ?
|
80
57
|
<p>{'Drop the files here ...'}</p>
|
81
58
|
:
|
82
|
-
<p>{
|
59
|
+
<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>
|
83
60
|
}
|
84
61
|
</Body>
|
85
62
|
</Card>
|
@@ -1,4 +1,3 @@
|
|
1
1
|
export { default as FileUploadDefault } from './_file_upload_default.jsx'
|
2
2
|
export { default as FileUploadAccept } from './_file_upload_accept.jsx'
|
3
3
|
export { default as FileUploadCustomDescription } from './_file_upload_custom_description.jsx'
|
4
|
-
export { default as FileUploadMaxSize } from './_file_upload_max_size.jsx'
|
@@ -27,14 +27,14 @@ test('shows default drag text', () => {
|
|
27
27
|
expect(kit).toHaveTextContent('Choose a file or drag it here')
|
28
28
|
})
|
29
29
|
|
30
|
-
test('
|
30
|
+
test('shows type-specific drag text', () => {
|
31
31
|
render(
|
32
32
|
<FileUpload
|
33
|
+
accept={['image/svg+xml']}
|
33
34
|
data={{ testid: testid }}
|
34
|
-
maxSize={1e+6}
|
35
35
|
/>
|
36
36
|
)
|
37
37
|
|
38
38
|
const kit = screen.getByTestId(testid)
|
39
|
-
expect(kit).toHaveTextContent('Choose a file or drag it here.
|
39
|
+
expect(kit).toHaveTextContent('Choose a file or drag it here. The accepted file types are: svg+xml')
|
40
40
|
})
|
@@ -73,7 +73,6 @@
|
|
73
73
|
}
|
74
74
|
|
75
75
|
.maskContainer::after {
|
76
|
-
background-image: linear-gradient(to right, rgba($card_light,.3) , rgba($card_light,1));
|
77
76
|
content: " ";
|
78
77
|
height: 48px;
|
79
78
|
padding-left: $space_xl;
|
@@ -82,7 +81,6 @@
|
|
82
81
|
}
|
83
82
|
|
84
83
|
.maskContainer::before {
|
85
|
-
background-image: linear-gradient(to right, rgba($card_light,.3) , rgba($card_light,1));
|
86
84
|
content: " ";
|
87
85
|
height: 48px;
|
88
86
|
padding-right: $space_sm;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* @flow */
|
2
2
|
|
3
|
-
import React, { type Node } from 'react'
|
3
|
+
import React, { useEffect, type Node } from 'react'
|
4
4
|
import classnames from 'classnames'
|
5
5
|
import { buildAriaProps, buildDataProps } from '../utilities/props'
|
6
6
|
import { globalProps } from '../utilities/globalProps'
|
@@ -45,8 +45,10 @@ const Table = (props: TableProps) => {
|
|
45
45
|
const dataProps = buildDataProps(data)
|
46
46
|
const tableCollapseCss = responsive !== 'none' ? `table-collapse-${collapse}` : ''
|
47
47
|
|
48
|
-
|
49
|
-
|
48
|
+
useEffect(() => {
|
49
|
+
const instance = new PbTable()
|
50
|
+
instance.connect()
|
51
|
+
}, [])
|
50
52
|
|
51
53
|
return (
|
52
54
|
<table
|
@@ -65,12 +65,12 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
65
65
|
const borderCss = `border_${borderToChange}_${borderToggle}`
|
66
66
|
|
67
67
|
const shouldShowAddOn = icon !== null
|
68
|
-
const addOnCss = shouldShowAddOn ? 'text_input_wrapper_add_on' :
|
69
|
-
const addOnDarkModeCardCss = (shouldShowAddOn && dark) ? 'add-on-card-dark' :
|
68
|
+
const addOnCss = shouldShowAddOn ? 'text_input_wrapper_add_on' : ""
|
69
|
+
const addOnDarkModeCardCss = (shouldShowAddOn && dark) ? 'add-on-card-dark' : ""
|
70
70
|
const css = classnames([
|
71
71
|
'pb_text_input_kit',
|
72
|
-
inline ? 'inline' :
|
73
|
-
error ? 'error' :
|
72
|
+
inline ? 'inline' : "",
|
73
|
+
error ? 'error' : "",
|
74
74
|
globalProps(props),
|
75
75
|
className,
|
76
76
|
])
|
@@ -110,9 +110,8 @@ $height_from_top: $icon_height/2 - $connector_width/2;
|
|
110
110
|
&[class*=_solid] {
|
111
111
|
flex-basis: 100%;
|
112
112
|
[class=pb_timeline_item_left_block] {
|
113
|
-
|
113
|
+
display: flex;
|
114
114
|
height: 55px;
|
115
|
-
justify-content: flex-end;
|
116
115
|
[class=pb_date_stacked_kit_center_sm] {
|
117
116
|
[class=pb_date_stacked_day_month] {
|
118
117
|
[class=pb_caption_kit_md] {
|
@@ -42,3 +42,26 @@
|
|
42
42
|
<% end %>
|
43
43
|
<% end %>
|
44
44
|
|
45
|
+
<br /><br /><br />
|
46
|
+
|
47
|
+
<%= pb_rails("timeline", props: {orientation: "vertical", show_date: true}) do %>
|
48
|
+
<%= pb_rails("timeline/item", props: {icon: "user", icon_color: "royal", line_style: "solid", date: Date.new(2018, 03, 20) }) do %>
|
49
|
+
<%= pb_rails("title_detail", props: {
|
50
|
+
title: "Jackson Heights",
|
51
|
+
detail: "37-27 74th Street"
|
52
|
+
}) %>
|
53
|
+
<% end %>
|
54
|
+
<%= pb_rails("timeline/item", props: {icon: "check", icon_color: "teal", line_style: "dotted" }) do %>
|
55
|
+
<%= pb_rails("title_detail", props: {
|
56
|
+
title: "Greenpoint",
|
57
|
+
detail: "81 Gate St Brooklyn"
|
58
|
+
}) %>
|
59
|
+
<% end %>
|
60
|
+
<%= pb_rails("timeline/item", props: {icon: "map-marker-alt", icon_color: "purple", date: Date.new(2018, 05, 20) }) do %>
|
61
|
+
<%= pb_rails("title_detail", props: {
|
62
|
+
title: "Society Hill",
|
63
|
+
detail: "72 E St Astoria"
|
64
|
+
}) %>
|
65
|
+
<% end %>
|
66
|
+
<% end %>
|
67
|
+
|
@@ -94,6 +94,53 @@ const TimelineWithDate = (props) => (
|
|
94
94
|
/>
|
95
95
|
</Timeline.Item>
|
96
96
|
</Timeline>
|
97
|
+
|
98
|
+
<br/>
|
99
|
+
<br/>
|
100
|
+
<br/>
|
101
|
+
|
102
|
+
<Timeline
|
103
|
+
orientation="vertical"
|
104
|
+
showDate
|
105
|
+
{...props}
|
106
|
+
>
|
107
|
+
<Timeline.Item
|
108
|
+
date={new Date('20 Mar 2018')}
|
109
|
+
icon="user"
|
110
|
+
iconColor="royal"
|
111
|
+
{...props}
|
112
|
+
>
|
113
|
+
<TitleDetail
|
114
|
+
detail="37-27 74th Street"
|
115
|
+
title="Jackson Heights"
|
116
|
+
{...props}
|
117
|
+
/>
|
118
|
+
</Timeline.Item>
|
119
|
+
<Timeline.Item
|
120
|
+
icon="check"
|
121
|
+
iconColor="teal"
|
122
|
+
lineStyle="dotted"
|
123
|
+
{...props}
|
124
|
+
>
|
125
|
+
<TitleDetail
|
126
|
+
detail="81 Gate St Brooklyn"
|
127
|
+
title="Greenpoint"
|
128
|
+
{...props}
|
129
|
+
/>
|
130
|
+
</Timeline.Item>
|
131
|
+
<Timeline.Item
|
132
|
+
date={new Date('20 May 2018')}
|
133
|
+
icon="map-marker-alt"
|
134
|
+
iconColor="purple"
|
135
|
+
{...props}
|
136
|
+
>
|
137
|
+
<TitleDetail
|
138
|
+
detail="72 E St Astoria"
|
139
|
+
title="Society Hill"
|
140
|
+
{...props}
|
141
|
+
/>
|
142
|
+
</Timeline.Item>
|
143
|
+
</Timeline>
|
97
144
|
</div>
|
98
145
|
)
|
99
146
|
|
@@ -0,0 +1 @@
|
|
1
|
+
Use the optional `showDate` prop to render the timeline kit with a visible date. If the date is from the current year, the year will not be displayed, however if date is NOT from the current year, the kit will display the year as well.
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.9.0
|
4
|
+
version: 11.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-10-
|
12
|
+
date: 2022-10-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -854,7 +854,6 @@ files:
|
|
854
854
|
- app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.jsx
|
855
855
|
- app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.md
|
856
856
|
- app/pb_kits/playbook/pb_file_upload/docs/_file_upload_default.jsx
|
857
|
-
- app/pb_kits/playbook/pb_file_upload/docs/_file_upload_max_size.jsx
|
858
857
|
- app/pb_kits/playbook/pb_file_upload/docs/example.yml
|
859
858
|
- app/pb_kits/playbook/pb_file_upload/docs/index.js
|
860
859
|
- app/pb_kits/playbook/pb_file_upload/fileupload.test.js
|
@@ -1950,6 +1949,7 @@ files:
|
|
1950
1949
|
- app/pb_kits/playbook/pb_timeline/docs/_timeline_vertical.jsx
|
1951
1950
|
- app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.html.erb
|
1952
1951
|
- app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.jsx
|
1952
|
+
- app/pb_kits/playbook/pb_timeline/docs/_timeline_with_date.md
|
1953
1953
|
- app/pb_kits/playbook/pb_timeline/docs/example.yml
|
1954
1954
|
- app/pb_kits/playbook/pb_timeline/docs/index.js
|
1955
1955
|
- app/pb_kits/playbook/pb_timeline/item.html.erb
|
@@ -2310,9 +2310,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
2310
2310
|
version: '0'
|
2311
2311
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
2312
2312
|
requirements:
|
2313
|
-
- - "
|
2313
|
+
- - ">="
|
2314
2314
|
- !ruby/object:Gem::Version
|
2315
|
-
version:
|
2315
|
+
version: '0'
|
2316
2316
|
requirements: []
|
2317
2317
|
rubygems_version: 3.3.7
|
2318
2318
|
signing_key:
|
@@ -1,51 +0,0 @@
|
|
1
|
-
/* @flow */
|
2
|
-
/* eslint-disable react/no-multi-comp */
|
3
|
-
|
4
|
-
import React, { useState } from 'react'
|
5
|
-
import {
|
6
|
-
Body,
|
7
|
-
FileUpload,
|
8
|
-
List,
|
9
|
-
ListItem,
|
10
|
-
} from '../..'
|
11
|
-
|
12
|
-
const AcceptedFilesList = ({ files }: FileList) => (
|
13
|
-
<List>
|
14
|
-
{files.map((file) => (
|
15
|
-
<ListItem key={file.name}>{file.name}</ListItem>
|
16
|
-
))}
|
17
|
-
</List>
|
18
|
-
)
|
19
|
-
|
20
|
-
const FileUploadMaxSize = (props) => {
|
21
|
-
const [filesToUpload, setFilesToUpload] = useState([])
|
22
|
-
const [error, setError] = useState()
|
23
|
-
|
24
|
-
const handleOnFilesAccepted = (files) => {
|
25
|
-
setFilesToUpload([...filesToUpload, ...files])
|
26
|
-
}
|
27
|
-
|
28
|
-
return (
|
29
|
-
<div>
|
30
|
-
<AcceptedFilesList
|
31
|
-
files={filesToUpload}
|
32
|
-
{...props}
|
33
|
-
/>
|
34
|
-
<FileUpload
|
35
|
-
acceptedFilesDescription="Choose a file or drag it here. 1 MB size limit."
|
36
|
-
maxSize={1000000}
|
37
|
-
onFilesAccepted={handleOnFilesAccepted}
|
38
|
-
onFilesRejected={(errorMessage) => setError(errorMessage)}
|
39
|
-
{...props}
|
40
|
-
/>
|
41
|
-
{ error && (
|
42
|
-
<Body
|
43
|
-
color="error"
|
44
|
-
marginY="md"
|
45
|
-
>{error}</Body>
|
46
|
-
)}
|
47
|
-
</div>
|
48
|
-
)
|
49
|
-
}
|
50
|
-
|
51
|
-
export default FileUploadMaxSize
|