playbook_ui 14.10.0.pre.alpha.PBNTR662stickyrightcolumnreact5160 → 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_dashboard/BarGraphStyles.scss +53 -0
- 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 -18
- data/app/pb_kits/playbook/pb_table/styles/_sticky_columns.scss +3 -17
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +8 -1
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +23 -0
- data/dist/chunks/{_typeahead-aym7Ky_O.js → _typeahead-BXXEtXbz.js} +2 -2
- 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/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 +7 -10
- 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-BZj1pop-.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: f2e1aaf2cadccd158fb55ca05342e3dfefd6e2614dc37d220086b342e5df4340
|
4
|
+
data.tar.gz: fc03a93a9cc11765508190229426d34d507306ebf46aff0efe5ec23bb65ddb32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88632df2e8dd9a501cd6d97a0bc60213d11a1a4f3e3b063c9318a83267177403c02adb69e60c69344c07c91e7a1915f8a3954069c8682839d8787879b3208219
|
7
|
+
data.tar.gz: 03f3eec3ebd3da933b162a985c72fde36109c4f2e01ad4d732f73cf27a1eae8fb633823af6859f659470d0dca062b8f1dba1777e172a05be30af19b19cc063a4
|
@@ -0,0 +1,53 @@
|
|
1
|
+
@import "../tokens/colors";
|
2
|
+
@import "../tokens/typography";
|
3
|
+
@import url("https://code.highcharts.com/css/highcharts.css");
|
4
|
+
// @import "highcharts/css/highcharts";
|
5
|
+
// @import "highcharts/highcharts.css";
|
6
|
+
|
7
|
+
:root {
|
8
|
+
--highcharts-color-0: #{$data_1};
|
9
|
+
--highcharts-color-1: #{$data_2};
|
10
|
+
--highcharts-color-2: #{$data_3};
|
11
|
+
--highcharts-color-3: #{$data_4};
|
12
|
+
--highcharts-color-4: #{$data_5};
|
13
|
+
--highcharts-color-5: #{$data_6};
|
14
|
+
--highcharts-color-6: #{$data_7};
|
15
|
+
--highcharts-color-7: #{$data_8};
|
16
|
+
}
|
17
|
+
|
18
|
+
.highcharts-title {
|
19
|
+
font-family: $font_family_base;
|
20
|
+
font-weight: $bold;
|
21
|
+
font-size: $heading_3;
|
22
|
+
color: $text_lt_default;
|
23
|
+
fill: $text_lt_default;
|
24
|
+
}
|
25
|
+
|
26
|
+
.highcharts-subtitle {
|
27
|
+
font-family: $font_family_base;
|
28
|
+
color: $text_lt_light;
|
29
|
+
fill: $text_lt_light;
|
30
|
+
font-weight: $regular;
|
31
|
+
font-size: $text_base;
|
32
|
+
}
|
33
|
+
|
34
|
+
.highcharts-yaxis > .highcharts-axis-title {
|
35
|
+
color: $text_lt_lighter;
|
36
|
+
fill: $text_lt_lighter;
|
37
|
+
font-family: $font_family_base;
|
38
|
+
font-weight: $bold;
|
39
|
+
font-size: $text_smaller;
|
40
|
+
}
|
41
|
+
|
42
|
+
.highcharts-axis-labels {
|
43
|
+
font-family: $font_family_base;
|
44
|
+
color: $text_lt_lighter;
|
45
|
+
fill: $text_lt_lighter;
|
46
|
+
font-weight: $bold;
|
47
|
+
font-size: $text_smaller;
|
48
|
+
}
|
49
|
+
|
50
|
+
.highcharts-grid-line {
|
51
|
+
stroke: $border_light;
|
52
|
+
}
|
53
|
+
|
@@ -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
|
}
|
@@ -8,24 +8,8 @@
|
|
8
8
|
@media (max-width: 1600px) {
|
9
9
|
&[class*="table-responsive-scroll"] {
|
10
10
|
border-radius: 4px;
|
11
|
-
box-shadow: 1px 0 0 0px $border_light
|
12
|
-
|
13
|
-
}
|
14
|
-
|
15
|
-
&[class^=pb_table].table-sm.table-card thead tr th:first-child,
|
16
|
-
&[class^=pb_table].table-sm:not(.no-hover).table-card tbody tr td:first-child {
|
17
|
-
border-left-width: 0px;
|
18
|
-
}
|
19
|
-
|
20
|
-
&[class^=pb_table].table-md.table-card thead tr th:first-child,
|
21
|
-
&[class^=pb_table].table-md:not(.no-hover).table-card tbody tr td:first-child {
|
22
|
-
border-left-width: 0px;
|
23
|
-
}
|
24
|
-
|
25
|
-
&[class^=pb_table].table-lg.table-card thead tr th:first-child,
|
26
|
-
&[class^=pb_table].table-lg:not(.no-hover).table-card tbody tr td:first-child {
|
27
|
-
border-left-width: 0px;
|
28
|
-
}
|
11
|
+
box-shadow: 1px 0 0 0px $border_light
|
12
|
+
}
|
29
13
|
|
30
14
|
&[class^=pb_table].table-sm.table-card thead tr th:last-child,
|
31
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
|
}
|
@@ -123,6 +123,13 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
123
123
|
|
124
124
|
const childInput = children ? children.type === "input" : undefined
|
125
125
|
|
126
|
+
let formattedValue;
|
127
|
+
if (isMaskedInput && value) {
|
128
|
+
formattedValue = INPUTMASKS[mask].formatDefaultValue(value.toString())
|
129
|
+
} else {
|
130
|
+
formattedValue = value
|
131
|
+
}
|
132
|
+
|
126
133
|
const textInput = (
|
127
134
|
childInput ? React.cloneElement(children, { className: "text_input" }) :
|
128
135
|
(<input
|
@@ -138,7 +145,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
138
145
|
ref={ref}
|
139
146
|
required={required}
|
140
147
|
type={type}
|
141
|
-
value={
|
148
|
+
value={formattedValue}
|
142
149
|
/>)
|
143
150
|
)
|
144
151
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
type InputMask = {
|
2
2
|
format: (value: string) => string
|
3
|
+
formatDefaultValue: (value: string) => string
|
3
4
|
pattern: string
|
4
5
|
placeholder: string
|
5
6
|
}
|
@@ -8,6 +9,24 @@ type InputMaskDictionary = {
|
|
8
9
|
[key in 'currency' | 'zipCode' | 'postalCode' | 'ssn']: InputMask
|
9
10
|
}
|
10
11
|
|
12
|
+
const formatCurrencyDefaultValue = (value: string): string => {
|
13
|
+
// Remove non-numeric characters except for the decimal point
|
14
|
+
const numericValue = value.replace(/[^0-9.]/g, '')
|
15
|
+
|
16
|
+
if (!numericValue) return ''
|
17
|
+
|
18
|
+
// Parse the numeric value as a float to handle decimals
|
19
|
+
const dollars = parseFloat(numericValue)
|
20
|
+
if (isNaN(dollars) || dollars === 0) return ''
|
21
|
+
|
22
|
+
// Format as currency
|
23
|
+
return new Intl.NumberFormat('en-US', {
|
24
|
+
style: 'currency',
|
25
|
+
currency: 'USD',
|
26
|
+
maximumFractionDigits: 2,
|
27
|
+
}).format(dollars)
|
28
|
+
}
|
29
|
+
|
11
30
|
const formatCurrency = (value: string): string => {
|
12
31
|
const numericValue = value.replace(/[^0-9]/g, '').slice(0, 15)
|
13
32
|
|
@@ -42,22 +61,26 @@ const formatSSN = (value: string): string => {
|
|
42
61
|
export const INPUTMASKS: InputMaskDictionary = {
|
43
62
|
currency: {
|
44
63
|
format: formatCurrency,
|
64
|
+
formatDefaultValue: formatCurrencyDefaultValue,
|
45
65
|
// eslint-disable-next-line no-useless-escape
|
46
66
|
pattern: '^\\$\\d{1,3}(?:,\\d{3})*(?:\\.\\d{2})?$',
|
47
67
|
placeholder: '$0.00',
|
48
68
|
},
|
49
69
|
zipCode: {
|
50
70
|
format: formatBasicPostal,
|
71
|
+
formatDefaultValue: formatBasicPostal,
|
51
72
|
pattern: '\\d{5}',
|
52
73
|
placeholder: '12345',
|
53
74
|
},
|
54
75
|
postalCode: {
|
55
76
|
format: formatExtendedPostal,
|
77
|
+
formatDefaultValue: formatExtendedPostal,
|
56
78
|
pattern: '\\d{5}-\\d{4}',
|
57
79
|
placeholder: '12345-6789',
|
58
80
|
},
|
59
81
|
ssn: {
|
60
82
|
format: formatSSN,
|
83
|
+
formatDefaultValue: formatSSN,
|
61
84
|
pattern: '\\d{3}-\\d{2}-\\d{4}',
|
62
85
|
placeholder: '123-45-6789',
|
63
86
|
},
|