playbook_ui 14.19.0.pre.alpha.PLAY2172homeaddressstreetundefinedstatebug7733 → 14.19.0.pre.alpha.PLAY20937693
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +1 -11
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +15 -148
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +3 -20
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +13 -23
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +0 -9
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +2 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -5
- data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +0 -1
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +2 -2
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +0 -13
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +1 -11
- data/app/pb_kits/playbook/pb_file_upload/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_file_upload/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +0 -1
- data/app/pb_kits/playbook/pb_file_upload/file_upload.rb +1 -7
- data/app/pb_kits/playbook/pb_file_upload/fileupload.test.js +0 -18
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +7 -13
- data/app/pb_kits/playbook/pb_person/_person.tsx +2 -12
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +9 -9
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +2 -2
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +2 -4
- data/dist/chunks/{_typeahead-BPSIWtFT.js → _typeahead-BQV04mOl.js} +3 -3
- data/dist/chunks/_weekday_stacked-CVwWr8B2.js +45 -0
- data/dist/chunks/{lib-B20MXZcW.js → lib-DwFasxbk.js} +2 -2
- data/dist/chunks/{pb_form_validation-WWvUXPKD.js → pb_form_validation-nnXW3T-3.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 -17
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/VisibilityTree.ts +0 -47
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility.jsx +0 -57
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility.md +0 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_custom.jsx +0 -62
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_custom.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_multi.jsx +0 -82
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_multi.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.jsx +0 -65
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_visibility_with_state.md +0 -1
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_error.html.erb +0 -1
- data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_error.jsx +0 -41
- data/dist/chunks/_weekday_stacked-D575Py8a.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: 2c5ff1137945a937ea4a81fda473a39b7d9e8016a537ea01abfa7ae79b41e1a0
|
4
|
+
data.tar.gz: 0fbe9b0d22ffecc88c65ba5794b0e3c02d3aeccb4221894abb82e1c9603b5104
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa662ae46bf92185d89461416cb7312875bb89fd938d1a204156975bfc5044128af090e39fdb8e5b97d123976b8105a4d76aea4555984068e1222349bb230f25
|
7
|
+
data.tar.gz: aaeb07f57c2923c857afeb9a49fb5a83fb8c44eb2d81bfdc488f20f9ed5603d0b29f6c4e82b164ff05330a9e717a3492384d14e03607b2b4fb341c4e5916aaaa
|
@@ -93,17 +93,7 @@ export const RegularTableView = ({
|
|
93
93
|
|
94
94
|
{row.getVisibleCells().map((cell: Cell<GenericObject, unknown>, i: number) => {
|
95
95
|
const isPinnedLeft = columnPinning.left.includes(cell.column.id);
|
96
|
-
const isLastCell = (
|
97
|
-
const parent = cell.column.parent;
|
98
|
-
if (!parent) {
|
99
|
-
const last = row.getVisibleCells().at(-1);
|
100
|
-
return last?.column.id === cell.column.id;
|
101
|
-
}
|
102
|
-
|
103
|
-
const visibleSiblings = parent.columns.filter(col => col.getIsVisible());
|
104
|
-
return visibleSiblings.at(-1)?.id === cell.column.id;
|
105
|
-
})();
|
106
|
-
|
96
|
+
const isLastCell = cell.column.parent?.columns?.at(-1)?.id === cell.column.id;
|
107
97
|
const { column } = cell;
|
108
98
|
return (
|
109
99
|
<td
|
@@ -1,112 +1,25 @@
|
|
1
|
-
import React, { useEffect, useRef
|
2
|
-
|
3
|
-
import AdvancedTableContext from "../Context/AdvancedTableContext";
|
4
|
-
import { buildVisibilityTree } from "../Utilities/VisibilityTree";
|
5
|
-
|
1
|
+
import React, { useEffect, useRef } from "react";
|
6
2
|
import Card from "../../pb_card/_card";
|
7
3
|
import Caption from "../../pb_caption/_caption";
|
8
4
|
import Flex from "../../pb_flex/_flex";
|
9
5
|
import FlexItem from "../../pb_flex/_flex_item";
|
10
|
-
import
|
11
|
-
import DropdownContainer from "../../pb_dropdown/subcomponents/DropdownContainer";
|
12
|
-
import DropdownTrigger from "../../pb_dropdown/subcomponents/DropdownTrigger";
|
13
|
-
import Icon from "../../pb_icon/_icon";
|
14
|
-
import Checkbox from "../../pb_checkbox/_checkbox";
|
15
|
-
import SectionSeparator from "../../pb_section_separator/_section_separator";
|
16
|
-
import Tooltip from "../../pb_tooltip/_tooltip";
|
17
|
-
|
18
|
-
import {
|
19
|
-
showActionBar,
|
20
|
-
hideActionBar,
|
21
|
-
} from "../Utilities/ActionBarAnimationHelper";
|
22
|
-
import { GenericObject } from "../../types";
|
6
|
+
import { showActionBar, hideActionBar } from "../Utilities/ActionBarAnimationHelper";
|
23
7
|
|
24
8
|
interface TableActionBarProps {
|
25
|
-
isVisible: boolean
|
9
|
+
isVisible: boolean;
|
26
10
|
selectedCount: number;
|
27
11
|
actions?: React.ReactNode[] | React.ReactNode;
|
28
|
-
type?: string;
|
29
|
-
}
|
30
|
-
|
31
|
-
interface VisibilityNode {
|
32
|
-
id?: string | undefined;
|
33
|
-
label?: string | undefined;
|
34
|
-
children?: VisibilityNode[];
|
35
12
|
}
|
36
13
|
|
37
14
|
const TableActionBar: React.FC<TableActionBarProps> = ({
|
38
15
|
isVisible,
|
39
16
|
selectedCount,
|
40
|
-
actions
|
41
|
-
type = "row-selection",
|
17
|
+
actions
|
42
18
|
}) => {
|
43
19
|
const cardRef = useRef(null);
|
44
|
-
const { table, columnVisibilityControl, columnDefinitions } =
|
45
|
-
useContext(AdvancedTableContext);
|
46
|
-
|
47
|
-
// ----------- Column visibility logic -----------
|
48
|
-
const includeIds = columnVisibilityControl?.includeIds;
|
49
|
-
const firstLeafId = table.getAllLeafColumns()[0]?.id;
|
50
|
-
// Get the first leaf column ID to exclude it from the visibility tree
|
51
|
-
// This is to avoid showing the first column in the dropdown
|
52
|
-
// as toggling it's visibility breaks the expanded row functionality
|
53
|
-
const tree = buildVisibilityTree(columnDefinitions, includeIds).filter(node => node.id !== firstLeafId);
|
54
|
-
|
55
|
-
const renderLeaf = (id: string, label: string) => {
|
56
|
-
const col = table.getColumn(id);
|
57
|
-
const show = col.getIsVisible();
|
58
|
-
|
59
|
-
return (
|
60
|
-
<Checkbox
|
61
|
-
checked={show}
|
62
|
-
key={id}
|
63
|
-
onChange={() => col.toggleVisibility()}
|
64
|
-
paddingBottom="xs"
|
65
|
-
text={label}
|
66
|
-
/>
|
67
|
-
);
|
68
|
-
};
|
69
|
-
|
70
|
-
const gatherLeafIds = (node: VisibilityNode): string[] =>
|
71
|
-
node.children && node.children.length
|
72
|
-
? node.children.flatMap(gatherLeafIds)
|
73
|
-
: node.id
|
74
|
-
? [node.id]
|
75
|
-
: [];
|
76
|
-
|
77
|
-
const renderGroup = (node: VisibilityNode ) => {
|
78
|
-
const leaves = gatherLeafIds(node);
|
79
|
-
const visibleArray = leaves.map((id) => table.getColumn(id).getIsVisible());
|
80
|
-
const allOn = visibleArray.every(Boolean);
|
81
|
-
const someOn = visibleArray.some(Boolean);
|
82
|
-
|
83
|
-
return (
|
84
|
-
<>
|
85
|
-
<Checkbox
|
86
|
-
checked={allOn}
|
87
|
-
indeterminate={!allOn && someOn}
|
88
|
-
onChange={() =>
|
89
|
-
leaves.forEach((id) =>
|
90
|
-
table.getColumn(id).toggleVisibility(!allOn),
|
91
|
-
)
|
92
|
-
}
|
93
|
-
paddingBottom="xs"
|
94
|
-
text={node.label}
|
95
|
-
/>
|
96
|
-
<Flex flexDirection="column"
|
97
|
-
paddingLeft="lg"
|
98
|
-
>
|
99
|
-
{node?.children?.map((child) =>
|
100
|
-
child.children ? renderGroup(child) : renderLeaf(child.id, child.label),
|
101
|
-
)}
|
102
|
-
</Flex>
|
103
|
-
</>
|
104
|
-
);
|
105
|
-
};
|
106
|
-
// ------------ End of column visibility logic --------
|
107
20
|
|
108
21
|
useEffect(() => {
|
109
|
-
if (cardRef.current
|
22
|
+
if (cardRef.current) {
|
110
23
|
if (isVisible) {
|
111
24
|
showActionBar(cardRef.current);
|
112
25
|
} else {
|
@@ -118,68 +31,22 @@ const TableActionBar: React.FC<TableActionBarProps> = ({
|
|
118
31
|
return (
|
119
32
|
<Card
|
120
33
|
borderNone={!isVisible}
|
121
|
-
className={`${
|
122
|
-
isVisible && "show-action-card row-selection-actions-card"
|
123
|
-
}`}
|
34
|
+
className={`${isVisible && "show-action-card row-selection-actions-card"}`}
|
124
35
|
htmlOptions={{ ref: cardRef as any }}
|
125
36
|
padding={`${isVisible ? "xs" : "none"}`}
|
126
37
|
>
|
127
38
|
<Flex
|
128
39
|
alignItems="center"
|
129
|
-
justify=
|
40
|
+
justify="between"
|
130
41
|
>
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
<FlexItem>{actions}</FlexItem>
|
140
|
-
</>
|
141
|
-
) : (
|
142
|
-
<Dropdown
|
143
|
-
className="column-visibility-dropdown-wrapper"
|
144
|
-
options={columnDefinitions}
|
145
|
-
>
|
146
|
-
<DropdownTrigger>
|
147
|
-
<Tooltip
|
148
|
-
placement='top'
|
149
|
-
text="Column Configuration"
|
150
|
-
zIndex={10}
|
151
|
-
>
|
152
|
-
<Icon
|
153
|
-
color="primary"
|
154
|
-
cursor="pointer"
|
155
|
-
icon="sliders-h"
|
156
|
-
/>
|
157
|
-
</Tooltip>
|
158
|
-
</DropdownTrigger>
|
159
|
-
<DropdownContainer
|
160
|
-
className="column-visibility-dropdown"
|
161
|
-
paddingTop="sm"
|
162
|
-
>
|
163
|
-
<>
|
164
|
-
<Caption
|
165
|
-
paddingBottom="sm"
|
166
|
-
text="Columns Config"
|
167
|
-
textAlign="center"
|
168
|
-
/>
|
169
|
-
<SectionSeparator paddingBottom="xs" />
|
170
|
-
{tree.map((node: VisibilityNode) => (
|
171
|
-
<Flex cursor="pointer"
|
172
|
-
flexDirection="column"
|
173
|
-
key={node.id}
|
174
|
-
paddingX="xs"
|
175
|
-
>
|
176
|
-
{node.children ? renderGroup(node) : renderLeaf(node.id, node.label)}
|
177
|
-
</Flex>
|
178
|
-
))}
|
179
|
-
</>
|
180
|
-
</DropdownContainer>
|
181
|
-
</Dropdown>
|
182
|
-
)}
|
42
|
+
<Caption
|
43
|
+
color="light"
|
44
|
+
paddingLeft="xs"
|
45
|
+
size="xs"
|
46
|
+
>
|
47
|
+
{selectedCount} Selected
|
48
|
+
</Caption>
|
49
|
+
<FlexItem>{actions}</FlexItem>
|
183
50
|
</Flex>
|
184
51
|
</Card>
|
185
52
|
);
|
@@ -79,26 +79,9 @@ export const TableHeaderCell = ({
|
|
79
79
|
header?.column.getLeafColumns().length === 1 &&
|
80
80
|
header?.column.getLeafColumns()[0].id === header.column.id
|
81
81
|
|
82
|
-
const
|
83
|
-
|
84
|
-
(
|
85
|
-
col.columns.some((child: any) => columnHasVisibleLeaf(child)));
|
86
|
-
|
87
|
-
// Check on column position in stack + visibility to add the vertical border
|
88
|
-
const isLastHeaderCell = (() => {
|
89
|
-
if (!header) return false;
|
90
|
-
|
91
|
-
if (header.colSpan > 1 && header.column.parent !== undefined) return true;
|
92
|
-
|
93
|
-
const parent = header.column.parent;
|
94
|
-
|
95
|
-
if (!parent) {
|
96
|
-
const topHeaders = table?.getHeaderGroups()[0].headers.filter((h: any) => columnHasVisibleLeaf(h.column));
|
97
|
-
return topHeaders?.at(-1)?.id === header.id;
|
98
|
-
}
|
99
|
-
const visibleSiblings = parent.columns.filter(columnHasVisibleLeaf);
|
100
|
-
return visibleSiblings.at(-1) === header.column;
|
101
|
-
})();
|
82
|
+
const isLastHeaderCell =
|
83
|
+
header?.column.parent?.columns.at(-1) === header?.column ||
|
84
|
+
(header?.colSpan > 1 && header?.column.parent !== undefined);
|
102
85
|
|
103
86
|
const cellClassName = classnames(
|
104
87
|
"table-header-cells",
|
@@ -26,8 +26,6 @@ interface UseTableStateProps {
|
|
26
26
|
virtualizedRows?: boolean;
|
27
27
|
tableOptions?: GenericObject;
|
28
28
|
onRowSelectionChange?: (arg: RowSelectionState) => void;
|
29
|
-
columnVisibilityControl?: GenericObject;
|
30
|
-
|
31
29
|
}
|
32
30
|
|
33
31
|
export function useTableState({
|
@@ -42,19 +40,16 @@ export function useTableState({
|
|
42
40
|
pagination = false,
|
43
41
|
paginationProps,
|
44
42
|
virtualizedRows = false,
|
45
|
-
tableOptions
|
46
|
-
columnVisibilityControl
|
43
|
+
tableOptions
|
47
44
|
}: UseTableStateProps) {
|
48
45
|
// Create a local state for expanded and setExpanded if expandedControl not used
|
49
46
|
const [localExpanded, setLocalExpanded] = useState({});
|
50
47
|
const [loadingStateRowCount, setLoadingStateRowCount] = useState(initialLoadingRowsCount);
|
51
48
|
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
|
52
|
-
|
49
|
+
|
53
50
|
// Determine whether to use the prop or the local state
|
54
51
|
const expanded = expandedControl ? expandedControl.value : localExpanded;
|
55
52
|
const setExpanded = expandedControl ? expandedControl.onChange : setLocalExpanded;
|
56
|
-
const columnVisibility = (columnVisibilityControl && columnVisibilityControl.value) ? columnVisibilityControl.value : localColumnVisibility;
|
57
|
-
const setColumnVisibility = (columnVisibilityControl && columnVisibilityControl.onChange) ? columnVisibilityControl.onChange : setLocalColumnVisibility;
|
58
53
|
|
59
54
|
// Virtualized data handling (chunked loading)
|
60
55
|
const fetchSize = 20; // Number of rows per "page"
|
@@ -109,21 +104,17 @@ export function useTableState({
|
|
109
104
|
}]), [columnDefinitions, sortControl]);
|
110
105
|
|
111
106
|
// Custom state based on features enabled
|
112
|
-
const customState = useCallback(() =>
|
113
|
-
|
114
|
-
expanded,
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
selectableRows,
|
124
|
-
rowSelection,
|
125
|
-
columnVisibility,
|
126
|
-
]);
|
107
|
+
const customState = useCallback(() => {
|
108
|
+
if (sortControl && selectableRows) {
|
109
|
+
return { state: { expanded, sorting, rowSelection } };
|
110
|
+
} else if (sortControl) {
|
111
|
+
return { state: { expanded, sorting } };
|
112
|
+
} else if (selectableRows) {
|
113
|
+
return { state: { expanded, rowSelection } };
|
114
|
+
} else {
|
115
|
+
return { state: { expanded } };
|
116
|
+
}
|
117
|
+
}, [expanded, rowSelection, sortControl, selectableRows, sorting]);
|
127
118
|
|
128
119
|
// Pagination configuration
|
129
120
|
const paginationInitializer = useMemo(() => {
|
@@ -154,7 +145,6 @@ export function useTableState({
|
|
154
145
|
sortDescFirst: true,
|
155
146
|
onRowSelectionChange: setRowSelection,
|
156
147
|
getRowId: selectableRows ? row => row.id : undefined,
|
157
|
-
onColumnVisibilityChange: setColumnVisibility,
|
158
148
|
meta: {
|
159
149
|
columnDefinitions
|
160
150
|
},
|
@@ -53,15 +53,6 @@
|
|
53
53
|
width: 100%;
|
54
54
|
}
|
55
55
|
|
56
|
-
.column-visibility-dropdown-wrapper {
|
57
|
-
position: unset !important;
|
58
|
-
}
|
59
|
-
.column-visibility-dropdown {
|
60
|
-
width: unset !important;
|
61
|
-
right: $space_xxs;
|
62
|
-
text-align: left;
|
63
|
-
}
|
64
|
-
|
65
56
|
// Virtualized table styles
|
66
57
|
.virtualized-table-row {
|
67
58
|
display: table !important;
|
@@ -35,7 +35,6 @@ type AdvancedTableProps = {
|
|
35
35
|
className?: string
|
36
36
|
columnDefinitions: GenericObject[]
|
37
37
|
columnGroupBorderColor?: "text_lt_default" | "text_lt_light" | "text_lt_lighter" | "text_dk_default" | "text_dk_light" | "text_dk_lighter"
|
38
|
-
columnVisibilityControl?: GenericObject
|
39
38
|
dark?: boolean
|
40
39
|
data?: { [key: string]: string }
|
41
40
|
enableToggleExpansion?: "all" | "header" | "none"
|
@@ -74,7 +73,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
74
73
|
className,
|
75
74
|
columnDefinitions,
|
76
75
|
columnGroupBorderColor,
|
77
|
-
columnVisibilityControl,
|
78
76
|
dark = false,
|
79
77
|
data = {},
|
80
78
|
enableToggleExpansion = "header",
|
@@ -134,8 +132,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
134
132
|
paginationProps,
|
135
133
|
virtualizedRows,
|
136
134
|
tableOptions,
|
137
|
-
onRowSelectionChange
|
138
|
-
columnVisibilityControl,
|
135
|
+
onRowSelectionChange
|
139
136
|
});
|
140
137
|
|
141
138
|
// Initialize table actions
|
@@ -255,7 +252,7 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
255
252
|
: {};
|
256
253
|
|
257
254
|
// Visibility flag for action bar
|
258
|
-
const isActionBarVisible =
|
255
|
+
const isActionBarVisible = selectableRows && showActionsBar && selectedRowsLength > 0;
|
259
256
|
|
260
257
|
return (
|
261
258
|
<>
|
@@ -289,7 +286,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
289
286
|
<AdvancedTableProvider
|
290
287
|
columnDefinitions={columnDefinitions}
|
291
288
|
columnGroupBorderColor={columnGroupBorderColor}
|
292
|
-
columnVisibilityControl={columnVisibilityControl}
|
293
289
|
enableToggleExpansion={enableToggleExpansion}
|
294
290
|
enableVirtualization={virtualizedRows}
|
295
291
|
expandByDepth={expandByDepth}
|
@@ -320,7 +316,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
320
316
|
actions={actions}
|
321
317
|
isVisible={isActionBarVisible}
|
322
318
|
selectedCount={selectedRowsLength}
|
323
|
-
type={columnVisibilityControl ? "column-visibility" : "row-selection"}
|
324
319
|
/>
|
325
320
|
|
326
321
|
{/* Main Table */}
|
@@ -47,7 +47,3 @@ examples:
|
|
47
47
|
- advanced_table_selectable_rows_header: Selectable Rows (No Actions Bar)
|
48
48
|
- advanced_table_inline_editing: Inline Cell Editing
|
49
49
|
- advanced_table_fullscreen: Fullscreen
|
50
|
-
- advanced_table_column_visibility: Column Visibility Control
|
51
|
-
- advanced_table_column_visibility_with_state: Column Visibility Control With State
|
52
|
-
- advanced_table_column_visibility_custom: Column Visibility Control with Custom Dropdown
|
53
|
-
- advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
|
@@ -27,8 +27,4 @@ export { default as AdvancedTableStickyColumns } from './_advanced_table_sticky_
|
|
27
27
|
export { default as AdvancedTableStickyHeader } from './_advanced_table_sticky_header.jsx'
|
28
28
|
export { default as AdvancedTableStickyColumnsAndHeader } from './_advanced_table_sticky_columns_and_header.jsx'
|
29
29
|
export { default as AdvancedTableExpandByDepth } from './_advanced_table_expand_by_depth.jsx'
|
30
|
-
export { default as AdvancedTableColumnBorderColor} from './_advanced_table_column_border_color.jsx'
|
31
|
-
export { default as AdvancedTableColumnVisibility } from './_advanced_table_column_visibility.jsx'
|
32
|
-
export { default as AdvancedTableColumnVisibilityCustom } from './_advanced_table_column_visibility_custom.jsx'
|
33
|
-
export { default as AdvancedTableColumnVisibilityMulti } from './_advanced_table_column_visibility_multi.jsx'
|
34
|
-
export { default as AdvancedTableColumnVisibilityWithState } from './_advanced_table_column_visibility_with_state.jsx'
|
30
|
+
export { default as AdvancedTableColumnBorderColor} from './_advanced_table_column_border_color.jsx'
|
@@ -6,7 +6,7 @@ import {
|
|
6
6
|
buildDataProps,
|
7
7
|
buildHtmlProps
|
8
8
|
} from "../../utilities/props";
|
9
|
-
import { globalProps
|
9
|
+
import { globalProps } from "../../utilities/globalProps";
|
10
10
|
|
11
11
|
import DropdownContext from "../context";
|
12
12
|
|
@@ -24,7 +24,7 @@ type DropdownContainerProps = {
|
|
24
24
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
25
25
|
id?: string;
|
26
26
|
searchbar?: boolean;
|
27
|
-
}
|
27
|
+
};
|
28
28
|
|
29
29
|
const DropdownContainer = (props: DropdownContainerProps) => {
|
30
30
|
const {
|
@@ -9,23 +9,10 @@
|
|
9
9
|
border: none;
|
10
10
|
width: 0;
|
11
11
|
}
|
12
|
-
&.error {
|
13
|
-
[class^='pb_card_kit'] {
|
14
|
-
border-color: $error;
|
15
|
-
}
|
16
|
-
[class^='pb_body_kit'][status="negative"] {
|
17
|
-
margin-top: $space_xs;
|
18
|
-
}
|
19
|
-
}
|
20
12
|
}
|
21
13
|
|
22
14
|
.dark [class*='pb_file_upload_kit'] {
|
23
15
|
[class*='pb_card_kit'] {
|
24
16
|
border: 1px $text_dk_lighter dashed;
|
25
17
|
}
|
26
|
-
&.error {
|
27
|
-
[class^='pb_card_kit'] {
|
28
|
-
border-color: $error_dark;
|
29
|
-
}
|
30
|
-
}
|
31
18
|
}
|
@@ -22,7 +22,6 @@ type FileUploadProps = {
|
|
22
22
|
maxSize?: number,
|
23
23
|
onFilesAccepted: Callback<File, File>,
|
24
24
|
onFilesRejected: (error: string, files: readonly FileRejection[]) => void,
|
25
|
-
error?: string,
|
26
25
|
}
|
27
26
|
|
28
27
|
const getFormattedFileSize = (fileSize: number): string => {
|
@@ -37,7 +36,6 @@ const FileUpload = (props: FileUploadProps): React.ReactElement => {
|
|
37
36
|
customMessage,
|
38
37
|
dark = false,
|
39
38
|
data = {},
|
40
|
-
error,
|
41
39
|
htmlOptions = {},
|
42
40
|
maxSize,
|
43
41
|
onFilesAccepted = noop,
|
@@ -102,7 +100,7 @@ const FileUpload = (props: FileUploadProps): React.ReactElement => {
|
|
102
100
|
|
103
101
|
return (
|
104
102
|
<div
|
105
|
-
className={classnames(buildCss('pb_file_upload_kit'),
|
103
|
+
className={classnames(buildCss('pb_file_upload_kit'), globalProps(props), className)}
|
106
104
|
{...dataProps}
|
107
105
|
{...htmlProps}
|
108
106
|
{...getRootProps()}
|
@@ -120,14 +118,6 @@ const FileUpload = (props: FileUploadProps): React.ReactElement => {
|
|
120
118
|
}
|
121
119
|
</Body>
|
122
120
|
</Card>
|
123
|
-
{error && (
|
124
|
-
<Body
|
125
|
-
dark={dark}
|
126
|
-
marginTop="xxs"
|
127
|
-
status="negative"
|
128
|
-
text={error}
|
129
|
-
/>
|
130
|
-
)}
|
131
121
|
</div>
|
132
122
|
)
|
133
123
|
}
|
@@ -3,7 +3,6 @@ examples:
|
|
3
3
|
rails:
|
4
4
|
- file_upload_default: File Upload
|
5
5
|
- file_upload_custom: Custom
|
6
|
-
- file_upload_error: Error
|
7
6
|
|
8
7
|
react:
|
9
8
|
- file_upload_default: Default List of files to upload
|
@@ -11,4 +10,3 @@ examples:
|
|
11
10
|
- file_upload_custom_message: Add a custom message
|
12
11
|
- file_upload_custom_description: Add your one accepted files description
|
13
12
|
- file_upload_max_size: Set a file size limit
|
14
|
-
- file_upload_error: Error
|
@@ -3,4 +3,3 @@ export { default as FileUploadAccept } from './_file_upload_accept.jsx'
|
|
3
3
|
export { default as FileUploadCustomMessage } from './_file_upload_custom_message.jsx'
|
4
4
|
export { default as FileUploadCustomDescription } from './_file_upload_custom_description.jsx'
|
5
5
|
export { default as FileUploadMaxSize } from './_file_upload_max_size.jsx'
|
6
|
-
export { default as FileUploadError } from './_file_upload_error.jsx'
|
@@ -21,20 +21,14 @@ module Playbook
|
|
21
21
|
prop :input_options, type: Playbook::Props::HashProp,
|
22
22
|
default: {}
|
23
23
|
|
24
|
-
prop :error, type: Playbook::Props::String
|
25
|
-
|
26
24
|
def classname
|
27
25
|
file_upload_class = generate_classname("pb_file_upload_kit")
|
28
|
-
file_upload_class +
|
26
|
+
file_upload_class + full_width_class
|
29
27
|
end
|
30
28
|
|
31
29
|
def full_width_class
|
32
30
|
full_width ? " full_width" : ""
|
33
31
|
end
|
34
|
-
|
35
|
-
def error_class
|
36
|
-
error.present? ? "_error" : ""
|
37
|
-
end
|
38
32
|
end
|
39
33
|
end
|
40
34
|
end
|
@@ -50,21 +50,3 @@ test('displays custom message', () => {
|
|
50
50
|
const kit = screen.getByTestId(testid)
|
51
51
|
expect(kit).toHaveTextContent('Hello world!')
|
52
52
|
})
|
53
|
-
|
54
|
-
test('handles error state with error prop', () => {
|
55
|
-
const errorText = "Test error message"
|
56
|
-
render(
|
57
|
-
<FileUpload
|
58
|
-
data={{ testid: testid }}
|
59
|
-
error={errorText}
|
60
|
-
/>
|
61
|
-
)
|
62
|
-
|
63
|
-
const kit = screen.getByTestId(testid)
|
64
|
-
|
65
|
-
expect(kit).toHaveClass('pb_file_upload_kit')
|
66
|
-
expect(kit).toHaveClass('error')
|
67
|
-
|
68
|
-
const errorElement = screen.getByText(errorText)
|
69
|
-
expect(errorElement).toBeInTheDocument()
|
70
|
-
})
|
@@ -81,11 +81,6 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
|
|
81
81
|
|
82
82
|
const formatStreetAdr = (address: string): string => preserveCase ? address : titleize(address)
|
83
83
|
|
84
|
-
const uppercaseState = state?.toUpperCase() ?? ''
|
85
|
-
|
86
|
-
const fields = [address, addressCont, city, homeId, homeUrl, houseStyle, state, territory, zipcode]
|
87
|
-
const hasAllEmptyProps = fields.every(field => field === undefined || field === null || field === '')
|
88
|
-
|
89
84
|
return (
|
90
85
|
<div
|
91
86
|
className={classes(className, dark)}
|
@@ -93,8 +88,7 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
|
|
93
88
|
{...dataProps}
|
94
89
|
{...htmlProps}
|
95
90
|
>
|
96
|
-
{
|
97
|
-
{emphasis == 'street' && !hasAllEmptyProps &&
|
91
|
+
{emphasis == 'street' &&
|
98
92
|
<div>
|
99
93
|
<Title
|
100
94
|
className="pb_home_address_street_address"
|
@@ -111,11 +105,11 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
|
|
111
105
|
{titleize(addressCont)}
|
112
106
|
</Title>
|
113
107
|
<Body color="light">
|
114
|
-
{`${
|
108
|
+
{`${titleize(city)}, ${state.toUpperCase()} ${zipcode}`}
|
115
109
|
</Body>
|
116
110
|
</div>
|
117
111
|
}
|
118
|
-
{emphasis == 'city' &&
|
112
|
+
{emphasis == 'city' &&
|
119
113
|
<div>
|
120
114
|
<Body color="light">
|
121
115
|
{joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
|
@@ -128,18 +122,18 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
|
|
128
122
|
size={4}
|
129
123
|
tag="span"
|
130
124
|
>
|
131
|
-
{`${
|
125
|
+
{`${titleize(city)}, ${state.toUpperCase()}`}
|
132
126
|
</Title>
|
133
127
|
<Body
|
134
128
|
color="light"
|
135
129
|
tag="span"
|
136
130
|
>
|
137
|
-
{` ${zipcode
|
131
|
+
{` ${zipcode}`}
|
138
132
|
</Body>
|
139
133
|
</div>
|
140
134
|
</div>
|
141
135
|
}
|
142
|
-
{emphasis == 'none' &&
|
136
|
+
{emphasis == 'none' &&
|
143
137
|
<div>
|
144
138
|
<Body dark={dark}>
|
145
139
|
{joinPresent([formatStreetAdr(address), houseStyle], ' · ')}
|
@@ -150,7 +144,7 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
|
|
150
144
|
color="light"
|
151
145
|
dark={dark}
|
152
146
|
>
|
153
|
-
{`${
|
147
|
+
{`${titleize(city)}, ${state.toUpperCase()} ${zipcode}`}
|
154
148
|
</Body>
|
155
149
|
</div>
|
156
150
|
</div>
|