@rpcbase/ui 0.282.0 → 0.284.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/index13.js +0 -1
- package/dist/index13.js.map +1 -1
- package/dist/index14.js.map +1 -1
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +45 -37
- package/dist/index16.js.map +1 -1
- package/dist/index182.js +162 -145
- package/dist/index182.js.map +1 -1
- package/dist/index294.js +27 -16
- package/dist/index294.js.map +1 -1
- package/dist/index296.js +83 -56
- package/dist/index296.js.map +1 -1
- package/dist/index298.js.map +1 -1
- package/dist/index299.js +18 -12
- package/dist/index299.js.map +1 -1
- package/dist/index300.js +352 -255
- package/dist/index300.js.map +1 -1
- package/dist/index301.js.map +1 -1
- package/dist/index356.js.map +1 -1
- package/dist/index358.js.map +1 -1
- package/dist/index361.js.map +1 -1
- package/dist/index362.js.map +1 -1
- package/dist/index4.js.map +1 -1
- package/dist/index416.js +62 -40
- package/dist/index416.js.map +1 -1
- package/dist/index417.js.map +1 -1
- package/dist/index419.js.map +1 -1
- package/dist/index420.js.map +1 -1
- package/dist/index421.js.map +1 -1
- package/dist/index6.js.map +1 -1
- package/dist/index7.js +133 -91
- package/dist/index7.js.map +1 -1
- package/dist/index8.js.map +1 -1
- package/dist/index9.js +19 -16
- package/dist/index9.js.map +1 -1
- package/package.json +3 -5
package/dist/index362.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index362.js","names":["candidate","initialState","country","parsed","snapshot","option","a","b","current","event","target","value","nextStart"],"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 placeholder:text-muted-foreground 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,IAAM,IACJ;AAOF,SAAS,EAAyB,GAAe;CAC/C,OAAO,EAAM,QAAQ,GAAiC,EAAE;AAC1D;AAEA,SAAS,EAAe,GAAgB;CACtC,KAAK,IAAM,KAAU,GACnB,IAAI,EAAO,WAAW,CAAM,GAC1B,OAAO,EAAO,MAAM,EAAO,MAAM;CAGrC,OAAO;AACT;AAEA,SAAS,GAAoC,GAAgB;CAC3D,IAAM,IAAY,IAAI,KAChB,EAAE,gBAAa,uBAAoB,EAAoB,CAAS;CAMtE,OAJI,GAAa,QAAQ,KAAK,IACrB,IAGF;AACT;AAEA,SAAS,GAAoC,GAAe;CAC1D,IAAM,IAAU,EAAyB,CAAK,CAAC,CAAC,KAAK;CACrD,IAAI,CAAC,GACH,OAAO;CAGT,IAAI,EAAQ,WAAW,GAAG,GAAG;EAC3B,IAAM,IAAS,EAAe,CAAO;EACrC,IAAI,CAAC,GACH,OAAO;EAGT,IAAM,IAAmB,EAAe,CAAM;EAC9C,OAAO,IAAmB,IAAI,MAAqB;CACrD;CAEA,IAAM,IAAS,EAAe,CAAO;CACrC,IAAI,CAAC,GACH,OAAO;CAGT,IAAM,IAAmB,EAAe,CAAM;CAK9C,OAJI,MAAqB,IAIlB,OAHE,IAAmB,IAAI,MAAqB;AAIvD;AAEA,SAAS,GAA4B,GAAe;CAClD,IAAM,IAAwB,GAAoC,CAAK;CACvE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,IACE,mBACA,+BACR;KACA,cAAY;KACZ,cAAcC,MAAUA,EAAM,eAAe;KAC7C,SAAS;KACT,UAAU;KACA;KAEV,UAAA,kBAAC,QAAD;MAAM,eAAY;MACf,UAAA,KAAgB,KAAa;KAC1B,CAAA;IACA,CAAA,CACL;;GAEJ,KACC,kBAAC,SAAD;IACE,UAAU;IACV,cAAa;IACb,MAAM;IACN,eAAY;IACZ,WAAU;GAA6D,CAAA,IAEvE;GAEJ,kBAAC,OAAD;IACE,WAAU;IACV,OAAO;KACL,eAAe,IAAuB,SAAS;KAC/C,OAAO;IACT;IACA,cAAcA,MAAUA,EAAM,eAAe;IAE5C,UAAA,KACC,kBAAC,GAAkB,UAAnB;KAA4B,OAAO;KACjC,UAAA,kBAAC,IAAD;MACE,GAAI;MACJ,YAAY;MACZ,YAAY;MACZ,SAAS;MACT,OAAO;MACP,YAAY;MACZ,QAAQ;MACR,aAAa;MACb,cAAc;MACd,uBAAuB;MACvB,iBAAiB;MACjB,0BAA0B;MACR;MAClB,cAAc,OAAqB,IAAmB,UAAU;MAChE,UAAU;MACV,iBAAiB,MAAuB;MACxC,aAAY;MACZ,mBAAmB;MACnB,kBACE,aAA2B,EAAiB;KAC7C,CAAA;IAEuB,CAAA,IAC1B;GACD,CAAA;GAEJ;EACE;;AAET,CACF;AAEA,EAAiB,cAAc"}
|
|
1
|
+
{"version":3,"file":"index362.js","names":[],"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 placeholder:text-muted-foreground 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,IAAM,IACJ;AAOF,SAAS,EAAyB,GAAe;CAC/C,OAAO,EAAM,QAAQ,GAAiC,EAAE;AAC1D;AAEA,SAAS,EAAe,GAAgB;CACtC,KAAK,IAAM,KAAU,GACnB,IAAI,EAAO,WAAW,CAAM,GAC1B,OAAO,EAAO,MAAM,EAAO,MAAM;CAGrC,OAAO;AACT;AAEA,SAAS,GAAoC,GAAgB;CAC3D,IAAM,IAAY,IAAI,KAChB,EAAE,gBAAa,uBAAoB,EAAoB,CAAS;CAMtE,OAJI,GAAa,QAAQ,KAAK,IACrB,IAGF;AACT;AAEA,SAAS,GAAoC,GAAe;CAC1D,IAAM,IAAU,EAAyB,CAAK,CAAC,CAAC,KAAK;CACrD,IAAI,CAAC,GACH,OAAO;CAGT,IAAI,EAAQ,WAAW,GAAG,GAAG;EAC3B,IAAM,IAAS,EAAe,CAAO;EACrC,IAAI,CAAC,GACH,OAAO;EAGT,IAAM,IAAmB,EAAe,CAAM;EAC9C,OAAO,IAAmB,IAAI,MAAqB;CACrD;CAEA,IAAM,IAAS,EAAe,CAAO;CACrC,IAAI,CAAC,GACH,OAAO;CAGT,IAAM,IAAmB,EAAe,CAAM;CAK9C,OAJI,MAAqB,IAIlB,OAHE,IAAmB,IAAI,MAAqB;AAIvD;AAEA,SAAS,GAA4B,GAAe;CAClD,IAAM,IAAwB,GAAoC,CAAK;CACvE,IAAI,KAAyB,MAC3B,OAAO;CAGT,IAAM,IAAU,EAAyB,CAAK,CAAC,CAAC,KAAK,GAC/C,IAAS,EAAe,CAAO;CAKrC,OAJ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A,IACC;GAEJ,kBAAC,OAAD;IACE,WAAU;IACV,OAAO;KACL,eAAe,IAAuB,SAAS;KAC/C,OAAO;IACT;IACA,cAAc,MAAU,EAAM,eAAe;IAE5C,UAAA,KACC,kBAAC,GAAkB,UAAnB;KAA4B,OAAO;KACjC,UAAA,kBAAC,IAAD;MACE,GAAI;MACJ,YAAY;MACZ,YAAY;MACZ,SAAS;MACT,OAAO;MACP,YAAY;MACZ,QAAQ;MACR,aAAa;MACb,cAAc;MACd,uBAAuB;MACvB,iBAAiB;MACjB,0BAA0B;MACR;MAClB,cAAc,OAAqB,IAAmB,UAAU;MAChE,UAAU;MACV,iBAAiB,MAAuB;MACxC,aAAY;MACZ,mBAAmB;MACnB,kBACE,aAA2B,EAAiB;KAE/C,CAAA;IACyB,CAAA,IAC1B;GACD,CAAA;GAEJ;EACE;;AAET,CACF;AAEA,EAAiB,cAAc"}
|
package/dist/index4.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index4.js","names":[],"sources":["../src/helpers/useIsTouchDevice.ts"],"sourcesContent":["import { useEffect, useState } from \"react\"\n\n\nconst TOUCH_MEDIA_QUERY = \"(pointer: coarse)\"\n\nexport function useIsTouchDevice() {\n const [isTouchDevice, setIsTouchDevice] = useState(false)\n\n // React Compiler rejects hook aliasing (useIsomorphicLayoutEffect pattern), so we keep\n // a direct hook call and guard browser-only logic inside the effect.\n useEffect(() => {\n if (typeof window === \"undefined\") {\n return\n }\n\n const mediaQuery =\n typeof window.matchMedia === \"function\" ? window.matchMedia(TOUCH_MEDIA_QUERY) : undefined\n\n const getHasTouchSupport = () => {\n if (typeof window === \"undefined\") {\n return false\n }\n\n const mqMatches = mediaQuery?.matches ?? false\n const nav = typeof navigator !== \"undefined\" ? navigator : undefined\n const maxTouchPoints = nav?.maxTouchPoints ?? 0\n const msMaxTouchPoints = (nav as unknown as { msMaxTouchPoints?: number })?.msMaxTouchPoints ?? 0\n\n return mqMatches || maxTouchPoints > 0 || msMaxTouchPoints > 0\n }\n\n const updateIsTouchDevice = () => {\n setIsTouchDevice(getHasTouchSupport())\n }\n\n updateIsTouchDevice()\n\n if (!mediaQuery) {\n return\n }\n\n if (typeof mediaQuery.addEventListener === \"function\") {\n mediaQuery.addEventListener(\"change\", updateIsTouchDevice)\n return () => mediaQuery.removeEventListener(\"change\", updateIsTouchDevice)\n }\n\n if (typeof mediaQuery.addListener === \"function\") {\n mediaQuery.addListener(updateIsTouchDevice)\n return () => mediaQuery.removeListener(updateIsTouchDevice)\n }\n }, [])\n\n return isTouchDevice\n}\n"],"mappings":";;;AAGA,IAAM,IAAoB;AAE1B,
|
|
1
|
+
{"version":3,"file":"index4.js","names":["() => {\n if (typeof window === \"undefined\") {\n return\n }\n\n const mediaQuery =\n typeof window.matchMedia === \"function\" ? window.matchMedia(TOUCH_MEDIA_QUERY) : undefined\n\n const getHasTouchSupport = () => {\n if (typeof window === \"undefined\") {\n return false\n }\n\n const mqMatches = mediaQuery?.matches ?? false\n const nav = typeof navigator !== \"undefined\" ? navigator : undefined\n const maxTouchPoints = nav?.maxTouchPoints ?? 0\n const msMaxTouchPoints = (nav as unknown as { msMaxTouchPoints?: number })?.msMaxTouchPoints ?? 0\n\n return mqMatches || maxTouchPoints > 0 || msMaxTouchPoints > 0\n }\n\n const updateIsTouchDevice = () => {\n setIsTouchDevice(getHasTouchSupport())\n }\n\n updateIsTouchDevice()\n\n if (!mediaQuery) {\n return\n }\n\n if (typeof mediaQuery.addEventListener === \"function\") {\n mediaQuery.addEventListener(\"change\", updateIsTouchDevice)\n return () => mediaQuery.removeEventListener(\"change\", updateIsTouchDevice)\n }\n\n if (typeof mediaQuery.addListener === \"function\") {\n mediaQuery.addListener(updateIsTouchDevice)\n return () => mediaQuery.removeListener(updateIsTouchDevice)\n }\n }","[]"],"sources":["../src/helpers/useIsTouchDevice.ts"],"sourcesContent":["import { useEffect, useState } from \"react\"\n\n\nconst TOUCH_MEDIA_QUERY = \"(pointer: coarse)\"\n\nexport function useIsTouchDevice() {\n const [isTouchDevice, setIsTouchDevice] = useState(false)\n\n // React Compiler rejects hook aliasing (useIsomorphicLayoutEffect pattern), so we keep\n // a direct hook call and guard browser-only logic inside the effect.\n useEffect(() => {\n if (typeof window === \"undefined\") {\n return\n }\n\n const mediaQuery =\n typeof window.matchMedia === \"function\" ? window.matchMedia(TOUCH_MEDIA_QUERY) : undefined\n\n const getHasTouchSupport = () => {\n if (typeof window === \"undefined\") {\n return false\n }\n\n const mqMatches = mediaQuery?.matches ?? false\n const nav = typeof navigator !== \"undefined\" ? navigator : undefined\n const maxTouchPoints = nav?.maxTouchPoints ?? 0\n const msMaxTouchPoints = (nav as unknown as { msMaxTouchPoints?: number })?.msMaxTouchPoints ?? 0\n\n return mqMatches || maxTouchPoints > 0 || msMaxTouchPoints > 0\n }\n\n const updateIsTouchDevice = () => {\n setIsTouchDevice(getHasTouchSupport())\n }\n\n updateIsTouchDevice()\n\n if (!mediaQuery) {\n return\n }\n\n if (typeof mediaQuery.addEventListener === \"function\") {\n mediaQuery.addEventListener(\"change\", updateIsTouchDevice)\n return () => mediaQuery.removeEventListener(\"change\", updateIsTouchDevice)\n }\n\n if (typeof mediaQuery.addListener === \"function\") {\n mediaQuery.addListener(updateIsTouchDevice)\n return () => mediaQuery.removeListener(updateIsTouchDevice)\n }\n }, [])\n\n return isTouchDevice\n}\n"],"mappings":";;;AAGA,IAAM,IAAoB;AAE1B,SAAgB,IAAmB;eAC3B,CAAC,GAAe,KAAoB,EAAS,EAAK,GAI9CA,GAwCPC;CAEH,2DA1CU,UAAM;EACd,IAAI,OAAO,SAAW,KACpB;EAGF,IAAM,IACJ,OAAO,OAAO,cAAe,aAAa,OAAO,WAAW,CAAiB,IAAI,KAAA,GAE7E,UAA2B;GAC/B,IAAI,OAAO,SAAW,KACpB,OAAO;GAGT,IAAM,IAAY,GAAY,WAAW,IACnC,IAAM,OAAO,YAAc,MAAc,YAAY,KAAA,GACrD,IAAiB,GAAK,kBAAkB,GACxC,IAAoB,GAAkD,oBAAoB;GAEhG,OAAO,KAAa,IAAiB,KAAK,IAAmB;EAC/D,GAEM,UAA4B;GAChC,EAAiB,EAAmB,CAAC;EACvC;EAEA,MAAoB,GAEf,GAIL;OAAI,OAAO,EAAW,oBAAqB,YAEzC,OADA,EAAW,iBAAiB,UAAU,CAAmB,SAC5C,EAAW,oBAAoB,UAAU,CAAmB;GAG3E,IAAI,OAAO,EAAW,eAAgB,YAEpC,OADA,EAAW,YAAY,CAAmB,SAC7B,EAAW,eAAe,CAAmB;EAJ5D;CAMF,GAAG,IAAA,CAAC,+CAxCJ,EAAUD,GAwCPC,CAAE,GAEE;AACT"}
|
package/dist/index416.js
CHANGED
|
@@ -191,24 +191,28 @@ var A = g.forwardRef((e, t) => {
|
|
|
191
191
|
}), n[4] = r, n[5] = i, n[6] = t, n[7] = o) : o = n[7], o;
|
|
192
192
|
});
|
|
193
193
|
A.displayName = "SelectScrollDownButton";
|
|
194
|
-
var j = g.forwardRef((
|
|
195
|
-
let
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
194
|
+
var j = g.forwardRef((t, n) => {
|
|
195
|
+
let r = h(43), i, l, u, d, f, p, m, _, v, y;
|
|
196
|
+
r[0] === t ? (i = r[1], l = r[2], u = r[3], d = r[4], f = r[5], p = r[6], m = r[7], _ = r[8], v = r[9], y = r[10]) : ({className: d, children: u, position: p, side: m, sideOffset: _, align: v, alignOffset: y, alignItemWithTrigger: i, autoScroll: l, ...f} = t, r[0] = t, r[1] = i, r[2] = l, r[3] = u, r[4] = d, r[5] = f, r[6] = p, r[7] = m, r[8] = _, r[9] = v, r[10] = y);
|
|
197
|
+
let S = p === void 0 ? "popper" : p, C = m === void 0 ? "bottom" : m, w = _ === void 0 ? 4 : _, T = v === void 0 ? "center" : v, E = y === void 0 ? 0 : y, O = i ?? S === "item-aligned", [j, M] = g.useState(null), N;
|
|
198
|
+
r[11] === Symbol.for("react.memo_cache_sentinel") ? (N = (e) => {
|
|
199
|
+
M(e);
|
|
200
|
+
}, r[11] = N) : N = r[11];
|
|
201
|
+
let P = N, F, I;
|
|
202
|
+
r[12] !== l || r[13] !== j ? (F = () => {
|
|
203
|
+
if (!j || !l) return;
|
|
200
204
|
let e = requestAnimationFrame(() => {
|
|
201
|
-
let e =
|
|
205
|
+
let e = j.querySelector("[role=\"option\"][data-selected]");
|
|
202
206
|
if (e instanceof HTMLElement) {
|
|
203
207
|
let t = e.offsetTop - 8, n = e.offsetTop + e.offsetHeight + 8;
|
|
204
|
-
if (t <
|
|
205
|
-
|
|
208
|
+
if (t < j.scrollTop) {
|
|
209
|
+
j.scrollTo({ top: Math.max(0, t) });
|
|
206
210
|
return;
|
|
207
211
|
}
|
|
208
|
-
n >
|
|
212
|
+
n > j.scrollTop + j.clientHeight && j.scrollTo({ top: Math.max(0, n - j.clientHeight) });
|
|
209
213
|
return;
|
|
210
214
|
}
|
|
211
|
-
let t = Array.from(
|
|
215
|
+
let t = Array.from(j.querySelectorAll("[role=\"option\"]"));
|
|
212
216
|
if (!t.length) return;
|
|
213
217
|
let n, r;
|
|
214
218
|
for (let e of t) {
|
|
@@ -219,38 +223,56 @@ var j = g.forwardRef(({ className: t, children: n, position: r = "popper", side:
|
|
|
219
223
|
r = e;
|
|
220
224
|
}
|
|
221
225
|
if (!n) return;
|
|
222
|
-
let i = Math.max(0, (
|
|
223
|
-
|
|
226
|
+
let i = Math.max(0, (l === "firstEnabledWithContext" && r ? r : n).offsetTop - 8);
|
|
227
|
+
j.scrollTo({ top: i });
|
|
224
228
|
});
|
|
225
229
|
return () => cancelAnimationFrame(e);
|
|
226
|
-
}, [
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
}, I = [j, l], r[12] = l, r[13] = j, r[14] = F, r[15] = I) : (F = r[14], I = r[15]), g.useEffect(F, I);
|
|
231
|
+
let L = S === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", R;
|
|
232
|
+
r[16] !== d || r[17] !== L ? (R = e("relative z-[60] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", L, d), r[16] = d, r[17] = L, r[18] = R) : R = r[18];
|
|
233
|
+
let z;
|
|
234
|
+
r[19] === j ? z = r[20] : (z = {
|
|
235
|
+
viewport: j,
|
|
236
|
+
setViewport: M
|
|
237
|
+
}, r[19] = j, r[20] = z);
|
|
238
|
+
let B;
|
|
239
|
+
r[21] === Symbol.for("react.memo_cache_sentinel") ? (B = /* @__PURE__ */ b(k, {}), r[21] = B) : B = r[21];
|
|
240
|
+
let V = S === "popper" && "w-full min-w-[var(--anchor-width)]", H;
|
|
241
|
+
r[22] === V ? H = r[23] : (H = e("max-h-96 overflow-y-auto p-1", V), r[22] = V, r[23] = H);
|
|
242
|
+
let U;
|
|
243
|
+
r[24] !== u || r[25] !== H ? (U = /* @__PURE__ */ b(c, {
|
|
244
|
+
ref: P,
|
|
245
|
+
className: H,
|
|
246
|
+
children: u
|
|
247
|
+
}), r[24] = u, r[25] = H, r[26] = U) : U = r[26];
|
|
248
|
+
let W;
|
|
249
|
+
r[27] === Symbol.for("react.memo_cache_sentinel") ? (W = /* @__PURE__ */ b(A, {}), r[27] = W) : W = r[27];
|
|
250
|
+
let G;
|
|
251
|
+
r[28] !== z || r[29] !== U ? (G = /* @__PURE__ */ x(D.Provider, {
|
|
252
|
+
value: z,
|
|
253
|
+
children: [
|
|
254
|
+
B,
|
|
255
|
+
U,
|
|
256
|
+
W
|
|
257
|
+
]
|
|
258
|
+
}), r[28] = z, r[29] = U, r[30] = G) : G = r[30];
|
|
259
|
+
let K;
|
|
260
|
+
r[31] !== f || r[32] !== n || r[33] !== R || r[34] !== G ? (K = /* @__PURE__ */ b(s, {
|
|
261
|
+
ref: n,
|
|
262
|
+
className: R,
|
|
263
|
+
...f,
|
|
264
|
+
children: G
|
|
265
|
+
}), r[31] = f, r[32] = n, r[33] = R, r[34] = G, r[35] = K) : K = r[35];
|
|
266
|
+
let q;
|
|
267
|
+
return r[36] !== T || r[37] !== E || r[38] !== O || r[39] !== C || r[40] !== w || r[41] !== K ? (q = /* @__PURE__ */ b(a, { children: /* @__PURE__ */ b(o, {
|
|
268
|
+
side: C,
|
|
269
|
+
sideOffset: w,
|
|
270
|
+
align: T,
|
|
271
|
+
alignOffset: E,
|
|
272
|
+
alignItemWithTrigger: O,
|
|
232
273
|
className: "isolate z-[60]",
|
|
233
|
-
children:
|
|
234
|
-
|
|
235
|
-
className: e("relative z-[60] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", r === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", t),
|
|
236
|
-
...m,
|
|
237
|
-
children: /* @__PURE__ */ x(D.Provider, {
|
|
238
|
-
value: {
|
|
239
|
-
viewport: v,
|
|
240
|
-
setViewport: y
|
|
241
|
-
},
|
|
242
|
-
children: [
|
|
243
|
-
/* @__PURE__ */ b(k, {}),
|
|
244
|
-
/* @__PURE__ */ b(c, {
|
|
245
|
-
ref: S,
|
|
246
|
-
className: e("max-h-96 overflow-y-auto p-1", r === "popper" && "w-full min-w-[var(--anchor-width)]"),
|
|
247
|
-
children: n
|
|
248
|
-
}),
|
|
249
|
-
/* @__PURE__ */ b(A, {})
|
|
250
|
-
]
|
|
251
|
-
})
|
|
252
|
-
})
|
|
253
|
-
}) });
|
|
274
|
+
children: K
|
|
275
|
+
}) }), r[36] = T, r[37] = E, r[38] = O, r[39] = C, r[40] = w, r[41] = K, r[42] = q) : q = r[42], q;
|
|
254
276
|
});
|
|
255
277
|
j.displayName = "SelectContent";
|
|
256
278
|
var M = g.forwardRef((t, n) => {
|
package/dist/index416.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index416.js","names":["children","ref","tolerance","e","className"],"sources":["../src/components/Select/index.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { Check, ChevronDown, ChevronUp } from \"lucide-react\"\nimport { Select as SelectPrimitive } from \"@base-ui/react/select\"\n\nimport { cn } from \"@/lib/utils\"\n\n\ntype SelectProps = React.ComponentProps<typeof SelectPrimitive.Root>\n\nfunction collectSelectItems(children: React.ReactNode) {\n const items: Array<{ label: React.ReactNode; value: unknown }> = []\n\n React.Children.forEach(children, child => {\n if (!React.isValidElement(child)) return\n\n const props = child.props as {\n children?: React.ReactNode\n value?: unknown\n }\n\n if (child.type === SelectItem && \"value\" in props) {\n items.push({ label: props.children, value: props.value })\n }\n\n if (props.children) {\n items.push(...collectSelectItems(props.children))\n }\n })\n\n return items\n}\n\nconst Select = ({ children, items, ...props }: SelectProps) => {\n const inferredItems = items == null ? collectSelectItems(children) : undefined\n\n return (\n <div className=\"contents\">\n <SelectPrimitive.Root\n items={items ?? (inferredItems && inferredItems.length > 0 ? inferredItems : undefined)}\n {...props}\n >\n {children}\n </SelectPrimitive.Root>\n </div>\n )\n}\nSelect.displayName = \"Select\"\n\nconst SelectGroup = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Group>,\n SelectPrimitive.Group.Props\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Group ref={ref} className={cn(className)} {...props} />\n))\nSelectGroup.displayName = \"SelectGroup\"\n\nconst SelectValue = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Value>,\n SelectPrimitive.Value.Props\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Value ref={ref} className={cn(className)} {...props} />\n))\nSelectValue.displayName = \"SelectValue\"\n\n\nconst SelectTrigger = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Trigger>,\n SelectPrimitive.Trigger.Props\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1\",\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon render={<ChevronDown className=\"h-4 w-4 opacity-50\" />} />\n </SelectPrimitive.Trigger>\n))\nSelectTrigger.displayName = \"SelectTrigger\"\n\nconst ScrollContext = React.createContext<{\n viewport: HTMLElement | null\n setViewport: (vp: HTMLElement | null) => void\n } | null>(null)\n\ninterface ScrollButtonImplProps extends React.HTMLAttributes<HTMLDivElement> {\n direction: \"up\" | \"down\"\n speed?: number\n}\n\nconst ScrollButtonImpl = React.forwardRef<HTMLDivElement, ScrollButtonImplProps>(\n ({ direction, speed = 400, className, children, ...rest }, ref) => {\n const scrollContext = React.useContext(ScrollContext)\n const [disabled, setDisabled] = React.useState(true)\n const animationRef = React.useRef<number | undefined>(undefined)\n const lastTimeRef = React.useRef<number | undefined>(undefined)\n const isScrollingRef = React.useRef(false)\n\n const viewport = scrollContext?.viewport\n\n const checkScrollability = React.useCallback(() => {\n if (!viewport) {\n setDisabled(true)\n return\n }\n\n const { scrollTop, scrollHeight, clientHeight } = viewport\n const tolerance = 2\n\n const canScrollUp = scrollTop > tolerance\n const canScrollDown = scrollTop < (scrollHeight - clientHeight - tolerance)\n const hasScrollableContent = scrollHeight > clientHeight + tolerance\n\n if (!hasScrollableContent) {\n setDisabled(true)\n return\n }\n\n const shouldDisable = direction === \"up\" ? !canScrollUp : !canScrollDown\n setDisabled(shouldDisable)\n }, [viewport, direction])\n\n React.useEffect(() => {\n if (!viewport) return\n\n checkScrollability()\n\n const handleScroll = () => checkScrollability()\n const handleResize = () => checkScrollability()\n\n viewport.addEventListener(\"scroll\", handleScroll, { passive: true })\n\n const resizeObserver = new ResizeObserver(handleResize)\n resizeObserver.observe(viewport)\n\n const mutationObserver = new MutationObserver(handleResize)\n mutationObserver.observe(viewport, { childList: true, subtree: true })\n\n return () => {\n viewport.removeEventListener(\"scroll\", handleScroll)\n resizeObserver.disconnect()\n mutationObserver.disconnect()\n }\n }, [viewport, checkScrollability])\n\n const stopScrolling = React.useCallback(() => {\n if (animationRef.current) {\n cancelAnimationFrame(animationRef.current)\n animationRef.current = undefined\n }\n isScrollingRef.current = false\n lastTimeRef.current = undefined\n }, [])\n\n const smoothScroll = React.useCallback(\n (currentTime: number) => {\n if (!viewport || disabled || !isScrollingRef.current) {\n stopScrolling()\n return\n }\n\n if (!lastTimeRef.current) {\n lastTimeRef.current = currentTime\n }\n\n const deltaTime = currentTime - lastTimeRef.current\n const distance = (speed * deltaTime) / 1000\n\n if (distance < 0.1) {\n animationRef.current = requestAnimationFrame(smoothScroll)\n return\n }\n\n const oldScrollTop = viewport.scrollTop\n const maxScroll = viewport.scrollHeight - viewport.clientHeight\n\n let newScrollTop: number\n if (direction === \"up\") {\n newScrollTop = Math.max(0, oldScrollTop - distance)\n } else {\n newScrollTop = Math.min(maxScroll, oldScrollTop + distance)\n }\n\n viewport.scrollTo({ top: newScrollTop })\n\n lastTimeRef.current = currentTime\n\n const tolerance = 1\n const canContinue =\n direction === \"up\"\n ? newScrollTop > tolerance\n : newScrollTop < (maxScroll - tolerance)\n\n if (canContinue && Math.abs(newScrollTop - oldScrollTop) > 0.01) {\n animationRef.current = requestAnimationFrame(smoothScroll)\n } else {\n stopScrolling()\n setTimeout(checkScrollability, 16)\n }\n },\n [viewport, disabled, direction, speed, stopScrolling, checkScrollability],\n )\n\n const startScrolling = React.useCallback(() => {\n if (disabled || !viewport || isScrollingRef.current) return\n\n isScrollingRef.current = true\n lastTimeRef.current = undefined\n animationRef.current = requestAnimationFrame(smoothScroll)\n }, [disabled, viewport, smoothScroll])\n\n React.useEffect(() => {\n return () => stopScrolling()\n }, [stopScrolling])\n\n return (\n <div\n {...rest}\n ref={ref}\n className={cn(\n \"flex items-center justify-center py-1 select-none\",\n disabled ? \"cursor-default opacity-40\" : \"cursor-pointer opacity-100 hover:bg-accent/20\",\n className\n )}\n onPointerEnter={e => {\n rest.onPointerEnter?.(e)\n if (!disabled) startScrolling()\n }}\n onPointerMove={e => {\n rest.onPointerMove?.(e)\n if (!disabled && !isScrollingRef.current) startScrolling()\n }}\n onPointerLeave={e => {\n rest.onPointerLeave?.(e)\n stopScrolling()\n }}\n >\n {children}\n </div>\n )\n }\n)\nScrollButtonImpl.displayName = \"ScrollButtonImpl\"\n\nconst SelectScrollUpButton = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <ScrollButtonImpl ref={ref} direction=\"up\" className={className} {...props}>\n <ChevronUp className=\"h-4 w-4\" />\n </ScrollButtonImpl>\n))\nSelectScrollUpButton.displayName = \"SelectScrollUpButton\"\n\nconst SelectScrollDownButton = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <ScrollButtonImpl ref={ref} direction=\"down\" className={className} {...props}>\n <ChevronDown className=\"h-4 w-4\" />\n </ScrollButtonImpl>\n))\nSelectScrollDownButton.displayName = \"SelectScrollDownButton\"\n\ntype SelectContentProps = SelectPrimitive.Popup.Props &\n Pick<SelectPrimitive.Positioner.Props, \"align\" | \"alignOffset\" | \"side\" | \"sideOffset\" | \"alignItemWithTrigger\"> & {\n position?: \"item-aligned\" | \"popper\"\n autoScroll?: \"firstEnabled\" | \"firstEnabledWithContext\"\n }\n\nconst SelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Popup>,\n SelectContentProps\n>(({ className, children, position = \"popper\", side = \"bottom\", sideOffset = 4, align = \"center\", alignOffset = 0, alignItemWithTrigger, autoScroll, ...props }, ref) => {\n const resolvedAlignItemWithTrigger = alignItemWithTrigger ?? position === \"item-aligned\"\n const [viewport, setViewport] = React.useState<HTMLElement | null>(null)\n const viewportRef = React.useCallback((node: HTMLElement | null) => {\n setViewport(node)\n }, [])\n\n React.useEffect(() => {\n if (!viewport || !autoScroll) return\n\n const run = () => {\n const selected = viewport.querySelector(\"[role=\\\"option\\\"][data-selected]\")\n if (selected instanceof HTMLElement) {\n const padding = 8\n const targetTop = selected.offsetTop - padding\n const targetBottom = selected.offsetTop + selected.offsetHeight + padding\n\n if (targetTop < viewport.scrollTop) {\n viewport.scrollTo({ top: Math.max(0, targetTop) })\n return\n }\n\n const viewportBottom = viewport.scrollTop + viewport.clientHeight\n if (targetBottom > viewportBottom) {\n viewport.scrollTo({ top: Math.max(0, targetBottom - viewport.clientHeight) })\n }\n return\n }\n\n const all = Array.from(\n viewport.querySelectorAll(\"[role=\\\"option\\\"]\")\n ) as HTMLElement[]\n if (!all.length) return\n\n let firstEnabled: HTMLElement | undefined\n let lastDisabledBefore: HTMLElement | undefined\n for (const el of all) {\n const isDisabled = el.hasAttribute(\"data-disabled\")\n if (!isDisabled) {\n firstEnabled = el\n break\n }\n lastDisabledBefore = el\n }\n\n if (!firstEnabled) return\n\n const target =\n autoScroll === \"firstEnabledWithContext\" && lastDisabledBefore\n ? lastDisabledBefore\n : firstEnabled\n\n const offset = Math.max(0, target.offsetTop - 8)\n viewport.scrollTo({ top: offset })\n }\n\n const raf = requestAnimationFrame(run)\n return () => cancelAnimationFrame(raf)\n }, [viewport, autoScroll])\n\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n alignItemWithTrigger={resolvedAlignItemWithTrigger}\n className=\"isolate z-[60]\"\n >\n <SelectPrimitive.Popup\n ref={ref}\n className={cn(\n \"relative z-[60] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n className\n )}\n {...props}\n >\n <ScrollContext.Provider value={{ viewport, setViewport }}>\n <SelectScrollUpButton />\n <SelectPrimitive.List\n ref={viewportRef}\n className={cn(\n \"max-h-96 overflow-y-auto p-1\",\n position === \"popper\" && \"w-full min-w-[var(--anchor-width)]\"\n )}\n >\n {children}\n </SelectPrimitive.List>\n <SelectScrollDownButton />\n </ScrollContext.Provider>\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n )\n})\nSelectContent.displayName = \"SelectContent\"\n\nconst SelectLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.GroupLabel>,\n SelectPrimitive.GroupLabel.Props\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.GroupLabel\n ref={ref}\n className={cn(\"py-1.5 pl-8 pr-2 text-sm font-semibold\", className)}\n {...props}\n />\n))\nSelectLabel.displayName = \"SelectLabel\"\n\nconst SelectItem = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Item>,\n SelectPrimitive.Item.Props\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n))\nSelectItem.displayName = \"SelectItem\"\n\nconst SelectSeparator = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Separator>,\n SelectPrimitive.Separator.Props\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n))\nSelectSeparator.displayName = \"SelectSeparator\"\n\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,SAAS,EAAmB,GAA2B;CACrD,IAAM,IAA2D,CAAA;CAmBjE,OAjBA,EAAM,SAAS,QAAQ,IAAU,MAAS;EACxC,IAAI,CAAC,EAAM,eAAe,CAAK,GAAG;EAElC,IAAM,IAAQ,EAAM;EASpB,AAJI,EAAM,SAAS,KAAc,WAAW,KAC1C,EAAM,KAAK;GAAE,OAAO,EAAM;GAAU,OAAO,EAAM;EAAM,CAAC,GAGtD,EAAM,YACR,EAAM,KAAK,GAAG,EAAmB,EAAM,QAAQ,CAAC;CAEpD,CAAC,GAEM;AACT;AAEA,IAAM,KAAS,MAAA;CAAA,IAAA,IAAA,EAAA,EAAA,GAAA,GAAA,GAAA;CAAA,AAAA,EAAA,OAAA,KAA2C,IAAA,EAAA,IAAA,IAAA,EAAA,IAAA,IAAA,EAAA,OAA1C,wBAAA,GAAA,KAAA,GAA0C,EAAA,KAAA,GAAA,EAAA,KAAA,GAAA,EAAA,KAAA,GAAA,EAAA,KAAA;CAAA,IAAA;CAAA,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A,GAAA,EAAA,MAAA,KAAA,IAAA,EAAA,KAdvB;AAcuB,CACxB;AACD,EAAW,cAAc;AAEzB,IAAM,IAAkB,EAAM,YAG5B,GAAA,MAAA;CAAA,IAAA,IAAA,EAAA,CAAA,GAAA,GAAA;CAAA,AAAA,EAAA,OAAA,KAAwB,IAAA,EAAA,IAAA,IAAA,EAAA,OAAvB,eAAA,GAAA,KAAA,GAAuB,EAAA,KAAA,GAAA,EAAA,KAAA,GAAA,EAAA,KAAA;CAAA,IAAA;CAAA,AAAA,EAAA,OAAA,IAG8B,IAAA,EAAA,MAAzC,IAAA,EAAG,4BAA4B,CAAS,GAAC,EAAA,KAAA,GAAA,EAAA,KAAA;CAAA,IAAA;CAEpD,OAFoD,EAAA,OAAA,KAAA,EAAA,OAAA,KAAA,EAAA,OAAA,KAFtD,IAAA,kBAAA,GAAA;EACO;EACM,WAAA;EAAyC,GAChD;CAAK,CAAA,GACT,EAAA,KAAA,GAAA,EAAA,KAAA,GAAA,EAAA,KAAA,GAAA,EAAA,KAAA,KAAA,IAAA,EAAA,IAJF;AAIE,CACH;AACD,EAAgB,cAAc"}
|
|
1
|
+
{"version":3,"file":"index416.js","names":["{ children, items, ...props }: SelectProps","items == null ? collectSelectItems(children) : undefined","<div className=\"contents\">\n <SelectPrimitive.Root\n items={items ?? (inferredItems && inferredItems.length > 0 ? inferredItems : undefined)}\n {...props}\n >\n {children}\n </SelectPrimitive.Root>\n </div>","items ?? (inferredItems && inferredItems.length > 0 ? inferredItems : undefined)","SelectPrimitive.Root","{ className, ...props }","cn(className)","<SelectPrimitive.Group ref={ref} className={cn(className)} {...props} />","SelectPrimitive.Group","<SelectPrimitive.Value ref={ref} className={cn(className)} {...props} />","SelectPrimitive.Value","{ className, children, ...props }","cn(\n \"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1\",\n className\n )","<SelectPrimitive.Icon render={<ChevronDown className=\"h-4 w-4 opacity-50\" />} />","SelectPrimitive.Icon","<SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1\",\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon render={<ChevronDown className=\"h-4 w-4 opacity-50\" />} />\n </SelectPrimitive.Trigger>","SelectPrimitive.Trigger","<ChevronUp className=\"h-4 w-4\" />","<ScrollButtonImpl ref={ref} direction=\"up\" className={className} {...props}>\n <ChevronUp className=\"h-4 w-4\" />\n </ScrollButtonImpl>","<ChevronDown className=\"h-4 w-4\" />","<ScrollButtonImpl ref={ref} direction=\"down\" className={className} {...props}>\n <ChevronDown className=\"h-4 w-4\" />\n </ScrollButtonImpl>","position = \"popper\"","side = \"bottom\"","sideOffset = 4","align = \"center\"","alignOffset = 0","{ className, children, position = \"popper\", side = \"bottom\", sideOffset = 4, align = \"center\", alignOffset = 0, alignItemWithTrigger, autoScroll, ...props }","(node: HTMLElement | null) => {\n setViewport(node)\n }","React.useCallback((node: HTMLElement | null) => {\n setViewport(node)\n }, [])","() => {\n if (!viewport || !autoScroll) return\n\n const run = () => {\n const selected = viewport.querySelector(\"[role=\\\"option\\\"][data-selected]\")\n if (selected instanceof HTMLElement) {\n const padding = 8\n const targetTop = selected.offsetTop - padding\n const targetBottom = selected.offsetTop + selected.offsetHeight + padding\n\n if (targetTop < viewport.scrollTop) {\n viewport.scrollTo({ top: Math.max(0, targetTop) })\n return\n }\n\n const viewportBottom = viewport.scrollTop + viewport.clientHeight\n if (targetBottom > viewportBottom) {\n viewport.scrollTo({ top: Math.max(0, targetBottom - viewport.clientHeight) })\n }\n return\n }\n\n const all = Array.from(\n viewport.querySelectorAll(\"[role=\\\"option\\\"]\")\n ) as HTMLElement[]\n if (!all.length) return\n\n let firstEnabled: HTMLElement | undefined\n let lastDisabledBefore: HTMLElement | undefined\n for (const el of all) {\n const isDisabled = el.hasAttribute(\"data-disabled\")\n if (!isDisabled) {\n firstEnabled = el\n break\n }\n lastDisabledBefore = el\n }\n\n if (!firstEnabled) return\n\n const target =\n autoScroll === \"firstEnabledWithContext\" && lastDisabledBefore\n ? lastDisabledBefore\n : firstEnabled\n\n const offset = Math.max(0, target.offsetTop - 8)\n viewport.scrollTo({ top: offset })\n }\n\n const raf = requestAnimationFrame(run)\n return () => cancelAnimationFrame(raf)\n }","[viewport, autoScroll]","cn(\n \"relative z-[60] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n className\n )","position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\"","{ viewport, setViewport }","<SelectScrollUpButton />","cn(\n \"max-h-96 overflow-y-auto p-1\",\n position === \"popper\" && \"w-full min-w-[var(--anchor-width)]\"\n )","position === \"popper\" && \"w-full min-w-[var(--anchor-width)]\"","<SelectPrimitive.List\n ref={viewportRef}\n className={cn(\n \"max-h-96 overflow-y-auto p-1\",\n position === \"popper\" && \"w-full min-w-[var(--anchor-width)]\"\n )}\n >\n {children}\n </SelectPrimitive.List>","SelectPrimitive.List","<SelectScrollDownButton />","<ScrollContext.Provider value={{ viewport, setViewport }}>\n <SelectScrollUpButton />\n <SelectPrimitive.List\n ref={viewportRef}\n className={cn(\n \"max-h-96 overflow-y-auto p-1\",\n position === \"popper\" && \"w-full min-w-[var(--anchor-width)]\"\n )}\n >\n {children}\n </SelectPrimitive.List>\n <SelectScrollDownButton />\n </ScrollContext.Provider>","ScrollContext.Provider","<SelectPrimitive.Popup\n ref={ref}\n className={cn(\n \"relative z-[60] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n className\n )}\n {...props}\n >\n <ScrollContext.Provider value={{ viewport, setViewport }}>\n <SelectScrollUpButton />\n <SelectPrimitive.List\n ref={viewportRef}\n className={cn(\n \"max-h-96 overflow-y-auto p-1\",\n position === \"popper\" && \"w-full min-w-[var(--anchor-width)]\"\n )}\n >\n {children}\n </SelectPrimitive.List>\n <SelectScrollDownButton />\n </ScrollContext.Provider>\n </SelectPrimitive.Popup>","SelectPrimitive.Popup","<SelectPrimitive.Portal>\n <SelectPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n alignItemWithTrigger={resolvedAlignItemWithTrigger}\n className=\"isolate z-[60]\"\n >\n <SelectPrimitive.Popup\n ref={ref}\n className={cn(\n \"relative z-[60] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n className\n )}\n {...props}\n >\n <ScrollContext.Provider value={{ viewport, setViewport }}>\n <SelectScrollUpButton />\n <SelectPrimitive.List\n ref={viewportRef}\n className={cn(\n \"max-h-96 overflow-y-auto p-1\",\n position === \"popper\" && \"w-full min-w-[var(--anchor-width)]\"\n )}\n >\n {children}\n </SelectPrimitive.List>\n <SelectScrollDownButton />\n </ScrollContext.Provider>\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>","SelectPrimitive.Portal","SelectPrimitive.Positioner","cn(\"py-1.5 pl-8 pr-2 text-sm font-semibold\", className)","<SelectPrimitive.GroupLabel\n ref={ref}\n className={cn(\"py-1.5 pl-8 pr-2 text-sm font-semibold\", className)}\n {...props}\n />","SelectPrimitive.GroupLabel","cn(\n \"relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50\",\n className\n )","<span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>","SelectPrimitive.ItemIndicator","<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>","SelectPrimitive.ItemText","<SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>","SelectPrimitive.Item","cn(\"-mx-1 my-1 h-px bg-muted\", className)","<SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />","SelectPrimitive.Separator"],"sources":["../src/components/Select/index.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { Check, ChevronDown, ChevronUp } from \"lucide-react\"\nimport { Select as SelectPrimitive } from \"@base-ui/react/select\"\n\nimport { cn } from \"@/lib/utils\"\n\n\ntype SelectProps = React.ComponentProps<typeof SelectPrimitive.Root>\n\nfunction collectSelectItems(children: React.ReactNode) {\n const items: Array<{ label: React.ReactNode; value: unknown }> = []\n\n React.Children.forEach(children, child => {\n if (!React.isValidElement(child)) return\n\n const props = child.props as {\n children?: React.ReactNode\n value?: unknown\n }\n\n if (child.type === SelectItem && \"value\" in props) {\n items.push({ label: props.children, value: props.value })\n }\n\n if (props.children) {\n items.push(...collectSelectItems(props.children))\n }\n })\n\n return items\n}\n\nconst Select = ({ children, items, ...props }: SelectProps) => {\n const inferredItems = items == null ? collectSelectItems(children) : undefined\n\n return (\n <div className=\"contents\">\n <SelectPrimitive.Root\n items={items ?? (inferredItems && inferredItems.length > 0 ? inferredItems : undefined)}\n {...props}\n >\n {children}\n </SelectPrimitive.Root>\n </div>\n )\n}\nSelect.displayName = \"Select\"\n\nconst SelectGroup = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Group>,\n SelectPrimitive.Group.Props\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Group ref={ref} className={cn(className)} {...props} />\n))\nSelectGroup.displayName = \"SelectGroup\"\n\nconst SelectValue = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Value>,\n SelectPrimitive.Value.Props\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Value ref={ref} className={cn(className)} {...props} />\n))\nSelectValue.displayName = \"SelectValue\"\n\n\nconst SelectTrigger = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Trigger>,\n SelectPrimitive.Trigger.Props\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1\",\n className\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon render={<ChevronDown className=\"h-4 w-4 opacity-50\" />} />\n </SelectPrimitive.Trigger>\n))\nSelectTrigger.displayName = \"SelectTrigger\"\n\nconst ScrollContext = React.createContext<{\n viewport: HTMLElement | null\n setViewport: (vp: HTMLElement | null) => void\n } | null>(null)\n\ninterface ScrollButtonImplProps extends React.HTMLAttributes<HTMLDivElement> {\n direction: \"up\" | \"down\"\n speed?: number\n}\n\nconst ScrollButtonImpl = React.forwardRef<HTMLDivElement, ScrollButtonImplProps>(\n ({ direction, speed = 400, className, children, ...rest }, ref) => {\n const scrollContext = React.useContext(ScrollContext)\n const [disabled, setDisabled] = React.useState(true)\n const animationRef = React.useRef<number | undefined>(undefined)\n const lastTimeRef = React.useRef<number | undefined>(undefined)\n const isScrollingRef = React.useRef(false)\n\n const viewport = scrollContext?.viewport\n\n const checkScrollability = React.useCallback(() => {\n if (!viewport) {\n setDisabled(true)\n return\n }\n\n const { scrollTop, scrollHeight, clientHeight } = viewport\n const tolerance = 2\n\n const canScrollUp = scrollTop > tolerance\n const canScrollDown = scrollTop < (scrollHeight - clientHeight - tolerance)\n const hasScrollableContent = scrollHeight > clientHeight + tolerance\n\n if (!hasScrollableContent) {\n setDisabled(true)\n return\n }\n\n const shouldDisable = direction === \"up\" ? !canScrollUp : !canScrollDown\n setDisabled(shouldDisable)\n }, [viewport, direction])\n\n React.useEffect(() => {\n if (!viewport) return\n\n checkScrollability()\n\n const handleScroll = () => checkScrollability()\n const handleResize = () => checkScrollability()\n\n viewport.addEventListener(\"scroll\", handleScroll, { passive: true })\n\n const resizeObserver = new ResizeObserver(handleResize)\n resizeObserver.observe(viewport)\n\n const mutationObserver = new MutationObserver(handleResize)\n mutationObserver.observe(viewport, { childList: true, subtree: true })\n\n return () => {\n viewport.removeEventListener(\"scroll\", handleScroll)\n resizeObserver.disconnect()\n mutationObserver.disconnect()\n }\n }, [viewport, checkScrollability])\n\n const stopScrolling = React.useCallback(() => {\n if (animationRef.current) {\n cancelAnimationFrame(animationRef.current)\n animationRef.current = undefined\n }\n isScrollingRef.current = false\n lastTimeRef.current = undefined\n }, [])\n\n const smoothScroll = React.useCallback(\n (currentTime: number) => {\n if (!viewport || disabled || !isScrollingRef.current) {\n stopScrolling()\n return\n }\n\n if (!lastTimeRef.current) {\n lastTimeRef.current = currentTime\n }\n\n const deltaTime = currentTime - lastTimeRef.current\n const distance = (speed * deltaTime) / 1000\n\n if (distance < 0.1) {\n animationRef.current = requestAnimationFrame(smoothScroll)\n return\n }\n\n const oldScrollTop = viewport.scrollTop\n const maxScroll = viewport.scrollHeight - viewport.clientHeight\n\n let newScrollTop: number\n if (direction === \"up\") {\n newScrollTop = Math.max(0, oldScrollTop - distance)\n } else {\n newScrollTop = Math.min(maxScroll, oldScrollTop + distance)\n }\n\n viewport.scrollTo({ top: newScrollTop })\n\n lastTimeRef.current = currentTime\n\n const tolerance = 1\n const canContinue =\n direction === \"up\"\n ? newScrollTop > tolerance\n : newScrollTop < (maxScroll - tolerance)\n\n if (canContinue && Math.abs(newScrollTop - oldScrollTop) > 0.01) {\n animationRef.current = requestAnimationFrame(smoothScroll)\n } else {\n stopScrolling()\n setTimeout(checkScrollability, 16)\n }\n },\n [viewport, disabled, direction, speed, stopScrolling, checkScrollability],\n )\n\n const startScrolling = React.useCallback(() => {\n if (disabled || !viewport || isScrollingRef.current) return\n\n isScrollingRef.current = true\n lastTimeRef.current = undefined\n animationRef.current = requestAnimationFrame(smoothScroll)\n }, [disabled, viewport, smoothScroll])\n\n React.useEffect(() => {\n return () => stopScrolling()\n }, [stopScrolling])\n\n return (\n <div\n {...rest}\n ref={ref}\n className={cn(\n \"flex items-center justify-center py-1 select-none\",\n disabled ? \"cursor-default opacity-40\" : \"cursor-pointer opacity-100 hover:bg-accent/20\",\n className\n )}\n onPointerEnter={e => {\n rest.onPointerEnter?.(e)\n if (!disabled) startScrolling()\n }}\n onPointerMove={e => {\n rest.onPointerMove?.(e)\n if (!disabled && !isScrollingRef.current) startScrolling()\n }}\n onPointerLeave={e => {\n rest.onPointerLeave?.(e)\n stopScrolling()\n }}\n >\n {children}\n </div>\n )\n }\n)\nScrollButtonImpl.displayName = \"ScrollButtonImpl\"\n\nconst SelectScrollUpButton = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <ScrollButtonImpl ref={ref} direction=\"up\" className={className} {...props}>\n <ChevronUp className=\"h-4 w-4\" />\n </ScrollButtonImpl>\n))\nSelectScrollUpButton.displayName = \"SelectScrollUpButton\"\n\nconst SelectScrollDownButton = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <ScrollButtonImpl ref={ref} direction=\"down\" className={className} {...props}>\n <ChevronDown className=\"h-4 w-4\" />\n </ScrollButtonImpl>\n))\nSelectScrollDownButton.displayName = \"SelectScrollDownButton\"\n\ntype SelectContentProps = SelectPrimitive.Popup.Props &\n Pick<SelectPrimitive.Positioner.Props, \"align\" | \"alignOffset\" | \"side\" | \"sideOffset\" | \"alignItemWithTrigger\"> & {\n position?: \"item-aligned\" | \"popper\"\n autoScroll?: \"firstEnabled\" | \"firstEnabledWithContext\"\n }\n\nconst SelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Popup>,\n SelectContentProps\n>(({ className, children, position = \"popper\", side = \"bottom\", sideOffset = 4, align = \"center\", alignOffset = 0, alignItemWithTrigger, autoScroll, ...props }, ref) => {\n const resolvedAlignItemWithTrigger = alignItemWithTrigger ?? position === \"item-aligned\"\n const [viewport, setViewport] = React.useState<HTMLElement | null>(null)\n const viewportRef = React.useCallback((node: HTMLElement | null) => {\n setViewport(node)\n }, [])\n\n React.useEffect(() => {\n if (!viewport || !autoScroll) return\n\n const run = () => {\n const selected = viewport.querySelector(\"[role=\\\"option\\\"][data-selected]\")\n if (selected instanceof HTMLElement) {\n const padding = 8\n const targetTop = selected.offsetTop - padding\n const targetBottom = selected.offsetTop + selected.offsetHeight + padding\n\n if (targetTop < viewport.scrollTop) {\n viewport.scrollTo({ top: Math.max(0, targetTop) })\n return\n }\n\n const viewportBottom = viewport.scrollTop + viewport.clientHeight\n if (targetBottom > viewportBottom) {\n viewport.scrollTo({ top: Math.max(0, targetBottom - viewport.clientHeight) })\n }\n return\n }\n\n const all = Array.from(\n viewport.querySelectorAll(\"[role=\\\"option\\\"]\")\n ) as HTMLElement[]\n if (!all.length) return\n\n let firstEnabled: HTMLElement | undefined\n let lastDisabledBefore: HTMLElement | undefined\n for (const el of all) {\n const isDisabled = el.hasAttribute(\"data-disabled\")\n if (!isDisabled) {\n firstEnabled = el\n break\n }\n lastDisabledBefore = el\n }\n\n if (!firstEnabled) return\n\n const target =\n autoScroll === \"firstEnabledWithContext\" && lastDisabledBefore\n ? lastDisabledBefore\n : firstEnabled\n\n const offset = Math.max(0, target.offsetTop - 8)\n viewport.scrollTo({ top: offset })\n }\n\n const raf = requestAnimationFrame(run)\n return () => cancelAnimationFrame(raf)\n }, [viewport, autoScroll])\n\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n alignItemWithTrigger={resolvedAlignItemWithTrigger}\n className=\"isolate z-[60]\"\n >\n <SelectPrimitive.Popup\n ref={ref}\n className={cn(\n \"relative z-[60] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\",\n className\n )}\n {...props}\n >\n <ScrollContext.Provider value={{ viewport, setViewport }}>\n <SelectScrollUpButton />\n <SelectPrimitive.List\n ref={viewportRef}\n className={cn(\n \"max-h-96 overflow-y-auto p-1\",\n position === \"popper\" && \"w-full min-w-[var(--anchor-width)]\"\n )}\n >\n {children}\n </SelectPrimitive.List>\n <SelectScrollDownButton />\n </ScrollContext.Provider>\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n )\n})\nSelectContent.displayName = \"SelectContent\"\n\nconst SelectLabel = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.GroupLabel>,\n SelectPrimitive.GroupLabel.Props\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.GroupLabel\n ref={ref}\n className={cn(\"py-1.5 pl-8 pr-2 text-sm font-semibold\", className)}\n {...props}\n />\n))\nSelectLabel.displayName = \"SelectLabel\"\n\nconst SelectItem = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Item>,\n SelectPrimitive.Item.Props\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n))\nSelectItem.displayName = \"SelectItem\"\n\nconst SelectSeparator = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Separator>,\n SelectPrimitive.Separator.Props\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n))\nSelectSeparator.displayName = \"SelectSeparator\"\n\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,SAAS,EAAmB,GAA2B;CACrD,IAAM,IAA2D,CAAC;CAmBlE,OAjBA,EAAM,SAAS,QAAQ,IAAU,MAAS;EACxC,IAAI,CAAC,EAAM,eAAe,CAAK,GAAG;EAElC,IAAM,IAAQ,EAAM;EASpB,AAJI,EAAM,SAAS,KAAc,WAAW,KAC1C,EAAM,KAAK;GAAE,OAAO,EAAM;GAAU,OAAO,EAAM;EAAM,CAAC,GAGtD,EAAM,YACR,EAAM,KAAK,GAAG,EAAmB,EAAM,QAAQ,CAAC;CAEpD,CAAC,GAEM;AACT;AAEA,IAAM,KAAA,MAAyD;gBAA7C,GAAU,GAAU;CAAtBA,AAAAA,EAAAA,OAAAA,sCAAE,wBAAiB,GAAA,KAAnBA;CACQC,IAAAA;CAAmC,AAAA,EAAA,OAAA,KAAA,EAAA,OAAnC,KAAS,IAAA,KAAA,OAAO,EAAmB,CAAQ,IAAI,KAAA,GAAZ,EAAA,KAAA,GAAnC,EAAA,KAAA;CAAtB,IAAM,IAAgBA,GAKT,IAAA,MAAU,KAAiB,EAAc,SAAS,IAAI,IAAgB,KAAA,IAFjFC;CADF,OA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ACL,WAAWF;EACX,GAAI;CACL,CAAA,GADK,EAAA,KAAA,GAFC,EAAA,KAAA,GACMA,EAAAA,KAAAA,yBAFbC;AAKD,CAAA;AACD,EAAgB,cAAc"}
|
package/dist/index417.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index417.js","names":["href","labelElement","
|
|
1
|
+
{"version":3,"file":"index417.js","names":["{\n href,\n labelClassName,\n labelActiveClassName,\n labelElement,\n isActive,\n children,\n}: {\n href: string;\n labelClassName: string;\n labelActiveClassName: string;\n labelElement: ReactNode;\n isActive: boolean;\n children: (props: { setIsOpen: (isOpen: boolean) => void }) => ReactNode\n}","() => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current)\n }\n setIsOpen(true)\n }","() => {\n timeoutRef.current = setTimeout(() => {\n setIsOpen(false)\n }, 120)\n }","() => {\n return () => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current)\n }\n }\n }","[]","() => {\n setIsOpen(false)\n }","clsx(\n \"relative z-10 -mb-px flex items-center border-b-2 pt-px text-sm font-medium text-gray-700 cursor-pointer transition-colors duration-200 ease-out hover:text-gray-800\",\n labelClassName,\n isOpen || isActive ? labelActiveClassName : \"border-transparent\",\n )","isOpen || isActive ? labelActiveClassName : \"border-transparent\"","<div className=\"relative flex\">\n <Link\n to={href}\n onClick={() => {\n setIsOpen(false)\n }}\n className={clsx(\n \"relative z-10 -mb-px flex items-center border-b-2 pt-px text-sm font-medium text-gray-700 cursor-pointer transition-colors duration-200 ease-out hover:text-gray-800\",\n labelClassName,\n isOpen || isActive ? labelActiveClassName : \"border-transparent\",\n )}\n >\n {labelElement}\n </Link>\n </div>","isOpen && (\n <div\n className=\"absolute left-0 right-0 top-full z-20 text-gray-500 sm:text-sm\"\n style={{ width: \"100vw\", left: \"50%\", transform: \"translateX(-50%)\" }}\n >\n <div\n aria-hidden=\"true\"\n className=\"absolute inset-0 top-1/2 bg-white shadow-sm\"\n />\n\n <div className=\"relative bg-white\">\n {children({ setIsOpen })}\n </div>\n </div>\n )","<div\n className=\"flex\"\n ref={popoverRef}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n <div className=\"relative flex\">\n <Link\n to={href}\n onClick={() => {\n setIsOpen(false)\n }}\n className={clsx(\n \"relative z-10 -mb-px flex items-center border-b-2 pt-px text-sm font-medium text-gray-700 cursor-pointer transition-colors duration-200 ease-out hover:text-gray-800\",\n labelClassName,\n isOpen || isActive ? labelActiveClassName : \"border-transparent\",\n )}\n >\n {labelElement}\n </Link>\n </div>\n\n {isOpen && (\n <div\n className=\"absolute left-0 right-0 top-full z-20 text-gray-500 sm:text-sm\"\n style={{ width: \"100vw\", left: \"50%\", transform: \"translateX(-50%)\" }}\n >\n <div\n aria-hidden=\"true\"\n className=\"absolute inset-0 top-1/2 bg-white shadow-sm\"\n />\n\n <div className=\"relative bg-white\">\n {children({ setIsOpen })}\n </div>\n </div>\n )}\n </div>"],"sources":["../src/components/header/MenuPopover/index.tsx"],"sourcesContent":["import clsx from \"clsx\"\nimport { ReactNode, useState, useRef, useEffect } from \"react\"\nimport { Link } from \"react-router\"\n\n\nexport const MenuPopover = ({\n href,\n labelClassName,\n labelActiveClassName,\n labelElement,\n isActive,\n children,\n}: {\n href: string;\n labelClassName: string;\n labelActiveClassName: string;\n labelElement: ReactNode;\n isActive: boolean;\n children: (props: { setIsOpen: (isOpen: boolean) => void }) => ReactNode\n}) => {\n const [isOpen, setIsOpen] = useState(false)\n const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const popoverRef = useRef(null)\n\n const handleMouseEnter = () => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current)\n }\n setIsOpen(true)\n }\n\n const handleMouseLeave = () => {\n timeoutRef.current = setTimeout(() => {\n setIsOpen(false)\n }, 120)\n }\n\n useEffect(() => {\n return () => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current)\n }\n }\n }, [])\n\n return (\n <div\n className=\"flex\"\n ref={popoverRef}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n <div className=\"relative flex\">\n <Link\n to={href}\n onClick={() => {\n setIsOpen(false)\n }}\n className={clsx(\n \"relative z-10 -mb-px flex items-center border-b-2 pt-px text-sm font-medium text-gray-700 cursor-pointer transition-colors duration-200 ease-out hover:text-gray-800\",\n labelClassName,\n isOpen || isActive ? labelActiveClassName : \"border-transparent\",\n )}\n >\n {labelElement}\n </Link>\n </div>\n\n {isOpen && (\n <div\n className=\"absolute left-0 right-0 top-full z-20 text-gray-500 sm:text-sm\"\n style={{ width: \"100vw\", left: \"50%\", transform: \"translateX(-50%)\" }}\n >\n <div\n aria-hidden=\"true\"\n className=\"absolute inset-0 top-1/2 bg-white shadow-sm\"\n />\n\n <div className=\"relative bg-white\">\n {children({ setIsOpen })}\n </div>\n </div>\n )}\n </div>\n )\n}\n"],"mappings":";;;;;;AAKA,IAAa,KAAA,MAcP;gBAdsB,EAC1B,SACA,mBACA,yBACA,iBACA,aACA,gBAN0BA,GAepB,CAAC,GAAQ,KAAa,EAAS,EAAK,GACpC,IAAa,EAA6C,IAAI,GAC9D,IAAa,EAAO,IAAI,GAELC;qDAAM,UAAA;EAI7B,AAHI,EAAW,WACb,aAAa,EAAW,OAAO,GAEjC,EAAU,EAAI;CAChB;CALA,IAAM,IAAmBA,GAOAC;qDAAM,UAAA;EAC7B,EAAW,UAAU,iBAAiB;GACpC,EAAU,EAAK;EACjB,GAAG,GAAG;CACR;CAJA,IAAM,IAAmBA,GAMfC,GAMPC;CANH,oDAAU,gBACK;EACX,AAAI,EAAW,WACb,aAAa,EAAW,OAAO;CAEnC,GACC,IAAA,CAAC,+CANJ,EAAUD,GAMPC,CAAE;CAYYC,IAAAA;qDAAM,UAAA;EACb,EAAU,EAAK;CACjB;CAIE,IAAA,IAAA,KAAU,IAAW,IAAuB,sBAHnCC;CAET,AAAA,EAAA,OAAA,KAAA,EAAA,OACAC,KAHS,IAAA,EACT,wKACA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