playbook_ui 14.21.2.pre.alpha.PLAY2233removetreemapchart8408 → 14.21.2.pre.alpha.PLAY2256stickydataidreact8446
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/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_contact/contact.test.js +2 -2
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +39 -1
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +39 -1
- data/app/pb_kits/playbook/pb_filter/filter.test.js +2 -2
- data/app/pb_kits/playbook/pb_table/_table.tsx +4 -4
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.jsx +8 -8
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_react.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.jsx +12 -12
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_react.md +3 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.jsx +12 -12
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_react.md +3 -3
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +34 -22
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open.jsx +25 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open.md +1 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.scss +14 -0
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +119 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_description.md +5 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.html.erb +37 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.jsx +48 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.md +2 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.html.erb +37 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.jsx +47 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.md +3 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.html.erb +79 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.jsx +90 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.md +1 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.html.erb +54 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.jsx +65 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.md +3 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.html.erb +37 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.jsx +48 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.md +3 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/example.yml +15 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +63 -0
- data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.html.erb +1 -0
- data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.rb +48 -0
- data/dist/chunks/_typeahead-BaWcHxpx.js +22 -0
- data/dist/chunks/{_weekday_stacked-SYZ-Kt4V.js → _weekday_stacked-DI-oMuSE.js} +1 -1
- data/dist/chunks/{lib-Carqm8Ip.js → lib-CTkMyvfQ.js} +1 -1
- data/dist/chunks/{pb_form_validation-DqRmTS8m.js → pb_form_validation-BVF3TmcL.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +9 -0
- data/dist/playbook-doc.js +2 -2
- 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 +31 -6
- data/dist/chunks/_typeahead-DOgzItP7.js +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c185d4750d745d3d138d5462d31944245538dc7d044f119e80b6ae9dd5f6f7f3
|
4
|
+
data.tar.gz: 70e7bd594420800d85f0a0e56d639176c098158c712e974d323b55d5a310d35b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cf8a39e10eec5f16919c4855ce04dac834d2421d9e8b5fa85bc79f0d0bab2f87e789dfdef980c67ed46a989b19b9c8d75e5a2b08f2dbf3d244a836407c9683d
|
7
|
+
data.tar.gz: d4002cb9e838f44b7b638b0d29c8964b602436a176b2a783248ed8b1d08d01818963e5a555a5c82fdb9d402900f009ebe942c9518166896128e32382627d57c5
|
@@ -104,6 +104,7 @@
|
|
104
104
|
@import 'pb_title_detail/title_detail';
|
105
105
|
@import 'pb_toggle/toggle';
|
106
106
|
@import 'pb_tooltip/tooltip';
|
107
|
+
@import 'pb_treemap_chart/treemap_chart';
|
107
108
|
@import 'pb_typeahead/typeahead';
|
108
109
|
@import 'pb_user/user';
|
109
110
|
@import 'pb_user_badge/user_badge';
|
@@ -77,12 +77,12 @@ test('returns correct icon', () => {
|
|
77
77
|
|
78
78
|
expect(screen.getByTestId('test-cell').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
79
79
|
expect(screen.getByTestId('test-home').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
80
|
-
expect(screen.getByTestId('test-work').querySelector('.
|
80
|
+
expect(screen.getByTestId('test-work').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
81
81
|
expect(screen.getByTestId('test-work-cell').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
82
82
|
expect(screen.getByTestId('test-email').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
83
83
|
expect(screen.getByTestId('test-wrong-phone').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
84
84
|
expect(screen.getByTestId('test-wrong-type').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
85
|
-
expect(screen.getByTestId('test-extension').querySelector('.
|
85
|
+
expect(screen.getByTestId('test-extension').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
86
86
|
expect(screen.getByTestId('test-empty').querySelector('.pb_custom_icon')).toBeInTheDocument()
|
87
87
|
})
|
88
88
|
|
@@ -3,6 +3,8 @@ import typography from '../tokens/exports/_typography.module.scss'
|
|
3
3
|
|
4
4
|
import { ThemeProps } from './themeTypes'
|
5
5
|
|
6
|
+
import { PlotTreemapOptions } from "highcharts";
|
7
|
+
|
6
8
|
const highchartsDarkTheme: ThemeProps = {
|
7
9
|
lang: {
|
8
10
|
thousandsSep: ',',
|
@@ -164,7 +166,43 @@ const highchartsDarkTheme: ThemeProps = {
|
|
164
166
|
marker: {
|
165
167
|
lineColor: colors.border_dark,
|
166
168
|
},
|
167
|
-
}
|
169
|
+
},
|
170
|
+
|
171
|
+
//TREEMAP CHART STYLES
|
172
|
+
treemap: {
|
173
|
+
layoutAlgorithm: "squarified",
|
174
|
+
allowTraversingTree: false,
|
175
|
+
animationLimit: 1000,
|
176
|
+
colors: [
|
177
|
+
colors.data_1,
|
178
|
+
colors.data_2,
|
179
|
+
colors.data_3,
|
180
|
+
colors.data_4,
|
181
|
+
colors.data_5,
|
182
|
+
colors.data_6,
|
183
|
+
colors.data_7,
|
184
|
+
colors.data_8,
|
185
|
+
],
|
186
|
+
dataLabels: {
|
187
|
+
enabled: true,
|
188
|
+
style: {
|
189
|
+
fontFamily: typography.font_family_base,
|
190
|
+
fontWeight: typography.bold,
|
191
|
+
fontSize: typography.heading_4,
|
192
|
+
},
|
193
|
+
},
|
194
|
+
levels: [
|
195
|
+
{
|
196
|
+
level: 1,
|
197
|
+
dataLabels: {
|
198
|
+
enabled: false,
|
199
|
+
},
|
200
|
+
},
|
201
|
+
],
|
202
|
+
traverseUpButton: {
|
203
|
+
position: { y: -50 },
|
204
|
+
},
|
205
|
+
} as PlotTreemapOptions,
|
168
206
|
},
|
169
207
|
credits: {
|
170
208
|
enabled: false
|
@@ -3,6 +3,8 @@ import typography from '../tokens/exports/_typography.module.scss'
|
|
3
3
|
|
4
4
|
import { ThemeProps } from './themeTypes'
|
5
5
|
|
6
|
+
import { PlotTreemapOptions } from "highcharts";
|
7
|
+
|
6
8
|
const highchartsTheme: ThemeProps = {
|
7
9
|
lang: {
|
8
10
|
thousandsSep: ',',
|
@@ -163,7 +165,43 @@ const highchartsTheme: ThemeProps = {
|
|
163
165
|
marker: {
|
164
166
|
lineColor: '#333',
|
165
167
|
},
|
166
|
-
}
|
168
|
+
},
|
169
|
+
|
170
|
+
//TREEMAP CHART STYLES
|
171
|
+
treemap: {
|
172
|
+
layoutAlgorithm: "squarified",
|
173
|
+
allowTraversingTree: false,
|
174
|
+
animationLimit: 1000,
|
175
|
+
colors: [
|
176
|
+
colors.data_1,
|
177
|
+
colors.data_2,
|
178
|
+
colors.data_3,
|
179
|
+
colors.data_4,
|
180
|
+
colors.data_5,
|
181
|
+
colors.data_6,
|
182
|
+
colors.data_7,
|
183
|
+
colors.data_8,
|
184
|
+
],
|
185
|
+
dataLabels: {
|
186
|
+
enabled: true,
|
187
|
+
style: {
|
188
|
+
fontFamily: typography.font_family_base,
|
189
|
+
fontWeight: typography.bold,
|
190
|
+
fontSize: typography.heading_4,
|
191
|
+
},
|
192
|
+
},
|
193
|
+
levels: [
|
194
|
+
{
|
195
|
+
level: 1,
|
196
|
+
dataLabels: {
|
197
|
+
enabled: false,
|
198
|
+
},
|
199
|
+
},
|
200
|
+
],
|
201
|
+
traverseUpButton: {
|
202
|
+
position: { y: -50 },
|
203
|
+
},
|
204
|
+
} as PlotTreemapOptions,
|
167
205
|
},
|
168
206
|
credits: {
|
169
207
|
enabled: false
|
@@ -58,12 +58,12 @@ function FilterTest(props) {
|
|
58
58
|
}
|
59
59
|
|
60
60
|
test("triggers popover on filter button click", () => {
|
61
|
-
render(<FilterTest data={{ testid: "render-test" }}/>);
|
61
|
+
const { container } = render(<FilterTest data={{ testid: "render-test" }}/>);
|
62
62
|
|
63
63
|
const btn = screen.getAllByRole("button")[0];
|
64
64
|
|
65
65
|
// checks if the sort menu rendered
|
66
|
-
expect(
|
66
|
+
expect(container.querySelector('.pb_custom_icon')).toBeInTheDocument()
|
67
67
|
expect(screen.getByText('Popularity')).toBeInTheDocument() // check if filter/sort is rendered
|
68
68
|
|
69
69
|
// hits the filter button and triggers popover
|
@@ -104,8 +104,8 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
104
104
|
|
105
105
|
stickyLeftColumn.forEach((colId, index) => {
|
106
106
|
const isLastColumn = index === stickyLeftColumn.length - 1;
|
107
|
-
const header = document.querySelector(`th[id="${colId}"]`);
|
108
|
-
const cells = document.querySelectorAll(`td[id="${colId}"]`);
|
107
|
+
const header = document.querySelector(`th[data-sticky-id="${colId}"]`);
|
108
|
+
const cells = document.querySelectorAll(`td[data-sticky-id="${colId}"]`);
|
109
109
|
|
110
110
|
if (header) {
|
111
111
|
header.classList.add('sticky');
|
@@ -155,8 +155,8 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
155
155
|
|
156
156
|
stickyRightColumnReversed.forEach((colId, index) => {
|
157
157
|
const isLastColumn = index === stickyRightColumn.length - 1;
|
158
|
-
const header = document.querySelector(`th[id="${colId}"]`);
|
159
|
-
const cells = document.querySelectorAll(`td[id="${colId}"]`);
|
158
|
+
const header = document.querySelector(`th[data-sticky-id="${colId}"]`);
|
159
|
+
const cells = document.querySelectorAll(`td[data-sticky-id="${colId}"]`);
|
160
160
|
|
161
161
|
if (header) {
|
162
162
|
header.classList.add('sticky');
|
@@ -11,7 +11,7 @@ const TableStickyColumns = () => {
|
|
11
11
|
>
|
12
12
|
<thead>
|
13
13
|
<tr>
|
14
|
-
<th id="a">{'Column 1'}</th>
|
14
|
+
<th data-sticky-id="a">{'Column 1'}</th>
|
15
15
|
<th>{'Column 2'}</th>
|
16
16
|
<th>{'Column 3'}</th>
|
17
17
|
<th>{'Column 4'}</th>
|
@@ -25,12 +25,12 @@ const TableStickyColumns = () => {
|
|
25
25
|
<th>{'Column 12'}</th>
|
26
26
|
<th>{'Column 13'}</th>
|
27
27
|
<th>{'Column 14'}</th>
|
28
|
-
<th id="b">{'Column 15'}</th>
|
28
|
+
<th data-sticky-id="b">{'Column 15'}</th>
|
29
29
|
</tr>
|
30
30
|
</thead>
|
31
31
|
<tbody>
|
32
32
|
<tr>
|
33
|
-
<td id="a">{'Value 1'}</td>
|
33
|
+
<td data-sticky-id="a">{'Value 1'}</td>
|
34
34
|
<td>{'Value 2'}</td>
|
35
35
|
<td>{'Value 3'}</td>
|
36
36
|
<td>{'Value 4'}</td>
|
@@ -44,10 +44,10 @@ const TableStickyColumns = () => {
|
|
44
44
|
<td>{'Value 12'}</td>
|
45
45
|
<td>{'Value 13'}</td>
|
46
46
|
<td>{'Value 14'}</td>
|
47
|
-
<td id="b">{'Value 15'}</td>
|
47
|
+
<td data-sticky-id="b">{'Value 15'}</td>
|
48
48
|
</tr>
|
49
49
|
<tr>
|
50
|
-
<td id="a">{'Value 1'}</td>
|
50
|
+
<td data-sticky-id="a">{'Value 1'}</td>
|
51
51
|
<td>{'Value 2'}</td>
|
52
52
|
<td>{'Value 3'}</td>
|
53
53
|
<td>{'Value 4'}</td>
|
@@ -61,10 +61,10 @@ const TableStickyColumns = () => {
|
|
61
61
|
<td>{'Value 12'}</td>
|
62
62
|
<td>{'Value 13'}</td>
|
63
63
|
<td>{'Value 14'}</td>
|
64
|
-
<td id="b">{'Value 15'}</td>
|
64
|
+
<td data-sticky-id="b">{'Value 15'}</td>
|
65
65
|
</tr>
|
66
66
|
<tr>
|
67
|
-
<td id="a">{'Value 1'}</td>
|
67
|
+
<td data-sticky-id="a">{'Value 1'}</td>
|
68
68
|
<td>{'Value 2'}</td>
|
69
69
|
<td>{'Value 3'}</td>
|
70
70
|
<td>{'Value 4'}</td>
|
@@ -78,7 +78,7 @@ const TableStickyColumns = () => {
|
|
78
78
|
<td>{'Value 12'}</td>
|
79
79
|
<td>{'Value 13'}</td>
|
80
80
|
<td>{'Value 14'}</td>
|
81
|
-
<td id="b">{'Value 15'}</td>
|
81
|
+
<td data-sticky-id="b">{'Value 15'}</td>
|
82
82
|
</tr>
|
83
83
|
</tbody>
|
84
84
|
</Table>
|
@@ -1,3 +1,3 @@
|
|
1
1
|
The `stickyLeftColumn` and `stickyRightColumn` props can be used together on the same table as needed.
|
2
2
|
|
3
|
-
Please ensure that unique
|
3
|
+
Please ensure that unique `data-sticky-id`s are used for all columns across multiple tables. Using the same columns `data-sticky-id`s on multiple tables can lead to issues when using props.
|
@@ -10,9 +10,9 @@ const TableStickyLeftColumns = () => {
|
|
10
10
|
>
|
11
11
|
<thead>
|
12
12
|
<tr>
|
13
|
-
<th id="1">{'Column 1'}</th>
|
14
|
-
<th id="2">{'Column 2'}</th>
|
15
|
-
<th id="3">{'Column 3'}</th>
|
13
|
+
<th data-sticky-id="1">{'Column 1'}</th>
|
14
|
+
<th data-sticky-id="2">{'Column 2'}</th>
|
15
|
+
<th data-sticky-id="3">{'Column 3'}</th>
|
16
16
|
<th>{'Column 4'}</th>
|
17
17
|
<th>{'Column 5'}</th>
|
18
18
|
<th>{'Column 6'}</th>
|
@@ -29,9 +29,9 @@ const TableStickyLeftColumns = () => {
|
|
29
29
|
</thead>
|
30
30
|
<tbody>
|
31
31
|
<tr>
|
32
|
-
<td id="1">{'Value 1'}</td>
|
33
|
-
<td id="2">{'Value 2'}</td>
|
34
|
-
<td id="3">{'Value 3'}</td>
|
32
|
+
<td data-sticky-id="1">{'Value 1'}</td>
|
33
|
+
<td data-sticky-id="2">{'Value 2'}</td>
|
34
|
+
<td data-sticky-id="3">{'Value 3'}</td>
|
35
35
|
<td>{'Value 4'}</td>
|
36
36
|
<td>{'Value 5'}</td>
|
37
37
|
<td>{'Value 6'}</td>
|
@@ -46,9 +46,9 @@ const TableStickyLeftColumns = () => {
|
|
46
46
|
<td>{'Value 15'}</td>
|
47
47
|
</tr>
|
48
48
|
<tr>
|
49
|
-
<td id="1">{'Value 1'}</td>
|
50
|
-
<td id="2">{'Value 2'}</td>
|
51
|
-
<td id="3">{'Value 3'}</td>
|
49
|
+
<td data-sticky-id="1">{'Value 1'}</td>
|
50
|
+
<td data-sticky-id="2">{'Value 2'}</td>
|
51
|
+
<td data-sticky-id="3">{'Value 3'}</td>
|
52
52
|
<td>{'Value 4'}</td>
|
53
53
|
<td>{'Value 5'}</td>
|
54
54
|
<td>{'Value 6'}</td>
|
@@ -63,9 +63,9 @@ const TableStickyLeftColumns = () => {
|
|
63
63
|
<td>{'Value 15'}</td>
|
64
64
|
</tr>
|
65
65
|
<tr>
|
66
|
-
<td id="1">{'Value 1'}</td>
|
67
|
-
<td id="2">{'Value 2'}</td>
|
68
|
-
<td id="3">{'Value 3'}</td>
|
66
|
+
<td data-sticky-id="1">{'Value 1'}</td>
|
67
|
+
<td data-sticky-id="2">{'Value 2'}</td>
|
68
|
+
<td data-sticky-id="3">{'Value 3'}</td>
|
69
69
|
<td>{'Value 4'}</td>
|
70
70
|
<td>{'Value 5'}</td>
|
71
71
|
<td>{'Value 6'}</td>
|
@@ -1,5 +1,5 @@
|
|
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>`.
|
1
|
+
The `stickyLeftColumn` prop expects an array of the column ids you want to be sticky. Make sure to add the corresponding `data-sticky-id` to the `<th>` and `<td>`.
|
2
2
|
|
3
|
-
If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
|
3
|
+
If you are using the sub-component variant, then you will pass the `data-sticky-id` to `<Table.Header>` and `<Table.Cell>`
|
4
4
|
|
5
|
-
Please ensure that unique
|
5
|
+
Please ensure that unique `data-sticky-id`s are used for all columns across multiple tables. Using the same columns `data-sticky-id`s on multiple tables can lead to issues when using `stickyLeftColumn` prop.
|
@@ -22,9 +22,9 @@ const TableStickyRightColumns = () => {
|
|
22
22
|
<th>{'Column 10'}</th>
|
23
23
|
<th>{'Column 11'}</th>
|
24
24
|
<th>{'Column 12'}</th>
|
25
|
-
<th id="13">{'Column 13'}</th>
|
26
|
-
<th id="14">{'Column 14'}</th>
|
27
|
-
<th id="15">{'Column 15'}</th>
|
25
|
+
<th data-sticky-id="13">{'Column 13'}</th>
|
26
|
+
<th data-sticky-id="14">{'Column 14'}</th>
|
27
|
+
<th data-sticky-id="15">{'Column 15'}</th>
|
28
28
|
</tr>
|
29
29
|
</thead>
|
30
30
|
<tbody>
|
@@ -41,9 +41,9 @@ const TableStickyRightColumns = () => {
|
|
41
41
|
<td>{'Value 10'}</td>
|
42
42
|
<td>{'Value 11'}</td>
|
43
43
|
<td>{'Value 12'}</td>
|
44
|
-
<td id="13">{'Value 13'}</td>
|
45
|
-
<td id="14">{'Value 14'}</td>
|
46
|
-
<td id="15">{'Value 15'}</td>
|
44
|
+
<td data-sticky-id="13">{'Value 13'}</td>
|
45
|
+
<td data-sticky-id="14">{'Value 14'}</td>
|
46
|
+
<td data-sticky-id="15">{'Value 15'}</td>
|
47
47
|
</tr>
|
48
48
|
<tr>
|
49
49
|
<td>{'Value 1'}</td>
|
@@ -58,9 +58,9 @@ const TableStickyRightColumns = () => {
|
|
58
58
|
<td>{'Value 10'}</td>
|
59
59
|
<td>{'Value 11'}</td>
|
60
60
|
<td>{'Value 12'}</td>
|
61
|
-
<td id="13">{'Value 13'}</td>
|
62
|
-
<td id="14">{'Value 14'}</td>
|
63
|
-
<td id="15">{'Value 15'}</td>
|
61
|
+
<td data-sticky-id="13">{'Value 13'}</td>
|
62
|
+
<td data-sticky-id="14">{'Value 14'}</td>
|
63
|
+
<td data-sticky-id="15">{'Value 15'}</td>
|
64
64
|
</tr>
|
65
65
|
<tr>
|
66
66
|
<td>{'Value 1'}</td>
|
@@ -75,9 +75,9 @@ const TableStickyRightColumns = () => {
|
|
75
75
|
<td>{'Value 10'}</td>
|
76
76
|
<td>{'Value 11'}</td>
|
77
77
|
<td>{'Value 12'}</td>
|
78
|
-
<td id="13">{'Value 13'}</td>
|
79
|
-
<td id="14">{'Value 14'}</td>
|
80
|
-
<td id="15">{'Value 15'}</td>
|
78
|
+
<td data-sticky-id="13">{'Value 13'}</td>
|
79
|
+
<td data-sticky-id="14">{'Value 14'}</td>
|
80
|
+
<td data-sticky-id="15">{'Value 15'}</td>
|
81
81
|
</tr>
|
82
82
|
</tbody>
|
83
83
|
</Table>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
The `stickyRightColumn` prop works in the same way as the above `stickyLeftColumn` prop. It expects an array of the column
|
1
|
+
The `stickyRightColumn` prop works in the same way as the above `stickyLeftColumn` prop. It expects an array of the column `data-sticky-id`s you want to be sticky. Make sure to add the corresponding `data-sticky-id` to the `<th>` and `<td>`.
|
2
2
|
|
3
|
-
If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
|
3
|
+
If you are using the sub-component variant, then you will pass the `data-sticky-id` to `<Table.Header>` and `<Table.Cell>`
|
4
4
|
|
5
|
-
Please ensure that unique
|
5
|
+
Please ensure that unique `data-sticky-id`s are used for all columns across multiple tables. Using the same columns `data-sticky-id`s on multiple tables can lead to issues when using the `stickyRightColumn` prop.
|
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
shift,
|
10
10
|
useFloating,
|
11
11
|
useHover,
|
12
|
+
useClick,
|
12
13
|
useInteractions,
|
13
14
|
} from "@floating-ui/react"
|
14
15
|
|
@@ -23,6 +24,7 @@ type TooltipProps = {
|
|
23
24
|
aria?: { [key: string]: string },
|
24
25
|
className?: string | string[],
|
25
26
|
children: JSX.Element,
|
27
|
+
useClickToOpen?: boolean,
|
26
28
|
data?: { [key: string]: string },
|
27
29
|
delay?: number | Partial<{open: number; close: number}>,
|
28
30
|
height?: string,
|
@@ -46,6 +48,7 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
|
|
46
48
|
aria = {},
|
47
49
|
className,
|
48
50
|
children,
|
51
|
+
useClickToOpen = false,
|
49
52
|
data = {},
|
50
53
|
delay = 0,
|
51
54
|
height,
|
@@ -110,14 +113,21 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
|
|
110
113
|
placement: preferredPlacement
|
111
114
|
})
|
112
115
|
|
116
|
+
const hover = useHover(context, {
|
117
|
+
delay,
|
118
|
+
handleClose: interaction ? safePolygon({
|
119
|
+
blockPointerEvents: false
|
120
|
+
}) : null,
|
121
|
+
enabled: !useClickToOpen // Disable hover when useClickToOpen is true
|
122
|
+
})
|
123
|
+
|
124
|
+
const click = useClick(context, {
|
125
|
+
enabled: useClickToOpen // Only enable click when useClickToOpen is true
|
126
|
+
})
|
113
127
|
|
114
|
-
const { getFloatingProps } = useInteractions([
|
115
|
-
|
116
|
-
|
117
|
-
handleClose: interaction ? safePolygon({
|
118
|
-
blockPointerEvents: false
|
119
|
-
}) : null
|
120
|
-
})
|
128
|
+
const { getFloatingProps, getReferenceProps } = useInteractions([
|
129
|
+
hover,
|
130
|
+
click
|
121
131
|
])
|
122
132
|
|
123
133
|
const staticSide = {
|
@@ -142,22 +152,24 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
|
|
142
152
|
return (
|
143
153
|
<>
|
144
154
|
<div
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
if (
|
150
|
-
ref
|
151
|
-
|
152
|
-
ref
|
155
|
+
{...getReferenceProps({
|
156
|
+
className: `pb_tooltip_kit ${css}`,
|
157
|
+
ref: (element) => {
|
158
|
+
refs.setReference(element);
|
159
|
+
if (ref) {
|
160
|
+
if (typeof ref === "function") {
|
161
|
+
ref(element);
|
162
|
+
} else if (typeof ref === "object") {
|
163
|
+
ref.current = element;
|
164
|
+
}
|
153
165
|
}
|
154
|
-
}
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
166
|
+
},
|
167
|
+
role: "tooltip_trigger",
|
168
|
+
style: { display: "inline-block" },
|
169
|
+
...ariaProps,
|
170
|
+
...dataProps,
|
171
|
+
...htmlProps,
|
172
|
+
})}
|
161
173
|
>
|
162
174
|
{children}
|
163
175
|
</div>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import Button from '../../pb_button/_button'
|
3
|
+
import Tooltip from '../_tooltip'
|
4
|
+
import Flex from '../../pb_flex/_flex'
|
5
|
+
|
6
|
+
const TooltipClickOpen = (props) => {
|
7
|
+
return (
|
8
|
+
<Flex flexDirection='row'
|
9
|
+
gap='md'
|
10
|
+
wrap
|
11
|
+
>
|
12
|
+
<Tooltip
|
13
|
+
placement='top'
|
14
|
+
text='Tooltip Opened'
|
15
|
+
useClickToOpen
|
16
|
+
zIndex={10}
|
17
|
+
{...props}
|
18
|
+
>
|
19
|
+
<Button text='Click to Open' />
|
20
|
+
</Tooltip>
|
21
|
+
</Flex>
|
22
|
+
)
|
23
|
+
}
|
24
|
+
|
25
|
+
export default TooltipClickOpen
|
@@ -0,0 +1 @@
|
|
1
|
+
Set the prop `useClickToOpen` so that the tooltip will only appear when an item is clicked rather than hovered over.
|
@@ -5,3 +5,4 @@ export { default as TooltipSizing } from './_tooltip_sizing'
|
|
5
5
|
export { default as TooltipIcon } from './_tooltip_icon'
|
6
6
|
export { default as TooltipDelay } from './_tooltip_delay'
|
7
7
|
export { default as TooltipShowTooltipReact } from './_tooltip_show_tooltip_react'
|
8
|
+
export { default as TooltipClickOpen } from './_tooltip_click_open'
|
@@ -0,0 +1,119 @@
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
2
|
+
import classnames from "classnames";
|
3
|
+
|
4
|
+
import { globalProps } from "../utilities/globalProps";
|
5
|
+
import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
|
6
|
+
|
7
|
+
import HighchartsReact from "highcharts-react-official";
|
8
|
+
import Highcharts from "highcharts";
|
9
|
+
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
10
|
+
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
11
|
+
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
12
|
+
import treemap from 'highcharts/modules/treemap'
|
13
|
+
import { merge } from '../utilities/object'
|
14
|
+
|
15
|
+
type TreemapChartProps = {
|
16
|
+
chartData: {
|
17
|
+
name: string;
|
18
|
+
parent?: string | number;
|
19
|
+
value: number;
|
20
|
+
color?: string;
|
21
|
+
id?: string | number;
|
22
|
+
}[];
|
23
|
+
className?: string;
|
24
|
+
colors: string[];
|
25
|
+
customOptions?: Partial<Highcharts.Options>;
|
26
|
+
dark?: boolean;
|
27
|
+
drillable: boolean;
|
28
|
+
grouped: boolean;
|
29
|
+
height?: string;
|
30
|
+
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
31
|
+
id: number | string;
|
32
|
+
title?: string;
|
33
|
+
tooltipHtml: string;
|
34
|
+
type?: string;
|
35
|
+
aria?: { [key: string]: string };
|
36
|
+
data?: { [key: string]: string };
|
37
|
+
};
|
38
|
+
|
39
|
+
const TreemapChart = ({
|
40
|
+
aria = {},
|
41
|
+
data = {},
|
42
|
+
chartData,
|
43
|
+
colors,
|
44
|
+
customOptions = {},
|
45
|
+
dark = false,
|
46
|
+
drillable = false,
|
47
|
+
grouped = false,
|
48
|
+
height,
|
49
|
+
htmlOptions = {},
|
50
|
+
id,
|
51
|
+
title = "",
|
52
|
+
tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.value}</b>',
|
53
|
+
type = "treemap",
|
54
|
+
...props
|
55
|
+
}: TreemapChartProps): React.ReactElement => {
|
56
|
+
|
57
|
+
const ariaProps = buildAriaProps(aria)
|
58
|
+
const dataProps = buildDataProps(data)
|
59
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
60
|
+
|
61
|
+
const setupTheme = () => {
|
62
|
+
dark
|
63
|
+
? Highcharts.setOptions(highchartsDarkTheme)
|
64
|
+
: Highcharts.setOptions(highchartsTheme);
|
65
|
+
};
|
66
|
+
treemap(Highcharts)
|
67
|
+
setupTheme();
|
68
|
+
|
69
|
+
const staticOptions = {
|
70
|
+
title: {
|
71
|
+
text: title,
|
72
|
+
},
|
73
|
+
chart: {
|
74
|
+
height: height,
|
75
|
+
type: type,
|
76
|
+
},
|
77
|
+
credits: false,
|
78
|
+
series: [
|
79
|
+
{
|
80
|
+
data: chartData,
|
81
|
+
},
|
82
|
+
],
|
83
|
+
plotOptions: {
|
84
|
+
treemap: {
|
85
|
+
tooltip: {
|
86
|
+
pointFormat: tooltipHtml,
|
87
|
+
},
|
88
|
+
allowTraversingTree: drillable,
|
89
|
+
colorByPoint: !grouped,
|
90
|
+
colors:
|
91
|
+
colors !== undefined && colors.length > 0
|
92
|
+
? mapColors(colors)
|
93
|
+
: highchartsTheme.colors,
|
94
|
+
},
|
95
|
+
},
|
96
|
+
};
|
97
|
+
|
98
|
+
const [options, setOptions] = useState({});
|
99
|
+
|
100
|
+
useEffect(() => {
|
101
|
+
setOptions(merge(staticOptions, customOptions));
|
102
|
+
}, [chartData]);
|
103
|
+
|
104
|
+
return (
|
105
|
+
<HighchartsReact
|
106
|
+
containerProps={{
|
107
|
+
className: classnames(globalProps(props), "pb_treemap_chart"),
|
108
|
+
id: id,
|
109
|
+
...ariaProps,
|
110
|
+
...dataProps,
|
111
|
+
...htmlProps
|
112
|
+
}}
|
113
|
+
highcharts={Highcharts}
|
114
|
+
options={options}
|
115
|
+
/>
|
116
|
+
);
|
117
|
+
};
|
118
|
+
|
119
|
+
export default TreemapChart;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
Treemap charts are used to compare the relative size of groups of data. They can also use a nested data structure, allowing a user to drill down into a group to see its constituent data points.
|
2
|
+
|
3
|
+
The default height of treemap is 400px and can be changed. The default height is in pixel units, but can also use percentage string (percentage would be that of the width. For example, `height:"50%"` would mean that the height is 50% of the width). This allows for preserving the aspect ratio across responsive sizes.
|
4
|
+
|
5
|
+
For more information, see: <a href="https://api.highcharts.com/highcharts/chart.height" target="_blank"> highcharts/chart.height</a>.
|