@razorpay/blade 12.47.1 → 12.48.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.
Files changed (51) hide show
  1. package/build/lib/native/components/Input/TextInput/TextInput.js +1 -1
  2. package/build/lib/native/components/Input/TextInput/TextInput.js.map +1 -1
  3. package/build/lib/native/components/Input/TextInput/useFormattedInput.js +1 -1
  4. package/build/lib/native/components/Input/TextInput/useFormattedInput.js.map +1 -1
  5. package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js +162 -113
  6. package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js.map +1 -1
  7. package/build/lib/web/development/components/DatePicker/CalendarFooter.web.js +1 -1
  8. package/build/lib/web/development/components/DatePicker/CalendarFooter.web.js.map +1 -1
  9. package/build/lib/web/development/components/DatePicker/DateInput.web.js +202 -147
  10. package/build/lib/web/development/components/DatePicker/DateInput.web.js.map +1 -1
  11. package/build/lib/web/development/components/DatePicker/QuickSelection/PresetContext.js +122 -0
  12. package/build/lib/web/development/components/DatePicker/QuickSelection/PresetContext.js.map +1 -0
  13. package/build/lib/web/development/components/DatePicker/QuickSelection/PresetDropdown.web.js +46 -0
  14. package/build/lib/web/development/components/DatePicker/QuickSelection/PresetDropdown.web.js.map +1 -0
  15. package/build/lib/web/development/components/DatePicker/QuickSelection/PresetSideBar.web.js +19 -19
  16. package/build/lib/web/development/components/DatePicker/QuickSelection/PresetSideBar.web.js.map +1 -1
  17. package/build/lib/web/development/components/DatePicker/QuickSelection/utils.js +9 -0
  18. package/build/lib/web/development/components/DatePicker/QuickSelection/utils.js.map +1 -0
  19. package/build/lib/web/development/components/DatePicker/usePopup.js +10 -2
  20. package/build/lib/web/development/components/DatePicker/usePopup.js.map +1 -1
  21. package/build/lib/web/development/components/DatePicker/utils.js +419 -1
  22. package/build/lib/web/development/components/DatePicker/utils.js.map +1 -1
  23. package/build/lib/web/development/components/Input/TextInput/TextInput.js +3 -1
  24. package/build/lib/web/development/components/Input/TextInput/TextInput.js.map +1 -1
  25. package/build/lib/web/development/components/Input/TextInput/useFormattedInput.js +21 -0
  26. package/build/lib/web/development/components/Input/TextInput/useFormattedInput.js.map +1 -1
  27. package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js +162 -113
  28. package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js.map +1 -1
  29. package/build/lib/web/production/components/DatePicker/CalendarFooter.web.js +1 -1
  30. package/build/lib/web/production/components/DatePicker/CalendarFooter.web.js.map +1 -1
  31. package/build/lib/web/production/components/DatePicker/DateInput.web.js +202 -147
  32. package/build/lib/web/production/components/DatePicker/DateInput.web.js.map +1 -1
  33. package/build/lib/web/production/components/DatePicker/QuickSelection/PresetContext.js +122 -0
  34. package/build/lib/web/production/components/DatePicker/QuickSelection/PresetContext.js.map +1 -0
  35. package/build/lib/web/production/components/DatePicker/QuickSelection/PresetDropdown.web.js +46 -0
  36. package/build/lib/web/production/components/DatePicker/QuickSelection/PresetDropdown.web.js.map +1 -0
  37. package/build/lib/web/production/components/DatePicker/QuickSelection/PresetSideBar.web.js +19 -19
  38. package/build/lib/web/production/components/DatePicker/QuickSelection/PresetSideBar.web.js.map +1 -1
  39. package/build/lib/web/production/components/DatePicker/QuickSelection/utils.js +9 -0
  40. package/build/lib/web/production/components/DatePicker/QuickSelection/utils.js.map +1 -0
  41. package/build/lib/web/production/components/DatePicker/usePopup.js +10 -2
  42. package/build/lib/web/production/components/DatePicker/usePopup.js.map +1 -1
  43. package/build/lib/web/production/components/DatePicker/utils.js +419 -1
  44. package/build/lib/web/production/components/DatePicker/utils.js.map +1 -1
  45. package/build/lib/web/production/components/Input/TextInput/TextInput.js +3 -1
  46. package/build/lib/web/production/components/Input/TextInput/TextInput.js.map +1 -1
  47. package/build/lib/web/production/components/Input/TextInput/useFormattedInput.js +21 -0
  48. package/build/lib/web/production/components/Input/TextInput/useFormattedInput.js.map +1 -1
  49. package/build/types/components/index.d.ts +10 -5
  50. package/build/types/components/index.native.d.ts +10 -5
  51. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.js","sources":["../../../../../../../src/components/Input/TextInput/TextInput.tsx"],"sourcesContent":["import React, { useEffect, useState, useRef } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\nimport { useFormattedInput } from './useFormattedInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { IconComponent } from '~components/Icons';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n ContainerElementType,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\nimport { Divider } from '~components/Divider';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { DropdownOverlay } from '~components/Dropdown';\nimport type { FormInputOnEvent } from '~components/Form/FormTypes';\nimport { isIconComponent } from '~utils/isIconComponent';\n\n// Users should use PasswordInput for input type password\ntype Type = Exclude<BaseInputProps['type'], 'password'>;\n\ntype TextInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'labelSuffix'\n | 'labelTrailing'\n | 'necessityIndicator'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'prefix'\n | 'suffix'\n | 'maxCharacters'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'autoCompleteSuggestionType'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | 'leadingIcon'\n | 'trailingButton'\n | 'trailingIcon'\n | 'textAlign'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n\n /**\n * Icon that will be rendered at the beginning of the input field\n * @deprecated Use `leading` instead. This prop will be removed in the next major version.\n */\n icon?: IconComponent;\n /**\n * Type of Input Field to be rendered. Use `PasswordInput` for type `password`\n *\n *\n * **Note on number type**\n *\n * `type=\"number\"` internally uses `inputMode=\"numeric\"` instead of HTML's `type=\"number\"` which also allows text characters.\n * If you have a usecase where you only want to support number input, you can handle it on validations end.\n *\n * Check out [Why the GOV.UK Design System team changed the input type for numbers](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) for reasoning\n *\n * @default text\n */\n type?: Type;\n /**\n *\n * Icon or React Element to be rendered at the end of the input field\n */\n trailing?: React.ReactElement | IconComponent;\n /**\n * Icon or React Element to be rendered at the beginning of the input field\n */\n leading?: React.ReactElement | IconComponent;\n /**\n * Format pattern where # represents input characters and other symbols act as delimiters\n * When provided, input will be automatically formatted and onChange will include rawValue\n *\n * **Note:**\n * 1. Format pattern should only contain # symbols and special characters as delimiters.\n * Alphanumeric characters (letters and numbers) are not allowed in the format pattern.\n * 2. When format is provided, user input is restricted to alphanumeric characters only.\n * Special characters and symbols will be filtered out automatically from user input.\n *\n * @example \"#### #### #### ####\" for card numbers\n * @example \"##/##\" for expiry dates\n * @example \"(###) ###-####\" for phone numbers\n */\n format?:\n | '#### #### #### ####'\n | '##/##'\n | '##/##/####'\n | '(###) ###-####'\n | '###-##-####'\n | '##:##'\n | '##:##:##'\n | '#### #### ####'\n | '###.###.###.###'\n | '## ## ####'\n | '##-###-##'\n // eslint-disable-next-line @typescript-eslint/ban-types\n | (string & {});\n} & TaggedInputProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype TextInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype TextInputProps = (TextInputPropsWithA11yLabel | TextInputPropsWithLabel) &\n TextInputCommonProps;\n\n// need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _TextInput: React.ForwardRefRenderFunction<BladeElementRef, TextInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n type = 'text',\n defaultValue,\n name,\n value,\n maxCharacters,\n format,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n necessityIndicator,\n validationState,\n errorText,\n helpText,\n successText,\n isRequired,\n icon,\n prefix,\n showClearButton,\n onClearButtonClick,\n isLoading,\n suffix,\n autoFocus,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n testID,\n size = 'medium',\n leadingIcon,\n trailingIcon,\n isTaggedInput,\n tags,\n onTagChange,\n trailing,\n leading,\n labelSuffix,\n labelTrailing,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const [isInputFocussed, setIsInputFocussed] = useState(autoFocus ?? false);\n\n if (__DEV__) {\n if (format) {\n const hasAlphanumeric = /[a-zA-Z0-9]/.test(format);\n if (hasAlphanumeric) {\n throw new Error(\n `[Blade: TextInput] Invalid format \"${format}\". Only # and special characters allowed, no letters/numbers.`,\n );\n }\n }\n }\n\n const formattingResult = useFormattedInput({\n format,\n onChange,\n value,\n defaultValue,\n });\n\n const inputValue = format ? formattingResult.formattedValue : value;\n const effectiveMaxCharacters = format ? formattingResult.maxLength : maxCharacters;\n\n const handleOnChange: FormInputOnEvent = React.useCallback(\n ({ name, value: inputValue }) => {\n if (format) {\n formattingResult.handleChange({ name, value: inputValue });\n } else {\n onChange?.({ name, value: inputValue });\n }\n },\n [format, formattingResult.handleChange, onChange],\n );\n\n const {\n activeTagIndex,\n setActiveTagIndex,\n getTags,\n handleTaggedInputKeydown,\n handleTaggedInputChange,\n handleTagsClear,\n } = useTaggedInput({\n isTaggedInput,\n tags,\n onTagChange,\n isDisabled,\n onChange: handleOnChange,\n name,\n value: inputValue,\n inputRef: textInputRef,\n });\n const [isTrailingDropDownOpen, setIsTrailingDropDownOpen] = React.useState(false);\n const [isLeadingDropDownOpen, setIsLeadingDropDownOpen] = React.useState(false);\n const textInputWrapperRef = useRef<ContainerElementType | null>(null);\n\n useEffect(() => {\n if (isTrailingDropDownOpen && isLeadingDropDownOpen) {\n setIsLeadingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isTrailingDropDownOpen]);\n\n useEffect(() => {\n if (isLeadingDropDownOpen && isTrailingDropDownOpen) {\n setIsTrailingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLeadingDropDownOpen]);\n\n const leadingDropDown =\n leading && getComponentId(leading as React.ReactElement) === 'Dropdown' ? leading : null;\n\n const trailingDropdown =\n trailing && getComponentId(trailing as React.ReactElement) === 'Dropdown' ? trailing : null;\n // we need to look into name of component and check if it 's and icon or a dropdown\n const _leadingIcon: IconComponent | undefined = isIconComponent(leading)\n ? (leading as IconComponent)\n : undefined;\n\n const _trailingIcon: IconComponent | undefined = isIconComponent(trailing)\n ? (trailing as IconComponent)\n : undefined;\n const hasLeadingInteractionElement = !_leadingIcon && !leadingDropDown && leading;\n\n const hasTrailingInteractionElement = !_trailingIcon && !trailingDropdown && trailing;\n\n const renderDropdown = (\n dropdown: React.ReactElement,\n isOpen: boolean,\n setIsOpen: (isOpen: boolean) => void,\n defaultPlacement: 'bottom-start' | 'bottom-end',\n ): React.ReactElement | null => {\n if (!dropdown) {\n return null;\n }\n return React.cloneElement(dropdown, {\n selectionType: 'single',\n isOpen,\n onOpenChange: (isOpen: boolean) => {\n setIsOpen(isOpen);\n },\n children: React.Children.map(dropdown.props.children, (child) => {\n if (child.type === DropdownOverlay) {\n return React.cloneElement(child, {\n referenceRef: textInputWrapperRef,\n _isNestedDropdown: true,\n defaultPlacement,\n });\n }\n return child;\n }),\n });\n };\n\n const renderLeadingDropDown = renderDropdown(\n leadingDropDown as React.ReactElement,\n isLeadingDropDownOpen,\n setIsLeadingDropDownOpen,\n 'bottom-start',\n );\n const renderTrailingDropDown = renderDropdown(\n trailingDropdown as React.ReactElement,\n isTrailingDropDownOpen,\n setIsTrailingDropDownOpen,\n 'bottom-end',\n );\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (defaultValue ?? inputValue)));\n }, [showClearButton, defaultValue, inputValue]);\n\n const renderClearButton = (): React.ReactElement => {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(inputValue) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n handleTagsClear();\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n };\n const hasTrailingDropDown = Boolean(trailingDropdown);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton && hasTrailingDropDown) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" />\n </BaseBox>\n );\n }\n\n if (showClearButton && hasTrailingInteractionElement) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" /> {trailing as React.ReactElement}\n </BaseBox>\n );\n }\n\n if (shouldShowClearButton) {\n return renderClearButton();\n }\n\n if (hasTrailingInteractionElement) {\n return trailing as React.ReactElement;\n }\n return null;\n };\n return (\n <BaseInput\n id=\"textinput\"\n componentName={MetaConstants.TextInput}\n ref={mergedRef}\n setInputWrapperRef={(wrapperNode) => {\n textInputWrapperRef.current = wrapperNode;\n }}\n label={label as string}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n // CONTROLLED/UNCONTROLLED INPUT LOGIC:\n // For inputs WITHOUT format:\n // - Use standard React controlled/uncontrolled logic\n // - Controlled: user provides `value` prop → use `value` prop\n // - Uncontrolled: user provides `defaultValue` prop → use `defaultValue` prop\n //\n // For inputs WITH format:\n // - Formatting requires controlled mode to re-render and show formatted values\n // - Case 1: Only `value` provided → defaultValue: undefined, value: formattedValue (normal controlled)\n // - Case 2: Only `defaultValue` provided → defaultValue: undefined, value: formattedValue (convert to controlled)\n // - Case 3: Both `value` and `defaultValue` provided → defaultValue: defaultValue, value: formattedValue (let BaseInput detect conflict and throw error)\n //\n defaultValue={\n format\n ? value !== undefined && defaultValue !== undefined\n ? defaultValue\n : undefined\n : defaultValue\n }\n value={format ? inputValue : value}\n name={name}\n maxCharacters={effectiveMaxCharacters}\n isDropdownTrigger={isTaggedInput}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n showAllTags={isInputFocussed}\n maxTagRows=\"single\"\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n leadingDropDown={renderLeadingDropDown}\n trailingDropDown={renderTrailingDropDown}\n leadingInteractionElement={\n hasLeadingInteractionElement ? (leading as React.ReactElement) : null\n }\n onChange={({ name, value }: { name?: string; value?: string }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n handleTaggedInputChange({ name, value });\n handleOnChange({ name, value });\n }}\n onClick={onClick}\n onFocus={(e) => {\n setIsInputFocussed(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsInputFocussed(false);\n onBlur?.(e);\n }}\n onKeyDown={(e) => {\n handleTaggedInputKeydown(e);\n if (format) {\n formattingResult.handleKeyDown(e.event);\n }\n }}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n necessityIndicator={necessityIndicator}\n isRequired={isRequired}\n leadingIcon={_leadingIcon ?? leadingIcon ?? icon}\n prefix={prefix}\n trailingInteractionElement={renderInteractionElement()}\n trailingIcon={_trailingIcon ?? trailingIcon}\n suffix={suffix}\n validationState={validationState}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n trailingFooterSlot={(value) => {\n return format ? null : effectiveMaxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter\n currentCount={value?.length ?? 0}\n maxCount={effectiveMaxCharacters}\n size={size}\n />\n </BaseBox>\n ) : null;\n }}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n );\n};\n\nconst TextInput = assignWithoutSideEffects(React.forwardRef(_TextInput), {\n displayName: 'TextInput',\n});\n\nexport type { TextInputProps };\nexport { TextInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextInput","_ref","ref","_ref4","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","_ref$type","type","defaultValue","name","value","maxCharacters","format","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","_ref$size","size","leadingIcon","trailingIcon","isTaggedInput","tags","onTagChange","trailing","leading","labelSuffix","labelTrailing","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isInputFocussed","setIsInputFocussed","hasAlphanumeric","test","Error","concat","formattingResult","useFormattedInput","inputValue","formattedValue","effectiveMaxCharacters","maxLength","handleOnChange","useCallback","_ref2","handleChange","_useTaggedInput","useTaggedInput","inputRef","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","_React$useState","_React$useState2","isTrailingDropDownOpen","setIsTrailingDropDownOpen","_React$useState3","_React$useState4","isLeadingDropDownOpen","setIsLeadingDropDownOpen","textInputWrapperRef","useEffect","leadingDropDown","getComponentId","trailingDropdown","_leadingIcon","isIconComponent","undefined","_trailingIcon","hasLeadingInteractionElement","hasTrailingInteractionElement","renderDropdown","dropdown","isOpen","setIsOpen","defaultPlacement","cloneElement","selectionType","onOpenChange","children","Children","map","props","child","DropdownOverlay","referenceRef","_isNestedDropdown","renderLeadingDropDown","renderTrailingDropDown","Boolean","renderClearButton","_jsx","IconButton","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","hasTrailingDropDown","renderInteractionElement","Spinner","color","_jsxs","BaseBox","display","gap","Divider","orientation","BaseInput","_objectSpread","id","componentName","MetaConstants","TextInput","setInputWrapperRef","wrapperNode","hideLabelText","isDropdownTrigger","showAllTags","maxTagRows","trailingDropDown","leadingInteractionElement","_ref3","length","e","onKeyDown","handleKeyDown","event","trailingInteractionElement","trailingFooterSlot","_value$length","marginTop","hintMarginTop","marginRight","CharacterCounter","currentCount","maxCount","getKeyboardAndAutocompleteProps","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoLA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAkB,EAA4C;AACnF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,UAA2E,GAAG,SAA9EA,UAA2EA,CAAAC,IAAA,EA+C/EC,GAAG,EACc;AAAA,EAAA,IAAAC,KAAA,CAAA;AAAA,EAAA,IA9CfC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,kBAAkB,GAAAJ,IAAA,CAAlBI,kBAAkB;IAAAC,kBAAA,GAAAL,IAAA,CAClBM,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,kBAAA;IACrBE,WAAW,GAAAP,IAAA,CAAXO,WAAW;IAAAC,SAAA,GAAAR,IAAA,CACXS,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,SAAA;IACbE,YAAY,GAAAV,IAAA,CAAZU,YAAY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,KAAK,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAALA,KAAK,CAAEuJ,MAAM,MAAAO,IAAAA,IAAAA,aAAA,KAAAA,KAAAA,CAAAA,GAAAA,aAAA,GAAI,CAAE;AACjCM,UAAAA,QAAQ,EAAErG,sBAAuB;AACjCpC,UAAAA,IAAI,EAAEA,IAAAA;SACP,CAAA;OACM,CAAC,GACR,IAAI,CAAA;AACV,KAAA;AACA;AAAA;AACAN,IAAAA,SAAS,EAAEA,SAAU;AACrBI,IAAAA,MAAM,EAAEA,MAAAA;AAAO,GAAA,EACX4I,+BAA+B,CAAC;AAClCxK,IAAAA,IAAI,EAAJA,IAAI;AACJyB,IAAAA,qBAAqB,EAArBA,qBAAqB;AACrBC,IAAAA,0BAA0B,EAA1BA,0BAA0B;AAC1BC,IAAAA,cAAc,EAAdA,cAAAA;AACF,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACFG,IAAAA,IAAI,EAAEA,IAAAA;GACFU,EAAAA,IAAI,CACT,CAAC,CAAA;AAEN,CAAC,CAAA;AAEKwG,IAAAA,SAAS,gBAAGyB,wBAAwB,eAAC7H,cAAK,CAAC8H,UAAU,CAACpL,UAAU,CAAC,EAAE;AACvEqL,EAAAA,WAAW,EAAE,WAAA;AACf,CAAC;;;;"}
1
+ {"version":3,"file":"TextInput.js","sources":["../../../../../../../src/components/Input/TextInput/TextInput.tsx"],"sourcesContent":["import React, { useEffect, useState, useRef } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\nimport { useFormattedInput } from './useFormattedInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { IconComponent } from '~components/Icons';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type {\n BladeElementRef,\n BladeElementRefWithValue,\n ContainerElementType,\n DataAnalyticsAttribute,\n} from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\nimport { Divider } from '~components/Divider';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { DropdownOverlay } from '~components/Dropdown';\nimport type { FormInputOnEvent } from '~components/Form/FormTypes';\nimport { isIconComponent } from '~utils/isIconComponent';\n\n// Users should use PasswordInput for input type password\ntype Type = Exclude<BaseInputProps['type'], 'password'>;\n\ntype TextInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'labelSuffix'\n | 'labelTrailing'\n | 'necessityIndicator'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'prefix'\n | 'suffix'\n | 'maxCharacters'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'autoCompleteSuggestionType'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | 'leadingIcon'\n | 'trailingButton'\n | 'trailingIcon'\n | 'textAlign'\n | 'popupId'\n | 'isPopupExpanded'\n | 'hasPopup'\n | 'componentName'\n | 'onKeyDown'\n | keyof DataAnalyticsAttribute\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n\n /**\n * Icon that will be rendered at the beginning of the input field\n * @deprecated Use `leading` instead. This prop will be removed in the next major version.\n */\n icon?: IconComponent;\n /**\n * Type of Input Field to be rendered. Use `PasswordInput` for type `password`\n *\n *\n * **Note on number type**\n *\n * `type=\"number\"` internally uses `inputMode=\"numeric\"` instead of HTML's `type=\"number\"` which also allows text characters.\n * If you have a usecase where you only want to support number input, you can handle it on validations end.\n *\n * Check out [Why the GOV.UK Design System team changed the input type for numbers](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) for reasoning\n *\n * @default text\n */\n type?: Type;\n /**\n *\n * Icon or React Element to be rendered at the end of the input field\n */\n trailing?: React.ReactElement | IconComponent;\n /**\n * Icon or React Element to be rendered at the beginning of the input field\n */\n leading?: React.ReactElement | IconComponent;\n /**\n * Format pattern where # represents input characters and other symbols act as delimiters\n * When provided, input will be automatically formatted and onChange will include rawValue\n *\n * **Note:**\n * 1. Format pattern should only contain # symbols and special characters as delimiters.\n * Alphanumeric characters (letters and numbers) are not allowed in the format pattern.\n * 2. When format is provided, user input is restricted to alphanumeric characters only.\n * Special characters and symbols will be filtered out automatically from user input.\n *\n * @example \"#### #### #### ####\" for card numbers\n * @example \"##/##\" for expiry dates\n * @example \"(###) ###-####\" for phone numbers\n */\n format?:\n | '#### #### #### ####'\n | '##/##'\n | '##/##/####'\n | '(###) ###-####'\n | '###-##-####'\n | '##:##'\n | '##:##:##'\n | '#### #### ####'\n | '###.###.###.###'\n | '## ## ####'\n | '##-###-##'\n // eslint-disable-next-line @typescript-eslint/ban-types\n | (string & {});\n} & TaggedInputProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype TextInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype TextInputProps = (TextInputPropsWithA11yLabel | TextInputPropsWithLabel) &\n TextInputCommonProps;\n\n// need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _TextInput: React.ForwardRefRenderFunction<BladeElementRef, TextInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n type = 'text',\n defaultValue,\n name,\n value,\n maxCharacters,\n format,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n necessityIndicator,\n validationState,\n errorText,\n helpText,\n successText,\n isRequired,\n icon,\n prefix,\n showClearButton,\n onClearButtonClick,\n isLoading,\n suffix,\n autoFocus,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n testID,\n size = 'medium',\n leadingIcon,\n trailingIcon,\n isTaggedInput,\n tags,\n onTagChange,\n trailing,\n leading,\n labelSuffix,\n labelTrailing,\n onKeyDown,\n ...rest\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const [isInputFocussed, setIsInputFocussed] = useState(autoFocus ?? false);\n\n if (__DEV__) {\n if (format) {\n const hasAlphanumeric = /[a-zA-Z0-9]/.test(format);\n if (hasAlphanumeric) {\n throw new Error(\n `[Blade: TextInput] Invalid format \"${format}\". Only # and special characters allowed, no letters/numbers.`,\n );\n }\n }\n }\n\n const formattingResult = useFormattedInput({\n format,\n onChange,\n value,\n defaultValue,\n });\n\n const inputValue = format ? formattingResult.formattedValue : value;\n const effectiveMaxCharacters = format ? formattingResult.maxLength : maxCharacters;\n\n const handleOnChange: FormInputOnEvent = React.useCallback(\n ({ name, value: inputValue }) => {\n if (format) {\n formattingResult.handleChange({ name, value: inputValue });\n } else {\n onChange?.({ name, value: inputValue });\n }\n },\n [format, formattingResult.handleChange, onChange],\n );\n\n const {\n activeTagIndex,\n setActiveTagIndex,\n getTags,\n handleTaggedInputKeydown,\n handleTaggedInputChange,\n handleTagsClear,\n } = useTaggedInput({\n isTaggedInput,\n tags,\n onTagChange,\n isDisabled,\n onChange: handleOnChange,\n name,\n value: inputValue,\n inputRef: textInputRef,\n });\n const [isTrailingDropDownOpen, setIsTrailingDropDownOpen] = React.useState(false);\n const [isLeadingDropDownOpen, setIsLeadingDropDownOpen] = React.useState(false);\n const textInputWrapperRef = useRef<ContainerElementType | null>(null);\n\n useEffect(() => {\n if (isTrailingDropDownOpen && isLeadingDropDownOpen) {\n setIsLeadingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isTrailingDropDownOpen]);\n\n useEffect(() => {\n if (isLeadingDropDownOpen && isTrailingDropDownOpen) {\n setIsTrailingDropDownOpen(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLeadingDropDownOpen]);\n\n const leadingDropDown =\n leading && getComponentId(leading as React.ReactElement) === 'Dropdown' ? leading : null;\n\n const trailingDropdown =\n trailing && getComponentId(trailing as React.ReactElement) === 'Dropdown' ? trailing : null;\n // we need to look into name of component and check if it 's and icon or a dropdown\n const _leadingIcon: IconComponent | undefined = isIconComponent(leading)\n ? (leading as IconComponent)\n : undefined;\n\n const _trailingIcon: IconComponent | undefined = isIconComponent(trailing)\n ? (trailing as IconComponent)\n : undefined;\n const hasLeadingInteractionElement = !_leadingIcon && !leadingDropDown && leading;\n\n const hasTrailingInteractionElement = !_trailingIcon && !trailingDropdown && trailing;\n\n const renderDropdown = (\n dropdown: React.ReactElement,\n isOpen: boolean,\n setIsOpen: (isOpen: boolean) => void,\n defaultPlacement: 'bottom-start' | 'bottom-end',\n ): React.ReactElement | null => {\n if (!dropdown) {\n return null;\n }\n return React.cloneElement(dropdown, {\n selectionType: 'single',\n isOpen,\n onOpenChange: (isOpen: boolean) => {\n setIsOpen(isOpen);\n },\n children: React.Children.map(dropdown.props.children, (child) => {\n if (child.type === DropdownOverlay) {\n return React.cloneElement(child, {\n referenceRef: textInputWrapperRef,\n _isNestedDropdown: true,\n defaultPlacement,\n });\n }\n return child;\n }),\n });\n };\n\n const renderLeadingDropDown = renderDropdown(\n leadingDropDown as React.ReactElement,\n isLeadingDropDownOpen,\n setIsLeadingDropDownOpen,\n 'bottom-start',\n );\n const renderTrailingDropDown = renderDropdown(\n trailingDropdown as React.ReactElement,\n isTrailingDropDownOpen,\n setIsTrailingDropDownOpen,\n 'bottom-end',\n );\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (defaultValue ?? inputValue)));\n }, [showClearButton, defaultValue, inputValue]);\n\n const renderClearButton = (): React.ReactElement => {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(inputValue) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n handleTagsClear();\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n };\n const hasTrailingDropDown = Boolean(trailingDropdown);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton && hasTrailingDropDown) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" />\n </BaseBox>\n );\n }\n\n if (showClearButton && hasTrailingInteractionElement) {\n return (\n <BaseBox display=\"flex\" gap=\"spacing.3\">\n {renderClearButton()} <Divider orientation=\"vertical\" /> {trailing as React.ReactElement}\n </BaseBox>\n );\n }\n\n if (shouldShowClearButton) {\n return renderClearButton();\n }\n\n if (hasTrailingInteractionElement) {\n return trailing as React.ReactElement;\n }\n return null;\n };\n return (\n <BaseInput\n id=\"textinput\"\n componentName={MetaConstants.TextInput}\n ref={mergedRef}\n setInputWrapperRef={(wrapperNode) => {\n textInputWrapperRef.current = wrapperNode;\n }}\n label={label as string}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n // CONTROLLED/UNCONTROLLED INPUT LOGIC:\n // For inputs WITHOUT format:\n // - Use standard React controlled/uncontrolled logic\n // - Controlled: user provides `value` prop → use `value` prop\n // - Uncontrolled: user provides `defaultValue` prop → use `defaultValue` prop\n //\n // For inputs WITH format:\n // - Formatting requires controlled mode to re-render and show formatted values\n // - Case 1: Only `value` provided → defaultValue: undefined, value: formattedValue (normal controlled)\n // - Case 2: Only `defaultValue` provided → defaultValue: undefined, value: formattedValue (convert to controlled)\n // - Case 3: Both `value` and `defaultValue` provided → defaultValue: defaultValue, value: formattedValue (let BaseInput detect conflict and throw error)\n //\n defaultValue={\n format\n ? value !== undefined && defaultValue !== undefined\n ? defaultValue\n : undefined\n : defaultValue\n }\n value={format ? inputValue : value}\n name={name}\n maxCharacters={effectiveMaxCharacters}\n isDropdownTrigger={isTaggedInput}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n showAllTags={isInputFocussed}\n maxTagRows=\"single\"\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n leadingDropDown={renderLeadingDropDown}\n trailingDropDown={renderTrailingDropDown}\n leadingInteractionElement={\n hasLeadingInteractionElement ? (leading as React.ReactElement) : null\n }\n onChange={({ name, value }: { name?: string; value?: string }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n handleTaggedInputChange({ name, value });\n handleOnChange({ name, value });\n }}\n onClick={onClick}\n onFocus={(e) => {\n setIsInputFocussed(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsInputFocussed(false);\n onBlur?.(e);\n }}\n onKeyDown={(e) => {\n handleTaggedInputKeydown(e);\n onKeyDown?.(e);\n if (format) {\n formattingResult.handleKeyDown(e.event);\n }\n }}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n necessityIndicator={necessityIndicator}\n isRequired={isRequired}\n leadingIcon={_leadingIcon ?? leadingIcon ?? icon}\n prefix={prefix}\n trailingInteractionElement={renderInteractionElement()}\n trailingIcon={_trailingIcon ?? trailingIcon}\n suffix={suffix}\n validationState={validationState}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n trailingFooterSlot={(value) => {\n return format ? null : effectiveMaxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter\n currentCount={value?.length ?? 0}\n maxCount={effectiveMaxCharacters}\n size={size}\n />\n </BaseBox>\n ) : null;\n }}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n })}\n size={size}\n {...rest}\n />\n );\n};\n\nconst TextInput = assignWithoutSideEffects(React.forwardRef(_TextInput), {\n displayName: 'TextInput',\n});\n\nexport type { TextInputProps };\nexport { TextInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextInput","_ref","ref","_ref4","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","_ref$type","type","defaultValue","name","value","maxCharacters","format","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","_ref$size","size","leadingIcon","trailingIcon","isTaggedInput","tags","onTagChange","trailing","leading","labelSuffix","labelTrailing","onKeyDown","rest","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isInputFocussed","setIsInputFocussed","hasAlphanumeric","test","Error","concat","formattingResult","useFormattedInput","inputValue","formattedValue","effectiveMaxCharacters","maxLength","handleOnChange","useCallback","_ref2","handleChange","_useTaggedInput","useTaggedInput","inputRef","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","_React$useState","_React$useState2","isTrailingDropDownOpen","setIsTrailingDropDownOpen","_React$useState3","_React$useState4","isLeadingDropDownOpen","setIsLeadingDropDownOpen","textInputWrapperRef","useEffect","leadingDropDown","getComponentId","trailingDropdown","_leadingIcon","isIconComponent","undefined","_trailingIcon","hasLeadingInteractionElement","hasTrailingInteractionElement","renderDropdown","dropdown","isOpen","setIsOpen","defaultPlacement","cloneElement","selectionType","onOpenChange","children","Children","map","props","child","DropdownOverlay","referenceRef","_isNestedDropdown","renderLeadingDropDown","renderTrailingDropDown","Boolean","renderClearButton","_jsx","IconButton","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","hasTrailingDropDown","renderInteractionElement","Spinner","color","_jsxs","BaseBox","display","gap","Divider","orientation","BaseInput","_objectSpread","id","componentName","MetaConstants","TextInput","setInputWrapperRef","wrapperNode","hideLabelText","isDropdownTrigger","showAllTags","maxTagRows","trailingDropDown","leadingInteractionElement","_ref3","length","e","handleKeyDown","event","trailingInteractionElement","trailingFooterSlot","_value$length","marginTop","hintMarginTop","marginRight","CharacterCounter","currentCount","maxCount","getKeyboardAndAutocompleteProps","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyLA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAkB,EAA4C;AACnF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,UAA2E,GAAG,SAA9EA,UAA2EA,CAAAC,IAAA,EAgD/EC,GAAG,EACc;AAAA,EAAA,IAAAC,KAAA,CAAA;AAAA,EAAA,IA/CfC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,kBAAkB,GAAAJ,IAAA,CAAlBI,kBAAkB;IAAAC,kBAAA,GAAAL,IAAA,CAClBM,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,kBAAA;IACrBE,WAAW,GAAAP,IAAA,CAAXO,WAAW;IAAAC,SAAA,GAAAR,IAAA,CACXS,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,SAAA;IACbE,YAAY,GAAAV,IAAA,CAAZU,YAAY;IACZC,IAAI,GAAAX,IAAA,CAAJW,IAAI;IACJC,KAAK,GAAAZ,IAAA,CAALY,KAAK;IACLC,aAAa,GAAAb,IAAA,CAAba,aAAa;IACbC,MAAM,GAAAd,IAAA,CAANc,MAAM;IACNC,QAAQ,GAAAf,IAAA,CAARe,QAAQ;IACRC,OAAO,GAAAhB,IAAA,CAAPgB,OAAO;IACPC,QAAO,GAAAjB,IAAA,CAAPiB,OAAO;IACPC,OAAM,GAAAlB,IAAA,CAANkB,MAAM;IACNC,QAAQ,GAAAnB,IAAA,CAARmB,QAAQ;IACRC,UAAU,GAAApB,I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P,CAAA;OACM,CAAC,GACR,IAAI,CAAA;AACV,KAAA;AACA;AAAA;AACAN,IAAAA,SAAS,EAAEA,SAAU;AACrBI,IAAAA,MAAM,EAAEA,MAAAA;AAAO,GAAA,EACX4I,+BAA+B,CAAC;AAClCxK,IAAAA,IAAI,EAAJA,IAAI;AACJyB,IAAAA,qBAAqB,EAArBA,qBAAqB;AACrBC,IAAAA,0BAA0B,EAA1BA,0BAA0B;AAC1BC,IAAAA,cAAc,EAAdA,cAAAA;AACF,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AACFG,IAAAA,IAAI,EAAEA,IAAAA;GACFW,EAAAA,IAAI,CACT,CAAC,CAAA;AAEN,CAAC,CAAA;AAEKwG,IAAAA,SAAS,gBAAGwB,wBAAwB,eAAC5H,cAAK,CAAC6H,UAAU,CAACpL,UAAU,CAAC,EAAE;AACvEqL,EAAAA,WAAW,EAAE,WAAA;AACf,CAAC;;;;"}
@@ -68,6 +68,20 @@ var useFormattedInput = function useFormattedInput(_ref) {
68
68
  var emptyFormatted = format('', pattern !== null && pattern !== void 0 ? pattern : '');
69
69
  setInternalValue(emptyFormatted);
70
70
  }
71
+ // DATEPICKER FIX: Sync internal state when external value changes
72
+ // This addresses the issue where DatePicker programmatically updates the value prop
73
+ // (e.g., when user selects date from calendar), but the formatted input's internal
74
+ // state doesn't update, causing the input to not reflect the new value.
75
+ // Without this, only user typing and empty resets were handled.
76
+ if (userValue !== undefined && userValue !== '' && pattern) {
77
+ var rawValue = stripPatternCharacters(userValue);
78
+ var newFormatted = format(rawValue, pattern);
79
+
80
+ // Only update if the formatted value actually changed to avoid unnecessary re-renders
81
+ if (newFormatted !== internalValue) {
82
+ setInternalValue(newFormatted);
83
+ }
84
+ }
71
85
  }, [userValue, pattern]);
72
86
 
73
87
  // Apply calculated cursor position after value updates
@@ -144,6 +158,13 @@ var useFormattedInput = function useFormattedInput(_ref) {
144
158
  var prevIsDelimiter = !isUserCharacter(prevChar);
145
159
  if (prevIsDelimiter) {
146
160
  infoRef.current.cursorPosition = cursorPosition + nextUserCharIndex + 1;
161
+ } else {
162
+ // If we're at a delimiter after typing (not deleting), and there are more chars,
163
+ // we probably need to move past it unless it's a brand new delimiter
164
+ var delimiterExistedBefore = currentValue[cursorPosition] === formattedValue[cursorPosition];
165
+ if (delimiterExistedBefore) {
166
+ infoRef.current.cursorPosition = cursorPosition + 1;
167
+ }
147
168
  }
148
169
  }
149
170
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useFormattedInput.js","sources":["../../../../../../../src/components/Input/TextInput/useFormattedInput.ts"],"sourcesContent":["import type React from 'react';\nimport { useCallback, useRef, useState, useEffect, useMemo } from 'react';\nimport type { FormInputOnEvent } from '~components/Form/FormTypes';\n\n/**\n * Formats user input according to pattern. format(\"1234\", \"##/##\") → \"12/34\"\n */\nconst format = (value: string, pattern: string): string => {\n if (!pattern) return value;\n\n let result = '';\n let valueIndex = 0;\n\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i]; // \"#\" or \"/\"\n\n if (patternChar === '#') {\n if (valueIndex < value.length) {\n result += value[valueIndex]; // add \"1\" from \"1234\"\n valueIndex++;\n } else {\n break; // No more input chars, stop\n }\n } else {\n result += patternChar; // add \"/\" delimiter\n }\n }\n\n return result; // \"12/34\"\n};\n\n/**\n * Removes delimiters, keeps only user input. stripPatternCharacters(\"12/34\") → \"1234\"\n */\nconst stripPatternCharacters = (value: string): string => {\n return value.replace(/[^\\dA-z]/g, ''); // \"12/34\" → \"1234\" (removes \"/\")\n};\n\n/**\n * Checks if character is user input vs delimiter. isUserCharacter('1') → true, isUserCharacter('/') → false\n */\nconst isUserCharacter = (character: string): boolean => {\n return /[\\dA-z]/.test(character); // \"1\" → true, \"/\" → false\n};\n\ntype UseFormattedInputProps = {\n format?: string;\n onChange?: (params: { name?: string; value?: string; rawValue?: string }) => void;\n value?: string;\n defaultValue?: string;\n};\n\ntype UseFormattedInputReturn = {\n formattedValue: string;\n handleChange: FormInputOnEvent;\n handleKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n maxLength?: number;\n};\n\n/**\n * Hook for pattern-based input formatting with smart cursor positioning.\n * useFormattedInput({ format: \"##/##\" }) transforms \"1234\" → \"12/34\"\n */\nexport const useFormattedInput = ({\n format: pattern,\n onChange,\n value: userValue,\n defaultValue = '',\n}: UseFormattedInputProps): UseFormattedInputReturn => {\n const initialValue = useMemo(() => {\n return format(userValue ?? defaultValue, pattern ?? '');\n }, [userValue, defaultValue, pattern]);\n\n const [internalValue, setInternalValue] = useState(initialValue);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const infoRef = useRef<{\n cursorPosition?: number;\n endOfSection?: boolean;\n }>({});\n\n const maxLength = useMemo(() => pattern?.length, [pattern]);\n\n // Reset internal state when parent clears value (form resets, external state changes)\n // Preserves format delimiters for visual guidance. Example: \"(###)\" → \"( )\" when cleared\n useEffect(() => {\n if ((userValue === '' || userValue === undefined) && defaultValue === '') {\n const emptyFormatted = format('', pattern ?? '');\n setInternalValue(emptyFormatted);\n }\n }, [userValue, pattern]);\n\n // Apply calculated cursor position after value updates\n useEffect(() => {\n const { cursorPosition, endOfSection } = infoRef.current;\n\n if (endOfSection || cursorPosition === undefined) return; // Skip if no position or end section\n\n if (inputRef.current) {\n inputRef.current.setSelectionRange(cursorPosition, cursorPosition);\n }\n }, [internalValue]);\n\n const handleChange: FormInputOnEvent = useCallback(\n ({ name, value: inputValue }) => {\n if (!pattern) {\n // No pattern = regular input\n const cleanValue = inputValue ?? '';\n onChange?.({ name, value: cleanValue });\n setInternalValue(cleanValue);\n return;\n }\n\n const currentValue = internalValue; // \"12/34\" (user wants to delete \"/\")\n const newInputValue = inputValue ?? ''; // \"1234\" (after deleting \"/\")\n const cursorPosition = inputRef.current?.selectionStart ?? 0; // 2 (cursor where \"/\" was)\n const didDelete = newInputValue.length < currentValue.length; // 4 < 5 → true\n\n infoRef.current.cursorPosition = cursorPosition;\n\n let rawValue = stripPatternCharacters(newInputValue); // \"1234\" → \"1234\"\n\n // Handle special case: user deleted a delimiter (like deleting \"/\" in \"12/|34\")\n if (didDelete) {\n const deletedChar = currentValue[cursorPosition] ?? ''; // \"12/34\"[2] → \"/\"\n const deletedDelimiter = !isUserCharacter(deletedChar); // \"/\" → true (is delimiter)\n\n if (deletedDelimiter) {\n // true (will execute for \"/\" deletion)\n const beforeCursor = newInputValue.substring(0, cursorPosition); // \"12\" (before cursor)\n const afterCursor = newInputValue.substring(cursorPosition); // \"34\" (after cursor)\n const rawBefore = stripPatternCharacters(beforeCursor); // \"12\" → \"12\"\n const rawAfter = stripPatternCharacters(afterCursor); // \"34\" → \"34\"\n\n rawValue = rawBefore.slice(0, -1) + rawAfter; // \"12\".slice(0,-1) + \"34\" → \"1\" + \"34\" → \"134\"\n\n // Removes trailing non-alphanumeric characters from the end of the string, preserving the last alphanumeric word before them.\n infoRef.current.cursorPosition =\n beforeCursor.replace(/([\\d\\w]+)[^\\dA-z]+$/, '$1').length - 1;\n }\n }\n\n const formattedValue = format(rawValue, pattern); // format(\"134\", \"##/##\") → \"13/4\"\n infoRef.current.endOfSection = false;\n\n // Handle cursor positioning when typing (not deleting)\n if (!didDelete) {\n // User types \"2\" in \"1|\" → becomes \"12|/\" → should jump to \"12/|\"\n const nextChar = formattedValue[cursorPosition]; // \"12/\"[2] → \"/\" (delimiter)\n const nextIsDelimiter = nextChar ? !isUserCharacter(nextChar) : false; // \"/\" → true\n\n const remainingText = formattedValue.substring(cursorPosition); // \"12/\".substring(2) → \"/\"\n const nextUserCharIndex = remainingText.search(/[\\dA-z]/); // \"/\".search() → -1 (no user chars)\n const hasMoreUserChars = nextUserCharIndex !== -1; // -1 !== -1 → false\n\n infoRef.current.endOfSection = nextIsDelimiter && !hasMoreUserChars; // true && false → false\n\n // Move cursor past auto-inserted delimiters for smooth typing\n if (nextIsDelimiter && hasMoreUserChars) {\n const prevChar = formattedValue[cursorPosition - 1] ?? '';\n const prevIsDelimiter = !isUserCharacter(prevChar);\n\n if (prevIsDelimiter) {\n infoRef.current.cursorPosition = cursorPosition + nextUserCharIndex + 1;\n }\n }\n }\n\n onChange?.({ name, value: formattedValue, rawValue });\n setInternalValue(formattedValue);\n },\n [pattern, onChange, internalValue],\n );\n\n const handleKeyDown = useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.currentTarget && inputRef.current !== event.currentTarget) {\n inputRef.current = event.currentTarget;\n }\n }, []);\n\n return {\n formattedValue: internalValue,\n handleChange,\n handleKeyDown,\n maxLength,\n };\n};\n"],"names":["format","value","pattern","result","valueIndex","i","length","patternChar","stripPatternCharacters","replace","isUserCharacter","character","test","useFormattedInput","_ref","onChange","userValue","_ref$defaultValue","defaultValue","initialValue","useMemo","_useState","useState","_useState2","_slicedToArray","internalValue","setInternalValue","inputRef","useRef","infoRef","maxLength","useEffect","undefined","emptyFormatted","_infoRef$current","current","cursorPosition","endOfSection","setSelectionRange","handleChange","useCallback","_ref2","_inputRef$current$sel","_inputRef$current","name","inputValue","cleanValue","currentValue","newInputValue","selectionStart","didDelete","rawValue","_currentValue$cursorP","deletedChar","deletedDelimiter","beforeCursor","substring","afterCursor","rawBefore","rawAfter","slice","formattedValue","nextChar","nextIsDelimiter","remainingText","nextUserCharIndex","search","hasMoreUserChars","_formattedValue","prevChar","prevIsDelimiter","handleKeyDown","event","currentTarget"],"mappings":";;;AAIA;AACA;AACA;AACA,IAAMA,MAAM,GAAG,SAATA,MAAMA,CAAIC,KAAa,EAAEC,OAAe,EAAa;AACzD,EAAA,IAAI,CAACA,OAAO,EAAE,OAAOD,KAAK,CAAA;EAE1B,IAAIE,MAAM,GAAG,EAAE,CAAA;EACf,IAAIC,UAAU,GAAG,CAAC,CAAA;AAElB,EAAA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,OAAO,CAACI,MAAM,EAAED,CAAC,EAAE,EAAE;AACvC,IAAA,IAAME,WAAW,GAAGL,OAAO,CAACG,CAAC,CAAC,CAAC;;IAE/B,IAAIE,WA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,gBAAgB,CAACmC,cAAc,CAAC,CAAA;GACjC,EACD,CAAC3D,OAAO,EAAEa,QAAQ,EAAEU,aAAa,CACnC,CAAC,CAAA;AAED,EAAA,IAAM8C,aAAa,GAAG/B,WAAW,CAAC,UAACgC,KAA4C,EAAK;IAClF,IAAIA,KAAK,CAACC,aAAa,IAAI9C,QAAQ,CAACQ,OAAO,KAAKqC,KAAK,CAACC,aAAa,EAAE;AACnE9C,MAAAA,QAAQ,CAACQ,OAAO,GAAGqC,KAAK,CAACC,aAAa,CAAA;AACxC,KAAA;GACD,EAAE,EAAE,CAAC,CAAA;EAEN,OAAO;AACLZ,IAAAA,cAAc,EAAEpC,aAAa;AAC7Bc,IAAAA,YAAY,EAAZA,YAAY;AACZgC,IAAAA,aAAa,EAAbA,aAAa;AACbzC,IAAAA,SAAS,EAATA,SAAAA;GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"useFormattedInput.js","sources":["../../../../../../../src/components/Input/TextInput/useFormattedInput.ts"],"sourcesContent":["import type React from 'react';\nimport { useCallback, useRef, useState, useEffect, useMemo } from 'react';\nimport type { FormInputOnEvent } from '~components/Form/FormTypes';\n\n/**\n * Formats user input according to pattern. format(\"1234\", \"##/##\") → \"12/34\"\n */\nconst format = (value: string, pattern: string): string => {\n if (!pattern) return value;\n\n let result = '';\n let valueIndex = 0;\n\n for (let i = 0; i < pattern.length; i++) {\n const patternChar = pattern[i]; // \"#\" or \"/\"\n\n if (patternChar === '#') {\n if (valueIndex < value.length) {\n result += value[valueIndex]; // add \"1\" from \"1234\"\n valueIndex++;\n } else {\n break; // No more input chars, stop\n }\n } else {\n result += patternChar; // add \"/\" delimiter\n }\n }\n\n return result; // \"12/34\"\n};\n\n/**\n * Removes delimiters, keeps only user input. stripPatternCharacters(\"12/34\") → \"1234\"\n */\nconst stripPatternCharacters = (value: string): string => {\n return value.replace(/[^\\dA-z]/g, ''); // \"12/34\" → \"1234\" (removes \"/\")\n};\n\n/**\n * Checks if character is user input vs delimiter. isUserCharacter('1') → true, isUserCharacter('/') → false\n */\nconst isUserCharacter = (character: string): boolean => {\n return /[\\dA-z]/.test(character); // \"1\" → true, \"/\" → false\n};\n\ntype UseFormattedInputProps = {\n format?: string;\n onChange?: (params: { name?: string; value?: string; rawValue?: string }) => void;\n value?: string;\n defaultValue?: string;\n};\n\ntype UseFormattedInputReturn = {\n formattedValue: string;\n handleChange: FormInputOnEvent;\n handleKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n maxLength?: number;\n};\n\n/**\n * Hook for pattern-based input formatting with smart cursor positioning.\n * useFormattedInput({ format: \"##/##\" }) transforms \"1234\" → \"12/34\"\n */\nexport const useFormattedInput = ({\n format: pattern,\n onChange,\n value: userValue,\n defaultValue = '',\n}: UseFormattedInputProps): UseFormattedInputReturn => {\n const initialValue = useMemo(() => {\n return format(userValue ?? defaultValue, pattern ?? '');\n }, [userValue, defaultValue, pattern]);\n\n const [internalValue, setInternalValue] = useState(initialValue);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const infoRef = useRef<{\n cursorPosition?: number;\n endOfSection?: boolean;\n }>({});\n\n const maxLength = useMemo(() => pattern?.length, [pattern]);\n\n // Reset internal state when parent clears value (form resets, external state changes)\n // Preserves format delimiters for visual guidance. Example: \"(###)\" → \"( )\" when cleared\n useEffect(() => {\n if ((userValue === '' || userValue === undefined) && defaultValue === '') {\n const emptyFormatted = format('', pattern ?? '');\n setInternalValue(emptyFormatted);\n }\n // DATEPICKER FIX: Sync internal state when external value changes\n // This addresses the issue where DatePicker programmatically updates the value prop\n // (e.g., when user selects date from calendar), but the formatted input's internal\n // state doesn't update, causing the input to not reflect the new value.\n // Without this, only user typing and empty resets were handled.\n if (userValue !== undefined && userValue !== '' && pattern) {\n const rawValue = stripPatternCharacters(userValue);\n const newFormatted = format(rawValue, pattern);\n\n // Only update if the formatted value actually changed to avoid unnecessary re-renders\n if (newFormatted !== internalValue) {\n setInternalValue(newFormatted);\n }\n }\n }, [userValue, pattern]);\n\n // Apply calculated cursor position after value updates\n useEffect(() => {\n const { cursorPosition, endOfSection } = infoRef.current;\n\n if (endOfSection || cursorPosition === undefined) return; // Skip if no position or end section\n\n if (inputRef.current) {\n inputRef.current.setSelectionRange(cursorPosition, cursorPosition);\n }\n }, [internalValue]);\n\n const handleChange: FormInputOnEvent = useCallback(\n ({ name, value: inputValue }) => {\n if (!pattern) {\n // No pattern = regular input\n const cleanValue = inputValue ?? '';\n onChange?.({ name, value: cleanValue });\n setInternalValue(cleanValue);\n return;\n }\n\n const currentValue = internalValue; // \"12/34\" (user wants to delete \"/\")\n const newInputValue = inputValue ?? ''; // \"1234\" (after deleting \"/\")\n const cursorPosition = inputRef.current?.selectionStart ?? 0; // 2 (cursor where \"/\" was)\n const didDelete = newInputValue.length < currentValue.length; // 4 < 5 → true\n\n infoRef.current.cursorPosition = cursorPosition;\n\n let rawValue = stripPatternCharacters(newInputValue); // \"1234\" → \"1234\"\n\n // Handle special case: user deleted a delimiter (like deleting \"/\" in \"12/|34\")\n if (didDelete) {\n const deletedChar = currentValue[cursorPosition] ?? ''; // \"12/34\"[2] → \"/\"\n const deletedDelimiter = !isUserCharacter(deletedChar); // \"/\" → true (is delimiter)\n\n if (deletedDelimiter) {\n // true (will execute for \"/\" deletion)\n const beforeCursor = newInputValue.substring(0, cursorPosition); // \"12\" (before cursor)\n const afterCursor = newInputValue.substring(cursorPosition); // \"34\" (after cursor)\n const rawBefore = stripPatternCharacters(beforeCursor); // \"12\" → \"12\"\n const rawAfter = stripPatternCharacters(afterCursor); // \"34\" → \"34\"\n\n rawValue = rawBefore.slice(0, -1) + rawAfter; // \"12\".slice(0,-1) + \"34\" → \"1\" + \"34\" → \"134\"\n\n // Removes trailing non-alphanumeric characters from the end of the string, preserving the last alphanumeric word before them.\n infoRef.current.cursorPosition =\n beforeCursor.replace(/([\\d\\w]+)[^\\dA-z]+$/, '$1').length - 1;\n }\n }\n\n const formattedValue = format(rawValue, pattern); // format(\"134\", \"##/##\") → \"13/4\"\n infoRef.current.endOfSection = false;\n\n // Handle cursor positioning when typing (not deleting)\n if (!didDelete) {\n // User types \"2\" in \"1|\" → becomes \"12|/\" → should jump to \"12/|\"\n const nextChar = formattedValue[cursorPosition]; // \"12/\"[2] → \"/\" (delimiter)\n const nextIsDelimiter = nextChar ? !isUserCharacter(nextChar) : false; // \"/\" → true\n\n const remainingText = formattedValue.substring(cursorPosition); // \"12/\".substring(2) → \"/\"\n const nextUserCharIndex = remainingText.search(/[\\dA-z]/); // \"/\".search() → -1 (no user chars)\n const hasMoreUserChars = nextUserCharIndex !== -1; // -1 !== -1 → false\n\n infoRef.current.endOfSection = nextIsDelimiter && !hasMoreUserChars; // true && false → false\n\n // Move cursor past auto-inserted delimiters for smooth typing\n if (nextIsDelimiter && hasMoreUserChars) {\n const prevChar = formattedValue[cursorPosition - 1] ?? '';\n const prevIsDelimiter = !isUserCharacter(prevChar);\n\n if (prevIsDelimiter) {\n infoRef.current.cursorPosition = cursorPosition + nextUserCharIndex + 1;\n } else {\n // If we're at a delimiter after typing (not deleting), and there are more chars,\n // we probably need to move past it unless it's a brand new delimiter\n const delimiterExistedBefore =\n currentValue[cursorPosition] === formattedValue[cursorPosition];\n if (delimiterExistedBefore) {\n infoRef.current.cursorPosition = cursorPosition + 1;\n }\n }\n }\n }\n\n onChange?.({ name, value: formattedValue, rawValue });\n setInternalValue(formattedValue);\n },\n [pattern, onChange, internalValue],\n );\n\n const handleKeyDown = useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.currentTarget && inputRef.current !== event.currentTarget) {\n inputRef.current = event.currentTarget;\n }\n }, []);\n\n return {\n formattedValue: internalValue,\n handleChange,\n handleKeyDown,\n maxLength,\n };\n};\n"],"names":["format","value","pattern","result","valueIndex","i","length","patternChar","stripPatternCharacters","replace","isUserCharacter","character","test","useFormattedInput","_ref","onChange","userValue","_ref$defaultValue","defaultValue","initialValue","useMemo","_useState","useState","_useState2","_slicedToArray","internalValue","setInternalValue","inputRef","useRef","infoRef","maxLength","useEffect","undefined","emptyFormatted","rawValue","newFormatted","_infoRef$current","current","cursorPosition","endOfSection","setSelectionRange","handleChange","useCallback","_ref2","_inputRef$current$sel","_inputRef$current","name","inputValue","cleanValue","currentValue","newInputValue","selectionStart","didDelete","_currentValue$cursorP","deletedChar","deletedDelimiter","beforeCursor","substring","afterCursor","rawBefore","rawAfter","slice","formattedValue","nextChar","nextIsDelimiter","remainingText","nextUserCharIndex","search","hasMoreUserChars","_formattedValue","prevChar","prevIsDelimiter","delimiterExistedBefore","handleKeyDown","event","currentTarget"],"mappings":";;;AAIA;AACA;AACA;AACA,IAAMA,MAAM,GAAG,SAATA,MAAMA,CAAIC,KAAa,EAAEC,OAAe,EAAa;AACzD,EAAA,IAAI,CAACA,OAAO,EAAE,OAAOD,KAAK,CAAA;EAE1B,IAAIE,MAAM,GAAG,EAAE,CAAA;EACf,IAAIC,UAAU,GAAG,CAAC,CAAA;AAElB,EAAA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,OAAO,CAACI,MAAM,EAAED,CAAC,EAAE,EAAE;AACvC,IAAA,IAAME,WAAW,GAAGL,OAAO,CAACG,CAAC,CAAC,CAAC;;IAE/B,IAAIE,WAAW,KAAK,GAAG,EAAE;AACvB,MAAA,IAAIH,UAAU,GAAGH,KAAK,CAACK,MAAM,EAAE;AAC7BH,QAAAA,MAAM,IAAIF,KAAK,CAACG,UAAU,CAAC,CAAC;AAC5BA,QAAAA,UAAU,EAAE,CAAA;AACd,OAAC,MAAM;AACL,QAAA,MAAM;AACR,OAAA;AACF,KAAC,MAAM;MACLD,MAAM,IAAII,WAAW,CAAC;AACxB,KAAA;AACF,GAAA;EAEA,OAAOJ,MAAM,CAAC;AAChB,CAAC,CAAA;;AAED;AACA;AACA;AACA,IAAMK,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAIP,KAAa,EAAa;EACxD,OAAOA,KAAK,CAACQ,OAAO,CAAC,WAAW,EAAE,EAAE,CA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