@elliemae/ds-form-input-textarea 3.6.0-rc.6 → 3.7.0-rc.1
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 +14 -12
- package/dist/cjs/DSControlledLargeTextInput.js.map +2 -2
- package/dist/cjs/styles.js +26 -5
- package/dist/cjs/styles.js.map +2 -2
- package/dist/esm/DSControlledLargeTextInput.js +15 -13
- package/dist/esm/DSControlledLargeTextInput.js.map +2 -2
- package/dist/esm/styles.js +26 -5
- package/dist/esm/styles.js.map +2 -2
- package/package.json +3 -3
|
@@ -64,19 +64,21 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
64
64
|
"data-testid": import_exported_related.DSControlledLargetTextInputDatatestids.CONTAINER,
|
|
65
65
|
...xstyledProps,
|
|
66
66
|
children: [
|
|
67
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.
|
|
68
|
-
ref: (0, import_ds_utilities.mergeRefs)(innerRef, textareaRef),
|
|
69
|
-
"aria-multiline": true,
|
|
70
|
-
value,
|
|
71
|
-
$maxHeight: maxHeight,
|
|
72
|
-
$minHeight: calculatedMinHeight,
|
|
73
|
-
onChange: handleOnChange,
|
|
74
|
-
resizable,
|
|
75
|
-
name,
|
|
76
|
-
id,
|
|
77
|
-
"data-testid": import_exported_related.DSControlledLargetTextInputDatatestids.INPUT,
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.WrapperBorder, {
|
|
78
68
|
$hasError: hasError,
|
|
79
|
-
|
|
69
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTextArea, {
|
|
70
|
+
ref: (0, import_ds_utilities.mergeRefs)(innerRef, textareaRef),
|
|
71
|
+
"aria-multiline": true,
|
|
72
|
+
value,
|
|
73
|
+
$maxHeight: maxHeight,
|
|
74
|
+
$minHeight: calculatedMinHeight,
|
|
75
|
+
onChange: handleOnChange,
|
|
76
|
+
resizable,
|
|
77
|
+
name,
|
|
78
|
+
id,
|
|
79
|
+
"data-testid": import_exported_related.DSControlledLargetTextInputDatatestids.INPUT,
|
|
80
|
+
...globalAttributes
|
|
81
|
+
})
|
|
80
82
|
}),
|
|
81
83
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTextArea, {
|
|
82
84
|
disabled: true,
|
|
@@ -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, 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}`)
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAAyF;AACzF,0BAOO;AACP,mCAAwC;AACxC,
|
|
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, WrapperBorder } 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 <WrapperBorder $hasError={hasError}>\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 {...globalAttributes}\n />\n </WrapperBorder>\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;AAAA,mBAAyF;AACzF,0BAOO;AACP,mCAAwC;AACxC,oBAA+D;AAC/D,8BAAuD;AAGvD,MAAM,6BAA6B,CAAC,UAA0D;AAC5F,0DAA+B,OAAO,sCAAS;AAE/C,QAAM,uBAAmB,kDAAgE,OAAO,yCAAY;AAE5G,QAAM,EAAE,OAAO,UAAU,UAAU,WAAW,MAAM,IAAI,UAAU,cAAc,WAAW,IAAI;AAE/F,QAAM,EAAE,cAAc,iBAAiB,QAAI,4CAAuB,UAAU;AAE5E,QAAM,mBAAe,wCAAmB,UAAU;AAElD,QAAM,CAAC,qBAAqB,sBAAsB,QAAI,uBAAS,MAAS;AAExE,QAAM,kBAAc,qBAAmC,IAAI;AAC3D,QAAM,eAAW,qBAAmC,IAAI;AAExD,QAAM,qBAAiB;AAAA,IACrB,CAAC,MAA2B,SAAU,EAAE,OAA4B,OAAO,CAAC;AAAA,IAC5E,CAAC,QAAQ;AAAA,EACX;AAEA,oCAAgB,MAAM;AACpB,QAAI,YAAY,SAAS,WAAW,UAAU,IAAI;AAChD,eAAS,QAAQ,MAAM,YAAY;AACnC,YAAM,EAAE,aAAa,IAAI,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,6CAAC;AAAA,IACC;AAAA,IACA,eAAa,+DAAuC;AAAA,IACnD,GAAG;AAAA,IAEJ;AAAA,kDAAC;AAAA,QAAc,WAAW;AAAA,QACxB,sDAAC;AAAA,UACC,SAAK,+BAAU,UAAU,WAAW;AAAA,UACpC,kBAAc;AAAA,UACd;AAAA,UACA,YAAY;AAAA,UACZ,YAAY;AAAA,UACZ,UAAU;AAAA,UACV;AAAA,UACA;AAAA,UACA;AAAA,UACA,eAAa,+DAAuC;AAAA,UACnD,GAAG;AAAA,SACN;AAAA,OACF;AAAA,MACA,4CAAC;AAAA,QACC,UAAQ;AAAA,QACR,KAAK;AAAA,QACL;AAAA,QACA,OAAO,EAAE,YAAY,UAAU,eAAe,QAAQ,UAAU,WAAW;AAAA,QAC3E,YAAY;AAAA,OACd;AAAA;AAAA,GACF;AAEJ;AAEA,2BAA2B,cAAc;AACzC,MAAM,2CAAuC,8BAAS,0BAA0B;AAChF,qCAAqC,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/styles.js
CHANGED
|
@@ -25,7 +25,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
25
25
|
var styles_exports = {};
|
|
26
26
|
__export(styles_exports, {
|
|
27
27
|
StyledContainer: () => StyledContainer,
|
|
28
|
-
StyledTextArea: () => StyledTextArea
|
|
28
|
+
StyledTextArea: () => StyledTextArea,
|
|
29
|
+
WrapperBorder: () => WrapperBorder
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(styles_exports);
|
|
31
32
|
var React = __toESM(require("react"));
|
|
@@ -43,14 +44,35 @@ const StyledContainer = (0, import_ds_system.styled)("div", {
|
|
|
43
44
|
${import_ds_system.space}
|
|
44
45
|
${import_ds_system.sizing}
|
|
45
46
|
`;
|
|
47
|
+
const WrapperBorder = (0, import_ds_system.styled)("div")`
|
|
48
|
+
&:hover::after,
|
|
49
|
+
&:focus::after {
|
|
50
|
+
content: " ";
|
|
51
|
+
position: absolute;
|
|
52
|
+
inset: 0px;
|
|
53
|
+
border: 2px solid brand-700;
|
|
54
|
+
border-radius: inherit;
|
|
55
|
+
pointer-events: none;
|
|
56
|
+
z-index: 1;
|
|
57
|
+
}
|
|
58
|
+
&:hover,
|
|
59
|
+
&:focus {
|
|
60
|
+
border-color: transparent;
|
|
61
|
+
}
|
|
62
|
+
border: 1px solid black;
|
|
63
|
+
border-radius: 2px;
|
|
64
|
+
position: relative;
|
|
65
|
+
box-sizing: content-box;
|
|
66
|
+
${({ $hasError }) => $hasError ? `border: 2px solid red;` : ``}
|
|
67
|
+
`;
|
|
46
68
|
const StyledTextArea = (0, import_ds_system.styled)("textarea", {
|
|
47
69
|
name: import_exported_related.DSControlledLargeTextInputName,
|
|
48
70
|
slot: import_exported_related.DSControlledLargeTextInputSlots.INPUT
|
|
49
71
|
})`
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
72
|
+
line-height: 1;
|
|
73
|
+
outline: none;
|
|
53
74
|
width: 100%;
|
|
75
|
+
border: none;
|
|
54
76
|
${({ resizable }) => resizable ? `` : `resize: none;`}
|
|
55
77
|
&:disabled {
|
|
56
78
|
&:hover {
|
|
@@ -60,6 +82,5 @@ const StyledTextArea = (0, import_ds_system.styled)("textarea", {
|
|
|
60
82
|
${({ $maxHeight }) => $maxHeight ? `max-height: ${$maxHeight}px;` : ``}
|
|
61
83
|
${({ $minHeight }) => $minHeight ? `min-height: ${$minHeight}px;` : ``}
|
|
62
84
|
${({ disabled }) => disabled ? `overflow: hidden` : ""}
|
|
63
|
-
${({ $hasError }) => $hasError ? `border: 1px solid red;` : ``}
|
|
64
85
|
`;
|
|
65
86
|
//# 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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA8C;AAC9C,8BAAgF;AAOzE,MAAM,sBAAkB,yBAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,wDAAgC;AACxC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAKG;AAAA,IACA;AAAA,IACA;AAAA;AAGG,MAAM,qBAAiB,yBAAO,YAAY;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,wDAAgC;AACxC,CAAC;AAAA;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 WrapperBorder = styled('div')`\n &:hover::after,\n &:focus::after {\n content: \" \";\n position: absolute;\n inset: 0px;\n border: 2px solid brand-700;\n border-radius: inherit;\n pointer-events: none;\n z-index: 1;\n }\n &:hover,\n &:focus {\n border-color: transparent;\n }\n border: 1px solid black;\n border-radius: 2px;\n position: relative;\n box-sizing: content-box;\n ${({ $hasError }) => ($hasError ? `border: 2px solid red;` : ``)}\n`;\n\nexport const StyledTextArea = styled('textarea', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.INPUT,\n})<StyledTextAreaT>`\n line-height: 1;\n outline: none;\n width: 100%;\n border: none;\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`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA8C;AAC9C,8BAAgF;AAOzE,MAAM,sBAAkB,yBAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,wDAAgC;AACxC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAKG;AAAA,IACA;AAAA,IACA;AAAA;AAGG,MAAM,oBAAgB,yBAAO,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAmBrC,CAAC,EAAE,UAAU,MAAO,YAAY,2BAA2B;AAAA;AAGxD,MAAM,qBAAiB,yBAAO,YAAY;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,wDAAgC;AACxC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAKG,CAAC,EAAE,UAAU,MAAO,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMrC,CAAC,EAAE,WAAW,MAAO,aAAa,eAAe,kBAAkB;AAAA,IACnE,CAAC,EAAE,WAAW,MAAO,aAAa,eAAe,kBAAkB;AAAA,IACnE,CAAC,EAAE,SAAS,MAAO,WAAW,qBAAqB;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useGetXstyledProps
|
|
11
11
|
} from "@elliemae/ds-utilities";
|
|
12
12
|
import { propTypes, defaultProps } from "./react-desc-prop-types";
|
|
13
|
-
import { StyledTextArea, StyledContainer } from "./styles";
|
|
13
|
+
import { StyledTextArea, StyledContainer, WrapperBorder } from "./styles";
|
|
14
14
|
import { DSControlledLargetTextInputDatatestids } from "./exported-related";
|
|
15
15
|
const DSControlledLargeTextInput = (props) => {
|
|
16
16
|
useValidateTypescriptPropTypes(props, propTypes);
|
|
@@ -41,19 +41,21 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
41
41
|
"data-testid": DSControlledLargetTextInputDatatestids.CONTAINER,
|
|
42
42
|
...xstyledProps,
|
|
43
43
|
children: [
|
|
44
|
-
/* @__PURE__ */ jsx(
|
|
45
|
-
ref: mergeRefs(innerRef, textareaRef),
|
|
46
|
-
"aria-multiline": true,
|
|
47
|
-
value,
|
|
48
|
-
$maxHeight: maxHeight,
|
|
49
|
-
$minHeight: calculatedMinHeight,
|
|
50
|
-
onChange: handleOnChange,
|
|
51
|
-
resizable,
|
|
52
|
-
name,
|
|
53
|
-
id,
|
|
54
|
-
"data-testid": DSControlledLargetTextInputDatatestids.INPUT,
|
|
44
|
+
/* @__PURE__ */ jsx(WrapperBorder, {
|
|
55
45
|
$hasError: hasError,
|
|
56
|
-
|
|
46
|
+
children: /* @__PURE__ */ jsx(StyledTextArea, {
|
|
47
|
+
ref: mergeRefs(innerRef, textareaRef),
|
|
48
|
+
"aria-multiline": true,
|
|
49
|
+
value,
|
|
50
|
+
$maxHeight: maxHeight,
|
|
51
|
+
$minHeight: calculatedMinHeight,
|
|
52
|
+
onChange: handleOnChange,
|
|
53
|
+
resizable,
|
|
54
|
+
name,
|
|
55
|
+
id,
|
|
56
|
+
"data-testid": DSControlledLargetTextInputDatatestids.INPUT,
|
|
57
|
+
...globalAttributes
|
|
58
|
+
})
|
|
57
59
|
}),
|
|
58
60
|
/* @__PURE__ */ jsx(StyledTextArea, {
|
|
59
61
|
disabled: true,
|
|
@@ -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, 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}`)
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,aAAgC,QAAQ,UAAU,uBAAuB;AACzF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW,oBAAoB;AACxC,SAAS,gBAAgB,
|
|
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, WrapperBorder } 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 <WrapperBorder $hasError={hasError}>\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 {...globalAttributes}\n />\n </WrapperBorder>\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,YAAY,WAAW;ACAvB;AAAA,SAAgB,aAAgC,QAAQ,UAAU,uBAAuB;AACzF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW,oBAAoB;AACxC,SAAS,gBAAgB,iBAAiB,qBAAqB;AAC/D,SAAS,8CAA8C;AAGvD,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,WAAW,IAAI;AAE/F,QAAM,EAAE,cAAc,iBAAiB,IAAI,uBAAuB,UAAU;AAE5E,QAAM,eAAe,mBAAmB,UAAU;AAElD,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAAS,MAAS;AAExE,QAAM,cAAc,OAAmC,IAAI;AAC3D,QAAM,WAAW,OAAmC,IAAI;AAExD,QAAM,iBAAiB;AAAA,IACrB,CAAC,MAA2B,SAAU,EAAE,OAA4B,OAAO,CAAC;AAAA,IAC5E,CAAC,QAAQ;AAAA,EACX;AAEA,kBAAgB,MAAM;AACpB,QAAI,YAAY,SAAS,WAAW,UAAU,IAAI;AAChD,eAAS,QAAQ,MAAM,YAAY;AACnC,YAAM,EAAE,aAAa,IAAI,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,qBAAC;AAAA,IACC;AAAA,IACA,eAAa,uCAAuC;AAAA,IACnD,GAAG;AAAA,IAEJ;AAAA,0BAAC;AAAA,QAAc,WAAW;AAAA,QACxB,8BAAC;AAAA,UACC,KAAK,UAAU,UAAU,WAAW;AAAA,UACpC,kBAAc;AAAA,UACd;AAAA,UACA,YAAY;AAAA,UACZ,YAAY;AAAA,UACZ,UAAU;AAAA,UACV;AAAA,UACA;AAAA,UACA;AAAA,UACA,eAAa,uCAAuC;AAAA,UACnD,GAAG;AAAA,SACN;AAAA,OACF;AAAA,MACA,oBAAC;AAAA,QACC,UAAQ;AAAA,QACR,KAAK;AAAA,QACL;AAAA,QACA,OAAO,EAAE,YAAY,UAAU,eAAe,QAAQ,UAAU,WAAW;AAAA,QAC3E,YAAY;AAAA,OACd;AAAA;AAAA,GACF;AAEJ;AAEA,2BAA2B,cAAc;AACzC,MAAM,uCAAuC,SAAS,0BAA0B;AAChF,qCAAqC,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/styles.js
CHANGED
|
@@ -13,14 +13,35 @@ const StyledContainer = styled("div", {
|
|
|
13
13
|
${space}
|
|
14
14
|
${sizing}
|
|
15
15
|
`;
|
|
16
|
+
const WrapperBorder = styled("div")`
|
|
17
|
+
&:hover::after,
|
|
18
|
+
&:focus::after {
|
|
19
|
+
content: " ";
|
|
20
|
+
position: absolute;
|
|
21
|
+
inset: 0px;
|
|
22
|
+
border: 2px solid brand-700;
|
|
23
|
+
border-radius: inherit;
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
z-index: 1;
|
|
26
|
+
}
|
|
27
|
+
&:hover,
|
|
28
|
+
&:focus {
|
|
29
|
+
border-color: transparent;
|
|
30
|
+
}
|
|
31
|
+
border: 1px solid black;
|
|
32
|
+
border-radius: 2px;
|
|
33
|
+
position: relative;
|
|
34
|
+
box-sizing: content-box;
|
|
35
|
+
${({ $hasError }) => $hasError ? `border: 2px solid red;` : ``}
|
|
36
|
+
`;
|
|
16
37
|
const StyledTextArea = styled("textarea", {
|
|
17
38
|
name: DSControlledLargeTextInputName,
|
|
18
39
|
slot: DSControlledLargeTextInputSlots.INPUT
|
|
19
40
|
})`
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
41
|
+
line-height: 1;
|
|
42
|
+
outline: none;
|
|
23
43
|
width: 100%;
|
|
44
|
+
border: none;
|
|
24
45
|
${({ resizable }) => resizable ? `` : `resize: none;`}
|
|
25
46
|
&:disabled {
|
|
26
47
|
&:hover {
|
|
@@ -30,10 +51,10 @@ const StyledTextArea = styled("textarea", {
|
|
|
30
51
|
${({ $maxHeight }) => $maxHeight ? `max-height: ${$maxHeight}px;` : ``}
|
|
31
52
|
${({ $minHeight }) => $minHeight ? `min-height: ${$minHeight}px;` : ``}
|
|
32
53
|
${({ disabled }) => disabled ? `overflow: hidden` : ""}
|
|
33
|
-
${({ $hasError }) => $hasError ? `border: 1px solid red;` : ``}
|
|
34
54
|
`;
|
|
35
55
|
export {
|
|
36
56
|
StyledContainer,
|
|
37
|
-
StyledTextArea
|
|
57
|
+
StyledTextArea,
|
|
58
|
+
WrapperBorder
|
|
38
59
|
};
|
|
39
60
|
//# sourceMappingURL=styles.js.map
|
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
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,QAAQ,OAAO,cAAc;AAC9C,SAAS,gCAAgC,uCAAuC;AAOzE,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
|
|
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 WrapperBorder = styled('div')`\n &:hover::after,\n &:focus::after {\n content: \" \";\n position: absolute;\n inset: 0px;\n border: 2px solid brand-700;\n border-radius: inherit;\n pointer-events: none;\n z-index: 1;\n }\n &:hover,\n &:focus {\n border-color: transparent;\n }\n border: 1px solid black;\n border-radius: 2px;\n position: relative;\n box-sizing: content-box;\n ${({ $hasError }) => ($hasError ? `border: 2px solid red;` : ``)}\n`;\n\nexport const StyledTextArea = styled('textarea', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.INPUT,\n})<StyledTextAreaT>`\n line-height: 1;\n outline: none;\n width: 100%;\n border: none;\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`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,QAAQ,OAAO,cAAc;AAC9C,SAAS,gCAAgC,uCAAuC;AAOzE,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,gBAAgB,OAAO,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAmBrC,CAAC,EAAE,UAAU,MAAO,YAAY,2BAA2B;AAAA;AAGxD,MAAM,iBAAiB,OAAO,YAAY;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,gCAAgC;AACxC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAKG,CAAC,EAAE,UAAU,MAAO,YAAY,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMrC,CAAC,EAAE,WAAW,MAAO,aAAa,eAAe,kBAAkB;AAAA,IACnE,CAAC,EAAE,WAAW,MAAO,aAAa,eAAe,kBAAkB;AAAA,IACnE,CAAC,EAAE,SAAS,MAAO,WAAW,qBAAqB;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
|
+
"version": "3.7.0-rc.1",
|
|
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.
|
|
39
|
-
"@elliemae/ds-utilities": "3.
|
|
38
|
+
"@elliemae/ds-system": "3.7.0-rc.1",
|
|
39
|
+
"@elliemae/ds-utilities": "3.7.0-rc.1",
|
|
40
40
|
"@xstyled/styled-components": "~3.6.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|