@hh.ru/magritte-ui-textarea 2.0.13
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/Textarea.d.ts +4 -0
- package/Textarea.js +121 -0
- package/Textarea.js.map +1 -0
- package/UncontrolledTextarea.d.ts +3 -0
- package/UncontrolledTextarea.js +27 -0
- package/UncontrolledTextarea.js.map +1 -0
- package/index.css +480 -0
- package/index.d.ts +2 -0
- package/index.js +16 -0
- package/index.js.map +1 -0
- package/package.json +39 -0
- package/types.d.ts +52 -0
- package/types.js +3 -0
- package/types.js.map +1 -0
- package/useFocus.d.ts +6 -0
- package/useFocus.js +18 -0
- package/useFocus.js.map +1 -0
package/Textarea.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type TextareaHTMLAttributes } from 'react';
|
|
2
|
+
import type { ControlledTextAreaProps } from './types';
|
|
3
|
+
declare const TextArea: import("react").ForwardRefExoticComponent<(ControlledTextAreaProps & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "placeholder" | "onFocus" | "onBlur" | "description" | "errorMessage" | "disabled" | "invalid" | "invalidLimit" | "elevatePlaceholder" | "onChange" | "value" | "maxLength" | "onValidate" | "layout" | "resize">) & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
4
|
+
export { TextArea };
|
package/Textarea.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef, useState, useRef, useId, useEffect } from 'react';
|
|
4
|
+
import { CSSTransition } from 'react-transition-group';
|
|
5
|
+
import classnames from 'classnames';
|
|
6
|
+
import { useDisabled } from '@hh.ru/magritte-common-use-disabled';
|
|
7
|
+
import { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';
|
|
8
|
+
import { FieldHint } from '@hh.ru/magritte-internal-field-hint';
|
|
9
|
+
import { useBreakpoint } from '@hh.ru/magritte-ui-breakpoint';
|
|
10
|
+
import { GripSize24 } from '@hh.ru/magritte-ui-icon/private';
|
|
11
|
+
import { useInputAriaProps } from '@hh.ru/magritte-ui-input/useInputAriaProps';
|
|
12
|
+
import { useFocus } from './useFocus.js';
|
|
13
|
+
import { Text } from '@hh.ru/magritte-ui-typography';
|
|
14
|
+
|
|
15
|
+
var styles = {"textarea":"magritte-textarea___ugvor_2-0-13","textarea-focused":"magritte-textarea-focused___eiGyC_2-0-13","textareaFocused":"magritte-textarea-focused___eiGyC_2-0-13","textarea-invalid":"magritte-textarea-invalid___iKOPh_2-0-13","textareaInvalid":"magritte-textarea-invalid___iKOPh_2-0-13","textarea-disabled":"magritte-textarea-disabled___XN0cg_2-0-13","textareaDisabled":"magritte-textarea-disabled___XN0cg_2-0-13","textarea-position-container-wrapper":"magritte-textarea-position-container-wrapper___4Dsui_2-0-13","textareaPositionContainerWrapper":"magritte-textarea-position-container-wrapper___4Dsui_2-0-13","textarea-position-container":"magritte-textarea-position-container___cEpbv_2-0-13","textareaPositionContainer":"magritte-textarea-position-container___cEpbv_2-0-13","textarea-native":"magritte-textarea-native___w-czf_2-0-13","textareaNative":"magritte-textarea-native___w-czf_2-0-13","textarea-label":"magritte-textarea-label___sgTIH_2-0-13","textareaLabel":"magritte-textarea-label___sgTIH_2-0-13","textarea-elevated":"magritte-textarea-elevated___S0jk-_2-0-13","textareaElevated":"magritte-textarea-elevated___S0jk-_2-0-13","textarea-label-elevated":"magritte-textarea-label-elevated___0lxOI_2-0-13","textareaLabelElevated":"magritte-textarea-label-elevated___0lxOI_2-0-13","textarea-limit":"magritte-textarea-limit___IjPJy_2-0-13","textareaLimit":"magritte-textarea-limit___IjPJy_2-0-13","textarea-limit-error":"magritte-textarea-limit-error___vLvZU_2-0-13","textareaLimitError":"magritte-textarea-limit-error___vLvZU_2-0-13","textarea-limited":"magritte-textarea-limited___cU1Rg_2-0-13","textareaLimited":"magritte-textarea-limited___cU1Rg_2-0-13","textarea-layout-fill-both":"magritte-textarea-layout-fill-both___ERS-q_2-0-13","textareaLayoutFillBoth":"magritte-textarea-layout-fill-both___ERS-q_2-0-13","textarea-layout-fill-vertical":"magritte-textarea-layout-fill-vertical___HmNtp_2-0-13","textareaLayoutFillVertical":"magritte-textarea-layout-fill-vertical___HmNtp_2-0-13","textarea-layout-fill-horizontal":"magritte-textarea-layout-fill-horizontal___imBH2_2-0-13","textareaLayoutFillHorizontal":"magritte-textarea-layout-fill-horizontal___imBH2_2-0-13","textarea-without-label":"magritte-textarea-without-label___WhBIw_2-0-13","textareaWithoutLabel":"magritte-textarea-without-label___WhBIw_2-0-13","textarea-wrapper":"magritte-textarea-wrapper___yD7G6_2-0-13","textareaWrapper":"magritte-textarea-wrapper___yD7G6_2-0-13","textarea-layout-hug":"magritte-textarea-layout-hug___tdCMY_2-0-13","textareaLayoutHug":"magritte-textarea-layout-hug___tdCMY_2-0-13","textarea-animation-timeout":"magritte-textarea-animation-timeout___zudbr_2-0-13","textareaAnimationTimeout":"magritte-textarea-animation-timeout___zudbr_2-0-13","textarea-rigging-container":"magritte-textarea-rigging-container___-1S6i_2-0-13","textareaRiggingContainer":"magritte-textarea-rigging-container___-1S6i_2-0-13","textarea-grip":"magritte-textarea-grip___iL7lq_2-0-13","textareaGrip":"magritte-textarea-grip___iL7lq_2-0-13","textarea-grip-icon":"magritte-textarea-grip-icon___YK-9w_2-0-13","textareaGripIcon":"magritte-textarea-grip-icon___YK-9w_2-0-13","textarea-limit-enter":"magritte-textarea-limit-enter___CygGz_2-0-13","textareaLimitEnter":"magritte-textarea-limit-enter___CygGz_2-0-13","textarea-limit-exit":"magritte-textarea-limit-exit___RMp-R_2-0-13","textareaLimitExit":"magritte-textarea-limit-exit___RMp-R_2-0-13","textarea-limit-enter-active":"magritte-textarea-limit-enter-active___8vN-t_2-0-13","textareaLimitEnterActive":"magritte-textarea-limit-enter-active___8vN-t_2-0-13","textarea-limit-exit-active":"magritte-textarea-limit-exit-active___a5kBr_2-0-13","textareaLimitExitActive":"magritte-textarea-limit-exit-active___a5kBr_2-0-13"};
|
|
16
|
+
|
|
17
|
+
const TextAreaComponent = ({ onChange, onFocus, onBlur, onValidate, value, placeholder, disabled = false, elevatePlaceholder = false, invalid = false, invalidLimit = false, maxLength, description, errorMessage, resize = 'none', layout = 'fixed', ...restProps }, ref) => {
|
|
18
|
+
const { isXS, isS } = useBreakpoint();
|
|
19
|
+
const [internalInvalid, setInternalInvalid] = useState(false);
|
|
20
|
+
const [isFocusVisible, setFocusVisible] = useState(false);
|
|
21
|
+
const limitRef = useRef(null);
|
|
22
|
+
const previousInvalid = useRef(internalInvalid);
|
|
23
|
+
const textAreaRef = useRef(null);
|
|
24
|
+
const resizableDivRef = useRef(null);
|
|
25
|
+
const resizableDivSizes = useRef(null);
|
|
26
|
+
const resizableDivWasResized = useRef(false);
|
|
27
|
+
const textAreaRefCallback = useMultipleRefs(ref, textAreaRef);
|
|
28
|
+
const descriptionId = useId();
|
|
29
|
+
const labelId = useId();
|
|
30
|
+
const [animationTimeout, setAnimationTimeout] = useState(100);
|
|
31
|
+
const currentResizeValue = isXS || isS ? 'none' : resize;
|
|
32
|
+
const isResizable = currentResizeValue !== 'none';
|
|
33
|
+
const forceDisabled = useDisabled();
|
|
34
|
+
const isComponentDisabled = forceDisabled || !!disabled;
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const animationTimeoutElement = document.createElement('div');
|
|
37
|
+
animationTimeoutElement.classList.add(styles.textareaAnimationTimeout);
|
|
38
|
+
document.body.appendChild(animationTimeoutElement);
|
|
39
|
+
const style = window.getComputedStyle(animationTimeoutElement);
|
|
40
|
+
const animationTimeout = parseInt(style.getPropertyValue(`--animation-duration`), 10);
|
|
41
|
+
if (Number.isInteger(animationTimeout)) {
|
|
42
|
+
setAnimationTimeout(animationTimeout);
|
|
43
|
+
}
|
|
44
|
+
document.body.removeChild(animationTimeoutElement);
|
|
45
|
+
}, []);
|
|
46
|
+
const { focusHandler, blurHandler, isFocused } = useFocus(onFocus, onBlur);
|
|
47
|
+
const handleClick = () => {
|
|
48
|
+
if (resizableDivWasResized.current) {
|
|
49
|
+
resizableDivWasResized.current = false;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
textAreaRef.current?.focus();
|
|
53
|
+
};
|
|
54
|
+
const handleMouseUp = () => {
|
|
55
|
+
if (resizableDivRef.current?.offsetWidth !== resizableDivSizes.current?.width ||
|
|
56
|
+
resizableDivRef.current?.offsetHeight !== resizableDivSizes.current?.height) {
|
|
57
|
+
resizableDivWasResized.current = true;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const handleMouseDown = () => {
|
|
61
|
+
resizableDivSizes.current = {
|
|
62
|
+
width: resizableDivRef.current?.offsetWidth,
|
|
63
|
+
height: resizableDivRef.current?.offsetHeight,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (maxLength) {
|
|
68
|
+
const invalid = !isFocused && value.length > maxLength;
|
|
69
|
+
setInternalInvalid(invalid);
|
|
70
|
+
if (previousInvalid.current !== invalid) {
|
|
71
|
+
onValidate({ invalidLimit: invalid });
|
|
72
|
+
}
|
|
73
|
+
previousInvalid.current = invalid;
|
|
74
|
+
}
|
|
75
|
+
}, [onValidate, value, internalInvalid, maxLength, isFocused]);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (textAreaRef.current) {
|
|
78
|
+
setFocusVisible(isFocused && textAreaRef.current.classList.contains('focus-visible'));
|
|
79
|
+
}
|
|
80
|
+
}, [isFocused]);
|
|
81
|
+
const isElevatedPlaceholder = !!elevatePlaceholder && !!placeholder;
|
|
82
|
+
const showLabel = isElevatedPlaceholder || value === '';
|
|
83
|
+
const invalidState = invalid || invalidLimit;
|
|
84
|
+
const ariaProps = useInputAriaProps({
|
|
85
|
+
invalid: invalidState || internalInvalid,
|
|
86
|
+
hasDescription: !!description,
|
|
87
|
+
hasPlaceholder: !!placeholder,
|
|
88
|
+
descriptionId,
|
|
89
|
+
labelId,
|
|
90
|
+
});
|
|
91
|
+
const hasElevatedPlaceholderClass = (isFocused || value !== '') && isElevatedPlaceholder;
|
|
92
|
+
return (jsxs("div", { "data-qa": "textarea-wrapper", className: classnames(styles.textarea, {
|
|
93
|
+
[styles.textareaFocused]: isFocused,
|
|
94
|
+
[styles.textareaDisabled]: isComponentDisabled,
|
|
95
|
+
[styles.textareaInvalid]: !!(invalidState || internalInvalid) && !isFocused,
|
|
96
|
+
[styles.textareaLimitError]: ((invalidLimit || internalInvalid) && !isFocused) ||
|
|
97
|
+
(maxLength === undefined || maxLength === null ? false : value.length > maxLength),
|
|
98
|
+
[styles.textareaLimited]: !!maxLength,
|
|
99
|
+
[styles.textareaLayoutFillBoth]: layout === 'fill-both',
|
|
100
|
+
[styles.textareaLayoutFillVertical]: layout === 'fill-vertical',
|
|
101
|
+
[styles.textareaLayoutFillHorizontal]: layout === 'fill-horizontal',
|
|
102
|
+
[styles.textareaLayoutHug]: layout === 'hug',
|
|
103
|
+
[styles.textareaWithoutLabel]: !isElevatedPlaceholder,
|
|
104
|
+
}), children: [jsxs("div", { className: classnames(styles.textareaPositionContainerWrapper, {
|
|
105
|
+
'focus-visible': isFocusVisible,
|
|
106
|
+
}), children: [jsxs("div", { className: classnames(styles.textareaPositionContainer, {
|
|
107
|
+
[styles.textareaElevated]: isElevatedPlaceholder,
|
|
108
|
+
}), onClick: handleClick, onMouseDown: isResizable ? handleMouseDown : undefined, onMouseUp: isResizable ? handleMouseUp : undefined, style: { resize: currentResizeValue }, ref: resizableDivRef, children: [jsx("div", { className: styles.textareaWrapper, "data-qa": "textarea-native-wrapper", "data-replicated-value": layout === 'hug' ? value : '', children: jsx("textarea", { ...restProps, ...ariaProps, disabled: isComponentDisabled, suppressHydrationWarning: true, className: styles.textareaNative, value: value, onChange: onChange, onFocus: focusHandler, onBlur: blurHandler, ref: textAreaRefCallback }) }), showLabel && (jsx("div", { className: styles.textareaRiggingContainer, children: jsx("label", { className: classnames(styles.textareaLabel, {
|
|
109
|
+
[styles.textareaLabelElevated]: hasElevatedPlaceholderClass,
|
|
110
|
+
}), id: ariaProps['aria-labelledby'], children: placeholder }) })), !!maxLength && (jsx(CSSTransition, { in: isFocused || value.length > maxLength, timeout: animationTimeout, classNames: {
|
|
111
|
+
enter: styles.textareaLimitEnter,
|
|
112
|
+
enterActive: styles.textareaLimitEnterActive,
|
|
113
|
+
exit: styles.textareaLimitExit,
|
|
114
|
+
exitActive: styles.textareaLimitExitActive,
|
|
115
|
+
}, unmountOnExit: true, nodeRef: limitRef, children: jsx("div", { className: styles.textareaLimit, ref: limitRef, children: jsxs(Text, { typography: "label-3-regular", children: [value.length, "/", maxLength] }) }) }))] }), currentResizeValue !== 'none' && (jsx("div", { className: styles.textareaGrip, children: jsx("div", { className: styles.textareaGripIcon, children: jsx(GripSize24, {}) }) }))] }), jsx(FieldHint, { description: description, errorMessage: errorMessage, descriptionId: ariaProps['aria-describedby'], disabled: isComponentDisabled, focused: isFocused, invalid: invalidState, "data-qa": "textarea-hint-container" })] }));
|
|
116
|
+
};
|
|
117
|
+
const TextArea = forwardRef(TextAreaComponent);
|
|
118
|
+
TextArea.displayName = 'TextArea';
|
|
119
|
+
|
|
120
|
+
export { TextArea };
|
|
121
|
+
//# sourceMappingURL=Textarea.js.map
|
package/Textarea.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Textarea.js","sources":["../src/Textarea.tsx"],"sourcesContent":["import { forwardRef, type ForwardedRef, useId, useRef, useState, type TextareaHTMLAttributes, useEffect } from 'react';\nimport { CSSTransition } from 'react-transition-group';\nimport classnames from 'classnames';\n\nimport { useDisabled } from '@hh.ru/magritte-common-use-disabled';\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { FieldHint } from '@hh.ru/magritte-internal-field-hint';\nimport { useBreakpoint } from '@hh.ru/magritte-ui-breakpoint';\nimport { GripSize24 } from '@hh.ru/magritte-ui-icon/private';\nimport { useInputAriaProps } from '@hh.ru/magritte-ui-input/useInputAriaProps';\nimport type { ControlledTextAreaProps } from '@hh.ru/magritte-ui-textarea/types';\nimport { useFocus } from '@hh.ru/magritte-ui-textarea/useFocus';\nimport { Text } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './textarea.less';\n\nconst TextAreaComponent = (\n {\n onChange,\n onFocus,\n onBlur,\n onValidate,\n value,\n placeholder,\n disabled = false,\n elevatePlaceholder = false,\n invalid = false,\n invalidLimit = false,\n maxLength,\n description,\n errorMessage,\n resize = 'none',\n layout = 'fixed',\n ...restProps\n }: ControlledTextAreaProps & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, keyof ControlledTextAreaProps>,\n ref: ForwardedRef<HTMLTextAreaElement>\n) => {\n const { isXS, isS } = useBreakpoint();\n const [internalInvalid, setInternalInvalid] = useState(false);\n const [isFocusVisible, setFocusVisible] = useState(false);\n const limitRef = useRef<HTMLDivElement>(null);\n const previousInvalid = useRef(internalInvalid);\n const textAreaRef = useRef<HTMLTextAreaElement>(null);\n const resizableDivRef = useRef<HTMLDivElement>(null);\n const resizableDivSizes = useRef<{ width?: number; height?: number } | null>(null);\n const resizableDivWasResized = useRef(false);\n const textAreaRefCallback = useMultipleRefs(ref, textAreaRef);\n const descriptionId = useId();\n const labelId = useId();\n const [animationTimeout, setAnimationTimeout] = useState(100);\n const currentResizeValue = isXS || isS ? 'none' : resize;\n const isResizable = currentResizeValue !== 'none';\n\n const forceDisabled = useDisabled();\n const isComponentDisabled = forceDisabled || !!disabled;\n\n useEffect(() => {\n const animationTimeoutElement = document.createElement('div');\n animationTimeoutElement.classList.add(styles.textareaAnimationTimeout);\n document.body.appendChild(animationTimeoutElement);\n const style = window.getComputedStyle(animationTimeoutElement);\n const animationTimeout = parseInt(style.getPropertyValue(`--animation-duration`), 10);\n if (Number.isInteger(animationTimeout)) {\n setAnimationTimeout(animationTimeout);\n }\n document.body.removeChild(animationTimeoutElement);\n }, []);\n\n const { focusHandler, blurHandler, isFocused } = useFocus<HTMLTextAreaElement>(onFocus, onBlur);\n\n const handleClick = () => {\n if (resizableDivWasResized.current) {\n resizableDivWasResized.current = false;\n return;\n }\n textAreaRef.current?.focus();\n };\n\n const handleMouseUp = () => {\n if (\n resizableDivRef.current?.offsetWidth !== resizableDivSizes.current?.width ||\n resizableDivRef.current?.offsetHeight !== resizableDivSizes.current?.height\n ) {\n resizableDivWasResized.current = true;\n }\n };\n\n const handleMouseDown = () => {\n resizableDivSizes.current = {\n width: resizableDivRef.current?.offsetWidth,\n height: resizableDivRef.current?.offsetHeight,\n };\n };\n\n useEffect(() => {\n if (maxLength) {\n const invalid = !isFocused && value.length > maxLength;\n setInternalInvalid(invalid);\n\n if (previousInvalid.current !== invalid) {\n onValidate({ invalidLimit: invalid });\n }\n previousInvalid.current = invalid;\n }\n }, [onValidate, value, internalInvalid, maxLength, isFocused]);\n\n useEffect(() => {\n if (textAreaRef.current) {\n setFocusVisible(isFocused && textAreaRef.current.classList.contains('focus-visible'));\n }\n }, [isFocused]);\n\n const isElevatedPlaceholder = !!elevatePlaceholder && !!placeholder;\n const showLabel = isElevatedPlaceholder || value === '';\n\n const invalidState = invalid || invalidLimit;\n const ariaProps = useInputAriaProps({\n invalid: invalidState || internalInvalid,\n hasDescription: !!description,\n hasPlaceholder: !!placeholder,\n descriptionId,\n labelId,\n });\n\n const hasElevatedPlaceholderClass = (isFocused || value !== '') && isElevatedPlaceholder;\n\n return (\n <div\n data-qa=\"textarea-wrapper\"\n className={classnames(styles.textarea, {\n [styles.textareaFocused]: isFocused,\n [styles.textareaDisabled]: isComponentDisabled,\n [styles.textareaInvalid]: !!(invalidState || internalInvalid) && !isFocused,\n [styles.textareaLimitError]:\n ((invalidLimit || internalInvalid) && !isFocused) ||\n (maxLength === undefined || maxLength === null ? false : value.length > maxLength),\n [styles.textareaLimited]: !!maxLength,\n [styles.textareaLayoutFillBoth]: layout === 'fill-both',\n [styles.textareaLayoutFillVertical]: layout === 'fill-vertical',\n [styles.textareaLayoutFillHorizontal]: layout === 'fill-horizontal',\n [styles.textareaLayoutHug]: layout === 'hug',\n [styles.textareaWithoutLabel]: !isElevatedPlaceholder,\n })}\n >\n <div\n className={classnames(styles.textareaPositionContainerWrapper, {\n 'focus-visible': isFocusVisible,\n })}\n >\n <div\n className={classnames(styles.textareaPositionContainer, {\n [styles.textareaElevated]: isElevatedPlaceholder,\n })}\n onClick={handleClick}\n onMouseDown={isResizable ? handleMouseDown : undefined}\n onMouseUp={isResizable ? handleMouseUp : undefined}\n style={{ resize: currentResizeValue }}\n ref={resizableDivRef}\n >\n <div\n className={styles.textareaWrapper}\n data-qa=\"textarea-native-wrapper\"\n data-replicated-value={layout === 'hug' ? value : ''}\n >\n <textarea\n {...restProps}\n {...ariaProps}\n disabled={isComponentDisabled}\n suppressHydrationWarning\n className={styles.textareaNative}\n value={value}\n onChange={onChange}\n onFocus={focusHandler}\n onBlur={blurHandler}\n ref={textAreaRefCallback}\n />\n </div>\n {showLabel && (\n <div className={styles.textareaRiggingContainer}>\n <label\n className={classnames(styles.textareaLabel, {\n [styles.textareaLabelElevated]: hasElevatedPlaceholderClass,\n })}\n id={ariaProps['aria-labelledby']}\n >\n {placeholder}\n </label>\n </div>\n )}\n {!!maxLength && (\n <CSSTransition\n in={isFocused || value.length > maxLength}\n timeout={animationTimeout}\n classNames={{\n enter: styles.textareaLimitEnter,\n enterActive: styles.textareaLimitEnterActive,\n exit: styles.textareaLimitExit,\n exitActive: styles.textareaLimitExitActive,\n }}\n unmountOnExit\n nodeRef={limitRef}\n >\n <div className={styles.textareaLimit} ref={limitRef}>\n <Text typography=\"label-3-regular\">\n {value.length}/{maxLength}\n </Text>\n </div>\n </CSSTransition>\n )}\n </div>\n {currentResizeValue !== 'none' && (\n <div className={styles.textareaGrip}>\n <div className={styles.textareaGripIcon}>\n <GripSize24 />\n </div>\n </div>\n )}\n </div>\n <FieldHint\n description={description}\n errorMessage={errorMessage}\n descriptionId={ariaProps['aria-describedby']}\n disabled={isComponentDisabled}\n focused={isFocused}\n invalid={invalidState}\n data-qa=\"textarea-hint-container\"\n />\n </div>\n );\n};\n\nconst TextArea = forwardRef(TextAreaComponent);\n\nTextArea.displayName = 'TextArea';\n\nexport { TextArea };\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAM,iBAAiB,GAAG,CACtB,EACI,QAAQ,EACR,OAAO,EACP,MAAM,EACN,UAAU,EACV,KAAK,EACL,WAAW,EACX,QAAQ,GAAG,KAAK,EAChB,kBAAkB,GAAG,KAAK,EAC1B,OAAO,GAAG,KAAK,EACf,YAAY,GAAG,KAAK,EACpB,SAAS,EACT,WAAW,EACX,YAAY,EACZ,MAAM,GAAG,MAAM,EACf,MAAM,GAAG,OAAO,EAChB,GAAG,SAAS,EAC6F,EAC7G,GAAsC,KACtC;IACA,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,aAAa,EAAE,CAAC;IACtC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9D,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1D,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AAC9C,IAAA,MAAM,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAChD,IAAA,MAAM,WAAW,GAAG,MAAM,CAAsB,IAAI,CAAC,CAAC;AACtD,IAAA,MAAM,eAAe,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AACrD,IAAA,MAAM,iBAAiB,GAAG,MAAM,CAA6C,IAAI,CAAC,CAAC;AACnF,IAAA,MAAM,sBAAsB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,mBAAmB,GAAG,eAAe,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;AAC9D,IAAA,MAAM,aAAa,GAAG,KAAK,EAAE,CAAC;AA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,aAAa,EAAE,SAAS,CAAC,kBAAkB,CAAC,EAC5C,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,YAAY,aACb,yBAAyB,EAAA,CACnC,CACA,EAAA,CAAA,EACR;AACN,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,UAAU,CAAC,iBAAiB,EAAE;AAE/C,QAAQ,CAAC,WAAW,GAAG,UAAU;;;;"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TextareaHTMLAttributes } from 'react';
|
|
2
|
+
import { UncontrolledTextAreaProps } from './types';
|
|
3
|
+
export declare const UncontrolledTextArea: import("react").ForwardRefExoticComponent<(UncontrolledTextAreaProps & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "placeholder" | "onFocus" | "onBlur" | "description" | "errorMessage" | "disabled" | "invalid" | "invalidLimit" | "elevatePlaceholder" | "onChange" | "value" | "maxLength" | "onValidate" | "layout" | "resize">) & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef, useState, useCallback } from 'react';
|
|
4
|
+
import { TextArea } from './Textarea.js';
|
|
5
|
+
import 'react-transition-group';
|
|
6
|
+
import 'classnames';
|
|
7
|
+
import '@hh.ru/magritte-common-use-disabled';
|
|
8
|
+
import '@hh.ru/magritte-common-use-multiple-refs';
|
|
9
|
+
import '@hh.ru/magritte-internal-field-hint';
|
|
10
|
+
import '@hh.ru/magritte-ui-breakpoint';
|
|
11
|
+
import '@hh.ru/magritte-ui-icon/private';
|
|
12
|
+
import '@hh.ru/magritte-ui-input/useInputAriaProps';
|
|
13
|
+
import './useFocus.js';
|
|
14
|
+
import '@hh.ru/magritte-ui-typography';
|
|
15
|
+
|
|
16
|
+
const UncontrolledTextArea = forwardRef(({ value = '', onChange, ...restProps }, ref) => {
|
|
17
|
+
const [defaultValue, setDefaultValue] = useState(value);
|
|
18
|
+
const changeHandler = useCallback((event) => {
|
|
19
|
+
setDefaultValue(event.target.value);
|
|
20
|
+
onChange?.(event);
|
|
21
|
+
}, [onChange]);
|
|
22
|
+
return jsx(TextArea, { ...restProps, value: defaultValue, onChange: changeHandler, ref: ref });
|
|
23
|
+
});
|
|
24
|
+
UncontrolledTextArea.displayName = 'UncontrolledTextArea';
|
|
25
|
+
|
|
26
|
+
export { UncontrolledTextArea };
|
|
27
|
+
//# sourceMappingURL=UncontrolledTextarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UncontrolledTextarea.js","sources":["../src/UncontrolledTextarea.tsx"],"sourcesContent":["import { forwardRef, TextareaHTMLAttributes, useCallback, useState, type ChangeEvent } from 'react';\n\nimport { TextArea } from '@hh.ru/magritte-ui-textarea/Textarea';\nimport { UncontrolledTextAreaProps } from '@hh.ru/magritte-ui-textarea/types';\n\nexport const UncontrolledTextArea = forwardRef<\n HTMLTextAreaElement,\n UncontrolledTextAreaProps & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, keyof UncontrolledTextAreaProps>\n>(({ value = '', onChange, ...restProps }, ref) => {\n const [defaultValue, setDefaultValue] = useState(value);\n const changeHandler = useCallback(\n (event: ChangeEvent<HTMLTextAreaElement>) => {\n setDefaultValue(event.target.value);\n onChange?.(event);\n },\n [onChange]\n );\n\n return <TextArea {...restProps} value={defaultValue} onChange={changeHandler} ref={ref} />;\n});\n\nUncontrolledTextArea.displayName = 'UncontrolledTextArea';\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;MAKa,oBAAoB,GAAG,UAAU,CAG5C,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,EAAE,GAAG,KAAI;IAC9C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AACxD,IAAA,MAAM,aAAa,GAAG,WAAW,CAC7B,CAAC,KAAuC,KAAI;AACxC,QAAA,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpC,QAAA,QAAQ,GAAG,KAAK,CAAC,CAAC;AACtB,KAAC,EACD,CAAC,QAAQ,CAAC,CACb,CAAC;AAEF,IAAA,OAAOA,IAAC,QAAQ,EAAA,EAAA,GAAK,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;AAC/F,CAAC,EAAE;AAEH,oBAAoB,CAAC,WAAW,GAAG,sBAAsB;;;;"}
|
package/index.css
ADDED
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
:root{
|
|
2
|
+
--magritte-color-text-primary-v18-1-1:#000000;
|
|
3
|
+
--magritte-color-component-input-stroke-state-field-hovered-v18-1-1:#CCD5DF;
|
|
4
|
+
--magritte-color-component-input-stroke-state-field-focused-v18-1-1:#0070ff;
|
|
5
|
+
--magritte-color-component-input-stroke-state-accent-focused-accessible-v18-1-1:#0070ff7a;
|
|
6
|
+
--magritte-color-component-input-stroke-state-field-invalid-v18-1-1:#ff4d3a;
|
|
7
|
+
--magritte-color-component-input-stroke-state-field-disabled-v18-1-1:#EEF1F7;
|
|
8
|
+
--magritte-color-component-input-background-field-v18-1-1:#ffffff;
|
|
9
|
+
--magritte-color-component-input-background-state-field-hovered-v18-1-1:#ffffff;
|
|
10
|
+
--magritte-color-component-input-background-state-field-focused-v18-1-1:#ffffff;
|
|
11
|
+
--magritte-color-component-input-background-state-field-invalid-v18-1-1:#ffffff;
|
|
12
|
+
--magritte-color-component-input-background-state-field-disabled-v18-1-1:#F4F6FB;
|
|
13
|
+
--magritte-color-component-input-stroke-field-v18-1-1:#DCE3EB;
|
|
14
|
+
--magritte-color-component-input-text-state-content-disabled-v18-1-1:#AABBCA;
|
|
15
|
+
--magritte-color-component-input-text-state-label-disabled-v18-1-1:#AABBCA;
|
|
16
|
+
--magritte-color-component-input-text-state-placeholder-disabled-v18-1-1:#AABBCA;
|
|
17
|
+
--magritte-color-component-input-text-state-limit-disabled-v18-1-1:#AABBCA;
|
|
18
|
+
--magritte-color-component-input-text-state-content-hovered-v18-1-1:#000000;
|
|
19
|
+
--magritte-color-component-input-text-state-content-focused-v18-1-1:#000000;
|
|
20
|
+
--magritte-color-component-input-text-state-content-invalid-v18-1-1:#000000;
|
|
21
|
+
--magritte-color-component-input-text-state-label-hovered-v18-1-1:#768694;
|
|
22
|
+
--magritte-color-component-input-text-state-label-focused-v18-1-1:#468ffd;
|
|
23
|
+
--magritte-color-component-input-text-state-label-invalid-v18-1-1:#ff8a77;
|
|
24
|
+
--magritte-color-component-input-text-state-placeholder-hovered-v18-1-1:#768694;
|
|
25
|
+
--magritte-color-component-input-text-state-limit-hovered-v18-1-1:#768694;
|
|
26
|
+
--magritte-color-component-input-text-state-placeholder-focused-v18-1-1:#768694;
|
|
27
|
+
--magritte-color-component-input-text-state-limit-focused-v18-1-1:#768694;
|
|
28
|
+
--magritte-color-component-input-text-state-placeholder-invalid-v18-1-1:#768694;
|
|
29
|
+
--magritte-color-component-input-text-state-limit-invalid-v18-1-1:#ff8a77;
|
|
30
|
+
--magritte-color-component-input-icon-grip-v18-1-1:#AABBCA;
|
|
31
|
+
--magritte-color-component-input-text-content-v18-1-1:#000000;
|
|
32
|
+
--magritte-color-component-input-text-label-v18-1-1:#768694;
|
|
33
|
+
--magritte-color-component-input-text-placeholder-v18-1-1:#AABBCA;
|
|
34
|
+
--magritte-color-component-input-text-limit-v18-1-1:#AABBCA;
|
|
35
|
+
}
|
|
36
|
+
:root{
|
|
37
|
+
--magritte-typography-label-2-regular-font-family-v18-1-1:"Inter";
|
|
38
|
+
--magritte-typography-label-2-regular-font-weight-v18-1-1:400;
|
|
39
|
+
--magritte-typography-label-2-regular-line-height-v18-1-1:22px;
|
|
40
|
+
--magritte-typography-label-2-regular-font-size-v18-1-1:16px;
|
|
41
|
+
--magritte-typography-label-2-regular-letter-spacing-v18-1-1:0em;
|
|
42
|
+
--magritte-typography-label-2-regular-text-indent-v18-1-1:0px;
|
|
43
|
+
--magritte-typography-label-2-regular-text-transform-v18-1-1:none;
|
|
44
|
+
--magritte-typography-label-2-regular-text-decoration-v18-1-1:none;
|
|
45
|
+
--magritte-typography-label-4-regular-font-family-v18-1-1:"Inter";
|
|
46
|
+
--magritte-typography-label-4-regular-font-weight-v18-1-1:400;
|
|
47
|
+
--magritte-typography-label-4-regular-line-height-v18-1-1:18px;
|
|
48
|
+
--magritte-typography-label-4-regular-font-size-v18-1-1:12px;
|
|
49
|
+
--magritte-typography-label-4-regular-letter-spacing-v18-1-1:0.01em;
|
|
50
|
+
--magritte-typography-label-4-regular-text-indent-v18-1-1:0px;
|
|
51
|
+
--magritte-typography-label-4-regular-text-transform-v18-1-1:none;
|
|
52
|
+
--magritte-typography-label-4-regular-text-decoration-v18-1-1:none;
|
|
53
|
+
--magritte-semantic-animation-ease-in-out-100-timing-function-v18-1-1:cubic-bezier(0.25, 0.1, 0.25, 1);
|
|
54
|
+
--magritte-semantic-animation-ease-in-out-100-duration-v18-1-1:100ms;
|
|
55
|
+
--magritte-semantic-animation-ease-in-out-200-timing-function-v18-1-1:cubic-bezier(0.25, 0.1, 0.25, 1);
|
|
56
|
+
--magritte-semantic-animation-ease-in-out-300-duration-v18-1-1:300ms;
|
|
57
|
+
}
|
|
58
|
+
.magritte-night-theme{
|
|
59
|
+
--magritte-color-text-primary-v18-1-1:#ffffff;
|
|
60
|
+
--magritte-color-component-input-stroke-state-field-hovered-v18-1-1:#3B3B3B;
|
|
61
|
+
--magritte-color-component-input-stroke-state-field-focused-v18-1-1:#0070ff;
|
|
62
|
+
--magritte-color-component-input-stroke-state-accent-focused-accessible-v18-1-1:#0070ff7a;
|
|
63
|
+
--magritte-color-component-input-stroke-state-field-invalid-v18-1-1:#ff4d3a;
|
|
64
|
+
--magritte-color-component-input-stroke-state-field-disabled-v18-1-1:#111;
|
|
65
|
+
--magritte-color-component-input-background-field-v18-1-1:#1B1B1B;
|
|
66
|
+
--magritte-color-component-input-background-state-field-hovered-v18-1-1:#1B1B1B;
|
|
67
|
+
--magritte-color-component-input-background-state-field-focused-v18-1-1:#1B1B1B;
|
|
68
|
+
--magritte-color-component-input-background-state-field-invalid-v18-1-1:#1B1B1B;
|
|
69
|
+
--magritte-color-component-input-background-state-field-disabled-v18-1-1:#111;
|
|
70
|
+
--magritte-color-component-input-stroke-field-v18-1-1:#303030;
|
|
71
|
+
--magritte-color-component-input-text-content-v18-1-1:#ffffff;
|
|
72
|
+
--magritte-color-component-input-text-label-v18-1-1:#919191;
|
|
73
|
+
--magritte-color-component-input-text-placeholder-v18-1-1:#535353;
|
|
74
|
+
--magritte-color-component-input-text-limit-v18-1-1:#535353;
|
|
75
|
+
--magritte-color-component-input-text-state-content-disabled-v18-1-1:#474747;
|
|
76
|
+
--magritte-color-component-input-text-state-label-disabled-v18-1-1:#474747;
|
|
77
|
+
--magritte-color-component-input-text-state-placeholder-disabled-v18-1-1:#474747;
|
|
78
|
+
--magritte-color-component-input-text-state-limit-disabled-v18-1-1:#474747;
|
|
79
|
+
--magritte-color-component-input-text-state-content-hovered-v18-1-1:#ffffff;
|
|
80
|
+
--magritte-color-component-input-text-state-content-focused-v18-1-1:#ffffff;
|
|
81
|
+
--magritte-color-component-input-text-state-content-invalid-v18-1-1:#ffffff;
|
|
82
|
+
--magritte-color-component-input-text-state-label-hovered-v18-1-1:#919191;
|
|
83
|
+
--magritte-color-component-input-text-state-label-focused-v18-1-1:#5e9eff;
|
|
84
|
+
--magritte-color-component-input-text-state-label-invalid-v18-1-1:#fe725f;
|
|
85
|
+
--magritte-color-component-input-text-state-placeholder-hovered-v18-1-1:#5E5E5E;
|
|
86
|
+
--magritte-color-component-input-text-state-limit-hovered-v18-1-1:#535353;
|
|
87
|
+
--magritte-color-component-input-text-state-placeholder-focused-v18-1-1:#535353;
|
|
88
|
+
--magritte-color-component-input-text-state-limit-focused-v18-1-1:#535353;
|
|
89
|
+
--magritte-color-component-input-text-state-placeholder-invalid-v18-1-1:#535353;
|
|
90
|
+
--magritte-color-component-input-text-state-limit-invalid-v18-1-1:#fe725f;
|
|
91
|
+
--magritte-color-component-input-icon-grip-v18-1-1:#535353;
|
|
92
|
+
}
|
|
93
|
+
.magritte-textarea___ugvor_2-0-13{
|
|
94
|
+
display:inline-flex;
|
|
95
|
+
flex-flow:column;
|
|
96
|
+
--animation-100-duration:var(--magritte-semantic-animation-ease-in-out-100-duration-v18-1-1);
|
|
97
|
+
--animation-300-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v18-1-1);
|
|
98
|
+
}
|
|
99
|
+
@media (min-width: 1020px){
|
|
100
|
+
body.magritte-old-layout .magritte-textarea___ugvor_2-0-13:not(.magritte-textarea-focused___eiGyC_2-0-13):not(.magritte-textarea-invalid___iKOPh_2-0-13):not(.magritte-textarea-disabled___XN0cg_2-0-13) .magritte-textarea-position-container-wrapper___4Dsui_2-0-13:hover::after{
|
|
101
|
+
border-bottom-color:var(--magritte-color-component-input-stroke-state-field-hovered-v18-1-1);
|
|
102
|
+
border-right-color:var(--magritte-color-component-input-stroke-state-field-hovered-v18-1-1);
|
|
103
|
+
border-width:1px;
|
|
104
|
+
background-color:var(--magritte-color-component-input-background-state-field-hovered-v18-1-1);
|
|
105
|
+
}
|
|
106
|
+
body.magritte-old-layout .magritte-textarea___ugvor_2-0-13:not(.magritte-textarea-focused___eiGyC_2-0-13):not(.magritte-textarea-invalid___iKOPh_2-0-13):not(.magritte-textarea-disabled___XN0cg_2-0-13) .magritte-textarea-position-container-wrapper___4Dsui_2-0-13:hover .magritte-textarea-position-container___cEpbv_2-0-13{
|
|
107
|
+
box-shadow:inset 0 0 0 1px var(--magritte-color-component-input-stroke-state-field-hovered-v18-1-1);
|
|
108
|
+
background-color:var(--magritte-color-component-input-background-state-field-hovered-v18-1-1);
|
|
109
|
+
}
|
|
110
|
+
body.magritte-old-layout .magritte-textarea___ugvor_2-0-13:not(.magritte-textarea-focused___eiGyC_2-0-13):not(.magritte-textarea-invalid___iKOPh_2-0-13):not(.magritte-textarea-disabled___XN0cg_2-0-13) .magritte-textarea-position-container-wrapper___4Dsui_2-0-13:hover .magritte-textarea-native___w-czf_2-0-13{
|
|
111
|
+
color:var(--magritte-color-component-input-text-state-content-hovered-v18-1-1);
|
|
112
|
+
-webkit-text-fill-color:var(--magritte-color-component-input-text-state-content-hovered-v18-1-1);
|
|
113
|
+
opacity:1;
|
|
114
|
+
}
|
|
115
|
+
body.magritte-old-layout .magritte-textarea___ugvor_2-0-13:not(.magritte-textarea-focused___eiGyC_2-0-13):not(.magritte-textarea-invalid___iKOPh_2-0-13):not(.magritte-textarea-disabled___XN0cg_2-0-13) .magritte-textarea-position-container-wrapper___4Dsui_2-0-13:hover .magritte-textarea-label___sgTIH_2-0-13{
|
|
116
|
+
color:var(--magritte-color-component-input-text-state-placeholder-hovered-v18-1-1);
|
|
117
|
+
}
|
|
118
|
+
body.magritte-old-layout .magritte-textarea___ugvor_2-0-13:not(.magritte-textarea-focused___eiGyC_2-0-13):not(.magritte-textarea-invalid___iKOPh_2-0-13):not(.magritte-textarea-disabled___XN0cg_2-0-13) .magritte-textarea-position-container-wrapper___4Dsui_2-0-13:hover .magritte-textarea-elevated___S0jk-_2-0-13 .magritte-textarea-label-elevated___0lxOI_2-0-13{
|
|
119
|
+
color:var(--magritte-color-component-input-text-state-label-hovered-v18-1-1);
|
|
120
|
+
}
|
|
121
|
+
body.magritte-old-layout .magritte-textarea___ugvor_2-0-13:not(.magritte-textarea-focused___eiGyC_2-0-13):not(.magritte-textarea-invalid___iKOPh_2-0-13):not(.magritte-textarea-disabled___XN0cg_2-0-13) .magritte-textarea-position-container-wrapper___4Dsui_2-0-13:hover .magritte-textarea-limit___IjPJy_2-0-13{
|
|
122
|
+
background-color:var(--magritte-color-component-input-background-state-field-hovered-v18-1-1);
|
|
123
|
+
}
|
|
124
|
+
body.magritte-old-layout .magritte-textarea___ugvor_2-0-13:not(.magritte-textarea-focused___eiGyC_2-0-13):not(.magritte-textarea-invalid___iKOPh_2-0-13):not(.magritte-textarea-disabled___XN0cg_2-0-13) .magritte-textarea-position-container-wrapper___4Dsui_2-0-13:hover .magritte-textarea-limit___IjPJy_2-0-13{
|
|
125
|
+
--magritte-ui-text-color-override:var(--magritte-color-component-input-text-state-limit-hovered-v18-1-1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
@media (min-width: 1024px){
|
|
129
|
+
body:not(.magritte-old-layout) .magritte-textarea___ugvor_2-0-13:not(.magritte-textarea-focused___eiGyC_2-0-13):not(.magritte-textarea-invalid___iKOPh_2-0-13):not(.magritte-textarea-disabled___XN0cg_2-0-13) .magritte-textarea-position-container-wrapper___4Dsui_2-0-13:hover::after{
|
|
130
|
+
border-bottom-color:var(--magritte-color-component-input-stroke-state-field-hovered-v18-1-1);
|
|
131
|
+
border-right-color:var(--magritte-color-component-input-stroke-state-field-hovered-v18-1-1);
|
|
132
|
+
border-width:1px;
|
|
133
|
+
background-color:var(--magritte-color-component-input-background-state-field-hovered-v18-1-1);
|
|
134
|
+
}
|
|
135
|
+
body:not(.magritte-old-layout) .magritte-textarea___ugvor_2-0-13:not(.magritte-textarea-focused___eiGyC_2-0-13):not(.magritte-textarea-invalid___iKOPh_2-0-13):not(.magritte-textarea-disabled___XN0cg_2-0-13) .magritte-textarea-position-container-wrapper___4Dsui_2-0-13:hover .magritte-textarea-position-container___cEpbv_2-0-13{
|
|
136
|
+
box-shadow:inset 0 0 0 1px var(--magritte-color-component-input-stroke-state-field-hovered-v18-1-1);
|
|
137
|
+
background-color:var(--magritte-color-component-input-background-state-field-hovered-v18-1-1);
|
|
138
|
+
}
|
|
139
|
+
body:not(.magritte-old-layout) .magritte-textarea___ugvor_2-0-13:not(.magritte-textarea-focused___eiGyC_2-0-13):not(.magritte-textarea-invalid___iKOPh_2-0-13):not(.magritte-textarea-disabled___XN0cg_2-0-13) .magritte-textarea-position-container-wrapper___4Dsui_2-0-13:hover .magritte-textarea-native___w-czf_2-0-13{
|
|
140
|
+
color:var(--magritte-color-component-input-text-state-content-hovered-v18-1-1);
|
|
141
|
+
-webkit-text-fill-color:var(--magritte-color-component-input-text-state-content-hovered-v18-1-1);
|
|
142
|
+
opacity:1;
|
|
143
|
+
}
|
|
144
|
+
body:not(.magritte-old-layout) .magritte-textarea___ugvor_2-0-13:not(.magritte-textarea-focused___eiGyC_2-0-13):not(.magritte-textarea-invalid___iKOPh_2-0-13):not(.magritte-textarea-disabled___XN0cg_2-0-13) .magritte-textarea-position-container-wrapper___4Dsui_2-0-13:hover .magritte-textarea-label___sgTIH_2-0-13{
|
|
145
|
+
color:var(--magritte-color-component-input-text-state-placeholder-hovered-v18-1-1);
|
|
146
|
+
}
|
|
147
|
+
body:not(.magritte-old-layout) .magritte-textarea___ugvor_2-0-13:not(.magritte-textarea-focused___eiGyC_2-0-13):not(.magritte-textarea-invalid___iKOPh_2-0-13):not(.magritte-textarea-disabled___XN0cg_2-0-13) .magritte-textarea-position-container-wrapper___4Dsui_2-0-13:hover .magritte-textarea-elevated___S0jk-_2-0-13 .magritte-textarea-label-elevated___0lxOI_2-0-13{
|
|
148
|
+
color:var(--magritte-color-component-input-text-state-label-hovered-v18-1-1);
|
|
149
|
+
}
|
|
150
|
+
body:not(.magritte-old-layout) .magritte-textarea___ugvor_2-0-13:not(.magritte-textarea-focused___eiGyC_2-0-13):not(.magritte-textarea-invalid___iKOPh_2-0-13):not(.magritte-textarea-disabled___XN0cg_2-0-13) .magritte-textarea-position-container-wrapper___4Dsui_2-0-13:hover .magritte-textarea-limit___IjPJy_2-0-13{
|
|
151
|
+
background-color:var(--magritte-color-component-input-background-state-field-hovered-v18-1-1);
|
|
152
|
+
}
|
|
153
|
+
body:not(.magritte-old-layout) .magritte-textarea___ugvor_2-0-13:not(.magritte-textarea-focused___eiGyC_2-0-13):not(.magritte-textarea-invalid___iKOPh_2-0-13):not(.magritte-textarea-disabled___XN0cg_2-0-13) .magritte-textarea-position-container-wrapper___4Dsui_2-0-13:hover .magritte-textarea-limit___IjPJy_2-0-13{
|
|
154
|
+
--magritte-ui-text-color-override:var(--magritte-color-component-input-text-state-limit-hovered-v18-1-1);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-focused___eiGyC_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13::after{
|
|
158
|
+
border-bottom-color:var(--magritte-color-component-input-stroke-state-field-focused-v18-1-1);
|
|
159
|
+
border-right-color:var(--magritte-color-component-input-stroke-state-field-focused-v18-1-1);
|
|
160
|
+
border-width:2px;
|
|
161
|
+
background-color:var(--magritte-color-component-input-background-state-field-focused-v18-1-1);
|
|
162
|
+
}
|
|
163
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-focused___eiGyC_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-position-container___cEpbv_2-0-13{
|
|
164
|
+
box-shadow:inset 0 0 0 2px var(--magritte-color-component-input-stroke-state-field-focused-v18-1-1);
|
|
165
|
+
background-color:var(--magritte-color-component-input-background-state-field-focused-v18-1-1);
|
|
166
|
+
}
|
|
167
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-focused___eiGyC_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-native___w-czf_2-0-13{
|
|
168
|
+
color:var(--magritte-color-component-input-text-state-content-focused-v18-1-1);
|
|
169
|
+
-webkit-text-fill-color:var(--magritte-color-component-input-text-state-content-focused-v18-1-1);
|
|
170
|
+
opacity:1;
|
|
171
|
+
}
|
|
172
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-focused___eiGyC_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-label___sgTIH_2-0-13{
|
|
173
|
+
color:var(--magritte-color-component-input-text-state-placeholder-focused-v18-1-1);
|
|
174
|
+
}
|
|
175
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-focused___eiGyC_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-elevated___S0jk-_2-0-13 .magritte-textarea-label-elevated___0lxOI_2-0-13{
|
|
176
|
+
color:var(--magritte-color-component-input-text-state-label-focused-v18-1-1);
|
|
177
|
+
}
|
|
178
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-focused___eiGyC_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-limit___IjPJy_2-0-13{
|
|
179
|
+
background-color:var(--magritte-color-component-input-background-state-field-focused-v18-1-1);
|
|
180
|
+
}
|
|
181
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-focused___eiGyC_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-limit___IjPJy_2-0-13{
|
|
182
|
+
--magritte-ui-text-color-override:var(--magritte-color-component-input-text-state-limit-focused-v18-1-1);
|
|
183
|
+
}
|
|
184
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-focused___eiGyC_2-0-13.magritte-textarea-limit-error___vLvZU_2-0-13{
|
|
185
|
+
}
|
|
186
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-focused___eiGyC_2-0-13.magritte-textarea-limit-error___vLvZU_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-limit___IjPJy_2-0-13{
|
|
187
|
+
--magritte-ui-text-color-override:var(--magritte-color-component-input-text-state-limit-invalid-v18-1-1);
|
|
188
|
+
}
|
|
189
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-invalid___iKOPh_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13::after{
|
|
190
|
+
border-bottom-color:var(--magritte-color-component-input-stroke-state-field-invalid-v18-1-1);
|
|
191
|
+
border-right-color:var(--magritte-color-component-input-stroke-state-field-invalid-v18-1-1);
|
|
192
|
+
border-width:1px;
|
|
193
|
+
background-color:var(--magritte-color-component-input-background-state-field-invalid-v18-1-1);
|
|
194
|
+
}
|
|
195
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-invalid___iKOPh_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-position-container___cEpbv_2-0-13{
|
|
196
|
+
box-shadow:inset 0 0 0 1px var(--magritte-color-component-input-stroke-state-field-invalid-v18-1-1);
|
|
197
|
+
background-color:var(--magritte-color-component-input-background-state-field-invalid-v18-1-1);
|
|
198
|
+
}
|
|
199
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-invalid___iKOPh_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-native___w-czf_2-0-13{
|
|
200
|
+
color:var(--magritte-color-component-input-text-state-content-invalid-v18-1-1);
|
|
201
|
+
-webkit-text-fill-color:var(--magritte-color-component-input-text-state-content-invalid-v18-1-1);
|
|
202
|
+
opacity:1;
|
|
203
|
+
}
|
|
204
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-invalid___iKOPh_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-label___sgTIH_2-0-13{
|
|
205
|
+
color:var(--magritte-color-component-input-text-state-placeholder-invalid-v18-1-1);
|
|
206
|
+
}
|
|
207
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-invalid___iKOPh_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-elevated___S0jk-_2-0-13 .magritte-textarea-label-elevated___0lxOI_2-0-13{
|
|
208
|
+
color:var(--magritte-color-component-input-text-state-label-invalid-v18-1-1);
|
|
209
|
+
}
|
|
210
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-invalid___iKOPh_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-limit___IjPJy_2-0-13{
|
|
211
|
+
background-color:var(--magritte-color-component-input-background-state-field-invalid-v18-1-1);
|
|
212
|
+
}
|
|
213
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-limit-error___vLvZU_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-limit___IjPJy_2-0-13{
|
|
214
|
+
--magritte-ui-text-color-override:var(--magritte-color-component-input-text-state-limit-invalid-v18-1-1);
|
|
215
|
+
}
|
|
216
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-disabled___XN0cg_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13::after{
|
|
217
|
+
border-bottom-color:var(--magritte-color-component-input-stroke-state-field-disabled-v18-1-1);
|
|
218
|
+
border-right-color:var(--magritte-color-component-input-stroke-state-field-disabled-v18-1-1);
|
|
219
|
+
border-width:1px;
|
|
220
|
+
background-color:var(--magritte-color-component-input-background-state-field-disabled-v18-1-1);
|
|
221
|
+
}
|
|
222
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-disabled___XN0cg_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-position-container___cEpbv_2-0-13{
|
|
223
|
+
box-shadow:inset 0 0 0 1px var(--magritte-color-component-input-stroke-state-field-disabled-v18-1-1);
|
|
224
|
+
background-color:var(--magritte-color-component-input-background-state-field-disabled-v18-1-1);
|
|
225
|
+
}
|
|
226
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-disabled___XN0cg_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-native___w-czf_2-0-13{
|
|
227
|
+
color:var(--magritte-color-component-input-text-state-content-disabled-v18-1-1);
|
|
228
|
+
-webkit-text-fill-color:var(--magritte-color-component-input-text-state-content-disabled-v18-1-1);
|
|
229
|
+
opacity:1;
|
|
230
|
+
}
|
|
231
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-disabled___XN0cg_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-label___sgTIH_2-0-13{
|
|
232
|
+
color:var(--magritte-color-component-input-text-state-placeholder-disabled-v18-1-1);
|
|
233
|
+
}
|
|
234
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-disabled___XN0cg_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-elevated___S0jk-_2-0-13 .magritte-textarea-label-elevated___0lxOI_2-0-13{
|
|
235
|
+
color:var(--magritte-color-component-input-text-state-label-disabled-v18-1-1);
|
|
236
|
+
}
|
|
237
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-disabled___XN0cg_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-limit___IjPJy_2-0-13{
|
|
238
|
+
background-color:var(--magritte-color-component-input-background-state-field-disabled-v18-1-1);
|
|
239
|
+
}
|
|
240
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-disabled___XN0cg_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13 .magritte-textarea-limit___IjPJy_2-0-13{
|
|
241
|
+
--magritte-ui-text-color-override:var(--magritte-color-component-input-text-state-limit-disabled-v18-1-1);
|
|
242
|
+
}
|
|
243
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-disabled___XN0cg_2-0-13 .magritte-textarea-position-container___cEpbv_2-0-13,
|
|
244
|
+
.magritte-textarea___ugvor_2-0-13.magritte-textarea-disabled___XN0cg_2-0-13 .magritte-textarea-native___w-czf_2-0-13{
|
|
245
|
+
cursor:not-allowed;
|
|
246
|
+
}
|
|
247
|
+
@media (prefers-reduced-motion){
|
|
248
|
+
.magritte-textarea___ugvor_2-0-13{
|
|
249
|
+
--animation-100-duration:1ms;
|
|
250
|
+
--animation-300-duration:1ms;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
.magritte-textarea-position-container-wrapper___4Dsui_2-0-13{
|
|
254
|
+
display:inline-flex;
|
|
255
|
+
position:relative;
|
|
256
|
+
overflow:hidden;
|
|
257
|
+
width:100%;
|
|
258
|
+
border-radius:12px;
|
|
259
|
+
}
|
|
260
|
+
.magritte-textarea-position-container-wrapper___4Dsui_2-0-13.focus-visible{
|
|
261
|
+
outline:var(--magritte-color-component-input-stroke-state-accent-focused-accessible-v18-1-1) solid 4px;
|
|
262
|
+
}
|
|
263
|
+
.magritte-textarea-position-container-wrapper___4Dsui_2-0-13::after{
|
|
264
|
+
display:block;
|
|
265
|
+
pointer-events:none;
|
|
266
|
+
user-select:none;
|
|
267
|
+
position:absolute;
|
|
268
|
+
content:'';
|
|
269
|
+
width:16px;
|
|
270
|
+
height:16px;
|
|
271
|
+
background-color:var(--magritte-color-component-input-background-field-v18-1-1);
|
|
272
|
+
bottom:0;
|
|
273
|
+
right:0;
|
|
274
|
+
border-bottom-right-radius:12px;
|
|
275
|
+
border-bottom:1px solid var(--magritte-color-component-input-stroke-field-v18-1-1);
|
|
276
|
+
border-right:1px solid var(--magritte-color-component-input-stroke-field-v18-1-1);
|
|
277
|
+
}
|
|
278
|
+
.magritte-textarea-native___w-czf_2-0-13{
|
|
279
|
+
box-sizing:border-box;
|
|
280
|
+
border:0;
|
|
281
|
+
width:100%;
|
|
282
|
+
padding:0 16px;
|
|
283
|
+
padding-right:14px;
|
|
284
|
+
color:var(--magritte-color-component-input-text-content-v18-1-1);
|
|
285
|
+
caret-color:var(--magritte-color-text-primary-v18-1-1);
|
|
286
|
+
font-family:var(--magritte-typography-label-2-regular-font-family-v18-1-1);
|
|
287
|
+
font-weight:var(--magritte-typography-label-2-regular-font-weight-v18-1-1);
|
|
288
|
+
line-height:var(--magritte-typography-label-2-regular-line-height-v18-1-1);
|
|
289
|
+
font-size:var(--magritte-typography-label-2-regular-font-size-v18-1-1);
|
|
290
|
+
letter-spacing:var(--magritte-typography-label-2-regular-letter-spacing-v18-1-1);
|
|
291
|
+
text-indent:var(--magritte-typography-label-2-regular-text-indent-v18-1-1);
|
|
292
|
+
text-transform:var(--magritte-typography-label-2-regular-text-transform-v18-1-1);
|
|
293
|
+
text-decoration:var(--magritte-typography-label-2-regular-text-decoration-v18-1-1);
|
|
294
|
+
min-height:calc(86px - var(--magritte-typography-label-4-regular-line-height-v18-1-1));
|
|
295
|
+
position:relative;
|
|
296
|
+
resize:none;
|
|
297
|
+
background:none;
|
|
298
|
+
appearance:none;
|
|
299
|
+
}
|
|
300
|
+
.magritte-textarea-native___w-czf_2-0-13:focus{
|
|
301
|
+
outline:none;
|
|
302
|
+
}
|
|
303
|
+
.magritte-textarea-limited___cU1Rg_2-0-13 .magritte-textarea-native___w-czf_2-0-13{
|
|
304
|
+
min-height:calc(72px - var(--magritte-typography-label-4-regular-line-height-v18-1-1));
|
|
305
|
+
}
|
|
306
|
+
.magritte-textarea-limited___cU1Rg_2-0-13 .magritte-textarea-position-container___cEpbv_2-0-13{
|
|
307
|
+
padding-bottom:30px;
|
|
308
|
+
}
|
|
309
|
+
.magritte-textarea-layout-fill-both___ERS-q_2-0-13,
|
|
310
|
+
.magritte-textarea-layout-fill-vertical___HmNtp_2-0-13,
|
|
311
|
+
.magritte-textarea-layout-fill-horizontal___imBH2_2-0-13{
|
|
312
|
+
flex-direction:column;
|
|
313
|
+
}
|
|
314
|
+
.magritte-textarea-layout-fill-both___ERS-q_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13,
|
|
315
|
+
.magritte-textarea-layout-fill-vertical___HmNtp_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13,
|
|
316
|
+
.magritte-textarea-layout-fill-horizontal___imBH2_2-0-13 .magritte-textarea-position-container-wrapper___4Dsui_2-0-13{
|
|
317
|
+
flex:1;
|
|
318
|
+
}
|
|
319
|
+
.magritte-textarea-layout-fill-both___ERS-q_2-0-13{
|
|
320
|
+
width:100%;
|
|
321
|
+
height:100%;
|
|
322
|
+
}
|
|
323
|
+
.magritte-textarea-layout-fill-vertical___HmNtp_2-0-13{
|
|
324
|
+
height:100%;
|
|
325
|
+
}
|
|
326
|
+
.magritte-textarea-layout-fill-horizontal___imBH2_2-0-13{
|
|
327
|
+
width:100%;
|
|
328
|
+
}
|
|
329
|
+
.magritte-textarea-without-label___WhBIw_2-0-13 .magritte-textarea-native___w-czf_2-0-13{
|
|
330
|
+
margin-top:-18px;
|
|
331
|
+
min-height:calc(104px - var(--magritte-typography-label-4-regular-line-height-v18-1-1));
|
|
332
|
+
}
|
|
333
|
+
.magritte-textarea-without-label___WhBIw_2-0-13.magritte-textarea-limited___cU1Rg_2-0-13 .magritte-textarea-native___w-czf_2-0-13{
|
|
334
|
+
min-height:calc(90px - var(--magritte-typography-label-4-regular-line-height-v18-1-1));
|
|
335
|
+
}
|
|
336
|
+
.magritte-textarea-wrapper___yD7G6_2-0-13{
|
|
337
|
+
display:inline-flex;
|
|
338
|
+
width:100%;
|
|
339
|
+
}
|
|
340
|
+
.magritte-textarea-layout-hug___tdCMY_2-0-13{
|
|
341
|
+
width:100%;
|
|
342
|
+
}
|
|
343
|
+
.magritte-textarea-layout-hug___tdCMY_2-0-13 .magritte-textarea-wrapper___yD7G6_2-0-13{
|
|
344
|
+
display:grid;
|
|
345
|
+
}
|
|
346
|
+
.magritte-textarea-layout-hug___tdCMY_2-0-13 .magritte-textarea-wrapper___yD7G6_2-0-13::after,
|
|
347
|
+
.magritte-textarea-layout-hug___tdCMY_2-0-13 .magritte-textarea-wrapper___yD7G6_2-0-13 .magritte-textarea-native___w-czf_2-0-13{
|
|
348
|
+
grid-area:1 / 1 / 2 / 2;
|
|
349
|
+
overflow:hidden;
|
|
350
|
+
width:auto;
|
|
351
|
+
}
|
|
352
|
+
.magritte-textarea-layout-hug___tdCMY_2-0-13 .magritte-textarea-wrapper___yD7G6_2-0-13::after{
|
|
353
|
+
box-sizing:border-box;
|
|
354
|
+
border:0;
|
|
355
|
+
width:100%;
|
|
356
|
+
padding:0 16px;
|
|
357
|
+
padding-right:14px;
|
|
358
|
+
color:var(--magritte-color-component-input-text-content-v18-1-1);
|
|
359
|
+
caret-color:var(--magritte-color-text-primary-v18-1-1);
|
|
360
|
+
font-family:var(--magritte-typography-label-2-regular-font-family-v18-1-1);
|
|
361
|
+
font-weight:var(--magritte-typography-label-2-regular-font-weight-v18-1-1);
|
|
362
|
+
line-height:var(--magritte-typography-label-2-regular-line-height-v18-1-1);
|
|
363
|
+
font-size:var(--magritte-typography-label-2-regular-font-size-v18-1-1);
|
|
364
|
+
letter-spacing:var(--magritte-typography-label-2-regular-letter-spacing-v18-1-1);
|
|
365
|
+
text-indent:var(--magritte-typography-label-2-regular-text-indent-v18-1-1);
|
|
366
|
+
text-transform:var(--magritte-typography-label-2-regular-text-transform-v18-1-1);
|
|
367
|
+
text-decoration:var(--magritte-typography-label-2-regular-text-decoration-v18-1-1);
|
|
368
|
+
content:attr(data-replicated-value) ' ';
|
|
369
|
+
white-space:pre-wrap;
|
|
370
|
+
visibility:hidden;
|
|
371
|
+
}
|
|
372
|
+
.magritte-textarea-position-container___cEpbv_2-0-13{
|
|
373
|
+
display:inline-flex;
|
|
374
|
+
overflow:hidden;
|
|
375
|
+
position:relative;
|
|
376
|
+
width:100%;
|
|
377
|
+
border-radius:12px;
|
|
378
|
+
background-color:var(--magritte-color-component-input-background-field-v18-1-1);
|
|
379
|
+
padding:16px 0;
|
|
380
|
+
padding-right:2px;
|
|
381
|
+
padding-top:calc(var(--magritte-typography-label-4-regular-line-height-v18-1-1) + 18px);
|
|
382
|
+
cursor:text;
|
|
383
|
+
min-height:120px;
|
|
384
|
+
box-sizing:border-box;
|
|
385
|
+
box-shadow:inset 0 0 0 1px var(--magritte-color-component-input-stroke-field-v18-1-1);
|
|
386
|
+
transform:translateZ(0);
|
|
387
|
+
}
|
|
388
|
+
.magritte-textarea-position-container___cEpbv_2-0-13::-webkit-resizer{
|
|
389
|
+
display:none;
|
|
390
|
+
}
|
|
391
|
+
.magritte-textarea-animation-timeout___zudbr_2-0-13,
|
|
392
|
+
.magritte-textarea-position-container___cEpbv_2-0-13{
|
|
393
|
+
transition-property:transform, color, font-size, letter-spacing;
|
|
394
|
+
transition-duration:var(--animation-100-duration);
|
|
395
|
+
transition-timing-function:var(--magritte-semantic-animation-ease-in-out-100-timing-function-v18-1-1);
|
|
396
|
+
--animation-duration:var(--magritte-semantic-animation-ease-in-out-100-duration-v18-1-1);
|
|
397
|
+
}
|
|
398
|
+
.magritte-textarea-rigging-container___-1S6i_2-0-13{
|
|
399
|
+
position:absolute;
|
|
400
|
+
pointer-events:none;
|
|
401
|
+
left:16px;
|
|
402
|
+
right:16px;
|
|
403
|
+
top:0;
|
|
404
|
+
}
|
|
405
|
+
.magritte-textarea-label___sgTIH_2-0-13{
|
|
406
|
+
font-family:var(--magritte-typography-label-2-regular-font-family-v18-1-1);
|
|
407
|
+
font-weight:var(--magritte-typography-label-2-regular-font-weight-v18-1-1);
|
|
408
|
+
line-height:var(--magritte-typography-label-2-regular-line-height-v18-1-1);
|
|
409
|
+
font-size:var(--magritte-typography-label-2-regular-font-size-v18-1-1);
|
|
410
|
+
letter-spacing:var(--magritte-typography-label-2-regular-letter-spacing-v18-1-1);
|
|
411
|
+
text-indent:var(--magritte-typography-label-2-regular-text-indent-v18-1-1);
|
|
412
|
+
text-transform:var(--magritte-typography-label-2-regular-text-transform-v18-1-1);
|
|
413
|
+
text-decoration:var(--magritte-typography-label-2-regular-text-decoration-v18-1-1);
|
|
414
|
+
display:block;
|
|
415
|
+
white-space:nowrap;
|
|
416
|
+
overflow:hidden;
|
|
417
|
+
text-overflow:ellipsis;
|
|
418
|
+
user-select:none;
|
|
419
|
+
padding-top:var(--magritte-typography-label-4-regular-line-height-v18-1-1);
|
|
420
|
+
color:var(--magritte-color-component-input-text-placeholder-v18-1-1);
|
|
421
|
+
transition-property:transform, color, font-size, letter-spacing;
|
|
422
|
+
transition-duration:var(--animation-100-duration);
|
|
423
|
+
transition-timing-function:var(--magritte-semantic-animation-ease-in-out-100-timing-function-v18-1-1);
|
|
424
|
+
}
|
|
425
|
+
.magritte-textarea-limit___IjPJy_2-0-13{
|
|
426
|
+
position:absolute;
|
|
427
|
+
bottom:10px;
|
|
428
|
+
right:28px;
|
|
429
|
+
left:16px;
|
|
430
|
+
text-align:right;
|
|
431
|
+
background-color:var(--magritte-color-component-input-background-field-v18-1-1);
|
|
432
|
+
pointer-events:none;
|
|
433
|
+
--magritte-ui-text-color-override:var(--magritte-color-component-input-text-limit-v18-1-1);
|
|
434
|
+
}
|
|
435
|
+
.magritte-textarea-grip___iL7lq_2-0-13{
|
|
436
|
+
position:absolute;
|
|
437
|
+
pointer-events:none;
|
|
438
|
+
display:inline-flex;
|
|
439
|
+
bottom:4px;
|
|
440
|
+
right:4px;
|
|
441
|
+
border-bottom-right-radius:12px;
|
|
442
|
+
--magritte-ui-icon-color-override:var(--magritte-color-component-input-icon-grip-v18-1-1);
|
|
443
|
+
}
|
|
444
|
+
.magritte-textarea-grip-icon___YK-9w_2-0-13{
|
|
445
|
+
display:inline-flex;
|
|
446
|
+
z-index:1;
|
|
447
|
+
}
|
|
448
|
+
.magritte-textarea-label-elevated___0lxOI_2-0-13{
|
|
449
|
+
font-family:var(--magritte-typography-label-4-regular-font-family-v18-1-1);
|
|
450
|
+
font-weight:var(--magritte-typography-label-4-regular-font-weight-v18-1-1);
|
|
451
|
+
line-height:var(--magritte-typography-label-4-regular-line-height-v18-1-1);
|
|
452
|
+
font-size:var(--magritte-typography-label-4-regular-font-size-v18-1-1);
|
|
453
|
+
letter-spacing:var(--magritte-typography-label-4-regular-letter-spacing-v18-1-1);
|
|
454
|
+
text-indent:var(--magritte-typography-label-4-regular-text-indent-v18-1-1);
|
|
455
|
+
text-transform:var(--magritte-typography-label-4-regular-text-transform-v18-1-1);
|
|
456
|
+
text-decoration:var(--magritte-typography-label-4-regular-text-decoration-v18-1-1);
|
|
457
|
+
color:var(--magritte-color-component-input-text-label-v18-1-1);
|
|
458
|
+
transform:translateY(calc((var(--magritte-typography-label-4-regular-line-height-v18-1-1) / 2) - ((var(--magritte-typography-label-4-regular-line-height-v18-1-1) + var(--magritte-typography-label-2-regular-line-height-v18-1-1)) / 2) + 8px));
|
|
459
|
+
}
|
|
460
|
+
@media (prefers-reduced-motion: no-preference){
|
|
461
|
+
.magritte-textarea-limit-enter___CygGz_2-0-13{
|
|
462
|
+
opacity:0;
|
|
463
|
+
}
|
|
464
|
+
.magritte-textarea-limit-exit___RMp-R_2-0-13,
|
|
465
|
+
.magritte-textarea-limit-enter-active___8vN-t_2-0-13{
|
|
466
|
+
opacity:1;
|
|
467
|
+
}
|
|
468
|
+
.magritte-textarea-limit-enter-active___8vN-t_2-0-13{
|
|
469
|
+
transition-property:opacity;
|
|
470
|
+
transition-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v18-1-1);
|
|
471
|
+
transition-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v18-1-1);
|
|
472
|
+
--animation-duration:var(--magritte-semantic-animation-ease-in-out-300-duration-v18-1-1);
|
|
473
|
+
}
|
|
474
|
+
.magritte-textarea-limit-exit-active___a5kBr_2-0-13{
|
|
475
|
+
opacity:0;
|
|
476
|
+
transition-property:opacity;
|
|
477
|
+
transition-duration:var(--magritte-semantic-animation-ease-in-out-100-duration-v18-1-1);
|
|
478
|
+
transition-timing-function:var(--magritte-semantic-animation-ease-in-out-100-timing-function-v18-1-1);
|
|
479
|
+
}
|
|
480
|
+
}
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
export { TextArea } from './Textarea.js';
|
|
3
|
+
export { UncontrolledTextArea } from './UncontrolledTextarea.js';
|
|
4
|
+
import 'react/jsx-runtime';
|
|
5
|
+
import 'react';
|
|
6
|
+
import 'react-transition-group';
|
|
7
|
+
import 'classnames';
|
|
8
|
+
import '@hh.ru/magritte-common-use-disabled';
|
|
9
|
+
import '@hh.ru/magritte-common-use-multiple-refs';
|
|
10
|
+
import '@hh.ru/magritte-internal-field-hint';
|
|
11
|
+
import '@hh.ru/magritte-ui-breakpoint';
|
|
12
|
+
import '@hh.ru/magritte-ui-icon/private';
|
|
13
|
+
import '@hh.ru/magritte-ui-input/useInputAriaProps';
|
|
14
|
+
import './useFocus.js';
|
|
15
|
+
import '@hh.ru/magritte-ui-typography';
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hh.ru/magritte-ui-textarea",
|
|
3
|
+
"version": "2.0.13",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"types": "index.d.ts",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"index.css"
|
|
8
|
+
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "yarn root:build $(pwd)",
|
|
11
|
+
"build-test-branch": "yarn root:build-test-branch $(pwd)",
|
|
12
|
+
"changelog": "yarn root:changelog $(pwd)",
|
|
13
|
+
"prepack": "yarn root:prepack $(pwd)",
|
|
14
|
+
"postpublish": "yarn root:postpublish $(pwd)",
|
|
15
|
+
"stylelint-test": "yarn root:stylelint-test $(pwd)",
|
|
16
|
+
"eslint-test": "yarn root:eslint-test $(pwd)",
|
|
17
|
+
"ts-config": "yarn root:ts-config $(pwd)",
|
|
18
|
+
"ts-check": "yarn root:ts-check $(pwd)",
|
|
19
|
+
"test": "yarn root:test $(pwd)"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@hh.ru/magritte-common-use-disabled": "1.0.8",
|
|
23
|
+
"@hh.ru/magritte-common-use-multiple-refs": "1.1.2",
|
|
24
|
+
"@hh.ru/magritte-internal-field-hint": "1.2.26",
|
|
25
|
+
"@hh.ru/magritte-ui-breakpoint": "4.0.1",
|
|
26
|
+
"@hh.ru/magritte-ui-icon": "7.1.3",
|
|
27
|
+
"@hh.ru/magritte-ui-input": "5.0.12",
|
|
28
|
+
"@hh.ru/magritte-ui-typography": "3.0.8"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"classnames": ">=2.3.2",
|
|
32
|
+
"react": ">=18.2.0",
|
|
33
|
+
"react-transition-group": ">=4.4.5"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"gitHead": "b660dd64fca3eaad5ec44ea9a73f92bb0d9694aa"
|
|
39
|
+
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ReactNode, FocusEventHandler, ChangeEventHandler } from 'react';
|
|
2
|
+
export interface BaseTextAreaProps {
|
|
3
|
+
/** Текст плейсхолдера */
|
|
4
|
+
placeholder?: ReactNode;
|
|
5
|
+
/** Обработчик события получения фокуса */
|
|
6
|
+
onFocus?: FocusEventHandler<HTMLTextAreaElement>;
|
|
7
|
+
/** Обработчик события потери фокуса */
|
|
8
|
+
onBlur?: FocusEventHandler<HTMLTextAreaElement>;
|
|
9
|
+
/** Текст подсказки под textarea */
|
|
10
|
+
description?: ReactNode;
|
|
11
|
+
/** Текст сообщения об ошибке */
|
|
12
|
+
errorMessage?: ReactNode;
|
|
13
|
+
/** Флаг отключения textarea */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Признак невалидности */
|
|
16
|
+
invalid?: boolean;
|
|
17
|
+
/** Признак невалидности по лимиту */
|
|
18
|
+
invalidLimit?: boolean;
|
|
19
|
+
/** Флаг управляющий режимом отображения полейсхолдера */
|
|
20
|
+
elevatePlaceholder?: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface TextAreaLayoutFixed {
|
|
23
|
+
layout: 'fixed';
|
|
24
|
+
/** Включать ли возможность resize */
|
|
25
|
+
resize?: 'none' | 'both' | 'horizontal' | 'vertical';
|
|
26
|
+
}
|
|
27
|
+
interface TextAreaLayouts {
|
|
28
|
+
resize?: never;
|
|
29
|
+
layout?: 'fill-vertical' | 'fill-horizontal' | 'fill-both' | 'hug' | 'fixed';
|
|
30
|
+
}
|
|
31
|
+
interface ValidatorMaxLength {
|
|
32
|
+
/** Лимит на количество символов, отображает текущее состояние и лимит */
|
|
33
|
+
maxLength: number;
|
|
34
|
+
/** Функция для связывания внешней валидации с внутренней */
|
|
35
|
+
onValidate: (invalidState: {
|
|
36
|
+
invalidLimit: boolean;
|
|
37
|
+
}) => void;
|
|
38
|
+
}
|
|
39
|
+
interface WithoutValidatorMaxLength {
|
|
40
|
+
maxLength?: never;
|
|
41
|
+
onValidate?: never;
|
|
42
|
+
}
|
|
43
|
+
type Validator = WithoutValidatorMaxLength | ValidatorMaxLength;
|
|
44
|
+
export interface ControlledProps {
|
|
45
|
+
/** Обработчик события изменения */
|
|
46
|
+
onChange: ChangeEventHandler<HTMLTextAreaElement>;
|
|
47
|
+
/** Значение textarea */
|
|
48
|
+
value: string;
|
|
49
|
+
}
|
|
50
|
+
export type UncontrolledTextAreaProps = Partial<ControlledProps> & Validator & BaseTextAreaProps & (TextAreaLayoutFixed | TextAreaLayouts);
|
|
51
|
+
export type ControlledTextAreaProps = BaseTextAreaProps & ControlledProps & Validator & (TextAreaLayoutFixed | TextAreaLayouts);
|
|
52
|
+
export {};
|
package/types.js
ADDED
package/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/useFocus.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FocusEventHandler } from 'react';
|
|
2
|
+
export declare const useFocus: <T extends HTMLTextAreaElement = HTMLTextAreaElement>(onFocus: FocusEventHandler<T> | undefined, onBlur: FocusEventHandler<T> | undefined) => {
|
|
3
|
+
focusHandler: FocusEventHandler<T>;
|
|
4
|
+
blurHandler: FocusEventHandler<T>;
|
|
5
|
+
isFocused: boolean;
|
|
6
|
+
};
|
package/useFocus.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
|
+
|
|
4
|
+
const useFocus = (onFocus, onBlur) => {
|
|
5
|
+
const [isFocused, setFocused] = useState(false);
|
|
6
|
+
const focusHandler = useCallback((event) => {
|
|
7
|
+
setFocused(true);
|
|
8
|
+
onFocus?.(event);
|
|
9
|
+
}, [setFocused, onFocus]);
|
|
10
|
+
const blurHandler = useCallback((event) => {
|
|
11
|
+
setFocused(false);
|
|
12
|
+
onBlur?.(event);
|
|
13
|
+
}, [setFocused, onBlur]);
|
|
14
|
+
return { focusHandler, blurHandler, isFocused };
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { useFocus };
|
|
18
|
+
//# sourceMappingURL=useFocus.js.map
|
package/useFocus.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFocus.js","sources":["../src/useFocus.ts"],"sourcesContent":["import { useCallback, useState, FocusEventHandler } from 'react';\n\nexport const useFocus = <T extends HTMLTextAreaElement = HTMLTextAreaElement>(\n onFocus: FocusEventHandler<T> | undefined,\n onBlur: FocusEventHandler<T> | undefined\n): {\n focusHandler: FocusEventHandler<T>;\n blurHandler: FocusEventHandler<T>;\n isFocused: boolean;\n} => {\n const [isFocused, setFocused] = useState(false);\n const focusHandler = useCallback<FocusEventHandler<T>>(\n (event) => {\n setFocused(true);\n onFocus?.(event);\n },\n [setFocused, onFocus]\n );\n\n const blurHandler = useCallback<FocusEventHandler<T>>(\n (event) => {\n setFocused(false);\n onBlur?.(event);\n },\n [setFocused, onBlur]\n );\n\n return { focusHandler, blurHandler, isFocused };\n};\n"],"names":[],"mappings":";;MAEa,QAAQ,GAAG,CACpB,OAAyC,EACzC,MAAwC,KAKxC;IACA,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAChD,IAAA,MAAM,YAAY,GAAG,WAAW,CAC5B,CAAC,KAAK,KAAI;QACN,UAAU,CAAC,IAAI,CAAC,CAAC;AACjB,QAAA,OAAO,GAAG,KAAK,CAAC,CAAC;AACrB,KAAC,EACD,CAAC,UAAU,EAAE,OAAO,CAAC,CACxB,CAAC;AAEF,IAAA,MAAM,WAAW,GAAG,WAAW,CAC3B,CAAC,KAAK,KAAI;QACN,UAAU,CAAC,KAAK,CAAC,CAAC;AAClB,QAAA,MAAM,GAAG,KAAK,CAAC,CAAC;AACpB,KAAC,EACD,CAAC,UAAU,EAAE,MAAM,CAAC,CACvB,CAAC;AAEF,IAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AACpD;;;;"}
|