@elliemae/ds-form-input-textarea 3.3.0-rc.0 → 3.3.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/DSControlledLargeTextInput.js +15 -6
- package/dist/cjs/DSControlledLargeTextInput.js.map +2 -2
- package/dist/cjs/styles.js +2 -0
- package/dist/cjs/styles.js.map +2 -2
- package/dist/esm/DSControlledLargeTextInput.js +16 -7
- package/dist/esm/DSControlledLargeTextInput.js.map +2 -2
- package/dist/esm/styles.js +2 -0
- package/dist/esm/styles.js.map +2 -2
- package/package.json +3 -3
|
@@ -37,17 +37,19 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
37
37
|
const { value, onChange, innerRef, resizable, name, id, hasError, maxHeight, ...otherProps } = propsWithDefault;
|
|
38
38
|
const { className, ...globalAttributes } = (0, import_ds_utilities.useGetGlobalAttributes)(otherProps);
|
|
39
39
|
const xstyledProps = (0, import_ds_utilities.useGetXstyledProps)(otherProps);
|
|
40
|
+
const [calculatedMinHeight, setCalculatedMinHeight] = (0, import_react.useState)(void 0);
|
|
40
41
|
const textareaRef = (0, import_react.useRef)(null);
|
|
42
|
+
const ghostRef = (0, import_react.useRef)(null);
|
|
41
43
|
const handleOnChange = (0, import_react.useCallback)((e) => onChange(e.target.value, e), [onChange]);
|
|
42
44
|
(0, import_react.useLayoutEffect)(() => {
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
const { scrollHeight } =
|
|
45
|
+
if (ghostRef && ghostRef.current && value !== "") {
|
|
46
|
+
ghostRef.current.style.maxHeight = "0px";
|
|
47
|
+
const { scrollHeight } = ghostRef.current;
|
|
46
48
|
if (maxHeight !== void 0 && scrollHeight >= maxHeight)
|
|
47
|
-
|
|
49
|
+
setCalculatedMinHeight(`${maxHeight}`);
|
|
48
50
|
else
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
setCalculatedMinHeight(`${scrollHeight}`);
|
|
52
|
+
ghostRef.current.style.maxHeight = `${maxHeight}px`;
|
|
51
53
|
}
|
|
52
54
|
}, [maxHeight, value]);
|
|
53
55
|
return /* @__PURE__ */ import_react.default.createElement(import_styles.StyledContainer, {
|
|
@@ -59,6 +61,7 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
59
61
|
"aria-multiline": true,
|
|
60
62
|
value,
|
|
61
63
|
$maxHeight: maxHeight,
|
|
64
|
+
$minHeight: calculatedMinHeight,
|
|
62
65
|
onChange: handleOnChange,
|
|
63
66
|
resizable,
|
|
64
67
|
name,
|
|
@@ -66,6 +69,12 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
66
69
|
"data-testid": import_exported_related.DSControlledLargetTextInputDatatestids.INPUT,
|
|
67
70
|
$hasError: hasError,
|
|
68
71
|
...globalAttributes
|
|
72
|
+
}), /* @__PURE__ */ import_react.default.createElement(import_styles.StyledTextArea, {
|
|
73
|
+
disabled: true,
|
|
74
|
+
ref: ghostRef,
|
|
75
|
+
value,
|
|
76
|
+
style: { visibility: "hidden", pointerEvents: "none", position: "absolute" },
|
|
77
|
+
$maxHeight: maxHeight
|
|
69
78
|
}));
|
|
70
79
|
};
|
|
71
80
|
DSControlledLargeTextInput.displayName = "DSControlledLargeTextInput";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSControlledLargeTextInput.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback, WeakValidationMap, useRef, useLayoutEffect } from 'react';\nimport {\n describe,\n mergeRefs,\n useValidateTypescriptPropTypes,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useGetXstyledProps,\n} from '@elliemae/ds-utilities';\nimport { propTypes, defaultProps } from './react-desc-prop-types';\nimport { StyledTextArea, StyledContainer } from './styles';\nimport { DSControlledLargetTextInputDatatestids } from './exported-related';\nimport type { DSControlledLargeTextInputT } from './react-desc-prop-types';\n\nconst DSControlledLargeTextInput = (props: DSControlledLargeTextInputT.Props): JSX.Element => {\n useValidateTypescriptPropTypes(props, propTypes);\n\n const propsWithDefault = useMemoMergePropsWithDefault<DSControlledLargeTextInputT.Props>(props, defaultProps);\n\n const { value, onChange, innerRef, resizable, name, id, hasError, maxHeight, ...otherProps } = propsWithDefault;\n\n const { className, ...globalAttributes } = useGetGlobalAttributes(otherProps);\n\n const xstyledProps = useGetXstyledProps(otherProps);\n\n const textareaRef = useRef<HTMLTextAreaElement | null>(null);\n\n const handleOnChange = useCallback(\n (e: React.KeyboardEvent) => onChange((e.target as HTMLInputElement).value, e),\n [onChange],\n );\n\n useLayoutEffect(() => {\n if (
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, WeakValidationMap, useRef, useState, useLayoutEffect } from 'react';\nimport {\n describe,\n mergeRefs,\n useValidateTypescriptPropTypes,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useGetXstyledProps,\n} from '@elliemae/ds-utilities';\nimport { propTypes, defaultProps } from './react-desc-prop-types';\nimport { StyledTextArea, StyledContainer } from './styles';\nimport { DSControlledLargetTextInputDatatestids } from './exported-related';\nimport type { DSControlledLargeTextInputT } from './react-desc-prop-types';\n\nconst DSControlledLargeTextInput = (props: DSControlledLargeTextInputT.Props): JSX.Element => {\n useValidateTypescriptPropTypes(props, propTypes);\n\n const propsWithDefault = useMemoMergePropsWithDefault<DSControlledLargeTextInputT.Props>(props, defaultProps);\n\n const { value, onChange, innerRef, resizable, name, id, hasError, maxHeight, ...otherProps } = propsWithDefault;\n\n const { className, ...globalAttributes } = useGetGlobalAttributes(otherProps);\n\n const xstyledProps = useGetXstyledProps(otherProps);\n\n const [calculatedMinHeight, setCalculatedMinHeight] = useState(undefined)\n\n const textareaRef = useRef<HTMLTextAreaElement | null>(null);\n const ghostRef = useRef<HTMLTextAreaElement | null>(null);\n\n const handleOnChange = useCallback(\n (e: React.KeyboardEvent) => onChange((e.target as HTMLInputElement).value, e),\n [onChange],\n );\n\n useLayoutEffect(() => {\n if (ghostRef && ghostRef.current && value !== '') {\n ghostRef.current.style.maxHeight = '0px';\n const { scrollHeight } = ghostRef.current;\n if (maxHeight !== undefined && scrollHeight >= maxHeight) setCalculatedMinHeight(`${maxHeight}`);\n else setCalculatedMinHeight(`${scrollHeight}`)\n ghostRef.current.style.maxHeight = `${maxHeight}px`;\n }\n }, [maxHeight, value]);\n\n return (\n <StyledContainer\n className={className}\n data-testid={DSControlledLargetTextInputDatatestids.CONTAINER}\n {...xstyledProps}\n >\n <StyledTextArea\n ref={mergeRefs(innerRef, textareaRef)}\n aria-multiline\n value={value}\n $maxHeight={maxHeight}\n $minHeight={calculatedMinHeight}\n onChange={handleOnChange}\n resizable={resizable}\n name={name}\n id={id}\n data-testid={DSControlledLargetTextInputDatatestids.INPUT}\n $hasError={hasError}\n {...globalAttributes}\n />\n <StyledTextArea\n disabled\n ref={ghostRef}\n value={value}\n style={{ visibility: 'hidden', pointerEvents: 'none', position: 'absolute' }}\n $maxHeight={maxHeight}\n />\n </StyledContainer>\n );\n};\n\nDSControlledLargeTextInput.displayName = 'DSControlledLargeTextInput';\nconst DSControlledLargeTextInputWithSchema = describe(DSControlledLargeTextInput);\nDSControlledLargeTextInputWithSchema.propTypes = propTypes as WeakValidationMap<unknown>;\n\nexport { DSControlledLargeTextInput, DSControlledLargeTextInputWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAyF;AACzF,0BAOO;AACP,mCAAwC;AACxC,oBAAgD;AAChD,8BAAuD;AAGvD,MAAM,6BAA6B,CAAC,UAA0D;AAC5F,0DAA+B,OAAO,sCAAS;AAE/C,QAAM,mBAAmB,sDAAgE,OAAO,yCAAY;AAE5G,QAAM,EAAE,OAAO,UAAU,UAAU,WAAW,MAAM,IAAI,UAAU,cAAc,eAAe;AAE/F,QAAM,EAAE,cAAc,qBAAqB,gDAAuB,UAAU;AAE5E,QAAM,eAAe,4CAAmB,UAAU;AAElD,QAAM,CAAC,qBAAqB,0BAA0B,2BAAS,MAAS;AAExE,QAAM,cAAc,yBAAmC,IAAI;AAC3D,QAAM,WAAW,yBAAmC,IAAI;AAExD,QAAM,iBAAiB,8BACrB,CAAC,MAA2B,SAAU,EAAE,OAA4B,OAAO,CAAC,GAC5E,CAAC,QAAQ,CACX;AAEA,oCAAgB,MAAM;AACpB,QAAI,YAAY,SAAS,WAAW,UAAU,IAAI;AAChD,eAAS,QAAQ,MAAM,YAAY;AACnC,YAAM,EAAE,iBAAiB,SAAS;AAClC,UAAI,cAAc,UAAa,gBAAgB;AAAW,+BAAuB,GAAG,WAAW;AAAA;AAC1F,+BAAuB,GAAG,cAAc;AAC7C,eAAS,QAAQ,MAAM,YAAY,GAAG;AAAA,IACxC;AAAA,EACF,GAAG,CAAC,WAAW,KAAK,CAAC;AAErB,SACE,mDAAC;AAAA,IACC;AAAA,IACA,eAAa,+DAAuC;AAAA,IACnD,GAAG;AAAA,KAEJ,mDAAC;AAAA,IACC,KAAK,mCAAU,UAAU,WAAW;AAAA,IACpC,kBAAc;AAAA,IACd;AAAA,IACA,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAa,+DAAuC;AAAA,IACpD,WAAW;AAAA,IACV,GAAG;AAAA,GACN,GACA,mDAAC;AAAA,IACC,UAAQ;AAAA,IACR,KAAK;AAAA,IACL;AAAA,IACA,OAAO,EAAE,YAAY,UAAU,eAAe,QAAQ,UAAU,WAAW;AAAA,IAC3E,YAAY;AAAA,GACd,CACF;AAEJ;AAEA,2BAA2B,cAAc;AACzC,MAAM,uCAAuC,kCAAS,0BAA0B;AAChF,qCAAqC,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/styles.js
CHANGED
|
@@ -55,6 +55,8 @@ const StyledTextArea = (0, import_ds_system.styled)("textarea", {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
${({ $maxHeight }) => $maxHeight ? `max-height: ${$maxHeight}px;` : ``}
|
|
58
|
+
${({ $minHeight }) => $minHeight ? `min-height: ${$minHeight}px;` : ``}
|
|
59
|
+
${({ disabled }) => disabled ? `overflow: hidden` : ""}
|
|
58
60
|
${({ $hasError }) => $hasError ? `border: 1px solid red;` : ``}
|
|
59
61
|
`;
|
|
60
62
|
//# sourceMappingURL=styles.js.map
|
package/dist/cjs/styles.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/styles.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { styled, layout, space, sizing } from '@elliemae/ds-system';\nimport { DSControlledLargeTextInputName, DSControlledLargeTextInputSlots } from './exported-related';\n\ninterface StyledTextAreaT {\n resizable: boolean;\n hasError: boolean;\n}\n\nexport const StyledContainer = styled('div', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.CONTAINER,\n})`\n display: grid;\n grid-gap: 4px;\n grid-template-rows: auto auto;\n grid-template-columns: fit-content;\n ${layout}\n ${space}\n ${sizing}\n`;\n\nexport const StyledTextArea = styled('textarea', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.INPUT,\n})<StyledTextAreaT>`\n &:hover { \n border: 1px solid ${({theme}) => theme.colors.brand[700]};\n }\n width: 100%;\n ${({ resizable }) => (resizable ? `` : `resize: none;`)}\n &:disabled {\n &:hover {\n cursor: not-allowed;\n }\n }\n ${({ $maxHeight }) => ($maxHeight ? `max-height: ${$maxHeight}px;` : ``)}\n ${({ $hasError }) => ($hasError ? `border: 1px solid red;` : ``)}\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA8C;AAC9C,8BAAgF;AAOzE,MAAM,kBAAkB,6BAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,wDAAgC;AACxC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAKG;AAAA,IACA;AAAA,IACA;AAAA;AAGG,MAAM,iBAAiB,6BAAO,YAAY;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,wDAAgC;AACxC,CAAC;AAAA;AAAA,wBAEuB,CAAC,EAAC,YAAW,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA,IAGpD,CAAC,EAAE,gBAAiB,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMrC,CAAC,EAAE,iBAAkB,aAAa,eAAe,kBAAkB;AAAA,IACnE,CAAC,EAAE,gBAAiB,YAAY,2BAA2B;AAAA;",
|
|
4
|
+
"sourcesContent": ["import { styled, layout, space, sizing } from '@elliemae/ds-system';\nimport { DSControlledLargeTextInputName, DSControlledLargeTextInputSlots } from './exported-related';\n\ninterface StyledTextAreaT {\n resizable: boolean;\n hasError: boolean;\n}\n\nexport const StyledContainer = styled('div', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.CONTAINER,\n})`\n display: grid;\n grid-gap: 4px;\n grid-template-rows: auto auto;\n grid-template-columns: fit-content;\n ${layout}\n ${space}\n ${sizing}\n`;\n\nexport const StyledTextArea = styled('textarea', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.INPUT,\n})<StyledTextAreaT>`\n &:hover { \n border: 1px solid ${({theme}) => theme.colors.brand[700]};\n }\n width: 100%;\n ${({ resizable }) => (resizable ? `` : `resize: none;`)}\n &:disabled {\n &:hover {\n cursor: not-allowed;\n }\n }\n ${({ $maxHeight }) => ($maxHeight ? `max-height: ${$maxHeight}px;` : ``)}\n ${({ $minHeight }) => ($minHeight ? `min-height: ${$minHeight}px;` : ``)}\n ${({ disabled }) => (disabled ? `overflow: hidden` : '')}\n ${({ $hasError }) => ($hasError ? `border: 1px solid red;` : ``)}\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA8C;AAC9C,8BAAgF;AAOzE,MAAM,kBAAkB,6BAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,wDAAgC;AACxC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAKG;AAAA,IACA;AAAA,IACA;AAAA;AAGG,MAAM,iBAAiB,6BAAO,YAAY;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,wDAAgC;AACxC,CAAC;AAAA;AAAA,wBAEuB,CAAC,EAAC,YAAW,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA,IAGpD,CAAC,EAAE,gBAAiB,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMrC,CAAC,EAAE,iBAAkB,aAAa,eAAe,kBAAkB;AAAA,IACnE,CAAC,EAAE,iBAAkB,aAAa,eAAe,kBAAkB;AAAA,IACnE,CAAC,EAAE,eAAgB,WAAW,qBAAqB;AAAA,IACnD,CAAC,EAAE,gBAAiB,YAAY,2BAA2B;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import React2, { useCallback, useRef, useLayoutEffect } from "react";
|
|
3
|
+
import React2, { useCallback, useRef, useState, useLayoutEffect } from "react";
|
|
4
4
|
import {
|
|
5
5
|
describe,
|
|
6
6
|
mergeRefs,
|
|
@@ -18,17 +18,19 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
18
18
|
const { value, onChange, innerRef, resizable, name, id, hasError, maxHeight, ...otherProps } = propsWithDefault;
|
|
19
19
|
const { className, ...globalAttributes } = useGetGlobalAttributes(otherProps);
|
|
20
20
|
const xstyledProps = useGetXstyledProps(otherProps);
|
|
21
|
+
const [calculatedMinHeight, setCalculatedMinHeight] = useState(void 0);
|
|
21
22
|
const textareaRef = useRef(null);
|
|
23
|
+
const ghostRef = useRef(null);
|
|
22
24
|
const handleOnChange = useCallback((e) => onChange(e.target.value, e), [onChange]);
|
|
23
25
|
useLayoutEffect(() => {
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
const { scrollHeight } =
|
|
26
|
+
if (ghostRef && ghostRef.current && value !== "") {
|
|
27
|
+
ghostRef.current.style.maxHeight = "0px";
|
|
28
|
+
const { scrollHeight } = ghostRef.current;
|
|
27
29
|
if (maxHeight !== void 0 && scrollHeight >= maxHeight)
|
|
28
|
-
|
|
30
|
+
setCalculatedMinHeight(`${maxHeight}`);
|
|
29
31
|
else
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
setCalculatedMinHeight(`${scrollHeight}`);
|
|
33
|
+
ghostRef.current.style.maxHeight = `${maxHeight}px`;
|
|
32
34
|
}
|
|
33
35
|
}, [maxHeight, value]);
|
|
34
36
|
return /* @__PURE__ */ React2.createElement(StyledContainer, {
|
|
@@ -40,6 +42,7 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
40
42
|
"aria-multiline": true,
|
|
41
43
|
value,
|
|
42
44
|
$maxHeight: maxHeight,
|
|
45
|
+
$minHeight: calculatedMinHeight,
|
|
43
46
|
onChange: handleOnChange,
|
|
44
47
|
resizable,
|
|
45
48
|
name,
|
|
@@ -47,6 +50,12 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
47
50
|
"data-testid": DSControlledLargetTextInputDatatestids.INPUT,
|
|
48
51
|
$hasError: hasError,
|
|
49
52
|
...globalAttributes
|
|
53
|
+
}), /* @__PURE__ */ React2.createElement(StyledTextArea, {
|
|
54
|
+
disabled: true,
|
|
55
|
+
ref: ghostRef,
|
|
56
|
+
value,
|
|
57
|
+
style: { visibility: "hidden", pointerEvents: "none", position: "absolute" },
|
|
58
|
+
$maxHeight: maxHeight
|
|
50
59
|
}));
|
|
51
60
|
};
|
|
52
61
|
DSControlledLargeTextInput.displayName = "DSControlledLargeTextInput";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSControlledLargeTextInput.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, WeakValidationMap, useRef, useLayoutEffect } from 'react';\nimport {\n describe,\n mergeRefs,\n useValidateTypescriptPropTypes,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useGetXstyledProps,\n} from '@elliemae/ds-utilities';\nimport { propTypes, defaultProps } from './react-desc-prop-types';\nimport { StyledTextArea, StyledContainer } from './styles';\nimport { DSControlledLargetTextInputDatatestids } from './exported-related';\nimport type { DSControlledLargeTextInputT } from './react-desc-prop-types';\n\nconst DSControlledLargeTextInput = (props: DSControlledLargeTextInputT.Props): JSX.Element => {\n useValidateTypescriptPropTypes(props, propTypes);\n\n const propsWithDefault = useMemoMergePropsWithDefault<DSControlledLargeTextInputT.Props>(props, defaultProps);\n\n const { value, onChange, innerRef, resizable, name, id, hasError, maxHeight, ...otherProps } = propsWithDefault;\n\n const { className, ...globalAttributes } = useGetGlobalAttributes(otherProps);\n\n const xstyledProps = useGetXstyledProps(otherProps);\n\n const textareaRef = useRef<HTMLTextAreaElement | null>(null);\n\n const handleOnChange = useCallback(\n (e: React.KeyboardEvent) => onChange((e.target as HTMLInputElement).value, e),\n [onChange],\n );\n\n useLayoutEffect(() => {\n if (
|
|
5
|
-
"mappings": ";AAAA;ACAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA;AACA;AACA;AAGA,MAAM,6BAA6B,CAAC,UAA0D;AAC5F,iCAA+B,OAAO,SAAS;AAE/C,QAAM,mBAAmB,6BAAgE,OAAO,YAAY;AAE5G,QAAM,EAAE,OAAO,UAAU,UAAU,WAAW,MAAM,IAAI,UAAU,cAAc,eAAe;AAE/F,QAAM,EAAE,cAAc,qBAAqB,uBAAuB,UAAU;AAE5E,QAAM,eAAe,mBAAmB,UAAU;AAElD,QAAM,cAAc,OAAmC,IAAI;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, WeakValidationMap, useRef, useState, useLayoutEffect } from 'react';\nimport {\n describe,\n mergeRefs,\n useValidateTypescriptPropTypes,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useGetXstyledProps,\n} from '@elliemae/ds-utilities';\nimport { propTypes, defaultProps } from './react-desc-prop-types';\nimport { StyledTextArea, StyledContainer } from './styles';\nimport { DSControlledLargetTextInputDatatestids } from './exported-related';\nimport type { DSControlledLargeTextInputT } from './react-desc-prop-types';\n\nconst DSControlledLargeTextInput = (props: DSControlledLargeTextInputT.Props): JSX.Element => {\n useValidateTypescriptPropTypes(props, propTypes);\n\n const propsWithDefault = useMemoMergePropsWithDefault<DSControlledLargeTextInputT.Props>(props, defaultProps);\n\n const { value, onChange, innerRef, resizable, name, id, hasError, maxHeight, ...otherProps } = propsWithDefault;\n\n const { className, ...globalAttributes } = useGetGlobalAttributes(otherProps);\n\n const xstyledProps = useGetXstyledProps(otherProps);\n\n const [calculatedMinHeight, setCalculatedMinHeight] = useState(undefined)\n\n const textareaRef = useRef<HTMLTextAreaElement | null>(null);\n const ghostRef = useRef<HTMLTextAreaElement | null>(null);\n\n const handleOnChange = useCallback(\n (e: React.KeyboardEvent) => onChange((e.target as HTMLInputElement).value, e),\n [onChange],\n );\n\n useLayoutEffect(() => {\n if (ghostRef && ghostRef.current && value !== '') {\n ghostRef.current.style.maxHeight = '0px';\n const { scrollHeight } = ghostRef.current;\n if (maxHeight !== undefined && scrollHeight >= maxHeight) setCalculatedMinHeight(`${maxHeight}`);\n else setCalculatedMinHeight(`${scrollHeight}`)\n ghostRef.current.style.maxHeight = `${maxHeight}px`;\n }\n }, [maxHeight, value]);\n\n return (\n <StyledContainer\n className={className}\n data-testid={DSControlledLargetTextInputDatatestids.CONTAINER}\n {...xstyledProps}\n >\n <StyledTextArea\n ref={mergeRefs(innerRef, textareaRef)}\n aria-multiline\n value={value}\n $maxHeight={maxHeight}\n $minHeight={calculatedMinHeight}\n onChange={handleOnChange}\n resizable={resizable}\n name={name}\n id={id}\n data-testid={DSControlledLargetTextInputDatatestids.INPUT}\n $hasError={hasError}\n {...globalAttributes}\n />\n <StyledTextArea\n disabled\n ref={ghostRef}\n value={value}\n style={{ visibility: 'hidden', pointerEvents: 'none', position: 'absolute' }}\n $maxHeight={maxHeight}\n />\n </StyledContainer>\n );\n};\n\nDSControlledLargeTextInput.displayName = 'DSControlledLargeTextInput';\nconst DSControlledLargeTextInputWithSchema = describe(DSControlledLargeTextInput);\nDSControlledLargeTextInputWithSchema.propTypes = propTypes as WeakValidationMap<unknown>;\n\nexport { DSControlledLargeTextInput, DSControlledLargeTextInputWithSchema };\n"],
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA;AACA;AACA;AAGA,MAAM,6BAA6B,CAAC,UAA0D;AAC5F,iCAA+B,OAAO,SAAS;AAE/C,QAAM,mBAAmB,6BAAgE,OAAO,YAAY;AAE5G,QAAM,EAAE,OAAO,UAAU,UAAU,WAAW,MAAM,IAAI,UAAU,cAAc,eAAe;AAE/F,QAAM,EAAE,cAAc,qBAAqB,uBAAuB,UAAU;AAE5E,QAAM,eAAe,mBAAmB,UAAU;AAElD,QAAM,CAAC,qBAAqB,0BAA0B,SAAS,MAAS;AAExE,QAAM,cAAc,OAAmC,IAAI;AAC3D,QAAM,WAAW,OAAmC,IAAI;AAExD,QAAM,iBAAiB,YACrB,CAAC,MAA2B,SAAU,EAAE,OAA4B,OAAO,CAAC,GAC5E,CAAC,QAAQ,CACX;AAEA,kBAAgB,MAAM;AACpB,QAAI,YAAY,SAAS,WAAW,UAAU,IAAI;AAChD,eAAS,QAAQ,MAAM,YAAY;AACnC,YAAM,EAAE,iBAAiB,SAAS;AAClC,UAAI,cAAc,UAAa,gBAAgB;AAAW,+BAAuB,GAAG,WAAW;AAAA;AAC1F,+BAAuB,GAAG,cAAc;AAC7C,eAAS,QAAQ,MAAM,YAAY,GAAG;AAAA,IACxC;AAAA,EACF,GAAG,CAAC,WAAW,KAAK,CAAC;AAErB,SACE,qCAAC;AAAA,IACC;AAAA,IACA,eAAa,uCAAuC;AAAA,IACnD,GAAG;AAAA,KAEJ,qCAAC;AAAA,IACC,KAAK,UAAU,UAAU,WAAW;AAAA,IACpC,kBAAc;AAAA,IACd;AAAA,IACA,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAa,uCAAuC;AAAA,IACpD,WAAW;AAAA,IACV,GAAG;AAAA,GACN,GACA,qCAAC;AAAA,IACC,UAAQ;AAAA,IACR,KAAK;AAAA,IACL;AAAA,IACA,OAAO,EAAE,YAAY,UAAU,eAAe,QAAQ,UAAU,WAAW;AAAA,IAC3E,YAAY;AAAA,GACd,CACF;AAEJ;AAEA,2BAA2B,cAAc;AACzC,MAAM,uCAAuC,SAAS,0BAA0B;AAChF,qCAAqC,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/styles.js
CHANGED
|
@@ -29,6 +29,8 @@ const StyledTextArea = styled("textarea", {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
${({ $maxHeight }) => $maxHeight ? `max-height: ${$maxHeight}px;` : ``}
|
|
32
|
+
${({ $minHeight }) => $minHeight ? `min-height: ${$minHeight}px;` : ``}
|
|
33
|
+
${({ disabled }) => disabled ? `overflow: hidden` : ""}
|
|
32
34
|
${({ $hasError }) => $hasError ? `border: 1px solid red;` : ``}
|
|
33
35
|
`;
|
|
34
36
|
export {
|
package/dist/esm/styles.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/styles.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, layout, space, sizing } from '@elliemae/ds-system';\nimport { DSControlledLargeTextInputName, DSControlledLargeTextInputSlots } from './exported-related';\n\ninterface StyledTextAreaT {\n resizable: boolean;\n hasError: boolean;\n}\n\nexport const StyledContainer = styled('div', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.CONTAINER,\n})`\n display: grid;\n grid-gap: 4px;\n grid-template-rows: auto auto;\n grid-template-columns: fit-content;\n ${layout}\n ${space}\n ${sizing}\n`;\n\nexport const StyledTextArea = styled('textarea', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.INPUT,\n})<StyledTextAreaT>`\n &:hover { \n border: 1px solid ${({theme}) => theme.colors.brand[700]};\n }\n width: 100%;\n ${({ resizable }) => (resizable ? `` : `resize: none;`)}\n &:disabled {\n &:hover {\n cursor: not-allowed;\n }\n }\n ${({ $maxHeight }) => ($maxHeight ? `max-height: ${$maxHeight}px;` : ``)}\n ${({ $hasError }) => ($hasError ? `border: 1px solid red;` : ``)}\n`;\n"],
|
|
5
|
-
"mappings": ";AAAA;ACAA;AACA;AAOO,MAAM,kBAAkB,OAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,gCAAgC;AACxC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAKG;AAAA,IACA;AAAA,IACA;AAAA;AAGG,MAAM,iBAAiB,OAAO,YAAY;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,gCAAgC;AACxC,CAAC;AAAA;AAAA,wBAEuB,CAAC,EAAC,YAAW,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA,IAGpD,CAAC,EAAE,gBAAiB,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMrC,CAAC,EAAE,iBAAkB,aAAa,eAAe,kBAAkB;AAAA,IACnE,CAAC,EAAE,gBAAiB,YAAY,2BAA2B;AAAA;",
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, layout, space, sizing } from '@elliemae/ds-system';\nimport { DSControlledLargeTextInputName, DSControlledLargeTextInputSlots } from './exported-related';\n\ninterface StyledTextAreaT {\n resizable: boolean;\n hasError: boolean;\n}\n\nexport const StyledContainer = styled('div', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.CONTAINER,\n})`\n display: grid;\n grid-gap: 4px;\n grid-template-rows: auto auto;\n grid-template-columns: fit-content;\n ${layout}\n ${space}\n ${sizing}\n`;\n\nexport const StyledTextArea = styled('textarea', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.INPUT,\n})<StyledTextAreaT>`\n &:hover { \n border: 1px solid ${({theme}) => theme.colors.brand[700]};\n }\n width: 100%;\n ${({ resizable }) => (resizable ? `` : `resize: none;`)}\n &:disabled {\n &:hover {\n cursor: not-allowed;\n }\n }\n ${({ $maxHeight }) => ($maxHeight ? `max-height: ${$maxHeight}px;` : ``)}\n ${({ $minHeight }) => ($minHeight ? `min-height: ${$minHeight}px;` : ``)}\n ${({ disabled }) => (disabled ? `overflow: hidden` : '')}\n ${({ $hasError }) => ($hasError ? `border: 1px solid red;` : ``)}\n`;\n"],
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AAOO,MAAM,kBAAkB,OAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,gCAAgC;AACxC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAKG;AAAA,IACA;AAAA,IACA;AAAA;AAGG,MAAM,iBAAiB,OAAO,YAAY;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,gCAAgC;AACxC,CAAC;AAAA;AAAA,wBAEuB,CAAC,EAAC,YAAW,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA,IAGpD,CAAC,EAAE,gBAAiB,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMrC,CAAC,EAAE,iBAAkB,aAAa,eAAe,kBAAkB;AAAA,IACnE,CAAC,EAAE,iBAAkB,aAAa,eAAe,kBAAkB;AAAA,IACnE,CAAC,EAAE,eAAgB,WAAW,qBAAqB;AAAA,IACnD,CAAC,EAAE,gBAAiB,YAAY,2BAA2B;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-form-input-textarea",
|
|
3
|
-
"version": "3.3.0-rc.
|
|
3
|
+
"version": "3.3.0-rc.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Controlled Form Input Textarea",
|
|
6
6
|
"files": [
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"indent": 4
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@elliemae/ds-system": "3.3.0-rc.
|
|
39
|
-
"@elliemae/ds-utilities": "3.3.0-rc.
|
|
38
|
+
"@elliemae/ds-system": "3.3.0-rc.3",
|
|
39
|
+
"@elliemae/ds-utilities": "3.3.0-rc.3",
|
|
40
40
|
"@xstyled/styled-components": "~3.6.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|