@m4l/gclick 0.36.0 → 0.36.1-beta-feature-795-m4l-react-native-ui-indicator-flag.0
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.
- package/@types/types.d.ts +8 -0
- package/components/PhoneNumberField/PhoneNumberField.d.ts +4 -0
- package/components/PhoneNumberField/PhoneNumberField.d.ts.map +1 -0
- package/components/PhoneNumberField/PhoneNumberField.js +99 -0
- package/components/PhoneNumberField/index.d.ts +3 -0
- package/components/PhoneNumberField/index.d.ts.map +1 -0
- package/components/PhoneNumberField/phoneNumber.d.ts +5 -0
- package/components/PhoneNumberField/phoneNumber.d.ts.map +1 -0
- package/components/PhoneNumberField/phoneNumber.js +12 -0
- package/components/PhoneNumberField/types.d.ts +30 -0
- package/components/PhoneNumberField/types.d.ts.map +1 -0
- package/components/RHFs/RHFPhoneNumberField/RHFPhoneNumberField.d.ts +5 -0
- package/components/RHFs/RHFPhoneNumberField/RHFPhoneNumberField.d.ts.map +1 -0
- package/components/RHFs/RHFPhoneNumberField/RHFPhoneNumberField.js +81 -0
- package/components/RHFs/RHFPhoneNumberField/RHFPhoneNumberField.slots.d.ts +5 -0
- package/components/RHFs/RHFPhoneNumberField/RHFPhoneNumberField.slots.d.ts.map +1 -0
- package/components/RHFs/RHFPhoneNumberField/RHFPhoneNumberField.slots.js +13 -0
- package/components/RHFs/RHFPhoneNumberField/index.d.ts +3 -0
- package/components/RHFs/RHFPhoneNumberField/index.d.ts.map +1 -0
- package/components/RHFs/RHFPhoneNumberField/types.d.ts +13 -0
- package/components/RHFs/RHFPhoneNumberField/types.d.ts.map +1 -0
- package/components/index.d.ts +2 -0
- package/components/index.d.ts.map +1 -1
- package/components/indicators/IndicatorCountryPhone/IndicatorCountryPhone.d.ts +4 -0
- package/components/indicators/IndicatorCountryPhone/IndicatorCountryPhone.d.ts.map +1 -0
- package/components/indicators/IndicatorCountryPhone/IndicatorCountryPhone.js +249 -0
- package/components/indicators/IndicatorCountryPhone/IndicatorCountryPhone.slots.d.ts +40 -0
- package/components/indicators/IndicatorCountryPhone/IndicatorCountryPhone.slots.d.ts.map +1 -0
- package/components/indicators/IndicatorCountryPhone/IndicatorCountryPhone.slots.js +21 -0
- package/components/indicators/IndicatorCountryPhone/IndicatorCountryPhone.styles.d.ts +4 -0
- package/components/indicators/IndicatorCountryPhone/IndicatorCountryPhone.styles.d.ts.map +1 -0
- package/components/indicators/IndicatorCountryPhone/IndicatorCountryPhone.styles.js +175 -0
- package/components/indicators/IndicatorCountryPhone/constants.d.ts +9 -0
- package/components/indicators/IndicatorCountryPhone/constants.d.ts.map +1 -0
- package/components/indicators/IndicatorCountryPhone/constants.js +11 -0
- package/components/indicators/IndicatorCountryPhone/countryFlags.generated.d.ts +3 -0
- package/components/indicators/IndicatorCountryPhone/countryFlags.generated.d.ts.map +1 -0
- package/components/indicators/IndicatorCountryPhone/countryFlags.generated.js +251 -0
- package/components/indicators/IndicatorCountryPhone/countryOptions.d.ts +6 -0
- package/components/indicators/IndicatorCountryPhone/countryOptions.d.ts.map +1 -0
- package/components/indicators/IndicatorCountryPhone/countryOptions.js +31 -0
- package/components/indicators/IndicatorCountryPhone/dictionary.d.ts +15 -0
- package/components/indicators/IndicatorCountryPhone/dictionary.d.ts.map +1 -0
- package/components/indicators/IndicatorCountryPhone/dictionary.js +21 -0
- package/components/indicators/IndicatorCountryPhone/hooks/useCountryPhoneCatalog/index.d.ts +3 -0
- package/components/indicators/IndicatorCountryPhone/hooks/useCountryPhoneCatalog/index.d.ts.map +1 -0
- package/components/indicators/IndicatorCountryPhone/hooks/useCountryPhoneCatalog/types.d.ts +19 -0
- package/components/indicators/IndicatorCountryPhone/hooks/useCountryPhoneCatalog/types.d.ts.map +1 -0
- package/components/indicators/IndicatorCountryPhone/hooks/useCountryPhoneCatalog/useCountryPhoneCatalog.d.ts +12 -0
- package/components/indicators/IndicatorCountryPhone/hooks/useCountryPhoneCatalog/useCountryPhoneCatalog.d.ts.map +1 -0
- package/components/indicators/IndicatorCountryPhone/hooks/useCountryPhoneCatalog/useCountryPhoneCatalog.js +146 -0
- package/components/indicators/IndicatorCountryPhone/index.d.ts +4 -0
- package/components/indicators/IndicatorCountryPhone/index.d.ts.map +1 -0
- package/components/indicators/IndicatorCountryPhone/slots.d.ts +16 -0
- package/components/indicators/IndicatorCountryPhone/slots.d.ts.map +1 -0
- package/components/indicators/IndicatorCountryPhone/slots.js +4 -0
- package/components/indicators/IndicatorCountryPhone/types.d.ts +88 -0
- package/components/indicators/IndicatorCountryPhone/types.d.ts.map +1 -0
- package/components/indicators/index.d.ts +1 -0
- package/components/indicators/index.d.ts.map +1 -1
- package/index.js +248 -240
- package/package.json +3 -3
package/@types/types.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { GaugeCircularOwnerState, GaugeCircularSlotsType } from '../components/G
|
|
|
6
6
|
import { IndicatorCSQOwnerState, IndicatorCSQSlotsType } from '../components/indicators/IndicatorCSQ/types';
|
|
7
7
|
import { IndicatorBatteryOwnerState, IndicatorBatterySlotsType } from '../components/indicators/IndicatorBattery/types';
|
|
8
8
|
import { IndicatorValueStatusSlotsType } from '../components/indicators/IndicatorValueStatus/types';
|
|
9
|
+
import { IndicatorCountryPhoneOwnerState, IndicatorCountryPhoneSlotsType } from '../components/indicators/IndicatorCountryPhone/types';
|
|
9
10
|
import { VideoTimeLineSelectorOwnerState, VideoTimeLineSelectorSlotsType } from '../components/VideoTimeLineSelector/types';
|
|
10
11
|
import { VideoPlayerOwnerState, VideoPlayerSlotsType } from '../components/VideoPlayer/types';
|
|
11
12
|
import { CameraStreamOwnerState, CameraStreamSlotsStyledType } from '../components/CameraStream/types';
|
|
@@ -35,6 +36,7 @@ declare module '@mui/material/styles' {
|
|
|
35
36
|
M4LCSQSignal: IndicatorCSQSlotsType;
|
|
36
37
|
M4LIndicatorBattery: IndicatorBatterySlotsType;
|
|
37
38
|
M4LIndicatorValueStatus: IndicatorValueStatusSlotsType;
|
|
39
|
+
M4LIndicatorCountryPhone: IndicatorCountryPhoneSlotsType;
|
|
38
40
|
M4LVideoTimeLineSelector: VideoTimeLineSelectorSlotsType;
|
|
39
41
|
M4LVideoPlayer: VideoPlayerSlotsType;
|
|
40
42
|
M4LCameraStream: CameraStreamSlotsStyledType;
|
|
@@ -55,6 +57,7 @@ declare module '@mui/material/styles' {
|
|
|
55
57
|
M4LCSQSignal: Partial<IndicatorCSQOwnerState>;
|
|
56
58
|
M4LIndicatorBattery: Partial<IndicatorBatteryOwnerState>;
|
|
57
59
|
M4LIndicatorValueStatus: Partial<IndicatorValueStatusOwnerState>;
|
|
60
|
+
M4LIndicatorCountryPhone: Partial<IndicatorCountryPhoneOwnerState>;
|
|
58
61
|
M4LVideoTimeLineSelector: Partial<VideoTimeLineSelectorOwnerState>;
|
|
59
62
|
M4LVideoPlayer: Partial<VideoPlayerOwnerState>;
|
|
60
63
|
M4LCameraStream: Partial<CameraStreamOwnerState>;
|
|
@@ -110,6 +113,11 @@ declare module '@mui/material/styles' {
|
|
|
110
113
|
styleOverrides?: ComponentsOverrides<Theme>['M4LIndicatorValueStatus'];
|
|
111
114
|
variants?: ComponentsVariants['M4LIndicatorValueStatus'];
|
|
112
115
|
};
|
|
116
|
+
M4LIndicatorCountryPhone?: {
|
|
117
|
+
defaultProps?: ComponentsPropsList['M4LIndicatorCountryPhone'];
|
|
118
|
+
styleOverrides?: ComponentsOverrides<Theme>['M4LIndicatorCountryPhone'];
|
|
119
|
+
variants?: ComponentsVariants['M4LIndicatorCountryPhone'];
|
|
120
|
+
};
|
|
113
121
|
M4LVideoTimeLineSelector?: {
|
|
114
122
|
defaultProps?: ComponentsPropsList['M4LVideoTimeLineSelector'];
|
|
115
123
|
styleOverrides?: ComponentsOverrides<Theme>['M4LVideoTimeLineSelector'];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PhoneNumberFieldProps } from './types';
|
|
2
|
+
/** Enter national digits while storing a complete E.164-style phone value. */
|
|
3
|
+
export declare function PhoneNumberField(props: PhoneNumberFieldProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=PhoneNumberField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PhoneNumberField.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/PhoneNumberField/PhoneNumberField.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AA4BrD,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,oDA4G5D"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsx as h } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { TextField as j } from "@m4l/components";
|
|
3
|
+
import { InputAdornment as L } from "@mui/material";
|
|
4
|
+
import { styled as W } from "@mui/material/styles";
|
|
5
|
+
import { useState as O, useMemo as V } from "react";
|
|
6
|
+
import { IndicatorCountryPhone as k } from "../indicators/IndicatorCountryPhone/IndicatorCountryPhone.js";
|
|
7
|
+
import { resolveIndicatorCountryPhoneCountries as q } from "../indicators/IndicatorCountryPhone/countryOptions.js";
|
|
8
|
+
import { splitPhoneNumber as E } from "./phoneNumber.js";
|
|
9
|
+
import { useCountryPhoneCatalog as G } from "../indicators/IndicatorCountryPhone/hooks/useCountryPhoneCatalog/useCountryPhoneCatalog.js";
|
|
10
|
+
const J = W(j, {
|
|
11
|
+
name: "M4LPhoneNumberField",
|
|
12
|
+
slot: "Root",
|
|
13
|
+
shouldForwardProp: (o) => o !== "inputHeight"
|
|
14
|
+
})(({ theme: o, size: a, inputHeight: d }) => {
|
|
15
|
+
const s = d === "compact" ? o.vars.size.baseSpacings.sp6 : a === "small" ? o.vars.size.baseSpacings.sp8 : o.vars.size.baseSpacings.sp9;
|
|
16
|
+
return {
|
|
17
|
+
"&&&& .MuiInputBase-root": {
|
|
18
|
+
height: s,
|
|
19
|
+
minHeight: s,
|
|
20
|
+
overflow: "visible"
|
|
21
|
+
},
|
|
22
|
+
"&&&& .MuiInputAdornment-root": {
|
|
23
|
+
alignSelf: "stretch",
|
|
24
|
+
display: "flex",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
height: "auto",
|
|
27
|
+
maxHeight: "none"
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
function oe(o) {
|
|
32
|
+
const {
|
|
33
|
+
value: a,
|
|
34
|
+
defaultValue: d = "",
|
|
35
|
+
onChange: s,
|
|
36
|
+
options: n,
|
|
37
|
+
defaultCountry: F = "es",
|
|
38
|
+
onCountryChange: S,
|
|
39
|
+
indicatorProps: x,
|
|
40
|
+
inputHeight: A = "comfortable",
|
|
41
|
+
variant: B = "contained",
|
|
42
|
+
disabled: y = !1,
|
|
43
|
+
readOnly: C = !1,
|
|
44
|
+
InputProps: c,
|
|
45
|
+
autoComplete: H = "tel-national",
|
|
46
|
+
...p
|
|
47
|
+
} = o, [M, R] = O(d), [i, $] = O(F), m = a ?? M, t = G({
|
|
48
|
+
enabled: n === void 0 || n.length > 0,
|
|
49
|
+
selectedValue: i
|
|
50
|
+
}), r = V(
|
|
51
|
+
() => q(t.countries, n, t.locale),
|
|
52
|
+
[t.countries, t.locale, n]
|
|
53
|
+
), w = V(() => t.selectedCountry && !r.some((e) => e.value === t.selectedCountry?.value) ? [...r, t.selectedCountry] : r, [t.selectedCountry, r]), { country: v, nationalDigits: g } = E(
|
|
54
|
+
m,
|
|
55
|
+
w,
|
|
56
|
+
i
|
|
57
|
+
), l = v ?? r.find((e) => e.value === i) ?? t.selectedCountry ?? r[0], P = !!(l && r.some((e) => e.value === l.value)), f = t.status === "loaded", u = m.startsWith("+") && !v, z = C || !!(c?.readOnly || p.inputProps?.readOnly) || !f || !P || u, N = u ? m : g, D = n?.length !== 0 && (!f || !u);
|
|
58
|
+
function b(e) {
|
|
59
|
+
a === void 0 && R(e), s?.(e);
|
|
60
|
+
}
|
|
61
|
+
function T(e) {
|
|
62
|
+
if (!f || !l || !P || u)
|
|
63
|
+
return;
|
|
64
|
+
const I = e.target.value.replace(/\D/g, "");
|
|
65
|
+
b(I ? `${l.callingCode}${I}` : "");
|
|
66
|
+
}
|
|
67
|
+
return /* @__PURE__ */ h(
|
|
68
|
+
J,
|
|
69
|
+
{
|
|
70
|
+
...p,
|
|
71
|
+
inputHeight: A,
|
|
72
|
+
variant: B,
|
|
73
|
+
value: N,
|
|
74
|
+
onChange: T,
|
|
75
|
+
disabled: y || n?.length === 0,
|
|
76
|
+
readOnly: z,
|
|
77
|
+
autoComplete: H,
|
|
78
|
+
InputProps: {
|
|
79
|
+
...c,
|
|
80
|
+
type: "tel",
|
|
81
|
+
startAdornment: D ? /* @__PURE__ */ h(L, { position: "start", children: /* @__PURE__ */ h(
|
|
82
|
+
k,
|
|
83
|
+
{
|
|
84
|
+
...x,
|
|
85
|
+
options: n,
|
|
86
|
+
value: l?.value ?? i,
|
|
87
|
+
disabled: y || C || !!(c?.readOnly || p.inputProps?.readOnly),
|
|
88
|
+
onChange: (e) => {
|
|
89
|
+
$(e.value), b(g ? `${e.callingCode}${g}` : ""), S?.(e);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
) }) : void 0
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
oe as PhoneNumberField
|
|
99
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/PhoneNumberField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CountryPhoneCountry } from '../indicators/IndicatorCountryPhone/types';
|
|
2
|
+
import { SplitPhoneNumberResult } from './types';
|
|
3
|
+
/** Extract the national digits and best matching country from an international value. */
|
|
4
|
+
export declare function splitPhoneNumber(value: string, countries: readonly CountryPhoneCountry[], preferredCountry: string): SplitPhoneNumberResult;
|
|
5
|
+
//# sourceMappingURL=phoneNumber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phoneNumber.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/PhoneNumberField/phoneNumber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,yFAAyF;AACzF,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,SAAS,mBAAmB,EAAE,EACzC,gBAAgB,EAAE,MAAM,GACvB,sBAAsB,CAexB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function r(n, c, s) {
|
|
2
|
+
if (!n.startsWith("+"))
|
|
3
|
+
return { country: void 0, nationalDigits: n.replace(/\D/g, "") };
|
|
4
|
+
const e = `+${n.slice(1).replace(/\D/g, "")}`, l = c.filter((t) => e.startsWith(t.callingCode)), a = Math.max(0, ...l.map((t) => t.callingCode.length)), o = l.filter((t) => t.callingCode.length === a), i = o.find((t) => t.value === s) ?? o[0];
|
|
5
|
+
return {
|
|
6
|
+
country: i,
|
|
7
|
+
nationalDigits: i ? e.slice(i.callingCode.length) : e.slice(1)
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
r as splitPhoneNumber
|
|
12
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TextField } from '@m4l/components';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
import { IndicatorCountryPhoneOption, IndicatorCountryPhoneProps, CountryPhoneCountry } from '../indicators/IndicatorCountryPhone/types';
|
|
4
|
+
type TextFieldProps = ComponentProps<typeof TextField>;
|
|
5
|
+
/** Result of separating a complete phone value with the loaded country catalog. */
|
|
6
|
+
export interface SplitPhoneNumberResult {
|
|
7
|
+
country: CountryPhoneCountry | undefined;
|
|
8
|
+
nationalDigits: string;
|
|
9
|
+
}
|
|
10
|
+
/** Props for a phone field whose form value includes the international prefix. */
|
|
11
|
+
export interface PhoneNumberFieldProps extends Omit<TextFieldProps, 'value' | 'defaultValue' | 'onChange' | 'label' | 'helperText'> {
|
|
12
|
+
/** Complete international number, for example `+34123456789`; empty while no digits are entered. */
|
|
13
|
+
value?: string;
|
|
14
|
+
/** Initial complete number when used without controlled value. */
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
/** Receives the complete international number or an empty string. */
|
|
17
|
+
onChange?: (value: string) => void;
|
|
18
|
+
/** E.164 calling codes available in the selector. Omit for the full catalog. */
|
|
19
|
+
options?: readonly number[];
|
|
20
|
+
/** Country selected before a number is entered; defaults to Spain. */
|
|
21
|
+
defaultCountry?: string;
|
|
22
|
+
/** Receives the selected country, including its calling code. */
|
|
23
|
+
onCountryChange?: (country: IndicatorCountryPhoneOption) => void;
|
|
24
|
+
/** Customize the indicator's chip and popover without replacing its country/value contract. */
|
|
25
|
+
indicatorProps?: Omit<IndicatorCountryPhoneProps, 'options' | 'value' | 'defaultValue' | 'onChange' | 'disabled'>;
|
|
26
|
+
/** Select the compact 24 px form layout or the comfortable base field height. */
|
|
27
|
+
inputHeight?: 'compact' | 'comfortable';
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/PhoneNumberField/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACzH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAErF,KAAK,cAAc,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,CAAC;AAEvD,mFAAmF;AACnF,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACzC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,kFAAkF;AAClF,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,CAAC;IACjI,oGAAoG;IACpG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,gFAAgF;IAChF,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,2BAA2B,KAAK,IAAI,CAAC;IACjE,+FAA+F;IAC/F,cAAc,CAAC,EAAE,IAAI,CAAC,0BAA0B,EAAE,SAAS,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC;IAClH,iFAAiF;IACjF,WAAW,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;CACzC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FieldValues } from 'react-hook-form';
|
|
2
|
+
import { RHFPhoneNumberFieldProps } from './types';
|
|
3
|
+
/** Bind PhoneNumberField's complete international value to react-hook-form. */
|
|
4
|
+
export declare function RHFPhoneNumberField<TFieldValues extends FieldValues = FieldValues>(props: RHFPhoneNumberFieldProps<TFieldValues>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
5
|
+
//# sourceMappingURL=RHFPhoneNumberField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RHFPhoneNumberField.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/RHFs/RHFPhoneNumberField/RHFPhoneNumberField.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAExD,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,YAAY,SAAS,WAAW,GAAG,WAAW,EAChF,KAAK,EAAE,wBAAwB,CAAC,YAAY,CAAC,oDAsF9C"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as e, jsxs as q } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { Label as E, HelperError as N } from "@m4l/components";
|
|
3
|
+
import { useId as w } from "react";
|
|
4
|
+
import { useFormContext as z, Controller as D } from "react-hook-form";
|
|
5
|
+
import { RootStyled as L, ErrorStyled as O } from "./RHFPhoneNumberField.slots.js";
|
|
6
|
+
import { PhoneNumberField as S } from "../../PhoneNumberField/PhoneNumberField.js";
|
|
7
|
+
function Q(c) {
|
|
8
|
+
const {
|
|
9
|
+
name: b,
|
|
10
|
+
control: p,
|
|
11
|
+
rules: m,
|
|
12
|
+
disabled: y,
|
|
13
|
+
label: a,
|
|
14
|
+
symbol: g,
|
|
15
|
+
labelOverflow: h,
|
|
16
|
+
mandatory: f,
|
|
17
|
+
mandatoryMessage: B,
|
|
18
|
+
helperMessage: F,
|
|
19
|
+
htmlFor: v,
|
|
20
|
+
id: P,
|
|
21
|
+
size: t = "medium",
|
|
22
|
+
variant: j = "contained",
|
|
23
|
+
inputHeight: x = "compact",
|
|
24
|
+
inputProps: o,
|
|
25
|
+
...C
|
|
26
|
+
} = c, I = z(), M = w(), n = P ?? v ?? M, d = `${n}-error`, s = m?.required, R = f ?? (typeof s == "object" ? !!s.value : !!s);
|
|
27
|
+
return /* @__PURE__ */ e(
|
|
28
|
+
D,
|
|
29
|
+
{
|
|
30
|
+
name: b,
|
|
31
|
+
control: p ?? I?.control,
|
|
32
|
+
rules: m,
|
|
33
|
+
render: ({ field: r, fieldState: i, formState: H }) => {
|
|
34
|
+
const u = y || H.isSubmitting, l = i.error?.message;
|
|
35
|
+
return /* @__PURE__ */ q(L, { children: [
|
|
36
|
+
a && /* @__PURE__ */ e(
|
|
37
|
+
E,
|
|
38
|
+
{
|
|
39
|
+
label: a,
|
|
40
|
+
symbol: g,
|
|
41
|
+
labelOverflow: h,
|
|
42
|
+
mandatory: R,
|
|
43
|
+
mandatoryMessage: B,
|
|
44
|
+
helperMessage: F,
|
|
45
|
+
htmlFor: n,
|
|
46
|
+
size: t,
|
|
47
|
+
disabled: u,
|
|
48
|
+
error: !!i.error
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ e(
|
|
52
|
+
S,
|
|
53
|
+
{
|
|
54
|
+
...C,
|
|
55
|
+
id: n,
|
|
56
|
+
name: r.name,
|
|
57
|
+
inputRef: r.ref,
|
|
58
|
+
inputProps: {
|
|
59
|
+
...o,
|
|
60
|
+
"aria-label": o?.["aria-label"] ?? a,
|
|
61
|
+
"aria-describedby": l ? [o?.["aria-describedby"], d].filter(Boolean).join(" ") : o?.["aria-describedby"]
|
|
62
|
+
},
|
|
63
|
+
size: t,
|
|
64
|
+
variant: j,
|
|
65
|
+
inputHeight: x,
|
|
66
|
+
value: typeof r.value == "string" ? r.value : "",
|
|
67
|
+
onChange: r.onChange,
|
|
68
|
+
onBlur: r.onBlur,
|
|
69
|
+
disabled: u,
|
|
70
|
+
error: !!i.error
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
l && /* @__PURE__ */ e(O, { id: d, children: /* @__PURE__ */ e(N, { message: l, size: t, htmlFor: n }) })
|
|
74
|
+
] });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
Q as RHFPhoneNumberField
|
|
81
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Keep the external label, phone input and validation message in one field stack. */
|
|
2
|
+
export declare const RootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
3
|
+
/** Provide an accessible target for the input's error description. */
|
|
4
|
+
export declare const ErrorStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof import('react').ClassAttributes<HTMLSpanElement> | keyof import('react').HTMLAttributes<HTMLSpanElement>>, {}>;
|
|
5
|
+
//# sourceMappingURL=RHFPhoneNumberField.slots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RHFPhoneNumberField.slots.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/RHFs/RHFPhoneNumberField/RHFPhoneNumberField.slots.tsx"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,eAAO,MAAM,UAAU,iVAKpB,CAAC;AAEJ,sEAAsE;AACtE,eAAO,MAAM,WAAW,qVAEtB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { styled as o } from "@mui/material/styles";
|
|
2
|
+
const r = o("div", { name: "M4LRHFPhoneNumberField", slot: "Root" })(({ theme: e }) => ({
|
|
3
|
+
display: "flex",
|
|
4
|
+
flexDirection: "column",
|
|
5
|
+
gap: e.vars.size.baseSpacings["sp1-5"],
|
|
6
|
+
width: "100%"
|
|
7
|
+
})), s = o("span", { name: "M4LRHFPhoneNumberField", slot: "Error" })({
|
|
8
|
+
display: "block"
|
|
9
|
+
});
|
|
10
|
+
export {
|
|
11
|
+
s as ErrorStyled,
|
|
12
|
+
r as RootStyled
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/RHFs/RHFPhoneNumberField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Control, FieldPath, FieldValues, UseControllerProps } from 'react-hook-form';
|
|
2
|
+
import { LabelProps } from '@m4l/components';
|
|
3
|
+
import { PhoneNumberFieldProps } from '../../PhoneNumberField';
|
|
4
|
+
/** Props for a phone number stored as one international string in react-hook-form. */
|
|
5
|
+
export interface RHFPhoneNumberFieldProps<TFieldValues extends FieldValues = FieldValues> extends Omit<PhoneNumberFieldProps, 'name' | 'value' | 'defaultValue' | 'onChange' | 'inputRef' | 'error'>, Pick<LabelProps, 'label' | 'symbol' | 'labelOverflow' | 'mandatory' | 'mandatoryMessage' | 'helperMessage' | 'htmlFor'> {
|
|
6
|
+
/** Path of the complete international phone number in the form. */
|
|
7
|
+
name: FieldPath<TFieldValues>;
|
|
8
|
+
/** Optional form control when no FormProvider is present. */
|
|
9
|
+
control?: Control<TFieldValues>;
|
|
10
|
+
/** react-hook-form validation rules for this field. */
|
|
11
|
+
rules?: UseControllerProps<TFieldValues>['rules'];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/RHFs/RHFPhoneNumberField/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,sFAAsF;AACtF,MAAM,WAAW,wBAAwB,CAAC,YAAY,SAAS,WAAW,GAAG,WAAW,CACtF,SAAQ,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC,EACxG,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,eAAe,GAAG,WAAW,GAAG,kBAAkB,GAAG,eAAe,GAAG,SAAS,CAAC;IACzH,mEAAmE;IACnE,IAAI,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IAC9B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAChC,uDAAuD;IACvD,KAAK,CAAC,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC;CACnD"}
|
package/components/index.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export * from './ReportsViewer';
|
|
|
14
14
|
export * from './TimelineCardsViewer';
|
|
15
15
|
export * from './AddressLocation';
|
|
16
16
|
export * from './RHFs/RHFAddressLocation';
|
|
17
|
+
export * from './PhoneNumberField';
|
|
18
|
+
export * from './RHFs/RHFPhoneNumberField';
|
|
17
19
|
export * from './DevicesPicker';
|
|
18
20
|
export * from './CheckableDevicesPicker';
|
|
19
21
|
export * from './RHFs/RHFDevicesPicker';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/gclick/src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,gCAAgC,EAAE,MAAM,QAAQ,CAAC;AAC1D,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,OAAO,EAAE,yCAAyC,EAAE,MAAM,yBAAyB,CAAC;AACpF,YAAY,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/gclick/src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,gCAAgC,EAAE,MAAM,QAAQ,CAAC;AAC1D,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,OAAO,EAAE,yCAAyC,EAAE,MAAM,yBAAyB,CAAC;AACpF,YAAY,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IndicatorCountryPhoneProps } from './types';
|
|
2
|
+
/** Render an authenticated E.164 country selector with local flag artwork. */
|
|
3
|
+
export declare function IndicatorCountryPhone(props: IndicatorCountryPhoneProps): import("@emotion/react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
//# sourceMappingURL=IndicatorCountryPhone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IndicatorCountryPhone.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/indicators/IndicatorCountryPhone/IndicatorCountryPhone.tsx"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAGV,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAEjB,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,2DAgYtE"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { jsx as l, jsxs as $ } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useModuleDictionary as be } from "@m4l/core";
|
|
3
|
+
import { useVirtualizer as Ie } from "@tanstack/react-virtual";
|
|
4
|
+
import { useState as x, useRef as w, useId as Se, useMemo as Re, useCallback as Ee, useEffect as Q } from "react";
|
|
5
|
+
import { INDICATOR_COUNTRY_PHONE_DEFAULT_VALUE as xe, INDICATOR_COUNTRY_PHONE_VISIBLE_ROWS as H, INDICATOR_COUNTRY_PHONE_ROW_HEIGHT as U, INDICATOR_COUNTRY_PHONE_ROW_GAP as J } from "./constants.js";
|
|
6
|
+
import { resolveIndicatorCountryPhoneCountries as we } from "./countryOptions.js";
|
|
7
|
+
import { resolveIndicatorCountryPhoneLabel as d, INDICATOR_COUNTRY_PHONE_DICTIONARY as u } from "./dictionary.js";
|
|
8
|
+
import { RootStyled as D, SkeletonStyled as De, StatusButtonStyled as V, ChipStyled as Oe, CodeInputStyled as Te, TriggerStyled as _e, FlagStyled as X, PopoverStyled as Le, MenuStyled as Me, VirtualItemsStyled as Ne, MenuItemStyled as Ae, CodeStyled as ke, EmptyStateStyled as Pe } from "./IndicatorCountryPhone.slots.js";
|
|
9
|
+
import { useCountryPhoneCatalog as $e } from "./hooks/useCountryPhoneCatalog/useCountryPhoneCatalog.js";
|
|
10
|
+
function Ke(Z) {
|
|
11
|
+
const {
|
|
12
|
+
options: g,
|
|
13
|
+
value: v,
|
|
14
|
+
defaultValue: ee = xe,
|
|
15
|
+
onChange: te,
|
|
16
|
+
expanded: O,
|
|
17
|
+
defaultExpanded: ae = !1,
|
|
18
|
+
onExpandedChange: F,
|
|
19
|
+
disabled: T = !1,
|
|
20
|
+
chipProps: le,
|
|
21
|
+
popoverProps: ne,
|
|
22
|
+
className: m,
|
|
23
|
+
dataTestId: b
|
|
24
|
+
} = Z, [oe, re] = x(ee.toLowerCase()), [ie, se] = x(ae), [I, Y] = x(null), [S, p] = x(0), _ = w(null), L = w(null), h = w(null), R = w(!1), f = Se(), i = (v ?? oe).trim().toLowerCase(), a = $e({
|
|
25
|
+
enabled: g === void 0 || g.length > 0,
|
|
26
|
+
selectedValue: i
|
|
27
|
+
}), y = Re(
|
|
28
|
+
() => we(a.countries, g, a.locale),
|
|
29
|
+
[a.countries, a.locale, g]
|
|
30
|
+
), ce = y.find((e) => e.value === i), de = a.selectedCountry?.value === i ? a.selectedCountry : a.countries.find((e) => e.value === i), n = ce ?? (v === void 0 ? y[0] : de) ?? (v !== void 0 && i ? {
|
|
31
|
+
apiId: i.toUpperCase(),
|
|
32
|
+
value: i,
|
|
33
|
+
label: i.toUpperCase(),
|
|
34
|
+
callingCode: "",
|
|
35
|
+
active: !1
|
|
36
|
+
} : void 0), ue = !!(n && y.some((e) => e.value === n.value)), { getLabel: s } = be(), he = d(
|
|
37
|
+
s,
|
|
38
|
+
u.callingCode,
|
|
39
|
+
"Country calling code"
|
|
40
|
+
), fe = d(
|
|
41
|
+
s,
|
|
42
|
+
u.callingCodes,
|
|
43
|
+
"Country calling codes"
|
|
44
|
+
), ge = d(
|
|
45
|
+
s,
|
|
46
|
+
u.empty,
|
|
47
|
+
"No countries available"
|
|
48
|
+
), pe = d(
|
|
49
|
+
s,
|
|
50
|
+
u.loading,
|
|
51
|
+
"Loading country calling codes"
|
|
52
|
+
), ye = d(
|
|
53
|
+
s,
|
|
54
|
+
u.noMatches,
|
|
55
|
+
"No matching country codes"
|
|
56
|
+
), M = d(
|
|
57
|
+
s,
|
|
58
|
+
u.retry,
|
|
59
|
+
"Retry country calling codes"
|
|
60
|
+
), Ce = d(
|
|
61
|
+
s,
|
|
62
|
+
u.unavailable,
|
|
63
|
+
"Country unavailable"
|
|
64
|
+
), z = O ?? ie, ve = I?.replace(/\D/g, "") ?? "", r = y.filter((e) => (I !== null || e.value !== n?.value) && e.callingCode.slice(1).startsWith(ve)), N = y.some((e) => e.value !== n?.value), o = z && N && !T && !a.hasRefreshError, W = r.length > H, q = Math.max(
|
|
65
|
+
0,
|
|
66
|
+
Math.min(r.length, H) * U - J
|
|
67
|
+
), A = Ie({
|
|
68
|
+
count: r.length,
|
|
69
|
+
getScrollElement: () => h.current,
|
|
70
|
+
estimateSize: () => U,
|
|
71
|
+
initialRect: { width: 59, height: q },
|
|
72
|
+
overscan: 2,
|
|
73
|
+
enabled: o
|
|
74
|
+
}), c = Ee((e) => {
|
|
75
|
+
e || Y(null), O === void 0 && se(e), F?.(e);
|
|
76
|
+
}, [O, F]);
|
|
77
|
+
Q(() => {
|
|
78
|
+
p((e) => Math.max(
|
|
79
|
+
0,
|
|
80
|
+
Math.min(e, r.length - 1)
|
|
81
|
+
));
|
|
82
|
+
}, [r.length]), Q(() => {
|
|
83
|
+
if (!o)
|
|
84
|
+
return;
|
|
85
|
+
R.current && (h.current?.focus(), R.current = !1);
|
|
86
|
+
function e(t) {
|
|
87
|
+
_.current && !_.current.contains(t.target) && c(!1);
|
|
88
|
+
}
|
|
89
|
+
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
90
|
+
}, [o, c]);
|
|
91
|
+
function k(e) {
|
|
92
|
+
v === void 0 && re(e.value);
|
|
93
|
+
const t = {
|
|
94
|
+
value: e.value,
|
|
95
|
+
callingCode: e.callingCode,
|
|
96
|
+
label: e.label
|
|
97
|
+
};
|
|
98
|
+
te?.(t), c(!1), L.current?.focus();
|
|
99
|
+
}
|
|
100
|
+
function P(e) {
|
|
101
|
+
if (r.length === 0)
|
|
102
|
+
return;
|
|
103
|
+
const t = Math.max(0, Math.min(e, r.length - 1));
|
|
104
|
+
p(t), A.scrollToIndex(t, { align: "auto" });
|
|
105
|
+
}
|
|
106
|
+
if (g?.length === 0)
|
|
107
|
+
return null;
|
|
108
|
+
if (a.status === "loading")
|
|
109
|
+
return /* @__PURE__ */ l(D, { className: m, "data-testid": b, role: "status", "aria-label": pe, children: /* @__PURE__ */ l(De, { variant: "rounded", width: 49, height: 20 }) });
|
|
110
|
+
if (a.status === "error")
|
|
111
|
+
return /* @__PURE__ */ l(D, { className: m, "data-testid": b, children: /* @__PURE__ */ l(V, { type: "button", "aria-label": M, onClick: () => {
|
|
112
|
+
a.retry();
|
|
113
|
+
}, children: "Retry" }) });
|
|
114
|
+
if (!n)
|
|
115
|
+
return /* @__PURE__ */ l(D, { className: m, "data-testid": b, children: /* @__PURE__ */ l(V, { type: "button", "aria-label": ge, disabled: !0, children: "--" }) });
|
|
116
|
+
const B = n.flag, C = r[S] ?? r[0], K = A.getVirtualItems(), j = K.length > 0 ? K : Array.from(
|
|
117
|
+
{ length: Math.min(r.length, H + 2) },
|
|
118
|
+
(e, t) => ({ index: t, start: t * U })
|
|
119
|
+
), E = j.some((e) => e.index === S) ? C : void 0, me = n.callingCode ? `${n.label} ${n.callingCode}` : `${n.label} ${Ce}`;
|
|
120
|
+
return /* @__PURE__ */ $(
|
|
121
|
+
D,
|
|
122
|
+
{
|
|
123
|
+
ref: _,
|
|
124
|
+
ownerState: { expanded: o },
|
|
125
|
+
className: m,
|
|
126
|
+
"data-testid": b,
|
|
127
|
+
onKeyDown: (e) => {
|
|
128
|
+
e.key === "Escape" && o && (e.stopPropagation(), c(!1), L.current?.focus());
|
|
129
|
+
},
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ l(
|
|
132
|
+
Oe,
|
|
133
|
+
{
|
|
134
|
+
...le,
|
|
135
|
+
startIcon: /* @__PURE__ */ l(
|
|
136
|
+
_e,
|
|
137
|
+
{
|
|
138
|
+
ref: L,
|
|
139
|
+
type: "button",
|
|
140
|
+
"aria-label": a.hasRefreshError ? M : me,
|
|
141
|
+
"aria-haspopup": a.hasRefreshError ? void 0 : "listbox",
|
|
142
|
+
"aria-expanded": a.hasRefreshError ? void 0 : o,
|
|
143
|
+
"aria-controls": o ? f : void 0,
|
|
144
|
+
disabled: T || !N,
|
|
145
|
+
onClick: () => {
|
|
146
|
+
if (a.hasRefreshError) {
|
|
147
|
+
a.retry();
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
p(0), R.current = !o, c(!z);
|
|
151
|
+
},
|
|
152
|
+
children: /* @__PURE__ */ l(X, { "aria-hidden": "true", children: B ? /* @__PURE__ */ l(B, {}) : n.apiId })
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
label: /* @__PURE__ */ l(
|
|
156
|
+
Te,
|
|
157
|
+
{
|
|
158
|
+
ownerState: {
|
|
159
|
+
expanded: o,
|
|
160
|
+
codeLength: Math.max(3, (I ?? n.callingCode).length)
|
|
161
|
+
},
|
|
162
|
+
type: "text",
|
|
163
|
+
role: "combobox",
|
|
164
|
+
"aria-label": he,
|
|
165
|
+
"aria-autocomplete": "list",
|
|
166
|
+
"aria-expanded": o,
|
|
167
|
+
"aria-controls": o ? f : void 0,
|
|
168
|
+
"aria-activedescendant": o && E ? `${f}-${E.value}` : void 0,
|
|
169
|
+
inputMode: "tel",
|
|
170
|
+
autoComplete: "off",
|
|
171
|
+
value: I ?? (n.callingCode || n.apiId),
|
|
172
|
+
disabled: T || !N || !ue || a.hasRefreshError,
|
|
173
|
+
onFocus: (e) => {
|
|
174
|
+
R.current = !1, c(!0), e.currentTarget.select();
|
|
175
|
+
},
|
|
176
|
+
onChange: (e) => {
|
|
177
|
+
const t = e.target.value.replace(/\D/g, "").slice(0, 3);
|
|
178
|
+
Y(t ? `+${t}` : ""), p(0), h.current && (h.current.scrollTop = 0), c(!0);
|
|
179
|
+
},
|
|
180
|
+
onKeyDown: (e) => {
|
|
181
|
+
e.key === "ArrowDown" && o ? (e.preventDefault(), h.current?.focus(), P(0)) : e.key === "Enter" && o && C && (e.preventDefault(), k(C));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
o && /* @__PURE__ */ $(Le, { ...ne, "data-scrollable": W, children: [
|
|
188
|
+
a.hasSelectedError && /* @__PURE__ */ l(V, { type: "button", "aria-label": M, onClick: () => {
|
|
189
|
+
a.retry();
|
|
190
|
+
}, children: "Retry" }),
|
|
191
|
+
/* @__PURE__ */ l(
|
|
192
|
+
Me,
|
|
193
|
+
{
|
|
194
|
+
id: f,
|
|
195
|
+
ref: h,
|
|
196
|
+
ownerState: { viewportHeight: q },
|
|
197
|
+
"data-scrollable": W,
|
|
198
|
+
role: "listbox",
|
|
199
|
+
tabIndex: 0,
|
|
200
|
+
"aria-label": fe,
|
|
201
|
+
"aria-activedescendant": E ? `${f}-${E.value}` : void 0,
|
|
202
|
+
onKeyDown: (e) => {
|
|
203
|
+
e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), P(S + (e.key === "ArrowDown" ? 1 : -1))) : e.key === "Home" || e.key === "End" ? (e.preventDefault(), P(e.key === "Home" ? 0 : r.length - 1)) : (e.key === "Enter" || e.key === " ") && C && (e.preventDefault(), k(C));
|
|
204
|
+
},
|
|
205
|
+
children: /* @__PURE__ */ l(
|
|
206
|
+
Ne,
|
|
207
|
+
{
|
|
208
|
+
ownerState: {
|
|
209
|
+
totalHeight: Math.max(
|
|
210
|
+
0,
|
|
211
|
+
A.getTotalSize() - J
|
|
212
|
+
)
|
|
213
|
+
},
|
|
214
|
+
children: j.map((e) => {
|
|
215
|
+
const t = r[e.index], G = t.flag;
|
|
216
|
+
return /* @__PURE__ */ $(
|
|
217
|
+
Ae,
|
|
218
|
+
{
|
|
219
|
+
id: `${f}-${t.value}`,
|
|
220
|
+
type: "button",
|
|
221
|
+
role: "option",
|
|
222
|
+
"aria-label": `${t.label} ${t.callingCode}`,
|
|
223
|
+
"aria-selected": t.value === n.value,
|
|
224
|
+
tabIndex: -1,
|
|
225
|
+
"data-active": e.index === S,
|
|
226
|
+
ownerState: { rowTop: e.start },
|
|
227
|
+
onMouseEnter: () => p(e.index),
|
|
228
|
+
onClick: () => k(t),
|
|
229
|
+
children: [
|
|
230
|
+
/* @__PURE__ */ l(X, { "aria-hidden": "true", children: G ? /* @__PURE__ */ l(G, {}) : t.apiId }),
|
|
231
|
+
/* @__PURE__ */ l(ke, { children: t.callingCode })
|
|
232
|
+
]
|
|
233
|
+
},
|
|
234
|
+
t.value
|
|
235
|
+
);
|
|
236
|
+
})
|
|
237
|
+
}
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
r.length === 0 && /* @__PURE__ */ l(Pe, { role: "status", children: ye })
|
|
242
|
+
] })
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
export {
|
|
248
|
+
Ke as IndicatorCountryPhone
|
|
249
|
+
};
|