@rpcbase/ui 0.206.0 → 0.208.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/index.js +7 -7
- package/dist/index19.js +1 -1
- package/dist/index19.js.map +1 -1
- package/dist/index200.js +56 -55
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +60 -8
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +7 -15
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +15 -143
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +145 -4
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +4 -11
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +10 -104
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +94 -347
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +349 -87
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +73 -304
- package/dist/index209.js.map +1 -1
- package/dist/index210.js +309 -193
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +211 -19
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +18 -27
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +27 -187
- package/dist/index213.js.map +1 -1
- package/dist/index214.js +186 -16
- package/dist/index214.js.map +1 -1
- package/dist/index215.js +18 -44
- package/dist/index215.js.map +1 -1
- package/dist/index216.js +60 -8
- package/dist/index216.js.map +1 -1
- package/dist/index217.js +42 -23
- package/dist/index217.js.map +1 -1
- package/dist/index218.js +9 -44
- package/dist/index218.js.map +1 -1
- package/dist/index219.js +25 -18
- package/dist/index219.js.map +1 -1
- package/dist/index220.js +45 -3
- package/dist/index220.js.map +1 -1
- package/dist/index221.js +17 -4
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +3 -21
- package/dist/index222.js.map +1 -1
- package/dist/index223.js +4 -24
- package/dist/index223.js.map +1 -1
- package/dist/index224.js +17 -64
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +23 -13
- package/dist/index225.js.map +1 -1
- package/dist/index226.js +68 -4
- package/dist/index226.js.map +1 -1
- package/dist/index227.js +14 -50
- package/dist/index227.js.map +1 -1
- package/dist/index228.js +4 -6
- package/dist/index228.js.map +1 -1
- package/dist/index229.js +50 -26
- package/dist/index229.js.map +1 -1
- package/dist/index230.js +5 -13
- package/dist/index230.js.map +1 -1
- package/dist/index231.js +25 -8
- package/dist/index231.js.map +1 -1
- package/dist/index232.js +17 -3
- package/dist/index232.js.map +1 -0
- package/dist/index233.js +8 -24
- package/dist/index233.js.map +1 -1
- package/dist/index234.js +2 -71
- package/dist/index235.js +29 -3
- package/dist/index235.js.map +1 -0
- package/dist/index236.js +69 -12
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +3 -54
- package/dist/index238.js +11 -114
- package/dist/index238.js.map +1 -1
- package/dist/index239.js +51 -6
- package/dist/index239.js.map +1 -1
- package/dist/index240.js +115 -13
- package/dist/index240.js.map +1 -1
- package/dist/index241.js +6 -687
- package/dist/index241.js.map +1 -1
- package/dist/index242.js +13 -253
- package/dist/index242.js.map +1 -1
- package/dist/index243.js +662 -676
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +252 -7430
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +700 -6
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +7429 -11
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +5 -4
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +11 -458
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +5 -37
- package/dist/index249.js.map +1 -1
- package/dist/index250.js +458 -18
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +34 -24
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +19 -4
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +23 -54
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +4 -7
- package/dist/index254.js.map +1 -1
- package/dist/index255.js +57 -11
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +8 -3
- package/dist/index256.js.map +1 -1
- package/dist/index257.js +12 -16
- package/dist/index257.js.map +1 -1
- package/dist/index258.js +3 -26
- package/dist/index258.js.map +1 -1
- package/dist/index259.js +15 -42
- package/dist/index259.js.map +1 -1
- package/dist/index260.js +25 -13
- package/dist/index260.js.map +1 -1
- package/dist/index261.js +40 -22
- package/dist/index261.js.map +1 -1
- package/dist/index262.js +13 -17
- package/dist/index262.js.map +1 -1
- package/dist/index263.js +24 -34
- package/dist/index263.js.map +1 -1
- package/dist/index264.js +17 -5
- package/dist/index264.js.map +1 -1
- package/dist/index265.js +35 -9
- package/dist/index265.js.map +1 -1
- package/dist/index266.js +5 -8
- package/dist/index266.js.map +1 -1
- package/dist/index267.js +9 -9
- package/dist/index267.js.map +1 -1
- package/dist/index268.js +8 -10
- package/dist/index268.js.map +1 -1
- package/dist/index269.js +9 -7
- package/dist/index269.js.map +1 -1
- package/dist/index270.js +9 -72
- package/dist/index270.js.map +1 -1
- package/dist/index271.js +7 -171
- package/dist/index271.js.map +1 -1
- package/dist/index272.js +63 -104
- package/dist/index272.js.map +1 -1
- package/dist/index273.js +169 -12
- package/dist/index273.js.map +1 -1
- package/dist/index274.js +109 -75
- package/dist/index274.js.map +1 -1
- package/dist/index275.js +12 -44
- package/dist/index275.js.map +1 -1
- package/dist/index276.js +79 -12
- package/dist/index276.js.map +1 -1
- package/dist/index277.js +45 -15
- package/dist/index277.js.map +1 -1
- package/dist/index278.js +12 -98
- package/dist/index278.js.map +1 -1
- package/dist/index279.js +15 -55
- package/dist/index279.js.map +1 -1
- package/dist/index280.js +89 -98
- package/dist/index280.js.map +1 -1
- package/dist/index281.js +27 -42
- package/dist/index281.js.map +1 -1
- package/dist/index282.js +92 -97
- package/dist/index282.js.map +1 -1
- package/dist/index283.js +62 -46
- package/dist/index283.js.map +1 -1
- package/dist/index284.js +108 -38
- package/dist/index284.js.map +1 -1
- package/dist/index285.js +48 -135
- package/dist/index285.js.map +1 -1
- package/dist/index286.js +43 -139
- package/dist/index286.js.map +1 -1
- package/dist/index287.js +105 -217
- package/dist/index287.js.map +1 -1
- package/dist/index288.js +109 -210
- package/dist/index288.js.map +1 -1
- package/dist/index289.js +168 -212
- package/dist/index289.js.map +1 -1
- package/dist/index290.js +240 -5
- package/dist/index290.js.map +1 -1
- package/dist/index291.js +298 -6
- package/dist/index291.js.map +1 -1
- package/dist/index292.js +5 -7
- package/dist/index292.js.map +1 -1
- package/dist/index293.js +4 -4
- package/dist/index293.js.map +1 -1
- package/dist/index294.js +7 -6
- package/dist/index294.js.map +1 -1
- package/dist/index295.js +6 -21
- package/dist/index295.js.map +1 -1
- package/dist/index296.js +6 -10
- package/dist/index296.js.map +1 -1
- package/dist/index297.js +18 -123
- package/dist/index297.js.map +1 -1
- package/dist/index298.js +10 -164
- package/dist/index298.js.map +1 -1
- package/dist/index299.js +116 -58
- package/dist/index299.js.map +1 -1
- package/dist/index300.js +161 -106
- package/dist/index300.js.map +1 -1
- package/dist/index301.js +66 -489
- package/dist/index301.js.map +1 -1
- package/dist/index302.js +106 -59
- package/dist/index302.js.map +1 -1
- package/dist/index303.js +492 -4
- package/dist/index303.js.map +1 -1
- package/dist/index304.js +62 -27
- package/dist/index304.js.map +1 -1
- package/dist/index305.js +4 -66
- package/dist/index305.js.map +1 -1
- package/dist/index306.js +27 -152
- package/dist/index306.js.map +1 -1
- package/dist/index307.js +59 -555
- package/dist/index307.js.map +1 -1
- package/dist/index308.js +143 -201
- package/dist/index308.js.map +1 -1
- package/dist/index309.js +56 -326
- package/dist/index309.js.map +1 -1
- package/dist/index310.js +553 -260
- package/dist/index310.js.map +1 -1
- package/dist/index311.js +214 -0
- package/dist/index311.js.map +1 -0
- package/dist/index312.js +335 -0
- package/dist/index312.js.map +1 -0
- package/dist/index313.js +272 -0
- package/dist/index313.js.map +1 -0
- package/package.json +2 -2
- package/dist/index234.js.map +0 -1
- package/dist/index237.js.map +0 -1
package/dist/index301.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index301.js","names":["React","CountryCode","getCountryCallingCode","Select","Props","SelectProps","SingleValue","StylesConfig","cn","CountryOption","PhoneNumberChangeDetails","PhoneNumberInputProps","PhoneNumberSelectedCountry","resolveMessages","DEFAULT_COUNTRY","COMMON_IDD_PREFIXES","buildFallbackSelectedCountry","getCachedCountryOptions","getLocaleCacheKey","getValidCountry","normalizeSearchValue","optionMatchIndex","parseLocaleCacheKey","toSelectedCountry","detectNationalPrefixForDisplay","formatWithAsYouType","getLengthIssue","getSuggestionState","injectNationalPrefixDisplay","normalizeInputValue","sanitizeDigits","shouldDisplayExplicitCountrySelection","stripPrefix","LengthIssue","captureSelectionSnapshot","resolveSelection","skipFormattingCharactersLeft","skipFormattingCharactersRight","HiddenControl","NullComponent","SuggestionContext","SuggestionOption","formatCountryOption","suggestionSelectStyles","SuggestionContextValue","PhoneNumberInputMessages","PhoneNumberInputValidationCode","PhoneNumberInput","forwardRef","HTMLInputElement","props","forwardedRef","value","defaultCountry","country","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","hasConfiguredCountry","localeCacheKey","localeForBuild","useMemo","resolvedMessages","countryOptions","resolveSelectedCountry","useCallback","match","find","candidate","fallbackCountry","some","option","hasResolvedCountryRef","useRef","initialStateRef","inputValue","normalizedValue","hasExplicitCountrySelection","lastNormalizedRef","current","baseCountryForInit","undefined","normalized","allowJustPlus","international","phoneNumber","detectedCountry","inferredCountry","hasExplicitInternationalPrefix","canonicalDetectedCountry","resolvedCountry","rawDigits","hasExplicitPlus","test","internationalDigits","initialDialCode","initialHasPrefix","suggestion","hasRemovedNationalPrefix","inferredCountryToApply","shouldSuggest","resolvedFromValue","Boolean","nextDialCode","finalHasPrefix","displayValue","force","displayDetectedCountry","allowInlineFlag","initialState","uncontrolledCountry","setUncontrolledCountry","useState","inputValueState","setInputValueState","countryQuery","setCountryQuery","showSuggestions","setShowSuggestions","highlightedIndex","setHighlightedIndex","isFocused","setIsFocused","lengthIssue","setLengthIssue","setHasExplicitCountrySelection","manualSelectionCountryRef","keyboardBufferRef","bufferTimeoutRef","scrollBehaviorRef","ScrollBehavior","pendingSelectionRef","start","end","consumeScrollBehavior","behavior","isCountryControlled","selectedCountry","activeCountry","inputRef","useImperativeHandle","useLayoutEffect","selection","input","setSelectionRange","selectOverrides","styles","userSelectStyles","components","userSelectComponents","classNamePrefix","userClassNamePrefix","formatOptionLabel","userFormatOptionLabel","forwardedSelectProps","noOptionsMessage","restForwardedSelectProps","mergedSelectStyles","mergedSelectComponents","baseComponents","Control","IndicatorsContainer","DropdownIndicator","IndicatorSeparator","ValueContainer","overrides","Option","hasAnnouncedCountryRef","notifyCountryChange","useEffect","window","clearTimeout","baseCountryForSync","previousNormalized","previousValue","nextCountry","initialHasTypedTrunk","finalCountry","hasTypedTrunk","manualSelectionActive","shouldShowInlineFlag","query","emitChange","details","Omit","scheduleBufferReset","setTimeout","handleInputChange","event","ChangeEvent","target","snapshot","raw","baseCountryForInput","dialCode","typedDigits","trim","startsWith","startsWithDialCode","hasLeadingZero","isIddPrefix","prefix","shouldRemoveNationalPrefix","slice","length","removeNationalPrefix","formattedInternational","formattedNational","e164","countryCallingCode","nationalNumber","rawInput","isValid","national","resolvedFromInput","normalizedDigits","nationalDigits","number","handleCountrySelect","previousDigits","currentDial","digitsWithoutCurrentDial","rebasedDigits","requestAnimationFrame","focus","filteredOptions","results","pushUnique","existing","push","fallbackOption","currentOption","digitQuery","normalizedQuery","forEach","dialMatches","filter","sort","a","b","aExact","bExact","nameMatches","normalizedSearchableTokens","token","includes","aIndex","bIndex","localeCompare","suggestionMenuIsOpen","highlightedOption","updateHighlightedOption","index","findIndex","selectFormatOptionLabel","NonNullable","meta","optionLabelRenderer","context","selectValue","highlightContextValue","highlightedValue","setHighlightedOption","renderOptionLabel","activeOption","activeFlag","flag","inlineFlagLabel","selectedCountryLabel","selectCountryLabel","hasInlineFlag","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","toLowerCase","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 DEFAULT_COUNTRY,\n COMMON_IDD_PREFIXES,\n buildFallbackSelectedCountry,\n getCachedCountryOptions,\n getLocaleCacheKey,\n getValidCountry,\n normalizeSearchValue,\n optionMatchIndex,\n parseLocaleCacheKey,\n toSelectedCountry,\n} from \"./country-options\"\nimport {\n detectNationalPrefixForDisplay,\n formatWithAsYouType,\n getLengthIssue,\n getSuggestionState,\n injectNationalPrefixDisplay,\n normalizeInputValue,\n sanitizeDigits,\n shouldDisplayExplicitCountrySelection,\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\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 hasConfiguredCountry =\n typeof defaultCountry === \"string\" || typeof countryProp === \"string\"\n\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 fallbackCountry = 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 hasResolvedCountryRef = React.useRef<boolean>(hasConfiguredCountry)\n\n const initialStateRef = React.useRef<{\n country: CountryCode\n inputValue: string\n normalizedValue: string\n hasExplicitCountrySelection: boolean\n } | null>(null)\n const lastNormalizedRef = React.useRef<string>(\"\")\n\n if (!initialStateRef.current) {\n if (!value) {\n initialStateRef.current = {\n country: fallbackCountry,\n inputValue: \"\",\n normalizedValue: \"\",\n hasExplicitCountrySelection: false,\n }\n lastNormalizedRef.current = \"\"\n } else {\n const baseCountryForInit = hasConfiguredCountry ? fallbackCountry : undefined\n const normalized = normalizeInputValue(value, baseCountryForInit, { allowJustPlus: true })\n if (!normalized) {\n initialStateRef.current = {\n country: fallbackCountry,\n inputValue: \"\",\n normalizedValue: \"\",\n hasExplicitCountrySelection: false,\n }\n lastNormalizedRef.current = \"\"\n } else {\n const {\n international,\n phoneNumber,\n detectedCountry,\n inferredCountry,\n hasExplicitInternationalPrefix,\n } = formatWithAsYouType(normalized, baseCountryForInit)\n const canonicalDetectedCountry = detectedCountry ?? undefined\n let resolvedCountry = canonicalDetectedCountry ?? fallbackCountry\n const rawDigits = sanitizeDigits(value ?? \"\")\n const hasExplicitPlus = typeof value === \"string\" ? /^\\s*\\+/.test(value) : false\n const internationalDigits = sanitizeDigits(international)\n const initialDialCode = getCountryCallingCode(resolvedCountry)\n const initialHasPrefix = detectNationalPrefixForDisplay(\n rawDigits,\n internationalDigits,\n initialDialCode,\n hasExplicitPlus\n )\n\n const suggestion = getSuggestionState(\n normalized,\n baseCountryForInit,\n phoneNumber ?? undefined,\n {\n hasRemovedNationalPrefix: initialHasPrefix,\n detectedCountry: canonicalDetectedCountry,\n hasExplicitInternationalPrefix,\n }\n )\n\n const inferredCountryToApply =\n !suggestion.shouldSuggest && !canonicalDetectedCountry ? inferredCountry : undefined\n\n\n if (inferredCountryToApply) {\n resolvedCountry = inferredCountryToApply\n }\n\n const resolvedFromValue =\n Boolean(canonicalDetectedCountry) || Boolean(inferredCountryToApply)\n if (resolvedFromValue) {\n hasResolvedCountryRef.current = true\n }\n\n const nextDialCode = getCountryCallingCode(resolvedCountry)\n const finalHasPrefix = inferredCountryToApply\n ? detectNationalPrefixForDisplay(\n rawDigits,\n internationalDigits,\n nextDialCode,\n hasExplicitPlus\n )\n : initialHasPrefix\n\n const displayValue = injectNationalPrefixDisplay(international, nextDialCode, {\n force: finalHasPrefix,\n })\n\n const displayDetectedCountry = canonicalDetectedCountry ?? undefined\n const allowInlineFlag = hasResolvedCountryRef.current\n initialStateRef.current = {\n country: resolvedCountry,\n inputValue: displayValue,\n normalizedValue: normalized,\n hasExplicitCountrySelection:\n allowInlineFlag &&\n shouldDisplayExplicitCountrySelection(suggestion, {\n detectedCountry: displayDetectedCountry,\n hasExplicitInternationalPrefix,\n }),\n }\n lastNormalizedRef.current = normalized\n }\n }\n }\n\n const initialState = initialStateRef.current\n\n const [uncontrolledCountry, setUncontrolledCountry] = React.useState(initialState.country)\n const [inputValueState, setInputValueState] = React.useState(initialState.inputValue)\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>(null)\n const [hasExplicitCountrySelection, setHasExplicitCountrySelection] = React.useState(\n initialState.hasExplicitCountrySelection\n )\n const manualSelectionCountryRef = React.useRef<CountryCode | null>(null)\n\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 consumeScrollBehavior = React.useCallback(() => {\n const behavior = scrollBehaviorRef.current\n scrollBehaviorRef.current = \"smooth\"\n return behavior\n }, [])\n\n const isCountryControlled = typeof countryProp === \"string\"\n const selectedCountry = isCountryControlled ? countryProp : uncontrolledCountry\n const activeCountry = selectedCountry ?? fallbackCountry\n\n const inputRef = React.useRef<HTMLInputElement | null>(null)\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 ...forwardedSelectProps\n } = selectOverrides\n const { noOptionsMessage, ...restForwardedSelectProps } = forwardedSelectProps\n\n const mergedSelectStyles = React.useMemo<StylesConfig<CountryOption, false>>(\n () => ({\n ...suggestionSelectStyles,\n ...(userSelectStyles ?? {}),\n }),\n [userSelectStyles]\n )\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 const hasAnnouncedCountryRef = React.useRef(false)\n\n const notifyCountryChange = React.useCallback(\n (country: CountryCode) => {\n hasAnnouncedCountryRef.current = true\n const selection = resolveSelectedCountry(country)\n onCountryChange?.(country, selection)\n return selection\n },\n [onCountryChange, resolveSelectedCountry]\n )\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 baseCountryForSync = hasResolvedCountryRef.current ? activeCountry : undefined\n const previousNormalized = lastNormalizedRef.current\n const normalized = normalizeInputValue(value, baseCountryForSync, {\n allowJustPlus: true,\n previousValue: previousNormalized,\n })\n lastNormalizedRef.current = normalized\n keyboardBufferRef.current = \"\"\n\n if (!normalized) {\n setInputValueState(\"\")\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setLengthIssue(null)\n manualSelectionCountryRef.current = null\n setHasExplicitCountrySelection(false)\n const nextCountry = hasConfiguredCountry ? fallbackCountry : activeCountry\n if (!isCountryControlled && uncontrolledCountry !== nextCountry) {\n setUncontrolledCountry(nextCountry)\n notifyCountryChange(nextCountry)\n }\n return\n }\n\n if (normalized === \"0\") {\n setInputValueState(\"0\")\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setLengthIssue(null)\n manualSelectionCountryRef.current = null\n setHasExplicitCountrySelection(false)\n return\n }\n\n if (normalized === \"+\") {\n setInputValueState(\"+\")\n setShowSuggestions(true)\n setCountryQuery(\"\")\n setLengthIssue(null)\n manualSelectionCountryRef.current = null\n setHasExplicitCountrySelection(false)\n const nextCountry = hasConfiguredCountry ? fallbackCountry : activeCountry\n if (!isCountryControlled && uncontrolledCountry !== nextCountry) {\n setUncontrolledCountry(nextCountry)\n notifyCountryChange(nextCountry)\n }\n return\n }\n\n const {\n international,\n phoneNumber,\n detectedCountry,\n inferredCountry,\n hasExplicitInternationalPrefix,\n } = formatWithAsYouType(normalized, baseCountryForSync)\n const canonicalDetectedCountry = detectedCountry ?? undefined\n let nextCountry = canonicalDetectedCountry ?? baseCountryForSync ?? activeCountry\n const rawDigits = sanitizeDigits(value ?? \"\")\n const hasExplicitPlus = typeof value === \"string\" ? /^\\s*\\+/.test(value) : false\n const internationalDigits = sanitizeDigits(international)\n const initialDialCode = getCountryCallingCode(nextCountry)\n const initialHasTypedTrunk = detectNationalPrefixForDisplay(\n rawDigits,\n internationalDigits,\n initialDialCode,\n hasExplicitPlus\n )\n\n const suggestion = getSuggestionState(\n normalized,\n baseCountryForSync,\n phoneNumber ?? undefined,\n {\n hasRemovedNationalPrefix: initialHasTypedTrunk,\n detectedCountry: canonicalDetectedCountry,\n hasExplicitInternationalPrefix,\n }\n )\n\n const inferredCountryToApply =\n !suggestion.shouldSuggest && !canonicalDetectedCountry ? inferredCountry : undefined\n const finalCountry = inferredCountryToApply ?? nextCountry\n\n const resolvedFromValue =\n Boolean(canonicalDetectedCountry) || Boolean(inferredCountryToApply)\n if (resolvedFromValue) {\n hasResolvedCountryRef.current = true\n }\n\n if (!isCountryControlled && finalCountry !== uncontrolledCountry) {\n setUncontrolledCountry(finalCountry)\n notifyCountryChange(finalCountry)\n }\n\n nextCountry = finalCountry\n\n if (\n manualSelectionCountryRef.current &&\n manualSelectionCountryRef.current !== nextCountry\n ) {\n manualSelectionCountryRef.current = null\n }\n\n const nextDialCode = getCountryCallingCode(nextCountry)\n const hasTypedTrunk = inferredCountryToApply\n ? detectNationalPrefixForDisplay(\n rawDigits,\n internationalDigits,\n nextDialCode,\n hasExplicitPlus\n )\n : initialHasTypedTrunk\n\n const displayValue = injectNationalPrefixDisplay(international, nextDialCode, {\n force: hasTypedTrunk,\n })\n const displayDetectedCountry = canonicalDetectedCountry ?? undefined\n const manualSelectionActive = manualSelectionCountryRef.current != null\n const shouldShowInlineFlag =\n manualSelectionActive ||\n shouldDisplayExplicitCountrySelection(suggestion, {\n detectedCountry: displayDetectedCountry,\n hasExplicitInternationalPrefix,\n })\n\n setInputValueState(displayValue)\n setShowSuggestions(suggestion.shouldSuggest)\n setCountryQuery(suggestion.query)\n setLengthIssue(hasResolvedCountryRef.current ? getLengthIssue(normalized, nextCountry) : null)\n setHasExplicitCountrySelection(hasResolvedCountryRef.current && shouldShowInlineFlag)\n }, [\n value,\n activeCountry,\n fallbackCountry,\n hasConfiguredCountry,\n isCountryControlled,\n notifyCountryChange,\n uncontrolledCountry,\n ])\n\n React.useEffect(() => {\n if (hasAnnouncedCountryRef.current) {\n return\n }\n if (!hasResolvedCountryRef.current) {\n return\n }\n const current = selectedCountry ?? fallbackCountry\n if (!current) {\n return\n }\n notifyCountryChange(current)\n }, [fallbackCountry, notifyCountryChange, selectedCountry])\n\n React.useEffect(() => {\n if (isCountryControlled && countryProp && countryProp !== uncontrolledCountry) {\n setUncontrolledCountry(countryProp)\n }\n }, [countryProp, isCountryControlled, uncontrolledCountry])\n\n const emitChange = React.useCallback(\n (details: Omit<PhoneNumberChangeDetails, \"selectedCountry\">) => {\n const selection = resolveSelectedCountry(details.country)\n onChange?.({\n ...details,\n selectedCountry: selection,\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 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 baseCountryForInput = hasResolvedCountryRef.current ? activeCountry : undefined\n const dialCode = baseCountryForInput ? getCountryCallingCode(baseCountryForInput) : \"\"\n const typedDigits = sanitizeDigits(raw)\n const hasExplicitPlus = raw.trim().startsWith(\"+\")\n const startsWithDialCode = dialCode ? typedDigits.startsWith(dialCode) : false\n const hasLeadingZero = typedDigits.startsWith(\"0\")\n const isIddPrefix = COMMON_IDD_PREFIXES.some((prefix) => typedDigits.startsWith(prefix))\n\n const shouldRemoveNationalPrefix =\n Boolean(baseCountryForInput) &&\n !isIddPrefix &&\n ((startsWithDialCode && typedDigits.slice(dialCode.length).startsWith(\"0\")) ||\n (!hasExplicitPlus && hasLeadingZero && typedDigits.length > 1) ||\n (hasExplicitPlus && hasLeadingZero && typedDigits.length > 1 && !startsWithDialCode))\n\n const previousNormalized = lastNormalizedRef.current\n const normalized = normalizeInputValue(raw, baseCountryForInput, {\n allowJustPlus: true,\n removeNationalPrefix: shouldRemoveNationalPrefix,\n previousValue: previousNormalized,\n })\n lastNormalizedRef.current = normalized\n\n if (!normalized) {\n setInputValueState(\"\")\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setHighlightedIndex(-1)\n setLengthIssue(null)\n manualSelectionCountryRef.current = null\n setHasExplicitCountrySelection(false)\n pendingSelectionRef.current = resolveSelection(snapshot, \"\")\n\n const nextCountry = hasConfiguredCountry ? fallbackCountry : activeCountry\n\n if (!isCountryControlled && uncontrolledCountry !== nextCountry) {\n setUncontrolledCountry(nextCountry)\n notifyCountryChange(nextCountry)\n }\n\n const nextDialCode = getCountryCallingCode(nextCountry)\n emitChange({\n formattedInternational: \"\",\n formattedNational: \"\",\n e164: null,\n country: nextCountry,\n countryCallingCode: nextDialCode,\n nationalNumber: \"\",\n rawInput: \"\",\n isValid: false,\n })\n return\n }\n\n if (normalized === \"0\") {\n setInputValueState(\"0\")\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setHighlightedIndex(-1)\n setLengthIssue(null)\n manualSelectionCountryRef.current = null\n setHasExplicitCountrySelection(false)\n pendingSelectionRef.current = resolveSelection(snapshot, \"0\")\n\n const nextCountry = hasConfiguredCountry ? fallbackCountry : activeCountry\n\n if (!isCountryControlled && uncontrolledCountry !== nextCountry) {\n setUncontrolledCountry(nextCountry)\n notifyCountryChange(nextCountry)\n }\n\n const nextDialCode = getCountryCallingCode(nextCountry)\n emitChange({\n formattedInternational: \"0\",\n formattedNational: \"0\",\n e164: null,\n country: nextCountry,\n countryCallingCode: nextDialCode,\n nationalNumber: \"0\",\n rawInput: \"0\",\n isValid: false,\n })\n return\n }\n\n if (normalized === \"+\") {\n setInputValueState(\"+\")\n setShowSuggestions(true)\n setCountryQuery(\"\")\n setHighlightedIndex(0)\n setLengthIssue(null)\n manualSelectionCountryRef.current = null\n setHasExplicitCountrySelection(false)\n pendingSelectionRef.current = resolveSelection(snapshot, \"+\")\n\n const nextCountry = hasConfiguredCountry ? fallbackCountry : activeCountry\n\n if (!isCountryControlled && uncontrolledCountry !== nextCountry) {\n setUncontrolledCountry(nextCountry)\n notifyCountryChange(nextCountry)\n }\n\n const nextDialCode = getCountryCallingCode(nextCountry)\n emitChange({\n formattedInternational: \"+\",\n formattedNational: \"\",\n e164: null,\n country: nextCountry,\n countryCallingCode: nextDialCode,\n nationalNumber: \"\",\n rawInput: \"+\",\n isValid: false,\n })\n return\n }\n\n const {\n international,\n national,\n phoneNumber,\n detectedCountry,\n inferredCountry,\n hasExplicitInternationalPrefix,\n } = formatWithAsYouType(normalized, baseCountryForInput)\n const canonicalDetectedCountry = detectedCountry ?? undefined\n let nextCountry = canonicalDetectedCountry ?? baseCountryForInput ?? activeCountry\n\n const internationalDigits = sanitizeDigits(international)\n const initialDialCode = getCountryCallingCode(nextCountry)\n const initialHasTypedTrunk = detectNationalPrefixForDisplay(\n typedDigits,\n internationalDigits,\n initialDialCode,\n hasExplicitPlus\n )\n\n const suggestion = getSuggestionState(\n normalized,\n baseCountryForInput,\n phoneNumber ?? undefined,\n {\n hasRemovedNationalPrefix: initialHasTypedTrunk,\n detectedCountry: canonicalDetectedCountry,\n hasExplicitInternationalPrefix,\n }\n )\n\n const inferredCountryToApply =\n !suggestion.shouldSuggest && !canonicalDetectedCountry ? inferredCountry : undefined\n const finalCountry = inferredCountryToApply ?? nextCountry\n\n const resolvedFromInput =\n Boolean(canonicalDetectedCountry) || Boolean(inferredCountryToApply)\n if (resolvedFromInput) {\n hasResolvedCountryRef.current = true\n }\n\n if (!isCountryControlled && finalCountry !== uncontrolledCountry) {\n setUncontrolledCountry(finalCountry)\n notifyCountryChange(finalCountry)\n }\n\n nextCountry = finalCountry\n\n if (\n manualSelectionCountryRef.current &&\n manualSelectionCountryRef.current !== nextCountry\n ) {\n manualSelectionCountryRef.current = null\n }\n\n const nextDialCode = getCountryCallingCode(nextCountry)\n const normalizedDigits = sanitizeDigits(normalized)\n const nationalDigits = stripPrefix(normalizedDigits, nextDialCode)\n const hasTypedTrunk = inferredCountryToApply\n ? detectNationalPrefixForDisplay(\n typedDigits,\n internationalDigits,\n nextDialCode,\n hasExplicitPlus\n )\n : initialHasTypedTrunk\n\n const displayValue = injectNationalPrefixDisplay(international, nextDialCode, {\n force: hasTypedTrunk,\n })\n\n const displayDetectedCountry = canonicalDetectedCountry ?? undefined\n\n pendingSelectionRef.current = resolveSelection(snapshot, displayValue)\n setInputValueState(displayValue)\n setShowSuggestions(suggestion.shouldSuggest)\n setCountryQuery(suggestion.query)\n setHighlightedIndex(suggestion.shouldSuggest ? 0 : -1)\n setLengthIssue(hasResolvedCountryRef.current ? getLengthIssue(normalized, nextCountry) : null)\n const manualSelectionActive = manualSelectionCountryRef.current != null\n const shouldShowInlineFlag =\n manualSelectionActive ||\n shouldDisplayExplicitCountrySelection(suggestion, {\n detectedCountry: displayDetectedCountry,\n hasExplicitInternationalPrefix,\n })\n setHasExplicitCountrySelection(hasResolvedCountryRef.current && shouldShowInlineFlag)\n emitChange({\n formattedInternational: international,\n formattedNational: national,\n e164: phoneNumber?.number ?? null,\n country: nextCountry,\n countryCallingCode: nextDialCode,\n nationalNumber: nationalDigits,\n rawInput: normalized,\n isValid: phoneNumber?.isValid() ?? false,\n })\n },\n [\n activeCountry,\n emitChange,\n fallbackCountry,\n hasConfiguredCountry,\n isCountryControlled,\n notifyCountryChange,\n uncontrolledCountry,\n ]\n )\n\n const handleCountrySelect = React.useCallback(\n (option: SingleValue<CountryOption>) => {\n if (!option) {\n return\n }\n\n const previousDigits = sanitizeDigits(lastNormalizedRef.current || inputValueState)\n const currentDial = getCountryCallingCode(activeCountry)\n const digitsWithoutCurrentDial = previousDigits.startsWith(currentDial)\n ? previousDigits.slice(currentDial.length)\n : previousDigits\n let rebasedDigits = digitsWithoutCurrentDial\n if (!rebasedDigits) {\n rebasedDigits = option.dialCode\n } else if (!rebasedDigits.startsWith(option.dialCode)) {\n rebasedDigits = `${option.dialCode}${rebasedDigits}`\n }\n const normalized = `+${rebasedDigits}`\n lastNormalizedRef.current = normalized\n const { international, national, phoneNumber } = formatWithAsYouType(\n normalized,\n option.value\n )\n const nextCountry = option.value\n manualSelectionCountryRef.current = nextCountry\n hasResolvedCountryRef.current = true\n\n setInputValueState(international)\n pendingSelectionRef.current = {\n start: international.length,\n end: international.length,\n }\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setHighlightedIndex(-1)\n setLengthIssue(getLengthIssue(normalized, nextCountry))\n\n if (!isCountryControlled && nextCountry !== uncontrolledCountry) {\n setUncontrolledCountry(nextCountry)\n }\n\n notifyCountryChange(nextCountry)\n\n const normalizedDigits = sanitizeDigits(normalized)\n const dialCode = phoneNumber?.countryCallingCode ?? option.dialCode\n const nationalDigits = stripPrefix(normalizedDigits, dialCode)\n setHasExplicitCountrySelection(true)\n emitChange({\n formattedInternational: international,\n formattedNational: national,\n e164: phoneNumber?.number ?? null,\n country: nextCountry,\n countryCallingCode: dialCode,\n nationalNumber: nationalDigits,\n rawInput: normalized,\n isValid: phoneNumber?.isValid() ?? false,\n })\n\n requestAnimationFrame(() => {\n inputRef.current?.focus()\n })\n },\n [activeCountry, emitChange, inputValueState, isCountryControlled, notifyCountryChange, uncontrolledCountry]\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) => {\n if (!results.some((existing) => existing.value === option.value)) {\n results.push(option)\n }\n }\n\n const fallbackOption = countryOptions.find((option) => option.value === fallbackCountry)\n const currentOption = countryOptions.find((option) => option.value === activeCountry)\n const query = countryQuery.trim()\n const digitQuery = sanitizeDigits(query)\n const normalizedQuery = normalizeSearchValue(query)\n\n if (!digitQuery && !normalizedQuery) {\n if (fallbackOption) {\n pushUnique(fallbackOption)\n }\n if (currentOption) {\n pushUnique(currentOption)\n }\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 if (currentOption) {\n pushUnique(currentOption)\n }\n if (fallbackOption) {\n pushUnique(fallbackOption)\n }\n if (results.length === 0) {\n countryOptions.forEach(pushUnique)\n }\n\n return results\n }, [activeCountry, countryOptions, countryQuery, fallbackCountry, 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 React.useEffect(() => {\n if (highlightedIndex < 0) {\n scrollBehaviorRef.current = \"smooth\"\n }\n }, [highlightedIndex])\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 = countryOptions.find((option) => option.value === activeCountry)\n const activeFlag = activeOption?.flag ?? \"\"\n const inlineFlagLabel = hasExplicitCountrySelection\n ? resolvedMessages.selectedCountryLabel(activeOption?.name ?? activeCountry ?? null)\n : resolvedMessages.selectCountryLabel\n const hasInlineFlag = hasExplicitCountrySelection && Boolean(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 target = highlightedOption ?? filteredOptions[0]\n handleCountrySelect(target)\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 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":";;;;;;;;;;;AAoEA,IAAa+C,KAAmB/C,EAAMgD,WACpC,SAA0BE,IAAOC,IAAc;CAC7C,IAAM,EACJC,UACAC,mBACAC,SAASC,GACTC,YACAC,cACAC,qBACAC,eACAC,oBACAC,cACAC,cACAC,iBACAC,sBACAC,UAAUC,IACVC,6BACA,GAAGC,OACDlB,IAEE,EACJmB,SAASC,IACTC,QAAQC,IACRC,WAAWC,IACXC,MAAMC,IACNC,cAAcC,IACd,GAAGC,OACDX,IAEEY,IACJ,OAAO3B,KAAmB,YAAY,OAAOE,KAAgB,UAEzD0B,KAAiB/D,EAAkBsC,GAAO,EAC1C0B,KAAiBlF,EAAMmF,cACrB7D,EAAoB2D,GAAe,EACzC,CAACA,GACH,CAAC,EACKG,KAAmBpF,EAAMmF,cACvBtE,EAAgBqE,IAAgBhB,GAAa,EACnD,CAACgB,IAAgBhB,GACnB,CAAC,EACKmB,IAAiBrF,EAAMmF,cACrBlE,EAAwBiE,IAAgBD,GAAe,EAC7D,CAACA,IAAgBC,GACnB,CAAC,EACKI,KAAyBtF,EAAMuF,aAClCjC,MAAqD;EACpD,IAAMkC,IAAQH,EAAeI,MAAMC,MAAcA,EAAUtC,UAAUE,EAAQ;AAI7E,SAHIkC,IACKjE,EAAkBiE,EAAM,GAE1BxE,EAA6BsC,EAAQ;IAE9C,CAAC+B,EACH,CAAC,EACKM,IAAkB3F,EAAMmF,cAAc;EAC1C,IAAMO,IAAYvE,EAAgBkC,KAAkBE,KAAAA,KAA+B;AAInF,SAHI8B,EAAeO,MAAMC,MAAWA,EAAOzC,UAAUsC,EAAU,GACtDA,IAEFL,EAAe,IAAIjC,SAAAA;IACzB;EAACiC;EAAgB9B;EAAaF;EAAe,CAAC,EAE3CyC,IAAwB9F,EAAM+F,OAAgBf,EAAqB,EAEn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P,YAAYnE;MACZ,QAAQD;MACR,aAAa;MACb,cAAc;MACd,uBAAuB;MACvB,iBAAiB;MACjB,0BAA0B;MAC1B,UAAU6D;MACV,iBAAiBnE,MAAuB;MACxC,aAAY;MACZ,mBAAmBuG;MACnB,kBACAnG,aAA2B7F,GAAiBmP;MAC7C,CAAA;KAEuB,CAAA;IACzB,CAAA;GAEF/B;GACG;;EAGX;AAEDzP,GAAiByR,cAAc"}
|
|
1
|
+
{"version":3,"file":"index301.js","names":["isDigitCharacter","char","code","charCodeAt","countDigitsBefore","value","index","count","limit","Math","min","length","position","findIndexForDigitCount","digitCount","startsWith","seen","isFormattingCharacter","skipFormattingCharactersLeft","next","skipFormattingCharactersRight","SelectionSnapshot","selectionStart","selectionEnd","startDigits","endDigits","preserveStartIndex","preserveEndIndex","wasAtStart","wasAtEnd","captureSelectionSnapshot","input","HTMLInputElement","resolveSelection","snapshot","end","start","resolvedStart","resolvedEnd","clampedStart","max","clampedEnd"],"sources":["../src/components/PhoneNumberInput/selection.ts"],"sourcesContent":["function isDigitCharacter(char: string) {\n if (!char) {\n return false\n }\n const code = char.charCodeAt(0)\n return code >= 48 && code <= 57\n}\n\nfunction countDigitsBefore(value: string, index: number) {\n let count = 0\n const limit = Math.min(index, value.length)\n for (let position = 0; position < limit; position += 1) {\n if (isDigitCharacter(value[position] ?? \"\")) {\n count += 1\n }\n }\n return count\n}\n\nfunction findIndexForDigitCount(value: string, digitCount: number) {\n if (digitCount <= 0) {\n return value.startsWith(\"+\") ? Math.min(1, value.length) : 0\n }\n\n let seen = 0\n for (let index = 0; index < value.length; index += 1) {\n if (isDigitCharacter(value[index] ?? \"\")) {\n seen += 1\n if (seen === digitCount) {\n return index + 1\n }\n }\n }\n\n return value.length\n}\n\nfunction isFormattingCharacter(char: string) {\n if (!char) {\n return false\n }\n if (isDigitCharacter(char)) {\n return false\n }\n return char !== \"+\"\n}\n\nexport function skipFormattingCharactersLeft(value: string, index: number) {\n let position = index\n while (position > 0) {\n const next = value[position - 1] ?? \"\"\n if (!isFormattingCharacter(next)) {\n break\n }\n position -= 1\n }\n return position\n}\n\nexport function skipFormattingCharactersRight(value: string, index: number) {\n let position = index\n while (position < value.length) {\n const next = value[position] ?? \"\"\n if (!isFormattingCharacter(next)) {\n break\n }\n position += 1\n }\n return position\n}\n\ntype SelectionSnapshot = {\n selectionStart: number\n selectionEnd: number\n startDigits: number\n endDigits: number\n preserveStartIndex: boolean\n preserveEndIndex: boolean\n wasAtStart: boolean\n wasAtEnd: boolean\n}\n\nexport function captureSelectionSnapshot(input: HTMLInputElement): SelectionSnapshot {\n const { value } = input\n const selectionStart = input.selectionStart ?? value.length\n const selectionEnd = input.selectionEnd ?? selectionStart\n const preserveStartIndex = selectionStart <= 1 && value.startsWith(\"+\")\n const preserveEndIndex = selectionEnd <= 1 && value.startsWith(\"+\")\n\n return {\n selectionStart,\n selectionEnd,\n startDigits: countDigitsBefore(value, selectionStart),\n endDigits: countDigitsBefore(value, selectionEnd),\n preserveStartIndex,\n preserveEndIndex,\n wasAtStart: selectionStart === 0,\n wasAtEnd: selectionEnd === value.length,\n }\n}\n\nexport function resolveSelection(snapshot: SelectionSnapshot, value: string) {\n if (snapshot.selectionStart === snapshot.selectionEnd) {\n if (snapshot.wasAtEnd) {\n const end = value.length\n return { start: end, end }\n }\n if (snapshot.wasAtStart) {\n return { start: 0, end: 0 }\n }\n }\n\n const start = snapshot.preserveStartIndex\n ? Math.min(snapshot.selectionStart, value.length)\n : findIndexForDigitCount(value, snapshot.startDigits)\n const end = snapshot.preserveEndIndex\n ? Math.min(snapshot.selectionEnd, value.length)\n : findIndexForDigitCount(value, snapshot.endDigits)\n\n let resolvedStart = start\n let resolvedEnd = end\n\n if (snapshot.wasAtStart) {\n resolvedStart = 0\n }\n\n if (snapshot.wasAtEnd) {\n resolvedEnd = value.length\n }\n\n if (snapshot.selectionStart === snapshot.selectionEnd) {\n resolvedStart = resolvedEnd\n }\n\n const clampedStart = Math.min(Math.max(resolvedStart, 0), value.length)\n const clampedEnd = Math.min(Math.max(resolvedEnd, 0), value.length)\n\n if (clampedStart > clampedEnd) {\n return { start: clampedEnd, end: clampedEnd }\n }\n\n return { start: clampedStart, end: clampedEnd }\n}\n\n"],"mappings":";AAAA,SAASA,EAAiBC,GAAc;AACtC,KAAI,CAACA,EACH,QAAO;CAET,IAAMC,IAAOD,EAAKE,WAAW,EAAE;AAC/B,QAAOD,KAAQ,MAAMA,KAAQ;;AAG/B,SAASE,EAAkBC,GAAeC,GAAe;CACvD,IAAIC,IAAQ,GACNC,IAAQC,KAAKC,IAAIJ,GAAOD,EAAMM,OAAO;AAC3C,MAAK,IAAIC,IAAW,GAAGA,IAAWJ,GAAOI,KAAY,EACnD,CAAIZ,EAAiBK,EAAMO,MAAa,GAAG,KACzCL,KAAS;AAGb,QAAOA;;AAGT,SAASM,EAAuBR,GAAeS,GAAoB;AACjE,KAAIA,KAAc,EAChB,QAAOT,EAAMU,WAAW,IAAI,GAAGN,KAAKC,IAAI,GAAGL,EAAMM,OAAO,GAAG;CAG7D,IAAIK,IAAO;AACX,MAAK,IAAIV,IAAQ,GAAGA,IAAQD,EAAMM,QAAQL,KAAS,EACjD,KAAIN,EAAiBK,EAAMC,MAAU,GAAG,KACtCU,KAAQ,GACJA,MAASF,GACX,QAAOR,IAAQ;AAKrB,QAAOD,EAAMM;;AAGf,SAASM,EAAsBhB,GAAc;AAO3C,QANI,CAACA,KAGDD,EAAiBC,EAAK,GACjB,KAEFA,MAAS;;AAGlB,SAAgBiB,EAA6Bb,GAAeC,GAAe;CACzE,IAAIM,IAAWN;AACf,QAAOM,IAAW,KAEXK,EADQZ,EAAMO,IAAW,MAAM,GACJ,EAGhCA;AAEF,QAAOA;;AAGT,SAAgBQ,EAA8Bf,GAAeC,GAAe;CAC1E,IAAIM,IAAWN;AACf,QAAOM,IAAWP,EAAMM,UAEjBM,EADQZ,EAAMO,MAAa,GACA,EAGhCA,MAAY;AAEd,QAAOA;;AAcT,SAAgBkB,EAAy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;EAAY,GAGxC;EAAEL,OAAOG;EAAcJ,KAAKM;EAAY"}
|
package/dist/index302.js
CHANGED
|
@@ -1,66 +1,113 @@
|
|
|
1
|
-
import e from "./
|
|
1
|
+
import { cn as e } from "./index12.js";
|
|
2
2
|
import { c as t } from "react/compiler-runtime";
|
|
3
|
-
import
|
|
4
|
-
import { jsx as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
import * as n from "react";
|
|
4
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/PhoneNumberInput/suggestions.tsx
|
|
6
|
+
var o = n.createContext(null);
|
|
7
|
+
function s(e, t) {
|
|
8
|
+
if (typeof e == "function") {
|
|
9
|
+
e(t);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
e && typeof e == "object" && Reflect.set(e, "current", t);
|
|
13
|
+
}
|
|
14
|
+
var c = (r) => {
|
|
15
|
+
let a = t(30), c = n.useContext(o), l = c?.highlightedValue === r.data.value, u, d, f;
|
|
16
|
+
a[0] === r.innerProps ? (u = a[1], d = a[2], f = a[3]) : ({onMouseMove: u, className: d, ...f} = r.innerProps, a[0] = r.innerProps, a[1] = u, a[2] = d, a[3] = f);
|
|
17
|
+
let m;
|
|
18
|
+
a[4] === c?.renderOptionLabel ? m = a[5] : (m = c?.renderOptionLabel ?? p, a[4] = c?.renderOptionLabel, a[5] = m);
|
|
19
|
+
let h = m, g = n.useRef(null), { innerRef: _ } = r, v;
|
|
20
|
+
a[6] === _ ? v = a[7] : (v = (e) => {
|
|
21
|
+
g.current = e, s(_, e);
|
|
22
|
+
}, a[6] = _, a[7] = v);
|
|
23
|
+
let y = v, b;
|
|
24
|
+
a[8] !== c?.consumeScrollBehavior || a[9] !== l ? (b = () => {
|
|
25
|
+
if (!l) return;
|
|
26
|
+
let e = c?.consumeScrollBehavior, t = e ? e() : "smooth", n = g.current;
|
|
27
|
+
if (!n) return;
|
|
28
|
+
let r = n.parentElement;
|
|
29
|
+
if (!r) return;
|
|
30
|
+
let i = n.offsetTop, a = i + n.offsetHeight, o = r.scrollTop, s = o + r.clientHeight;
|
|
31
|
+
i >= o && a <= s || n.scrollIntoView({
|
|
32
|
+
block: "nearest",
|
|
33
|
+
behavior: t
|
|
34
|
+
});
|
|
35
|
+
}, a[8] = c?.consumeScrollBehavior, a[9] = l, a[10] = b) : b = a[10];
|
|
36
|
+
let x;
|
|
37
|
+
a[11] !== c || a[12] !== l ? (x = [c, l], a[11] = c, a[12] = l, a[13] = x) : x = a[13], n.useEffect(b, x);
|
|
38
|
+
let S;
|
|
39
|
+
a[14] !== c || a[15] !== u || a[16] !== r.data ? (S = (e) => {
|
|
40
|
+
u?.(e), c?.setHighlightedOption(r.data);
|
|
41
|
+
}, a[14] = c, a[15] = u, a[16] = r.data, a[17] = S) : S = a[17];
|
|
42
|
+
let C = S, w = l ? "bg-muted text-foreground" : "text-foreground hover:bg-muted", T;
|
|
43
|
+
a[18] !== d || a[19] !== w ? (T = e("flex cursor-pointer items-center justify-between gap-3 px-3 py-2 text-sm", d, w), a[18] = d, a[19] = w, a[20] = T) : T = a[20];
|
|
22
44
|
let E;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
a[21] !== r.data || a[22] !== h ? (E = h(r.data), a[21] = r.data, a[22] = h, a[23] = E) : E = a[23];
|
|
46
|
+
let D;
|
|
47
|
+
return a[24] !== y || a[25] !== C || a[26] !== f || a[27] !== T || a[28] !== E ? (D = /* @__PURE__ */ i("div", {
|
|
48
|
+
ref: y,
|
|
49
|
+
...f,
|
|
50
|
+
onMouseMove: C,
|
|
51
|
+
className: T,
|
|
52
|
+
children: E
|
|
53
|
+
}), a[24] = y, a[25] = C, a[26] = f, a[27] = T, a[28] = E, a[29] = D) : D = a[29], D;
|
|
54
|
+
}, l = {
|
|
55
|
+
control: () => ({ display: "none" }),
|
|
56
|
+
menu: (e) => ({
|
|
57
|
+
...e,
|
|
58
|
+
marginTop: 4,
|
|
59
|
+
borderRadius: "var(--radius)",
|
|
60
|
+
boxShadow: "0 18px 36px rgba(15, 23, 42, 0.18)",
|
|
61
|
+
backgroundColor: "hsl(var(--popover))",
|
|
62
|
+
overflow: "hidden",
|
|
63
|
+
zIndex: 20
|
|
64
|
+
}),
|
|
65
|
+
menuList: (e) => ({
|
|
66
|
+
...e,
|
|
67
|
+
maxHeight: 240,
|
|
68
|
+
padding: 0
|
|
69
|
+
}),
|
|
70
|
+
option: (e, t) => ({
|
|
71
|
+
...e,
|
|
72
|
+
fontSize: "0.875rem",
|
|
73
|
+
backgroundColor: t.isFocused ? "hsl(var(--muted))" : t.isSelected ? "hsl(var(--accent))" : "transparent",
|
|
74
|
+
color: t.isSelected ? "hsl(var(--accent-foreground))" : "hsl(var(--foreground))",
|
|
75
|
+
cursor: "pointer"
|
|
76
|
+
}),
|
|
77
|
+
noOptionsMessage: (e) => ({
|
|
78
|
+
...e,
|
|
79
|
+
fontSize: "0.875rem",
|
|
80
|
+
color: "hsl(var(--muted-foreground))"
|
|
81
|
+
})
|
|
82
|
+
}, u = (e) => {
|
|
83
|
+
let n = t(3), r;
|
|
84
|
+
n[0] === Symbol.for("react.memo_cache_sentinel") ? (r = { display: "none" }, n[0] = r) : r = n[0];
|
|
85
|
+
let a;
|
|
86
|
+
return n[1] === e.children ? a = n[2] : (a = /* @__PURE__ */ i("div", {
|
|
87
|
+
style: r,
|
|
88
|
+
children: e.children
|
|
89
|
+
}), n[1] = e.children, n[2] = a), a;
|
|
90
|
+
}, d = () => null;
|
|
91
|
+
function f(e) {
|
|
92
|
+
return /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ a("span", {
|
|
93
|
+
className: "flex min-w-0 items-center gap-2",
|
|
94
|
+
children: [e.flag ? /* @__PURE__ */ i("span", {
|
|
47
95
|
"aria-hidden": "true",
|
|
48
|
-
className: "
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
96
|
+
className: "text-lg leading-none",
|
|
97
|
+
children: e.flag
|
|
98
|
+
}) : null, /* @__PURE__ */ i("span", {
|
|
99
|
+
className: "truncate",
|
|
100
|
+
children: e.name
|
|
52
101
|
})]
|
|
53
|
-
}),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}), l[15] = k, l[16] = A, l[17] = j) : j = l[17], j;
|
|
62
|
-
};
|
|
102
|
+
}), /* @__PURE__ */ a("span", {
|
|
103
|
+
className: "text-xs text-muted-foreground",
|
|
104
|
+
children: ["+", e.dialCode]
|
|
105
|
+
})] });
|
|
106
|
+
}
|
|
107
|
+
function p(e) {
|
|
108
|
+
return f(e);
|
|
109
|
+
}
|
|
63
110
|
//#endregion
|
|
64
|
-
export { c as
|
|
111
|
+
export { u as HiddenControl, d as NullComponent, o as SuggestionContext, c as SuggestionOption, f as formatCountryOption, l as suggestionSelectStyles };
|
|
65
112
|
|
|
66
113
|
//# sourceMappingURL=index302.js.map
|
package/dist/index302.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index302.js","names":["
|
|
1
|
+
{"version":3,"file":"index302.js","names":["React","CountryCode","ControlProps","OptionProps","StylesConfig","cn","CountryOption","SuggestionContextValue","highlightedValue","setHighlightedOption","option","renderOptionLabel","ReactNode","consumeScrollBehavior","ScrollBehavior","SuggestionContext","createContext","assignOptionRef","ref","Ref","HTMLDivElement","node","Reflect","set","SuggestionOption","props","$","_c","context","useContext","isActive","data","value","onMouseMove","receivedClassName","restInnerProps","innerProps","className","t0","_temp","renderLabel","optionRef","useRef","innerRef","t1","current","assignRef","t2","behavior","target","parent","parentElement","top","offsetTop","bottom","offsetHeight","viewTop","scrollTop","viewBottom","clientHeight","scrollIntoView","block","t3","useEffect","t4","event","handleMouseMove","t5","t6","t7","t8","suggestionSelectStyles","control","display","menu","provided","marginTop","borderRadius","boxShadow","backgroundColor","overflow","zIndex","menuList","maxHeight","padding","state","fontSize","isFocused","isSelected","color","cursor","noOptionsMessage","HiddenControl","Symbol","for","children","NullComponent","formatCountryOption","flag","name","dialCode"],"sources":["../src/components/PhoneNumberInput/suggestions.tsx"],"sourcesContent":["import * as React from \"react\"\nimport type { CountryCode } from \"libphonenumber-js\"\nimport type { ControlProps, OptionProps, StylesConfig } from \"react-select\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport type { CountryOption } from \"./types\"\n\n\nexport type SuggestionContextValue = {\n highlightedValue: CountryCode | null\n setHighlightedOption: (option: CountryOption) => void\n renderOptionLabel: (option: CountryOption) => React.ReactNode\n consumeScrollBehavior: () => ScrollBehavior\n}\n\nexport const SuggestionContext = React.createContext<SuggestionContextValue | null>(null)\n\nfunction assignOptionRef(ref: React.Ref<HTMLDivElement> | undefined, node: HTMLDivElement | null) {\n if (typeof ref === \"function\") {\n ref(node)\n return\n }\n if (ref && typeof ref === \"object\") {\n Reflect.set(ref, \"current\", node)\n }\n}\n\nexport const SuggestionOption = (props: OptionProps<CountryOption, false>) => {\n const context = React.useContext(SuggestionContext)\n const isActive = context?.highlightedValue === props.data.value\n const { onMouseMove, className: receivedClassName, ...restInnerProps } = props.innerProps\n const renderLabel =\n context?.renderOptionLabel ?? ((option: CountryOption) => formatCountryOption(option))\n const optionRef = React.useRef<HTMLDivElement | null>(null)\n const { innerRef } = props\n\n const assignRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n optionRef.current = node\n assignOptionRef(innerRef, node)\n },\n [innerRef]\n )\n\n React.useEffect(() => {\n if (!isActive) {\n return\n }\n\n const consumeScrollBehavior = context?.consumeScrollBehavior\n const behavior = consumeScrollBehavior ? consumeScrollBehavior() : \"smooth\"\n\n const target = optionRef.current\n if (!target) {\n return\n }\n\n const parent = target.parentElement\n if (!parent) {\n return\n }\n\n const top = target.offsetTop\n const bottom = top + target.offsetHeight\n const viewTop = parent.scrollTop\n const viewBottom = viewTop + parent.clientHeight\n\n if (top >= viewTop && bottom <= viewBottom) {\n return\n }\n\n target.scrollIntoView({\n block: \"nearest\",\n behavior,\n })\n }, [context, isActive])\n\n const handleMouseMove = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseMove?.(event)\n context?.setHighlightedOption(props.data)\n }\n\n return (\n <div\n ref={assignRef}\n {...restInnerProps}\n onMouseMove={handleMouseMove}\n className={cn(\n \"flex cursor-pointer items-center justify-between gap-3 px-3 py-2 text-sm\",\n receivedClassName,\n isActive ? \"bg-muted text-foreground\" : \"text-foreground hover:bg-muted\"\n )}\n >\n {renderLabel(props.data)}\n </div>\n )\n}\n\nexport const suggestionSelectStyles: StylesConfig<CountryOption, false> = {\n control: () => ({\n display: \"none\",\n }),\n menu: (provided) => ({\n ...provided,\n marginTop: 4,\n borderRadius: \"var(--radius)\",\n boxShadow: \"0 18px 36px rgba(15, 23, 42, 0.18)\",\n backgroundColor: \"hsl(var(--popover))\",\n overflow: \"hidden\",\n zIndex: 20,\n }),\n menuList: (provided) => ({\n ...provided,\n maxHeight: 240,\n padding: 0,\n }),\n option: (provided, state) => ({\n ...provided,\n fontSize: \"0.875rem\",\n backgroundColor: state.isFocused\n ? \"hsl(var(--muted))\"\n : state.isSelected\n ? \"hsl(var(--accent))\"\n : \"transparent\",\n color: state.isSelected\n ? \"hsl(var(--accent-foreground))\"\n : \"hsl(var(--foreground))\",\n cursor: \"pointer\",\n }),\n noOptionsMessage: (provided) => ({\n ...provided,\n fontSize: \"0.875rem\",\n color: \"hsl(var(--muted-foreground))\",\n }),\n}\n\nexport const HiddenControl = (props: ControlProps<CountryOption, false>) => (\n <div style={{ display: \"none\" }}>{props.children}</div>\n)\n\nexport const NullComponent = () => null\n\nexport function formatCountryOption(option: CountryOption) {\n return (\n <>\n <span className=\"flex min-w-0 items-center gap-2\">\n {option.flag ? (\n <span aria-hidden=\"true\" className=\"text-lg leading-none\">\n {option.flag}\n </span>\n ) : null}\n <span className=\"truncate\">{option.name}</span>\n </span>\n <span className=\"text-xs text-muted-foreground\">+{option.dialCode}</span>\n </>\n )\n}\n"],"mappings":";;;;;AAgBA,IAAae,IAAoBf,EAAMgB,cAA6C,KAAK;AAEzF,SAASC,EAAgBC,GAA4CG,GAA6B;AAChG,KAAI,OAAOH,KAAQ,YAAY;AAC7BA,IAAIG,EAAK;AACT;;AAEF,CAAIH,KAAO,OAAOA,KAAQ,YACxBI,QAAQC,IAAIL,GAAK,WAAWG,EAAK;;AAIrC,IAAaG,KAAmBC,MAAA;CAAA,IAAAC,IAAAC,EAAA,GAAA,EAC9BC,IAAgB5B,EAAK6B,WAAYd,EAAkB,EACnDe,IAAiBF,GAAOpB,qBAAuBiB,EAAKM,KAAKC,OAAMC,GAAAC,GAAAC;AAAA,CAAAT,EAAA,OAAAD,EAAAW,cAC0BH,IAAAP,EAAA,IAAAQ,IAAAR,EAAA,IAAAS,IAAAT,EAAA,OAAzF,iBAAAW,WAAAH,MAAAC,KAAyEV,EAAKW,YAAWV,EAAA,KAAAD,EAAAW,YAAAV,EAAA,KAAAO,GAAAP,EAAA,KAAAQ,GAAAR,EAAA,KAAAS;CAAA,IAAAG;AAAA,CAAAZ,EAAA,OAAAE,GAAAjB,oBAED2B,IAAAZ,EAAA,MAAtFY,IAAAV,GAAOjB,qBAAP4B,GAAsFb,EAAA,KAAAE,GAAAjB,mBAAAe,EAAA,KAAAY;CADxF,IAAAE,IACEF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