@rpcbase/ui 0.258.0 → 0.260.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/dist/components/AddressAutocompleteInput/index.d.ts +3 -1
- package/dist/components/AddressAutocompleteInput/index.d.ts.map +1 -1
- package/dist/components/ApplePayButton/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Dialog/index.d.ts +1 -1
- package/dist/components/I18nField/index.d.ts +1 -1
- package/dist/components/Image/index.d.ts.map +1 -1
- package/dist/components/PhoneNumberInput/index.d.ts +1 -1
- package/dist/components/PhoneNumberInput/index.d.ts.map +1 -1
- package/dist/components/PhoneNumberInput/suggestions.d.ts.map +1 -1
- package/dist/components/Select/index.d.ts +4 -4
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/header/MenuPopover/index.d.ts.map +1 -1
- package/dist/components/header/index.d.ts +2 -10
- package/dist/components/header/index.d.ts.map +1 -1
- package/dist/helpers/useMapsLibrary.d.ts.map +1 -1
- package/dist/index14.js +61 -59
- package/dist/index14.js.map +1 -1
- package/dist/index362.js +75 -72
- package/dist/index362.js.map +1 -1
- package/dist/lib/render-as-child.d.ts +1 -1
- package/dist/lib/render-as-child.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export declare const AddressAutocompleteInput: ({ id, label, placeholder, value, onValueChange, disabled, name, className, autofillShimName, googleMapsApiKey, locationRestriction, allowedTypes, loadingIndicator, }: {
|
|
2
3
|
id: string;
|
|
3
4
|
label: string;
|
|
4
5
|
placeholder: string;
|
|
@@ -11,5 +12,6 @@ export declare const AddressAutocompleteInput: ({ id, label, placeholder, value,
|
|
|
11
12
|
googleMapsApiKey?: string;
|
|
12
13
|
locationRestriction?: google.maps.LatLngBoundsLiteral | google.maps.LatLngBounds;
|
|
13
14
|
allowedTypes?: Iterable<string>;
|
|
15
|
+
loadingIndicator?: ReactNode;
|
|
14
16
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AddressAutocompleteInput/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AddressAutocompleteInput/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAoE,MAAM,OAAO,CAAA;AAqJnG,eAAO,MAAM,wBAAwB,0KAclC;IACD,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAA;IAChF,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC/B,gBAAgB,CAAC,EAAE,SAAS,CAAA;CAC7B,4CAsVA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ApplePayButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAA;AAIrD,KAAK,mBAAmB,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAA;AAG7D,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ApplePayButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAA;AAIrD,KAAK,mBAAmB,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAA;AAG7D,eAAO,MAAM,cAAc,qDAKxB,mBAAmB,4CAiBrB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,QAAA,MAAM,aAAa;IACjB,GAAG;IACH,GAAG;IACH,OAAO;CAER,CAAA;AAED,UAAU,aACR,SAAQ,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,CAAC;IAC1E,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC/D,KAAK,CAAC,EAAE,MAAM,OAAO,aAAa,CAAC;CACpC;AAED,eAAO,MAAM,QAAQ,8FAUlB,aAAa,4CA6Cf,CAAA"}
|
|
@@ -9,7 +9,7 @@ declare function DialogClose({ asChild, render, children, ...props }: DialogPrim
|
|
|
9
9
|
asChild?: boolean;
|
|
10
10
|
}): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
declare function DialogOverlay({ className, ...props }: DialogPrimitive.Backdrop.Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
declare const DialogContent: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").
|
|
12
|
+
declare const DialogContent: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").DialogPopupProps & {
|
|
13
13
|
showCloseButton?: boolean;
|
|
14
14
|
showCloseButtonOutside?: boolean;
|
|
15
15
|
}, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -22,7 +22,7 @@ type LanguageOption = {
|
|
|
22
22
|
code: string;
|
|
23
23
|
searchable: string[];
|
|
24
24
|
};
|
|
25
|
-
export declare const I18nField: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
25
|
+
export declare const I18nField: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "defaultValue" | "onChange" | "value"> & Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "defaultValue" | "onChange" | "value"> & {
|
|
26
26
|
value?: I18nValue;
|
|
27
27
|
defaultValue?: I18nValue;
|
|
28
28
|
locale?: LanguageCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Image/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAI3E,eAAO,MAAM,kBAAkB,UAAwB,CAAA;AAEvD,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAEpD,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC,GAAG;IAC1E,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAUD,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Image/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAI3E,eAAO,MAAM,kBAAkB,UAAwB,CAAA;AAEvD,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAEpD,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC,GAAG;IAC1E,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAUD,eAAO,MAAM,qBAAqB,QAAS,MAAM,KAAG,OASnD,CAAA;AAED,eAAO,MAAM,cAAc,QAAS,MAAM,SAAS,MAAM,KAAG,MAc3D,CAAA;AAED,eAAO,MAAM,cAAc,QAAS,MAAM,wBAAgC,MAAM,GAAG,SAKlF,CAAA;AAED,wBAAgB,KAAK,CAAC,EACpB,GAAG,EACH,IAAI,EACJ,GAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,MAA2B,EAC3B,UAAU,EACV,KAAK,EACL,MAAM,EACN,OAAgB,EAChB,QAAkB,EAClB,KAAK,EACL,MAAM,EACN,OAAO,EACP,GAAG,KAAK,EACT,EAAE,UAAU,2CAyFZ"}
|
|
@@ -3,7 +3,7 @@ import type { CountryCode } from "libphonenumber-js";
|
|
|
3
3
|
import { type Props as SelectProps } from "react-select";
|
|
4
4
|
import type { CountryOption, PhoneNumberChangeDetails, PhoneNumberSelectedCountry } from "./types";
|
|
5
5
|
export type { CountryOption, PhoneNumberChangeDetails, PhoneNumberInputMessages, PhoneNumberInputProps, PhoneNumberInputValidationCode, PhoneNumberSelectedCountry, } from "./types";
|
|
6
|
-
export declare const PhoneNumberInput: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
6
|
+
export declare const PhoneNumberInput: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "defaultValue" | "onChange" | "value"> & {
|
|
7
7
|
value?: string;
|
|
8
8
|
defaultCountry?: CountryCode;
|
|
9
9
|
country?: CountryCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PhoneNumberInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAe,EACb,KAAK,KAAK,IAAI,WAAW,EAG1B,MAAM,cAAc,CAAA;AAIrB,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,EAExB,0BAA0B,EAC3B,MAAM,SAAS,CAAA;AAsChB,YAAY,EACV,aAAa,EACb,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,8BAA8B,EAC9B,0BAA0B,GAC3B,MAAM,SAAS,CAAA;AA+MhB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PhoneNumberInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAe,EACb,KAAK,KAAK,IAAI,WAAW,EAG1B,MAAM,cAAc,CAAA;AAIrB,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,EAExB,0BAA0B,EAC3B,MAAM,SAAS,CAAA;AAsChB,YAAY,EACV,aAAa,EACb,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,8BAA8B,EAC9B,0BAA0B,GAC3B,MAAM,SAAS,CAAA;AA+MhB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;0CAm2B5B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestions.d.ts","sourceRoot":"","sources":["../../../src/components/PhoneNumberInput/suggestions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAI3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAG5C,MAAM,MAAM,sBAAsB,GAAG;IACnC,gBAAgB,EAAE,WAAW,GAAG,IAAI,CAAA;IACpC,oBAAoB,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAA;IACrD,iBAAiB,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,KAAK,CAAC,SAAS,CAAA;IAC7D,qBAAqB,EAAE,MAAM,cAAc,CAAA;CAC5C,CAAA;AAED,eAAO,MAAM,iBAAiB,8CAA2D,CAAA;AAYzF,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"suggestions.d.ts","sourceRoot":"","sources":["../../../src/components/PhoneNumberInput/suggestions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAI3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAG5C,MAAM,MAAM,sBAAsB,GAAG;IACnC,gBAAgB,EAAE,WAAW,GAAG,IAAI,CAAA;IACpC,oBAAoB,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAA;IACrD,iBAAiB,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,KAAK,CAAC,SAAS,CAAA;IAC7D,qBAAqB,EAAE,MAAM,cAAc,CAAA;CAC5C,CAAA;AAED,eAAO,MAAM,iBAAiB,8CAA2D,CAAA;AAYzF,eAAO,MAAM,gBAAgB,UAAW,WAAW,CAAC,aAAa,EAAE,KAAK,CAAC,4CAqExE,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,YAAY,CAAC,aAAa,EAAE,KAAK,CAoCrE,CAAA;AAED,eAAO,MAAM,aAAa,UAAW,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,4CAkBtE,CAAA;AAED,eAAO,MAAM,aAAa,YAAa,CAAA;AAEvC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,2CAcxD"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
3
3
|
type SelectProps = React.ComponentProps<typeof SelectPrimitive.Root>;
|
|
4
|
-
declare
|
|
5
|
-
|
|
6
|
-
displayName: string;
|
|
7
|
-
}
|
|
4
|
+
declare function Select({ children, items, ...props }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare namespace Select {
|
|
6
|
+
var displayName: string;
|
|
7
|
+
}
|
|
8
8
|
declare const SelectGroup: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").SelectGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
9
|
declare const SelectValue: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").SelectValueProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
10
10
|
declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").SelectTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAKjE,KAAK,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAKjE,KAAK,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,CAAA;wBAyBpD,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW;;;;AAgB1D,QAAA,MAAM,WAAW,+HAKf,CAAA;AAGF,QAAA,MAAM,WAAW,gIAKf,CAAA;AAIF,QAAA,MAAM,aAAa,oIAejB,CAAA;AAuKF,QAAA,MAAM,oBAAoB,6GAOxB,CAAA;AAGF,QAAA,MAAM,sBAAsB,6GAO1B,CAAA;AAGF,KAAK,kBAAkB,GAAG,eAAe,CAAC,KAAK,CAAC,KAAK,GACnD,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,GAAG,MAAM,GAAG,YAAY,GAAG,sBAAsB,CAAC,GAAG;IACjH,QAAQ,CAAC,EAAE,cAAc,GAAG,QAAQ,CAAA;IACpC,UAAU,CAAC,EAAE,cAAc,GAAG,yBAAyB,CAAA;CACxD,CAAA;AAEH,QAAA,MAAM,aAAa,wGAoGjB,CAAA;AAGF,QAAA,MAAM,WAAW,oIASf,CAAA;AAGF,QAAA,MAAM,UAAU,2HAmBd,CAAA;AAGF,QAAA,MAAM,eAAe,6HASnB,CAAA;AAGF,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/header/MenuPopover/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAA;AAI9D,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/header/MenuPopover/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAA;AAI9D,eAAO,MAAM,WAAW,sFAOrB;IACD,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,YAAY,EAAE,SAAS,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;KAAE,KAAK,SAAS,CAAA;CACzE,4CAkEA,CAAA"}
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
+
import { MenuPopover } from "./MenuPopover";
|
|
1
2
|
export declare const Header: {
|
|
2
|
-
MenuPopover:
|
|
3
|
-
href: string;
|
|
4
|
-
labelClassName: string;
|
|
5
|
-
labelActiveClassName: string;
|
|
6
|
-
labelElement: import("react").ReactNode;
|
|
7
|
-
isActive: boolean;
|
|
8
|
-
children: (props: {
|
|
9
|
-
setIsOpen: (isOpen: boolean) => void;
|
|
10
|
-
}) => import("react").ReactNode;
|
|
11
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
MenuPopover: typeof MenuPopover;
|
|
12
4
|
};
|
|
13
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/header/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/header/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAG3C,eAAO,MAAM,MAAM;;CAElB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMapsLibrary.d.ts","sourceRoot":"","sources":["../../src/helpers/useMapsLibrary.ts"],"names":[],"mappings":"AAMA,KAAK,qBAAqB,GACtB,MAAM,GACN,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,WAAW,GACX,YAAY,GACZ,gBAAgB,GAChB,SAAS,GACT,eAAe,GACf,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAEjB,KAAK,uBAAuB,CAAC,CAAC,SAAS,qBAAqB,IAC1D,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,GACtC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,GACxC,CAAC,SAAS,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,GAC5C,CAAC,SAAS,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,GAC5C,CAAC,SAAS,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,GAChD,CAAC,SAAS,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,GAClD,CAAC,SAAS,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,iBAAiB,GACpD,CAAC,SAAS,gBA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AS,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,qBAAqB,GAC5D,CAAC,SAAS,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,GAC9C,CAAC,SAAS,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,oBAAoB,GAC1D,CAAC,SAAS,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,GAC5C,CAAC,SAAS,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,GAC5C,CAAC,SAAS,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,GAClD,OAAO,CAAA;AA+DrC,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,qBAAqB,WACnD,CAAC,WACD,MAAM,sCA+BhB,CAAA;AAED,YAAY,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,CAAA"}
|
package/dist/index14.js
CHANGED
|
@@ -45,109 +45,109 @@ var p = /* @__PURE__ */ new Set(/* @__PURE__ */ "street_address.route.premise.su
|
|
|
45
45
|
let n = e.placeId;
|
|
46
46
|
n && (t.has(n) || t.set(n, e));
|
|
47
47
|
}), Array.from(t.values());
|
|
48
|
-
}, y = (e, t) => e.filter((e) => g(e, t)), b = (e) => e.sort((e, t) => (e.distanceMeters ?? Infinity) - (t.distanceMeters ?? Infinity)), x = (e, t) => b(y(v(e), t)), S = (e, t) => m(e).toLowerCase() === t.trim().toLowerCase(), C = ({ id: i, label: u, placeholder: g, value: v, onValueChange: y, disabled: b, name: C, className: w, autofillShimName: T, googleMapsApiKey: E, locationRestriction: D, allowedTypes: O }) => {
|
|
49
|
-
let [
|
|
48
|
+
}, y = (e, t) => e.filter((e) => g(e, t)), b = (e) => e.sort((e, t) => (e.distanceMeters ?? Infinity) - (t.distanceMeters ?? Infinity)), x = (e, t) => b(y(v(e), t)), S = (e, t) => m(e).toLowerCase() === t.trim().toLowerCase(), C = ({ id: i, label: u, placeholder: g, value: v, onValueChange: y, disabled: b, name: C, className: w, autofillShimName: T, googleMapsApiKey: E, locationRestriction: D, allowedTypes: O, loadingIndicator: k }) => {
|
|
49
|
+
let [A, j] = c(v ?? ""), [M, N] = c([]), [P, F] = c(!1), [I, L] = c(-1), [R, z] = c(!1), B = s(null), V = s(null), H = s(!1), U = s(!1), W = s(null), G = s([]), K = s("smooth"), q = e("places", E), J = o(() => {
|
|
50
50
|
if (!O) return p;
|
|
51
51
|
let e = /* @__PURE__ */ new Set();
|
|
52
52
|
for (let t of O) e.add(t);
|
|
53
53
|
return e;
|
|
54
54
|
}, [O]);
|
|
55
55
|
a(() => {
|
|
56
|
-
|
|
56
|
+
j(v ?? ""), U.current = !1;
|
|
57
57
|
}, [v]), a(() => {
|
|
58
|
-
if (
|
|
59
|
-
|
|
58
|
+
if (H.current) {
|
|
59
|
+
H.current = !1;
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
let e =
|
|
63
|
-
|
|
62
|
+
let e = A.trim();
|
|
63
|
+
z(e !== "");
|
|
64
64
|
let t = !0, n = setTimeout(() => {
|
|
65
65
|
if (!t) return;
|
|
66
66
|
if (e === "") {
|
|
67
|
-
|
|
67
|
+
N([]), F(!1), W.current = null, v !== "" && y("");
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
if (!
|
|
71
|
-
let { AutocompleteSuggestion: n, AutocompleteSessionToken: r } =
|
|
70
|
+
if (!q) return;
|
|
71
|
+
let { AutocompleteSuggestion: n, AutocompleteSessionToken: r } = q;
|
|
72
72
|
if (!n || !r) {
|
|
73
|
-
console.error("AddressAutocompleteInput: missing AutocompleteSuggestion or AutocompleteSessionToken exports"),
|
|
73
|
+
console.error("AddressAutocompleteInput: missing AutocompleteSuggestion or AutocompleteSessionToken exports"), N([]), F(!1), z(!1);
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
W.current ||= new r();
|
|
77
77
|
let i = {
|
|
78
|
-
input:
|
|
79
|
-
sessionToken:
|
|
78
|
+
input: A,
|
|
79
|
+
sessionToken: W.current ?? void 0,
|
|
80
80
|
includedRegionCodes: ["fr"]
|
|
81
81
|
};
|
|
82
82
|
D && (i.locationRestriction = D), n.fetchAutocompleteSuggestions(i).then((e) => {
|
|
83
83
|
if (!t) return;
|
|
84
|
-
let n = x(e.suggestions.map((e) => e.placePrediction).filter((e) => !!e),
|
|
85
|
-
if (!
|
|
86
|
-
|
|
84
|
+
let n = x(e.suggestions.map((e) => e.placePrediction).filter((e) => !!e), J), r = n[0], i = r && n.length === 1 && S(r, A);
|
|
85
|
+
if (!U.current && i) {
|
|
86
|
+
N(n), F(!1), z(!1);
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
|
-
n.length > 0 ? (
|
|
89
|
+
n.length > 0 ? (N(n), U.current && F(!0), L(-1)) : (N([]), F(!1)), z(!1);
|
|
90
90
|
}).catch((e) => {
|
|
91
|
-
t && (console.error("AddressAutocompleteInput: suggestion fetch failed", e),
|
|
91
|
+
t && (console.error("AddressAutocompleteInput: suggestion fetch failed", e), N([]), F(!1), z(!1));
|
|
92
92
|
});
|
|
93
93
|
}, 300);
|
|
94
94
|
return () => {
|
|
95
95
|
t = !1, clearTimeout(n);
|
|
96
96
|
};
|
|
97
97
|
}, [
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
A,
|
|
99
|
+
q,
|
|
100
100
|
y,
|
|
101
101
|
v,
|
|
102
102
|
D,
|
|
103
|
-
|
|
103
|
+
J
|
|
104
104
|
]), a(() => {
|
|
105
105
|
let e = (e) => {
|
|
106
|
-
|
|
106
|
+
B.current && !B.current.contains(e.target) && V.current && !V.current.contains(e.target) && F(!1);
|
|
107
107
|
};
|
|
108
108
|
return document.addEventListener("mousedown", e), () => {
|
|
109
109
|
document.removeEventListener("mousedown", e);
|
|
110
110
|
};
|
|
111
111
|
}, []);
|
|
112
|
-
let
|
|
113
|
-
|
|
112
|
+
let Y = (e) => {
|
|
113
|
+
H.current = !0;
|
|
114
114
|
let t = m(e);
|
|
115
|
-
|
|
116
|
-
}, Y = (e) => {
|
|
117
|
-
H.current = !0, A(e.target.value);
|
|
115
|
+
j(t), y(t), N([]), F(!1), z(!1), W.current = null;
|
|
118
116
|
}, X = (e) => {
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
U.current = !0, j(e.target.value);
|
|
118
|
+
}, Z = (e) => {
|
|
119
|
+
if (!P || M.length === 0) {
|
|
120
|
+
e.key === "Enter" && (e.preventDefault(), y(A), F(!1), W.current = null);
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
e.key === "ArrowDown" ? (
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
},
|
|
123
|
+
e.key === "ArrowDown" ? (K.current = e.repeat ? "auto" : "smooth", e.preventDefault(), L((e) => M.length === 0 ? -1 : e < 0 ? 0 : (e + 1) % M.length)) : e.key === "ArrowUp" ? (K.current = e.repeat ? "auto" : "smooth", e.preventDefault(), L((e) => M.length === 0 ? -1 : e <= 0 ? M.length - 1 : (e - 1) % M.length)) : e.key === "Enter" ? (e.preventDefault(), I > -1 && M[I] ? Y(M[I]) : (y(A), F(!1), W.current = null)) : e.key === "Escape" && F(!1);
|
|
124
|
+
}, Q = () => {
|
|
125
|
+
F(!1), v !== A && y(A), W.current = null;
|
|
126
|
+
}, $ = T ?? (C ? `${C}_shim` : void 0);
|
|
127
127
|
return a(() => {
|
|
128
|
-
if (!
|
|
129
|
-
|
|
128
|
+
if (!P || I < 0) {
|
|
129
|
+
K.current = "smooth";
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
|
-
let e =
|
|
132
|
+
let e = G.current[I], t = V.current;
|
|
133
133
|
if (!e || !t) {
|
|
134
|
-
|
|
134
|
+
K.current = "smooth";
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
let n =
|
|
138
|
-
|
|
137
|
+
let n = K.current;
|
|
138
|
+
K.current = "smooth";
|
|
139
139
|
let r = e.offsetTop, i = r + e.offsetHeight, a = t.scrollTop, o = a + t.clientHeight;
|
|
140
140
|
r >= a && i <= o || e.scrollIntoView({
|
|
141
141
|
block: "nearest",
|
|
142
142
|
behavior: n
|
|
143
143
|
});
|
|
144
|
-
}, [
|
|
144
|
+
}, [I, P]), G.current.length = M.length, /* @__PURE__ */ f("div", {
|
|
145
145
|
className: "relative",
|
|
146
146
|
children: [
|
|
147
|
-
|
|
147
|
+
$ && /* @__PURE__ */ d("input", {
|
|
148
148
|
tabIndex: -1,
|
|
149
149
|
autoComplete: "street-address",
|
|
150
|
-
name:
|
|
150
|
+
name: $,
|
|
151
151
|
"aria-hidden": "true",
|
|
152
152
|
style: {
|
|
153
153
|
position: "absolute",
|
|
@@ -165,38 +165,40 @@ var p = /* @__PURE__ */ new Set(/* @__PURE__ */ "street_address.route.premise.su
|
|
|
165
165
|
/* @__PURE__ */ f("div", {
|
|
166
166
|
className: "relative",
|
|
167
167
|
children: [/* @__PURE__ */ d(r, {
|
|
168
|
-
ref:
|
|
168
|
+
ref: B,
|
|
169
169
|
id: i,
|
|
170
170
|
type: "text",
|
|
171
171
|
placeholder: g,
|
|
172
172
|
name: C ?? `${i}_input`,
|
|
173
|
-
value:
|
|
174
|
-
onChange:
|
|
175
|
-
onKeyDown:
|
|
173
|
+
value: A,
|
|
174
|
+
onChange: X,
|
|
175
|
+
onKeyDown: Z,
|
|
176
176
|
onFocus: () => {
|
|
177
|
-
|
|
177
|
+
M.length > 0 && A && F(!0);
|
|
178
178
|
},
|
|
179
|
-
onBlur:
|
|
179
|
+
onBlur: Q,
|
|
180
180
|
disabled: b,
|
|
181
181
|
autoComplete: "new-password",
|
|
182
|
-
className: n("w-full",
|
|
183
|
-
}),
|
|
184
|
-
|
|
185
|
-
"
|
|
182
|
+
className: n("w-full", R && "pr-9", w)
|
|
183
|
+
}), R && /* @__PURE__ */ d("span", {
|
|
184
|
+
"aria-hidden": "true",
|
|
185
|
+
className: "pointer-events-none absolute right-3 top-1/2 flex size-4 -translate-y-1/2 items-center justify-center text-gray-400",
|
|
186
|
+
"data-slot": "address-autocomplete-loading-indicator",
|
|
187
|
+
children: k === void 0 ? /* @__PURE__ */ d(l, { className: "size-full animate-spin" }) : k
|
|
186
188
|
})]
|
|
187
189
|
}),
|
|
188
|
-
|
|
189
|
-
ref:
|
|
190
|
+
P && M.length > 0 && /* @__PURE__ */ d("ul", {
|
|
191
|
+
ref: V,
|
|
190
192
|
className: "absolute z-10 mt-1 w-full max-h-60 overflow-y-auto rounded-md border border-gray-200 bg-white text-left shadow-lg",
|
|
191
193
|
role: "listbox",
|
|
192
|
-
children:
|
|
194
|
+
children: M.map((e, n) => /* @__PURE__ */ d("li", {
|
|
193
195
|
ref: (e) => {
|
|
194
|
-
|
|
196
|
+
G.current[n] = e;
|
|
195
197
|
},
|
|
196
|
-
className: t("cursor-pointer px-3 py-2 text-sm text-gray-700 hover:bg-gray-100", { "bg-gray-100":
|
|
198
|
+
className: t("cursor-pointer px-3 py-2 text-sm text-gray-700 hover:bg-gray-100", { "bg-gray-100": I === n }),
|
|
197
199
|
role: "option",
|
|
198
200
|
onMouseDown: (t) => {
|
|
199
|
-
t.preventDefault(),
|
|
201
|
+
t.preventDefault(), Y(e);
|
|
200
202
|
},
|
|
201
203
|
children: /* @__PURE__ */ d(h, { prediction: e })
|
|
202
204
|
}, _(e, n)))
|
package/dist/index14.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index14.js","names":["ReactNode","ChangeEvent","KeyboardEvent","useState","useEffect","useRef","useMemo","clsx","Loader2","useMapsLibrary","Input","cn","DEFAULT_ALLOWED_TYPES","Set","getDisplayText","prediction","google","maps","places","PlacePrediction","fullText","text","replace","trim","PredictionItem","t0","$","_c","displayText","parts","t1","Symbol","for","bb0","matches","wasCountryRemoved","length","lastIndex","forEach","substring","index","startOffset","endOffset","Math","min","push","matched","max","t2","isAllowedPrediction","allowedTypes","ReadonlySet","types","size","some","type","has","getPredictionId","placeId","getUniquePredictions","predictions","map","Map","key","set","Array","from","values","getFilteredPredictions","filter","sortPredictions","sort","a","b","aDistance","distanceMeters","Number","POSITIVE_INFINITY","bDistance","buildDisplayPredictions","isExactMatch","value","display","toLowerCase","AddressAutocompleteInput","id","label","placeholder","onValueChange","disabled","name","className","autofillShimName","googleMapsApiKey","locationRestriction","LatLngBoundsLiteral","LatLngBounds","Iterable","inputValue","setInputValue","setPredictions","isDropdownOpen","setIsDropdownOpen","highlightedIndex","setHighlightedIndex","isLoading","setIsLoading","inputRef","HTMLInputElement","dropdownRef","HTMLUListElement","isSelecting","hasUserTyped","sessionTokenRef","AutocompleteSessionToken","optionRefs","HTMLLIElement","scrollBehaviorRef","ScrollBehavior","placesLibrary","allowedTypesSet","newSet","add","current","trimmed","isActive","handler","setTimeout","AutocompleteSuggestion","console","error","request","AutocompleteRequest","input","sessionToken","undefined","includedRegionCodes","fetchAutocompleteSuggestions","then","response","suggestions","placePredictions","suggestion","placePrediction","Boolean","combinedPredictions","singlePrediction","hasExactMatch","catch","clearTimeout","handleClickOutside","event","MouseEvent","contains","target","Node","document","addEventListener","removeEventListener","handleSelectPrediction","newAddress","handleInputChange","e","handleKeyDown","preventDefault","repeat","prev","handleBlur","shimName","item","list","behavior","top","offsetTop","bottom","offsetHeight","viewTop","scrollTop","viewBottom","clientHeight","scrollIntoView","block","position","left","height","width","node"],"sources":["../src/components/AddressAutocompleteInput/index.tsx"],"sourcesContent":["/// <reference types=\"google.maps\" />\n\nimport { ReactNode, ChangeEvent, KeyboardEvent, useState, useEffect, useRef, useMemo } from \"react\"\nimport clsx from \"clsx\"\nimport { Loader2 } from \"lucide-react\"\n\nimport { useMapsLibrary } from \"@/helpers/useMapsLibrary\"\nimport { Input } from \"@/components/Input\"\nimport { cn } from \"@/lib/utils\"\n\n\nconst DEFAULT_ALLOWED_TYPES = new Set([\n \"street_address\",\n \"route\",\n \"premise\",\n \"subpremise\",\n \"intersection\",\n \"sublocality\",\n \"sublocality_level_1\",\n \"sublocality_level_2\",\n \"sublocality_level_3\",\n \"sublocality_level_4\",\n \"sublocality_level_5\",\n \"administrative_area_level_1\",\n \"administrative_area_level_2\",\n \"administrative_area_level_3\",\n \"administrative_area_level_4\",\n \"administrative_area_level_5\",\n \"administrative_area_level_6\",\n \"administrative_area_level_7\",\n \"postal_code\",\n \"locality\",\n \"country\",\n \"geocode\",\n \"plus_code\",\n \"political\",\n \"neighborhood\",\n \"colloquial_area\",\n \"lodging\",\n \"train_station\",\n \"transit_station\",\n])\n\nconst getDisplayText = (prediction: google.maps.places.PlacePrediction) => {\n const fullText = prediction.text?.text ?? \"\"\n return fullText.replace(/, France$/, \"\").trim()\n}\n\nconst PredictionItem = ({ prediction }: { prediction: google.maps.places.PlacePrediction }) => {\n const displayText = getDisplayText(prediction)\n const fullText = prediction.text?.text ?? \"\"\n const matches = prediction.text?.matches ?? []\n const wasCountryRemoved = displayText.length < fullText.length\n\n if (matches.length === 0) {\n return <>{displayText}</>\n }\n\n const parts: ReactNode[] = []\n let lastIndex = 0\n\n matches.forEach((substring, index) => {\n if (wasCountryRemoved && substring.startOffset >= displayText.length) {\n return\n }\n\n const startOffset = substring.startOffset\n const endOffset = Math.min(substring.endOffset, displayText.length)\n\n if (startOffset > lastIndex) {\n parts.push(displayText.substring(lastIndex, startOffset))\n }\n\n if (endOffset > startOffset) {\n const matched = displayText.substring(startOffset, endOffset)\n parts.push(<strong key={index}>{matched}</strong>)\n }\n\n lastIndex = Math.max(lastIndex, endOffset)\n })\n\n if (lastIndex < displayText.length) {\n parts.push(displayText.substring(lastIndex))\n }\n\n if (parts.length === 0) {\n return <>{displayText}</>\n }\n\n return <>{parts}</>\n}\n\nconst isAllowedPrediction = (\n prediction: google.maps.places.PlacePrediction,\n allowedTypes: ReadonlySet<string> | null,\n) => {\n if (!prediction.types || prediction.types.length === 0) {\n return true\n }\n\n if (!allowedTypes || allowedTypes.size === 0) {\n return true\n }\n\n return prediction.types.some(type => allowedTypes.has(type))\n}\n\nconst getPredictionId = (prediction: google.maps.places.PlacePrediction, index: number) =>\n prediction.placeId || `${prediction.text?.text ?? \"prediction\"}-${index}`\n\nconst getUniquePredictions = (predictions: google.maps.places.PlacePrediction[]) => {\n const map = new Map<string, google.maps.places.PlacePrediction>()\n\n predictions.forEach(prediction => {\n const key = prediction.placeId\n\n if (!key) {\n return\n }\n\n if (!map.has(key)) {\n map.set(key, prediction)\n }\n })\n\n return Array.from(map.values())\n}\n\nconst getFilteredPredictions = (\n predictions: google.maps.places.PlacePrediction[],\n allowedTypes: ReadonlySet<string> | null,\n) => predictions.filter(prediction => isAllowedPrediction(prediction, allowedTypes))\n\nconst sortPredictions = (predictions: google.maps.places.PlacePrediction[]) =>\n predictions.sort((a, b) => {\n const aDistance = a.distanceMeters ?? Number.POSITIVE_INFINITY\n const bDistance = b.distanceMeters ?? Number.POSITIVE_INFINITY\n\n return aDistance - bDistance\n })\n\nconst buildDisplayPredictions = (\n predictions: google.maps.places.PlacePrediction[],\n allowedTypes: ReadonlySet<string> | null,\n) => sortPredictions(getFilteredPredictions(getUniquePredictions(predictions), allowedTypes))\n\nconst isExactMatch = (prediction: google.maps.places.PlacePrediction, value: string) => {\n const display = getDisplayText(prediction)\n return display.toLowerCase() === value.trim().toLowerCase()\n}\n\nexport const AddressAutocompleteInput = ({\n id,\n label,\n placeholder,\n value,\n onValueChange,\n disabled,\n name,\n className,\n autofillShimName,\n googleMapsApiKey,\n locationRestriction,\n allowedTypes,\n}: {\n id: string\n label: string\n placeholder: string\n value: string | undefined\n onValueChange: (value: string) => void\n disabled?: boolean\n name?: string\n className?: string\n autofillShimName?: string\n googleMapsApiKey?: string\n locationRestriction?: google.maps.LatLngBoundsLiteral | google.maps.LatLngBounds\n allowedTypes?: Iterable<string>\n}) => {\n const [inputValue, setInputValue] = useState(value ?? \"\")\n const [predictions, setPredictions] = useState<google.maps.places.PlacePrediction[]>([])\n const [isDropdownOpen, setIsDropdownOpen] = useState(false)\n const [highlightedIndex, setHighlightedIndex] = useState(-1)\n const [isLoading, setIsLoading] = useState(false)\n\n const inputRef = useRef<HTMLInputElement>(null)\n const dropdownRef = useRef<HTMLUListElement>(null)\n const isSelecting = useRef(false)\n const hasUserTyped = useRef(false)\n const sessionTokenRef = useRef<google.maps.places.AutocompleteSessionToken | null>(null)\n const optionRefs = useRef<(HTMLLIElement | null)[]>([])\n const scrollBehaviorRef = useRef<ScrollBehavior>(\"smooth\")\n const placesLibrary = useMapsLibrary(\"places\", googleMapsApiKey)\n const allowedTypesSet = useMemo(() => {\n if (!allowedTypes) {\n return DEFAULT_ALLOWED_TYPES\n }\n\n const newSet = new Set<string>()\n for (const type of allowedTypes) {\n newSet.add(type)\n }\n return newSet\n }, [allowedTypes])\n\n useEffect(() => {\n setInputValue(value ?? \"\")\n hasUserTyped.current = false\n }, [value])\n\n useEffect(() => {\n if (isSelecting.current) {\n isSelecting.current = false\n return\n }\n\n const trimmed = inputValue.trim()\n\n if (trimmed === \"\") {\n setIsLoading(false)\n } else {\n setIsLoading(true)\n }\n\n let isActive = true\n\n const handler = setTimeout(() => {\n if (!isActive) {\n return\n }\n\n if (trimmed === \"\") {\n setPredictions([])\n setIsDropdownOpen(false)\n sessionTokenRef.current = null\n if (value !== \"\") {\n onValueChange(\"\")\n }\n return\n }\n\n if (!placesLibrary) return\n\n const { AutocompleteSuggestion, AutocompleteSessionToken } = placesLibrary\n\n if (!AutocompleteSuggestion || !AutocompleteSessionToken) {\n console.error(\"AddressAutocompleteInput: missing AutocompleteSuggestion or AutocompleteSessionToken exports\")\n setPredictions([])\n setIsDropdownOpen(false)\n setIsLoading(false)\n return\n }\n\n if (!sessionTokenRef.current) {\n sessionTokenRef.current = new AutocompleteSessionToken()\n }\n\n const request: google.maps.places.AutocompleteRequest = {\n input: inputValue,\n sessionToken: sessionTokenRef.current ?? undefined,\n includedRegionCodes: [\"fr\"],\n }\n if (locationRestriction) {\n request.locationRestriction = locationRestriction\n }\n\n AutocompleteSuggestion.fetchAutocompleteSuggestions(request)\n .then((response: { suggestions: google.maps.places.AutocompleteSuggestion[] }) => {\n if (!isActive) {\n return\n }\n\n const placePredictions = response.suggestions\n .map((suggestion: google.maps.places.AutocompleteSuggestion) => suggestion.placePrediction)\n .filter((prediction): prediction is google.maps.places.PlacePrediction => Boolean(prediction))\n\n const combinedPredictions = buildDisplayPredictions(placePredictions, allowedTypesSet)\n\n const singlePrediction = combinedPredictions[0]\n const hasExactMatch =\n singlePrediction && combinedPredictions.length === 1 && isExactMatch(singlePrediction, inputValue)\n\n if (!hasUserTyped.current && hasExactMatch) {\n setPredictions(combinedPredictions)\n setIsDropdownOpen(false)\n setIsLoading(false)\n return\n }\n\n if (combinedPredictions.length > 0) {\n setPredictions(combinedPredictions)\n if (hasUserTyped.current) {\n setIsDropdownOpen(true)\n }\n setHighlightedIndex(-1)\n } else {\n setPredictions([])\n setIsDropdownOpen(false)\n }\n setIsLoading(false)\n })\n .catch((error: unknown) => {\n if (!isActive) {\n return\n }\n console.error(\"AddressAutocompleteInput: suggestion fetch failed\", error)\n setPredictions([])\n setIsDropdownOpen(false)\n setIsLoading(false)\n })\n }, 300)\n\n return () => {\n isActive = false\n clearTimeout(handler)\n }\n }, [inputValue, placesLibrary, onValueChange, value, locationRestriction, allowedTypesSet])\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (\n inputRef.current &&\n !inputRef.current.contains(event.target as Node) &&\n dropdownRef.current &&\n !dropdownRef.current.contains(event.target as Node)\n ) {\n setIsDropdownOpen(false)\n }\n }\n document.addEventListener(\"mousedown\", handleClickOutside)\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside)\n }\n }, [])\n\n const handleSelectPrediction = (prediction: google.maps.places.PlacePrediction) => {\n isSelecting.current = true\n const newAddress = getDisplayText(prediction)\n setInputValue(newAddress)\n onValueChange(newAddress)\n setPredictions([])\n setIsDropdownOpen(false)\n setIsLoading(false)\n sessionTokenRef.current = null\n }\n\n const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n hasUserTyped.current = true\n setInputValue(e.target.value)\n }\n\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (!isDropdownOpen || predictions.length === 0) {\n if (e.key === \"Enter\") {\n e.preventDefault()\n onValueChange(inputValue)\n setIsDropdownOpen(false)\n sessionTokenRef.current = null\n }\n return\n }\n\n if (e.key === \"ArrowDown\") {\n scrollBehaviorRef.current = e.repeat ? \"auto\" : \"smooth\"\n e.preventDefault()\n setHighlightedIndex(prev => {\n if (predictions.length === 0) {\n return -1\n }\n return prev < 0 ? 0 : (prev + 1) % predictions.length\n })\n } else if (e.key === \"ArrowUp\") {\n scrollBehaviorRef.current = e.repeat ? \"auto\" : \"smooth\"\n e.preventDefault()\n setHighlightedIndex(prev => {\n if (predictions.length === 0) {\n return -1\n }\n if (prev <= 0) {\n return predictions.length - 1\n }\n return (prev - 1) % predictions.length\n })\n } else if (e.key === \"Enter\") {\n e.preventDefault()\n if (highlightedIndex > -1 && predictions[highlightedIndex]) {\n handleSelectPrediction(predictions[highlightedIndex])\n } else {\n onValueChange(inputValue)\n setIsDropdownOpen(false)\n sessionTokenRef.current = null\n }\n } else if (e.key === \"Escape\") {\n setIsDropdownOpen(false)\n }\n }\n\n const handleBlur = () => {\n setIsDropdownOpen(false)\n if (value !== inputValue) {\n onValueChange(inputValue)\n }\n sessionTokenRef.current = null\n }\n\n const shimName = autofillShimName ?? (name ? `${name}_shim` : undefined)\n\n useEffect(() => {\n if (!isDropdownOpen || highlightedIndex < 0) {\n scrollBehaviorRef.current = \"smooth\"\n return\n }\n\n const item = optionRefs.current[highlightedIndex]\n const list = dropdownRef.current\n\n if (!item || !list) {\n scrollBehaviorRef.current = \"smooth\"\n return\n }\n\n const behavior = scrollBehaviorRef.current\n scrollBehaviorRef.current = \"smooth\"\n\n const top = item.offsetTop\n const bottom = top + item.offsetHeight\n const viewTop = list.scrollTop\n const viewBottom = viewTop + list.clientHeight\n\n if (top >= viewTop && bottom <= viewBottom) {\n return\n }\n\n item.scrollIntoView({\n block: \"nearest\",\n behavior,\n })\n }, [highlightedIndex, isDropdownOpen])\n\n optionRefs.current.length = predictions.length\n\n return (\n <div className=\"relative\">\n {shimName && (\n <input\n tabIndex={-1}\n autoComplete=\"street-address\"\n name={shimName}\n aria-hidden=\"true\"\n style={{\n position: \"absolute\",\n left: \"-9999px\",\n top: \"-9999px\",\n height: \"1px\",\n width: \"1px\",\n }}\n />\n )}\n <label htmlFor={id} className=\"text-left block text-sm font-medium text-gray-700 mb-1 cursor-pointer\">\n {label}\n </label>\n <div className=\"relative\">\n <Input\n ref={inputRef}\n id={id}\n type=\"text\"\n placeholder={placeholder}\n name={name ?? `${id}_input`}\n value={inputValue}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n onFocus={() => {\n if (predictions.length > 0 && inputValue) {\n setIsDropdownOpen(true)\n }\n }}\n onBlur={handleBlur}\n disabled={disabled}\n autoComplete=\"new-password\"\n className={cn(\"w-full\", isLoading && \"pr-9\", className)}\n />\n {isLoading && (\n <Loader2\n className=\"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 animate-spin text-gray-400\"\n aria-hidden=\"true\"\n />\n )}\n </div>\n {isDropdownOpen && predictions.length > 0 && (\n <ul\n ref={dropdownRef}\n className=\"absolute z-10 mt-1 w-full max-h-60 overflow-y-auto rounded-md border border-gray-200 bg-white text-left shadow-lg\"\n role=\"listbox\"\n >\n {predictions.map((prediction, index) => (\n <li\n key={getPredictionId(prediction, index)}\n ref={node => {\n optionRefs.current[index] = node\n }}\n className={clsx(\n \"cursor-pointer px-3 py-2 text-sm text-gray-700 hover:bg-gray-100\",\n { \"bg-gray-100\": highlightedIndex === index },\n )}\n role=\"option\"\n onMouseDown={e => {\n e.preventDefault()\n handleSelectPrediction(prediction)\n }}\n >\n <PredictionItem prediction={prediction} />\n </li>\n ))}\n </ul>\n )}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;AAWA,IAAMY,oBAAwB,IAAIC,IAAI,ggBA6BnB,CAClB,GAEKC,KAAkBC,OACLA,EAAWM,MAAMA,QAAQ,GAAA,CAC1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Event","useState","useEffect","useRef","useMemo","clsx","Loader2","useMapsLibrary","Input","cn","DEFAULT_ALLOWED_TYPES","Set","getDisplayText","prediction","google","maps","places","PlacePrediction","fullText","text","replace","trim","PredictionItem","t0","$","_c","displayText","parts","t1","Symbol","for","bb0","matches","wasCountryRemoved","length","lastIndex","forEach","substring","index","startOffset","endOffset","Math","min","push","matched","max","t2","isAllowedPrediction","allowedTypes","ReadonlySet","types","size","some","type","has","getPredictionId","placeId","getUniquePredictions","predictions","map","Map","key","set","Array","from","values","getFilteredPredictions","filter","sortPredictions","sort","a","b","aDistance","distanceMeters","Number","POSITIVE_INFINITY","bDistance","buildDisplayPredictions","isExactMatch","value","display","toLowerCase","AddressAutocompleteInput","id","label","placeholder","onValueChange","disabled","name","className","autofillShimName","googleMapsApiKey","locationRestriction","loadingIndicator","LatLngBoundsLiteral","LatLngBounds","Iterable","inputValue","setInputValue","setPredictions","isDropdownOpen","setIsDropdownOpen","highlightedIndex","setHighlightedIndex","isLoading","setIsLoading","inputRef","HTMLInputElement","dropdownRef","HTMLUListElement","isSelecting","hasUserTyped","sessionTokenRef","AutocompleteSessionToken","optionRefs","HTMLLIElement","scrollBehaviorRef","ScrollBehavior","placesLibrary","allowedTypesSet","newSet","add","current","trimmed","isActive","handler","setTimeout","AutocompleteSuggestion","console","error","request","AutocompleteRequest","input","sessionToken","undefined","includedRegionCodes","fetchAutocompleteSuggestions","then","response","suggestions","placePredictions","suggestion","placePrediction","Boolean","combinedPredictions","singlePrediction","hasExactMatch","catch","clearTimeout","handleClickOutside","event","MouseEvent","contains","target","Node","document","addEventListener","removeEventListener","handleSelectPrediction","newAddress","handleInputChange","e","handleKeyDown","preventDefault","repeat","prev","handleBlur","shimName","item","list","behavior","top","offsetTop","bottom","offsetHeight","viewTop","scrollTop","viewBottom","clientHeight","scrollIntoView","block","position","left","height","width","node"],"sources":["../src/components/AddressAutocompleteInput/index.tsx"],"sourcesContent":["/// <reference types=\"google.maps\" />\n\nimport { ReactNode, ChangeEvent, KeyboardEvent, useState, useEffect, useRef, useMemo } from \"react\"\nimport clsx from \"clsx\"\nimport { Loader2 } from \"lucide-react\"\n\nimport { useMapsLibrary } from \"@/helpers/useMapsLibrary\"\nimport { Input } from \"@/components/Input\"\nimport { cn } from \"@/lib/utils\"\n\n\nconst DEFAULT_ALLOWED_TYPES = new Set([\n \"street_address\",\n \"route\",\n \"premise\",\n \"subpremise\",\n \"intersection\",\n \"sublocality\",\n \"sublocality_level_1\",\n \"sublocality_level_2\",\n \"sublocality_level_3\",\n \"sublocality_level_4\",\n \"sublocality_level_5\",\n \"administrative_area_level_1\",\n \"administrative_area_level_2\",\n \"administrative_area_level_3\",\n \"administrative_area_level_4\",\n \"administrative_area_level_5\",\n \"administrative_area_level_6\",\n \"administrative_area_level_7\",\n \"postal_code\",\n \"locality\",\n \"country\",\n \"geocode\",\n \"plus_code\",\n \"political\",\n \"neighborhood\",\n \"colloquial_area\",\n \"lodging\",\n \"train_station\",\n \"transit_station\",\n])\n\nconst getDisplayText = (prediction: google.maps.places.PlacePrediction) => {\n const fullText = prediction.text?.text ?? \"\"\n return fullText.replace(/, France$/, \"\").trim()\n}\n\nconst PredictionItem = ({ prediction }: { prediction: google.maps.places.PlacePrediction }) => {\n const displayText = getDisplayText(prediction)\n const fullText = prediction.text?.text ?? \"\"\n const matches = prediction.text?.matches ?? []\n const wasCountryRemoved = displayText.length < fullText.length\n\n if (matches.length === 0) {\n return <>{displayText}</>\n }\n\n const parts: ReactNode[] = []\n let lastIndex = 0\n\n matches.forEach((substring, index) => {\n if (wasCountryRemoved && substring.startOffset >= displayText.length) {\n return\n }\n\n const startOffset = substring.startOffset\n const endOffset = Math.min(substring.endOffset, displayText.length)\n\n if (startOffset > lastIndex) {\n parts.push(displayText.substring(lastIndex, startOffset))\n }\n\n if (endOffset > startOffset) {\n const matched = displayText.substring(startOffset, endOffset)\n parts.push(<strong key={index}>{matched}</strong>)\n }\n\n lastIndex = Math.max(lastIndex, endOffset)\n })\n\n if (lastIndex < displayText.length) {\n parts.push(displayText.substring(lastIndex))\n }\n\n if (parts.length === 0) {\n return <>{displayText}</>\n }\n\n return <>{parts}</>\n}\n\nconst isAllowedPrediction = (\n prediction: google.maps.places.PlacePrediction,\n allowedTypes: ReadonlySet<string> | null,\n) => {\n if (!prediction.types || prediction.types.length === 0) {\n return true\n }\n\n if (!allowedTypes || allowedTypes.size === 0) {\n return true\n }\n\n return prediction.types.some(type => allowedTypes.has(type))\n}\n\nconst getPredictionId = (prediction: google.maps.places.PlacePrediction, index: number) =>\n prediction.placeId || `${prediction.text?.text ?? \"prediction\"}-${index}`\n\nconst getUniquePredictions = (predictions: google.maps.places.PlacePrediction[]) => {\n const map = new Map<string, google.maps.places.PlacePrediction>()\n\n predictions.forEach(prediction => {\n const key = prediction.placeId\n\n if (!key) {\n return\n }\n\n if (!map.has(key)) {\n map.set(key, prediction)\n }\n })\n\n return Array.from(map.values())\n}\n\nconst getFilteredPredictions = (\n predictions: google.maps.places.PlacePrediction[],\n allowedTypes: ReadonlySet<string> | null,\n) => predictions.filter(prediction => isAllowedPrediction(prediction, allowedTypes))\n\nconst sortPredictions = (predictions: google.maps.places.PlacePrediction[]) =>\n predictions.sort((a, b) => {\n const aDistance = a.distanceMeters ?? Number.POSITIVE_INFINITY\n const bDistance = b.distanceMeters ?? Number.POSITIVE_INFINITY\n\n return aDistance - bDistance\n })\n\nconst buildDisplayPredictions = (\n predictions: google.maps.places.PlacePrediction[],\n allowedTypes: ReadonlySet<string> | null,\n) => sortPredictions(getFilteredPredictions(getUniquePredictions(predictions), allowedTypes))\n\nconst isExactMatch = (prediction: google.maps.places.PlacePrediction, value: string) => {\n const display = getDisplayText(prediction)\n return display.toLowerCase() === value.trim().toLowerCase()\n}\n\nexport const AddressAutocompleteInput = ({\n id,\n label,\n placeholder,\n value,\n onValueChange,\n disabled,\n name,\n className,\n autofillShimName,\n googleMapsApiKey,\n locationRestriction,\n allowedTypes,\n loadingIndicator,\n}: {\n id: string\n label: string\n placeholder: string\n value: string | undefined\n onValueChange: (value: string) => void\n disabled?: boolean\n name?: string\n className?: string\n autofillShimName?: string\n googleMapsApiKey?: string\n locationRestriction?: google.maps.LatLngBoundsLiteral | google.maps.LatLngBounds\n allowedTypes?: Iterable<string>\n loadingIndicator?: ReactNode\n}) => {\n const [inputValue, setInputValue] = useState(value ?? \"\")\n const [predictions, setPredictions] = useState<google.maps.places.PlacePrediction[]>([])\n const [isDropdownOpen, setIsDropdownOpen] = useState(false)\n const [highlightedIndex, setHighlightedIndex] = useState(-1)\n const [isLoading, setIsLoading] = useState(false)\n\n const inputRef = useRef<HTMLInputElement>(null)\n const dropdownRef = useRef<HTMLUListElement>(null)\n const isSelecting = useRef(false)\n const hasUserTyped = useRef(false)\n const sessionTokenRef = useRef<google.maps.places.AutocompleteSessionToken | null>(null)\n const optionRefs = useRef<(HTMLLIElement | null)[]>([])\n const scrollBehaviorRef = useRef<ScrollBehavior>(\"smooth\")\n const placesLibrary = useMapsLibrary(\"places\", googleMapsApiKey)\n const allowedTypesSet = useMemo(() => {\n if (!allowedTypes) {\n return DEFAULT_ALLOWED_TYPES\n }\n\n const newSet = new Set<string>()\n for (const type of allowedTypes) {\n newSet.add(type)\n }\n return newSet\n }, [allowedTypes])\n\n useEffect(() => {\n setInputValue(value ?? \"\")\n hasUserTyped.current = false\n }, [value])\n\n useEffect(() => {\n if (isSelecting.current) {\n isSelecting.current = false\n return\n }\n\n const trimmed = inputValue.trim()\n\n if (trimmed === \"\") {\n setIsLoading(false)\n } else {\n setIsLoading(true)\n }\n\n let isActive = true\n\n const handler = setTimeout(() => {\n if (!isActive) {\n return\n }\n\n if (trimmed === \"\") {\n setPredictions([])\n setIsDropdownOpen(false)\n sessionTokenRef.current = null\n if (value !== \"\") {\n onValueChange(\"\")\n }\n return\n }\n\n if (!placesLibrary) return\n\n const { AutocompleteSuggestion, AutocompleteSessionToken } = placesLibrary\n\n if (!AutocompleteSuggestion || !AutocompleteSessionToken) {\n console.error(\"AddressAutocompleteInput: missing AutocompleteSuggestion or AutocompleteSessionToken exports\")\n setPredictions([])\n setIsDropdownOpen(false)\n setIsLoading(false)\n return\n }\n\n if (!sessionTokenRef.current) {\n sessionTokenRef.current = new AutocompleteSessionToken()\n }\n\n const request: google.maps.places.AutocompleteRequest = {\n input: inputValue,\n sessionToken: sessionTokenRef.current ?? undefined,\n includedRegionCodes: [\"fr\"],\n }\n if (locationRestriction) {\n request.locationRestriction = locationRestriction\n }\n\n AutocompleteSuggestion.fetchAutocompleteSuggestions(request)\n .then((response: { suggestions: google.maps.places.AutocompleteSuggestion[] }) => {\n if (!isActive) {\n return\n }\n\n const placePredictions = response.suggestions\n .map((suggestion: google.maps.places.AutocompleteSuggestion) => suggestion.placePrediction)\n .filter((prediction): prediction is google.maps.places.PlacePrediction => Boolean(prediction))\n\n const combinedPredictions = buildDisplayPredictions(placePredictions, allowedTypesSet)\n\n const singlePrediction = combinedPredictions[0]\n const hasExactMatch =\n singlePrediction && combinedPredictions.length === 1 && isExactMatch(singlePrediction, inputValue)\n\n if (!hasUserTyped.current && hasExactMatch) {\n setPredictions(combinedPredictions)\n setIsDropdownOpen(false)\n setIsLoading(false)\n return\n }\n\n if (combinedPredictions.length > 0) {\n setPredictions(combinedPredictions)\n if (hasUserTyped.current) {\n setIsDropdownOpen(true)\n }\n setHighlightedIndex(-1)\n } else {\n setPredictions([])\n setIsDropdownOpen(false)\n }\n setIsLoading(false)\n })\n .catch((error: unknown) => {\n if (!isActive) {\n return\n }\n console.error(\"AddressAutocompleteInput: suggestion fetch failed\", error)\n setPredictions([])\n setIsDropdownOpen(false)\n setIsLoading(false)\n })\n }, 300)\n\n return () => {\n isActive = false\n clearTimeout(handler)\n }\n }, [inputValue, placesLibrary, onValueChange, value, locationRestriction, allowedTypesSet])\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (\n inputRef.current &&\n !inputRef.current.contains(event.target as Node) &&\n dropdownRef.current &&\n !dropdownRef.current.contains(event.target as Node)\n ) {\n setIsDropdownOpen(false)\n }\n }\n document.addEventListener(\"mousedown\", handleClickOutside)\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside)\n }\n }, [])\n\n const handleSelectPrediction = (prediction: google.maps.places.PlacePrediction) => {\n isSelecting.current = true\n const newAddress = getDisplayText(prediction)\n setInputValue(newAddress)\n onValueChange(newAddress)\n setPredictions([])\n setIsDropdownOpen(false)\n setIsLoading(false)\n sessionTokenRef.current = null\n }\n\n const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n hasUserTyped.current = true\n setInputValue(e.target.value)\n }\n\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {\n if (!isDropdownOpen || predictions.length === 0) {\n if (e.key === \"Enter\") {\n e.preventDefault()\n onValueChange(inputValue)\n setIsDropdownOpen(false)\n sessionTokenRef.current = null\n }\n return\n }\n\n if (e.key === \"ArrowDown\") {\n scrollBehaviorRef.current = e.repeat ? \"auto\" : \"smooth\"\n e.preventDefault()\n setHighlightedIndex(prev => {\n if (predictions.length === 0) {\n return -1\n }\n return prev < 0 ? 0 : (prev + 1) % predictions.length\n })\n } else if (e.key === \"ArrowUp\") {\n scrollBehaviorRef.current = e.repeat ? \"auto\" : \"smooth\"\n e.preventDefault()\n setHighlightedIndex(prev => {\n if (predictions.length === 0) {\n return -1\n }\n if (prev <= 0) {\n return predictions.length - 1\n }\n return (prev - 1) % predictions.length\n })\n } else if (e.key === \"Enter\") {\n e.preventDefault()\n if (highlightedIndex > -1 && predictions[highlightedIndex]) {\n handleSelectPrediction(predictions[highlightedIndex])\n } else {\n onValueChange(inputValue)\n setIsDropdownOpen(false)\n sessionTokenRef.current = null\n }\n } else if (e.key === \"Escape\") {\n setIsDropdownOpen(false)\n }\n }\n\n const handleBlur = () => {\n setIsDropdownOpen(false)\n if (value !== inputValue) {\n onValueChange(inputValue)\n }\n sessionTokenRef.current = null\n }\n\n const shimName = autofillShimName ?? (name ? `${name}_shim` : undefined)\n\n useEffect(() => {\n if (!isDropdownOpen || highlightedIndex < 0) {\n scrollBehaviorRef.current = \"smooth\"\n return\n }\n\n const item = optionRefs.current[highlightedIndex]\n const list = dropdownRef.current\n\n if (!item || !list) {\n scrollBehaviorRef.current = \"smooth\"\n return\n }\n\n const behavior = scrollBehaviorRef.current\n scrollBehaviorRef.current = \"smooth\"\n\n const top = item.offsetTop\n const bottom = top + item.offsetHeight\n const viewTop = list.scrollTop\n const viewBottom = viewTop + list.clientHeight\n\n if (top >= viewTop && bottom <= viewBottom) {\n return\n }\n\n item.scrollIntoView({\n block: \"nearest\",\n behavior,\n })\n }, [highlightedIndex, isDropdownOpen])\n\n optionRefs.current.length = predictions.length\n\n return (\n <div className=\"relative\">\n {shimName && (\n <input\n tabIndex={-1}\n autoComplete=\"street-address\"\n name={shimName}\n aria-hidden=\"true\"\n style={{\n position: \"absolute\",\n left: \"-9999px\",\n top: \"-9999px\",\n height: \"1px\",\n width: \"1px\",\n }}\n />\n )}\n <label htmlFor={id} className=\"text-left block text-sm font-medium text-gray-700 mb-1 cursor-pointer\">\n {label}\n </label>\n <div className=\"relative\">\n <Input\n ref={inputRef}\n id={id}\n type=\"text\"\n placeholder={placeholder}\n name={name ?? `${id}_input`}\n value={inputValue}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n onFocus={() => {\n if (predictions.length > 0 && inputValue) {\n setIsDropdownOpen(true)\n }\n }}\n onBlur={handleBlur}\n disabled={disabled}\n autoComplete=\"new-password\"\n className={cn(\"w-full\", isLoading && \"pr-9\", className)}\n />\n {isLoading && (\n <span\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute right-3 top-1/2 flex size-4 -translate-y-1/2 items-center justify-center text-gray-400\"\n data-slot=\"address-autocomplete-loading-indicator\"\n >\n {loadingIndicator === undefined ? <Loader2 className=\"size-full animate-spin\" /> : loadingIndicator}\n </span>\n )}\n </div>\n {isDropdownOpen && predictions.length > 0 && (\n <ul\n ref={dropdownRef}\n className=\"absolute z-10 mt-1 w-full max-h-60 overflow-y-auto rounded-md border border-gray-200 bg-white text-left shadow-lg\"\n role=\"listbox\"\n >\n {predictions.map((prediction, index) => (\n <li\n key={getPredictionId(prediction, index)}\n ref={node => {\n optionRefs.current[index] = node\n }}\n className={clsx(\n \"cursor-pointer px-3 py-2 text-sm text-gray-700 hover:bg-gray-100\",\n { \"bg-gray-100\": highlightedIndex === index },\n )}\n role=\"option\"\n onMouseDown={e => {\n e.preventDefault()\n handleSelectPrediction(prediction)\n }}\n >\n <PredictionItem prediction={prediction} />\n </li>\n ))}\n </ul>\n )}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;AAWA,IAAMY,oBAAwB,IAAIC,IAAI,ggBA6BnB,CAClB,GAEKC,KAAkBC,OACLA,EAAWM,MAAMA,QAAQ,GAAA,CAC1BC,QAAQ,aAAa,EAAE,CAAC,CAACC,KAAK,GAG1CC,KAAiBC,MAAA;CAAA,IAAAC,IAAAC,EAAA,CAAA,GAAC,EAAAZ,kBAAAU,GAAkEG,GAAAC,GAAAC;CAAA,IAAAJ,EAAA,OAAAX,GAAA;EAO/Ee,IAAAC,OAAkBC,IAAlB,6BAAiB;EAACC,KAAA;GAN3BL,IAAoBd,EAAeC,CAAU;GAC7C,IAAAK,IAAiBL,EAAUM,MAAWA,QAArB,IACjBa,IAAgBnB,EAAUM,MAAca,WAAxB,CAAA,GAChBC,IAA0BP,EAAWQ,SAAUhB,EAAQgB;GAEvD,IAAIF,EAAOE,WAAY,GAAC;IACfN,IAAA,kBAAA,GAAA,EAAA,UAAGF,EAAW,CAAA;IAAd,MAAAK;GAAkB;GAG3BJ,IAA2B,CAAA;GAC3B,IAAAQ,IAAgB;GAsBhB,AApBAH,EAAOI,SAASC,GAAAC,MAAA;IACd,IAAIL,KAAqBI,EAASE,eAAgBb,EAAWQ,QAAO;IAIpE,IAAAK,IAAoBF,EAASE,aAC7BC,IAAkBC,KAAIC,IAAKL,EAASG,WAAYd,EAAWQ,MAAO;IAMlE,IAJIK,IAAcJ,KAChBR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AAS,WAAU,yBAAwB,CAAA,IAAMzC;IAC/E,CAAA,CAEL;;GACJO,KAAkB1C,EAAYxB,SAAS,KACtC,kBAAC,MAAD;IACE,KAAK0E;IACL,WAAU;IACV,MAAK;cAEJlD,EAAYC,KAAK9C,GAAYyB,MAC5B,kBAAC,MAAD;KAEE,MAAKmJ,MAAQ;MACXvE,EAAWQ,QAAQpF,KAASmJ;KAC9B;KACA,WAAWpL,EACT,oEACA,EAAE,eAAeiG,MAAqBhE,EAAM,CAC9C;KACA,MAAK;KACL,cAAa2H,MAAK;MAEhBH,AADAG,EAAEE,eAAe,GACjBL,EAAuBjJ,CAAU;KACnC;eAEA,kBAAC,GAAD,EAAgB,YAAYA,EAAW,CAAA;IACrC,GAfG0C,EAAgB1C,GAAYyB,CAAK,CAepC,CACL;GACC,CAAA;EAEH;;AAET"}
|
package/dist/index362.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn as e } from "./index12.js";
|
|
2
2
|
import { getCountryCallingCode as t } from "./index355.js";
|
|
3
3
|
import { resolveMessages as n } from "./index356.js";
|
|
4
|
-
import { COMMON_IDD_PREFIXES as r, buildFallbackSelectedCountry as i, getCachedCountryOptions as a, getLocaleCacheKey as o, getValidCountry as s, normalizeSearchValue as ee, optionMatchIndex as c, parseLocaleCacheKey as
|
|
4
|
+
import { COMMON_IDD_PREFIXES as r, buildFallbackSelectedCountry as i, getCachedCountryOptions as a, getLocaleCacheKey as o, getValidCountry as s, normalizeSearchValue as ee, optionMatchIndex as c, parseLocaleCacheKey as l, toSelectedCountry as te } from "./index358.js";
|
|
5
5
|
import { formatWithAsYouType as u, getLengthIssue as d, sanitizeDigits as f, stripPrefix as ne } from "./index359.js";
|
|
6
6
|
import { captureSelectionSnapshot as p, resolveSelection as m, skipFormattingCharactersLeft as re, skipFormattingCharactersRight as ie } from "./index360.js";
|
|
7
7
|
import { HiddenControl as ae, NullComponent as h, SuggestionContext as oe, SuggestionOption as se, formatCountryOption as ce, suggestionSelectStyles as le } from "./index361.js";
|
|
@@ -95,9 +95,9 @@ function x(e, n) {
|
|
|
95
95
|
isValid: !1,
|
|
96
96
|
lengthIssue: null
|
|
97
97
|
};
|
|
98
|
-
let a = i ?? r, { international: o, national: s, formatted: ee, phoneNumber: c, detectedCountry:
|
|
98
|
+
let a = i ?? r, { international: o, national: s, formatted: ee, phoneNumber: c, detectedCountry: l } = u(a, n), te = i != null, p = te ? l ?? n ?? null : n ?? l ?? null, m = he(p, c?.countryCallingCode), re = f(a), ie = c?.nationalNumber ?? (m && a.startsWith("+") ? ne(re, m) : f(r));
|
|
99
99
|
return {
|
|
100
|
-
displayValue:
|
|
100
|
+
displayValue: te ? o : ee,
|
|
101
101
|
formattedInternational: c?.formatInternational() ?? o,
|
|
102
102
|
formattedNational: c?.formatNational() ?? s,
|
|
103
103
|
e164: c?.number ?? null,
|
|
@@ -110,9 +110,9 @@ function x(e, n) {
|
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
var S = g.forwardRef(function(r, u) {
|
|
113
|
-
let { value: d, defaultCountry: ne, country: v, locale: y, onChange: b, onCountryChange: fe, className: me, inputClassName: he, disabled: S, readOnly: C, selectProps: ve, autofillShimName: ye, messages: be, renderValidationMessage: xe, ...Se } = r, { onFocus: Ce, onBlur: we, onKeyDown: Te, name: Ee, autoComplete: De, ...Oe } = Se, w = typeof v == "string" ? v : null, T = o(y), E = g.useMemo(() =>
|
|
113
|
+
let { value: d, defaultCountry: ne, country: v, locale: y, onChange: b, onCountryChange: fe, className: me, inputClassName: he, disabled: S, readOnly: C, selectProps: ve, autofillShimName: ye, messages: be, renderValidationMessage: xe, ...Se } = r, { onFocus: Ce, onBlur: we, onKeyDown: Te, name: Ee, autoComplete: De, ...Oe } = Se, w = typeof v == "string" ? v : null, T = o(y), E = g.useMemo(() => l(T), [T]), D = g.useMemo(() => n(E, be), [E, be]), O = g.useMemo(() => a(E, T), [T, E]), k = g.useCallback((e) => {
|
|
114
114
|
let t = O.find((t) => t.value === e);
|
|
115
|
-
return t ?
|
|
115
|
+
return t ? te(t) : i(e);
|
|
116
116
|
}, [O]), ke = g.useMemo(() => {
|
|
117
117
|
let e = s(ne ?? v ?? "US");
|
|
118
118
|
return O.some((t) => t.value === e) ? e : O[0]?.value ?? "US";
|
|
@@ -122,8 +122,10 @@ var S = g.forwardRef(function(r, u) {
|
|
|
122
122
|
ne
|
|
123
123
|
]), Ae = g.useRef(null);
|
|
124
124
|
Ae.current ||= x(d, w ?? void 0);
|
|
125
|
-
let je = Ae.current, [A, Me] = g.useState(w ? null : je.country), [j, Ne] = g.useState(je.displayValue), [M, N] = g.useState(""), [P, F] = g.useState(!1), [I, L] = g.useState(-1), [Pe, Fe] = g.useState(!1), [Ie, R] = g.useState(je.lengthIssue), z = g.useRef(null), B = g.useRef(""), V = g.useRef(null), H = g.useRef("smooth"), U = g.useRef(null),
|
|
125
|
+
let je = Ae.current, [A, Me] = g.useState(w ? null : je.country), [j, Ne] = g.useState(je.displayValue), [M, N] = g.useState(""), [P, F] = g.useState(!1), [I, L] = g.useState(-1), [Pe, Fe] = g.useState(!1), [Ie, Le] = g.useState(!1), [Re, R] = g.useState(je.lengthIssue), z = g.useRef(null), B = g.useRef(""), V = g.useRef(null), H = g.useRef("smooth"), U = g.useRef(null), ze = g.useRef(!1), Be = g.useRef(null), W = g.useRef(null), G = w ?? A, Ve = w ?? z.current ?? void 0;
|
|
126
126
|
g.useImperativeHandle(u, () => W.current, []), g.useLayoutEffect(() => {
|
|
127
|
+
Le(!0);
|
|
128
|
+
}, []), g.useLayoutEffect(() => {
|
|
127
129
|
let e = U.current;
|
|
128
130
|
if (!e) return;
|
|
129
131
|
let t = W.current;
|
|
@@ -131,11 +133,11 @@ var S = g.forwardRef(function(r, u) {
|
|
|
131
133
|
let { start: n, end: r } = e;
|
|
132
134
|
t.setSelectionRange(n, r);
|
|
133
135
|
}, [j]);
|
|
134
|
-
let
|
|
135
|
-
let e =
|
|
136
|
+
let He = ve ?? {}, Ue = g.useId(), { styles: We, components: Ge, classNamePrefix: Ke, formatOptionLabel: qe, menuPortalTarget: Je, menuPosition: Ye, ...Xe } = He, { instanceId: Ze, noOptionsMessage: Qe, ...$e } = Xe, et = Ze ?? Ue, [tt, nt] = g.useState(null), rt = "menuPortalTarget" in He, K = rt ? Je : tt, it = g.useMemo(() => {
|
|
137
|
+
let e = We?.menuPortal;
|
|
136
138
|
return {
|
|
137
139
|
...le,
|
|
138
|
-
...
|
|
140
|
+
...We ?? {},
|
|
139
141
|
menuPortal: (t, n) => {
|
|
140
142
|
let r = {
|
|
141
143
|
...t,
|
|
@@ -150,20 +152,20 @@ var S = g.forwardRef(function(r, u) {
|
|
|
150
152
|
};
|
|
151
153
|
}
|
|
152
154
|
};
|
|
153
|
-
}, [K,
|
|
155
|
+
}, [K, We]);
|
|
154
156
|
g.useLayoutEffect(() => {
|
|
155
|
-
if (
|
|
157
|
+
if (rt || typeof document > "u") return;
|
|
156
158
|
let e = W.current?.closest("[data-slot='dialog-content'], [data-slot='sheet-content'], [role='dialog']") ?? document.body;
|
|
157
|
-
|
|
158
|
-
}, [
|
|
159
|
-
let
|
|
159
|
+
nt(e);
|
|
160
|
+
}, [rt]);
|
|
161
|
+
let at = g.useMemo(() => {
|
|
160
162
|
let e = {
|
|
161
163
|
Control: ae,
|
|
162
164
|
IndicatorsContainer: h,
|
|
163
165
|
DropdownIndicator: h,
|
|
164
166
|
IndicatorSeparator: h,
|
|
165
167
|
ValueContainer: h
|
|
166
|
-
}, t =
|
|
168
|
+
}, t = Ge ?? {};
|
|
167
169
|
return t.Option ? {
|
|
168
170
|
...e,
|
|
169
171
|
...t
|
|
@@ -172,21 +174,21 @@ var S = g.forwardRef(function(r, u) {
|
|
|
172
174
|
...t,
|
|
173
175
|
Option: se
|
|
174
176
|
};
|
|
175
|
-
}, [
|
|
177
|
+
}, [Ge]);
|
|
176
178
|
g.useEffect(() => () => {
|
|
177
179
|
V.current != null && typeof window < "u" && window.clearTimeout(V.current);
|
|
178
180
|
}, []), g.useEffect(() => {
|
|
179
181
|
if (d == null) return;
|
|
180
|
-
let e = x(d,
|
|
182
|
+
let e = x(d, Ve);
|
|
181
183
|
B.current = "", Ne(e.displayValue), F(!1), N(""), L(-1), R(e.lengthIssue), !w && e.country !== A && Me(e.country);
|
|
182
184
|
}, [
|
|
183
185
|
w,
|
|
184
|
-
|
|
186
|
+
Ve,
|
|
185
187
|
A,
|
|
186
188
|
d
|
|
187
189
|
]), g.useEffect(() => {
|
|
188
190
|
let e = G ?? null;
|
|
189
|
-
!
|
|
191
|
+
!ze.current && e == null || ze.current && Be.current === e || (ze.current = !0, Be.current = e, fe?.(e, e ? k(e) : null));
|
|
190
192
|
}, [
|
|
191
193
|
G,
|
|
192
194
|
fe,
|
|
@@ -201,7 +203,7 @@ var S = g.forwardRef(function(r, u) {
|
|
|
201
203
|
typeof window > "u" || (V.current != null && window.clearTimeout(V.current), V.current = window.setTimeout(() => {
|
|
202
204
|
B.current = "", V.current = null;
|
|
203
205
|
}, 800));
|
|
204
|
-
}, []),
|
|
206
|
+
}, []), ot = g.useCallback((e, t) => {
|
|
205
207
|
Ne(e.displayValue), F(!1), N(""), L(-1), R(e.lengthIssue), !w && e.country !== A && Me(e.country), t && (U.current = m(t, e.displayValue)), q({
|
|
206
208
|
formattedInternational: e.formattedInternational,
|
|
207
209
|
formattedNational: e.formattedNational,
|
|
@@ -216,7 +218,7 @@ var S = g.forwardRef(function(r, u) {
|
|
|
216
218
|
w,
|
|
217
219
|
q,
|
|
218
220
|
A
|
|
219
|
-
]),
|
|
221
|
+
]), st = g.useCallback((e) => {
|
|
220
222
|
let n = e.target, r = p(n), i = n.value;
|
|
221
223
|
B.current = "";
|
|
222
224
|
let a = pe(i), o = z.current;
|
|
@@ -233,12 +235,12 @@ var S = g.forwardRef(function(r, u) {
|
|
|
233
235
|
value: e.value,
|
|
234
236
|
dialCode: e.dialCode
|
|
235
237
|
}, { allowImplicitInternational: !1 }), s), e);
|
|
236
|
-
|
|
238
|
+
ot(n, r);
|
|
237
239
|
return;
|
|
238
240
|
}
|
|
239
241
|
let c = x(i, w ?? s ?? void 0);
|
|
240
|
-
|
|
241
|
-
}, [
|
|
242
|
+
ot(c, r);
|
|
243
|
+
}, [ot, w]), ct = g.useCallback((e) => {
|
|
242
244
|
if (!e) return;
|
|
243
245
|
z.current = e.value;
|
|
244
246
|
let t = _e(x(ge(j, e), e.value), e);
|
|
@@ -297,44 +299,44 @@ var S = g.forwardRef(function(r, u) {
|
|
|
297
299
|
g.useEffect(() => {
|
|
298
300
|
I < 0 && (H.current = "smooth");
|
|
299
301
|
}, [I]);
|
|
300
|
-
let
|
|
302
|
+
let lt = g.useCallback(() => {
|
|
301
303
|
let e = H.current;
|
|
302
304
|
return H.current = "smooth", e;
|
|
303
|
-
}, []),
|
|
305
|
+
}, []), ut = g.useCallback((e) => {
|
|
304
306
|
let t = Y.findIndex((t) => t.value === e.value);
|
|
305
307
|
t !== -1 && L(t);
|
|
306
|
-
}, [Y]),
|
|
308
|
+
}, [Y]), dt = g.useCallback((e, t) => qe ? qe(e, t) : ce(e), [qe]), ft = g.useCallback((e) => dt(e, {
|
|
307
309
|
context: "menu",
|
|
308
310
|
inputValue: M,
|
|
309
311
|
selectValue: []
|
|
310
|
-
}), [M,
|
|
312
|
+
}), [M, dt]), pt = g.useMemo(() => ({
|
|
311
313
|
highlightedValue: Z?.value ?? null,
|
|
312
|
-
setHighlightedOption:
|
|
313
|
-
renderOptionLabel:
|
|
314
|
-
consumeScrollBehavior:
|
|
314
|
+
setHighlightedOption: ut,
|
|
315
|
+
renderOptionLabel: ft,
|
|
316
|
+
consumeScrollBehavior: lt
|
|
315
317
|
}), [
|
|
316
|
-
|
|
318
|
+
lt,
|
|
317
319
|
Z,
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
]), Q = G ? O.find((e) => e.value === G) : void 0,
|
|
320
|
+
ft,
|
|
321
|
+
ut
|
|
322
|
+
]), Q = G ? O.find((e) => e.value === G) : void 0, mt = Q?.flag ?? "", ht = G ? D.selectedCountryLabel(Q?.name ?? G) : D.selectCountryLabel, gt = !!(G && mt), $ = Re === "TOO_LONG" ? D.lengthTooLong(Q?.name ?? G ?? null) : null, _t = Q?.name ?? G ?? null, vt = null;
|
|
321
323
|
if ($) {
|
|
322
324
|
let e = xe?.({
|
|
323
325
|
message: $,
|
|
324
326
|
code: "TOO_LONG",
|
|
325
|
-
countryName:
|
|
327
|
+
countryName: _t
|
|
326
328
|
});
|
|
327
|
-
|
|
329
|
+
vt = e === void 0 ? /* @__PURE__ */ _("p", {
|
|
328
330
|
className: "mt-1 text-xs text-destructive",
|
|
329
331
|
children: /* @__PURE__ */ _("span", { children: $ })
|
|
330
332
|
}) : e;
|
|
331
333
|
}
|
|
332
|
-
let
|
|
334
|
+
let yt = g.useCallback((e) => {
|
|
333
335
|
B.current = `${B.current}${e}`.slice(-12), N(B.current), F(!0), J();
|
|
334
|
-
}, [J]),
|
|
336
|
+
}, [J]), bt = g.useCallback(() => {
|
|
335
337
|
let e = B.current;
|
|
336
338
|
e && (B.current = e.slice(0, -1), N(B.current), B.current && J());
|
|
337
|
-
}, [J]),
|
|
339
|
+
}, [J]), xt = g.useCallback((e) => {
|
|
338
340
|
if (Te?.(e), e.defaultPrevented) return;
|
|
339
341
|
let t = e.key;
|
|
340
342
|
if (e.metaKey || e.ctrlKey || e.altKey) return;
|
|
@@ -372,12 +374,12 @@ var S = g.forwardRef(function(r, u) {
|
|
|
372
374
|
return;
|
|
373
375
|
}
|
|
374
376
|
if (/^[a-z]$/i.test(t)) {
|
|
375
|
-
e.preventDefault(), P || (F(!0), L(Y.length > 0 ? 0 : -1)),
|
|
377
|
+
e.preventDefault(), P || (F(!0), L(Y.length > 0 ? 0 : -1)), yt(t.toLowerCase());
|
|
376
378
|
return;
|
|
377
379
|
}
|
|
378
380
|
if (X) {
|
|
379
381
|
if (t === "Backspace" && B.current) {
|
|
380
|
-
e.preventDefault(),
|
|
382
|
+
e.preventDefault(), bt();
|
|
381
383
|
return;
|
|
382
384
|
}
|
|
383
385
|
if (t === "Escape") {
|
|
@@ -387,28 +389,28 @@ var S = g.forwardRef(function(r, u) {
|
|
|
387
389
|
if (t === "Enter" && Y.length > 0) {
|
|
388
390
|
e.preventDefault();
|
|
389
391
|
let t = Z ?? Y[0];
|
|
390
|
-
|
|
392
|
+
ct(t);
|
|
391
393
|
return;
|
|
392
394
|
}
|
|
393
395
|
}
|
|
394
396
|
}, [
|
|
395
|
-
|
|
397
|
+
yt,
|
|
396
398
|
Y,
|
|
397
|
-
|
|
399
|
+
ct,
|
|
398
400
|
Z,
|
|
399
401
|
Te,
|
|
400
|
-
|
|
402
|
+
bt,
|
|
401
403
|
P,
|
|
402
404
|
X
|
|
403
|
-
]),
|
|
405
|
+
]), St = g.useCallback((e) => {
|
|
404
406
|
Fe(!0), Ce?.(e);
|
|
405
|
-
}, [Ce]),
|
|
407
|
+
}, [Ce]), Ct = g.useCallback((e) => {
|
|
406
408
|
Fe(!1), F(!1), B.current = "", N(""), we?.(e);
|
|
407
|
-
}, [we]),
|
|
409
|
+
}, [we]), wt = g.useCallback(() => {
|
|
408
410
|
S || C || (B.current = "", N(""), F(!0), L((e) => e < 0 ? 0 : e), requestAnimationFrame(() => {
|
|
409
411
|
W.current?.focus();
|
|
410
412
|
}));
|
|
411
|
-
}, [S, C]),
|
|
413
|
+
}, [S, C]), Tt = ye ?? (Ee ? `${Ee}_shim` : void 0);
|
|
412
414
|
return /* @__PURE__ */ ue("div", {
|
|
413
415
|
className: e("relative flex flex-col", me),
|
|
414
416
|
children: [
|
|
@@ -421,31 +423,31 @@ var S = g.forwardRef(function(r, u) {
|
|
|
421
423
|
className: e("flex h-10 w-full rounded-md border border-input bg-background py-2 text-base ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "pl-11 pr-3", he),
|
|
422
424
|
name: Ee,
|
|
423
425
|
value: j,
|
|
424
|
-
onChange:
|
|
425
|
-
onFocus:
|
|
426
|
-
onBlur:
|
|
427
|
-
onKeyDown:
|
|
426
|
+
onChange: st,
|
|
427
|
+
onFocus: St,
|
|
428
|
+
onBlur: Ct,
|
|
429
|
+
onKeyDown: xt,
|
|
428
430
|
disabled: S,
|
|
429
431
|
readOnly: C,
|
|
430
432
|
autoComplete: De ?? "off"
|
|
431
433
|
}), /* @__PURE__ */ _("button", {
|
|
432
434
|
type: "button",
|
|
433
|
-
className: e("absolute left-3 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded border text-lg leading-none transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
434
|
-
"aria-label":
|
|
435
|
+
className: e("absolute left-3 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded border text-lg leading-none transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", gt ? "border-transparent" : "border-dashed border-border text-muted-foreground", S ? "cursor-not-allowed opacity-50" : C ? "cursor-default" : "cursor-pointer hover:bg-muted"),
|
|
436
|
+
"aria-label": ht,
|
|
435
437
|
onMouseDown: (e) => e.preventDefault(),
|
|
436
|
-
onClick:
|
|
438
|
+
onClick: wt,
|
|
437
439
|
tabIndex: -1,
|
|
438
440
|
disabled: S,
|
|
439
441
|
children: /* @__PURE__ */ _("span", {
|
|
440
442
|
"aria-hidden": "true",
|
|
441
|
-
children:
|
|
443
|
+
children: gt ? mt : "?"
|
|
442
444
|
})
|
|
443
445
|
})]
|
|
444
446
|
}),
|
|
445
|
-
|
|
447
|
+
Tt ? /* @__PURE__ */ _("input", {
|
|
446
448
|
tabIndex: -1,
|
|
447
449
|
autoComplete: "tel",
|
|
448
|
-
name:
|
|
450
|
+
name: Tt,
|
|
449
451
|
"aria-hidden": "true",
|
|
450
452
|
className: "pointer-events-none absolute left-0 top-0 h-0 w-0 opacity-0"
|
|
451
453
|
}) : null,
|
|
@@ -456,31 +458,32 @@ var S = g.forwardRef(function(r, u) {
|
|
|
456
458
|
width: "min(260px, 100%)"
|
|
457
459
|
},
|
|
458
460
|
onMouseDown: (e) => e.preventDefault(),
|
|
459
|
-
children: /* @__PURE__ */ _(oe.Provider, {
|
|
460
|
-
value:
|
|
461
|
+
children: Ie ? /* @__PURE__ */ _(oe.Provider, {
|
|
462
|
+
value: pt,
|
|
461
463
|
children: /* @__PURE__ */ _(de, {
|
|
462
|
-
|
|
464
|
+
...$e,
|
|
465
|
+
instanceId: et,
|
|
463
466
|
menuIsOpen: X,
|
|
464
467
|
options: Y,
|
|
465
468
|
value: null,
|
|
466
|
-
components:
|
|
467
|
-
styles:
|
|
469
|
+
components: at,
|
|
470
|
+
styles: it,
|
|
468
471
|
isClearable: !1,
|
|
469
472
|
isSearchable: !1,
|
|
470
473
|
backspaceRemovesValue: !1,
|
|
471
474
|
tabSelectsValue: !1,
|
|
472
475
|
menuShouldScrollIntoView: !1,
|
|
473
476
|
menuPortalTarget: K,
|
|
474
|
-
menuPosition:
|
|
475
|
-
onChange:
|
|
476
|
-
classNamePrefix:
|
|
477
|
+
menuPosition: Ye ?? (K ? "fixed" : "absolute"),
|
|
478
|
+
onChange: ct,
|
|
479
|
+
classNamePrefix: Ke ?? "phone-number-suggestions",
|
|
477
480
|
placeholder: "",
|
|
478
|
-
formatOptionLabel:
|
|
479
|
-
noOptionsMessage:
|
|
481
|
+
formatOptionLabel: dt,
|
|
482
|
+
noOptionsMessage: Qe ?? (() => D.noMatches)
|
|
480
483
|
})
|
|
481
|
-
})
|
|
484
|
+
}) : null
|
|
482
485
|
}),
|
|
483
|
-
|
|
486
|
+
vt
|
|
484
487
|
]
|
|
485
488
|
});
|
|
486
489
|
});
|
package/dist/index362.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index362.js","names":["React","CountryCode","getCountryCallingCode","Select","Props","SelectProps","SingleValue","StylesConfig","cn","CountryOption","PhoneNumberChangeDetails","PhoneNumberInputProps","PhoneNumberSelectedCountry","resolveMessages","COMMON_IDD_PREFIXES","DEFAULT_COUNTRY","buildFallbackSelectedCountry","getCachedCountryOptions","getLocaleCacheKey","getValidCountry","normalizeSearchValue","optionMatchIndex","parseLocaleCacheKey","toSelectedCountry","formatWithAsYouType","getLengthIssue","sanitizeDigits","stripPrefix","LengthIssue","captureSelectionSnapshot","resolveSelection","skipFormattingCharactersLeft","skipFormattingCharactersRight","HiddenControl","NullComponent","SuggestionContext","SuggestionOption","formatCountryOption","suggestionSelectStyles","SuggestionContextValue","PhoneNumberInputMessages","PhoneNumberInputValidationCode","INVISIBLE_FORMATTING_CHARACTERS","ParsedInput","Omit","displayValue","lengthIssue","stripInvisibleFormatting","value","replace","stripIddPrefix","digits","prefix","startsWith","slice","length","normalizeImplicitInternationalInput","candidate","phoneNumber","detectedCountry","isValid","normalizeExplicitInternationalInput","cleaned","trim","digitsWithoutIdd","normalizeInternationalInput","explicitInternational","getDialCode","country","parsedDialCode","getInputValueForSelectedCountry","option","Pick","options","allowImplicitInternational","dialCode","normalizedInternational","normalizedDigits","currentDialCode","countryCallingCode","nationalDigits","nationalNumber","preferSelectedCountry","parsed","rawInput","parsePhoneInput","rawValue","baseCountry","formattedInternational","formattedNational","e164","shouldFormat","normalized","international","national","formatted","hasInternationalPrefix","formatInternational","formatNational","number","PhoneNumberInput","forwardRef","HTMLInputElement","props","forwardedRef","defaultCountry","countryProp","locale","onChange","onCountryChange","className","inputClassName","disabled","readOnly","selectProps","autofillShimName","messages","messagesProp","renderValidationMessage","restProps","onFocus","onInputFocus","onBlur","onInputBlur","onKeyDown","onInputKeyDown","name","inputName","autoComplete","inputAutoComplete","restInputProps","controlledCountry","localeCacheKey","localeForBuild","useMemo","resolvedMessages","countryOptions","resolveSelectedCountry","useCallback","match","find","menuPriorityCountry","some","initialStateRef","useRef","current","initialState","undefined","uncontrolledCountry","setUncontrolledCountry","useState","inputValueState","setInputValueState","countryQuery","setCountryQuery","showSuggestions","setShowSuggestions","highlightedIndex","setHighlightedIndex","isFocused","setIsFocused","setLengthIssue","manualSelectionCountryRef","keyboardBufferRef","bufferTimeoutRef","scrollBehaviorRef","ScrollBehavior","pendingSelectionRef","start","end","hasNotifiedCountryRef","lastNotifiedCountryRef","inputRef","activeCountry","explicitFormattingCountry","useImperativeHandle","useLayoutEffect","selection","input","setSelectionRange","selectOverrides","styles","userSelectStyles","components","userSelectComponents","classNamePrefix","userClassNamePrefix","formatOptionLabel","userFormatOptionLabel","menuPortalTarget","userMenuPortalTarget","menuPosition","userMenuPosition","forwardedSelectProps","noOptionsMessage","restForwardedSelectProps","defaultMenuPortalTarget","setDefaultMenuPortalTarget","HTMLElement","hasUserMenuPortalTarget","mergedSelectStyles","userMenuPortal","menuPortal","provided","state","baseWithZIndex","zIndex","base","document","body","portalRect","getBoundingClientRect","left","top","portalTarget","closest","mergedSelectComponents","baseComponents","Control","IndicatorsContainer","DropdownIndicator","IndicatorSeparator","ValueContainer","overrides","Option","useEffect","window","clearTimeout","emitChange","details","selectedCountry","scheduleBufferReset","setTimeout","applyParsedInput","snapshot","ReturnType","handleInputChange","event","ChangeEvent","target","raw","normalizedExplicitInternational","manualCountry","manualDialCode","activeManualCountry","rawDigits","manualOption","handleCountrySelect","nextInputValue","requestAnimationFrame","focus","filteredOptions","results","pushUnique","existing","push","priorityOption","currentOption","query","digitQuery","normalizedQuery","forEach","dialMatches","filter","sort","a","b","aExact","bExact","nameMatches","normalizedSearchableTokens","token","includes","aIndex","bIndex","localeCompare","suggestionMenuIsOpen","highlightedOption","consumeScrollBehavior","behavior","updateHighlightedOption","index","findIndex","selectFormatOptionLabel","NonNullable","meta","optionLabelRenderer","context","inputValue","selectValue","highlightContextValue","highlightedValue","setHighlightedOption","renderOptionLabel","activeOption","activeFlag","flag","inlineFlagLabel","selectedCountryLabel","selectCountryLabel","hasInlineFlag","Boolean","lengthHint","lengthTooLong","countryName","validationNode","ReactNode","rendered","message","code","appendToBuffer","char","popBuffer","handleKeyDown","KeyboardEvent","defaultPrevented","key","metaKey","ctrlKey","altKey","currentTarget","selectionStart","selectionEnd","isCollapsedSelection","nextStart","preventDefault","repeat","next","test","toLowerCase","targetOption","handleFocus","FocusEvent","handleBlur","openCountryMenu","shimName","pointerEvents","width","noMatches","displayName"],"sources":["../src/components/PhoneNumberInput/index.tsx"],"sourcesContent":["import * as React from \"react\"\nimport type { CountryCode } from \"libphonenumber-js\"\nimport { getCountryCallingCode } from \"libphonenumber-js\"\nimport Select, {\n type Props as SelectProps,\n type SingleValue,\n type StylesConfig,\n} from \"react-select\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport type {\n CountryOption,\n PhoneNumberChangeDetails,\n PhoneNumberInputProps,\n PhoneNumberSelectedCountry,\n} from \"./types\"\nimport { resolveMessages } from \"./messages\"\nimport {\n COMMON_IDD_PREFIXES,\n DEFAULT_COUNTRY,\n buildFallbackSelectedCountry,\n getCachedCountryOptions,\n getLocaleCacheKey,\n getValidCountry,\n normalizeSearchValue,\n optionMatchIndex,\n parseLocaleCacheKey,\n toSelectedCountry,\n} from \"./country-options\"\nimport {\n formatWithAsYouType,\n getLengthIssue,\n sanitizeDigits,\n stripPrefix,\n type LengthIssue,\n} from \"./normalization\"\nimport {\n captureSelectionSnapshot,\n resolveSelection,\n skipFormattingCharactersLeft,\n skipFormattingCharactersRight,\n} from \"./selection\"\nimport {\n HiddenControl,\n NullComponent,\n SuggestionContext,\n SuggestionOption,\n formatCountryOption,\n suggestionSelectStyles,\n type SuggestionContextValue,\n} from \"./suggestions\"\n\n\nexport type {\n CountryOption,\n PhoneNumberChangeDetails,\n PhoneNumberInputMessages,\n PhoneNumberInputProps,\n PhoneNumberInputValidationCode,\n PhoneNumberSelectedCountry,\n} from \"./types\"\n\nconst INVISIBLE_FORMATTING_CHARACTERS =\n /[\\u061C\\u200B-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]/g\n\ntype ParsedInput = Omit<PhoneNumberChangeDetails, \"selectedCountry\"> & {\n displayValue: string\n lengthIssue: LengthIssue | null\n}\n\nfunction stripInvisibleFormatting(value: string) {\n return value.replace(INVISIBLE_FORMATTING_CHARACTERS, \"\")\n}\n\nfunction stripIddPrefix(digits: string) {\n for (const prefix of COMMON_IDD_PREFIXES) {\n if (digits.startsWith(prefix)) {\n return digits.slice(prefix.length)\n }\n }\n return digits\n}\n\nfunction normalizeImplicitInternationalInput(digits: string) {\n const candidate = `+${digits}`\n const { phoneNumber, detectedCountry } = formatWithAsYouType(candidate)\n\n if (phoneNumber?.isValid() && detectedCountry) {\n return candidate\n }\n\n return null\n}\n\nfunction normalizeExplicitInternationalInput(value: string) {\n const cleaned = stripInvisibleFormatting(value).trim()\n if (!cleaned) {\n return null\n }\n\n if (cleaned.startsWith(\"+\")) {\n const digits = sanitizeDigits(cleaned)\n if (!digits) {\n return \"+\"\n }\n\n const digitsWithoutIdd = stripIddPrefix(digits)\n return digitsWithoutIdd ? `+${digitsWithoutIdd}` : \"+\"\n }\n\n const digits = sanitizeDigits(cleaned)\n if (!digits) {\n return null\n }\n\n const digitsWithoutIdd = stripIddPrefix(digits)\n if (digitsWithoutIdd !== digits) {\n return digitsWithoutIdd ? `+${digitsWithoutIdd}` : \"+\"\n }\n\n return null\n}\n\nfunction normalizeInternationalInput(value: string) {\n const explicitInternational = normalizeExplicitInternationalInput(value)\n if (explicitInternational != null) {\n return explicitInternational\n }\n\n const cleaned = stripInvisibleFormatting(value).trim()\n const digits = sanitizeDigits(cleaned)\n if (!digits) {\n return null\n }\n\n return normalizeImplicitInternationalInput(digits)\n}\n\nfunction getDialCode(country: CountryCode | null, parsedDialCode: string | undefined) {\n if (parsedDialCode) {\n return parsedDialCode\n }\n return country ? getCountryCallingCode(country) : null\n}\n\nfunction getInputValueForSelectedCountry(\n value: string,\n option: Pick<CountryOption, \"dialCode\" | \"value\">,\n options?: { allowImplicitInternational?: boolean }\n) {\n const cleaned = stripInvisibleFormatting(value).trim()\n const digits = sanitizeDigits(cleaned)\n\n if (!digits) {\n return `+${option.dialCode}`\n }\n\n const normalizedInternational =\n options?.allowImplicitInternational === false\n ? normalizeExplicitInternationalInput(cleaned)\n : normalizeInternationalInput(cleaned)\n if (normalizedInternational) {\n const normalizedDigits = sanitizeDigits(normalizedInternational)\n if (normalizedDigits.startsWith(option.dialCode)) {\n return normalizedInternational\n }\n\n const { phoneNumber } = formatWithAsYouType(normalizedInternational)\n const currentDialCode = phoneNumber?.countryCallingCode\n const nationalDigits =\n currentDialCode && normalizedDigits.startsWith(currentDialCode)\n ? normalizedDigits.slice(currentDialCode.length)\n : phoneNumber?.nationalNumber ?? normalizedDigits\n\n return `+${option.dialCode}${nationalDigits}`\n }\n\n const { phoneNumber } = formatWithAsYouType(cleaned, option.value)\n return `+${option.dialCode}${phoneNumber?.nationalNumber ?? digits}`\n}\n\nfunction preferSelectedCountry(\n parsed: ParsedInput,\n option: Pick<CountryOption, \"dialCode\" | \"value\">\n): ParsedInput {\n return {\n ...parsed,\n country: option.value,\n countryCallingCode: option.dialCode,\n lengthIssue: getLengthIssue(parsed.rawInput, option.value),\n }\n}\n\nfunction parsePhoneInput(rawValue: string | undefined, baseCountry?: CountryCode): ParsedInput {\n const cleaned = stripInvisibleFormatting(rawValue ?? \"\").trim()\n\n if (!cleaned) {\n const country = baseCountry ?? null\n const countryCallingCode = country ? getCountryCallingCode(country) : null\n\n return {\n displayValue: \"\",\n formattedInternational: \"\",\n formattedNational: \"\",\n e164: null,\n country,\n countryCallingCode,\n nationalNumber: \"\",\n rawInput: \"\",\n isValid: false,\n lengthIssue: null,\n }\n }\n\n const normalizedInternational = normalizeInternationalInput(cleaned)\n const shouldFormat = normalizedInternational != null || baseCountry != null\n\n if (!shouldFormat) {\n return {\n displayValue: cleaned,\n formattedInternational: cleaned,\n formattedNational: cleaned,\n e164: null,\n country: null,\n countryCallingCode: null,\n nationalNumber: sanitizeDigits(cleaned),\n rawInput: cleaned,\n isValid: false,\n lengthIssue: null,\n }\n }\n\n const normalized = normalizedInternational ?? cleaned\n const {\n international,\n national,\n formatted,\n phoneNumber,\n detectedCountry,\n } = formatWithAsYouType(normalized, baseCountry)\n const hasInternationalPrefix = normalizedInternational != null\n const country = hasInternationalPrefix\n ? detectedCountry ?? baseCountry ?? null\n : baseCountry ?? detectedCountry ?? null\n const countryCallingCode = getDialCode(country, phoneNumber?.countryCallingCode)\n const normalizedDigits = sanitizeDigits(normalized)\n const nationalNumber =\n phoneNumber?.nationalNumber ??\n (countryCallingCode && normalized.startsWith(\"+\")\n ? stripPrefix(normalizedDigits, countryCallingCode)\n : sanitizeDigits(cleaned))\n const displayValue = hasInternationalPrefix ? international : formatted\n\n return {\n displayValue,\n formattedInternational: phoneNumber?.formatInternational() ?? international,\n formattedNational: phoneNumber?.formatNational() ?? national,\n e164: phoneNumber?.number ?? null,\n country,\n countryCallingCode,\n nationalNumber,\n rawInput: normalized,\n isValid: phoneNumber?.isValid() ?? false,\n lengthIssue: country ? getLengthIssue(normalized, country) : null,\n }\n}\n\nexport const PhoneNumberInput = React.forwardRef<HTMLInputElement, PhoneNumberInputProps>(\n function PhoneNumberInput(props, forwardedRef) {\n const {\n value,\n defaultCountry,\n country: countryProp,\n locale,\n onChange,\n onCountryChange,\n className,\n inputClassName,\n disabled,\n readOnly,\n selectProps,\n autofillShimName,\n messages: messagesProp,\n renderValidationMessage,\n ...restProps\n } = props\n\n const {\n onFocus: onInputFocus,\n onBlur: onInputBlur,\n onKeyDown: onInputKeyDown,\n name: inputName,\n autoComplete: inputAutoComplete,\n ...restInputProps\n } = restProps\n\n const controlledCountry = typeof countryProp === \"string\" ? countryProp : null\n const localeCacheKey = getLocaleCacheKey(locale)\n const localeForBuild = React.useMemo(\n () => parseLocaleCacheKey(localeCacheKey),\n [localeCacheKey]\n )\n const resolvedMessages = React.useMemo(\n () => resolveMessages(localeForBuild, messagesProp),\n [localeForBuild, messagesProp]\n )\n const countryOptions = React.useMemo(\n () => getCachedCountryOptions(localeForBuild, localeCacheKey),\n [localeCacheKey, localeForBuild]\n )\n const resolveSelectedCountry = React.useCallback(\n (country: CountryCode): PhoneNumberSelectedCountry => {\n const match = countryOptions.find((candidate) => candidate.value === country)\n if (match) {\n return toSelectedCountry(match)\n }\n return buildFallbackSelectedCountry(country)\n },\n [countryOptions]\n )\n const menuPriorityCountry = React.useMemo(() => {\n const candidate = getValidCountry(defaultCountry ?? countryProp ?? DEFAULT_COUNTRY)\n if (countryOptions.some((option) => option.value === candidate)) {\n return candidate\n }\n return countryOptions[0]?.value ?? DEFAULT_COUNTRY\n }, [countryOptions, countryProp, defaultCountry])\n\n const initialStateRef = React.useRef<ParsedInput | null>(null)\n\n if (!initialStateRef.current) {\n const initialState = parsePhoneInput(value, controlledCountry ?? undefined)\n initialStateRef.current = initialState\n }\n\n const initialState = initialStateRef.current\n\n const [uncontrolledCountry, setUncontrolledCountry] = React.useState<CountryCode | null>(\n controlledCountry ? null : initialState.country\n )\n const [inputValueState, setInputValueState] = React.useState(initialState.displayValue)\n const [countryQuery, setCountryQuery] = React.useState(\"\")\n const [showSuggestions, setShowSuggestions] = React.useState(false)\n const [highlightedIndex, setHighlightedIndex] = React.useState<number>(-1)\n const [isFocused, setIsFocused] = React.useState(false)\n const [lengthIssue, setLengthIssue] = React.useState<LengthIssue | null>(\n initialState.lengthIssue\n )\n\n const manualSelectionCountryRef = React.useRef<CountryCode | null>(null)\n const keyboardBufferRef = React.useRef(\"\")\n const bufferTimeoutRef = React.useRef<number | null>(null)\n const scrollBehaviorRef = React.useRef<ScrollBehavior>(\"smooth\")\n const pendingSelectionRef = React.useRef<{ start: number; end: number } | null>(null)\n const hasNotifiedCountryRef = React.useRef(false)\n const lastNotifiedCountryRef = React.useRef<CountryCode | null>(null)\n const inputRef = React.useRef<HTMLInputElement | null>(null)\n\n const activeCountry = controlledCountry ?? uncontrolledCountry\n const explicitFormattingCountry = controlledCountry ?? manualSelectionCountryRef.current ?? undefined\n\n React.useImperativeHandle(forwardedRef, () => inputRef.current as HTMLInputElement, [])\n\n React.useLayoutEffect(() => {\n const selection = pendingSelectionRef.current\n if (!selection) {\n return\n }\n\n const input = inputRef.current\n pendingSelectionRef.current = null\n if (!input) {\n return\n }\n\n const { start, end } = selection\n input.setSelectionRange(start, end)\n }, [inputValueState])\n\n const selectOverrides = selectProps ?? {}\n const {\n styles: userSelectStyles,\n components: userSelectComponents,\n classNamePrefix: userClassNamePrefix,\n formatOptionLabel: userFormatOptionLabel,\n menuPortalTarget: userMenuPortalTarget,\n menuPosition: userMenuPosition,\n ...forwardedSelectProps\n } = selectOverrides\n const { noOptionsMessage, ...restForwardedSelectProps } = forwardedSelectProps\n const [defaultMenuPortalTarget, setDefaultMenuPortalTarget] =\n React.useState<HTMLElement | null>(null)\n const hasUserMenuPortalTarget = \"menuPortalTarget\" in selectOverrides\n const menuPortalTarget = hasUserMenuPortalTarget\n ? userMenuPortalTarget\n : defaultMenuPortalTarget\n\n const mergedSelectStyles = React.useMemo<StylesConfig<CountryOption, false>>(\n () => {\n const userMenuPortal = userSelectStyles?.menuPortal\n\n return {\n ...suggestionSelectStyles,\n ...(userSelectStyles ?? {}),\n menuPortal: (provided, state) => {\n const baseWithZIndex = {\n ...provided,\n zIndex: 1300,\n }\n const base = userMenuPortal ? userMenuPortal(baseWithZIndex, state) : baseWithZIndex\n\n if (typeof document === \"undefined\" || !menuPortalTarget || menuPortalTarget === document.body) {\n return base\n }\n\n const portalRect = menuPortalTarget.getBoundingClientRect()\n return {\n ...base,\n left: typeof base.left === \"number\" ? base.left - portalRect.left : base.left,\n top: typeof base.top === \"number\" ? base.top - portalRect.top : base.top,\n }\n },\n }\n },\n [menuPortalTarget, userSelectStyles]\n )\n\n React.useLayoutEffect(() => {\n if (hasUserMenuPortalTarget || typeof document === \"undefined\") {\n return\n }\n\n const portalTarget =\n inputRef.current?.closest<HTMLElement>(\n \"[data-slot='dialog-content'], [data-slot='sheet-content'], [role='dialog']\"\n ) ?? document.body\n setDefaultMenuPortalTarget(portalTarget)\n }, [hasUserMenuPortalTarget])\n\n const mergedSelectComponents = React.useMemo(() => {\n const baseComponents = {\n Control: HiddenControl,\n IndicatorsContainer: NullComponent,\n DropdownIndicator: NullComponent,\n IndicatorSeparator: NullComponent,\n ValueContainer: NullComponent,\n }\n\n const overrides = userSelectComponents ?? {}\n\n if (!overrides.Option) {\n return {\n ...baseComponents,\n ...overrides,\n Option: SuggestionOption,\n }\n }\n\n return {\n ...baseComponents,\n ...overrides,\n }\n }, [userSelectComponents])\n\n React.useEffect(() => () => {\n if (bufferTimeoutRef.current != null && typeof window !== \"undefined\") {\n window.clearTimeout(bufferTimeoutRef.current)\n }\n }, [])\n\n React.useEffect(() => {\n if (value == null) {\n return\n }\n\n const parsed = parsePhoneInput(value, explicitFormattingCountry)\n keyboardBufferRef.current = \"\"\n\n setInputValueState(parsed.displayValue)\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setHighlightedIndex(-1)\n setLengthIssue(parsed.lengthIssue)\n\n if (!controlledCountry && parsed.country !== uncontrolledCountry) {\n setUncontrolledCountry(parsed.country)\n }\n }, [controlledCountry, explicitFormattingCountry, uncontrolledCountry, value])\n\n React.useEffect(() => {\n const country = activeCountry ?? null\n if (!hasNotifiedCountryRef.current && country == null) {\n return\n }\n\n if (hasNotifiedCountryRef.current && lastNotifiedCountryRef.current === country) {\n return\n }\n\n hasNotifiedCountryRef.current = true\n lastNotifiedCountryRef.current = country\n onCountryChange?.(country, country ? resolveSelectedCountry(country) : null)\n }, [activeCountry, onCountryChange, resolveSelectedCountry])\n\n const emitChange = React.useCallback(\n (details: Omit<PhoneNumberChangeDetails, \"selectedCountry\">) => {\n onChange?.({\n ...details,\n selectedCountry: details.country ? resolveSelectedCountry(details.country) : null,\n })\n },\n [onChange, resolveSelectedCountry]\n )\n\n const scheduleBufferReset = React.useCallback(() => {\n if (typeof window === \"undefined\") {\n return\n }\n\n if (bufferTimeoutRef.current != null) {\n window.clearTimeout(bufferTimeoutRef.current)\n }\n\n bufferTimeoutRef.current = window.setTimeout(() => {\n keyboardBufferRef.current = \"\"\n bufferTimeoutRef.current = null\n }, 800)\n }, [])\n\n const applyParsedInput = React.useCallback(\n (parsed: ParsedInput, snapshot: ReturnType<typeof captureSelectionSnapshot> | null) => {\n setInputValueState(parsed.displayValue)\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setHighlightedIndex(-1)\n setLengthIssue(parsed.lengthIssue)\n\n if (!controlledCountry && parsed.country !== uncontrolledCountry) {\n setUncontrolledCountry(parsed.country)\n }\n\n if (snapshot) {\n pendingSelectionRef.current = resolveSelection(snapshot, parsed.displayValue)\n }\n\n emitChange({\n formattedInternational: parsed.formattedInternational,\n formattedNational: parsed.formattedNational,\n e164: parsed.e164,\n country: parsed.country,\n countryCallingCode: parsed.countryCallingCode,\n nationalNumber: parsed.nationalNumber,\n rawInput: parsed.rawInput,\n isValid: parsed.isValid,\n })\n },\n [controlledCountry, emitChange, uncontrolledCountry]\n )\n\n const handleInputChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const target = event.target\n const snapshot = captureSelectionSnapshot(target)\n const raw = target.value\n keyboardBufferRef.current = \"\"\n\n const normalizedExplicitInternational = normalizeExplicitInternationalInput(raw)\n const manualCountry = manualSelectionCountryRef.current\n if (normalizedExplicitInternational != null && manualCountry) {\n const manualDialCode = getCountryCallingCode(manualCountry)\n if (!sanitizeDigits(normalizedExplicitInternational).startsWith(manualDialCode)) {\n manualSelectionCountryRef.current = null\n }\n } else if (normalizedExplicitInternational != null) {\n manualSelectionCountryRef.current = null\n }\n\n const activeManualCountry = manualSelectionCountryRef.current\n const rawDigits = sanitizeDigits(raw)\n if (\n !controlledCountry &&\n activeManualCountry &&\n normalizedExplicitInternational == null &&\n rawDigits\n ) {\n const manualOption = {\n value: activeManualCountry,\n dialCode: getCountryCallingCode(activeManualCountry),\n }\n const parsed = preferSelectedCountry(\n parsePhoneInput(\n getInputValueForSelectedCountry(\n raw,\n {\n value: manualOption.value,\n dialCode: manualOption.dialCode,\n },\n { allowImplicitInternational: false }\n ),\n activeManualCountry\n ),\n manualOption\n )\n applyParsedInput(parsed, snapshot)\n return\n }\n\n const baseCountry = controlledCountry ?? activeManualCountry ?? undefined\n const parsed = parsePhoneInput(raw, baseCountry)\n applyParsedInput(parsed, snapshot)\n },\n [applyParsedInput, controlledCountry]\n )\n\n const handleCountrySelect = React.useCallback(\n (option: SingleValue<CountryOption>) => {\n if (!option) {\n return\n }\n\n manualSelectionCountryRef.current = option.value\n const nextInputValue = getInputValueForSelectedCountry(inputValueState, option)\n const parsed = preferSelectedCountry(\n parsePhoneInput(nextInputValue, option.value),\n option\n )\n\n setInputValueState(parsed.displayValue)\n pendingSelectionRef.current = {\n start: parsed.displayValue.length,\n end: parsed.displayValue.length,\n }\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setHighlightedIndex(-1)\n setLengthIssue(parsed.lengthIssue)\n\n if (!controlledCountry) {\n setUncontrolledCountry(option.value)\n }\n\n emitChange({\n formattedInternational: parsed.formattedInternational,\n formattedNational: parsed.formattedNational,\n e164: parsed.e164,\n country: parsed.country,\n countryCallingCode: parsed.countryCallingCode,\n nationalNumber: parsed.nationalNumber,\n rawInput: parsed.rawInput,\n isValid: parsed.isValid,\n })\n\n requestAnimationFrame(() => {\n inputRef.current?.focus()\n })\n },\n [controlledCountry, emitChange, inputValueState]\n )\n\n const filteredOptions = React.useMemo(() => {\n if (!showSuggestions) {\n return [] as CountryOption[]\n }\n\n const results: CountryOption[] = []\n\n const pushUnique = (option: CountryOption | undefined) => {\n if (option && !results.some((existing) => existing.value === option.value)) {\n results.push(option)\n }\n }\n\n const priorityOption = countryOptions.find((option) => option.value === menuPriorityCountry)\n const currentOption = activeCountry\n ? countryOptions.find((option) => option.value === activeCountry)\n : undefined\n const query = countryQuery.trim()\n const digitQuery = sanitizeDigits(query)\n const normalizedQuery = normalizeSearchValue(query)\n\n if (!digitQuery && !normalizedQuery) {\n pushUnique(currentOption)\n pushUnique(priorityOption)\n countryOptions.forEach(pushUnique)\n return results\n }\n\n if (digitQuery) {\n const dialMatches = countryOptions\n .filter((option) => option.dialCode.startsWith(digitQuery))\n .sort((a, b) => {\n const aExact = a.dialCode === digitQuery\n const bExact = b.dialCode === digitQuery\n if (aExact && !bExact) {\n return -1\n }\n if (!aExact && bExact) {\n return 1\n }\n return a.dialCode.length - b.dialCode.length\n })\n dialMatches.forEach(pushUnique)\n }\n\n if (normalizedQuery) {\n const nameMatches = countryOptions\n .filter((option) =>\n option.normalizedSearchableTokens.some((token) => token.includes(normalizedQuery))\n )\n .sort((a, b) => {\n const aIndex = optionMatchIndex(a.normalizedSearchableTokens, normalizedQuery)\n const bIndex = optionMatchIndex(b.normalizedSearchableTokens, normalizedQuery)\n if (aIndex !== bIndex) {\n return aIndex - bIndex\n }\n return a.name.localeCompare(b.name)\n })\n nameMatches.forEach(pushUnique)\n }\n\n pushUnique(currentOption)\n pushUnique(priorityOption)\n if (results.length === 0) {\n countryOptions.forEach(pushUnique)\n }\n\n return results\n }, [activeCountry, countryOptions, countryQuery, menuPriorityCountry, showSuggestions])\n\n const suggestionMenuIsOpen = isFocused && showSuggestions && filteredOptions.length > 0\n\n React.useEffect(() => {\n if (!suggestionMenuIsOpen) {\n scrollBehaviorRef.current = \"smooth\"\n }\n }, [suggestionMenuIsOpen])\n\n React.useEffect(() => {\n if (!suggestionMenuIsOpen) {\n setHighlightedIndex(-1)\n return\n }\n\n if (filteredOptions.length === 0) {\n setHighlightedIndex(-1)\n return\n }\n\n setHighlightedIndex((current) => {\n if (current < 0 || current >= filteredOptions.length) {\n return 0\n }\n return current\n })\n }, [filteredOptions, suggestionMenuIsOpen])\n\n const highlightedOption =\n highlightedIndex >= 0 ? filteredOptions[highlightedIndex] ?? null : null\n\n React.useEffect(() => {\n if (highlightedIndex < 0) {\n scrollBehaviorRef.current = \"smooth\"\n }\n }, [highlightedIndex])\n\n const consumeScrollBehavior = React.useCallback(() => {\n const behavior = scrollBehaviorRef.current\n scrollBehaviorRef.current = \"smooth\"\n return behavior\n }, [])\n\n const updateHighlightedOption = React.useCallback(\n (option: CountryOption) => {\n const index = filteredOptions.findIndex((candidate) => candidate.value === option.value)\n if (index !== -1) {\n setHighlightedIndex(index)\n }\n },\n [filteredOptions]\n )\n\n const selectFormatOptionLabel = React.useCallback<\n NonNullable<SelectProps<CountryOption, false>[\"formatOptionLabel\"]>\n >(\n (option, meta) => {\n if (userFormatOptionLabel) {\n return userFormatOptionLabel(option, meta)\n }\n return formatCountryOption(option)\n },\n [userFormatOptionLabel]\n )\n\n const optionLabelRenderer = React.useCallback(\n (option: CountryOption) =>\n selectFormatOptionLabel(option, {\n context: \"menu\",\n inputValue: countryQuery,\n selectValue: [],\n }),\n [countryQuery, selectFormatOptionLabel]\n )\n\n const highlightContextValue = React.useMemo<SuggestionContextValue>(\n () => ({\n highlightedValue: highlightedOption?.value ?? null,\n setHighlightedOption: updateHighlightedOption,\n renderOptionLabel: optionLabelRenderer,\n consumeScrollBehavior,\n }),\n [consumeScrollBehavior, highlightedOption, optionLabelRenderer, updateHighlightedOption]\n )\n\n const activeOption = activeCountry\n ? countryOptions.find((option) => option.value === activeCountry)\n : undefined\n const activeFlag = activeOption?.flag ?? \"\"\n const inlineFlagLabel = activeCountry\n ? resolvedMessages.selectedCountryLabel(activeOption?.name ?? activeCountry)\n : resolvedMessages.selectCountryLabel\n const hasInlineFlag = Boolean(activeCountry && activeFlag)\n const lengthHint =\n lengthIssue === \"TOO_LONG\"\n ? resolvedMessages.lengthTooLong(activeOption?.name ?? activeCountry ?? null)\n : null\n const countryName = activeOption?.name ?? activeCountry ?? null\n\n let validationNode: React.ReactNode = null\n if (lengthHint) {\n const rendered = renderValidationMessage?.({\n message: lengthHint,\n code: \"TOO_LONG\",\n countryName,\n })\n validationNode =\n rendered === undefined ? (\n <p className=\"mt-1 text-xs text-destructive\">\n <span>{lengthHint}</span>\n </p>\n ) : (\n rendered\n )\n }\n\n const appendToBuffer = React.useCallback(\n (char: string) => {\n keyboardBufferRef.current = `${keyboardBufferRef.current}${char}`.slice(-12)\n setCountryQuery(keyboardBufferRef.current)\n setShowSuggestions(true)\n scheduleBufferReset()\n },\n [scheduleBufferReset]\n )\n\n const popBuffer = React.useCallback(() => {\n const current = keyboardBufferRef.current\n if (!current) {\n return\n }\n keyboardBufferRef.current = current.slice(0, -1)\n setCountryQuery(keyboardBufferRef.current)\n if (keyboardBufferRef.current) {\n scheduleBufferReset()\n }\n }, [scheduleBufferReset])\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n onInputKeyDown?.(event)\n if (event.defaultPrevented) {\n return\n }\n\n const key = event.key\n\n if (event.metaKey || event.ctrlKey || event.altKey) {\n return\n }\n\n const target = event.currentTarget\n const value = target.value\n const selectionStart = target.selectionStart ?? 0\n const selectionEnd = target.selectionEnd ?? selectionStart\n const isCollapsedSelection = selectionStart === selectionEnd\n\n if (key === \"Backspace\" && isCollapsedSelection) {\n const nextStart = skipFormattingCharactersLeft(value, selectionStart)\n if (nextStart !== selectionStart) {\n target.setSelectionRange(nextStart, nextStart)\n }\n } else if (key === \"ArrowLeft\" && isCollapsedSelection) {\n const nextStart = skipFormattingCharactersLeft(value, selectionStart)\n if (nextStart !== selectionStart) {\n event.preventDefault()\n target.setSelectionRange(nextStart, nextStart)\n return\n }\n } else if (key === \"ArrowRight\" && isCollapsedSelection) {\n const nextStart = skipFormattingCharactersRight(value, selectionEnd)\n if (nextStart !== selectionEnd) {\n event.preventDefault()\n target.setSelectionRange(nextStart, nextStart)\n return\n }\n }\n\n if (key === \"ArrowDown\") {\n scrollBehaviorRef.current = event.repeat ? \"auto\" : \"smooth\"\n event.preventDefault()\n if (!showSuggestions) {\n setShowSuggestions(true)\n setHighlightedIndex(filteredOptions.length > 0 ? 0 : -1)\n return\n }\n\n if (filteredOptions.length > 0) {\n setHighlightedIndex((current) => {\n const next = current < 0 ? 0 : (current + 1) % filteredOptions.length\n return next\n })\n }\n return\n }\n\n if (key === \"ArrowUp\") {\n scrollBehaviorRef.current = event.repeat ? \"auto\" : \"smooth\"\n event.preventDefault()\n if (!showSuggestions) {\n setShowSuggestions(true)\n setHighlightedIndex(filteredOptions.length > 0 ? filteredOptions.length - 1 : -1)\n return\n }\n\n if (filteredOptions.length > 0) {\n setHighlightedIndex((current) => {\n if (current < 0) {\n return filteredOptions.length - 1\n }\n return (current - 1 + filteredOptions.length) % filteredOptions.length\n })\n }\n return\n }\n\n if (/^[a-z]$/i.test(key)) {\n event.preventDefault()\n if (!showSuggestions) {\n setShowSuggestions(true)\n setHighlightedIndex(filteredOptions.length > 0 ? 0 : -1)\n }\n appendToBuffer(key.toLowerCase())\n return\n }\n\n if (suggestionMenuIsOpen) {\n if (key === \"Backspace\" && keyboardBufferRef.current) {\n event.preventDefault()\n popBuffer()\n return\n }\n\n if (key === \"Escape\") {\n event.preventDefault()\n keyboardBufferRef.current = \"\"\n setCountryQuery(\"\")\n setShowSuggestions(false)\n return\n }\n\n if (key === \"Enter\" && filteredOptions.length > 0) {\n event.preventDefault()\n const targetOption = highlightedOption ?? filteredOptions[0]\n handleCountrySelect(targetOption)\n return\n }\n }\n },\n [\n appendToBuffer,\n filteredOptions,\n handleCountrySelect,\n highlightedOption,\n onInputKeyDown,\n popBuffer,\n showSuggestions,\n suggestionMenuIsOpen,\n ]\n )\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(true)\n onInputFocus?.(event)\n },\n [onInputFocus]\n )\n\n const handleBlur = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(false)\n setShowSuggestions(false)\n keyboardBufferRef.current = \"\"\n setCountryQuery(\"\")\n onInputBlur?.(event)\n },\n [onInputBlur]\n )\n\n const openCountryMenu = React.useCallback(() => {\n if (disabled || readOnly) {\n return\n }\n\n keyboardBufferRef.current = \"\"\n setCountryQuery(\"\")\n setShowSuggestions(true)\n setHighlightedIndex((current) => (current < 0 ? 0 : current))\n\n requestAnimationFrame(() => {\n inputRef.current?.focus()\n })\n }, [disabled, readOnly])\n\n const shimName = autofillShimName ?? (inputName ? `${inputName}_shim` : undefined)\n\n return (\n <div className={cn(\"relative flex flex-col\", className)}>\n <div className=\"relative\">\n <input\n {...restInputProps}\n ref={inputRef}\n type=\"tel\"\n className={cn(\n \"flex h-10 w-full rounded-md border border-input bg-background py-2 text-base ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n \"pl-11 pr-3\",\n inputClassName\n )}\n name={inputName}\n value={inputValueState}\n onChange={handleInputChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n disabled={disabled}\n readOnly={readOnly}\n autoComplete={inputAutoComplete ?? \"off\"}\n />\n <button\n type=\"button\"\n className={cn(\n \"absolute left-3 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded border text-lg leading-none transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n hasInlineFlag\n ? \"border-transparent\"\n : \"border-dashed border-border text-muted-foreground\",\n disabled\n ? \"cursor-not-allowed opacity-50\"\n : readOnly\n ? \"cursor-default\"\n : \"cursor-pointer hover:bg-muted\"\n )}\n aria-label={inlineFlagLabel}\n onMouseDown={(event) => event.preventDefault()}\n onClick={openCountryMenu}\n tabIndex={-1}\n disabled={disabled}\n >\n <span aria-hidden=\"true\">\n {hasInlineFlag ? activeFlag : \"?\"}\n </span>\n </button>\n </div>\n\n {shimName ? (\n <input\n tabIndex={-1}\n autoComplete=\"tel\"\n name={shimName}\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute left-0 top-0 h-0 w-0 opacity-0\"\n />\n ) : null}\n\n <div\n className=\"absolute left-0 top-full z-30 mt-1\"\n style={{\n pointerEvents: suggestionMenuIsOpen ? \"auto\" : \"none\",\n width: \"min(260px, 100%)\",\n }}\n onMouseDown={(event) => event.preventDefault()}\n >\n <SuggestionContext.Provider value={highlightContextValue}>\n <Select<CountryOption, false>\n {...restForwardedSelectProps}\n menuIsOpen={suggestionMenuIsOpen}\n options={filteredOptions}\n value={null}\n components={mergedSelectComponents}\n styles={mergedSelectStyles}\n isClearable={false}\n isSearchable={false}\n backspaceRemovesValue={false}\n tabSelectsValue={false}\n menuShouldScrollIntoView={false}\n menuPortalTarget={menuPortalTarget}\n menuPosition={userMenuPosition ?? (menuPortalTarget ? \"fixed\" : \"absolute\")}\n onChange={handleCountrySelect}\n classNamePrefix={userClassNamePrefix ?? \"phone-number-suggestions\"}\n placeholder=\"\"\n formatOptionLabel={selectFormatOptionLabel}\n noOptionsMessage={\n noOptionsMessage ?? (() => resolvedMessages.noMatches)\n }\n />\n </SuggestionContext.Provider>\n </div>\n\n {validationNode}\n </div>\n )\n }\n)\n\nPhoneNumberInput.displayName = \"PhoneNumberInput\"\n"],"mappings":";;;;;;;;;;;AA+DA,IAAM0C,IACJ;AAOF,SAASK,EAAyBC,GAAe;CAC/C,OAAOA,EAAMC,QAAQP,GAAiC,EAAE;AAC1D;AAEA,SAASQ,EAAeC,GAAgB;CACtC,KAAK,IAAMC,KAAUtC,GACnB,IAAIqC,EAAOE,WAAWD,CAAM,GAC1B,OAAOD,EAAOG,MAAMF,EAAOG,MAAM;CAGrC,OAAOJ;AACT;AAEA,SAASK,GAAoCL,GAAgB;CAC3D,IAAMM,IAAY,IAAIN,KAChB,EAAEO,gBAAaC,uBAAoBnC,EAAoBiC,CAAS;CAMtE,OAJIC,GAAaE,QAAQ,KAAKD,IACrBF,IAGF;AACT;AAEA,SAASI,GAAoCb,GAAe;CAC1D,IAAMc,IAAUf,EAAyBC,CAAK,CAAC,CAACe,KAAK;CACrD,IAAI,CAACD,GACH,OAAO;CAGT,IAAIA,EAAQT,WAAW,GAAG,GAAG;EAC3B,IAAMF,IAASzB,EAAeoC,CAAO;EACrC,IAAI,CAACX,GACH,OAAO;EAGT,IAAMa,IAAmBd,EAAeC,CAAM;EAC9C,OAA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WAAWzH,EACT,wOACAoS,KACI,uBACA,qDACJ5L,IACI,kCACAC,IACE,mBACA,+BACR;KACA,cAAYwL;KACZ,cAAc5D,MAAUA,EAAMwF,eAAe;KAC7C,SAASS;KACT,UAAU;KACA9N;eAEV,kBAAC,QAAD;MAAM,eAAY;gBACf4L,KAAgBL,KAAa;KAC1B,CAAA;IACA,CAAA,CACL;;GAEJwC,KACC,kBAAC,SAAD;IACE,UAAU;IACV,cAAa;IACb,MAAMA;IACN,eAAY;IACZ,WAAU;GAA6D,CAAA,IAEvE;GAEJ,kBAAC,OAAD;IACE,WAAU;IACV,OAAO;KACLC,eAAe5D,IAAuB,SAAS;KAC/C6D,OAAO;IACT;IACA,cAAcpG,MAAUA,EAAMwF,eAAe;cAE7C,kBAAC,GAAkB,UAAnB;KAA4B,OAAOnC;eACjC,kBAAC,IAAD;MACE,GAAI/F;MACJ,YAAYiF;MACZ,SAASzB;MACT,OAAO;MACP,YAAYnC;MACZ,QAAQhB;MACR,aAAa;MACb,cAAc;MACd,uBAAuB;MACvB,iBAAiB;MACjB,0BAA0B;MACRX;MAClB,cAAcG,OAAqBH,IAAmB,UAAU;MAChE,UAAU0D;MACV,iBAAiB7D,MAAuB;MACxC,aAAY;MACZ,mBAAmBiG;MACnB,kBACEzF,aAA2B3D,EAAiB2M;KAC7C,CAAA;IAEuB,CAAA;GACzB,CAAA;GAEJjC;EACE;;AAET,CACF;AAEA7M,EAAiB+O,cAAc"}
|
|
1
|
+
{"version":3,"file":"index362.js","names":["React","CountryCode","getCountryCallingCode","Select","Props","SelectProps","SingleValue","StylesConfig","cn","CountryOption","PhoneNumberChangeDetails","PhoneNumberInputProps","PhoneNumberSelectedCountry","resolveMessages","COMMON_IDD_PREFIXES","DEFAULT_COUNTRY","buildFallbackSelectedCountry","getCachedCountryOptions","getLocaleCacheKey","getValidCountry","normalizeSearchValue","optionMatchIndex","parseLocaleCacheKey","toSelectedCountry","formatWithAsYouType","getLengthIssue","sanitizeDigits","stripPrefix","LengthIssue","captureSelectionSnapshot","resolveSelection","skipFormattingCharactersLeft","skipFormattingCharactersRight","HiddenControl","NullComponent","SuggestionContext","SuggestionOption","formatCountryOption","suggestionSelectStyles","SuggestionContextValue","PhoneNumberInputMessages","PhoneNumberInputValidationCode","INVISIBLE_FORMATTING_CHARACTERS","ParsedInput","Omit","displayValue","lengthIssue","stripInvisibleFormatting","value","replace","stripIddPrefix","digits","prefix","startsWith","slice","length","normalizeImplicitInternationalInput","candidate","phoneNumber","detectedCountry","isValid","normalizeExplicitInternationalInput","cleaned","trim","digitsWithoutIdd","normalizeInternationalInput","explicitInternational","getDialCode","country","parsedDialCode","getInputValueForSelectedCountry","option","Pick","options","allowImplicitInternational","dialCode","normalizedInternational","normalizedDigits","currentDialCode","countryCallingCode","nationalDigits","nationalNumber","preferSelectedCountry","parsed","rawInput","parsePhoneInput","rawValue","baseCountry","formattedInternational","formattedNational","e164","shouldFormat","normalized","international","national","formatted","hasInternationalPrefix","formatInternational","formatNational","number","PhoneNumberInput","forwardRef","HTMLInputElement","props","forwardedRef","defaultCountry","countryProp","locale","onChange","onCountryChange","className","inputClassName","disabled","readOnly","selectProps","autofillShimName","messages","messagesProp","renderValidationMessage","restProps","onFocus","onInputFocus","onBlur","onInputBlur","onKeyDown","onInputKeyDown","name","inputName","autoComplete","inputAutoComplete","restInputProps","controlledCountry","localeCacheKey","localeForBuild","useMemo","resolvedMessages","countryOptions","resolveSelectedCountry","useCallback","match","find","menuPriorityCountry","some","initialStateRef","useRef","current","initialState","undefined","uncontrolledCountry","setUncontrolledCountry","useState","inputValueState","setInputValueState","countryQuery","setCountryQuery","showSuggestions","setShowSuggestions","highlightedIndex","setHighlightedIndex","isFocused","setIsFocused","shouldRenderSelect","setShouldRenderSelect","setLengthIssue","manualSelectionCountryRef","keyboardBufferRef","bufferTimeoutRef","scrollBehaviorRef","ScrollBehavior","pendingSelectionRef","start","end","hasNotifiedCountryRef","lastNotifiedCountryRef","inputRef","activeCountry","explicitFormattingCountry","useImperativeHandle","useLayoutEffect","selection","input","setSelectionRange","selectOverrides","generatedSelectInstanceId","useId","styles","userSelectStyles","components","userSelectComponents","classNamePrefix","userClassNamePrefix","formatOptionLabel","userFormatOptionLabel","menuPortalTarget","userMenuPortalTarget","menuPosition","userMenuPosition","forwardedSelectProps","instanceId","userSelectInstanceId","noOptionsMessage","restForwardedSelectProps","selectInstanceId","defaultMenuPortalTarget","setDefaultMenuPortalTarget","HTMLElement","hasUserMenuPortalTarget","mergedSelectStyles","userMenuPortal","menuPortal","provided","state","baseWithZIndex","zIndex","base","document","body","portalRect","getBoundingClientRect","left","top","portalTarget","closest","mergedSelectComponents","baseComponents","Control","IndicatorsContainer","DropdownIndicator","IndicatorSeparator","ValueContainer","overrides","Option","useEffect","window","clearTimeout","emitChange","details","selectedCountry","scheduleBufferReset","setTimeout","applyParsedInput","snapshot","ReturnType","handleInputChange","event","ChangeEvent","target","raw","normalizedExplicitInternational","manualCountry","manualDialCode","activeManualCountry","rawDigits","manualOption","handleCountrySelect","nextInputValue","requestAnimationFrame","focus","filteredOptions","results","pushUnique","existing","push","priorityOption","currentOption","query","digitQuery","normalizedQuery","forEach","dialMatches","filter","sort","a","b","aExact","bExact","nameMatches","normalizedSearchableTokens","token","includes","aIndex","bIndex","localeCompare","suggestionMenuIsOpen","highlightedOption","consumeScrollBehavior","behavior","updateHighlightedOption","index","findIndex","selectFormatOptionLabel","NonNullable","meta","optionLabelRenderer","context","inputValue","selectValue","highlightContextValue","highlightedValue","setHighlightedOption","renderOptionLabel","activeOption","activeFlag","flag","inlineFlagLabel","selectedCountryLabel","selectCountryLabel","hasInlineFlag","Boolean","lengthHint","lengthTooLong","countryName","validationNode","ReactNode","rendered","message","code","appendToBuffer","char","popBuffer","handleKeyDown","KeyboardEvent","defaultPrevented","key","metaKey","ctrlKey","altKey","currentTarget","selectionStart","selectionEnd","isCollapsedSelection","nextStart","preventDefault","repeat","next","test","toLowerCase","targetOption","handleFocus","FocusEvent","handleBlur","openCountryMenu","shimName","pointerEvents","width","noMatches","displayName"],"sources":["../src/components/PhoneNumberInput/index.tsx"],"sourcesContent":["import * as React from \"react\"\nimport type { CountryCode } from \"libphonenumber-js\"\nimport { getCountryCallingCode } from \"libphonenumber-js\"\nimport Select, {\n type Props as SelectProps,\n type SingleValue,\n type StylesConfig,\n} from \"react-select\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport type {\n CountryOption,\n PhoneNumberChangeDetails,\n PhoneNumberInputProps,\n PhoneNumberSelectedCountry,\n} from \"./types\"\nimport { resolveMessages } from \"./messages\"\nimport {\n COMMON_IDD_PREFIXES,\n DEFAULT_COUNTRY,\n buildFallbackSelectedCountry,\n getCachedCountryOptions,\n getLocaleCacheKey,\n getValidCountry,\n normalizeSearchValue,\n optionMatchIndex,\n parseLocaleCacheKey,\n toSelectedCountry,\n} from \"./country-options\"\nimport {\n formatWithAsYouType,\n getLengthIssue,\n sanitizeDigits,\n stripPrefix,\n type LengthIssue,\n} from \"./normalization\"\nimport {\n captureSelectionSnapshot,\n resolveSelection,\n skipFormattingCharactersLeft,\n skipFormattingCharactersRight,\n} from \"./selection\"\nimport {\n HiddenControl,\n NullComponent,\n SuggestionContext,\n SuggestionOption,\n formatCountryOption,\n suggestionSelectStyles,\n type SuggestionContextValue,\n} from \"./suggestions\"\n\n\nexport type {\n CountryOption,\n PhoneNumberChangeDetails,\n PhoneNumberInputMessages,\n PhoneNumberInputProps,\n PhoneNumberInputValidationCode,\n PhoneNumberSelectedCountry,\n} from \"./types\"\n\nconst INVISIBLE_FORMATTING_CHARACTERS =\n /[\\u061C\\u200B-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]/g\n\ntype ParsedInput = Omit<PhoneNumberChangeDetails, \"selectedCountry\"> & {\n displayValue: string\n lengthIssue: LengthIssue | null\n}\n\nfunction stripInvisibleFormatting(value: string) {\n return value.replace(INVISIBLE_FORMATTING_CHARACTERS, \"\")\n}\n\nfunction stripIddPrefix(digits: string) {\n for (const prefix of COMMON_IDD_PREFIXES) {\n if (digits.startsWith(prefix)) {\n return digits.slice(prefix.length)\n }\n }\n return digits\n}\n\nfunction normalizeImplicitInternationalInput(digits: string) {\n const candidate = `+${digits}`\n const { phoneNumber, detectedCountry } = formatWithAsYouType(candidate)\n\n if (phoneNumber?.isValid() && detectedCountry) {\n return candidate\n }\n\n return null\n}\n\nfunction normalizeExplicitInternationalInput(value: string) {\n const cleaned = stripInvisibleFormatting(value).trim()\n if (!cleaned) {\n return null\n }\n\n if (cleaned.startsWith(\"+\")) {\n const digits = sanitizeDigits(cleaned)\n if (!digits) {\n return \"+\"\n }\n\n const digitsWithoutIdd = stripIddPrefix(digits)\n return digitsWithoutIdd ? `+${digitsWithoutIdd}` : \"+\"\n }\n\n const digits = sanitizeDigits(cleaned)\n if (!digits) {\n return null\n }\n\n const digitsWithoutIdd = stripIddPrefix(digits)\n if (digitsWithoutIdd !== digits) {\n return digitsWithoutIdd ? `+${digitsWithoutIdd}` : \"+\"\n }\n\n return null\n}\n\nfunction normalizeInternationalInput(value: string) {\n const explicitInternational = normalizeExplicitInternationalInput(value)\n if (explicitInternational != null) {\n return explicitInternational\n }\n\n const cleaned = stripInvisibleFormatting(value).trim()\n const digits = sanitizeDigits(cleaned)\n if (!digits) {\n return null\n }\n\n return normalizeImplicitInternationalInput(digits)\n}\n\nfunction getDialCode(country: CountryCode | null, parsedDialCode: string | undefined) {\n if (parsedDialCode) {\n return parsedDialCode\n }\n return country ? getCountryCallingCode(country) : null\n}\n\nfunction getInputValueForSelectedCountry(\n value: string,\n option: Pick<CountryOption, \"dialCode\" | \"value\">,\n options?: { allowImplicitInternational?: boolean }\n) {\n const cleaned = stripInvisibleFormatting(value).trim()\n const digits = sanitizeDigits(cleaned)\n\n if (!digits) {\n return `+${option.dialCode}`\n }\n\n const normalizedInternational =\n options?.allowImplicitInternational === false\n ? normalizeExplicitInternationalInput(cleaned)\n : normalizeInternationalInput(cleaned)\n if (normalizedInternational) {\n const normalizedDigits = sanitizeDigits(normalizedInternational)\n if (normalizedDigits.startsWith(option.dialCode)) {\n return normalizedInternational\n }\n\n const { phoneNumber } = formatWithAsYouType(normalizedInternational)\n const currentDialCode = phoneNumber?.countryCallingCode\n const nationalDigits =\n currentDialCode && normalizedDigits.startsWith(currentDialCode)\n ? normalizedDigits.slice(currentDialCode.length)\n : phoneNumber?.nationalNumber ?? normalizedDigits\n\n return `+${option.dialCode}${nationalDigits}`\n }\n\n const { phoneNumber } = formatWithAsYouType(cleaned, option.value)\n return `+${option.dialCode}${phoneNumber?.nationalNumber ?? digits}`\n}\n\nfunction preferSelectedCountry(\n parsed: ParsedInput,\n option: Pick<CountryOption, \"dialCode\" | \"value\">\n): ParsedInput {\n return {\n ...parsed,\n country: option.value,\n countryCallingCode: option.dialCode,\n lengthIssue: getLengthIssue(parsed.rawInput, option.value),\n }\n}\n\nfunction parsePhoneInput(rawValue: string | undefined, baseCountry?: CountryCode): ParsedInput {\n const cleaned = stripInvisibleFormatting(rawValue ?? \"\").trim()\n\n if (!cleaned) {\n const country = baseCountry ?? null\n const countryCallingCode = country ? getCountryCallingCode(country) : null\n\n return {\n displayValue: \"\",\n formattedInternational: \"\",\n formattedNational: \"\",\n e164: null,\n country,\n countryCallingCode,\n nationalNumber: \"\",\n rawInput: \"\",\n isValid: false,\n lengthIssue: null,\n }\n }\n\n const normalizedInternational = normalizeInternationalInput(cleaned)\n const shouldFormat = normalizedInternational != null || baseCountry != null\n\n if (!shouldFormat) {\n return {\n displayValue: cleaned,\n formattedInternational: cleaned,\n formattedNational: cleaned,\n e164: null,\n country: null,\n countryCallingCode: null,\n nationalNumber: sanitizeDigits(cleaned),\n rawInput: cleaned,\n isValid: false,\n lengthIssue: null,\n }\n }\n\n const normalized = normalizedInternational ?? cleaned\n const {\n international,\n national,\n formatted,\n phoneNumber,\n detectedCountry,\n } = formatWithAsYouType(normalized, baseCountry)\n const hasInternationalPrefix = normalizedInternational != null\n const country = hasInternationalPrefix\n ? detectedCountry ?? baseCountry ?? null\n : baseCountry ?? detectedCountry ?? null\n const countryCallingCode = getDialCode(country, phoneNumber?.countryCallingCode)\n const normalizedDigits = sanitizeDigits(normalized)\n const nationalNumber =\n phoneNumber?.nationalNumber ??\n (countryCallingCode && normalized.startsWith(\"+\")\n ? stripPrefix(normalizedDigits, countryCallingCode)\n : sanitizeDigits(cleaned))\n const displayValue = hasInternationalPrefix ? international : formatted\n\n return {\n displayValue,\n formattedInternational: phoneNumber?.formatInternational() ?? international,\n formattedNational: phoneNumber?.formatNational() ?? national,\n e164: phoneNumber?.number ?? null,\n country,\n countryCallingCode,\n nationalNumber,\n rawInput: normalized,\n isValid: phoneNumber?.isValid() ?? false,\n lengthIssue: country ? getLengthIssue(normalized, country) : null,\n }\n}\n\nexport const PhoneNumberInput = React.forwardRef<HTMLInputElement, PhoneNumberInputProps>(\n function PhoneNumberInput(props, forwardedRef) {\n const {\n value,\n defaultCountry,\n country: countryProp,\n locale,\n onChange,\n onCountryChange,\n className,\n inputClassName,\n disabled,\n readOnly,\n selectProps,\n autofillShimName,\n messages: messagesProp,\n renderValidationMessage,\n ...restProps\n } = props\n\n const {\n onFocus: onInputFocus,\n onBlur: onInputBlur,\n onKeyDown: onInputKeyDown,\n name: inputName,\n autoComplete: inputAutoComplete,\n ...restInputProps\n } = restProps\n\n const controlledCountry = typeof countryProp === \"string\" ? countryProp : null\n const localeCacheKey = getLocaleCacheKey(locale)\n const localeForBuild = React.useMemo(\n () => parseLocaleCacheKey(localeCacheKey),\n [localeCacheKey]\n )\n const resolvedMessages = React.useMemo(\n () => resolveMessages(localeForBuild, messagesProp),\n [localeForBuild, messagesProp]\n )\n const countryOptions = React.useMemo(\n () => getCachedCountryOptions(localeForBuild, localeCacheKey),\n [localeCacheKey, localeForBuild]\n )\n const resolveSelectedCountry = React.useCallback(\n (country: CountryCode): PhoneNumberSelectedCountry => {\n const match = countryOptions.find((candidate) => candidate.value === country)\n if (match) {\n return toSelectedCountry(match)\n }\n return buildFallbackSelectedCountry(country)\n },\n [countryOptions]\n )\n const menuPriorityCountry = React.useMemo(() => {\n const candidate = getValidCountry(defaultCountry ?? countryProp ?? DEFAULT_COUNTRY)\n if (countryOptions.some((option) => option.value === candidate)) {\n return candidate\n }\n return countryOptions[0]?.value ?? DEFAULT_COUNTRY\n }, [countryOptions, countryProp, defaultCountry])\n\n const initialStateRef = React.useRef<ParsedInput | null>(null)\n\n if (!initialStateRef.current) {\n const initialState = parsePhoneInput(value, controlledCountry ?? undefined)\n initialStateRef.current = initialState\n }\n\n const initialState = initialStateRef.current\n\n const [uncontrolledCountry, setUncontrolledCountry] = React.useState<CountryCode | null>(\n controlledCountry ? null : initialState.country\n )\n const [inputValueState, setInputValueState] = React.useState(initialState.displayValue)\n const [countryQuery, setCountryQuery] = React.useState(\"\")\n const [showSuggestions, setShowSuggestions] = React.useState(false)\n const [highlightedIndex, setHighlightedIndex] = React.useState<number>(-1)\n const [isFocused, setIsFocused] = React.useState(false)\n const [shouldRenderSelect, setShouldRenderSelect] = React.useState(false)\n const [lengthIssue, setLengthIssue] = React.useState<LengthIssue | null>(\n initialState.lengthIssue\n )\n\n const manualSelectionCountryRef = React.useRef<CountryCode | null>(null)\n const keyboardBufferRef = React.useRef(\"\")\n const bufferTimeoutRef = React.useRef<number | null>(null)\n const scrollBehaviorRef = React.useRef<ScrollBehavior>(\"smooth\")\n const pendingSelectionRef = React.useRef<{ start: number; end: number } | null>(null)\n const hasNotifiedCountryRef = React.useRef(false)\n const lastNotifiedCountryRef = React.useRef<CountryCode | null>(null)\n const inputRef = React.useRef<HTMLInputElement | null>(null)\n\n const activeCountry = controlledCountry ?? uncontrolledCountry\n const explicitFormattingCountry = controlledCountry ?? manualSelectionCountryRef.current ?? undefined\n\n React.useImperativeHandle(forwardedRef, () => inputRef.current as HTMLInputElement, [])\n\n React.useLayoutEffect(() => {\n setShouldRenderSelect(true)\n }, [])\n\n React.useLayoutEffect(() => {\n const selection = pendingSelectionRef.current\n if (!selection) {\n return\n }\n\n const input = inputRef.current\n pendingSelectionRef.current = null\n if (!input) {\n return\n }\n\n const { start, end } = selection\n input.setSelectionRange(start, end)\n }, [inputValueState])\n\n const selectOverrides = selectProps ?? {}\n const generatedSelectInstanceId = React.useId()\n const {\n styles: userSelectStyles,\n components: userSelectComponents,\n classNamePrefix: userClassNamePrefix,\n formatOptionLabel: userFormatOptionLabel,\n menuPortalTarget: userMenuPortalTarget,\n menuPosition: userMenuPosition,\n ...forwardedSelectProps\n } = selectOverrides\n const {\n instanceId: userSelectInstanceId,\n noOptionsMessage,\n ...restForwardedSelectProps\n } = forwardedSelectProps\n const selectInstanceId = userSelectInstanceId ?? generatedSelectInstanceId\n const [defaultMenuPortalTarget, setDefaultMenuPortalTarget] =\n React.useState<HTMLElement | null>(null)\n const hasUserMenuPortalTarget = \"menuPortalTarget\" in selectOverrides\n const menuPortalTarget = hasUserMenuPortalTarget\n ? userMenuPortalTarget\n : defaultMenuPortalTarget\n\n const mergedSelectStyles = React.useMemo<StylesConfig<CountryOption, false>>(\n () => {\n const userMenuPortal = userSelectStyles?.menuPortal\n\n return {\n ...suggestionSelectStyles,\n ...(userSelectStyles ?? {}),\n menuPortal: (provided, state) => {\n const baseWithZIndex = {\n ...provided,\n zIndex: 1300,\n }\n const base = userMenuPortal ? userMenuPortal(baseWithZIndex, state) : baseWithZIndex\n\n if (typeof document === \"undefined\" || !menuPortalTarget || menuPortalTarget === document.body) {\n return base\n }\n\n const portalRect = menuPortalTarget.getBoundingClientRect()\n return {\n ...base,\n left: typeof base.left === \"number\" ? base.left - portalRect.left : base.left,\n top: typeof base.top === \"number\" ? base.top - portalRect.top : base.top,\n }\n },\n }\n },\n [menuPortalTarget, userSelectStyles]\n )\n\n React.useLayoutEffect(() => {\n if (hasUserMenuPortalTarget || typeof document === \"undefined\") {\n return\n }\n\n const portalTarget =\n inputRef.current?.closest<HTMLElement>(\n \"[data-slot='dialog-content'], [data-slot='sheet-content'], [role='dialog']\"\n ) ?? document.body\n setDefaultMenuPortalTarget(portalTarget)\n }, [hasUserMenuPortalTarget])\n\n const mergedSelectComponents = React.useMemo(() => {\n const baseComponents = {\n Control: HiddenControl,\n IndicatorsContainer: NullComponent,\n DropdownIndicator: NullComponent,\n IndicatorSeparator: NullComponent,\n ValueContainer: NullComponent,\n }\n\n const overrides = userSelectComponents ?? {}\n\n if (!overrides.Option) {\n return {\n ...baseComponents,\n ...overrides,\n Option: SuggestionOption,\n }\n }\n\n return {\n ...baseComponents,\n ...overrides,\n }\n }, [userSelectComponents])\n\n React.useEffect(() => () => {\n if (bufferTimeoutRef.current != null && typeof window !== \"undefined\") {\n window.clearTimeout(bufferTimeoutRef.current)\n }\n }, [])\n\n React.useEffect(() => {\n if (value == null) {\n return\n }\n\n const parsed = parsePhoneInput(value, explicitFormattingCountry)\n keyboardBufferRef.current = \"\"\n\n setInputValueState(parsed.displayValue)\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setHighlightedIndex(-1)\n setLengthIssue(parsed.lengthIssue)\n\n if (!controlledCountry && parsed.country !== uncontrolledCountry) {\n setUncontrolledCountry(parsed.country)\n }\n }, [controlledCountry, explicitFormattingCountry, uncontrolledCountry, value])\n\n React.useEffect(() => {\n const country = activeCountry ?? null\n if (!hasNotifiedCountryRef.current && country == null) {\n return\n }\n\n if (hasNotifiedCountryRef.current && lastNotifiedCountryRef.current === country) {\n return\n }\n\n hasNotifiedCountryRef.current = true\n lastNotifiedCountryRef.current = country\n onCountryChange?.(country, country ? resolveSelectedCountry(country) : null)\n }, [activeCountry, onCountryChange, resolveSelectedCountry])\n\n const emitChange = React.useCallback(\n (details: Omit<PhoneNumberChangeDetails, \"selectedCountry\">) => {\n onChange?.({\n ...details,\n selectedCountry: details.country ? resolveSelectedCountry(details.country) : null,\n })\n },\n [onChange, resolveSelectedCountry]\n )\n\n const scheduleBufferReset = React.useCallback(() => {\n if (typeof window === \"undefined\") {\n return\n }\n\n if (bufferTimeoutRef.current != null) {\n window.clearTimeout(bufferTimeoutRef.current)\n }\n\n bufferTimeoutRef.current = window.setTimeout(() => {\n keyboardBufferRef.current = \"\"\n bufferTimeoutRef.current = null\n }, 800)\n }, [])\n\n const applyParsedInput = React.useCallback(\n (parsed: ParsedInput, snapshot: ReturnType<typeof captureSelectionSnapshot> | null) => {\n setInputValueState(parsed.displayValue)\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setHighlightedIndex(-1)\n setLengthIssue(parsed.lengthIssue)\n\n if (!controlledCountry && parsed.country !== uncontrolledCountry) {\n setUncontrolledCountry(parsed.country)\n }\n\n if (snapshot) {\n pendingSelectionRef.current = resolveSelection(snapshot, parsed.displayValue)\n }\n\n emitChange({\n formattedInternational: parsed.formattedInternational,\n formattedNational: parsed.formattedNational,\n e164: parsed.e164,\n country: parsed.country,\n countryCallingCode: parsed.countryCallingCode,\n nationalNumber: parsed.nationalNumber,\n rawInput: parsed.rawInput,\n isValid: parsed.isValid,\n })\n },\n [controlledCountry, emitChange, uncontrolledCountry]\n )\n\n const handleInputChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const target = event.target\n const snapshot = captureSelectionSnapshot(target)\n const raw = target.value\n keyboardBufferRef.current = \"\"\n\n const normalizedExplicitInternational = normalizeExplicitInternationalInput(raw)\n const manualCountry = manualSelectionCountryRef.current\n if (normalizedExplicitInternational != null && manualCountry) {\n const manualDialCode = getCountryCallingCode(manualCountry)\n if (!sanitizeDigits(normalizedExplicitInternational).startsWith(manualDialCode)) {\n manualSelectionCountryRef.current = null\n }\n } else if (normalizedExplicitInternational != null) {\n manualSelectionCountryRef.current = null\n }\n\n const activeManualCountry = manualSelectionCountryRef.current\n const rawDigits = sanitizeDigits(raw)\n if (\n !controlledCountry &&\n activeManualCountry &&\n normalizedExplicitInternational == null &&\n rawDigits\n ) {\n const manualOption = {\n value: activeManualCountry,\n dialCode: getCountryCallingCode(activeManualCountry),\n }\n const parsed = preferSelectedCountry(\n parsePhoneInput(\n getInputValueForSelectedCountry(\n raw,\n {\n value: manualOption.value,\n dialCode: manualOption.dialCode,\n },\n { allowImplicitInternational: false }\n ),\n activeManualCountry\n ),\n manualOption\n )\n applyParsedInput(parsed, snapshot)\n return\n }\n\n const baseCountry = controlledCountry ?? activeManualCountry ?? undefined\n const parsed = parsePhoneInput(raw, baseCountry)\n applyParsedInput(parsed, snapshot)\n },\n [applyParsedInput, controlledCountry]\n )\n\n const handleCountrySelect = React.useCallback(\n (option: SingleValue<CountryOption>) => {\n if (!option) {\n return\n }\n\n manualSelectionCountryRef.current = option.value\n const nextInputValue = getInputValueForSelectedCountry(inputValueState, option)\n const parsed = preferSelectedCountry(\n parsePhoneInput(nextInputValue, option.value),\n option\n )\n\n setInputValueState(parsed.displayValue)\n pendingSelectionRef.current = {\n start: parsed.displayValue.length,\n end: parsed.displayValue.length,\n }\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setHighlightedIndex(-1)\n setLengthIssue(parsed.lengthIssue)\n\n if (!controlledCountry) {\n setUncontrolledCountry(option.value)\n }\n\n emitChange({\n formattedInternational: parsed.formattedInternational,\n formattedNational: parsed.formattedNational,\n e164: parsed.e164,\n country: parsed.country,\n countryCallingCode: parsed.countryCallingCode,\n nationalNumber: parsed.nationalNumber,\n rawInput: parsed.rawInput,\n isValid: parsed.isValid,\n })\n\n requestAnimationFrame(() => {\n inputRef.current?.focus()\n })\n },\n [controlledCountry, emitChange, inputValueState]\n )\n\n const filteredOptions = React.useMemo(() => {\n if (!showSuggestions) {\n return [] as CountryOption[]\n }\n\n const results: CountryOption[] = []\n\n const pushUnique = (option: CountryOption | undefined) => {\n if (option && !results.some((existing) => existing.value === option.value)) {\n results.push(option)\n }\n }\n\n const priorityOption = countryOptions.find((option) => option.value === menuPriorityCountry)\n const currentOption = activeCountry\n ? countryOptions.find((option) => option.value === activeCountry)\n : undefined\n const query = countryQuery.trim()\n const digitQuery = sanitizeDigits(query)\n const normalizedQuery = normalizeSearchValue(query)\n\n if (!digitQuery && !normalizedQuery) {\n pushUnique(currentOption)\n pushUnique(priorityOption)\n countryOptions.forEach(pushUnique)\n return results\n }\n\n if (digitQuery) {\n const dialMatches = countryOptions\n .filter((option) => option.dialCode.startsWith(digitQuery))\n .sort((a, b) => {\n const aExact = a.dialCode === digitQuery\n const bExact = b.dialCode === digitQuery\n if (aExact && !bExact) {\n return -1\n }\n if (!aExact && bExact) {\n return 1\n }\n return a.dialCode.length - b.dialCode.length\n })\n dialMatches.forEach(pushUnique)\n }\n\n if (normalizedQuery) {\n const nameMatches = countryOptions\n .filter((option) =>\n option.normalizedSearchableTokens.some((token) => token.includes(normalizedQuery))\n )\n .sort((a, b) => {\n const aIndex = optionMatchIndex(a.normalizedSearchableTokens, normalizedQuery)\n const bIndex = optionMatchIndex(b.normalizedSearchableTokens, normalizedQuery)\n if (aIndex !== bIndex) {\n return aIndex - bIndex\n }\n return a.name.localeCompare(b.name)\n })\n nameMatches.forEach(pushUnique)\n }\n\n pushUnique(currentOption)\n pushUnique(priorityOption)\n if (results.length === 0) {\n countryOptions.forEach(pushUnique)\n }\n\n return results\n }, [activeCountry, countryOptions, countryQuery, menuPriorityCountry, showSuggestions])\n\n const suggestionMenuIsOpen = isFocused && showSuggestions && filteredOptions.length > 0\n\n React.useEffect(() => {\n if (!suggestionMenuIsOpen) {\n scrollBehaviorRef.current = \"smooth\"\n }\n }, [suggestionMenuIsOpen])\n\n React.useEffect(() => {\n if (!suggestionMenuIsOpen) {\n setHighlightedIndex(-1)\n return\n }\n\n if (filteredOptions.length === 0) {\n setHighlightedIndex(-1)\n return\n }\n\n setHighlightedIndex((current) => {\n if (current < 0 || current >= filteredOptions.length) {\n return 0\n }\n return current\n })\n }, [filteredOptions, suggestionMenuIsOpen])\n\n const highlightedOption =\n highlightedIndex >= 0 ? filteredOptions[highlightedIndex] ?? null : null\n\n React.useEffect(() => {\n if (highlightedIndex < 0) {\n scrollBehaviorRef.current = \"smooth\"\n }\n }, [highlightedIndex])\n\n const consumeScrollBehavior = React.useCallback(() => {\n const behavior = scrollBehaviorRef.current\n scrollBehaviorRef.current = \"smooth\"\n return behavior\n }, [])\n\n const updateHighlightedOption = React.useCallback(\n (option: CountryOption) => {\n const index = filteredOptions.findIndex((candidate) => candidate.value === option.value)\n if (index !== -1) {\n setHighlightedIndex(index)\n }\n },\n [filteredOptions]\n )\n\n const selectFormatOptionLabel = React.useCallback<\n NonNullable<SelectProps<CountryOption, false>[\"formatOptionLabel\"]>\n >(\n (option, meta) => {\n if (userFormatOptionLabel) {\n return userFormatOptionLabel(option, meta)\n }\n return formatCountryOption(option)\n },\n [userFormatOptionLabel]\n )\n\n const optionLabelRenderer = React.useCallback(\n (option: CountryOption) =>\n selectFormatOptionLabel(option, {\n context: \"menu\",\n inputValue: countryQuery,\n selectValue: [],\n }),\n [countryQuery, selectFormatOptionLabel]\n )\n\n const highlightContextValue = React.useMemo<SuggestionContextValue>(\n () => ({\n highlightedValue: highlightedOption?.value ?? null,\n setHighlightedOption: updateHighlightedOption,\n renderOptionLabel: optionLabelRenderer,\n consumeScrollBehavior,\n }),\n [consumeScrollBehavior, highlightedOption, optionLabelRenderer, updateHighlightedOption]\n )\n\n const activeOption = activeCountry\n ? countryOptions.find((option) => option.value === activeCountry)\n : undefined\n const activeFlag = activeOption?.flag ?? \"\"\n const inlineFlagLabel = activeCountry\n ? resolvedMessages.selectedCountryLabel(activeOption?.name ?? activeCountry)\n : resolvedMessages.selectCountryLabel\n const hasInlineFlag = Boolean(activeCountry && activeFlag)\n const lengthHint =\n lengthIssue === \"TOO_LONG\"\n ? resolvedMessages.lengthTooLong(activeOption?.name ?? activeCountry ?? null)\n : null\n const countryName = activeOption?.name ?? activeCountry ?? null\n\n let validationNode: React.ReactNode = null\n if (lengthHint) {\n const rendered = renderValidationMessage?.({\n message: lengthHint,\n code: \"TOO_LONG\",\n countryName,\n })\n validationNode =\n rendered === undefined ? (\n <p className=\"mt-1 text-xs text-destructive\">\n <span>{lengthHint}</span>\n </p>\n ) : (\n rendered\n )\n }\n\n const appendToBuffer = React.useCallback(\n (char: string) => {\n keyboardBufferRef.current = `${keyboardBufferRef.current}${char}`.slice(-12)\n setCountryQuery(keyboardBufferRef.current)\n setShowSuggestions(true)\n scheduleBufferReset()\n },\n [scheduleBufferReset]\n )\n\n const popBuffer = React.useCallback(() => {\n const current = keyboardBufferRef.current\n if (!current) {\n return\n }\n keyboardBufferRef.current = current.slice(0, -1)\n setCountryQuery(keyboardBufferRef.current)\n if (keyboardBufferRef.current) {\n scheduleBufferReset()\n }\n }, [scheduleBufferReset])\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n onInputKeyDown?.(event)\n if (event.defaultPrevented) {\n return\n }\n\n const key = event.key\n\n if (event.metaKey || event.ctrlKey || event.altKey) {\n return\n }\n\n const target = event.currentTarget\n const value = target.value\n const selectionStart = target.selectionStart ?? 0\n const selectionEnd = target.selectionEnd ?? selectionStart\n const isCollapsedSelection = selectionStart === selectionEnd\n\n if (key === \"Backspace\" && isCollapsedSelection) {\n const nextStart = skipFormattingCharactersLeft(value, selectionStart)\n if (nextStart !== selectionStart) {\n target.setSelectionRange(nextStart, nextStart)\n }\n } else if (key === \"ArrowLeft\" && isCollapsedSelection) {\n const nextStart = skipFormattingCharactersLeft(value, selectionStart)\n if (nextStart !== selectionStart) {\n event.preventDefault()\n target.setSelectionRange(nextStart, nextStart)\n return\n }\n } else if (key === \"ArrowRight\" && isCollapsedSelection) {\n const nextStart = skipFormattingCharactersRight(value, selectionEnd)\n if (nextStart !== selectionEnd) {\n event.preventDefault()\n target.setSelectionRange(nextStart, nextStart)\n return\n }\n }\n\n if (key === \"ArrowDown\") {\n scrollBehaviorRef.current = event.repeat ? \"auto\" : \"smooth\"\n event.preventDefault()\n if (!showSuggestions) {\n setShowSuggestions(true)\n setHighlightedIndex(filteredOptions.length > 0 ? 0 : -1)\n return\n }\n\n if (filteredOptions.length > 0) {\n setHighlightedIndex((current) => {\n const next = current < 0 ? 0 : (current + 1) % filteredOptions.length\n return next\n })\n }\n return\n }\n\n if (key === \"ArrowUp\") {\n scrollBehaviorRef.current = event.repeat ? \"auto\" : \"smooth\"\n event.preventDefault()\n if (!showSuggestions) {\n setShowSuggestions(true)\n setHighlightedIndex(filteredOptions.length > 0 ? filteredOptions.length - 1 : -1)\n return\n }\n\n if (filteredOptions.length > 0) {\n setHighlightedIndex((current) => {\n if (current < 0) {\n return filteredOptions.length - 1\n }\n return (current - 1 + filteredOptions.length) % filteredOptions.length\n })\n }\n return\n }\n\n if (/^[a-z]$/i.test(key)) {\n event.preventDefault()\n if (!showSuggestions) {\n setShowSuggestions(true)\n setHighlightedIndex(filteredOptions.length > 0 ? 0 : -1)\n }\n appendToBuffer(key.toLowerCase())\n return\n }\n\n if (suggestionMenuIsOpen) {\n if (key === \"Backspace\" && keyboardBufferRef.current) {\n event.preventDefault()\n popBuffer()\n return\n }\n\n if (key === \"Escape\") {\n event.preventDefault()\n keyboardBufferRef.current = \"\"\n setCountryQuery(\"\")\n setShowSuggestions(false)\n return\n }\n\n if (key === \"Enter\" && filteredOptions.length > 0) {\n event.preventDefault()\n const targetOption = highlightedOption ?? filteredOptions[0]\n handleCountrySelect(targetOption)\n return\n }\n }\n },\n [\n appendToBuffer,\n filteredOptions,\n handleCountrySelect,\n highlightedOption,\n onInputKeyDown,\n popBuffer,\n showSuggestions,\n suggestionMenuIsOpen,\n ]\n )\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(true)\n onInputFocus?.(event)\n },\n [onInputFocus]\n )\n\n const handleBlur = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(false)\n setShowSuggestions(false)\n keyboardBufferRef.current = \"\"\n setCountryQuery(\"\")\n onInputBlur?.(event)\n },\n [onInputBlur]\n )\n\n const openCountryMenu = React.useCallback(() => {\n if (disabled || readOnly) {\n return\n }\n\n keyboardBufferRef.current = \"\"\n setCountryQuery(\"\")\n setShowSuggestions(true)\n setHighlightedIndex((current) => (current < 0 ? 0 : current))\n\n requestAnimationFrame(() => {\n inputRef.current?.focus()\n })\n }, [disabled, readOnly])\n\n const shimName = autofillShimName ?? (inputName ? `${inputName}_shim` : undefined)\n\n return (\n <div className={cn(\"relative flex flex-col\", className)}>\n <div className=\"relative\">\n <input\n {...restInputProps}\n ref={inputRef}\n type=\"tel\"\n className={cn(\n \"flex h-10 w-full rounded-md border border-input bg-background py-2 text-base ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n \"pl-11 pr-3\",\n inputClassName\n )}\n name={inputName}\n value={inputValueState}\n onChange={handleInputChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n disabled={disabled}\n readOnly={readOnly}\n autoComplete={inputAutoComplete ?? \"off\"}\n />\n <button\n type=\"button\"\n className={cn(\n \"absolute left-3 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded border text-lg leading-none transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n hasInlineFlag\n ? \"border-transparent\"\n : \"border-dashed border-border text-muted-foreground\",\n disabled\n ? \"cursor-not-allowed opacity-50\"\n : readOnly\n ? \"cursor-default\"\n : \"cursor-pointer hover:bg-muted\"\n )}\n aria-label={inlineFlagLabel}\n onMouseDown={(event) => event.preventDefault()}\n onClick={openCountryMenu}\n tabIndex={-1}\n disabled={disabled}\n >\n <span aria-hidden=\"true\">\n {hasInlineFlag ? activeFlag : \"?\"}\n </span>\n </button>\n </div>\n\n {shimName ? (\n <input\n tabIndex={-1}\n autoComplete=\"tel\"\n name={shimName}\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute left-0 top-0 h-0 w-0 opacity-0\"\n />\n ) : null}\n\n <div\n className=\"absolute left-0 top-full z-30 mt-1\"\n style={{\n pointerEvents: suggestionMenuIsOpen ? \"auto\" : \"none\",\n width: \"min(260px, 100%)\",\n }}\n onMouseDown={(event) => event.preventDefault()}\n >\n {shouldRenderSelect ? (\n <SuggestionContext.Provider value={highlightContextValue}>\n <Select<CountryOption, false>\n {...restForwardedSelectProps}\n instanceId={selectInstanceId}\n menuIsOpen={suggestionMenuIsOpen}\n options={filteredOptions}\n value={null}\n components={mergedSelectComponents}\n styles={mergedSelectStyles}\n isClearable={false}\n isSearchable={false}\n backspaceRemovesValue={false}\n tabSelectsValue={false}\n menuShouldScrollIntoView={false}\n menuPortalTarget={menuPortalTarget}\n menuPosition={userMenuPosition ?? (menuPortalTarget ? \"fixed\" : \"absolute\")}\n onChange={handleCountrySelect}\n classNamePrefix={userClassNamePrefix ?? \"phone-number-suggestions\"}\n placeholder=\"\"\n formatOptionLabel={selectFormatOptionLabel}\n noOptionsMessage={\n noOptionsMessage ?? (() => resolvedMessages.noMatches)\n }\n />\n </SuggestionContext.Provider>\n ) : null}\n </div>\n\n {validationNode}\n </div>\n )\n }\n)\n\nPhoneNumberInput.displayName = \"PhoneNumberInput\"\n"],"mappings":";;;;;;;;;;;AA+DA,IAAM0C,IACJ;AAOF,SAASK,EAAyBC,GAAe;CAC/C,OAAOA,EAAMC,QAAQP,GAAiC,EAAE;AAC1D;AAEA,SAASQ,EAAeC,GAAgB;CACtC,KAAK,IAAMC,KAAUtC,GACnB,IAAIqC,EAAOE,WAAWD,CAAM,GAC1B,OAAOD,EAAOG,MAAMF,EAAOG,MAAM;CAGrC,OAAOJ;AACT;AAEA,SAASK,GAAoCL,GAAgB;CAC3D,IAAMM,IAAY,IAAIN,KAChB,EAAEO,gBAAaC,uBAAoBnC,EAAoBiC,CAAS;CAMtE,OAJIC,GAAaE,QAAQ,KAAKD,IACrBF,IAGF;AACT;AAEA,SAASI,GAAoCb,GAAe;CAC1D,IAAMc,IAAUf,EAAyBC,CAAK,CAAC,CAACe,KAAK;CACrD,IAAI,CAACD,GACH,OAAO;CAGT,IAAIA,EAAQT,WAAW,GAAG,GAAG;EAC3B,IAAMF,IAASzB,EAAeoC,C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React from "react";
|
|
2
2
|
type RenderProp = React.ReactElement | ((props: any, state: any) => React.ReactElement);
|
|
3
|
-
export declare function renderAsChild(asChild: boolean | undefined, render: RenderProp | undefined, children: React.ReactNode):
|
|
3
|
+
export declare function renderAsChild(asChild: boolean | undefined, render: RenderProp | undefined, children: React.ReactNode): RenderProp | undefined;
|
|
4
4
|
export {};
|
|
5
5
|
//# sourceMappingURL=render-as-child.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-as-child.d.ts","sourceRoot":"","sources":["../../src/lib/render-as-child.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,KAAK,UAAU,GAAG,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,KAAK,KAAK,CAAC,YAAY,CAAC,CAAA;AAEvF,wBAAgB,aAAa,CAC3B,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"render-as-child.d.ts","sourceRoot":"","sources":["../../src/lib/render-as-child.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,KAAK,UAAU,GAAG,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,KAAK,KAAK,CAAC,YAAY,CAAC,CAAA;AAEvF,wBAAgB,aAAa,CAC3B,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,0BAI1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.260.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -125,6 +125,7 @@
|
|
|
125
125
|
"tailwind-merge": "3.6.0",
|
|
126
126
|
"tailwindcss": "4.3.3",
|
|
127
127
|
"tw-animate-css": "1.4.0",
|
|
128
|
+
"typescript": "7.0.2",
|
|
128
129
|
"vite": "8.1.5",
|
|
129
130
|
"vite-bundle-analyzer": "1.3.8",
|
|
130
131
|
"vitest": "4.1.9"
|