@elliemae/ds-form-input-textarea 3.60.0-next.48 → 3.60.0-next.49
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 +9 -5
- 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 +9 -5
- package/dist/esm/DSControlledLargeTextInput.js.map +2 -2
- package/dist/esm/styles.js +2 -0
- package/dist/esm/styles.js.map +2 -2
- package/dist/types/styles.d.ts +1 -0
- package/package.json +5 -5
|
@@ -47,8 +47,10 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
47
47
|
const { value, onChange, readOnly, innerRef, name, id, hasError, maxHeight, applyAriaDisabled, ...otherProps } = propsWithDefault;
|
|
48
48
|
const { className, rows, value: discardedVal, ...globalAttributes } = (0, import_ds_props_helpers.useGetGlobalAttributes)(otherProps);
|
|
49
49
|
const xstyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(otherProps);
|
|
50
|
+
const baseRows = rows ?? 2;
|
|
50
51
|
const [calculatedMinHeight, setCalculatedMinHeight] = (0, import_react.useState)();
|
|
51
52
|
const [scrollBarWidth, setScrollBarWidth] = (0, import_react.useState)(0);
|
|
53
|
+
const [hasVerticalOverflow, setHasVerticalOverflow] = (0, import_react.useState)(false);
|
|
52
54
|
const textareaRef = (0, import_react.useRef)(null);
|
|
53
55
|
const ghostRef = (0, import_react.useRef)(null);
|
|
54
56
|
const handleOnChange = (0, import_react.useCallback)(
|
|
@@ -60,16 +62,17 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
60
62
|
);
|
|
61
63
|
(0, import_react.useEffect)(() => {
|
|
62
64
|
if (textareaRef && textareaRef.current) {
|
|
63
|
-
const { offsetWidth, clientWidth } = textareaRef.current;
|
|
65
|
+
const { offsetWidth, clientWidth, scrollHeight, clientHeight } = textareaRef.current;
|
|
64
66
|
setScrollBarWidth(offsetWidth - clientWidth);
|
|
67
|
+
setHasVerticalOverflow(scrollHeight > clientHeight);
|
|
65
68
|
}
|
|
66
|
-
}, [value]);
|
|
69
|
+
}, [value, calculatedMinHeight]);
|
|
67
70
|
(0, import_react.useLayoutEffect)(() => {
|
|
68
71
|
if (ghostRef && ghostRef.current) {
|
|
69
72
|
const { offsetHeight, scrollHeight } = ghostRef.current;
|
|
70
73
|
if (rows !== void 0) setCalculatedMinHeight(offsetHeight);
|
|
71
74
|
else if (maxHeight !== void 0 && scrollHeight >= maxHeight) setCalculatedMinHeight(maxHeight);
|
|
72
|
-
else setCalculatedMinHeight(scrollHeight);
|
|
75
|
+
else setCalculatedMinHeight(Math.max(scrollHeight, offsetHeight));
|
|
73
76
|
}
|
|
74
77
|
}, [maxHeight, value, rows]);
|
|
75
78
|
const referenceSetter = (0, import_react.useMemo)(() => (0, import_ds_system.mergeRefs)(textareaRef, innerRef), [innerRef]);
|
|
@@ -90,11 +93,12 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
90
93
|
"aria-multiline": true,
|
|
91
94
|
$maxHeight: maxHeight,
|
|
92
95
|
$minHeight: calculatedMinHeight,
|
|
96
|
+
$hasVerticalOverflow: hasVerticalOverflow,
|
|
93
97
|
onChange: handleOnChange,
|
|
94
98
|
name,
|
|
95
99
|
id,
|
|
96
100
|
"data-testid": import_exported_related.DSControlledLargetTextInputDatatestids.INPUT,
|
|
97
|
-
rows,
|
|
101
|
+
rows: baseRows,
|
|
98
102
|
"aria-describedby": id !== void 0 ? `${id}_feedback_message ${id}_error_message ${id}_remaining_characters` : void 0,
|
|
99
103
|
"aria-invalid": hasError,
|
|
100
104
|
"aria-disabled": applyAriaDisabled,
|
|
@@ -114,7 +118,7 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
114
118
|
innerRef: ghostRef,
|
|
115
119
|
value,
|
|
116
120
|
$maxHeight: maxHeight,
|
|
117
|
-
rows,
|
|
121
|
+
rows: baseRows,
|
|
118
122
|
style: {
|
|
119
123
|
visibility: "hidden",
|
|
120
124
|
pointerEvents: "none",
|
|
@@ -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, useMemo, useRef, useState, useLayoutEffect, useEffect } from 'react';\nimport {\n describe,\n useValidateTypescriptPropTypes,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useGetXstyledProps,\n type ValidationMap,\n useOwnerProps,\n} from '@elliemae/ds-props-helpers';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { propTypes, defaultProps } from './react-desc-prop-types.js';\nimport { StyledTextArea, StyledContainer, WrapperBorder } from './styles.js';\nimport { DSControlledLargeTextInputName, DSControlledLargetTextInputDatatestids } from './exported-related/index.js';\nimport type { DSControlledLargeTextInputT } from './react-desc-prop-types.js';\n\nconst DSControlledLargeTextInput = (props: DSControlledLargeTextInputT.Props): JSX.Element => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSControlledLargeTextInputT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, propTypes, DSControlledLargeTextInputName);\n\n const ownerPropsConfig = useOwnerProps(propsWithDefault, { ...props });\n\n const { value, onChange, readOnly, innerRef, name, id, hasError, maxHeight, applyAriaDisabled, ...otherProps } =\n propsWithDefault;\n\n const { className, rows, value: discardedVal, ...globalAttributes } = useGetGlobalAttributes(otherProps);\n\n const xstyledProps = useGetXstyledProps(otherProps);\n\n const [calculatedMinHeight, setCalculatedMinHeight] = useState<number>();\n const [scrollBarWidth, setScrollBarWidth] = useState<number>(0);\n\n const textareaRef = useRef<HTMLTextAreaElement | null>(null);\n const ghostRef = useRef<HTMLTextAreaElement | null>(null);\n\n const handleOnChange = useCallback<React.KeyboardEventHandler<HTMLTextAreaElement>>(\n (e) => {\n if (applyAriaDisabled) return;\n onChange(e.currentTarget.value, e);\n },\n [onChange, applyAriaDisabled],\n );\n\n useEffect(() => {\n if (textareaRef && textareaRef.current) {\n const { offsetWidth, clientWidth } = textareaRef.current;\n setScrollBarWidth(offsetWidth - clientWidth);\n }\n }, [value]);\n\n useLayoutEffect(() => {\n if (ghostRef && ghostRef.current) {\n const { offsetHeight, scrollHeight } = ghostRef.current;\n if (rows !== undefined) setCalculatedMinHeight(offsetHeight);\n else if (maxHeight !== undefined && scrollHeight >= maxHeight) setCalculatedMinHeight(maxHeight);\n else setCalculatedMinHeight(scrollHeight);\n }\n }, [maxHeight, value, rows]);\n\n const referenceSetter = useMemo(() => mergeRefs(textareaRef, innerRef), [innerRef]);\n\n return (\n <StyledContainer\n className={className}\n data-testid={DSControlledLargetTextInputDatatestids.CONTAINER}\n $isDisabled={otherProps.disabled}\n applyAriaDisabled={applyAriaDisabled || readOnly}\n {...xstyledProps}\n {...ownerPropsConfig}\n >\n <WrapperBorder $hasError={hasError} $isDisabled={otherProps.disabled} $isReadOnly={applyAriaDisabled || readOnly}>\n <StyledTextArea\n innerRef={referenceSetter}\n aria-multiline\n $maxHeight={maxHeight}\n $minHeight={calculatedMinHeight}\n onChange={handleOnChange}\n name={name}\n id={id}\n data-testid={DSControlledLargetTextInputDatatestids.INPUT}\n rows={
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useMemo, useRef, useState, useLayoutEffect, useEffect } from 'react';\nimport {\n describe,\n useValidateTypescriptPropTypes,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useGetXstyledProps,\n type ValidationMap,\n useOwnerProps,\n} from '@elliemae/ds-props-helpers';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { propTypes, defaultProps } from './react-desc-prop-types.js';\nimport { StyledTextArea, StyledContainer, WrapperBorder } from './styles.js';\nimport { DSControlledLargeTextInputName, DSControlledLargetTextInputDatatestids } from './exported-related/index.js';\nimport type { DSControlledLargeTextInputT } from './react-desc-prop-types.js';\n\nconst DSControlledLargeTextInput = (props: DSControlledLargeTextInputT.Props): JSX.Element => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSControlledLargeTextInputT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, propTypes, DSControlledLargeTextInputName);\n\n const ownerPropsConfig = useOwnerProps(propsWithDefault, { ...props });\n\n const { value, onChange, readOnly, innerRef, name, id, hasError, maxHeight, applyAriaDisabled, ...otherProps } =\n propsWithDefault;\n\n const { className, rows, value: discardedVal, ...globalAttributes } = useGetGlobalAttributes(otherProps);\n\n const xstyledProps = useGetXstyledProps(otherProps);\n const baseRows = rows ?? 2;\n\n const [calculatedMinHeight, setCalculatedMinHeight] = useState<number>();\n const [scrollBarWidth, setScrollBarWidth] = useState<number>(0);\n const [hasVerticalOverflow, setHasVerticalOverflow] = useState(false);\n\n const textareaRef = useRef<HTMLTextAreaElement | null>(null);\n const ghostRef = useRef<HTMLTextAreaElement | null>(null);\n\n const handleOnChange = useCallback<React.KeyboardEventHandler<HTMLTextAreaElement>>(\n (e) => {\n if (applyAriaDisabled) return;\n onChange(e.currentTarget.value, e);\n },\n [onChange, applyAriaDisabled],\n );\n\n useEffect(() => {\n if (textareaRef && textareaRef.current) {\n const { offsetWidth, clientWidth, scrollHeight, clientHeight } = textareaRef.current;\n setScrollBarWidth(offsetWidth - clientWidth);\n setHasVerticalOverflow(scrollHeight > clientHeight);\n }\n }, [value, calculatedMinHeight]);\n\n useLayoutEffect(() => {\n if (ghostRef && ghostRef.current) {\n const { offsetHeight, scrollHeight } = ghostRef.current;\n if (rows !== undefined) setCalculatedMinHeight(offsetHeight);\n else if (maxHeight !== undefined && scrollHeight >= maxHeight) setCalculatedMinHeight(maxHeight);\n else setCalculatedMinHeight(Math.max(scrollHeight, offsetHeight));\n }\n }, [maxHeight, value, rows]);\n\n const referenceSetter = useMemo(() => mergeRefs(textareaRef, innerRef), [innerRef]);\n\n return (\n <StyledContainer\n className={className}\n data-testid={DSControlledLargetTextInputDatatestids.CONTAINER}\n $isDisabled={otherProps.disabled}\n applyAriaDisabled={applyAriaDisabled || readOnly}\n {...xstyledProps}\n {...ownerPropsConfig}\n >\n <WrapperBorder $hasError={hasError} $isDisabled={otherProps.disabled} $isReadOnly={applyAriaDisabled || readOnly}>\n <StyledTextArea\n innerRef={referenceSetter}\n aria-multiline\n $maxHeight={maxHeight}\n $minHeight={calculatedMinHeight}\n $hasVerticalOverflow={hasVerticalOverflow}\n onChange={handleOnChange}\n name={name}\n id={id}\n data-testid={DSControlledLargetTextInputDatatestids.INPUT}\n rows={baseRows}\n aria-describedby={\n id !== undefined ? `${id}_feedback_message ${id}_error_message ${id}_remaining_characters` : undefined\n }\n aria-invalid={hasError}\n aria-disabled={applyAriaDisabled}\n {...globalAttributes}\n // PUI-17313 - value === undefined && applyAriaDisabled === true -> user can still type.\n // the following looks stupid. But the thing is, we are not validating that user never provides undefined.\n // when user provides undefined, merging keeps undefined, react enters in \"uncontrolled\" mode\n // when in uncontrolled mode, we can't prevent react from changing the dom value directly\n // which means \"if applyAriaDisabled never change the input\" constraint can't be enforced by us\n // to accomplish all that, we have to specifically make react behave still in controlled mode by providing ''\n // we had a team discussion, while this is mostly tech-debt, it would potentially be a breaking change to fix this to always default to ''\n // scenarios where user provides undefined and expect uncontrolled behavior might exist (without applyAriaDisabled)\n // as such, we only specifically fix the case that would cause a bug (applyAriaDisabled = true && value = undefined)\n value={value === undefined && applyAriaDisabled ? '' : value}\n readOnly={readOnly}\n aria-readonly={readOnly}\n {...ownerPropsConfig}\n />\n </WrapperBorder>\n <StyledTextArea\n disabled\n aria-label=\"ghost textarea\"\n data-testid=\"\"\n innerRef={ghostRef}\n value={value}\n $maxHeight={maxHeight}\n rows={baseRows}\n style={{\n visibility: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n paddingLeft: '9px',\n paddingRight: `${9 + scrollBarWidth}px`,\n overflow: 'hidden',\n }}\n />\n </StyledContainer>\n );\n};\n\nDSControlledLargeTextInput.displayName = 'DSControlledLargeTextInput';\nconst DSControlledLargeTextInputWithSchema = describe(DSControlledLargeTextInput);\nDSControlledLargeTextInputWithSchema.propTypes = propTypes as ValidationMap<unknown>;\nexport { DSControlledLargeTextInput, DSControlledLargeTextInputWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiEnB;AAjEJ,mBAA0F;AAC1F,8BAQO;AACP,uBAA0B;AAC1B,mCAAwC;AACxC,oBAA+D;AAC/D,8BAAuF;AAGvF,MAAM,6BAA6B,CAAC,UAA0D;AAC5F,QAAM,uBAAmB,sDAAwE,OAAO,yCAAY;AACpH,8DAA+B,kBAAkB,wCAAW,sDAA8B;AAE1F,QAAM,uBAAmB,uCAAc,kBAAkB,EAAE,GAAG,MAAM,CAAC;AAErE,QAAM,EAAE,OAAO,UAAU,UAAU,UAAU,MAAM,IAAI,UAAU,WAAW,mBAAmB,GAAG,WAAW,IAC3G;AAEF,QAAM,EAAE,WAAW,MAAM,OAAO,cAAc,GAAG,iBAAiB,QAAI,gDAAuB,UAAU;AAEvG,QAAM,mBAAe,4CAAmB,UAAU;AAClD,QAAM,WAAW,QAAQ;AAEzB,QAAM,CAAC,qBAAqB,sBAAsB,QAAI,uBAAiB;AACvE,QAAM,CAAC,gBAAgB,iBAAiB,QAAI,uBAAiB,CAAC;AAC9D,QAAM,CAAC,qBAAqB,sBAAsB,QAAI,uBAAS,KAAK;AAEpE,QAAM,kBAAc,qBAAmC,IAAI;AAC3D,QAAM,eAAW,qBAAmC,IAAI;AAExD,QAAM,qBAAiB;AAAA,IACrB,CAAC,MAAM;AACL,UAAI,kBAAmB;AACvB,eAAS,EAAE,cAAc,OAAO,CAAC;A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,UAAa,oBAAoB,KAAK;AAAA,YACvD;AAAA,YACA,iBAAe;AAAA,YACd,GAAG;AAAA;AAAA,QACN,GACF;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,UAAQ;AAAA,YACR,cAAW;AAAA,YACX,eAAY;AAAA,YACZ,UAAU;AAAA,YACV;AAAA,YACA,YAAY;AAAA,YACZ,MAAM;AAAA,YACN,OAAO;AAAA,cACL,YAAY;AAAA,cACZ,eAAe;AAAA,cACf,UAAU;AAAA,cACV,aAAa;AAAA,cACb,cAAc,GAAG,IAAI,cAAc;AAAA,cACnC,UAAU;AAAA,YACZ;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,2BAA2B,cAAc;AACzC,MAAM,2CAAuC,kCAAS,0BAA0B;AAChF,qCAAqC,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/styles.js
CHANGED
|
@@ -87,11 +87,13 @@ const StyledTextArea = (0, import_ds_system.styled)("textarea", {
|
|
|
87
87
|
name: import_exported_related.DSControlledLargeTextInputName,
|
|
88
88
|
slot: import_exported_related.DSControlledLargeTextInputSlots.INPUT
|
|
89
89
|
})`
|
|
90
|
+
display: block;
|
|
90
91
|
line-height: 1;
|
|
91
92
|
outline: none;
|
|
92
93
|
width: 100%;
|
|
93
94
|
border: none;
|
|
94
95
|
padding: 8px;
|
|
96
|
+
${({ $hasVerticalOverflow }) => $hasVerticalOverflow ? "padding-bottom: 0;" : ``}
|
|
95
97
|
resize: none;
|
|
96
98
|
color: ${({ theme }) => theme.colors.neutral["800"]};
|
|
97
99
|
${({ $maxHeight }) => $maxHeight ? `max-height: ${$maxHeight}px;` : ``}
|
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, xStyledCommonProps } from '@elliemae/ds-system';\nimport { DSControlledLargeTextInputName, DSControlledLargeTextInputSlots } from './exported-related/index.js';\n\nexport const StyledContainer = styled('div', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.CONTAINER,\n})<{ $isDisabled?: boolean; applyAriaDisabled?: boolean }>`\n display: grid;\n grid-template-rows: auto auto;\n grid-template-columns: fit-content;\n ${({ $isDisabled }) =>\n $isDisabled\n ? `\n background-color: #EBEDF0;\n color: #616b7f;\n `\n : ``}\n ${({ applyAriaDisabled, theme }) =>\n applyAriaDisabled\n ? `\n background-color: ${theme.colors.neutral['050']};\n color: #616b7f;\n textarea {\n background-color: ${theme.colors.neutral['050']};\n }\n `\n : ``}\n ${xStyledCommonProps}\n`;\n\nexport const WrapperBorder = styled('div')<{ $hasError?: boolean; $isDisabled?: boolean; $isReadOnly?: boolean }>`\n ${({ $isDisabled, theme }) =>\n !$isDisabled\n ? `\n&:hover {\n outline: 1px solid ${theme.colors.brand[600]};\n outline-offset: -1px;\n}\n&:focus,\n&:focus-within {\n outline: 2px solid ${theme.colors.brand[700]};\n outline-offset: -2px;\n}\n&:hover,\n&:focus,\n&:focus-within {\n border-color: transparent;\n} \n`\n : ``}\n border: 1px solid neutral-400;\n border-radius: 2px;\n position: relative;\n box-sizing: content-box;\n ${({ $isReadOnly, theme }) =>\n $isReadOnly\n ? `\n border: 1px solid ${theme.colors.neutral['080']};\n border-bottom: 1px solid ${theme.colors.neutral['400']};\n `\n : ``}\n ${({ $hasError, theme }) => ($hasError ? `border: 1px solid ${theme.colors.danger[900]};` : ``)}\n`;\n\ninterface StyledTextAreaT {\n resizable?: boolean;\n hasError?: boolean;\n applyAriaDisabled?: boolean;\n $maxHeight?: number;\n $minHeight?: number;\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 padding: 8px;\n resize: none;\n color: ${({ theme }) => theme.colors.neutral['800']};\n ${({ $maxHeight }) => ($maxHeight ? `max-height: ${$maxHeight}px;` : ``)}\n ${({ $minHeight }) => ($minHeight ? `min-height: ${$minHeight}px;` : ``)}\n ${({ disabled, theme }) =>\n disabled\n ? `\n overflow: hidden;\n background-color: ${theme.colors.neutral['080']};\n color: ${theme.colors.neutral['500']};\n cursor: not-allowed;\n `\n : ''}\n &[aria-disabled='true'] {\n overflow: hidden;\n background-color: ${({ theme }) => theme.colors.neutral['050']};\n cursor: text;\n caret-color: transparent;\n }\n\n ${({ rows, $maxHeight }) => {\n if (rows === undefined && $maxHeight === undefined) return 'overflow: hidden;';\n return '';\n }}\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA2C;AAC3C,8BAAgF;AAEzE,MAAM,sBAAkB,yBAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,wDAAgC;AACxC,CAAC;AAAA;AAAA;AAAA;AAAA,IAIG,CAAC,EAAE,YAAY,MACf,cACI;AAAA;AAAA;AAAA,MAIA,EAAE;AAAA,IACN,CAAC,EAAE,mBAAmB,MAAM,MAC5B,oBACI;AAAA,wBACgB,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA;AAAA,0BAGzB,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA,MAG7C,EAAE;AAAA,IACN,mCAAkB;AAAA;AAGf,MAAM,oBAAgB,yBAAO,KAAK;AAAA,IACrC,CAAC,EAAE,aAAa,MAAM,MACtB,CAAC,cACG;AAAA;AAAA,uBAEe,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,uBAKvB,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAStC,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,IAKN,CAAC,EAAE,aAAa,MAAM,MACtB,cACI;AAAA,wBACgB,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,+BACpB,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,MAElD,EAAE;AAAA,IACN,CAAC,EAAE,WAAW,MAAM,MAAO,YAAY,qBAAqB,MAAM,OAAO,OAAO,GAAG,CAAC,MAAM,EAAG;AAAA;
|
|
4
|
+
"sourcesContent": ["import { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport { DSControlledLargeTextInputName, DSControlledLargeTextInputSlots } from './exported-related/index.js';\n\nexport const StyledContainer = styled('div', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.CONTAINER,\n})<{ $isDisabled?: boolean; applyAriaDisabled?: boolean }>`\n display: grid;\n grid-template-rows: auto auto;\n grid-template-columns: fit-content;\n ${({ $isDisabled }) =>\n $isDisabled\n ? `\n background-color: #EBEDF0;\n color: #616b7f;\n `\n : ``}\n ${({ applyAriaDisabled, theme }) =>\n applyAriaDisabled\n ? `\n background-color: ${theme.colors.neutral['050']};\n color: #616b7f;\n textarea {\n background-color: ${theme.colors.neutral['050']};\n }\n `\n : ``}\n ${xStyledCommonProps}\n`;\n\nexport const WrapperBorder = styled('div')<{ $hasError?: boolean; $isDisabled?: boolean; $isReadOnly?: boolean }>`\n ${({ $isDisabled, theme }) =>\n !$isDisabled\n ? `\n&:hover {\n outline: 1px solid ${theme.colors.brand[600]};\n outline-offset: -1px;\n}\n&:focus,\n&:focus-within {\n outline: 2px solid ${theme.colors.brand[700]};\n outline-offset: -2px;\n}\n&:hover,\n&:focus,\n&:focus-within {\n border-color: transparent;\n} \n`\n : ``}\n border: 1px solid neutral-400;\n border-radius: 2px;\n position: relative;\n box-sizing: content-box;\n ${({ $isReadOnly, theme }) =>\n $isReadOnly\n ? `\n border: 1px solid ${theme.colors.neutral['080']};\n border-bottom: 1px solid ${theme.colors.neutral['400']};\n `\n : ``}\n ${({ $hasError, theme }) => ($hasError ? `border: 1px solid ${theme.colors.danger[900]};` : ``)}\n`;\n\ninterface StyledTextAreaT {\n resizable?: boolean;\n hasError?: boolean;\n applyAriaDisabled?: boolean;\n $maxHeight?: number;\n $minHeight?: number;\n $hasVerticalOverflow?: boolean;\n}\n\nexport const StyledTextArea = styled('textarea', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.INPUT,\n})<StyledTextAreaT>`\n display: block;\n line-height: 1;\n outline: none;\n width: 100%;\n border: none;\n padding: 8px;\n ${({ $hasVerticalOverflow }) => ($hasVerticalOverflow ? 'padding-bottom: 0;' : ``)}\n resize: none;\n color: ${({ theme }) => theme.colors.neutral['800']};\n ${({ $maxHeight }) => ($maxHeight ? `max-height: ${$maxHeight}px;` : ``)}\n ${({ $minHeight }) => ($minHeight ? `min-height: ${$minHeight}px;` : ``)}\n ${({ disabled, theme }) =>\n disabled\n ? `\n overflow: hidden;\n background-color: ${theme.colors.neutral['080']};\n color: ${theme.colors.neutral['500']};\n cursor: not-allowed;\n `\n : ''}\n &[aria-disabled='true'] {\n overflow: hidden;\n background-color: ${({ theme }) => theme.colors.neutral['050']};\n cursor: text;\n caret-color: transparent;\n }\n\n ${({ rows, $maxHeight }) => {\n if (rows === undefined && $maxHeight === undefined) return 'overflow: hidden;';\n return '';\n }}\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA2C;AAC3C,8BAAgF;AAEzE,MAAM,sBAAkB,yBAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,wDAAgC;AACxC,CAAC;AAAA;AAAA;AAAA;AAAA,IAIG,CAAC,EAAE,YAAY,MACf,cACI;AAAA;AAAA;AAAA,MAIA,EAAE;AAAA,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,CAAC;AAAA,WACtC,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA,MAG9B,EAAE;AAAA;AAAA;AAAA,wBAGc,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAK9D,CAAC,EAAE,MAAM,WAAW,MAAM;AAC1B,MAAI,SAAS,UAAa,eAAe,OAAW,QAAO;AAC3D,SAAO;AACT,CAAC;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -20,8 +20,10 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
20
20
|
const { value, onChange, readOnly, innerRef, name, id, hasError, maxHeight, applyAriaDisabled, ...otherProps } = propsWithDefault;
|
|
21
21
|
const { className, rows, value: discardedVal, ...globalAttributes } = useGetGlobalAttributes(otherProps);
|
|
22
22
|
const xstyledProps = useGetXstyledProps(otherProps);
|
|
23
|
+
const baseRows = rows ?? 2;
|
|
23
24
|
const [calculatedMinHeight, setCalculatedMinHeight] = useState();
|
|
24
25
|
const [scrollBarWidth, setScrollBarWidth] = useState(0);
|
|
26
|
+
const [hasVerticalOverflow, setHasVerticalOverflow] = useState(false);
|
|
25
27
|
const textareaRef = useRef(null);
|
|
26
28
|
const ghostRef = useRef(null);
|
|
27
29
|
const handleOnChange = useCallback(
|
|
@@ -33,16 +35,17 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
33
35
|
);
|
|
34
36
|
useEffect(() => {
|
|
35
37
|
if (textareaRef && textareaRef.current) {
|
|
36
|
-
const { offsetWidth, clientWidth } = textareaRef.current;
|
|
38
|
+
const { offsetWidth, clientWidth, scrollHeight, clientHeight } = textareaRef.current;
|
|
37
39
|
setScrollBarWidth(offsetWidth - clientWidth);
|
|
40
|
+
setHasVerticalOverflow(scrollHeight > clientHeight);
|
|
38
41
|
}
|
|
39
|
-
}, [value]);
|
|
42
|
+
}, [value, calculatedMinHeight]);
|
|
40
43
|
useLayoutEffect(() => {
|
|
41
44
|
if (ghostRef && ghostRef.current) {
|
|
42
45
|
const { offsetHeight, scrollHeight } = ghostRef.current;
|
|
43
46
|
if (rows !== void 0) setCalculatedMinHeight(offsetHeight);
|
|
44
47
|
else if (maxHeight !== void 0 && scrollHeight >= maxHeight) setCalculatedMinHeight(maxHeight);
|
|
45
|
-
else setCalculatedMinHeight(scrollHeight);
|
|
48
|
+
else setCalculatedMinHeight(Math.max(scrollHeight, offsetHeight));
|
|
46
49
|
}
|
|
47
50
|
}, [maxHeight, value, rows]);
|
|
48
51
|
const referenceSetter = useMemo(() => mergeRefs(textareaRef, innerRef), [innerRef]);
|
|
@@ -63,11 +66,12 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
63
66
|
"aria-multiline": true,
|
|
64
67
|
$maxHeight: maxHeight,
|
|
65
68
|
$minHeight: calculatedMinHeight,
|
|
69
|
+
$hasVerticalOverflow: hasVerticalOverflow,
|
|
66
70
|
onChange: handleOnChange,
|
|
67
71
|
name,
|
|
68
72
|
id,
|
|
69
73
|
"data-testid": DSControlledLargetTextInputDatatestids.INPUT,
|
|
70
|
-
rows,
|
|
74
|
+
rows: baseRows,
|
|
71
75
|
"aria-describedby": id !== void 0 ? `${id}_feedback_message ${id}_error_message ${id}_remaining_characters` : void 0,
|
|
72
76
|
"aria-invalid": hasError,
|
|
73
77
|
"aria-disabled": applyAriaDisabled,
|
|
@@ -87,7 +91,7 @@ const DSControlledLargeTextInput = (props) => {
|
|
|
87
91
|
innerRef: ghostRef,
|
|
88
92
|
value,
|
|
89
93
|
$maxHeight: maxHeight,
|
|
90
|
-
rows,
|
|
94
|
+
rows: baseRows,
|
|
91
95
|
style: {
|
|
92
96
|
visibility: "hidden",
|
|
93
97
|
pointerEvents: "none",
|
|
@@ -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, useMemo, useRef, useState, useLayoutEffect, useEffect } from 'react';\nimport {\n describe,\n useValidateTypescriptPropTypes,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useGetXstyledProps,\n type ValidationMap,\n useOwnerProps,\n} from '@elliemae/ds-props-helpers';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { propTypes, defaultProps } from './react-desc-prop-types.js';\nimport { StyledTextArea, StyledContainer, WrapperBorder } from './styles.js';\nimport { DSControlledLargeTextInputName, DSControlledLargetTextInputDatatestids } from './exported-related/index.js';\nimport type { DSControlledLargeTextInputT } from './react-desc-prop-types.js';\n\nconst DSControlledLargeTextInput = (props: DSControlledLargeTextInputT.Props): JSX.Element => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSControlledLargeTextInputT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, propTypes, DSControlledLargeTextInputName);\n\n const ownerPropsConfig = useOwnerProps(propsWithDefault, { ...props });\n\n const { value, onChange, readOnly, innerRef, name, id, hasError, maxHeight, applyAriaDisabled, ...otherProps } =\n propsWithDefault;\n\n const { className, rows, value: discardedVal, ...globalAttributes } = useGetGlobalAttributes(otherProps);\n\n const xstyledProps = useGetXstyledProps(otherProps);\n\n const [calculatedMinHeight, setCalculatedMinHeight] = useState<number>();\n const [scrollBarWidth, setScrollBarWidth] = useState<number>(0);\n\n const textareaRef = useRef<HTMLTextAreaElement | null>(null);\n const ghostRef = useRef<HTMLTextAreaElement | null>(null);\n\n const handleOnChange = useCallback<React.KeyboardEventHandler<HTMLTextAreaElement>>(\n (e) => {\n if (applyAriaDisabled) return;\n onChange(e.currentTarget.value, e);\n },\n [onChange, applyAriaDisabled],\n );\n\n useEffect(() => {\n if (textareaRef && textareaRef.current) {\n const { offsetWidth, clientWidth } = textareaRef.current;\n setScrollBarWidth(offsetWidth - clientWidth);\n }\n }, [value]);\n\n useLayoutEffect(() => {\n if (ghostRef && ghostRef.current) {\n const { offsetHeight, scrollHeight } = ghostRef.current;\n if (rows !== undefined) setCalculatedMinHeight(offsetHeight);\n else if (maxHeight !== undefined && scrollHeight >= maxHeight) setCalculatedMinHeight(maxHeight);\n else setCalculatedMinHeight(scrollHeight);\n }\n }, [maxHeight, value, rows]);\n\n const referenceSetter = useMemo(() => mergeRefs(textareaRef, innerRef), [innerRef]);\n\n return (\n <StyledContainer\n className={className}\n data-testid={DSControlledLargetTextInputDatatestids.CONTAINER}\n $isDisabled={otherProps.disabled}\n applyAriaDisabled={applyAriaDisabled || readOnly}\n {...xstyledProps}\n {...ownerPropsConfig}\n >\n <WrapperBorder $hasError={hasError} $isDisabled={otherProps.disabled} $isReadOnly={applyAriaDisabled || readOnly}>\n <StyledTextArea\n innerRef={referenceSetter}\n aria-multiline\n $maxHeight={maxHeight}\n $minHeight={calculatedMinHeight}\n onChange={handleOnChange}\n name={name}\n id={id}\n data-testid={DSControlledLargetTextInputDatatestids.INPUT}\n rows={
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, useMemo, useRef, useState, useLayoutEffect, useEffect } from 'react';\nimport {\n describe,\n useValidateTypescriptPropTypes,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useGetXstyledProps,\n type ValidationMap,\n useOwnerProps,\n} from '@elliemae/ds-props-helpers';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { propTypes, defaultProps } from './react-desc-prop-types.js';\nimport { StyledTextArea, StyledContainer, WrapperBorder } from './styles.js';\nimport { DSControlledLargeTextInputName, DSControlledLargetTextInputDatatestids } from './exported-related/index.js';\nimport type { DSControlledLargeTextInputT } from './react-desc-prop-types.js';\n\nconst DSControlledLargeTextInput = (props: DSControlledLargeTextInputT.Props): JSX.Element => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSControlledLargeTextInputT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, propTypes, DSControlledLargeTextInputName);\n\n const ownerPropsConfig = useOwnerProps(propsWithDefault, { ...props });\n\n const { value, onChange, readOnly, innerRef, name, id, hasError, maxHeight, applyAriaDisabled, ...otherProps } =\n propsWithDefault;\n\n const { className, rows, value: discardedVal, ...globalAttributes } = useGetGlobalAttributes(otherProps);\n\n const xstyledProps = useGetXstyledProps(otherProps);\n const baseRows = rows ?? 2;\n\n const [calculatedMinHeight, setCalculatedMinHeight] = useState<number>();\n const [scrollBarWidth, setScrollBarWidth] = useState<number>(0);\n const [hasVerticalOverflow, setHasVerticalOverflow] = useState(false);\n\n const textareaRef = useRef<HTMLTextAreaElement | null>(null);\n const ghostRef = useRef<HTMLTextAreaElement | null>(null);\n\n const handleOnChange = useCallback<React.KeyboardEventHandler<HTMLTextAreaElement>>(\n (e) => {\n if (applyAriaDisabled) return;\n onChange(e.currentTarget.value, e);\n },\n [onChange, applyAriaDisabled],\n );\n\n useEffect(() => {\n if (textareaRef && textareaRef.current) {\n const { offsetWidth, clientWidth, scrollHeight, clientHeight } = textareaRef.current;\n setScrollBarWidth(offsetWidth - clientWidth);\n setHasVerticalOverflow(scrollHeight > clientHeight);\n }\n }, [value, calculatedMinHeight]);\n\n useLayoutEffect(() => {\n if (ghostRef && ghostRef.current) {\n const { offsetHeight, scrollHeight } = ghostRef.current;\n if (rows !== undefined) setCalculatedMinHeight(offsetHeight);\n else if (maxHeight !== undefined && scrollHeight >= maxHeight) setCalculatedMinHeight(maxHeight);\n else setCalculatedMinHeight(Math.max(scrollHeight, offsetHeight));\n }\n }, [maxHeight, value, rows]);\n\n const referenceSetter = useMemo(() => mergeRefs(textareaRef, innerRef), [innerRef]);\n\n return (\n <StyledContainer\n className={className}\n data-testid={DSControlledLargetTextInputDatatestids.CONTAINER}\n $isDisabled={otherProps.disabled}\n applyAriaDisabled={applyAriaDisabled || readOnly}\n {...xstyledProps}\n {...ownerPropsConfig}\n >\n <WrapperBorder $hasError={hasError} $isDisabled={otherProps.disabled} $isReadOnly={applyAriaDisabled || readOnly}>\n <StyledTextArea\n innerRef={referenceSetter}\n aria-multiline\n $maxHeight={maxHeight}\n $minHeight={calculatedMinHeight}\n $hasVerticalOverflow={hasVerticalOverflow}\n onChange={handleOnChange}\n name={name}\n id={id}\n data-testid={DSControlledLargetTextInputDatatestids.INPUT}\n rows={baseRows}\n aria-describedby={\n id !== undefined ? `${id}_feedback_message ${id}_error_message ${id}_remaining_characters` : undefined\n }\n aria-invalid={hasError}\n aria-disabled={applyAriaDisabled}\n {...globalAttributes}\n // PUI-17313 - value === undefined && applyAriaDisabled === true -> user can still type.\n // the following looks stupid. But the thing is, we are not validating that user never provides undefined.\n // when user provides undefined, merging keeps undefined, react enters in \"uncontrolled\" mode\n // when in uncontrolled mode, we can't prevent react from changing the dom value directly\n // which means \"if applyAriaDisabled never change the input\" constraint can't be enforced by us\n // to accomplish all that, we have to specifically make react behave still in controlled mode by providing ''\n // we had a team discussion, while this is mostly tech-debt, it would potentially be a breaking change to fix this to always default to ''\n // scenarios where user provides undefined and expect uncontrolled behavior might exist (without applyAriaDisabled)\n // as such, we only specifically fix the case that would cause a bug (applyAriaDisabled = true && value = undefined)\n value={value === undefined && applyAriaDisabled ? '' : value}\n readOnly={readOnly}\n aria-readonly={readOnly}\n {...ownerPropsConfig}\n />\n </WrapperBorder>\n <StyledTextArea\n disabled\n aria-label=\"ghost textarea\"\n data-testid=\"\"\n innerRef={ghostRef}\n value={value}\n $maxHeight={maxHeight}\n rows={baseRows}\n style={{\n visibility: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n paddingLeft: '9px',\n paddingRight: `${9 + scrollBarWidth}px`,\n overflow: 'hidden',\n }}\n />\n </StyledContainer>\n );\n};\n\nDSControlledLargeTextInput.displayName = 'DSControlledLargeTextInput';\nconst DSControlledLargeTextInputWithSchema = describe(DSControlledLargeTextInput);\nDSControlledLargeTextInputWithSchema.propTypes = propTypes as ValidationMap<unknown>;\nexport { DSControlledLargeTextInput, DS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;AAAA,YACZ,UAAU;AAAA,YACV;AAAA,YACA,YAAY;AAAA,YACZ,MAAM;AAAA,YACN,OAAO;AAAA,cACL,YAAY;AAAA,cACZ,eAAe;AAAA,cACf,UAAU;AAAA,cACV,aAAa;AAAA,cACb,cAAc,GAAG,IAAI,cAAc;AAAA,cACnC,UAAU;AAAA,YACZ;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,2BAA2B,cAAc;AACzC,MAAM,uCAAuC,SAAS,0BAA0B;AAChF,qCAAqC,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/styles.js
CHANGED
|
@@ -52,11 +52,13 @@ const StyledTextArea = styled("textarea", {
|
|
|
52
52
|
name: DSControlledLargeTextInputName,
|
|
53
53
|
slot: DSControlledLargeTextInputSlots.INPUT
|
|
54
54
|
})`
|
|
55
|
+
display: block;
|
|
55
56
|
line-height: 1;
|
|
56
57
|
outline: none;
|
|
57
58
|
width: 100%;
|
|
58
59
|
border: none;
|
|
59
60
|
padding: 8px;
|
|
61
|
+
${({ $hasVerticalOverflow }) => $hasVerticalOverflow ? "padding-bottom: 0;" : ``}
|
|
60
62
|
resize: none;
|
|
61
63
|
color: ${({ theme }) => theme.colors.neutral["800"]};
|
|
62
64
|
${({ $maxHeight }) => $maxHeight ? `max-height: ${$maxHeight}px;` : ``}
|
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, xStyledCommonProps } from '@elliemae/ds-system';\nimport { DSControlledLargeTextInputName, DSControlledLargeTextInputSlots } from './exported-related/index.js';\n\nexport const StyledContainer = styled('div', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.CONTAINER,\n})<{ $isDisabled?: boolean; applyAriaDisabled?: boolean }>`\n display: grid;\n grid-template-rows: auto auto;\n grid-template-columns: fit-content;\n ${({ $isDisabled }) =>\n $isDisabled\n ? `\n background-color: #EBEDF0;\n color: #616b7f;\n `\n : ``}\n ${({ applyAriaDisabled, theme }) =>\n applyAriaDisabled\n ? `\n background-color: ${theme.colors.neutral['050']};\n color: #616b7f;\n textarea {\n background-color: ${theme.colors.neutral['050']};\n }\n `\n : ``}\n ${xStyledCommonProps}\n`;\n\nexport const WrapperBorder = styled('div')<{ $hasError?: boolean; $isDisabled?: boolean; $isReadOnly?: boolean }>`\n ${({ $isDisabled, theme }) =>\n !$isDisabled\n ? `\n&:hover {\n outline: 1px solid ${theme.colors.brand[600]};\n outline-offset: -1px;\n}\n&:focus,\n&:focus-within {\n outline: 2px solid ${theme.colors.brand[700]};\n outline-offset: -2px;\n}\n&:hover,\n&:focus,\n&:focus-within {\n border-color: transparent;\n} \n`\n : ``}\n border: 1px solid neutral-400;\n border-radius: 2px;\n position: relative;\n box-sizing: content-box;\n ${({ $isReadOnly, theme }) =>\n $isReadOnly\n ? `\n border: 1px solid ${theme.colors.neutral['080']};\n border-bottom: 1px solid ${theme.colors.neutral['400']};\n `\n : ``}\n ${({ $hasError, theme }) => ($hasError ? `border: 1px solid ${theme.colors.danger[900]};` : ``)}\n`;\n\ninterface StyledTextAreaT {\n resizable?: boolean;\n hasError?: boolean;\n applyAriaDisabled?: boolean;\n $maxHeight?: number;\n $minHeight?: number;\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 padding: 8px;\n resize: none;\n color: ${({ theme }) => theme.colors.neutral['800']};\n ${({ $maxHeight }) => ($maxHeight ? `max-height: ${$maxHeight}px;` : ``)}\n ${({ $minHeight }) => ($minHeight ? `min-height: ${$minHeight}px;` : ``)}\n ${({ disabled, theme }) =>\n disabled\n ? `\n overflow: hidden;\n background-color: ${theme.colors.neutral['080']};\n color: ${theme.colors.neutral['500']};\n cursor: not-allowed;\n `\n : ''}\n &[aria-disabled='true'] {\n overflow: hidden;\n background-color: ${({ theme }) => theme.colors.neutral['050']};\n cursor: text;\n caret-color: transparent;\n }\n\n ${({ rows, $maxHeight }) => {\n if (rows === undefined && $maxHeight === undefined) return 'overflow: hidden;';\n return '';\n }}\n`;\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,0BAA0B;AAC3C,SAAS,gCAAgC,uCAAuC;AAEzE,MAAM,kBAAkB,OAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,gCAAgC;AACxC,CAAC;AAAA;AAAA;AAAA;AAAA,IAIG,CAAC,EAAE,YAAY,MACf,cACI;AAAA;AAAA;AAAA,MAIA,EAAE;AAAA,IACN,CAAC,EAAE,mBAAmB,MAAM,MAC5B,oBACI;AAAA,wBACgB,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA;AAAA,0BAGzB,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA,MAG7C,EAAE;AAAA,IACN,kBAAkB;AAAA;AAGf,MAAM,gBAAgB,OAAO,KAAK;AAAA,IACrC,CAAC,EAAE,aAAa,MAAM,MACtB,CAAC,cACG;AAAA;AAAA,uBAEe,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,uBAKvB,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAStC,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,IAKN,CAAC,EAAE,aAAa,MAAM,MACtB,cACI;AAAA,wBACgB,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,+BACpB,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,MAElD,EAAE;AAAA,IACN,CAAC,EAAE,WAAW,MAAM,MAAO,YAAY,qBAAqB,MAAM,OAAO,OAAO,GAAG,CAAC,MAAM,EAAG;AAAA;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, xStyledCommonProps } from '@elliemae/ds-system';\nimport { DSControlledLargeTextInputName, DSControlledLargeTextInputSlots } from './exported-related/index.js';\n\nexport const StyledContainer = styled('div', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.CONTAINER,\n})<{ $isDisabled?: boolean; applyAriaDisabled?: boolean }>`\n display: grid;\n grid-template-rows: auto auto;\n grid-template-columns: fit-content;\n ${({ $isDisabled }) =>\n $isDisabled\n ? `\n background-color: #EBEDF0;\n color: #616b7f;\n `\n : ``}\n ${({ applyAriaDisabled, theme }) =>\n applyAriaDisabled\n ? `\n background-color: ${theme.colors.neutral['050']};\n color: #616b7f;\n textarea {\n background-color: ${theme.colors.neutral['050']};\n }\n `\n : ``}\n ${xStyledCommonProps}\n`;\n\nexport const WrapperBorder = styled('div')<{ $hasError?: boolean; $isDisabled?: boolean; $isReadOnly?: boolean }>`\n ${({ $isDisabled, theme }) =>\n !$isDisabled\n ? `\n&:hover {\n outline: 1px solid ${theme.colors.brand[600]};\n outline-offset: -1px;\n}\n&:focus,\n&:focus-within {\n outline: 2px solid ${theme.colors.brand[700]};\n outline-offset: -2px;\n}\n&:hover,\n&:focus,\n&:focus-within {\n border-color: transparent;\n} \n`\n : ``}\n border: 1px solid neutral-400;\n border-radius: 2px;\n position: relative;\n box-sizing: content-box;\n ${({ $isReadOnly, theme }) =>\n $isReadOnly\n ? `\n border: 1px solid ${theme.colors.neutral['080']};\n border-bottom: 1px solid ${theme.colors.neutral['400']};\n `\n : ``}\n ${({ $hasError, theme }) => ($hasError ? `border: 1px solid ${theme.colors.danger[900]};` : ``)}\n`;\n\ninterface StyledTextAreaT {\n resizable?: boolean;\n hasError?: boolean;\n applyAriaDisabled?: boolean;\n $maxHeight?: number;\n $minHeight?: number;\n $hasVerticalOverflow?: boolean;\n}\n\nexport const StyledTextArea = styled('textarea', {\n name: DSControlledLargeTextInputName,\n slot: DSControlledLargeTextInputSlots.INPUT,\n})<StyledTextAreaT>`\n display: block;\n line-height: 1;\n outline: none;\n width: 100%;\n border: none;\n padding: 8px;\n ${({ $hasVerticalOverflow }) => ($hasVerticalOverflow ? 'padding-bottom: 0;' : ``)}\n resize: none;\n color: ${({ theme }) => theme.colors.neutral['800']};\n ${({ $maxHeight }) => ($maxHeight ? `max-height: ${$maxHeight}px;` : ``)}\n ${({ $minHeight }) => ($minHeight ? `min-height: ${$minHeight}px;` : ``)}\n ${({ disabled, theme }) =>\n disabled\n ? `\n overflow: hidden;\n background-color: ${theme.colors.neutral['080']};\n color: ${theme.colors.neutral['500']};\n cursor: not-allowed;\n `\n : ''}\n &[aria-disabled='true'] {\n overflow: hidden;\n background-color: ${({ theme }) => theme.colors.neutral['050']};\n cursor: text;\n caret-color: transparent;\n }\n\n ${({ rows, $maxHeight }) => {\n if (rows === undefined && $maxHeight === undefined) return 'overflow: hidden;';\n return '';\n }}\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,0BAA0B;AAC3C,SAAS,gCAAgC,uCAAuC;AAEzE,MAAM,kBAAkB,OAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,gCAAgC;AACxC,CAAC;AAAA;AAAA;AAAA;AAAA,IAIG,CAAC,EAAE,YAAY,MACf,cACI;AAAA;AAAA;AAAA,MAIA,EAAE;AAAA,IACN,CAAC,EAAE,mBAAmB,MAAM,MAC5B,oBACI;AAAA,wBACgB,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA;AAAA,0BAGzB,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA,MAG7C,EAAE;AAAA,IACN,kBAAkB;AAAA;AAGf,MAAM,gBAAgB,OAAO,KAAK;AAAA,IACrC,CAAC,EAAE,aAAa,MAAM,MACtB,CAAC,cACG;AAAA;AAAA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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/types/styles.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ interface StyledTextAreaT {
|
|
|
13
13
|
applyAriaDisabled?: boolean;
|
|
14
14
|
$maxHeight?: number;
|
|
15
15
|
$minHeight?: number;
|
|
16
|
+
$hasVerticalOverflow?: boolean;
|
|
16
17
|
}
|
|
17
18
|
export declare const StyledTextArea: import("styled-components").StyledComponent<"textarea", import("@elliemae/ds-system").Theme, StyledTextAreaT & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<"textarea">, never>;
|
|
18
19
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-form-input-textarea",
|
|
3
|
-
"version": "3.60.0-next.
|
|
3
|
+
"version": "3.60.0-next.49",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Controlled Form Input Textarea",
|
|
6
6
|
"files": [
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
"indent": 4
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@elliemae/ds-
|
|
40
|
-
"@elliemae/ds-
|
|
39
|
+
"@elliemae/ds-props-helpers": "3.60.0-next.49",
|
|
40
|
+
"@elliemae/ds-system": "3.60.0-next.49"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@elliemae/pui-theme": "~2.13.0",
|
|
44
44
|
"@xstyled/system": "~3.8.1",
|
|
45
45
|
"jest": "^30.0.0",
|
|
46
46
|
"styled-components": "~5.3.9",
|
|
47
|
-
"@elliemae/ds-monorepo-devops": "3.60.0-next.
|
|
48
|
-
"@elliemae/ds-test-utils": "3.60.0-next.
|
|
47
|
+
"@elliemae/ds-monorepo-devops": "3.60.0-next.49",
|
|
48
|
+
"@elliemae/ds-test-utils": "3.60.0-next.49"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@elliemae/pui-theme": "~2.13.0",
|