playbook_ui 14.10.0.pre.alpha.play1465attempt25272 → 14.10.0.pre.alpha.play1662cssbargraph5193
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/_advanced_table.scss +16 -11
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +1 -8
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -4
- data/app/pb_kits/playbook/pb_advanced_table/index.js +95 -143
- data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +8 -50
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +14 -17
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +0 -78
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +3 -4
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +2 -7
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +6 -2
- data/app/pb_kits/playbook/pb_card/_card.scss +3 -21
- data/app/pb_kits/playbook/pb_card/docs/_card_header.html.erb +0 -18
- data/app/pb_kits/playbook/pb_card/docs/_card_header.jsx +0 -40
- data/app/pb_kits/playbook/pb_dashboard/BarGraphStyles.scss +53 -0
- data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss +13 -1
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.scss +1 -64
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +1 -3
- data/app/pb_kits/playbook/pb_section_separator/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_section_separator/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_section_separator/section_separator.rb +1 -4
- data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.scss +2 -2
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_filter.jsx +2 -10
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.jsx +2 -6
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_user.jsx +3 -11
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/example.yml +2 -7
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.html.erb +12 -8
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb +1 -48
- data/app/pb_kits/playbook/pb_table/_table.tsx +18 -67
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.jsx +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_rails.md +0 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_react.md +1 -4
- data/app/pb_kits/playbook/pb_table/index.ts +17 -17
- data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +2 -38
- data/app/pb_kits/playbook/pb_table/styles/_sticky_columns.scss +3 -17
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +2 -3
- data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +4 -12
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +1 -5
- data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +3 -8
- data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +1 -6
- data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +6 -21
- data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +6 -13
- data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +3 -7
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +0 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +2 -4
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +5 -5
- data/dist/chunks/{_typeahead-BhT5aXCY.js → _typeahead-BXXEtXbz.js} +3 -3
- data/dist/chunks/_weekday_stacked-D0yBvHBb.js +45 -0
- data/dist/chunks/{lib-B7sgJtGS.js → lib-sMFo2JZy.js} +1 -1
- data/dist/chunks/{pb_form_validation-C5Cc0-1v.js → pb_form_validation-CgvjWbOK.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +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 +9 -26
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers.html.erb +0 -43
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_multiple.html.erb +0 -58
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.html.erb +0 -10
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.jsx +0 -42
- data/app/pb_kits/playbook/pb_section_separator/docs/_section_separator_color.md +0 -3
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_description.md +0 -3
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.html.erb +0 -9
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius_rails.md +0 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.html.erb +0 -7
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_filter.html.erb +0 -119
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.html.erb +0 -15
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width_rails.md +0 -3
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.html.erb +0 -3
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_user.html.erb +0 -63
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.jsx +0 -88
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_react.md +0 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.jsx +0 -87
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_react.md +0 -5
- data/dist/chunks/_weekday_stacked-DJOTNDSY.js +0 -45
- /data/app/pb_kits/playbook/pb_skeleton_loading/docs/{_skeleton_loading_border_radius_react.md → _skeleton_loading_border_radius.md} +0 -0
- /data/app/pb_kits/playbook/pb_skeleton_loading/docs/{_skeleton_loading_height_width_react.md → _skeleton_loading_height_width.md} +0 -0
@@ -28,8 +28,7 @@ type TableProps = {
|
|
28
28
|
singleLine?: boolean,
|
29
29
|
size?: "sm" | "md" | "lg",
|
30
30
|
sticky?: boolean,
|
31
|
-
|
32
|
-
stickyRightColumn?: string[],
|
31
|
+
stickyLeftcolumn?: string[],
|
33
32
|
striped?: boolean,
|
34
33
|
tag?: "table" | "div",
|
35
34
|
verticalBorder?: boolean,
|
@@ -53,8 +52,7 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
53
52
|
singleLine = false,
|
54
53
|
size = 'sm',
|
55
54
|
sticky = false,
|
56
|
-
|
57
|
-
stickyRightColumn= [],
|
55
|
+
stickyLeftcolumn = [],
|
58
56
|
striped = false,
|
59
57
|
tag = 'table',
|
60
58
|
verticalBorder = false,
|
@@ -81,8 +79,7 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
81
79
|
'single-line': singleLine,
|
82
80
|
'no-hover': disableHover,
|
83
81
|
'sticky-header': sticky,
|
84
|
-
'sticky-left-column':
|
85
|
-
'sticky-right-column': stickyRightColumn,
|
82
|
+
'sticky-left-column': stickyLeftcolumn,
|
86
83
|
'striped': striped,
|
87
84
|
[outerPaddingCss]: outerPadding !== '',
|
88
85
|
},
|
@@ -93,12 +90,11 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
93
90
|
)
|
94
91
|
|
95
92
|
useEffect(() => {
|
96
|
-
const
|
97
|
-
if (!stickyLeftColumn.length) return;
|
93
|
+
const handleStickyColumns = () => {
|
98
94
|
let accumulatedWidth = 0;
|
99
95
|
|
100
|
-
|
101
|
-
const isLastColumn = index ===
|
96
|
+
stickyLeftcolumn.forEach((colId, index) => {
|
97
|
+
const isLastColumn = index === stickyLeftcolumn.length - 1;
|
102
98
|
const header = document.querySelector(`th[id="${colId}"]`);
|
103
99
|
const cells = document.querySelectorAll(`td[id="${colId}"]`);
|
104
100
|
|
@@ -107,11 +103,11 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
107
103
|
(header as HTMLElement).style.left = `${accumulatedWidth}px`;
|
108
104
|
|
109
105
|
if (!isLastColumn) {
|
110
|
-
header.classList.add('with-border
|
111
|
-
header.classList.remove('sticky-
|
106
|
+
header.classList.add('with-border');
|
107
|
+
header.classList.remove('sticky-shadow');
|
112
108
|
} else {
|
113
|
-
header.classList.remove('with-border
|
114
|
-
header.classList.add('sticky-
|
109
|
+
header.classList.remove('with-border');
|
110
|
+
header.classList.add('sticky-shadow');
|
115
111
|
}
|
116
112
|
|
117
113
|
accumulatedWidth += (header as HTMLElement).offsetWidth;
|
@@ -122,71 +118,26 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
122
118
|
(cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
|
123
119
|
|
124
120
|
if (!isLastColumn) {
|
125
|
-
cell.classList.add('with-border
|
126
|
-
cell.classList.remove('sticky-
|
121
|
+
cell.classList.add('with-border');
|
122
|
+
cell.classList.remove('sticky-shadow');
|
127
123
|
} else {
|
128
|
-
cell.classList.remove('with-border
|
129
|
-
cell.classList.add('sticky-
|
124
|
+
cell.classList.remove('with-border');
|
125
|
+
cell.classList.add('sticky-shadow');
|
130
126
|
}
|
131
127
|
});
|
132
128
|
});
|
133
129
|
};
|
134
130
|
|
135
131
|
setTimeout(() => {
|
136
|
-
|
132
|
+
handleStickyColumns();
|
137
133
|
}, 10);
|
138
134
|
|
139
|
-
window.addEventListener('resize',
|
135
|
+
window.addEventListener('resize', handleStickyColumns);
|
140
136
|
|
141
137
|
return () => {
|
142
|
-
window.removeEventListener('resize',
|
138
|
+
window.removeEventListener('resize', handleStickyColumns);
|
143
139
|
};
|
144
|
-
}, [
|
145
|
-
|
146
|
-
useEffect(() => {
|
147
|
-
const handleStickyRightColumns = () => {
|
148
|
-
if (!stickyRightColumn.length) return;
|
149
|
-
let accumulatedWidth = 0;
|
150
|
-
|
151
|
-
stickyRightColumn.reverse().forEach((colId, index) => {
|
152
|
-
const isLastColumn = index === stickyRightColumn.length - 1;
|
153
|
-
const header = document.querySelector(`th[id="${colId}"]`);
|
154
|
-
const cells = document.querySelectorAll(`td[id="${colId}"]`);
|
155
|
-
|
156
|
-
if (header) {
|
157
|
-
header.classList.add('sticky');
|
158
|
-
(header as HTMLElement).style.right = `${accumulatedWidth}px`;
|
159
|
-
|
160
|
-
if (!isLastColumn) {
|
161
|
-
header.classList.add('with-border-left');
|
162
|
-
header.classList.remove('sticky-right-shadow');
|
163
|
-
} else {
|
164
|
-
header.classList.remove('with-border-left');
|
165
|
-
header.classList.add('sticky-right-shadow');
|
166
|
-
}
|
167
|
-
|
168
|
-
accumulatedWidth += (header as HTMLElement).offsetWidth;
|
169
|
-
}
|
170
|
-
|
171
|
-
cells.forEach((cell) => {
|
172
|
-
cell.classList.add('sticky');
|
173
|
-
(cell as HTMLElement).style.right = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
|
174
|
-
|
175
|
-
if (!isLastColumn) {
|
176
|
-
cell.classList.add('with-border-left');
|
177
|
-
cell.classList.remove('sticky-right-shadow');
|
178
|
-
} else {
|
179
|
-
cell.classList.remove('with-border-left');
|
180
|
-
cell.classList.add('sticky-right-shadow');
|
181
|
-
}
|
182
|
-
});
|
183
|
-
});
|
184
|
-
};
|
185
|
-
|
186
|
-
setTimeout(() => {
|
187
|
-
handleStickyRightColumns();
|
188
|
-
}, 10);
|
189
|
-
}, [stickyRightColumn]);
|
140
|
+
}, [stickyLeftcolumn]);
|
190
141
|
|
191
142
|
useEffect(() => {
|
192
143
|
const instance = new PbTable()
|
@@ -1,3 +1 @@
|
|
1
1
|
The `stickyLeftColumn` prop expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
|
2
|
-
|
3
|
-
Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using the `stickyLeftColumn`.
|
@@ -1,5 +1,2 @@
|
|
1
1
|
The `stickyLeftColumn` prop expects an array of the column ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
|
2
|
-
|
3
|
-
If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
|
4
|
-
|
5
|
-
Please ensure that unique ids are used for all columns across multiple tables. Using the same columns ids on multiple tables can lead to issues when using `stickyLeftColumn` prop.
|
2
|
+
If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
|
@@ -2,7 +2,7 @@ import PbEnhancedElement from '../pb_enhanced_element'
|
|
2
2
|
|
3
3
|
export default class PbTable extends PbEnhancedElement {
|
4
4
|
private stickyLeftColumns: string[] = [];
|
5
|
-
private
|
5
|
+
private handleStickyColumnsRef: () => void;
|
6
6
|
|
7
7
|
static get selector(): string {
|
8
8
|
return '.table-responsive-collapse'
|
@@ -31,10 +31,10 @@ export default class PbTable extends PbEnhancedElement {
|
|
31
31
|
});
|
32
32
|
|
33
33
|
// New sticky columns logic
|
34
|
-
this.
|
34
|
+
this.initStickyColumns();
|
35
35
|
}
|
36
36
|
|
37
|
-
private
|
37
|
+
private initStickyColumns(): void {
|
38
38
|
// Find tables with sticky-left-column class
|
39
39
|
const tables = document.querySelectorAll('.sticky-left-column');
|
40
40
|
|
@@ -52,16 +52,16 @@ export default class PbTable extends PbEnhancedElement {
|
|
52
52
|
|
53
53
|
if (this.stickyLeftColumns.length > 0) {
|
54
54
|
setTimeout(() => {
|
55
|
-
this.
|
56
|
-
this.
|
57
|
-
window.addEventListener('resize', this.
|
55
|
+
this.handleStickyColumnsRef = this.handleStickyColumns.bind(this);
|
56
|
+
this.handleStickyColumns();
|
57
|
+
window.addEventListener('resize', this.handleStickyColumnsRef);
|
58
58
|
}, 10);
|
59
59
|
}
|
60
60
|
}
|
61
61
|
});
|
62
62
|
}
|
63
63
|
|
64
|
-
private
|
64
|
+
private handleStickyColumns(): void {
|
65
65
|
let accumulatedWidth = 0;
|
66
66
|
|
67
67
|
this.stickyLeftColumns.forEach((colId, index) => {
|
@@ -74,11 +74,11 @@ export default class PbTable extends PbEnhancedElement {
|
|
74
74
|
(header as HTMLElement).style.left = `${accumulatedWidth}px`;
|
75
75
|
|
76
76
|
if (!isLastColumn) {
|
77
|
-
header.classList.add('with-border
|
78
|
-
header.classList.remove('sticky-
|
77
|
+
header.classList.add('with-border');
|
78
|
+
header.classList.remove('sticky-shadow');
|
79
79
|
} else {
|
80
|
-
header.classList.remove('with-border
|
81
|
-
header.classList.add('sticky-
|
80
|
+
header.classList.remove('with-border');
|
81
|
+
header.classList.add('sticky-shadow');
|
82
82
|
}
|
83
83
|
|
84
84
|
accumulatedWidth += (header as HTMLElement).offsetWidth;
|
@@ -89,11 +89,11 @@ export default class PbTable extends PbEnhancedElement {
|
|
89
89
|
(cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
|
90
90
|
|
91
91
|
if (!isLastColumn) {
|
92
|
-
cell.classList.add('with-border
|
93
|
-
cell.classList.remove('sticky-
|
92
|
+
cell.classList.add('with-border');
|
93
|
+
cell.classList.remove('sticky-shadow');
|
94
94
|
} else {
|
95
|
-
cell.classList.remove('with-border
|
96
|
-
cell.classList.add('sticky-
|
95
|
+
cell.classList.remove('with-border');
|
96
|
+
cell.classList.add('sticky-shadow');
|
97
97
|
}
|
98
98
|
});
|
99
99
|
});
|
@@ -101,8 +101,8 @@ export default class PbTable extends PbEnhancedElement {
|
|
101
101
|
|
102
102
|
// Cleanup method to remove event listener
|
103
103
|
disconnect(): void {
|
104
|
-
if (this.
|
105
|
-
window.removeEventListener('resize', this.
|
104
|
+
if (this.handleStickyColumnsRef) {
|
105
|
+
window.removeEventListener('resize', this.handleStickyColumnsRef);
|
106
106
|
}
|
107
107
|
}
|
108
108
|
}
|
@@ -4,48 +4,12 @@
|
|
4
4
|
display: block;
|
5
5
|
overflow-x: scroll;
|
6
6
|
|
7
|
-
// hides duplicate scroll bar for those that see two (byproduct of repeated table-responsive-scroll class
|
8
|
-
// hides outer scroll bar in chrome and safari
|
9
|
-
&:not(.table-responsive-scroll .table-responsive-scroll) {
|
10
|
-
&::-webkit-scrollbar {
|
11
|
-
height: 0px;
|
12
|
-
}
|
13
|
-
}
|
14
|
-
// hides outer scroll bar in firefox
|
15
|
-
@supports (scrollbar-width: none) {
|
16
|
-
scrollbar-width: none;
|
17
|
-
.pb_table {
|
18
|
-
overflow-x: auto;
|
19
|
-
scrollbar-width: auto;
|
20
|
-
}
|
21
|
-
}
|
22
|
-
// ensures visible inner scroll bar can scroll
|
23
|
-
.pb_table {
|
24
|
-
overflow-x: auto;
|
25
|
-
}
|
26
|
-
|
27
7
|
// Responsive Styles
|
28
8
|
@media (max-width: 1600px) {
|
29
9
|
&[class*="table-responsive-scroll"] {
|
30
10
|
border-radius: 4px;
|
31
|
-
box-shadow: 1px 0 0 0px $border_light
|
32
|
-
|
33
|
-
}
|
34
|
-
|
35
|
-
&[class^=pb_table].table-sm.table-card thead tr th:first-child,
|
36
|
-
&[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:first-child {
|
37
|
-
border-left-width: 0px;
|
38
|
-
}
|
39
|
-
|
40
|
-
&[class^=pb_table].table-md.table-card thead tr th:first-child,
|
41
|
-
&[class^=pb_table].table-md:not(.no-hover).table-card tbody tr td:first-child {
|
42
|
-
border-left-width: 0px;
|
43
|
-
}
|
44
|
-
|
45
|
-
&[class^=pb_table].table-lg.table-card thead tr th:first-child,
|
46
|
-
&[class^=pb_table].table-lg:not(.no-hover).table-card tbody tr td:first-child {
|
47
|
-
border-left-width: 0px;
|
48
|
-
}
|
11
|
+
box-shadow: 1px 0 0 0px $border_light
|
12
|
+
}
|
49
13
|
|
50
14
|
&[class^=pb_table].table-sm.table-card thead tr th:last-child,
|
51
15
|
&[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:last-child {
|
@@ -7,25 +7,11 @@
|
|
7
7
|
background-color: white;
|
8
8
|
}
|
9
9
|
|
10
|
-
|
11
|
-
.sticky-left-shadow {
|
12
|
-
box-shadow: 4px 0 10px rgba(60, 106, 172, 0.16) !important;
|
13
|
-
left: 0;
|
14
|
-
}
|
15
|
-
|
16
|
-
.with-border-right {
|
10
|
+
.with-border {
|
17
11
|
border-right: 1px solid $border_light !important;
|
18
|
-
left: 0;
|
19
12
|
}
|
20
13
|
|
21
|
-
|
22
|
-
|
23
|
-
box-shadow: -4px 0 10px rgba(60, 106, 172, 0.16) !important;
|
24
|
-
right: 0;
|
25
|
-
}
|
26
|
-
|
27
|
-
.with-border-left {
|
28
|
-
border-left: 1px solid $border_light !important;
|
29
|
-
right: 0;
|
14
|
+
.sticky-shadow {
|
15
|
+
box-shadow: 4px 0 10px rgba(60, 106, 172, 0.16) !important;
|
30
16
|
}
|
31
17
|
}
|
@@ -42,8 +42,8 @@ type TypeaheadProps = {
|
|
42
42
|
id?: string,
|
43
43
|
label?: string,
|
44
44
|
loadOptions?: string | Noop,
|
45
|
-
getOptionLabel?: string | (() =>
|
46
|
-
getOptionValue?: string | (() =>
|
45
|
+
getOptionLabel?: string | (() => any),
|
46
|
+
getOptionValue?: string | (() => any),
|
47
47
|
name?: string,
|
48
48
|
marginBottom?: "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
|
49
49
|
pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
|
@@ -109,7 +109,6 @@ const Typeahead = ({
|
|
109
109
|
multiKit: '',
|
110
110
|
onCreateOption: null as null,
|
111
111
|
plusIcon: false,
|
112
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
113
112
|
onMultiValueClick: (_option: SelectValueType): any => undefined,
|
114
113
|
pillColor: pillColor,
|
115
114
|
...props,
|
@@ -1,24 +1,16 @@
|
|
1
1
|
import React, { useEffect } from 'react'
|
2
2
|
import { components } from 'react-select'
|
3
3
|
|
4
|
-
|
5
|
-
children: React.ReactNode,
|
6
|
-
selectProps?: {
|
7
|
-
id: string,
|
8
|
-
},
|
9
|
-
clearValue: () => void,
|
10
|
-
}
|
11
|
-
|
12
|
-
const ClearContainer = (props: ClearContainerProps): React.ReactElement => {
|
4
|
+
const ClearContainer = (props: any) => {
|
13
5
|
const { selectProps, clearValue } = props
|
14
6
|
useEffect(() => {
|
15
7
|
document.addEventListener(`pb-typeahead-kit-${selectProps.id}:clear`, clearValue)
|
16
|
-
}, [
|
8
|
+
}, [true])
|
17
9
|
|
18
10
|
return (
|
19
11
|
<components.ClearIndicator
|
20
|
-
|
21
|
-
|
12
|
+
className="clear_indicator"
|
13
|
+
{...props}
|
22
14
|
/>
|
23
15
|
)
|
24
16
|
}
|
@@ -5,11 +5,7 @@ import Flex from '../../pb_flex/_flex'
|
|
5
5
|
import TextInput from '../../pb_text_input/_text_input'
|
6
6
|
|
7
7
|
type Props = {
|
8
|
-
|
9
|
-
dark?: boolean,
|
10
|
-
label: string,
|
11
|
-
error?: string,
|
12
|
-
},
|
8
|
+
selectProps: any,
|
13
9
|
}
|
14
10
|
|
15
11
|
const TypeaheadControl = (props: Props) => (
|
@@ -1,15 +1,10 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { components } from 'react-select'
|
3
3
|
|
4
|
-
|
5
|
-
children: React.ReactNode,
|
6
|
-
}
|
7
|
-
|
8
|
-
|
9
|
-
const IndicatorsContainer = (props: IndicatorsContainerProps): React.ReactElement => (
|
4
|
+
const IndicatorsContainer = (props: any) => (
|
10
5
|
<components.IndicatorsContainer
|
11
|
-
|
12
|
-
|
6
|
+
className="text_input_indicators"
|
7
|
+
{...props}
|
13
8
|
/>
|
14
9
|
)
|
15
10
|
|
@@ -1,12 +1,7 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { components } from 'react-select'
|
3
3
|
|
4
|
-
|
5
|
-
children: React.ReactNode,
|
6
|
-
footer: React.ReactNode,
|
7
|
-
}
|
8
|
-
|
9
|
-
const MenuList = (props: MenuListProps): React.ReactElement => {
|
4
|
+
const MenuList = (props: any) => {
|
10
5
|
return (
|
11
6
|
<components.MenuList {...props}>
|
12
7
|
{props.children}
|
@@ -3,22 +3,7 @@ import { components } from 'react-select'
|
|
3
3
|
|
4
4
|
import User from '../../pb_user/_user'
|
5
5
|
|
6
|
-
|
7
|
-
children: React.ReactNode,
|
8
|
-
label?: string,
|
9
|
-
data: {
|
10
|
-
imageUrl?: string,
|
11
|
-
},
|
12
|
-
selectProps: {
|
13
|
-
dark?: boolean,
|
14
|
-
valueComponent?: (data: {
|
15
|
-
imageUrl?: string,
|
16
|
-
}) => React.ReactNode,
|
17
|
-
},
|
18
|
-
}
|
19
|
-
|
20
|
-
|
21
|
-
const Option = (props: OptionProps): React.ReactElement => {
|
6
|
+
const Option = (props: any) => {
|
22
7
|
const {
|
23
8
|
imageUrl,
|
24
9
|
} = props.data
|
@@ -29,11 +14,11 @@ const Option = (props: OptionProps): React.ReactElement => {
|
|
29
14
|
<>
|
30
15
|
{!valueComponent && imageUrl &&
|
31
16
|
<User
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
17
|
+
align="left"
|
18
|
+
avatarUrl={imageUrl}
|
19
|
+
dark={props.selectProps.dark}
|
20
|
+
name={props.label}
|
21
|
+
orientation="horizontal"
|
37
22
|
/>
|
38
23
|
}
|
39
24
|
|
@@ -4,26 +4,19 @@ import { components } from 'react-select'
|
|
4
4
|
import Flex from '../../pb_flex/_flex'
|
5
5
|
import Icon from '../../pb_icon/_icon'
|
6
6
|
|
7
|
-
|
8
|
-
children: React.ReactNode,
|
9
|
-
selectProps: {
|
10
|
-
plusIcon?: boolean,
|
11
|
-
},
|
12
|
-
}
|
13
|
-
|
14
|
-
const Placeholder = (props: PlaceholderProps): React.ReactElement => (
|
7
|
+
const Placeholder = (props: any) => (
|
15
8
|
<>
|
16
9
|
<Flex
|
17
|
-
|
18
|
-
|
10
|
+
align="center"
|
11
|
+
className="placeholder"
|
19
12
|
>
|
20
13
|
<components.IndicatorsContainer
|
21
|
-
|
14
|
+
{...props}
|
22
15
|
/>
|
23
16
|
{props.selectProps.plusIcon &&
|
24
17
|
<Icon
|
25
|
-
|
26
|
-
|
18
|
+
className="typeahead-plus-icon"
|
19
|
+
icon="plus"
|
27
20
|
/>
|
28
21
|
}
|
29
22
|
</Flex>
|
@@ -1,14 +1,10 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { components } from 'react-select'
|
3
3
|
|
4
|
-
|
5
|
-
children: React.ReactNode,
|
6
|
-
}
|
7
|
-
|
8
|
-
const ValueContainer = (props: ValueContainerProps): React.ReactElement => (
|
4
|
+
const ValueContainer = (props: any) => (
|
9
5
|
<components.ValueContainer
|
10
|
-
|
11
|
-
|
6
|
+
className="text_input_value_container"
|
7
|
+
{...props}
|
12
8
|
/>
|
13
9
|
)
|
14
10
|
|
@@ -45,7 +45,8 @@ const promiseOptions = (inputValue) =>
|
|
45
45
|
|
46
46
|
const TypeaheadWithPillsAsync = (props) => {
|
47
47
|
const [users, setUsers] = useState([])
|
48
|
-
|
48
|
+
const handleOnChange = (value) => setUsers(formatUsers(value))
|
49
|
+
const formatValue = (users) => formatUsers(users)
|
49
50
|
const formatUsers = (users) => {
|
50
51
|
const results = () => (users.map((user) => {
|
51
52
|
if (Object.keys(user)[0] === 'name' || Object.keys(user)[1] === 'id'){
|
@@ -57,9 +58,6 @@ const TypeaheadWithPillsAsync = (props) => {
|
|
57
58
|
return results()
|
58
59
|
}
|
59
60
|
|
60
|
-
const handleOnChange = (value) => setUsers(formatUsers(value))
|
61
|
-
const formatValue = (users) => formatUsers(users)
|
62
|
-
|
63
61
|
return (
|
64
62
|
<>
|
65
63
|
{users && users.length > 0 && (
|
@@ -83,13 +83,13 @@ const TypeaheadWithPillsAsyncCustomOptions = (props) => {
|
|
83
83
|
onChange={handleOnChange}
|
84
84
|
onMultiValueClick={handleOnMultiValueClick}
|
85
85
|
placeholder="type the name of a Github user"
|
86
|
-
valueComponent={(
|
86
|
+
valueComponent={(props) => (
|
87
87
|
<User
|
88
88
|
avatar
|
89
|
-
avatarUrl={imageUrl}
|
90
|
-
name={label}
|
91
|
-
territory={territory}
|
92
|
-
title={type}
|
89
|
+
avatarUrl={props.imageUrl}
|
90
|
+
name={props.label}
|
91
|
+
territory={props.territory}
|
92
|
+
title={props.type}
|
93
93
|
/>
|
94
94
|
)}
|
95
95
|
{...props}
|