playbook_ui 15.5.0.pre.alpha.play265012854 → 15.5.0.pre.alpha.revert5553typeaheadfix12763
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_background/_background.tsx +6 -6
- data/app/pb_kits/playbook/pb_background/background.test.js +1 -5
- data/app/pb_kits/playbook/pb_background/docs/_background_light.html.erb +1 -1
- data/app/pb_kits/playbook/pb_background/docs/_background_light.jsx +1 -0
- data/app/pb_kits/playbook/pb_background/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +0 -6
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +0 -31
- data/app/pb_kits/playbook/pb_legend/_legend.tsx +1 -6
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +10 -44
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb +4 -34
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +7 -16
- data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +2 -13
- data/dist/chunks/_typeahead-j69iQ_Qb.js +6 -0
- data/dist/chunks/vendor.js +2 -2
- data/dist/menu.yml +2 -3
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +3 -6
- data/app/pb_kits/playbook/pb_background/docs/_background_light.md +0 -1
- data/app/pb_kits/playbook/utilities/DEPRECATION_WARNINGS.md +0 -82
- data/app/pb_kits/playbook/utilities/deprecated.ts +0 -71
- data/dist/chunks/_typeahead-EauOtKPs.js +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1a59cf8f69d5fe52b8de77c8841a833bf94874562f059e400cd0d579d594a138
|
|
4
|
+
data.tar.gz: 6cfe8278c2647fbd8d2a9e8a53aa9b3e05dd4ed95956054f875614b4b39de579
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a9ddcc0dc503a03291f2098bc20dbf1e2c7e061dd5813b47d22d668e69e6174a329ee0124d3f97eb456d3d2eae3407206e9b538284f1d800e007dd90533481a
|
|
7
|
+
data.tar.gz: 4617c2fa17d4fd3cc8ea7d5fbb046f4a7963fa62a5c7410cceed78b028b1ba93a75043ea54e13744f2b14c0a57f63750235984cc9949122c83c7c1616d41665b
|
|
@@ -102,16 +102,16 @@ const Background = (props: BackgroundProps): React.ReactElement => {
|
|
|
102
102
|
useEffect(() => {
|
|
103
103
|
const updateResponsiveProps = () => {
|
|
104
104
|
setResponsiveProps({
|
|
105
|
-
backgroundSize: getResponsiveValue(backgroundSize),
|
|
106
|
-
backgroundPosition: getResponsiveValue(backgroundPosition),
|
|
107
|
-
backgroundRepeat: getResponsiveValue(backgroundRepeat),
|
|
108
|
-
backgroundColor: getResponsiveValue(backgroundColor),
|
|
109
|
-
imageUrl: getResponsiveValue(imageUrl),
|
|
105
|
+
backgroundSize: getResponsiveValue(props.backgroundSize),
|
|
106
|
+
backgroundPosition: getResponsiveValue(props.backgroundPosition),
|
|
107
|
+
backgroundRepeat: getResponsiveValue(props.backgroundRepeat),
|
|
108
|
+
backgroundColor: getResponsiveValue(props.backgroundColor),
|
|
109
|
+
imageUrl: getResponsiveValue(props.imageUrl),
|
|
110
110
|
});
|
|
111
111
|
};
|
|
112
112
|
window.addEventListener('resize', updateResponsiveProps);
|
|
113
113
|
return () => window.removeEventListener('resize', updateResponsiveProps);
|
|
114
|
-
}, [
|
|
114
|
+
}, [props]);
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
// Extract currently applicable responsive values.
|
|
@@ -4,6 +4,7 @@ import Background from './_background'
|
|
|
4
4
|
|
|
5
5
|
const props = {
|
|
6
6
|
data: { testid: 'background' },
|
|
7
|
+
backgroundColor: null,
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
it('Should be accessible', async () => {
|
|
@@ -41,8 +42,3 @@ test('applies correct overlay class when imageOverlay prop is provided', () => {
|
|
|
41
42
|
const kit = renderKit(Background, props, { imageOverlay: 'opacity_6' });
|
|
42
43
|
expect(kit).toHaveClass('imageoverlay_opacity_6');
|
|
43
44
|
});
|
|
44
|
-
|
|
45
|
-
test('Sets backgroundColor to light as default when no backgroundColor prop is provided', () => {
|
|
46
|
-
const kit = renderKit(Background, props);
|
|
47
|
-
expect(kit).toHaveClass('pb_background_color_light');
|
|
48
|
-
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
examples:
|
|
2
2
|
|
|
3
3
|
rails:
|
|
4
|
-
- background_light:
|
|
4
|
+
- background_light: Light
|
|
5
5
|
- background_white: White
|
|
6
6
|
- background_gradient: Gradient
|
|
7
7
|
- background_image: Image
|
|
@@ -11,7 +11,7 @@ examples:
|
|
|
11
11
|
- background_size: Size
|
|
12
12
|
|
|
13
13
|
react:
|
|
14
|
-
- background_light:
|
|
14
|
+
- background_light: Light
|
|
15
15
|
- background_white: White
|
|
16
16
|
- background_gradient: Gradient
|
|
17
17
|
- background_image: Image
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
|
2
2
|
import { globalProps } from "../utilities/globalProps";
|
|
3
3
|
import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
|
|
4
|
-
import { deprecatedKitWarning } from "../utilities/deprecated";
|
|
5
4
|
|
|
6
5
|
import HighchartsReact from "highcharts-react-official";
|
|
7
6
|
import Highcharts from "highcharts";
|
|
@@ -169,11 +168,6 @@ if (Array.isArray(axisTitle) && axisTitle.length > 1 && axisTitle[1].name) {
|
|
|
169
168
|
|
|
170
169
|
const [options, setOptions] = useState({});
|
|
171
170
|
|
|
172
|
-
useEffect(() => {
|
|
173
|
-
// Warn about deprecated kit (only once per page load, dev mode only)
|
|
174
|
-
deprecatedKitWarning('BarGraph', '[Playbook] The "BarGraph" kit is deprecated. Please use "PbBarGraph" instead.');
|
|
175
|
-
}, []);
|
|
176
|
-
|
|
177
171
|
useEffect(() => {
|
|
178
172
|
setOptions(merge(staticOptions, customOptions));
|
|
179
173
|
}, [chartData]);
|
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
<%
|
|
2
|
-
options = [
|
|
3
|
-
{
|
|
4
|
-
label: "United States",
|
|
5
|
-
value: "unitedStates",
|
|
6
|
-
id: "us"
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
label: "United Kingdom",
|
|
10
|
-
value: "unitedKingdom",
|
|
11
|
-
id: "gb"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
label: "Pakistan",
|
|
15
|
-
value: "pakistan",
|
|
16
|
-
id: "pk"
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
%>
|
|
20
|
-
|
|
21
|
-
|
|
22
1
|
<%= pb_rails("button", props: { text: "Open Complex Dialog", data:{"open-dialog": "dialog-complex"} }) %>
|
|
23
2
|
|
|
24
3
|
<%= pb_rails("dialog", props: { id:"dialog-complex", size: "lg", full_height: true }) do %>
|
|
@@ -31,16 +10,6 @@
|
|
|
31
10
|
<%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %>
|
|
32
11
|
<%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
|
|
33
12
|
<%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
|
|
34
|
-
<%= pb_rails("dropdown", props: {options: options, autocomplete: true}) %>
|
|
35
|
-
<%= pb_rails("typeahead", props: {
|
|
36
|
-
id: "typeahead-default",
|
|
37
|
-
placeholder: "Select one...",
|
|
38
|
-
options: options,
|
|
39
|
-
name: :foo,
|
|
40
|
-
margin_top: "sm",
|
|
41
|
-
is_multi: false
|
|
42
|
-
})
|
|
43
|
-
%>
|
|
44
13
|
|
|
45
14
|
<% end %>
|
|
46
15
|
<%= pb_rails("dialog/dialog_footer", props: {cancel_button: "Back", confirm_button: "Send my Issue", confirm_button_id:"confirm-complex", id: "dialog-complex"}) %>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react'
|
|
2
2
|
import classnames from 'classnames'
|
|
3
3
|
|
|
4
4
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
|
5
5
|
import { globalProps } from '../utilities/globalProps'
|
|
6
|
-
import { deprecatedKitWarning } from '../utilities/deprecated'
|
|
7
6
|
|
|
8
7
|
import Body from '../pb_body/_body'
|
|
9
8
|
import Title from '../pb_title/_title'
|
|
@@ -33,10 +32,6 @@ const Legend = (props: LegendProps) => {
|
|
|
33
32
|
text,
|
|
34
33
|
} = props
|
|
35
34
|
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
deprecatedKitWarning('Legend')
|
|
38
|
-
}, [])
|
|
39
|
-
|
|
40
35
|
const ariaProps = buildAriaProps(aria)
|
|
41
36
|
const dataProps = buildDataProps(data)
|
|
42
37
|
const htmlProps = buildHtmlProps(htmlOptions)
|
|
@@ -110,25 +110,13 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
|
110
110
|
const inputRef = useRef<HTMLInputElement | null>(null)
|
|
111
111
|
const itiRef = useRef<any>(null);
|
|
112
112
|
const wrapperRef = useRef<HTMLDivElement | null>(null);
|
|
113
|
-
const hasBlurredRef = useRef<boolean>(false);
|
|
114
|
-
const formSubmittedRef = useRef<boolean>(false);
|
|
115
113
|
const [inputValue, setInputValue] = useState(value)
|
|
116
114
|
const [error, setError] = useState(props.error || "")
|
|
117
115
|
const [dropDownIsOpen, setDropDownIsOpen] = useState(false)
|
|
118
116
|
const [selectedData, setSelectedData] = useState()
|
|
119
117
|
const [hasTyped, setHasTyped] = useState(false)
|
|
120
|
-
const [hasBlurred, setHasBlurred] = useState(false)
|
|
121
118
|
const [formSubmitted, setFormSubmitted] = useState(false)
|
|
122
119
|
const [hasStartedValidating, setHasStartedValidating] = useState(false)
|
|
123
|
-
|
|
124
|
-
// Keep refs in sync with state for use in event listeners
|
|
125
|
-
useEffect(() => {
|
|
126
|
-
hasBlurredRef.current = hasBlurred
|
|
127
|
-
}, [hasBlurred])
|
|
128
|
-
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
formSubmittedRef.current = formSubmitted
|
|
131
|
-
}, [formSubmitted])
|
|
132
120
|
|
|
133
121
|
// Only sync initial error from props, not continuous updates
|
|
134
122
|
// Once validation starts, internal validation takes over
|
|
@@ -155,8 +143,8 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
|
155
143
|
}
|
|
156
144
|
|
|
157
145
|
// Determine which error to display
|
|
158
|
-
// Show internal errors
|
|
159
|
-
const shouldShowInternalError = (
|
|
146
|
+
// Show internal errors on blur (hasTyped) or on form submission (formSubmitted)
|
|
147
|
+
const shouldShowInternalError = (hasTyped || formSubmitted) && required && error
|
|
160
148
|
const displayError = shouldShowInternalError ? error : ""
|
|
161
149
|
|
|
162
150
|
useEffect(() => {
|
|
@@ -271,9 +259,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
|
271
259
|
return
|
|
272
260
|
}
|
|
273
261
|
|
|
274
|
-
|
|
275
|
-
// Use refs here since state updates are async and we need current values
|
|
276
|
-
if (!hasBlurredRef.current && !formSubmittedRef.current) return
|
|
262
|
+
if (!hasTyped && !error) return
|
|
277
263
|
|
|
278
264
|
// Run validation checks
|
|
279
265
|
if (itiRef.current) isValid(itiRef.current.isValidNumber())
|
|
@@ -294,7 +280,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
|
294
280
|
if (phoneNumberContainer && phoneNumberContainer === wrapperRef.current) {
|
|
295
281
|
const invalidInputName = target.name || target.getAttribute('name')
|
|
296
282
|
if (invalidInputName === name) {
|
|
297
|
-
formSubmittedRef.current = true
|
|
298
283
|
setFormSubmitted(true)
|
|
299
284
|
// Trigger validation when form is submitted
|
|
300
285
|
validateErrors()
|
|
@@ -320,9 +305,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
|
320
305
|
setInputValue("")
|
|
321
306
|
setError("")
|
|
322
307
|
setHasTyped(false)
|
|
323
|
-
hasBlurredRef.current = false
|
|
324
|
-
setHasBlurred(false)
|
|
325
|
-
formSubmittedRef.current = false
|
|
326
308
|
setFormSubmitted(false)
|
|
327
309
|
setHasStartedValidating(false)
|
|
328
310
|
// Only clear validation state if field was required
|
|
@@ -340,7 +322,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
|
340
322
|
|
|
341
323
|
if (required && isEmpty) {
|
|
342
324
|
setError('Missing phone number')
|
|
343
|
-
formSubmittedRef.current = true
|
|
344
325
|
setFormSubmitted(true)
|
|
345
326
|
return 'Missing phone number'
|
|
346
327
|
}
|
|
@@ -397,7 +378,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
|
397
378
|
|
|
398
379
|
// Set the error state so the validation attribute gets added
|
|
399
380
|
setError(errorMessage)
|
|
400
|
-
formSubmittedRef.current = true
|
|
401
381
|
setFormSubmitted(true)
|
|
402
382
|
setHasTyped(true)
|
|
403
383
|
|
|
@@ -421,7 +401,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
|
421
401
|
|
|
422
402
|
// Reset form submitted state when user types
|
|
423
403
|
if (formSubmitted) {
|
|
424
|
-
formSubmittedRef.current = false
|
|
425
404
|
setFormSubmitted(false)
|
|
426
405
|
}
|
|
427
406
|
|
|
@@ -437,15 +416,11 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
|
437
416
|
|
|
438
417
|
setSelectedData(phoneNumberData)
|
|
439
418
|
onChange(phoneNumberData)
|
|
440
|
-
|
|
441
|
-
// Don't call isValid callback on change - only on blur or form submission
|
|
442
|
-
// This prevents triggering validation while typing
|
|
443
|
-
// Use refs to get current values in case this is called from event listener
|
|
444
|
-
if (hasBlurredRef.current || formSubmittedRef.current) {
|
|
445
|
-
isValid(itiRef.current.isValidNumber())
|
|
446
|
-
}
|
|
419
|
+
isValid(itiRef.current.isValidNumber())
|
|
447
420
|
|
|
448
|
-
//
|
|
421
|
+
// Trigger validation after onChange for React Hook Form
|
|
422
|
+
// This ensures validation state is up-to-date
|
|
423
|
+
setTimeout(() => validateErrors(), 0)
|
|
449
424
|
}
|
|
450
425
|
|
|
451
426
|
// Separating Concerns as React Docs Recommend
|
|
@@ -507,12 +482,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
|
507
482
|
|
|
508
483
|
setSelectedData(phoneNumberData)
|
|
509
484
|
onChange(phoneNumberData)
|
|
510
|
-
|
|
511
|
-
// Don't call isValid callback on change - only on blur or form submission
|
|
512
|
-
// Use refs to check current blur state in the event listener (closure issue)
|
|
513
|
-
if (hasBlurredRef.current || formSubmittedRef.current) {
|
|
514
|
-
isValid(telInputInit.isValidNumber())
|
|
515
|
-
}
|
|
485
|
+
isValid(telInputInit.isValidNumber())
|
|
516
486
|
})
|
|
517
487
|
}
|
|
518
488
|
}
|
|
@@ -522,16 +492,12 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
|
522
492
|
dark,
|
|
523
493
|
"data-phone-number": JSON.stringify(selectedData),
|
|
524
494
|
disabled,
|
|
525
|
-
error:
|
|
495
|
+
error: hasTyped ? error : props.error || displayError,
|
|
526
496
|
type: 'tel',
|
|
527
497
|
id,
|
|
528
498
|
label,
|
|
529
499
|
name,
|
|
530
|
-
onBlur:
|
|
531
|
-
hasBlurredRef.current = true
|
|
532
|
-
setHasBlurred(true)
|
|
533
|
-
validateErrors()
|
|
534
|
-
},
|
|
500
|
+
onBlur: validateErrors,
|
|
535
501
|
onChange: formatAsYouType ? undefined : handleOnChange,
|
|
536
502
|
value: inputValue
|
|
537
503
|
}
|
data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb
CHANGED
|
@@ -1,42 +1,12 @@
|
|
|
1
1
|
<form id="example-form-validation" action="" method="get">
|
|
2
|
-
<%= pb_rails("phone_number_input", props: {
|
|
3
|
-
id: "validation",
|
|
4
|
-
initial_country: "af",
|
|
5
|
-
value: "",
|
|
6
|
-
required: true
|
|
7
|
-
}) %>
|
|
2
|
+
<%= pb_rails("phone_number_input", props: { error: "Missing phone number", id: "validation", initial_country: "af", value: "", required: true }) %>
|
|
8
3
|
<%= pb_rails("button", props: {html_type: "submit", text: "Save Phone Number"}) %>
|
|
9
4
|
</form>
|
|
10
5
|
|
|
11
6
|
<%= javascript_tag do %>
|
|
12
7
|
document.addEventListener('DOMContentLoaded', function () {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function waitForComponent() {
|
|
17
|
-
const phoneInput = form.querySelector('#validation');
|
|
18
|
-
|
|
19
|
-
if (!phoneInput) {
|
|
20
|
-
setTimeout(waitForComponent, 100);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Wait for intl-tel-input to initialize, then focus and blur to trigger validation
|
|
25
|
-
setTimeout(function() {
|
|
26
|
-
phoneInput.focus({ preventScroll: true });
|
|
27
|
-
setTimeout(function() {
|
|
28
|
-
phoneInput.blur();
|
|
29
|
-
}, 100);
|
|
30
|
-
}, 500);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
waitForComponent();
|
|
34
|
-
|
|
35
|
-
// Prevent form submission if there are validation errors
|
|
36
|
-
form.addEventListener('submit', function (e) {
|
|
37
|
-
if (e.target.querySelectorAll('[error]:not([error=""])').length > 0) {
|
|
38
|
-
e.preventDefault();
|
|
39
|
-
}
|
|
40
|
-
});
|
|
8
|
+
document.querySelector('#example-form-validation').addEventListener('submit', function (e) {
|
|
9
|
+
if (e.target.querySelectorAll('[error]:not([error=""])').length > 0) e.preventDefault();
|
|
10
|
+
})
|
|
41
11
|
})
|
|
42
12
|
<% end %>
|
|
@@ -10,19 +10,8 @@ const PhoneNumberInputValidation = (props) => {
|
|
|
10
10
|
const [showFormErrors, setShowFormErrors] = useState(false);
|
|
11
11
|
const [phoneNumber, setPhoneNumber] = useState("");
|
|
12
12
|
const [countryCode, setCountryCode] = useState("af");
|
|
13
|
-
const [isValid, setIsValid] = useState(false);
|
|
14
|
-
const [hasInteracted, setHasInteracted] = useState(false);
|
|
15
|
-
|
|
16
|
-
// Start with initial error - will be cleared on blur if valid
|
|
17
|
-
const initialError = (
|
|
18
|
-
<>
|
|
19
|
-
<Icon icon="warning" /> Missing phone number.
|
|
20
|
-
</>
|
|
21
|
-
);
|
|
22
13
|
|
|
23
14
|
const handleOnValidate = (valid) => {
|
|
24
|
-
setIsValid(valid);
|
|
25
|
-
setHasInteracted(true);
|
|
26
15
|
setFormErrors(
|
|
27
16
|
valid ? "" : "Please correct the fields below and try again."
|
|
28
17
|
);
|
|
@@ -34,16 +23,18 @@ const PhoneNumberInputValidation = (props) => {
|
|
|
34
23
|
};
|
|
35
24
|
|
|
36
25
|
const handleOnSubmit = (e) => {
|
|
37
|
-
if (
|
|
26
|
+
if (showFormErrors) e.preventDefault()
|
|
38
27
|
}
|
|
39
28
|
|
|
40
29
|
useEffect(() => {
|
|
41
30
|
setShowFormErrors(formErrors.length > 0);
|
|
42
31
|
}, [formErrors]);
|
|
43
32
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
const error = (
|
|
34
|
+
<>
|
|
35
|
+
<Icon icon="warning" /> Missing phone number.
|
|
36
|
+
</>
|
|
37
|
+
)
|
|
47
38
|
|
|
48
39
|
return (
|
|
49
40
|
<form
|
|
@@ -59,7 +50,7 @@ const PhoneNumberInputValidation = (props) => {
|
|
|
59
50
|
/>
|
|
60
51
|
)}
|
|
61
52
|
<PhoneNumberInput
|
|
62
|
-
error={
|
|
53
|
+
error={error}
|
|
63
54
|
id="validation"
|
|
64
55
|
initialCountry={countryCode}
|
|
65
56
|
onChange={handleOnChange}
|
|
@@ -7,29 +7,18 @@ type ClearContainerProps = {
|
|
|
7
7
|
id: string,
|
|
8
8
|
},
|
|
9
9
|
clearValue: () => void,
|
|
10
|
-
innerProps?: any,
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
const ClearContainer = (props: ClearContainerProps
|
|
14
|
-
const { selectProps, clearValue
|
|
12
|
+
const ClearContainer = (props: ClearContainerProps): React.ReactElement => {
|
|
13
|
+
const { selectProps, clearValue } = props
|
|
15
14
|
useEffect(() => {
|
|
16
15
|
document.addEventListener(`pb-typeahead-kit-${selectProps.id}:clear`, clearValue)
|
|
17
16
|
}, [clearValue, selectProps.id])
|
|
18
17
|
|
|
19
|
-
// To stop this from bubbling up when inside a dialog or other modal
|
|
20
|
-
const handleMouseDown = (event: React.MouseEvent) => {
|
|
21
|
-
event.stopPropagation()
|
|
22
|
-
innerProps?.onMouseDown?.(event)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
18
|
return (
|
|
26
19
|
<components.ClearIndicator
|
|
27
20
|
className="clear_indicator"
|
|
28
21
|
{...props}
|
|
29
|
-
innerProps={{
|
|
30
|
-
...innerProps,
|
|
31
|
-
onMouseDown: handleMouseDown,
|
|
32
|
-
}}
|
|
33
22
|
/>
|
|
34
23
|
)
|
|
35
24
|
}
|