playbook_ui 14.22.0.pre.alpha.PLAY22588587 → 14.22.0.pre.alpha.PLAY22958843
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/CustomCell.tsx +6 -7
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header.jsx +69 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +8 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -2
- data/app/pb_kits/playbook/pb_badge/_badge.scss +5 -6
- data/app/pb_kits/playbook/pb_bar_graph/barGraphTheme.ts +106 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.jsx +33 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.jsx +33 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.jsx +52 -22
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.md +3 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_horizontal.jsx +12 -16
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend.jsx +31 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_non_clickable.jsx +39 -16
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.jsx +86 -38
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_negative_numbers.jsx +32 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.jsx +72 -22
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.md +1 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_spline.jsx +31 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.jsx +37 -16
- data/app/pb_kits/playbook/pb_bar_graph/docs/_description.md +1 -3
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +1 -3
- data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_circle_chart/circleChartTheme.ts +36 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.jsx +71 -26
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.jsx +29 -16
- data/app/pb_kits/playbook/pb_circle_chart/docs/{_circle_chart_colors.md → _circle_chart_colors_rails.md} +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors_react.md +2 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.jsx +28 -16
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.md +4 -2
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.jsx +23 -15
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_inner_sizes.jsx +81 -51
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.jsx +103 -75
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +3 -6
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_live_data.jsx +19 -13
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.jsx +30 -17
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_labels.jsx +34 -20
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_legend_kit.jsx +29 -20
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_title.jsx +28 -20
- data/app/pb_kits/playbook/pb_circle_chart/docs/_description.md +1 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +0 -1
- 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/docs/_tooltip_click_open.html.erb +14 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open_rails.md +1 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_tooltip/index.js +59 -36
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +9 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.html.erb +18 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input_rails.md +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +3 -0
- data/dist/chunks/_circle_chart-BjcInQNv.js +1 -0
- data/dist/chunks/{_typeahead-B7FRYVtS.js → _typeahead-CuwY9iVi.js} +3 -3
- data/dist/chunks/_weekday_stacked-C3EeTZ8D.js +45 -0
- data/dist/chunks/{lib-Carqm8Ip.js → lib-DYpq0k8j.js} +1 -1
- data/dist/chunks/{pb_form_validation-DqRmTS8m.js → pb_form_validation-BUOKwfvW.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +68 -8
- 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 +20 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.jsx +0 -72
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.md +0 -6
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.jsx +0 -64
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.md +0 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.jsx +0 -38
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.md +0 -1
- data/dist/chunks/_weekday_stacked-D1TcPO8F.js +0 -45
- /data/app/pb_kits/playbook/pb_tooltip/docs/{_tooltip_click_open.md → _tooltip_click_open_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_typeahead/docs/{_typeahead_preserve_input.md → _typeahead_preserve_input_react.md} +0 -0
@@ -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
|
1
|
+
The `stickyLeftColumn` prop 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 `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.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%= pb_rails("button", props: {
|
2
|
+
text: "Click to Open",
|
3
|
+
id: "click-tooltip-trigger-1",
|
4
|
+
variant: "primary"
|
5
|
+
}) %>
|
6
|
+
|
7
|
+
<%= pb_rails("tooltip", props: {
|
8
|
+
trigger_element_selector: "#click-tooltip-trigger-1",
|
9
|
+
tooltip_id: "click-tooltip-1",
|
10
|
+
position: "top",
|
11
|
+
use_click_to_open: true
|
12
|
+
}) do %>
|
13
|
+
Tooltip opened by click! Click trigger again to close.
|
14
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Set the prop `use_click_to_open` as `true` so that the tooltip will only appear when an item is clicked rather than hovered over.
|
@@ -19,60 +19,75 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
this.triggerElements.forEach((trigger) => {
|
22
|
-
const method = this.
|
22
|
+
const method = this.effectiveTriggerMethod
|
23
23
|
const interactionEnabled = this.tooltipInteraction
|
24
24
|
|
25
25
|
if (method === 'click') {
|
26
|
-
trigger.addEventListener('click', () => {
|
27
|
-
this.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
this.currentTrigger = trigger
|
34
|
-
const delayOpen = this.delayOpen ? parseInt(this.delayOpen) : TOOLTIP_TIMEOUT
|
35
|
-
this.mouseenterTimeout = setTimeout(() => {
|
36
|
-
this.showTooltip(trigger)
|
37
|
-
if (interactionEnabled) {
|
38
|
-
this.checkCloseTooltip(trigger)
|
26
|
+
trigger.addEventListener('click', (e) => {
|
27
|
+
if (this.useClickToOpen) {
|
28
|
+
e.preventDefault()
|
29
|
+
if (this.isTooltipVisible()) {
|
30
|
+
this.hideTooltip()
|
31
|
+
} else {
|
32
|
+
this.showTooltip(trigger)
|
39
33
|
}
|
40
|
-
}
|
34
|
+
} else {
|
35
|
+
this.showTooltip(trigger)
|
36
|
+
}
|
41
37
|
})
|
38
|
+
} else {
|
39
|
+
if (!this.useClickToOpen) {
|
40
|
+
trigger.addEventListener('mouseenter', () => {
|
41
|
+
clearSafeZoneListener(this)
|
42
|
+
clearTimeout(this.mouseleaveTimeout)
|
43
|
+
this.currentTrigger = trigger
|
44
|
+
const delayOpen = this.delayOpen ? parseInt(this.delayOpen) : TOOLTIP_TIMEOUT
|
45
|
+
this.mouseenterTimeout = setTimeout(() => {
|
46
|
+
this.showTooltip(trigger)
|
47
|
+
if (interactionEnabled) {
|
48
|
+
this.checkCloseTooltip(trigger)
|
49
|
+
}
|
50
|
+
}, delayOpen)
|
51
|
+
})
|
42
52
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
53
|
+
trigger.addEventListener('mouseleave', () => {
|
54
|
+
clearTimeout(this.mouseenterTimeout)
|
55
|
+
if (this.delayClose) {
|
56
|
+
const delayClose = parseInt(this.delayClose)
|
57
|
+
this.mouseleaveTimeout = setTimeout(() => {
|
58
|
+
if (interactionEnabled) {
|
59
|
+
this.attachSafeZoneListener()
|
60
|
+
} else {
|
61
|
+
this.hideTooltip()
|
62
|
+
}
|
63
|
+
}, delayClose)
|
64
|
+
} else {
|
48
65
|
if (interactionEnabled) {
|
49
66
|
this.attachSafeZoneListener()
|
50
67
|
} else {
|
51
68
|
this.hideTooltip()
|
52
69
|
}
|
53
|
-
}, delayClose)
|
54
|
-
} else {
|
55
|
-
if (interactionEnabled) {
|
56
|
-
this.attachSafeZoneListener()
|
57
|
-
} else {
|
58
|
-
this.hideTooltip()
|
59
70
|
}
|
60
|
-
}
|
61
|
-
})
|
62
|
-
|
63
|
-
if (interactionEnabled) {
|
64
|
-
this.tooltip.addEventListener('mouseenter', () => {
|
65
|
-
clearSafeZoneListener(this)
|
66
71
|
})
|
67
72
|
|
68
|
-
|
69
|
-
this.
|
70
|
-
|
73
|
+
if (interactionEnabled) {
|
74
|
+
this.tooltip.addEventListener('mouseenter', () => {
|
75
|
+
clearSafeZoneListener(this)
|
76
|
+
})
|
77
|
+
|
78
|
+
this.tooltip.addEventListener('mouseleave', () => {
|
79
|
+
this.attachSafeZoneListener()
|
80
|
+
})
|
81
|
+
}
|
71
82
|
}
|
72
83
|
}
|
73
84
|
})
|
74
85
|
}
|
75
86
|
|
87
|
+
isTooltipVisible() {
|
88
|
+
return this.tooltip && this.tooltip.classList.contains('show')
|
89
|
+
}
|
90
|
+
|
76
91
|
attachSafeZoneListener() {
|
77
92
|
clearSafeZoneListener(this)
|
78
93
|
this.safeZoneHandler = (e) => {
|
@@ -145,7 +160,7 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
145
160
|
|
146
161
|
this.tooltip.classList.add('show')
|
147
162
|
|
148
|
-
if (this.
|
163
|
+
if (this.effectiveTriggerMethod === 'click' && !this.useClickToOpen) {
|
149
164
|
clearTimeout(this.autoHideTimeout)
|
150
165
|
this.autoHideTimeout = setTimeout(() => {
|
151
166
|
this.hideTooltip()
|
@@ -224,6 +239,14 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
224
239
|
return this.element.dataset.pbTooltipTriggerMethod || 'hover'
|
225
240
|
}
|
226
241
|
|
242
|
+
get useClickToOpen() {
|
243
|
+
return this.element.dataset.pbTooltipUseClickToOpen === 'true'
|
244
|
+
}
|
245
|
+
|
246
|
+
get effectiveTriggerMethod() {
|
247
|
+
return this.useClickToOpen ? 'click' : this.triggerMethod
|
248
|
+
}
|
249
|
+
|
227
250
|
get tooltipInteraction() {
|
228
251
|
return this.element.dataset.pbTooltipInteraction === 'true'
|
229
252
|
}
|
@@ -21,6 +21,8 @@ module Playbook
|
|
21
21
|
prop :trigger_method, type: Playbook::Props::Enum,
|
22
22
|
values: %w[hover click],
|
23
23
|
default: "hover"
|
24
|
+
prop :use_click_to_open, type: Playbook::Props::Boolean,
|
25
|
+
default: false
|
24
26
|
prop :width
|
25
27
|
|
26
28
|
def classname
|
@@ -46,6 +48,10 @@ module Playbook
|
|
46
48
|
out
|
47
49
|
end
|
48
50
|
|
51
|
+
def effective_trigger_method
|
52
|
+
use_click_to_open ? "click" : (trigger_method || "hover")
|
53
|
+
end
|
54
|
+
|
49
55
|
def data
|
50
56
|
data = Hash(values[:data]).merge(
|
51
57
|
pb_tooltip_kit: true,
|
@@ -54,8 +60,9 @@ module Playbook
|
|
54
60
|
pb_tooltip_trigger_element_id: trigger_element_id,
|
55
61
|
pb_tooltip_tooltip_id: tooltip_id,
|
56
62
|
pb_tooltip_show_tooltip: true,
|
57
|
-
pb_tooltip_trigger_method:
|
58
|
-
pb_tooltip_interaction: interaction
|
63
|
+
pb_tooltip_trigger_method: effective_trigger_method,
|
64
|
+
pb_tooltip_interaction: interaction,
|
65
|
+
pb_tooltip_use_click_to_open: use_click_to_open
|
59
66
|
)
|
60
67
|
data = data.merge(pb_tooltip_delay_open: delay_open) if delay_open
|
61
68
|
data = data.merge(pb_tooltip_delay_close: delay_close) if delay_close
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%
|
2
|
+
options = [
|
3
|
+
{ label: 'Orange', value: '#FFA500' },
|
4
|
+
{ label: 'Red', value: '#FF0000' },
|
5
|
+
{ label: 'Green', value: '#00FF00' },
|
6
|
+
{ label: 'Blue', value: '#0000FF' },
|
7
|
+
]
|
8
|
+
%>
|
9
|
+
|
10
|
+
<%= pb_rails("typeahead", props: {
|
11
|
+
id: "typeahead-preserve-search-input",
|
12
|
+
is_multi: false,
|
13
|
+
label: "Colors",
|
14
|
+
options: options,
|
15
|
+
placeholder: "Select...",
|
16
|
+
preserve_search_input: true,
|
17
|
+
})
|
18
|
+
%>
|
@@ -0,0 +1 @@
|
|
1
|
+
By default, text is not preserved in the typeahead kit when you click off of the input field. You can utilize the `preserve_search_input` prop in order to prevent text from being cleared when the field loses focus
|
@@ -54,6 +54,8 @@ module Playbook
|
|
54
54
|
default: nil
|
55
55
|
prop :disabled, type: Playbook::Props::Boolean,
|
56
56
|
default: false
|
57
|
+
prop :preserve_search_input, type: Playbook::Props::Boolean,
|
58
|
+
default: false
|
57
59
|
|
58
60
|
def classname
|
59
61
|
default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
|
@@ -103,6 +105,7 @@ module Playbook
|
|
103
105
|
optionsByContext: options_by_context,
|
104
106
|
clearOnContextChange: clear_on_context_change,
|
105
107
|
disabled: disabled,
|
108
|
+
preserveSearchInput: preserve_search_input,
|
106
109
|
}
|
107
110
|
|
108
111
|
base_options[:getOptionLabel] = get_option_label if get_option_label.present?
|
@@ -0,0 +1 @@
|
|
1
|
+
import{jsx,Fragment,jsxs}from"react/jsx-runtime";import{useState,useEffect}from"react";import{b as buildAriaProps,a as buildDataProps,c as buildHtmlProps,m as mapColors,H as HighchartsReact,d as Highcharts,e as classnames,g as globalProps,f as HighchartsMore}from"./_typeahead-CuwY9iVi.js";import{h as highchartsTheme,m as merge,a as highchartsDarkTheme}from"./lib-DYpq0k8j.js";const BarGraph=({aria:aria={},data:data={},align:align="center",axisTitle:axisTitle,dark:dark=false,chartData:chartData,className:className="pb_bar_graph",colors:colors,htmlOptions:htmlOptions={},customOptions:customOptions={},axisFormat:axisFormat,id:id,pointStart:pointStart,stacking:stacking,subTitle:subTitle,type:type="column",title:title="Title",xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,legend:legend=false,toggleLegendClick:toggleLegendClick=true,height:height,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:[{labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat&&axisFormat[0]?axisFormat[0].format:""},min:yAxisMin,max:yAxisMax,opposite:false,title:{text:Array.isArray(axisTitle)?axisTitle.length>0?axisTitle[0].name:null:axisTitle},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]}],xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors!==void 0&&colors.length>0?mapColors(colors):highchartsTheme.colors,plotOptions:{series:{stacking:stacking,pointStart:pointStart,borderWidth:stacking?0:"",events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(Array.isArray(axisTitle)&&axisTitle.length>1&&axisTitle[1].name){staticOptions.yAxis.push({labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat[1].format},min:yAxisMin,max:yAxisMax,opposite:true,title:{text:axisTitle[1].name},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]})}if(!toggleLegendClick){staticOptions.plotOptions.series.events={legendItemClick:()=>false}}const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(globalProps(filteredProps),className),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};const alignBlockElement=event=>{const itemToMove=document.querySelector(`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`);const chartContainer=document.querySelector(`#${event.target.renderTo.id}`);if(itemToMove!==null&&chartContainer!==null){itemToMove.style.height=`${event.target.chartHeight}px`;itemToMove.style.width=`${event.target.chartWidth}px`;if(chartContainer.firstChild!==null){chartContainer.firstChild.before(itemToMove)}}};const CircleChart=({align:align="center",aria:aria={},rounded:rounded=false,borderColor:borderColor=(rounded?null:""),borderWidth:borderWidth=(rounded?20:null),chartData:chartData,children:children,className:className,colors:colors=[],customOptions:customOptions={},dark:dark=false,data:data={},dataLabelHtml:dataLabelHtml="<div>{point.name}</div>",dataLabels:dataLabels=false,height:height,htmlOptions:htmlOptions={},id:id,innerSize:innerSize="md",legend:legend=false,maxPointSize:maxPointSize=null,minPointSize:minPointSize=null,startAngle:startAngle=null,style:style="pie",title:title,tooltipHtml:tooltipHtml,useHtml:useHtml=false,zMin:zMin=null,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{headerFormat:null,pointFormat:tooltipHtml?tooltipHtml:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',useHTML:useHtml}});const innerSizes={sm:"35%",md:"50%",lg:"85%",none:"0%"};const innerSizeFormat=size=>innerSizes[size];const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={title:{text:title},chart:{height:height,type:style,events:{render:event=>alignBlockElement(event),redraw:event=>alignBlockElement(event)}},legend:{align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},plotOptions:{pie:{colors:colors.length>0?mapColors(colors):highchartsTheme.colors,dataLabels:{enabled:dataLabels,connectorShape:"straight",connectorWidth:3,format:dataLabelHtml},showInLegend:legend}},series:[{minPointSize:minPointSize,maxPointSize:maxPointSize,innerSize:borderWidth==20?"100%":innerSizeFormat(innerSize),data:formattedChartData,zMin:zMin,startAngle:startAngle,borderWidth:borderWidth,borderColor:borderColor}],credits:false};setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(Fragment,{children:children?jsxs("div",{id:`wrapper-circle-chart-${id}`,children:[jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options}),jsx("div",{className:"pb-circle-chart-block",children:children})]}):jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})})};export{BarGraph as B,CircleChart as C};
|