@hh.ru/magritte-ui-input 5.0.27 → 5.0.29
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/BaseInput.js +2 -2
- package/BaseInput.js.map +1 -1
- package/DateTimeInput.js +1 -1
- package/UncontrolledDateTimeInput.js +1 -1
- package/index.css +114 -87
- package/{index.esm-jCMiQLQm.js → index.esm-CTmNhX1-.js} +1 -1
- package/{index.esm-jCMiQLQm.js.map → index.esm-CTmNhX1-.js.map} +1 -1
- package/index.js +1 -1
- package/maskito-exports.js +1 -1
- package/package.json +5 -3
- package/useDateTimeMask.js +1 -1
package/BaseInput.js
CHANGED
|
@@ -13,7 +13,7 @@ import { useFocus } from './useFocus.js';
|
|
|
13
13
|
import { useInputAriaProps } from './useInputAriaProps.js';
|
|
14
14
|
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
15
15
|
|
|
16
|
-
var styles = {"input":"magritte-input___LVTID_5-0-
|
|
16
|
+
var styles = {"input":"magritte-input___LVTID_5-0-29","label":"magritte-label___YlOQk_5-0-29","elevated":"magritte-elevated___kPcsM_5-0-29","focused":"magritte-focused___dxrHD_5-0-29","invalid":"magritte-invalid___L5MVa_5-0-29","disabled":"magritte-disabled___0NH6E_5-0-29","position-container":"magritte-position-container___kZnvZ_5-0-29","positionContainer":"magritte-position-container___kZnvZ_5-0-29","field":"magritte-field___9S8Tw_5-0-29","hint":"magritte-hint___EFGK0_5-0-29","additional-value":"magritte-additional-value___9Kyap_5-0-29","additionalValue":"magritte-additional-value___9Kyap_5-0-29","label_elevated":"magritte-label_elevated___PVcpC_5-0-29","labelElevated":"magritte-label_elevated___PVcpC_5-0-29","fixed-placeholder":"magritte-fixed-placeholder___PYJIH_5-0-29","fixedPlaceholder":"magritte-fixed-placeholder___PYJIH_5-0-29","icon":"magritte-icon___HEDsQ_5-0-29","focus-visible":"magritte-focus-visible___QvCO1_5-0-29","focusVisible":"magritte-focus-visible___QvCO1_5-0-29","right-container":"magritte-right-container___N0B0o_5-0-29","rightContainer":"magritte-right-container___N0B0o_5-0-29","with-icon":"magritte-with-icon___TPBe2_5-0-29","withIcon":"magritte-with-icon___TPBe2_5-0-29","large":"magritte-large___9frRh_5-0-29","autofill-helper":"magritte-autofill-helper___WFjOW_5-0-29","autofillHelper":"magritte-autofill-helper___WFjOW_5-0-29","content-container":"magritte-content-container___s-0kX_5-0-29","contentContainer":"magritte-content-container___s-0kX_5-0-29","rigging-container":"magritte-rigging-container___Up9Lb_5-0-29","riggingContainer":"magritte-rigging-container___Up9Lb_5-0-29","input__mask":"magritte-input__mask___CHda2_5-0-29","inputMask":"magritte-input__mask___CHda2_5-0-29","value-ghost":"magritte-value-ghost___IXNZj_5-0-29","valueGhost":"magritte-value-ghost___IXNZj_5-0-29","hint-container":"magritte-hint-container___rGsD8_5-0-29","hintContainer":"magritte-hint-container___rGsD8_5-0-29","with-right":"magritte-with-right___NUNiP_5-0-29","withRight":"magritte-with-right___NUNiP_5-0-29","counter":"magritte-counter___Bld3Q_5-0-29","value-container":"magritte-value-container___6ReT7_5-0-29","valueContainer":"magritte-value-container___6ReT7_5-0-29"};
|
|
17
17
|
|
|
18
18
|
const BaseInputComponent = ({ onChange, onFocus, onBlur, value, placeholder, disabled = false, postfix, size = 'medium', elevatePlaceholder = false, invalid = false, description, errorMessage, formatter, buttonIcon, clearable = false, clearableOnFocus, onButtonClick, buttonDataQa, buttonRef, inputIcon, wrapperRef, counter, fixedPlaceholder, maxLength, hint, showHintAlways = false, ...restProps }, ref) => {
|
|
19
19
|
const wrapperCurrentRef = useRef(null);
|
|
@@ -121,7 +121,7 @@ const BaseInputComponent = ({ onChange, onFocus, onBlur, value, placeholder, dis
|
|
|
121
121
|
[styles.invalid]: !!invalid,
|
|
122
122
|
[styles.withRight]: !!buttonIcon || showClearButton || counter,
|
|
123
123
|
[styles.withIcon]: !!inputIcon,
|
|
124
|
-
}), onFocus: clearableOnFocus ? handleWrapperFocus : undefined, onBlur: clearableOnFocus ? handleWrapperBlur : undefined, onClick: onClickWrapper, children: [jsxs("div", { className: styles.positionContainer, children: [jsxs("div", { className: styles.hintContainer, children: [jsxs("div", { className: styles.contentContainer, children: [!!InputIconComponent && (jsx("div", { className: styles.icon, children: jsx(InputIconComponent, {}) })), jsxs("div", { className: styles.valueContainer, children: [jsx("input", { ...restProps, ...ariaProps, maxLength: maxLength, disabled: isComponentDisabled, suppressHydrationWarning: true, className: styles.field, value: currentValue, onInput: changeHandler, onFocus: focusHandler, onBlur: blurHandler, ref: inputRefCallback }), jsx("div", { className: styles.additionalValue, children: jsxs(Text, { Element: "span", typography: "label-2-regular", children: [jsx("span", { className: styles.valueGhost, children: currentValue }), showFixedPlaceholder && (jsx("span", { className: styles.fixedPlaceholder, children: fixedPlaceholder.slice(value.length) })), showPostfix && (jsxs(Fragment, { children: ['\u00A0', postfix] }))] }) })] }), jsx("div", { className: styles.riggingContainer, children: showLabel && (jsx("label", { className: classnames(styles.label, {
|
|
124
|
+
}), onFocus: clearableOnFocus ? handleWrapperFocus : undefined, onBlur: clearableOnFocus ? handleWrapperBlur : undefined, onClick: onClickWrapper, children: [jsxs("div", { className: styles.positionContainer, children: [jsxs("div", { className: styles.hintContainer, children: [jsx("div", { className: styles.autofillHelper }), jsxs("div", { className: styles.contentContainer, children: [!!InputIconComponent && (jsx("div", { className: styles.icon, children: jsx(InputIconComponent, {}) })), jsxs("div", { className: styles.valueContainer, children: [jsx("input", { ...restProps, ...ariaProps, maxLength: maxLength, disabled: isComponentDisabled, suppressHydrationWarning: true, className: styles.field, value: currentValue, onInput: changeHandler, onFocus: focusHandler, onBlur: blurHandler, ref: inputRefCallback }), jsx("div", { className: styles.additionalValue, children: jsxs(Text, { Element: "span", typography: "label-2-regular", children: [jsx("span", { className: styles.valueGhost, children: currentValue }), showFixedPlaceholder && (jsx("span", { className: styles.fixedPlaceholder, children: fixedPlaceholder.slice(value.length) })), showPostfix && (jsxs(Fragment, { children: ['\u00A0', postfix] }))] }) })] }), jsx("div", { className: styles.riggingContainer, children: showLabel && (jsx("label", { className: classnames(styles.label, {
|
|
125
125
|
[styles.labelElevated]: placeholderIsElevated,
|
|
126
126
|
}), id: ariaProps['aria-labelledby'], children: placeholder })) })] }), showHint && (jsx("div", { className: styles.hint, ref: hintWrapperRefCallback, "data-qa": "input-hint", children: jsx(Text, { Element: "span", typography: "label-3-regular", children: jsx("span", { ref: hintRef, children: hint }) }) }))] }), (buttonIcon || showClearButton || counter) && (jsxs("div", { className: styles.rightContainer, children: [(buttonIcon || showClearButton) && (jsx(Action, { "data-qa": buttonQaLabel, mode: "secondary", onMouseDown: (event) => event.preventDefault(), onClick: showClearButton ? clearClickHandler : onButtonClick, icon: showClearButton ? CrossOutlinedSize24 : buttonIcon, disabled: isComponentDisabled, ref: buttonRef })), counter && (jsx("span", { className: styles.counter, children: jsx(DeprecatedCounter, { label: counter }) }))] }))] }), jsx(FormHelper, { description: description, errorMessage: errorMessage, descriptionId: ariaProps['aria-describedby'], disabled: isComponentDisabled, invalid: invalid })] }));
|
|
127
127
|
};
|
package/BaseInput.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInput.js","sources":["../src/BaseInput.tsx"],"sourcesContent":["import {\n InputHTMLAttributes,\n forwardRef,\n ForwardedRef,\n useCallback,\n useId,\n useRef,\n useState,\n useEffect,\n RefCallback,\n} from 'react';\nimport classnames from 'classnames';\n\nimport { Selection } from '@hh.ru/magritte-common-text-selection';\nimport { useDisabled } from '@hh.ru/magritte-common-use-disabled';\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { Action } from '@hh.ru/magritte-ui-action';\nimport { DeprecatedCounter } from '@hh.ru/magritte-ui-counter';\nimport { FormHelper } from '@hh.ru/magritte-ui-form-helper';\nimport { CrossOutlinedSize24 } from '@hh.ru/magritte-ui-icon/icon';\nimport { IconWrapperComponentSize24 } from '@hh.ru/magritte-ui-icon/src/iconTypes';\nimport { BaseInputProps } from '@hh.ru/magritte-ui-input/types';\nimport { useFocus } from '@hh.ru/magritte-ui-input/useFocus';\nimport { useInputAriaProps } from '@hh.ru/magritte-ui-input/useInputAriaProps';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './input.less';\n\nconst BaseInputComponent = (\n {\n onChange,\n onFocus,\n onBlur,\n value,\n placeholder,\n disabled = false,\n postfix,\n size = 'medium',\n elevatePlaceholder = false,\n invalid = false,\n description,\n errorMessage,\n formatter,\n buttonIcon,\n clearable = false,\n clearableOnFocus,\n onButtonClick,\n buttonDataQa,\n buttonRef,\n inputIcon,\n wrapperRef,\n counter,\n fixedPlaceholder,\n maxLength,\n hint,\n showHintAlways = false,\n ...restProps\n }: BaseInputProps & Omit<InputHTMLAttributes<HTMLInputElement>, keyof BaseInputProps>,\n ref: ForwardedRef<HTMLInputElement>\n) => {\n const wrapperCurrentRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const [isActionVisible, setActionVisible] = useState(false);\n const inputRefCallback = useMultipleRefs(ref, inputRef);\n const wrapperRefCallback = useMultipleRefs(wrapperRef, wrapperCurrentRef);\n const descriptionId = useId();\n const labelId = useId();\n const hintRef = useRef<HTMLDivElement>(null);\n const hintMaxWidthRef = useRef<{ width: number; text: string } | null>(null);\n const change = useCallback(\n (newValue: string) => {\n if (inputRef.current && formatter) {\n const caretPosition = Selection.getCaretPosition(inputRef.current);\n const formatResult = formatter(value, newValue, caretPosition || 0);\n requestAnimationFrame(() => {\n if (inputRef.current) {\n Selection.setCaretPosition(inputRef.current, formatResult.caretPosition);\n }\n });\n onChange(formatResult.outputValue);\n return;\n }\n onChange(newValue);\n },\n [formatter, onChange, value, inputRef]\n );\n\n const clearClickHandler = useCallback(\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n onChange('');\n inputRef.current && inputRef.current.focus();\n onButtonClick?.(event);\n },\n [onChange, inputRef, onButtonClick]\n );\n\n const forceDisabled = useDisabled();\n const isComponentDisabled = forceDisabled || !!disabled;\n\n const { changeHandler, focusHandler, blurHandler, isFocused } = useFocus(change, onFocus, onBlur);\n const placeholderCanElevated = size === 'large' && !!elevatePlaceholder && !!placeholder;\n const [isFocusVisible, setFocusVisible] = useState(false);\n const currentValue = formatter?.('', value, 0).formattedValue || value;\n const buttonQaLabel = buttonDataQa || `input-${clearable ? 'clearable-' : ''}button`;\n const ariaProps = useInputAriaProps({\n invalid,\n hasDescription: !!description,\n hasPlaceholder: !!placeholder,\n descriptionId,\n labelId,\n });\n\n const handleWrapperFocus = () => {\n setActionVisible(true);\n };\n\n const handleWrapperBlur = () => {\n requestAnimationFrame(() => {\n if (!wrapperCurrentRef.current?.contains(document.activeElement)) {\n setActionVisible(false);\n }\n });\n };\n\n const onClickWrapper = () => {\n requestAnimationFrame(() => {\n if (document.activeElement !== inputRef.current) {\n inputRef.current?.focus();\n }\n });\n };\n\n const focusedOrFilled = isFocused || value !== '';\n const placeholderIsElevated = focusedOrFilled && placeholderCanElevated;\n const showPostfix = !!postfix && (placeholderIsElevated || value !== '');\n const showFixedPlaceholder = focusedOrFilled && !!fixedPlaceholder;\n const showLabel = placeholderCanElevated || (value === '' && !showFixedPlaceholder);\n\n const InputIconComponent = inputIcon || null;\n const showClearButton = value.length > 0 && (clearable || (!!clearableOnFocus && isActionVisible));\n const showHint = !!hint && (showHintAlways || value.length > 0);\n\n const hintWrapperRefCallback: RefCallback<HTMLDivElement> = useCallback(\n (element) => {\n if (element && hintRef.current) {\n const text = hintRef.current.innerText;\n if (text.length > 30) {\n let maxWidth;\n if (text !== hintMaxWidthRef.current?.text) {\n const newText = text.slice(0, 30);\n hintRef.current.innerText = newText;\n maxWidth = hintRef.current.offsetWidth;\n hintRef.current.innerText = text;\n hintMaxWidthRef.current = {\n width: maxWidth,\n text,\n };\n } else {\n maxWidth = hintMaxWidthRef.current.width;\n }\n\n element.style.maxWidth = `${maxWidth}px`;\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [hint]\n );\n\n useEffect(() => {\n if (inputRef.current) {\n setFocusVisible(isFocused && inputRef.current.classList.contains('focus-visible'));\n }\n }, [isFocused]);\n\n return (\n <div\n ref={wrapperRefCallback}\n className={classnames(styles.input, {\n [styles.focused]: isFocused,\n [styles.focusVisible]: isFocusVisible,\n [styles.disabled]: isComponentDisabled,\n [styles.large]: size === 'large',\n [styles.elevated]: placeholderCanElevated,\n [styles.invalid]: !!invalid,\n [styles.withRight]: !!buttonIcon || showClearButton || counter,\n [styles.withIcon]: !!inputIcon,\n })}\n onFocus={clearableOnFocus ? handleWrapperFocus : undefined}\n onBlur={clearableOnFocus ? handleWrapperBlur : undefined}\n onClick={onClickWrapper}\n >\n <div className={styles.positionContainer}>\n <div className={styles.hintContainer}>\n <div className={styles.contentContainer}>\n {!!InputIconComponent && (\n <div className={styles.icon}>\n <InputIconComponent />\n </div>\n )}\n <div className={styles.valueContainer}>\n <input\n {...restProps}\n {...ariaProps}\n maxLength={maxLength}\n disabled={isComponentDisabled}\n suppressHydrationWarning\n className={styles.field}\n value={currentValue}\n onInput={changeHandler} // maskito требует onInput, (https://maskito.dev/frameworks/react) который работает аналогично onChange\n onFocus={focusHandler}\n onBlur={blurHandler}\n ref={inputRefCallback}\n />\n <div className={styles.additionalValue}>\n <Text Element=\"span\" typography=\"label-2-regular\">\n <span className={styles.valueGhost}>{currentValue}</span>\n {showFixedPlaceholder && (\n <span className={styles.fixedPlaceholder}>\n {fixedPlaceholder.slice(value.length)}\n </span>\n )}\n {showPostfix && (\n <>\n {'\\u00A0'}\n {postfix}\n </>\n )}\n </Text>\n </div>\n </div>\n <div className={styles.riggingContainer}>\n {showLabel && (\n <label\n className={classnames(styles.label, {\n [styles.labelElevated]: placeholderIsElevated,\n })}\n id={ariaProps['aria-labelledby']}\n >\n {placeholder}\n </label>\n )}\n </div>\n </div>\n {showHint && (\n <div className={styles.hint} ref={hintWrapperRefCallback} data-qa=\"input-hint\">\n <Text Element=\"span\" typography=\"label-3-regular\">\n <span ref={hintRef}>{hint}</span>\n </Text>\n </div>\n )}\n </div>\n {(buttonIcon || showClearButton || counter) && (\n <div className={styles.rightContainer}>\n {(buttonIcon || showClearButton) && (\n <Action\n data-qa={buttonQaLabel}\n mode=\"secondary\"\n onMouseDown={(event) => event.preventDefault()} // чтобы инпут не терял фокус\n onClick={showClearButton ? clearClickHandler : (onButtonClick as () => void)}\n icon={\n showClearButton ? CrossOutlinedSize24 : (buttonIcon as IconWrapperComponentSize24)\n }\n disabled={isComponentDisabled}\n ref={buttonRef}\n />\n )}\n {counter && (\n <span className={styles.counter}>\n <DeprecatedCounter label={counter} />\n </span>\n )}\n </div>\n )}\n </div>\n <FormHelper\n description={description}\n errorMessage={errorMessage}\n descriptionId={ariaProps['aria-describedby']}\n disabled={isComponentDisabled}\n invalid={invalid}\n />\n </div>\n );\n};\n\nconst BaseInput = forwardRef(BaseInputComponent);\n\nBaseInput.displayName = 'BaseInput';\n\nexport { BaseInput };\n"],"names":["_jsxs","_jsx","_Fragment"],"mappings":";;;;;;;;;;;;;;;;AA4BA,MAAM,kBAAkB,GAAG,CACvB,EACI,QAAQ,EACR,OAAO,EACP,MAAM,EACN,KAAK,EACL,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,IAAI,GAAG,QAAQ,EACf,kBAAkB,GAAG,KAAK,EAC1B,OAAO,GAAG,KAAK,EACf,WAAW,EACX,YAAY,EACZ,SAAS,EACT,UAAU,EACV,SAAS,GAAG,KAAK,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,SAAS,EACT,SAAS,EACT,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,IAAI,EACJ,cAAc,GAAG,KAAK,EACtB,GAAG,SAAS,EACqE,EACrF,GAAmC,KACnC;AACA,IAAA,MAAM,iBAAiB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AACvD,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IACh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EAChC,QAAA,EAAA,CAAA,CAAC,UAAU,IAAI,eAAe,MAC3BC,IAAC,MAAM,EAAA,EAAA,SAAA,EACM,aAAa,EACtB,IAAI,EAAC,WAAW,EAChB,WAAW,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,cAAc,EAAE,EAC9C,OAAO,EAAE,eAAe,GAAG,iBAAiB,GAAI,aAA4B,EAC5E,IAAI,EACA,eAAe,GAAG,mBAAmB,GAAI,UAAyC,EAEtF,QAAQ,EAAE,mBAAmB,EAC7B,GAAG,EAAE,SAAS,GAChB,CACL,EACA,OAAO,KACJA,cAAM,SAAS,EAAE,MAAM,CAAC,OAAO,EAC3B,QAAA,EAAAA,GAAA,CAAC,iBAAiB,EAAC,EAAA,KAAK,EAAE,OAAO,EAAA,CAAI,GAClC,CACV,CAAA,EAAA,CACC,CACT,CACC,EAAA,CAAA,EACNA,IAAC,UAAU,EAAA,EACP,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,SAAS,CAAC,kBAAkB,CAAC,EAC5C,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,EAAE,OAAO,EAClB,CAAA,CAAA,EAAA,CACA,EACR;AACN,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,UAAU,CAAC,kBAAkB,EAAE;AAEjD,SAAS,CAAC,WAAW,GAAG,WAAW;;;;"}
|
|
1
|
+
{"version":3,"file":"BaseInput.js","sources":["../src/BaseInput.tsx"],"sourcesContent":["import {\n InputHTMLAttributes,\n forwardRef,\n ForwardedRef,\n useCallback,\n useId,\n useRef,\n useState,\n useEffect,\n RefCallback,\n} from 'react';\nimport classnames from 'classnames';\n\nimport { Selection } from '@hh.ru/magritte-common-text-selection';\nimport { useDisabled } from '@hh.ru/magritte-common-use-disabled';\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { Action } from '@hh.ru/magritte-ui-action';\nimport { DeprecatedCounter } from '@hh.ru/magritte-ui-counter';\nimport { FormHelper } from '@hh.ru/magritte-ui-form-helper';\nimport { CrossOutlinedSize24 } from '@hh.ru/magritte-ui-icon/icon';\nimport { IconWrapperComponentSize24 } from '@hh.ru/magritte-ui-icon/src/iconTypes';\nimport { BaseInputProps } from '@hh.ru/magritte-ui-input/types';\nimport { useFocus } from '@hh.ru/magritte-ui-input/useFocus';\nimport { useInputAriaProps } from '@hh.ru/magritte-ui-input/useInputAriaProps';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './input.less';\n\nconst BaseInputComponent = (\n {\n onChange,\n onFocus,\n onBlur,\n value,\n placeholder,\n disabled = false,\n postfix,\n size = 'medium',\n elevatePlaceholder = false,\n invalid = false,\n description,\n errorMessage,\n formatter,\n buttonIcon,\n clearable = false,\n clearableOnFocus,\n onButtonClick,\n buttonDataQa,\n buttonRef,\n inputIcon,\n wrapperRef,\n counter,\n fixedPlaceholder,\n maxLength,\n hint,\n showHintAlways = false,\n ...restProps\n }: BaseInputProps & Omit<InputHTMLAttributes<HTMLInputElement>, keyof BaseInputProps>,\n ref: ForwardedRef<HTMLInputElement>\n) => {\n const wrapperCurrentRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const [isActionVisible, setActionVisible] = useState(false);\n const inputRefCallback = useMultipleRefs(ref, inputRef);\n const wrapperRefCallback = useMultipleRefs(wrapperRef, wrapperCurrentRef);\n const descriptionId = useId();\n const labelId = useId();\n const hintRef = useRef<HTMLDivElement>(null);\n const hintMaxWidthRef = useRef<{ width: number; text: string } | null>(null);\n const change = useCallback(\n (newValue: string) => {\n if (inputRef.current && formatter) {\n const caretPosition = Selection.getCaretPosition(inputRef.current);\n const formatResult = formatter(value, newValue, caretPosition || 0);\n requestAnimationFrame(() => {\n if (inputRef.current) {\n Selection.setCaretPosition(inputRef.current, formatResult.caretPosition);\n }\n });\n onChange(formatResult.outputValue);\n return;\n }\n onChange(newValue);\n },\n [formatter, onChange, value, inputRef]\n );\n\n const clearClickHandler = useCallback(\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n onChange('');\n inputRef.current && inputRef.current.focus();\n onButtonClick?.(event);\n },\n [onChange, inputRef, onButtonClick]\n );\n\n const forceDisabled = useDisabled();\n const isComponentDisabled = forceDisabled || !!disabled;\n\n const { changeHandler, focusHandler, blurHandler, isFocused } = useFocus(change, onFocus, onBlur);\n const placeholderCanElevated = size === 'large' && !!elevatePlaceholder && !!placeholder;\n const [isFocusVisible, setFocusVisible] = useState(false);\n const currentValue = formatter?.('', value, 0).formattedValue || value;\n const buttonQaLabel = buttonDataQa || `input-${clearable ? 'clearable-' : ''}button`;\n const ariaProps = useInputAriaProps({\n invalid,\n hasDescription: !!description,\n hasPlaceholder: !!placeholder,\n descriptionId,\n labelId,\n });\n\n const handleWrapperFocus = () => {\n setActionVisible(true);\n };\n\n const handleWrapperBlur = () => {\n requestAnimationFrame(() => {\n if (!wrapperCurrentRef.current?.contains(document.activeElement)) {\n setActionVisible(false);\n }\n });\n };\n\n const onClickWrapper = () => {\n requestAnimationFrame(() => {\n if (document.activeElement !== inputRef.current) {\n inputRef.current?.focus();\n }\n });\n };\n\n const focusedOrFilled = isFocused || value !== '';\n const placeholderIsElevated = focusedOrFilled && placeholderCanElevated;\n const showPostfix = !!postfix && (placeholderIsElevated || value !== '');\n const showFixedPlaceholder = focusedOrFilled && !!fixedPlaceholder;\n const showLabel = placeholderCanElevated || (value === '' && !showFixedPlaceholder);\n\n const InputIconComponent = inputIcon || null;\n const showClearButton = value.length > 0 && (clearable || (!!clearableOnFocus && isActionVisible));\n const showHint = !!hint && (showHintAlways || value.length > 0);\n\n const hintWrapperRefCallback: RefCallback<HTMLDivElement> = useCallback(\n (element) => {\n if (element && hintRef.current) {\n const text = hintRef.current.innerText;\n if (text.length > 30) {\n let maxWidth;\n if (text !== hintMaxWidthRef.current?.text) {\n const newText = text.slice(0, 30);\n hintRef.current.innerText = newText;\n maxWidth = hintRef.current.offsetWidth;\n hintRef.current.innerText = text;\n hintMaxWidthRef.current = {\n width: maxWidth,\n text,\n };\n } else {\n maxWidth = hintMaxWidthRef.current.width;\n }\n\n element.style.maxWidth = `${maxWidth}px`;\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [hint]\n );\n\n useEffect(() => {\n if (inputRef.current) {\n setFocusVisible(isFocused && inputRef.current.classList.contains('focus-visible'));\n }\n }, [isFocused]);\n\n return (\n <div\n ref={wrapperRefCallback}\n className={classnames(styles.input, {\n [styles.focused]: isFocused,\n [styles.focusVisible]: isFocusVisible,\n [styles.disabled]: isComponentDisabled,\n [styles.large]: size === 'large',\n [styles.elevated]: placeholderCanElevated,\n [styles.invalid]: !!invalid,\n [styles.withRight]: !!buttonIcon || showClearButton || counter,\n [styles.withIcon]: !!inputIcon,\n })}\n onFocus={clearableOnFocus ? handleWrapperFocus : undefined}\n onBlur={clearableOnFocus ? handleWrapperBlur : undefined}\n onClick={onClickWrapper}\n >\n <div className={styles.positionContainer}>\n <div className={styles.hintContainer}>\n <div className={styles.autofillHelper} />\n <div className={styles.contentContainer}>\n {!!InputIconComponent && (\n <div className={styles.icon}>\n <InputIconComponent />\n </div>\n )}\n <div className={styles.valueContainer}>\n <input\n {...restProps}\n {...ariaProps}\n maxLength={maxLength}\n disabled={isComponentDisabled}\n suppressHydrationWarning\n className={styles.field}\n value={currentValue}\n onInput={changeHandler} // maskito требует onInput, (https://maskito.dev/frameworks/react) который работает аналогично onChange\n onFocus={focusHandler}\n onBlur={blurHandler}\n ref={inputRefCallback}\n />\n <div className={styles.additionalValue}>\n <Text Element=\"span\" typography=\"label-2-regular\">\n <span className={styles.valueGhost}>{currentValue}</span>\n {showFixedPlaceholder && (\n <span className={styles.fixedPlaceholder}>\n {fixedPlaceholder.slice(value.length)}\n </span>\n )}\n {showPostfix && (\n <>\n {'\\u00A0'}\n {postfix}\n </>\n )}\n </Text>\n </div>\n </div>\n <div className={styles.riggingContainer}>\n {showLabel && (\n <label\n className={classnames(styles.label, {\n [styles.labelElevated]: placeholderIsElevated,\n })}\n id={ariaProps['aria-labelledby']}\n >\n {placeholder}\n </label>\n )}\n </div>\n </div>\n {showHint && (\n <div className={styles.hint} ref={hintWrapperRefCallback} data-qa=\"input-hint\">\n <Text Element=\"span\" typography=\"label-3-regular\">\n <span ref={hintRef}>{hint}</span>\n </Text>\n </div>\n )}\n </div>\n {(buttonIcon || showClearButton || counter) && (\n <div className={styles.rightContainer}>\n {(buttonIcon || showClearButton) && (\n <Action\n data-qa={buttonQaLabel}\n mode=\"secondary\"\n onMouseDown={(event) => event.preventDefault()} // чтобы инпут не терял фокус\n onClick={showClearButton ? clearClickHandler : (onButtonClick as () => void)}\n icon={\n showClearButton ? CrossOutlinedSize24 : (buttonIcon as IconWrapperComponentSize24)\n }\n disabled={isComponentDisabled}\n ref={buttonRef}\n />\n )}\n {counter && (\n <span className={styles.counter}>\n <DeprecatedCounter label={counter} />\n </span>\n )}\n </div>\n )}\n </div>\n <FormHelper\n description={description}\n errorMessage={errorMessage}\n descriptionId={ariaProps['aria-describedby']}\n disabled={isComponentDisabled}\n invalid={invalid}\n />\n </div>\n );\n};\n\nconst BaseInput = forwardRef(BaseInputComponent);\n\nBaseInput.displayName = 'BaseInput';\n\nexport { BaseInput };\n"],"names":["_jsxs","_jsx","_Fragment"],"mappings":";;;;;;;;;;;;;;;;AA4BA,MAAM,kBAAkB,GAAG,CACvB,EACI,QAAQ,EACR,OAAO,EACP,MAAM,EACN,KAAK,EACL,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,IAAI,GAAG,QAAQ,EACf,kBAAkB,GAAG,KAAK,EAC1B,OAAO,GAAG,KAAK,EACf,WAAW,EACX,YAAY,EACZ,SAAS,EACT,UAAU,EACV,SAAS,GAAG,KAAK,EACjB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,SAAS,EACT,SAAS,EACT,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,IAAI,EACJ,cAAc,GAAG,KAAK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-helper';
|
|
|
14
14
|
import './useFocus.js';
|
|
15
15
|
import './useInputAriaProps.js';
|
|
16
16
|
import '@hh.ru/magritte-ui-typography';
|
|
17
|
-
import './index.esm-
|
|
17
|
+
import './index.esm-CTmNhX1-.js';
|
|
18
18
|
|
|
19
19
|
const DateTimeInput = forwardRef(({ dateMask, timeMask, timeRounding, onButtonClick, ...restProps }, ref) => {
|
|
20
20
|
const maskedInputRef = useDateTimeMask(dateMask, timeMask, timeRounding);
|
|
@@ -16,7 +16,7 @@ import './useFocus.js';
|
|
|
16
16
|
import './useInputAriaProps.js';
|
|
17
17
|
import '@hh.ru/magritte-ui-typography';
|
|
18
18
|
import './useDateTimeMask.js';
|
|
19
|
-
import './index.esm-
|
|
19
|
+
import './index.esm-CTmNhX1-.js';
|
|
20
20
|
|
|
21
21
|
const UncontrolledDateTimeInput = forwardRef(({ value, onChange, ...restProps }, ref) => {
|
|
22
22
|
const [currentValue, changeHandler] = useUncontrolledInput(value, onChange);
|