playbook_ui 14.22.0.pre.alpha.PLAY2132phonenumberinputvalidationtooaggressive8863 → 14.22.0.pre.alpha.PLAY2207preservesearchinputrails8526
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 +7 -6
- data/app/pb_kits/playbook/pb_advanced_table/Components/SubRowHeaderRow.tsx +11 -32
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +0 -5
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +0 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +2 -2
- data/app/pb_kits/playbook/pb_badge/_badge.scss +6 -5
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.jsx +15 -33
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.jsx +72 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.md +6 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.jsx +15 -33
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.jsx +22 -52
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_horizontal.jsx +16 -12
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend.jsx +15 -31
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_non_clickable.jsx +16 -39
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.jsx +38 -86
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_negative_numbers.jsx +15 -32
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.jsx +64 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.jsx +22 -72
- 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 +15 -31
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.jsx +16 -37
- data/app/pb_kits/playbook/pb_bar_graph/docs/_description.md +3 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_circle_chart/circleChartTheme.ts +1 -36
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.jsx +26 -71
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.jsx +16 -29
- data/app/pb_kits/playbook/pb_circle_chart/docs/{_circle_chart_colors_rails.md → _circle_chart_colors.md} +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.jsx +16 -28
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.md +2 -4
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.jsx +15 -23
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_inner_sizes.jsx +51 -81
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.jsx +75 -103
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +6 -3
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_live_data.jsx +13 -19
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.jsx +38 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.jsx +17 -30
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_labels.jsx +20 -34
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_legend_kit.jsx +20 -29
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_title.jsx +20 -28
- data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +17 -27
- 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/example.yml +0 -1
- data/app/pb_kits/playbook/pb_tooltip/index.js +36 -59
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +2 -9
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_preserve_input.html.erb +0 -1
- data/dist/chunks/{_typeahead-Do6525vz.js → _typeahead-B7FRYVtS.js} +3 -3
- data/dist/chunks/_weekday_stacked-B0oaGhTW.js +45 -0
- data/dist/chunks/{lib-DYpq0k8j.js → lib-Carqm8Ip.js} +1 -1
- data/dist/chunks/{pb_form_validation-BUOKwfvW.js → pb_form_validation-DqRmTS8m.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- 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 +14 -19
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_sort.jsx +0 -65
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_sort.md +0 -5
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header.jsx +0 -69
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header.md +0 -1
- data/app/pb_kits/playbook/pb_bar_graph/barGraphTheme.ts +0 -106
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.md +0 -3
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors_react.md +0 -2
- data/app/pb_kits/playbook/pb_circle_chart/docs/_description.md +0 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open.html.erb +0 -14
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open_rails.md +0 -1
- data/dist/chunks/_circle_chart-C56zcOHC.js +0 -1
- data/dist/chunks/_weekday_stacked-CrFm3XuJ.js +0 -45
- /data/app/pb_kits/playbook/pb_tooltip/docs/{_tooltip_click_open_react.md → _tooltip_click_open.md} +0 -0
@@ -68,7 +68,7 @@ const containOnlyNumbers = (value: string) => {
|
|
68
68
|
return /^[()+\-\ .\d]*$/g.test(value)
|
69
69
|
}
|
70
70
|
|
71
|
-
const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.
|
71
|
+
const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefObject<unknown>) => {
|
72
72
|
const {
|
73
73
|
aria = {},
|
74
74
|
className,
|
@@ -106,16 +106,15 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
106
106
|
className
|
107
107
|
)
|
108
108
|
|
109
|
-
const inputRef = useRef<HTMLInputElement
|
109
|
+
const inputRef = useRef<HTMLInputElement>()
|
110
110
|
const itiRef = useRef<any>(null);
|
111
111
|
const [inputValue, setInputValue] = useState(value)
|
112
112
|
const [error, setError] = useState(props.error)
|
113
113
|
const [dropDownIsOpen, setDropDownIsOpen] = useState(false)
|
114
114
|
const [selectedData, setSelectedData] = useState()
|
115
|
-
const [hasTyped, setHasTyped] = useState(false)
|
116
115
|
|
117
116
|
useEffect(() => {
|
118
|
-
if (
|
117
|
+
if (error?.length > 0) {
|
119
118
|
onValidate(false)
|
120
119
|
} else {
|
121
120
|
onValidate(true)
|
@@ -132,7 +131,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
132
131
|
clearField() {
|
133
132
|
setInputValue("")
|
134
133
|
setError("")
|
135
|
-
setHasTyped(false)
|
136
134
|
},
|
137
135
|
inputNode() {
|
138
136
|
return inputRef.current
|
@@ -203,8 +201,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
203
201
|
}
|
204
202
|
|
205
203
|
const validateErrors = () => {
|
206
|
-
if (!hasTyped && !error) return
|
207
|
-
|
208
204
|
if (itiRef.current) isValid(itiRef.current.isValidNumber())
|
209
205
|
if (validateOnlyNumbers(itiRef.current)) return
|
210
206
|
if (validateTooLongNumber(itiRef.current)) return
|
@@ -218,7 +214,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
218
214
|
}
|
219
215
|
|
220
216
|
const handleOnChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
|
221
|
-
if (!hasTyped) setHasTyped(true)
|
222
217
|
setInputValue(evt.target.value)
|
223
218
|
let phoneNumberData
|
224
219
|
if (formatAsYouType) {
|
@@ -264,17 +259,16 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
264
259
|
|
265
260
|
itiRef.current = telInputInit;
|
266
261
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
262
|
+
inputRef.current.addEventListener("countrychange", (evt: Event) => {
|
263
|
+
const phoneNumberData = getCurrentSelectedData(telInputInit, (evt.target as HTMLInputElement).value)
|
264
|
+
setSelectedData(phoneNumberData)
|
265
|
+
onChange(phoneNumberData)
|
266
|
+
validateErrors()
|
267
|
+
})
|
268
|
+
|
269
|
+
inputRef.current.addEventListener("open:countrydropdown", () => setDropDownIsOpen(true))
|
270
|
+
inputRef.current.addEventListener("close:countrydropdown", () => setDropDownIsOpen(false))
|
274
271
|
|
275
|
-
inputRef.current.addEventListener("open:countrydropdown", () => setDropDownIsOpen(true))
|
276
|
-
inputRef.current.addEventListener("close:countrydropdown", () => setDropDownIsOpen(false))
|
277
|
-
}
|
278
272
|
if (formatAsYouType) {
|
279
273
|
inputRef.current?.addEventListener("input", (evt) => {
|
280
274
|
handleOnChange(evt as unknown as React.ChangeEvent<HTMLInputElement>);
|
@@ -309,16 +303,12 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
309
303
|
{...htmlProps}
|
310
304
|
>
|
311
305
|
<TextInput
|
312
|
-
ref={
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
} else {
|
317
|
-
(ref as React.MutableRefObject<HTMLInputElement | null>).current = inputNode
|
318
|
-
}
|
306
|
+
ref={
|
307
|
+
inputNode => {
|
308
|
+
ref ? ref.current = inputNode : null
|
309
|
+
inputRef.current = inputNode
|
319
310
|
}
|
320
|
-
|
321
|
-
}}
|
311
|
+
}
|
322
312
|
{...textInputProps}
|
323
313
|
/>
|
324
314
|
</div>
|
@@ -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[
|
108
|
-
const cells = document.querySelectorAll(`td[
|
107
|
+
const header = document.querySelector(`th[id="${colId}"]`);
|
108
|
+
const cells = document.querySelectorAll(`td[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[
|
159
|
-
const cells = document.querySelectorAll(`td[
|
158
|
+
const header = document.querySelector(`th[id="${colId}"]`);
|
159
|
+
const cells = document.querySelectorAll(`td[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
|
14
|
+
<th 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
|
28
|
+
<th id="b">{'Column 15'}</th>
|
29
29
|
</tr>
|
30
30
|
</thead>
|
31
31
|
<tbody>
|
32
32
|
<tr>
|
33
|
-
<td
|
33
|
+
<td 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
|
47
|
+
<td id="b">{'Value 15'}</td>
|
48
48
|
</tr>
|
49
49
|
<tr>
|
50
|
-
<td
|
50
|
+
<td 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
|
64
|
+
<td id="b">{'Value 15'}</td>
|
65
65
|
</tr>
|
66
66
|
<tr>
|
67
|
-
<td
|
67
|
+
<td 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
|
81
|
+
<td 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 ids are used for all columns across multiple tables. Using the same columns ids 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
|
14
|
-
<th
|
15
|
-
<th
|
13
|
+
<th id="1">{'Column 1'}</th>
|
14
|
+
<th id="2">{'Column 2'}</th>
|
15
|
+
<th 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
|
33
|
-
<td
|
34
|
-
<td
|
32
|
+
<td id="1">{'Value 1'}</td>
|
33
|
+
<td id="2">{'Value 2'}</td>
|
34
|
+
<td 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
|
50
|
-
<td
|
51
|
-
<td
|
49
|
+
<td id="1">{'Value 1'}</td>
|
50
|
+
<td id="2">{'Value 2'}</td>
|
51
|
+
<td 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
|
67
|
-
<td
|
68
|
-
<td
|
66
|
+
<td id="1">{'Value 1'}</td>
|
67
|
+
<td id="2">{'Value 2'}</td>
|
68
|
+
<td 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 ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
|
2
2
|
|
3
|
-
If you are using the sub-component variant, then you will pass the
|
3
|
+
If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
|
4
4
|
|
5
|
-
Please ensure that unique
|
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.
|
@@ -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
|
26
|
-
<th
|
27
|
-
<th
|
25
|
+
<th id="13">{'Column 13'}</th>
|
26
|
+
<th id="14">{'Column 14'}</th>
|
27
|
+
<th 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
|
45
|
-
<td
|
46
|
-
<td
|
44
|
+
<td id="13">{'Value 13'}</td>
|
45
|
+
<td id="14">{'Value 14'}</td>
|
46
|
+
<td 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
|
62
|
-
<td
|
63
|
-
<td
|
61
|
+
<td id="13">{'Value 13'}</td>
|
62
|
+
<td id="14">{'Value 14'}</td>
|
63
|
+
<td 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
|
79
|
-
<td
|
80
|
-
<td
|
78
|
+
<td id="13">{'Value 13'}</td>
|
79
|
+
<td id="14">{'Value 14'}</td>
|
80
|
+
<td 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 ids you want to be sticky. Make sure to add the corresponding id to the `<th>` and `<td>`.
|
2
2
|
|
3
|
-
If you are using the sub-component variant, then you will pass the
|
3
|
+
If you are using the sub-component variant, then you will pass the id to `<Table.Header>` and `<Table.Cell>`
|
4
4
|
|
5
|
-
Please ensure that unique
|
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 the `stickyRightColumn` prop.
|
@@ -19,75 +19,60 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
this.triggerElements.forEach((trigger) => {
|
22
|
-
const method = this.
|
22
|
+
const method = this.triggerMethod
|
23
23
|
const interactionEnabled = this.tooltipInteraction
|
24
24
|
|
25
25
|
if (method === 'click') {
|
26
|
-
trigger.addEventListener('click', (
|
27
|
-
|
28
|
-
e.preventDefault()
|
29
|
-
if (this.isTooltipVisible()) {
|
30
|
-
this.hideTooltip()
|
31
|
-
} else {
|
32
|
-
this.showTooltip(trigger)
|
33
|
-
}
|
34
|
-
} else {
|
35
|
-
this.showTooltip(trigger)
|
36
|
-
}
|
26
|
+
trigger.addEventListener('click', () => {
|
27
|
+
this.showTooltip(trigger)
|
37
28
|
})
|
38
29
|
} else {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
this.
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
})
|
30
|
+
trigger.addEventListener('mouseenter', () => {
|
31
|
+
clearSafeZoneListener(this)
|
32
|
+
clearTimeout(this.mouseleaveTimeout)
|
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)
|
39
|
+
}
|
40
|
+
}, delayOpen)
|
41
|
+
})
|
52
42
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
if (interactionEnabled) {
|
59
|
-
this.attachSafeZoneListener()
|
60
|
-
} else {
|
61
|
-
this.hideTooltip()
|
62
|
-
}
|
63
|
-
}, delayClose)
|
64
|
-
} else {
|
43
|
+
trigger.addEventListener('mouseleave', () => {
|
44
|
+
clearTimeout(this.mouseenterTimeout)
|
45
|
+
if (this.delayClose) {
|
46
|
+
const delayClose = parseInt(this.delayClose)
|
47
|
+
this.mouseleaveTimeout = setTimeout(() => {
|
65
48
|
if (interactionEnabled) {
|
66
49
|
this.attachSafeZoneListener()
|
67
50
|
} else {
|
68
51
|
this.hideTooltip()
|
69
52
|
}
|
53
|
+
}, delayClose)
|
54
|
+
} else {
|
55
|
+
if (interactionEnabled) {
|
56
|
+
this.attachSafeZoneListener()
|
57
|
+
} else {
|
58
|
+
this.hideTooltip()
|
70
59
|
}
|
71
|
-
}
|
60
|
+
}
|
61
|
+
})
|
72
62
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
63
|
+
if (interactionEnabled) {
|
64
|
+
this.tooltip.addEventListener('mouseenter', () => {
|
65
|
+
clearSafeZoneListener(this)
|
66
|
+
})
|
77
67
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
}
|
68
|
+
this.tooltip.addEventListener('mouseleave', () => {
|
69
|
+
this.attachSafeZoneListener()
|
70
|
+
})
|
82
71
|
}
|
83
72
|
}
|
84
73
|
})
|
85
74
|
}
|
86
75
|
|
87
|
-
isTooltipVisible() {
|
88
|
-
return this.tooltip && this.tooltip.classList.contains('show')
|
89
|
-
}
|
90
|
-
|
91
76
|
attachSafeZoneListener() {
|
92
77
|
clearSafeZoneListener(this)
|
93
78
|
this.safeZoneHandler = (e) => {
|
@@ -160,7 +145,7 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
160
145
|
|
161
146
|
this.tooltip.classList.add('show')
|
162
147
|
|
163
|
-
if (this.
|
148
|
+
if (this.triggerMethod === 'click') {
|
164
149
|
clearTimeout(this.autoHideTimeout)
|
165
150
|
this.autoHideTimeout = setTimeout(() => {
|
166
151
|
this.hideTooltip()
|
@@ -239,14 +224,6 @@ export default class PbTooltip extends PbEnhancedElement {
|
|
239
224
|
return this.element.dataset.pbTooltipTriggerMethod || 'hover'
|
240
225
|
}
|
241
226
|
|
242
|
-
get useClickToOpen() {
|
243
|
-
return this.element.dataset.pbTooltipUseClickToOpen === 'true'
|
244
|
-
}
|
245
|
-
|
246
|
-
get effectiveTriggerMethod() {
|
247
|
-
return this.useClickToOpen ? 'click' : this.triggerMethod
|
248
|
-
}
|
249
|
-
|
250
227
|
get tooltipInteraction() {
|
251
228
|
return this.element.dataset.pbTooltipInteraction === 'true'
|
252
229
|
}
|
@@ -21,8 +21,6 @@ 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
|
26
24
|
prop :width
|
27
25
|
|
28
26
|
def classname
|
@@ -48,10 +46,6 @@ module Playbook
|
|
48
46
|
out
|
49
47
|
end
|
50
48
|
|
51
|
-
def effective_trigger_method
|
52
|
-
use_click_to_open ? "click" : (trigger_method || "hover")
|
53
|
-
end
|
54
|
-
|
55
49
|
def data
|
56
50
|
data = Hash(values[:data]).merge(
|
57
51
|
pb_tooltip_kit: true,
|
@@ -60,9 +54,8 @@ module Playbook
|
|
60
54
|
pb_tooltip_trigger_element_id: trigger_element_id,
|
61
55
|
pb_tooltip_tooltip_id: tooltip_id,
|
62
56
|
pb_tooltip_show_tooltip: true,
|
63
|
-
pb_tooltip_trigger_method:
|
64
|
-
pb_tooltip_interaction: interaction
|
65
|
-
pb_tooltip_use_click_to_open: use_click_to_open
|
57
|
+
pb_tooltip_trigger_method: trigger_method,
|
58
|
+
pb_tooltip_interaction: interaction
|
66
59
|
)
|
67
60
|
data = data.merge(pb_tooltip_delay_open: delay_open) if delay_open
|
68
61
|
data = data.merge(pb_tooltip_delay_close: delay_close) if delay_close
|