Skip to content

Commit a050090

Browse files
committed
chore: update version to 1.9.5-beta-11 in package.json and package-lock.json; add onMenuOpen and onMenuClose props to CountrySelect and PhoneInput components
1 parent 01e9160 commit a050090

File tree

5 files changed

+26
-6
lines changed

5 files changed

+26
-6
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.9.5-beta-8",
3+
"version": "1.9.5-beta-11",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/CountrySelect/CountrySelect.component.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const CountrySelect = ({
1414
name,
1515
variant = 'default',
1616
size,
17+
onMenuClose,
18+
onMenuOpen,
1719
}: CountrySelectProps) => {
1820
const countryOptions = useMemo(() => getCountryOptions(variant), [variant])
1921

@@ -51,12 +53,15 @@ const CountrySelect = ({
5153
size={size}
5254
filterOption={filterOption}
5355
getOptionValue={getOptionValue}
56+
onMenuClose={onMenuClose}
57+
onMenuOpen={onMenuOpen}
5458
icon={
5559
variant === 'selectPhoneCode' && selectedOption?.value?.iso2 ? (
5660
<FlagImage country={selectedOption?.value?.iso2} />
5761
) : null
5862
}
5963
controlShouldRenderValue={variant !== 'selectPhoneCode'}
64+
fullWidth
6065
/>
6166
)
6267
}

src/Shared/Components/CountrySelect/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import { CountryISO2Type } from '@Shared/index'
22
import { SelectPickerProps } from '../SelectPicker'
33

44
export interface CountrySelectProps
5-
extends Pick<SelectPickerProps, 'required' | 'label' | 'error' | 'placeholder' | 'size'>,
5+
extends Pick<
6+
SelectPickerProps,
7+
'required' | 'label' | 'error' | 'placeholder' | 'size' | 'onMenuOpen' | 'onMenuClose'
8+
>,
69
Required<Pick<SelectPickerProps, 'name'>> {
710
selectedCountry: CountryISO2Type
811
handleChange: (iso2: CountryISO2Type) => void

src/Shared/Components/PhoneInput/PhoneInput.component.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { usePhoneInput } from 'react-international-phone'
22
import { CountryISO2Type } from '@Shared/index'
3-
import { useRef } from 'react'
3+
import { useRef, useState } from 'react'
44
import { PhoneInputProps } from './types'
55
import { CountrySelect } from '../CountrySelect'
66
import { CustomInput } from '../CustomInput'
@@ -31,6 +31,16 @@ const PhoneInput = ({
3131
},
3232
})
3333

34+
const [isCountrySelectOpen, setIsCountrySelectOpen] = useState<boolean>(false)
35+
36+
const handleOpenCountrySelect = () => {
37+
setIsCountrySelectOpen(true)
38+
}
39+
40+
const handleCloseCountrySelect = () => {
41+
setIsCountrySelectOpen(false)
42+
}
43+
3444
const handleUpdateCountry = (updatedCountry: CountryISO2Type) => {
3545
setCountry(updatedCountry)
3646
}
@@ -41,14 +51,16 @@ const PhoneInput = ({
4151

4252
<div className="flexbox-col dc__gap-4 dc__grid">
4353
<div className="flexbox dc__gap-8 w-100">
44-
<div className="flexbox dc__mxw-50-per mw-76">
54+
<div className={`flexbox dc__mxw-50-per ${isCountrySelectOpen ? 'w-100' : ''}`}>
4555
<CountrySelect
4656
placeholder={null}
4757
selectedCountry={country.iso2}
4858
variant="selectPhoneCode"
4959
handleChange={handleUpdateCountry}
5060
name={countryCodeSelectName}
5161
size={countryCodeSelectSize}
62+
onMenuClose={handleCloseCountrySelect}
63+
onMenuOpen={handleOpenCountrySelect}
5264
/>
5365
</div>
5466

0 commit comments

Comments
 (0)