playbook_ui 14.22.0 → 14.23.0.pre.alpha.PLAY2205atborderbug9085
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/Components/SubRowHeaderRow.tsx +32 -11
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +10 -10
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +58 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +15 -6
- 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 +13 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table_action_bar.js +16 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_sort.jsx +65 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_sort.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.html.erb +46 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling_rails.md +7 -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/_advanced_table_with_custom_header_rails.html.erb +51 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +13 -8
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +7 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +36 -0
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +13 -4
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +2 -0
- 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_legend_position.md +1 -1
- 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_body/docs/_body_truncate.jsx +3 -3
- data/app/pb_kits/playbook/pb_body/docs/_body_truncate_react.md +4 -0
- 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 +4 -7
- 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_draggable/context/index.tsx +12 -4
- data/app/pb_kits/playbook/pb_draggable/context/types.ts +5 -2
- data/app/pb_kits/playbook/pb_gauge/docs/_description.md +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.jsx +32 -15
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors_react.md +2 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.jsx +35 -9
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex_react.md +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_default.jsx +26 -14
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_disable_animation.jsx +32 -15
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.jsx +45 -17
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_height.jsx +59 -22
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx +40 -9
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.jsx +50 -18
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.jsx +31 -18
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_title.jsx +34 -17
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units.jsx +64 -23
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units_react.md +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_gauge/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_gauge/gaugeTheme.ts +7 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/_description.md +1 -3
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.jsx +36 -17
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors_react.md +3 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_default.jsx +31 -16
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +63 -31
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.md +3 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend.jsx +35 -16
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_nonclickable.jsx +41 -16
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.jsx +107 -62
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.md +4 -7
- data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_line_graph/lineGraphTheme.ts +16 -1
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +30 -17
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.html.erb +10 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.jsx +26 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.md +3 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +3 -0
- 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_title/docs/_title_truncate.jsx +3 -3
- data/app/pb_kits/playbook/pb_title/docs/_title_truncate_react.md +4 -0
- 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/_line_graph-BfCo79KE.js +1 -0
- data/dist/chunks/_typeahead-Db4YQA5c.js +6 -0
- data/dist/chunks/_weekday_stacked-BNHSKTSw.js +61 -0
- data/dist/chunks/lib-DnQyMxO1.js +29 -0
- data/dist/chunks/{pb_form_validation-Dx1C9XCK.js → pb_form_validation-kl-4Jv4t.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 +2 -2
- metadata +43 -25
- 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/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx +0 -30
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md +0 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.jsx +0 -52
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.md +0 -1
- data/dist/chunks/_typeahead-dOC1gq2X.js +0 -22
- data/dist/chunks/_weekday_stacked-Bh8iY5uA.js +0 -45
- data/dist/chunks/lib-DtCftrUN.js +0 -29
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_row_styling.md → _advanced_table_row_styling_react.md} +0 -0
- /data/app/pb_kits/playbook/pb_body/docs/{_body_truncate.md → _body_truncate_rails.md} +0 -0
- /data/app/pb_kits/playbook/pb_gauge/docs/{_gauge_colors.md → _gauge_colors_rails.md} +0 -0
- /data/app/pb_kits/playbook/pb_gauge/docs/{_gauge_complex.md → _gauge_complex_rails.md} +0 -0
- /data/app/pb_kits/playbook/pb_line_graph/docs/{_line_graph_colors.md → _line_graph_colors_rails.md} +0 -0
- /data/app/pb_kits/playbook/pb_title/docs/{_title_truncate.md → _title_truncate_rails.md} +0 -0
- /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
|
@@ -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.
|
|
@@ -20,7 +20,7 @@ const TitleTruncate = (props) => {
|
|
|
20
20
|
marginBottom="md"
|
|
21
21
|
size={4}
|
|
22
22
|
text={lorem}
|
|
23
|
-
truncate=
|
|
23
|
+
truncate={1}
|
|
24
24
|
{...props}
|
|
25
25
|
/>
|
|
26
26
|
|
|
@@ -32,7 +32,7 @@ const TitleTruncate = (props) => {
|
|
|
32
32
|
marginBottom="md"
|
|
33
33
|
size={4}
|
|
34
34
|
text={lorem}
|
|
35
|
-
truncate=
|
|
35
|
+
truncate={2}
|
|
36
36
|
{...props}
|
|
37
37
|
/>
|
|
38
38
|
|
|
@@ -43,7 +43,7 @@ const TitleTruncate = (props) => {
|
|
|
43
43
|
<Title
|
|
44
44
|
size={4}
|
|
45
45
|
text={lorem}
|
|
46
|
-
truncate=
|
|
46
|
+
truncate={3}
|
|
47
47
|
{...props}
|
|
48
48
|
/>
|
|
49
49
|
</Flex>
|
|
@@ -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,c as buildDataProps,d as buildHtmlProps,H as HighchartsReact,e as Highcharts,f as classnames,g as globalProps,h as HighchartsMore,S as SolidGauge,i as buildCss}from"./_typeahead-Db4YQA5c.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-DnQyMxO1.js";const mapColors=array=>{const regex=/(data)\-[1-8]/;const newArray=array.map((item=>regex.test(item)?`${colors[`data_${item[item.length-1]}`]}`:item));return newArray};const BarGraph=({aria:aria={},data:data={},align:align="center",axisTitle:axisTitle,dark:dark=false,chartData:chartData,className:className="pb_bar_graph",colors:colors2,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:colors2!==void 0&&colors2.length>0?mapColors(colors2):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:colors2=[],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:colors2.length>0?mapColors(colors2):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})})};const Gauge=({aria:aria={},chartData:chartData,customOptions:customOptions={},dark:dark=false,data:data={},disableAnimation:disableAnimation=false,fullCircle:fullCircle=false,height:height=null,htmlOptions:htmlOptions={},id:id,max:max=100,min:min=0,prefix:prefix="",showLabels:showLabels=false,style:style="solidgauge",suffix:suffix="",title:title="",tooltipHtml:tooltipHtml='<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',colors:colors$1=[],minorTickInterval:minorTickInterval=null,circumference:circumference=(fullCircle?[0,360]:[-100,100]),...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);SolidGauge(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{pointFormat:tooltipHtml,followPointer:true}});const css=buildCss({pb_gauge_kit:true});const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={chart:{events:{load(){setTimeout(this.reflow.bind(this),0)}},type:style,height:height},title:{text:title},yAxis:{min:min,max:max,lineWidth:0,tickWidth:0,minorTickInterval:minorTickInterval,tickAmount:2,tickPositions:[min,max],labels:{y:26,enabled:showLabels}},credits:false,series:[{data:formattedChartData}],pane:{center:["50%","50%"],size:"90%",startAngle:circumference[0],endAngle:circumference[1],background:{borderWidth:20,innerRadius:"90%",outerRadius:"90%",shape:"arc",className:"gauge-pane"}},colors:colors$1!==void 0&&colors$1.length>0?mapColors(colors$1):highchartsTheme.colors,plotOptions:{series:{animation:!disableAnimation},solidgauge:{borderColor:colors$1!==void 0&&colors$1.length===1?mapColors(colors$1).join():highchartsTheme.colors[0],borderWidth:20,radius:90,innerRadius:"90%",dataLabels:{borderWidth:0,color:colors.text_lt_default,enabled:true,format:`<span class="prefix${dark?" dark":""}">${prefix}</span><span class="fix${dark?" dark":""}">{y:,f}</span><span class="suffix${dark?" dark":""}">${suffix}</span>`,style:{fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_2},y:-26}}}};setOptions(merge(staticOptions,customOptions));if(document.querySelector(".prefix")){document.querySelectorAll(".prefix").forEach((prefix2=>{prefix2.setAttribute("y","28")}));document.querySelectorAll(".fix").forEach((fix=>fix.setAttribute("y","38")))}}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(css,globalProps(props)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};const LineGraph=({aria:aria={},data:data={},align:align="center",className:className="pb_bar_graph",customOptions:customOptions={},dark:dark=false,gradient:gradient=false,type:type="line",htmlOptions:htmlOptions={},id:id,legend:legend=false,toggleLegendClick:toggleLegendClick=true,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,axisTitle:axisTitle,xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,chartData:chartData,pointStart:pointStart,subTitle:subTitle,title:title,height:height,colors:colors2=[],...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:{min:yAxisMin,max:yAxisMax,title:{text:axisTitle}},xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors2!==void 0&&colors2.length>0?mapColors(colors2):highchartsTheme.colors,plotOptions:{series:{pointStart:pointStart,events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};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})};export{BarGraph as B,CircleChart as C,Gauge as G,LineGraph as L};
|