playbook_ui 14.9.0.pre.alpha.PBNTR775formmatingmaskdefaultvalue5121 → 14.9.0.pre.alpha.PLAY1660reactdropzone5020
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_advanced_table/Components/CollapsibleTrail.tsx +6 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +3 -11
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +2 -4
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +0 -8
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +0 -8
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +0 -2
- data/app/pb_kits/playbook/pb_card/_card.tsx +7 -7
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +1 -21
- data/app/pb_kits/playbook/pb_card/docs/_card_header.jsx +0 -50
- data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +24 -15
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx +3 -1
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.jsx +4 -1
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_max_size.jsx +1 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.scss +2 -11
- data/app/pb_kits/playbook/pb_gauge/_gauge.scss +1 -31
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +3 -3
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.jsx +5 -25
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +1 -17
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_emphasis.html.erb +1 -17
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_emphasis.jsx +0 -15
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_emphasis.md +1 -2
- data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +1 -15
- data/app/pb_kits/playbook/pb_table/_table.tsx +6 -6
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.html.erb +48 -30
- data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_table/index.ts +3 -5
- data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +3 -28
- data/app/pb_kits/playbook/pb_table/styles/_sticky_columns.scss +1 -0
- data/app/pb_kits/playbook/pb_table/table.html.erb +1 -7
- data/app/pb_kits/playbook/pb_table/table.rb +0 -4
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -8
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +46 -115
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +2 -9
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -3
- data/dist/chunks/_typeahead-CZ_5SxHq.js +36 -0
- data/dist/chunks/_weekday_stacked-D345GDEZ.js +45 -0
- data/dist/chunks/{lib-sMFo2JZy.js → lib-CuCy3_xO.js} +1 -1
- data/dist/chunks/{pb_form_validation-CgvjWbOK.js → pb_form_validation-D37k10a0.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +6 -12
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail_rails.html.erb +0 -36
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail_rails.md +0 -1
- data/app/pb_kits/playbook/pb_form_group/_error_state_mixin.scss +0 -57
- data/app/pb_kits/playbook/pb_home_address_street/none_emphasis.html.erb +0 -32
- data/app/pb_kits/playbook/pb_home_address_street/none_emphasis.rb +0 -29
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +0 -1
- data/dist/chunks/_typeahead-DWFImMpi.js +0 -22
- data/dist/chunks/_weekday_stacked-UtPiOqYV.js +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bd94a16e8f4921dfb9fc4dec855acde1e435ef517754f0622a861ee987a0d63
|
4
|
+
data.tar.gz: 8599257f054471735d29bad11278793ed971382e2910dbc50f30dd80b6f85cf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07b3efaee6c1db4128f6225d25d89aac30a35d9747881aca6f065a58d83982fda6373244c2fc9cfce867701b75c2bfbaca56f8980ca3b51886abf2b773e3e84b
|
7
|
+
data.tar.gz: 41c4d23b85f2c20877f01bac703b5d50312b5a6e826c1fcc8cb1bb0f0810ce84c118f3334ca9f01489c99c84529b1f4c96df3e8762ce92cf4e8f8326f5a60732
|
@@ -3,13 +3,18 @@ import React from "react"
|
|
3
3
|
//CollapsibleTrail component
|
4
4
|
const CollapsibleTrail = ({ leftOffset }: { leftOffset: number }) => {
|
5
5
|
const style: { [key: string]: string | number } = {
|
6
|
+
position: "absolute",
|
6
7
|
left: `${leftOffset}em`,
|
8
|
+
top: 0,
|
9
|
+
bottom: 0,
|
10
|
+
width: "2px",
|
11
|
+
backgroundColor: "#E4E8F0",
|
7
12
|
}
|
8
13
|
|
9
14
|
return (
|
10
15
|
<div
|
11
16
|
className="collapsible-trail"
|
12
|
-
style={style}
|
17
|
+
style={style}
|
13
18
|
/>
|
14
19
|
)
|
15
20
|
}
|
@@ -110,17 +110,9 @@
|
|
110
110
|
height: auto;
|
111
111
|
}
|
112
112
|
|
113
|
-
.collapsible-trail {
|
114
|
-
background-color: $border_light;
|
115
|
-
position: absolute;
|
116
|
-
top: 0;
|
117
|
-
bottom: 0;
|
118
|
-
width: 2px;
|
119
|
-
}
|
120
|
-
|
121
113
|
// Responsive Styles
|
122
114
|
@media only screen and (max-width: $screen-xl-min) {
|
123
|
-
&[class*="
|
115
|
+
&[class*="table-responsive-scroll"] {
|
124
116
|
border-radius: 4px;
|
125
117
|
box-shadow: 1px 0 0 0px $border_light,
|
126
118
|
-1px 0 0 0px $border_light;
|
@@ -158,7 +150,7 @@
|
|
158
150
|
}
|
159
151
|
}
|
160
152
|
@media only screen and (min-width: $screen-xl-min) {
|
161
|
-
&[class*="
|
153
|
+
&[class*="table-responsive-scroll"] {
|
162
154
|
overflow-x: visible;
|
163
155
|
}
|
164
156
|
}
|
@@ -208,7 +200,7 @@
|
|
208
200
|
}
|
209
201
|
// Dark Mode Responsive Styles
|
210
202
|
@media only screen and (max-width: $screen-xl-min) {
|
211
|
-
&[class*="
|
203
|
+
&[class*="table-responsive-scroll"] {
|
212
204
|
border-radius: 4px;
|
213
205
|
box-shadow: 1px 0 0 0px $border_dark,
|
214
206
|
-1px 0 0 0px $border_dark;
|
@@ -240,7 +240,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
240
240
|
const htmlProps = buildHtmlProps(htmlOptions)
|
241
241
|
const classes = classnames(
|
242
242
|
buildCss("pb_advanced_table"),
|
243
|
-
`
|
243
|
+
`table-responsive-${responsive}`,
|
244
244
|
globalProps(props),
|
245
245
|
className
|
246
246
|
)
|
@@ -468,7 +468,7 @@ test("responsive prop functions as expected", () => {
|
|
468
468
|
)
|
469
469
|
|
470
470
|
const kit = screen.getByTestId(testId)
|
471
|
-
expect(kit).toHaveClass("pb_advanced_table
|
471
|
+
expect(kit).toHaveClass("pb_advanced_table table-responsive-scroll")
|
472
472
|
})
|
473
473
|
|
474
474
|
test("responsive none prop functions as expected", () => {
|
@@ -483,7 +483,7 @@ test("responsive none prop functions as expected", () => {
|
|
483
483
|
)
|
484
484
|
|
485
485
|
const kit = screen.getByTestId(testId)
|
486
|
-
expect(kit).toHaveClass("pb_advanced_table
|
486
|
+
expect(kit).toHaveClass("pb_advanced_table table-responsive-none")
|
487
487
|
})
|
488
488
|
|
489
489
|
test("customRenderer prop functions as expected", () => {
|
@@ -2,7 +2,6 @@ examples:
|
|
2
2
|
rails:
|
3
3
|
- advanced_table_beta: Default (Required Props)
|
4
4
|
- advanced_table_beta_subrow_headers: SubRow Headers
|
5
|
-
- advanced_table_collapsible_trail_rails: Collapsible Trail
|
6
5
|
- advanced_table_beta_sort: Enable Sorting
|
7
6
|
- advanced_table_custom_cell_rails: Custom Components for Cells
|
8
7
|
|
@@ -14,16 +14,14 @@ module Playbook
|
|
14
14
|
default: "header"
|
15
15
|
prop :subrow_headers, type: Playbook::Props::Array,
|
16
16
|
default: []
|
17
|
-
prop :collapsible_trail, type: Playbook::Props::Boolean,
|
18
|
-
default: true
|
19
17
|
|
20
18
|
def render_row_and_children(row, column_definitions, current_depth, first_parent_child)
|
21
19
|
output = ActiveSupport::SafeBuffer.new
|
22
20
|
is_first_child_of_subrow = current_depth.positive? && first_parent_child && subrow_headers[current_depth - 1].present?
|
23
21
|
|
24
|
-
output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: column_definitions, depth: current_depth, subrow_header: subrow_headers[current_depth - 1]
|
22
|
+
output << pb_rails("advanced_table/table_subrow_header", props: { row: row, column_definitions: column_definitions, depth: current_depth, subrow_header: subrow_headers[current_depth - 1] }) if is_first_child_of_subrow && enable_toggle_expansion == "all"
|
25
23
|
|
26
|
-
output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: column_definitions, depth: current_depth
|
24
|
+
output << pb_rails("advanced_table/table_row", props: { id: id, row: row, column_definitions: column_definitions, depth: current_depth })
|
27
25
|
|
28
26
|
if row[:children].present?
|
29
27
|
output << content_tag(:div, class: "toggle-content", data: { advanced_table_content: row.object_id.to_s + id }) do
|
@@ -2,14 +2,6 @@
|
|
2
2
|
<% object.column_definitions.each_with_index do |column, index| %>
|
3
3
|
<%= pb_rails("table/table_cell", props: { tag:"div", classname:object.td_classname}) do %>
|
4
4
|
<%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end" }) do %>
|
5
|
-
<% if collapsible_trail && index.zero? %>
|
6
|
-
<% (1..depth).each do |i| %>
|
7
|
-
<% additional_offset = i > 1 ? (i - 1) * 0.25 : 0 %>
|
8
|
-
<% left_offset = i * 1.0 + additional_offset %>
|
9
|
-
<div class="collapsible-trail" style="left: <%= left_offset %>em"></div>
|
10
|
-
<% end %>
|
11
|
-
<% end %>
|
12
|
-
|
13
5
|
<div style="padding-left: <%= depth * 1.25 %>em">
|
14
6
|
<%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
|
15
7
|
<% if index.zero? && object.row[:children].present? %>
|
@@ -6,14 +6,6 @@
|
|
6
6
|
<% object.column_definitions.each_with_index do |column, index| %>
|
7
7
|
<%= pb_rails("table/table_cell", props: { tag: "div", classname: object.td_classname}) do %>
|
8
8
|
<%= pb_rails("flex", props:{ align: "center", justify: "start" }) do %>
|
9
|
-
<% if collapsible_trail && index.zero? %>
|
10
|
-
<% (1..depth).each do |i| %>
|
11
|
-
<% additional_offset = i > 1 ? (i - 1) * 0.25 : 0 %>
|
12
|
-
<% left_offset = i * 1.0 + additional_offset %>
|
13
|
-
<div class="collapsible-trail" style="left: <%= left_offset %>em"></div>
|
14
|
-
<% end %>
|
15
|
-
<% end %>
|
16
|
-
|
17
9
|
<div style="padding-left: <%= depth * 1.25 %>em">
|
18
10
|
<%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
|
19
11
|
<% if index.zero? && object.row[:children].present? %>
|
@@ -12,8 +12,6 @@ module Playbook
|
|
12
12
|
default: "header"
|
13
13
|
prop :subrow_header, type: Playbook::Props::String,
|
14
14
|
default: ""
|
15
|
-
prop :collapsible_trail, type: Playbook::Props::Boolean,
|
16
|
-
default: true
|
17
15
|
|
18
16
|
def classname
|
19
17
|
generate_classname("pb_table_tr", "bg-white", subrow_depth_classname, separator: " ")
|
@@ -6,7 +6,7 @@ import classnames from 'classnames'
|
|
6
6
|
|
7
7
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
8
8
|
import { GlobalProps, globalProps, globalInlineProps } from '../utilities/globalProps'
|
9
|
-
import type { ProductColors, CategoryColors, BackgroundColors
|
9
|
+
import type { ProductColors, CategoryColors, BackgroundColors } from '../types/colors'
|
10
10
|
|
11
11
|
import Icon from '../pb_icon/_icon'
|
12
12
|
import Flex from '../pb_flex/_flex'
|
@@ -36,7 +36,7 @@ type CardPropTypes = {
|
|
36
36
|
} & GlobalProps
|
37
37
|
|
38
38
|
type CardHeaderProps = {
|
39
|
-
headerColor?: BackgroundColors | ProductColors | CategoryColors |
|
39
|
+
headerColor?: BackgroundColors | ProductColors | CategoryColors | "none",
|
40
40
|
headerColorStriped?: boolean,
|
41
41
|
children: React.ReactChild[] | React.ReactChild,
|
42
42
|
className?: string,
|
@@ -127,12 +127,12 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
127
127
|
|
128
128
|
const tagOptions = ['div', 'section', 'footer', 'header', 'article', 'aside', 'main', 'nav']
|
129
129
|
const Tag = tagOptions.includes(tag) ? tag : 'div'
|
130
|
-
|
130
|
+
|
131
131
|
return (
|
132
132
|
<>
|
133
133
|
{
|
134
134
|
draggableItem ? (
|
135
|
-
<Draggable.Item dragId={dragId}
|
135
|
+
<Draggable.Item dragId={dragId}
|
136
136
|
key={dragId}
|
137
137
|
>
|
138
138
|
<Tag
|
@@ -140,14 +140,14 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
140
140
|
{...dataProps}
|
141
141
|
className={classnames(cardCss, globalProps(props), className)}
|
142
142
|
{...restHtmlProps}
|
143
|
-
style={mergedStyles}
|
143
|
+
style={mergedStyles}
|
144
144
|
>
|
145
145
|
{subComponentTags('Header')}
|
146
146
|
{
|
147
147
|
dragHandle ? (
|
148
148
|
<Flex>
|
149
149
|
<span className="card_draggable_handle">
|
150
|
-
<Icon
|
150
|
+
<Icon
|
151
151
|
icon="grip-dots-vertical"
|
152
152
|
paddingRight="xs"
|
153
153
|
verticalAlign="middle"
|
@@ -169,7 +169,7 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
169
169
|
{...dataProps}
|
170
170
|
className={classnames(cardCss, globalProps(props), className)}
|
171
171
|
{...restHtmlProps}
|
172
|
-
style={mergedStyles}
|
172
|
+
style={mergedStyles}
|
173
173
|
>
|
174
174
|
{subComponentTags('Header')}
|
175
175
|
{nonHeaderChildren}
|
@@ -24,7 +24,7 @@ $additional_colors: (
|
|
24
24
|
"neutral_subtle": $neutral_subtle,
|
25
25
|
);
|
26
26
|
$background_colors: map-merge($product_colors, $additional_colors);
|
27
|
-
$pb_card_header_colors: map-merge(map-merge(
|
27
|
+
$pb_card_header_colors: map-merge(map-merge($product_colors, $additional_colors), $category_colors);
|
28
28
|
|
29
29
|
@mixin pb_card_selected($border_color: $primary) {
|
30
30
|
border-color: $border_color;
|
@@ -67,24 +67,4 @@
|
|
67
67
|
<%= pb_rails("card/card_body", props: { padding: "md", }) do %>
|
68
68
|
Body
|
69
69
|
<% end %>
|
70
|
-
<% end %>
|
71
|
-
|
72
|
-
<%= pb_rails("title", props: { text: "Status Colors", tag: "h4", size: 4, margin_bottom: "sm" }) %>
|
73
|
-
|
74
|
-
<%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %>
|
75
|
-
<%= pb_rails("card/card_header", props: { padding: "sm", header_color: "success" }) do %>
|
76
|
-
<%= pb_rails("body", props: { text: "Success", dark: true }) %>
|
77
|
-
<% end %>
|
78
|
-
<%= pb_rails("card/card_body", props: { padding: "md" }) do %>
|
79
|
-
Body
|
80
|
-
<% end %>
|
81
|
-
<% end %>
|
82
|
-
|
83
|
-
<%= pb_rails("card", props: { padding: "none", header: true, margin_bottom: "sm"}) do %>
|
84
|
-
<%= pb_rails("card/card_header", props: { padding: "sm", header_color: "error" }) do %>
|
85
|
-
<%= pb_rails("body", props: { text: "Error", dark: true }) %>
|
86
|
-
<% end %>
|
87
|
-
<%= pb_rails("card/card_body", props: { padding: "md" }) do %>
|
88
|
-
Body
|
89
|
-
<% end %>
|
90
|
-
<% end %>
|
70
|
+
<% end %>
|
@@ -181,56 +181,6 @@ const CardHeader = (props) => {
|
|
181
181
|
/>
|
182
182
|
</Card.Body>
|
183
183
|
</Card>
|
184
|
-
|
185
|
-
<Title
|
186
|
-
{...props}
|
187
|
-
marginBottom='sm'
|
188
|
-
size={4}
|
189
|
-
tag="h4"
|
190
|
-
text="Status Colors"
|
191
|
-
/>
|
192
|
-
|
193
|
-
<Card
|
194
|
-
{...props}
|
195
|
-
marginBottom='sm'
|
196
|
-
padding="none"
|
197
|
-
>
|
198
|
-
<Card.Header
|
199
|
-
headerColor="success"
|
200
|
-
>
|
201
|
-
<Body
|
202
|
-
dark
|
203
|
-
text="Success"
|
204
|
-
/>
|
205
|
-
</Card.Header>
|
206
|
-
<Card.Body>
|
207
|
-
<Body
|
208
|
-
{...props}
|
209
|
-
text="Body"
|
210
|
-
/>
|
211
|
-
</Card.Body>
|
212
|
-
</Card>
|
213
|
-
|
214
|
-
<Card
|
215
|
-
{...props}
|
216
|
-
marginBottom='sm'
|
217
|
-
padding="none"
|
218
|
-
>
|
219
|
-
<Card.Header
|
220
|
-
headerColor="error"
|
221
|
-
>
|
222
|
-
<Body
|
223
|
-
dark
|
224
|
-
text="Error"
|
225
|
-
/>
|
226
|
-
</Card.Header>
|
227
|
-
<Card.Body>
|
228
|
-
<Body
|
229
|
-
{...props}
|
230
|
-
text="Body"
|
231
|
-
/>
|
232
|
-
</Card.Body>
|
233
|
-
</Card>
|
234
184
|
</>
|
235
185
|
)
|
236
186
|
}
|
@@ -1 +1 @@
|
|
1
|
-
Card headers pass category, product,
|
1
|
+
Card headers pass category, product, and background colors only. List of all category, product, and background colors can be viewed <a href="https://playbook.powerapp.cloud/visual_guidelines/colors" target="_blank">here</a>.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { useEffect, useCallback, useRef } from 'react'
|
2
|
-
import { useDropzone, DropzoneInputProps, DropzoneRootProps } from 'react-dropzone'
|
2
|
+
import { useDropzone, DropzoneInputProps, DropzoneRootProps, FileRejection } from 'react-dropzone'
|
3
3
|
import classnames from 'classnames'
|
4
4
|
|
5
5
|
import { buildCss, buildDataProps, noop, buildHtmlProps } from '../utilities/props'
|
@@ -9,8 +9,10 @@ import type { Callback } from '../types'
|
|
9
9
|
import Body from '../pb_body/_body'
|
10
10
|
import Card from '../pb_card/_card'
|
11
11
|
|
12
|
+
import { isEmpty } from '../utilities/object'
|
13
|
+
|
12
14
|
type FileUploadProps = {
|
13
|
-
accept?: string[]
|
15
|
+
accept?: Record<string, string[]>,
|
14
16
|
className?: string,
|
15
17
|
customMessage?: string,
|
16
18
|
dark?: boolean,
|
@@ -19,7 +21,7 @@ type FileUploadProps = {
|
|
19
21
|
acceptedFilesDescription?: string,
|
20
22
|
maxSize?: number,
|
21
23
|
onFilesAccepted: Callback<File, File>,
|
22
|
-
onFilesRejected: (error: string, files:
|
24
|
+
onFilesRejected: (error: string, files: readonly FileRejection[]) => void,
|
23
25
|
}
|
24
26
|
|
25
27
|
const getFormattedFileSize = (fileSize: number): string => {
|
@@ -28,7 +30,7 @@ const getFormattedFileSize = (fileSize: number): string => {
|
|
28
30
|
|
29
31
|
const FileUpload = (props: FileUploadProps): React.ReactElement => {
|
30
32
|
const {
|
31
|
-
accept =
|
33
|
+
accept = {},
|
32
34
|
acceptedFilesDescription = '',
|
33
35
|
className,
|
34
36
|
customMessage,
|
@@ -48,30 +50,37 @@ const FileUpload = (props: FileUploadProps): React.ReactElement => {
|
|
48
50
|
getRootProps: () => DropzoneRootProps & any;
|
49
51
|
getInputProps: () => DropzoneInputProps & any;
|
50
52
|
isDragActive: boolean;
|
51
|
-
|
53
|
+
fileRejections: readonly FileRejection[];
|
52
54
|
}
|
53
55
|
|
54
|
-
const { getRootProps, getInputProps, isDragActive,
|
56
|
+
const { getRootProps, getInputProps, isDragActive, fileRejections }: DropZoneProps = useDropzone({
|
55
57
|
accept,
|
56
58
|
maxSize,
|
57
59
|
onDrop,
|
58
60
|
})
|
59
61
|
|
60
|
-
const prevRejected = useRef<
|
62
|
+
const prevRejected = useRef<readonly FileRejection[] | null>(null);
|
61
63
|
|
62
|
-
|
64
|
+
let maxFileSizeText = ''
|
65
|
+
if (maxSize !== undefined) {
|
66
|
+
maxFileSizeText = `Max file size is ${getFormattedFileSize(maxSize)}.`
|
67
|
+
}
|
63
68
|
|
64
69
|
useEffect(() => {
|
65
|
-
if (
|
66
|
-
const isFileTooLarge = maxSize &&
|
70
|
+
if (fileRejections === prevRejected.current) return
|
71
|
+
const isFileTooLarge = maxSize && fileRejections.length > 0 && fileRejections[0].file.size > maxSize;
|
67
72
|
if (isFileTooLarge) {
|
68
|
-
onFilesRejected(`File size is too large! ${maxFileSizeText}`,
|
73
|
+
onFilesRejected(`File size is too large! ${maxFileSizeText}`, fileRejections)
|
69
74
|
}
|
70
|
-
prevRejected.current =
|
71
|
-
}, [maxFileSizeText, maxSize, onFilesRejected,
|
75
|
+
prevRejected.current = fileRejections
|
76
|
+
}, [maxFileSizeText, maxSize, onFilesRejected, fileRejections])
|
72
77
|
|
73
78
|
const acceptedFileTypes = () => {
|
74
|
-
|
79
|
+
if (!accept) {
|
80
|
+
return []
|
81
|
+
}
|
82
|
+
|
83
|
+
return Object.keys(accept).map((fileType) => {
|
75
84
|
if (fileType.startsWith('image/')) {
|
76
85
|
return fileType.replace('image/', ' ')
|
77
86
|
} else {
|
@@ -86,7 +95,7 @@ const FileUpload = (props: FileUploadProps): React.ReactElement => {
|
|
86
95
|
const getDescription = () => {
|
87
96
|
return customMessage
|
88
97
|
? customMessage
|
89
|
-
: `Choose a file or drag it here.${accept
|
98
|
+
: `Choose a file or drag it here.${isEmpty(accept) ? '' : ` The accepted file types are: ${acceptedFilesDescription || acceptedFileTypes()}.`}${maxSize ? ` ${maxFileSizeText}` : ''}`;
|
90
99
|
}
|
91
100
|
|
92
101
|
return (
|
@@ -25,7 +25,10 @@ const FileUploadCustomDescription = (props) => {
|
|
25
25
|
{...props}
|
26
26
|
/>
|
27
27
|
<FileUpload
|
28
|
-
accept={
|
28
|
+
accept={{
|
29
|
+
"application/pdf": [".pdf"],
|
30
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
|
31
|
+
}}
|
29
32
|
acceptedFilesDescription="Adobe (.pdf) and Microsoft (.xslx)"
|
30
33
|
onFilesAccepted={handleOnFilesAccepted}
|
31
34
|
{...props}
|
@@ -18,7 +18,7 @@ const AcceptedFilesList = ({ files }) => (
|
|
18
18
|
const RejectedFilesList = ({ files }) => (
|
19
19
|
<List>
|
20
20
|
{files.map((file) => (
|
21
|
-
<ListItem key={file.name}><Body color="error">{`${file.name} (file too large)`}</Body></ListItem>
|
21
|
+
<ListItem key={file.file.name}><Body color="error">{`${file.file.name} (file too large)`}</Body></ListItem>
|
22
22
|
))}
|
23
23
|
</List>
|
24
24
|
)
|
@@ -1,6 +1,3 @@
|
|
1
|
-
@import "../tokens/spacing";
|
2
|
-
@import "./error_state_mixin";
|
3
|
-
|
4
1
|
[class^=pb_form_group_kit] {
|
5
2
|
display: inline-flex;
|
6
3
|
flex-direction: row;
|
@@ -15,12 +12,6 @@
|
|
15
12
|
}
|
16
13
|
}
|
17
14
|
|
18
|
-
@include error-state-flex-start-selectors;
|
19
|
-
@include error-state-center-selectors;
|
20
|
-
@include error-state-flex-end-selectors;
|
21
|
-
@include error-state-left-side-select-kit;
|
22
|
-
@include error-state-right-side-select-kit;
|
23
|
-
|
24
15
|
& [class^=pb_text_input_kit] .text_input_wrapper,
|
25
16
|
& [class^=pb_date_picker_kit] .input_wrapper,
|
26
17
|
& [class^=pb_select] {
|
@@ -36,7 +27,7 @@
|
|
36
27
|
border-bottom-right-radius: 0;
|
37
28
|
border-top-right-radius: 0;
|
38
29
|
border-right-width: 0;
|
39
|
-
|
30
|
+
|
40
31
|
&:focus {
|
41
32
|
outline: $primary solid 1px;
|
42
33
|
outline-offset: -1px;
|
@@ -159,7 +150,7 @@
|
|
159
150
|
& > [class^=pb_selectable_card_kit] input[type="checkbox"]:not(:checked) ~ label, [class^=pb_selectable_card_kit] input[type="radio"]:not(:checked) ~ label {
|
160
151
|
&:hover {
|
161
152
|
border-right-color: $slate;
|
162
|
-
}
|
153
|
+
}
|
163
154
|
}
|
164
155
|
|
165
156
|
& > [class^=pb_selectable_card_kit]:not(:first-child) label {
|
@@ -1,33 +1,12 @@
|
|
1
|
-
@import "../tokens/colors";
|
2
|
-
|
3
1
|
[class^=pb_gauge_kit] {
|
4
2
|
|
5
|
-
.fix {
|
6
|
-
fill: $text_lt_default;
|
7
|
-
stroke: none;
|
8
|
-
|
9
|
-
&[class*=dark] {
|
10
|
-
fill: $text_dk_default;
|
11
|
-
}
|
12
|
-
}
|
13
|
-
|
14
3
|
.suffix {
|
15
4
|
fill: $text_lt_light;
|
16
|
-
stroke: none;
|
17
5
|
font: $regular $font_larger $font_family_base;
|
18
|
-
|
19
|
-
&[class*=dark] {
|
20
|
-
fill: $text_dk_light;
|
21
|
-
}
|
22
6
|
}
|
23
7
|
.prefix {
|
24
8
|
fill: $text_lt_light;
|
25
|
-
stroke: none;
|
26
9
|
font: $regular $font_base $font_family_base;
|
27
|
-
|
28
|
-
&[class*=dark] {
|
29
|
-
fill: $text_dk_light;
|
30
|
-
}
|
31
10
|
}
|
32
11
|
|
33
12
|
rect.highcharts-background {
|
@@ -37,13 +16,4 @@
|
|
37
16
|
.gauge-pane {
|
38
17
|
stroke-linejoin: round;
|
39
18
|
}
|
40
|
-
|
41
|
-
&[class*=dark] {
|
42
|
-
color: $text_dk_default;
|
43
|
-
|
44
|
-
.pb_title_kit_size_1,
|
45
|
-
.pb_caption_kit_xs {
|
46
|
-
color: $text_dk_light;
|
47
|
-
}
|
48
|
-
}
|
49
|
-
}
|
19
|
+
}
|
@@ -164,9 +164,9 @@ const Gauge = ({
|
|
164
164
|
color: defaultColors.text_lt_default,
|
165
165
|
enabled: true,
|
166
166
|
format:
|
167
|
-
`<span class="prefix
|
168
|
-
|
169
|
-
`<span class="suffix
|
167
|
+
`<span class="prefix">${prefix}</span>` +
|
168
|
+
'<span class="fix">{y:,f}</span>' +
|
169
|
+
`<span class="suffix">${suffix}</span>`,
|
170
170
|
style: {
|
171
171
|
fontFamily: typography.font_family_base,
|
172
172
|
fontWeight: typography.regular,
|