@blocklet/payment-react 1.18.35 → 1.18.37

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.
@@ -1,339 +1,430 @@
1
1
  /* eslint-disable @typescript-eslint/indent */
2
2
  import { useMemo, forwardRef, useState, useEffect, ChangeEvent, useRef, KeyboardEvent } from 'react';
3
- import { Box, MenuItem, Select, Typography, TextField } from '@mui/material';
3
+ import { Box, MenuItem, Typography, TextField, Dialog, DialogContent, IconButton, Select, Slide } from '@mui/material';
4
+ import { TransitionProps } from '@mui/material/transitions';
4
5
  import { useFormContext } from 'react-hook-form';
5
6
  import { FlagEmoji, defaultCountries, parseCountry } from 'react-international-phone';
6
7
  import type { SxProps } from '@mui/material';
7
8
  import type { CountryIso2 } from 'react-international-phone';
8
9
  import { useMobile } from '../hooks/mobile';
9
10
 
11
+ const Transition = forwardRef(function Transition(
12
+ props: TransitionProps & {
13
+ children: React.ReactElement;
14
+ },
15
+ ref: React.Ref<unknown>
16
+ ) {
17
+ return <Slide direction="up" ref={ref} timeout={200} {...props} />;
18
+ });
19
+
10
20
  export type CountrySelectProps = {
11
21
  value: CountryIso2;
12
22
  onChange: (value: CountryIso2) => void;
13
23
  name: string;
14
24
  sx?: SxProps;
25
+ showDialCode?: boolean;
15
26
  };
16
27
 
17
- const CountrySelect = forwardRef<HTMLDivElement, CountrySelectProps>(({ value, onChange, name, sx }, ref) => {
18
- const { setValue } = useFormContext();
19
- const [open, setOpen] = useState(false);
20
- const [searchText, setSearchText] = useState('');
21
- const inputRef = useRef<HTMLInputElement>(null);
22
- const menuRef = useRef<HTMLDivElement>(null);
23
- const listRef = useRef<HTMLDivElement>(null);
24
- const [focusedIndex, setFocusedIndex] = useState(-1);
25
- const itemHeightRef = useRef<number>(40);
26
- const { isMobile } = useMobile();
27
- const measuredRef = useRef(false);
28
-
29
- // Handle window resize
30
- useEffect(() => {
31
- if (!open) return () => {};
32
- const handleResize = () => {
33
- measuredRef.current = false;
28
+ const CountrySelect = forwardRef<HTMLDivElement, CountrySelectProps>(
29
+ ({ value, onChange, name, sx, showDialCode = false }, ref) => {
30
+ const { setValue } = useFormContext();
31
+ const [open, setOpen] = useState(false);
32
+ const [searchText, setSearchText] = useState('');
33
+ const inputRef = useRef<HTMLInputElement>(null);
34
+ const menuRef = useRef<HTMLDivElement>(null);
35
+ const listRef = useRef<HTMLDivElement>(null);
36
+ const [focusedIndex, setFocusedIndex] = useState(-1);
37
+ const itemHeightRef = useRef<number>(40);
38
+ const { isMobile } = useMobile();
39
+ const measuredRef = useRef(false);
40
+
41
+ // Handle window resize
42
+ useEffect(() => {
43
+ if (!open) return () => {};
44
+ const handleResize = () => {
45
+ measuredRef.current = false;
46
+ };
47
+
48
+ window.addEventListener('resize', handleResize);
49
+ return () => {
50
+ window.removeEventListener('resize', handleResize);
51
+ };
52
+ // eslint-disable-next-line react-hooks/exhaustive-deps
53
+ }, [open]);
54
+
55
+ const scrollToTop = () => {
56
+ if (listRef.current) {
57
+ listRef.current.scrollTop = 0;
58
+ }
34
59
  };
35
60
 
36
- window.addEventListener('resize', handleResize);
37
- return () => {
38
- window.removeEventListener('resize', handleResize);
61
+ const measureItemHeight = () => {
62
+ if (!listRef.current || !open) return;
63
+
64
+ const items = listRef.current.querySelectorAll('.MuiMenuItem-root');
65
+ if (items.length > 0) {
66
+ const firstItem = items[0] as HTMLElement;
67
+ if (firstItem.offsetHeight > 0) {
68
+ itemHeightRef.current = firstItem.offsetHeight;
69
+ }
70
+ }
39
71
  };
40
- // eslint-disable-next-line react-hooks/exhaustive-deps
41
- }, [open]);
42
72
 
43
- const scrollToTop = () => {
44
- if (listRef.current) {
45
- listRef.current.scrollTop = 0;
46
- }
47
- };
73
+ const controlScrollPosition = (index: number) => {
74
+ if (!listRef.current) return;
75
+
76
+ // Always measure height when dropdown is open for accuracy
77
+ if (open && !measuredRef.current) {
78
+ measureItemHeight();
79
+ measuredRef.current = true;
80
+ }
48
81
 
49
- const measureItemHeight = () => {
50
- if (!listRef.current || !open) return;
82
+ const listHeight = listRef.current.clientHeight;
83
+ const targetPosition = index * itemHeightRef.current;
51
84
 
52
- const items = listRef.current.querySelectorAll('.MuiMenuItem-root');
53
- if (items.length > 0) {
54
- const firstItem = items[0] as HTMLElement;
55
- if (firstItem.offsetHeight > 0) {
56
- itemHeightRef.current = firstItem.offsetHeight;
85
+ if (index < 2) {
86
+ listRef.current.scrollTop = 0;
87
+ } else if (index > filteredCountries.length - 3) {
88
+ listRef.current.scrollTop = listRef.current.scrollHeight - listHeight;
89
+ } else {
90
+ const scrollPosition = targetPosition - listHeight / 2 + itemHeightRef.current / 2;
91
+ listRef.current.scrollTop = Math.max(0, scrollPosition);
57
92
  }
58
- }
59
- };
93
+ };
60
94
 
61
- const controlScrollPosition = (index: number) => {
62
- if (!listRef.current) return;
95
+ useEffect(() => {
96
+ let timeout: NodeJS.Timeout | null = null;
97
+ if (open) {
98
+ timeout = setTimeout(() => {
99
+ scrollToTop();
100
+ if (!isMobile && inputRef.current) {
101
+ inputRef.current.focus();
102
+ }
103
+ }, 100);
104
+ } else {
105
+ setSearchText('');
106
+ setFocusedIndex(-1);
107
+ }
108
+ return () => {
109
+ if (timeout) {
110
+ clearTimeout(timeout);
111
+ }
112
+ };
113
+ }, [open, isMobile]);
63
114
 
64
- // Always measure height when dropdown is open for accuracy
65
- if (open && !measuredRef.current) {
66
- measureItemHeight();
67
- measuredRef.current = true;
68
- }
115
+ const filteredCountries = useMemo(() => {
116
+ if (!searchText) return defaultCountries;
69
117
 
70
- const listHeight = listRef.current.clientHeight;
71
- const targetPosition = index * itemHeightRef.current;
118
+ return defaultCountries.filter((c) => {
119
+ const parsed = parseCountry(c);
120
+ return (
121
+ parsed.name.toLowerCase().includes(searchText.toLowerCase()) ||
122
+ parsed.iso2.toLowerCase().includes(searchText.toLowerCase()) ||
123
+ `+${parsed.dialCode}`.includes(searchText)
124
+ );
125
+ });
126
+ }, [searchText]);
72
127
 
73
- if (index < 2) {
74
- listRef.current.scrollTop = 0;
75
- } else if (index > filteredCountries.length - 3) {
76
- listRef.current.scrollTop = listRef.current.scrollHeight - listHeight;
77
- } else {
78
- const scrollPosition = targetPosition - listHeight / 2 + itemHeightRef.current / 2;
79
- listRef.current.scrollTop = Math.max(0, scrollPosition);
80
- }
81
- };
82
-
83
- useEffect(() => {
84
- let timeout: NodeJS.Timeout | null = null;
85
- if (open) {
86
- timeout = setTimeout(() => {
87
- scrollToTop();
88
- if (!isMobile && inputRef.current) {
89
- inputRef.current.focus();
90
- }
91
- }, 100);
92
- } else {
93
- setSearchText('');
128
+ useEffect(() => {
129
+ scrollToTop();
94
130
  setFocusedIndex(-1);
95
- }
96
- return () => {
97
- if (timeout) {
98
- clearTimeout(timeout);
131
+ }, [searchText]);
132
+
133
+ useEffect(() => {
134
+ let timeout: NodeJS.Timeout | null = null;
135
+ if (focusedIndex >= 0) {
136
+ timeout = setTimeout(() => {
137
+ controlScrollPosition(focusedIndex);
138
+ }, 10);
99
139
  }
140
+ return () => {
141
+ if (timeout) {
142
+ clearTimeout(timeout);
143
+ }
144
+ };
145
+ // eslint-disable-next-line react-hooks/exhaustive-deps
146
+ }, [focusedIndex, filteredCountries.length]);
147
+
148
+ const countryDetail = useMemo(() => {
149
+ const item = defaultCountries.find((v) => v[1] === value);
150
+ return value && item ? parseCountry(item) : { name: '' };
151
+ }, [value]);
152
+
153
+ const handleCountryClick = (code: CountryIso2) => {
154
+ onChange(code);
155
+ setValue(name, code);
156
+ setOpen(false);
100
157
  };
101
- }, [open, isMobile]);
102
158
 
103
- const filteredCountries = useMemo(() => {
104
- if (!searchText) return defaultCountries;
159
+ const handleSearchChange = (e: ChangeEvent<HTMLInputElement>) => {
160
+ e.stopPropagation();
161
+ setSearchText(e.target.value);
162
+ };
105
163
 
106
- return defaultCountries.filter((c) => {
107
- const parsed = parseCountry(c);
108
- return (
109
- parsed.name.toLowerCase().includes(searchText.toLowerCase()) ||
110
- parsed.iso2.toLowerCase().includes(searchText.toLowerCase()) ||
111
- `+${parsed.dialCode}`.includes(searchText)
112
- );
113
- });
114
- }, [searchText]);
115
-
116
- useEffect(() => {
117
- scrollToTop();
118
- setFocusedIndex(-1);
119
- }, [searchText]);
120
-
121
- useEffect(() => {
122
- let timeout: NodeJS.Timeout | null = null;
123
- if (focusedIndex >= 0) {
124
- timeout = setTimeout(() => {
125
- controlScrollPosition(focusedIndex);
126
- }, 10);
127
- }
128
- return () => {
129
- if (timeout) {
130
- clearTimeout(timeout);
164
+ const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {
165
+ e.stopPropagation();
166
+
167
+ if (e.key === 'Escape') {
168
+ setOpen(false);
169
+ return;
131
170
  }
132
- };
133
- // eslint-disable-next-line react-hooks/exhaustive-deps
134
- }, [focusedIndex, filteredCountries.length]);
135
-
136
- const countryDetail = useMemo(() => {
137
- const item = defaultCountries.find((v) => v[1] === value);
138
- return value && item ? parseCountry(item) : { name: '' };
139
- }, [value]);
140
-
141
- const onCountryChange = (e: any) => {
142
- onChange(e.target.value as CountryIso2);
143
- setValue(name, e.target.value);
144
- };
145
-
146
- const handleCountryClick = (code: CountryIso2) => {
147
- onChange(code);
148
- setValue(name, code);
149
- setOpen(false);
150
- };
151
-
152
- const handleSearchChange = (e: ChangeEvent<HTMLInputElement>) => {
153
- e.stopPropagation();
154
- setSearchText(e.target.value);
155
- };
156
-
157
- const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {
158
- e.stopPropagation();
159
-
160
- if (e.key === 'Escape') {
161
- setOpen(false);
162
- return;
163
- }
164
171
 
165
- const handleNavigation = (direction: 'next' | 'prev') => {
166
- e.preventDefault();
167
- setFocusedIndex((prev) => {
168
- if (direction === 'next') {
169
- if (prev === -1) return 0;
170
- return prev >= filteredCountries.length - 1 ? 0 : prev + 1;
171
- }
172
- if (prev === -1) return filteredCountries.length - 1;
173
- return prev <= 0 ? filteredCountries.length - 1 : prev - 1;
174
- });
172
+ const handleNavigation = (direction: 'next' | 'prev') => {
173
+ e.preventDefault();
174
+ setFocusedIndex((prev) => {
175
+ if (direction === 'next') {
176
+ if (prev === -1) return 0;
177
+ return prev >= filteredCountries.length - 1 ? 0 : prev + 1;
178
+ }
179
+ if (prev === -1) return filteredCountries.length - 1;
180
+ return prev <= 0 ? filteredCountries.length - 1 : prev - 1;
181
+ });
182
+ };
183
+
184
+ if (e.key === 'Tab') {
185
+ handleNavigation(e.shiftKey ? 'prev' : 'next');
186
+ return;
187
+ }
188
+
189
+ if (e.key === 'ArrowDown') {
190
+ handleNavigation('next');
191
+ return;
192
+ }
193
+
194
+ if (e.key === 'ArrowUp') {
195
+ handleNavigation('prev');
196
+ return;
197
+ }
198
+
199
+ if (e.key === 'Enter' && focusedIndex >= 0 && focusedIndex < filteredCountries.length) {
200
+ e.preventDefault();
201
+ const country = parseCountry(filteredCountries[focusedIndex]);
202
+ handleCountryClick(country.iso2);
203
+ }
175
204
  };
176
205
 
177
- if (e.key === 'Tab') {
178
- handleNavigation(e.shiftKey ? 'prev' : 'next');
179
- return;
180
- }
206
+ const countryListContent = (
207
+ <>
208
+ <Box
209
+ sx={{
210
+ position: 'sticky',
211
+ top: 0,
212
+ zIndex: 1,
213
+ bgcolor: 'background.paper',
214
+ p: 1,
215
+ }}
216
+ onClick={(e) => {
217
+ e.stopPropagation();
218
+ }}>
219
+ <TextField
220
+ inputRef={inputRef}
221
+ autoFocus={!isMobile}
222
+ fullWidth
223
+ placeholder="Search country..."
224
+ value={searchText}
225
+ onChange={handleSearchChange}
226
+ onKeyDown={handleKeyDown}
227
+ onClick={(e) => e.stopPropagation()}
228
+ size="small"
229
+ variant="outlined"
230
+ />
231
+ </Box>
232
+ <Box
233
+ ref={listRef}
234
+ sx={{
235
+ flex: 1,
236
+ overflowY: 'auto',
237
+ overflowX: 'hidden',
238
+ maxHeight: isMobile ? 'calc(60vh - 80px)' : 'calc(300px - 65px)',
239
+ scrollBehavior: 'smooth',
240
+ }}>
241
+ {filteredCountries.length > 0 ? (
242
+ filteredCountries.map((c: any, index) => {
243
+ const parsed = parseCountry(c);
244
+ const isFocused = index === focusedIndex;
181
245
 
182
- if (e.key === 'ArrowDown') {
183
- handleNavigation('next');
184
- return;
185
- }
246
+ return (
247
+ <MenuItem
248
+ key={parsed.iso2}
249
+ value={parsed.iso2}
250
+ selected={parsed.iso2 === value}
251
+ onClick={() => handleCountryClick(parsed.iso2)}
252
+ sx={{
253
+ display: 'flex',
254
+ alignItems: 'center',
255
+ '&.Mui-selected': {
256
+ backgroundColor: 'rgba(0, 0, 0, 0.04)',
257
+ },
258
+ '&:hover': {
259
+ backgroundColor: 'var(--backgrounds-bg-highlight, #eff6ff)',
260
+ },
261
+ ...(isFocused
262
+ ? {
263
+ backgroundColor: 'var(--backgrounds-bg-highlight, #eff6ff)',
264
+ outline: 'none',
265
+ }
266
+ : {}),
267
+ }}>
268
+ <FlagEmoji iso2={parsed.iso2} style={{ marginRight: '8px' }} />
269
+ <Typography>{parsed.name}</Typography>
270
+ {showDialCode && (
271
+ <Typography sx={{ ml: 1 }} color="text.secondary">
272
+ {`+${parsed.dialCode}`}
273
+ </Typography>
274
+ )}
275
+ </MenuItem>
276
+ );
277
+ })
278
+ ) : (
279
+ <MenuItem disabled>
280
+ <Typography color="text.secondary">No countries found</Typography>
281
+ </MenuItem>
282
+ )}
283
+ </Box>
284
+ </>
285
+ );
186
286
 
187
- if (e.key === 'ArrowUp') {
188
- handleNavigation('prev');
189
- return;
287
+ if (!isMobile) {
288
+ return (
289
+ <Select
290
+ ref={ref}
291
+ open={open}
292
+ onOpen={() => setOpen(true)}
293
+ onClose={() => setOpen(false)}
294
+ MenuProps={{
295
+ style: {
296
+ maxHeight: '300px',
297
+ top: '10px',
298
+ },
299
+ anchorOrigin: {
300
+ vertical: 'bottom',
301
+ horizontal: 'left',
302
+ },
303
+ transformOrigin: {
304
+ vertical: 'top',
305
+ horizontal: 'left',
306
+ },
307
+ PaperProps: {
308
+ ref: menuRef,
309
+ sx: {
310
+ display: 'flex',
311
+ '& .MuiList-root': {
312
+ pt: 0,
313
+ display: 'flex',
314
+ flexDirection: 'column',
315
+ overflowY: 'hidden',
316
+ },
317
+ },
318
+ },
319
+ }}
320
+ sx={{
321
+ width: '100%',
322
+ minWidth: '60px',
323
+ fieldset: {
324
+ display: 'none',
325
+ },
326
+ '&.Mui-focused:has(div[aria-expanded="false"])': {
327
+ fieldset: {
328
+ display: 'block',
329
+ },
330
+ },
331
+ '.MuiSelect-select': {
332
+ padding: '8px',
333
+ paddingRight: '24px !important',
334
+ },
335
+ svg: {
336
+ right: 0,
337
+ },
338
+ '.MuiMenuItem-root': {
339
+ justifyContent: 'flex-start',
340
+ },
341
+ ...sx,
342
+ }}
343
+ value={value}
344
+ onChange={(e) => {
345
+ onChange(e.target.value as CountryIso2);
346
+ setValue(name, e.target.value);
347
+ }}
348
+ renderValue={(code) => (
349
+ <Box display="flex" alignItems="center" flexWrap="nowrap" gap={0.5} sx={{ cursor: 'pointer' }}>
350
+ <FlagEmoji iso2={code} style={{ display: 'flex' }} />
351
+ <Typography>{countryDetail?.name}</Typography>
352
+ </Box>
353
+ )}>
354
+ {countryListContent}
355
+ </Select>
356
+ );
190
357
  }
191
358
 
192
- if (e.key === 'Enter' && focusedIndex >= 0 && focusedIndex < filteredCountries.length) {
193
- e.preventDefault();
194
- const country = parseCountry(filteredCountries[focusedIndex]);
195
- handleCountryClick(country.iso2);
196
- }
197
- };
198
-
199
- return (
200
- <Select
201
- ref={ref}
202
- open={open}
203
- onOpen={() => setOpen(true)}
204
- onClose={() => setOpen(false)}
205
- MenuProps={{
206
- style: {
207
- maxHeight: '300px',
208
- top: '10px',
209
- },
210
- anchorOrigin: {
211
- vertical: 'bottom',
212
- horizontal: 'left',
213
- },
214
- transformOrigin: {
215
- vertical: 'top',
216
- horizontal: 'left',
217
- },
218
- PaperProps: {
219
- ref: menuRef,
220
- sx: {
221
- display: 'flex',
222
- '& .MuiList-root': {
223
- pt: 0,
224
- display: 'flex',
225
- flexDirection: 'column',
226
- overflowY: 'hidden',
359
+ return (
360
+ <Box ref={ref} sx={{ ...sx }}>
361
+ <Box
362
+ onClick={() => setOpen(true)}
363
+ display="flex"
364
+ alignItems="center"
365
+ flexWrap="nowrap"
366
+ gap={0.5}
367
+ sx={{
368
+ cursor: 'pointer',
369
+ padding: '8px',
370
+ paddingRight: '24px',
371
+ position: 'relative',
372
+ border: 'none',
373
+ '-webkit-tap-highlight-color': 'transparent',
374
+ userSelect: 'none',
375
+ background: 'none',
376
+ '&:hover, &:focus, &:active': {
377
+ backgroundColor: 'transparent',
378
+ outline: 'none',
227
379
  },
228
- },
229
- },
230
- }}
231
- sx={{
232
- width: '100%',
233
- minWidth: '60px',
234
- fieldset: {
235
- display: 'none',
236
- },
237
- '&.Mui-focused:has(div[aria-expanded="false"])': {
238
- fieldset: {
239
- display: 'block',
240
- },
241
- },
242
- '.MuiSelect-select': {
243
- padding: '8px',
244
- paddingRight: '24px !important',
245
- },
246
- svg: {
247
- right: 0,
248
- },
249
- '.MuiMenuItem-root': {
250
- justifyContent: 'flex-start',
251
- },
252
- ...sx,
253
- }}
254
- value={value}
255
- onChange={onCountryChange}
256
- renderValue={(code) => (
257
- <Box display="flex" alignItems="center" flexWrap="nowrap" gap={0.5} sx={{ cursor: 'pointer' }}>
258
- <FlagEmoji iso2={code} style={{ display: 'flex' }} />
380
+ touchAction: 'manipulation',
381
+ }}>
382
+ <FlagEmoji iso2={value} style={{ display: 'flex' }} />
259
383
  <Typography>{countryDetail?.name}</Typography>
384
+ <Box
385
+ sx={{
386
+ position: 'absolute',
387
+ right: '8px',
388
+ width: 0,
389
+ height: 0,
390
+ borderLeft: '5px solid transparent',
391
+ borderRight: '5px solid transparent',
392
+ borderTop: '5px solid currentColor',
393
+ }}
394
+ />
260
395
  </Box>
261
- )}>
262
- <Box
263
- sx={{
264
- position: 'sticky',
265
- top: 0,
266
- zIndex: 1,
267
- bgcolor: 'background.paper',
268
- p: 1,
269
- }}
270
- onClick={(e) => {
271
- e.stopPropagation();
272
- }}>
273
- <TextField
274
- inputRef={inputRef}
275
- autoFocus={!isMobile}
276
- fullWidth
277
- placeholder="Search country..."
278
- value={searchText}
279
- onChange={handleSearchChange}
280
- onKeyDown={handleKeyDown}
281
- onClick={(e) => e.stopPropagation()}
282
- size="small"
283
- variant="outlined"
284
- />
285
- </Box>
286
396
 
287
- <Box
288
- ref={listRef}
289
- sx={{
290
- flex: 1,
291
- overflowY: 'auto',
292
- overflowX: 'hidden',
293
- maxHeight: 'calc(300px - 65px)',
294
- scrollBehavior: 'smooth',
295
- }}>
296
- {filteredCountries.length > 0 ? (
297
- filteredCountries.map((c: any, index) => {
298
- const parsed = parseCountry(c);
299
- const isFocused = index === focusedIndex;
300
-
301
- return (
302
- <MenuItem
303
- key={parsed.iso2}
304
- value={parsed.iso2}
305
- selected={parsed.iso2 === value}
306
- onClick={() => handleCountryClick(parsed.iso2)}
307
- sx={{
308
- '&.Mui-selected': {
309
- backgroundColor: 'rgba(0, 0, 0, 0.04)',
310
- },
311
- '&:hover': {
312
- backgroundColor: 'var(--backgrounds-bg-highlight, #eff6ff)',
313
- },
314
- ...(isFocused
315
- ? {
316
- backgroundColor: 'var(--backgrounds-bg-highlight, #eff6ff)',
317
- outline: 'none',
318
- }
319
- : {}),
320
- }}>
321
- <FlagEmoji iso2={parsed.iso2} style={{ marginRight: '8px' }} />
322
- <Typography>{parsed.name}</Typography>
323
- </MenuItem>
324
- );
325
- })
326
- ) : (
327
- <MenuItem disabled>
328
- <Typography color="text.secondary">No countries found</Typography>
329
- </MenuItem>
330
- )}
397
+ <Dialog
398
+ open={open}
399
+ onClose={() => setOpen(false)}
400
+ fullWidth
401
+ maxWidth="xs"
402
+ TransitionComponent={Transition}
403
+ PaperProps={{
404
+ sx: {
405
+ position: 'absolute',
406
+ bottom: 0,
407
+ m: 0,
408
+ borderBottomLeftRadius: 0,
409
+ borderBottomRightRadius: 0,
410
+ width: '100%',
411
+ },
412
+ }}>
413
+ <Box sx={{ p: 2, display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
414
+ <Typography variant="h6">Select Country</Typography>
415
+ <IconButton edge="end" onClick={() => setOpen(false)} sx={{ '-webkit-tap-highlight-color': 'transparent' }}>
416
+
417
+ </IconButton>
418
+ </Box>
419
+ <DialogContent sx={{ p: 0 }}>{countryListContent}</DialogContent>
420
+ </Dialog>
331
421
  </Box>
332
- </Select>
333
- );
334
- });
422
+ );
423
+ }
424
+ );
335
425
 
336
426
  CountrySelect.defaultProps = {
337
427
  sx: {},
428
+ showDialCode: false,
338
429
  };
339
430
  export default CountrySelect;