@elliemae/ds-form-input-textarea 3.80.0-next.71 → 3.80.0-next.75

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.
@@ -40,12 +40,20 @@ var import_ds_system = require("@elliemae/ds-system");
40
40
  var import_react_desc_prop_types = require("./react-desc-prop-types.js");
41
41
  var import_styles = require("./styles.js");
42
42
  var import_exported_related = require("./exported-related/index.js");
43
+ var import_useAriaDescribedBy = require("./config/useAriaDescribedBy.js");
44
+ var import_useTextareaInteractions = require("./config/useTextareaInteractions.js");
43
45
  const DSControlledLargeTextInput = (props) => {
44
46
  const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultProps);
45
47
  (0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefault, import_react_desc_prop_types.propTypes, import_exported_related.DSControlledLargeTextInputName);
46
48
  const ownerPropsConfig = (0, import_ds_props_helpers.useOwnerProps)(propsWithDefault, { ...props });
47
49
  const { value, onChange, readOnly, innerRef, name, id, hasError, maxHeight, applyAriaDisabled, ...otherProps } = propsWithDefault;
48
- const { className, rows, value: discardedVal, ...globalAttributes } = (0, import_ds_props_helpers.useGetGlobalAttributes)(otherProps);
50
+ const {
51
+ className,
52
+ rows,
53
+ value: discardedVal,
54
+ "aria-describedby": consumerAriaDescribedBy,
55
+ ...globalAttributes
56
+ } = (0, import_ds_props_helpers.useGetGlobalAttributes)(otherProps);
49
57
  const xstyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(otherProps);
50
58
  const baseRows = rows ?? 2;
51
59
  const [calculatedMinHeight, setCalculatedMinHeight] = (0, import_react.useState)();
@@ -53,13 +61,12 @@ const DSControlledLargeTextInput = (props) => {
53
61
  const [hasVerticalOverflow, setHasVerticalOverflow] = (0, import_react.useState)(false);
54
62
  const textareaRef = (0, import_react.useRef)(null);
55
63
  const ghostRef = (0, import_react.useRef)(null);
56
- const handleOnChange = (0, import_react.useCallback)(
57
- (e) => {
58
- if (applyAriaDisabled) return;
59
- onChange(e.currentTarget.value, e);
60
- },
61
- [onChange, applyAriaDisabled]
62
- );
64
+ const { isLocked, handleOnChange } = (0, import_useTextareaInteractions.useTextareaInteractions)({
65
+ disabled: otherProps.disabled,
66
+ applyAriaDisabled,
67
+ readOnly,
68
+ onChange
69
+ });
63
70
  (0, import_react.useEffect)(() => {
64
71
  if (textareaRef && textareaRef.current) {
65
72
  const { offsetWidth, clientWidth, scrollHeight, clientHeight } = textareaRef.current;
@@ -76,6 +83,11 @@ const DSControlledLargeTextInput = (props) => {
76
83
  }
77
84
  }, [maxHeight, value, rows]);
78
85
  const referenceSetter = (0, import_react.useMemo)(() => (0, import_ds_system.mergeRefs)(textareaRef, innerRef), [innerRef]);
86
+ const { readOnlyHelperId, ariaDescribedBy: finalAriaDescribedBy } = (0, import_useAriaDescribedBy.useAriaDescribedBy)({
87
+ id,
88
+ readOnly,
89
+ consumerAriaDescribedBy
90
+ });
79
91
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
80
92
  import_styles.StyledContainer,
81
93
  {
@@ -86,29 +98,35 @@ const DSControlledLargeTextInput = (props) => {
86
98
  ...xstyledProps,
87
99
  ...ownerPropsConfig,
88
100
  children: [
89
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.WrapperBorder, { $hasError: hasError, $isDisabled: otherProps.disabled, $isReadOnly: applyAriaDisabled || readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
90
- import_styles.StyledTextArea,
91
- {
92
- innerRef: referenceSetter,
93
- "aria-multiline": true,
94
- $maxHeight: maxHeight,
95
- $minHeight: calculatedMinHeight,
96
- $hasVerticalOverflow: hasVerticalOverflow,
97
- onChange: handleOnChange,
98
- name,
99
- id,
100
- "data-testid": import_exported_related.DSControlledLargetTextInputDatatestids.INPUT,
101
- rows: baseRows,
102
- "aria-describedby": id !== void 0 ? `${id}_feedback_message ${id}_error_message ${id}_remaining_characters` : void 0,
103
- "aria-invalid": hasError,
104
- "aria-disabled": applyAriaDisabled,
105
- ...globalAttributes,
106
- value: value === void 0 && applyAriaDisabled ? "" : value,
107
- readOnly,
108
- "aria-readonly": readOnly,
109
- ...ownerPropsConfig
110
- }
111
- ) }),
101
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.WrapperBorder, { $hasError: hasError, $isDisabled: otherProps.disabled, $isReadOnly: applyAriaDisabled || readOnly, children: [
102
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
103
+ import_styles.StyledTextArea,
104
+ {
105
+ innerRef: referenceSetter,
106
+ "aria-multiline": true,
107
+ $maxHeight: maxHeight,
108
+ $minHeight: calculatedMinHeight,
109
+ $hasVerticalOverflow: hasVerticalOverflow,
110
+ onChange: handleOnChange,
111
+ name,
112
+ id,
113
+ "data-testid": import_exported_related.DSControlledLargetTextInputDatatestids.INPUT,
114
+ rows: baseRows,
115
+ "aria-describedby": finalAriaDescribedBy,
116
+ "aria-invalid": hasError,
117
+ ...(0, import_ds_props_helpers.omitLockedHandlers)(globalAttributes, isLocked, "change"),
118
+ "aria-disabled": (0, import_ds_props_helpers.resolveAriaDisabled)({
119
+ disabled: otherProps.disabled,
120
+ softLocked: applyAriaDisabled || readOnly,
121
+ consumerValue: globalAttributes["aria-disabled"]
122
+ }),
123
+ value: value === void 0 && (applyAriaDisabled || readOnly) ? "" : value,
124
+ readOnly,
125
+ ...ownerPropsConfig
126
+ }
127
+ ),
128
+ readOnly ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { hidden: true, id: readOnlyHelperId, children: "Read only" }) : null
129
+ ] }),
112
130
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
113
131
  import_styles.StyledTextArea,
114
132
  {
@@ -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 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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YACZ,sBAAsB;AAAA,YACtB,UAAU;AAAA,YACV;AAAA,YACA;AAAA,YACA,eAAa,+DAAuC;AAAA,YACpD,MAAM;AAAA,YACN,oBACE,OAAO,SAAY,GAAG,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,0BAA0B;AAAA,YAE/F,gBAAc;AAAA,YACd,iBAAe;AAAA,YACd,GAAG;AAAA,YAUJ,OAAO,UAAU,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;",
4
+ "sourcesContent": ["import React, { useMemo, useRef, useState, useLayoutEffect, useEffect } from 'react';\nimport {\n describe,\n useValidateTypescriptPropTypes,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useGetXstyledProps,\n type ValidationMap,\n useOwnerProps,\n omitLockedHandlers,\n resolveAriaDisabled,\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';\nimport { useAriaDescribedBy } from './config/useAriaDescribedBy.js';\nimport { useTextareaInteractions } from './config/useTextareaInteractions.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 {\n className,\n rows,\n value: discardedVal,\n 'aria-describedby': consumerAriaDescribedBy,\n ...globalAttributes\n } = 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 { isLocked, handleOnChange } = useTextareaInteractions({\n disabled: otherProps.disabled,\n applyAriaDisabled,\n readOnly,\n onChange,\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 const { readOnlyHelperId, ariaDescribedBy: finalAriaDescribedBy } = useAriaDescribedBy({\n id,\n readOnly,\n consumerAriaDescribedBy,\n });\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={finalAriaDescribedBy}\n aria-invalid={hasError}\n {...omitLockedHandlers(globalAttributes, isLocked, 'change')}\n // after the spread: a soft lock prints \"true\" whatever the consumer passes, a natively disabled textarea prints none\n // of its own, otherwise the consumer's own aria-disabled passes through (inversion of control)\n aria-disabled={resolveAriaDisabled({\n disabled: otherProps.disabled,\n softLocked: applyAriaDisabled || readOnly,\n consumerValue: globalAttributes['aria-disabled'],\n })}\n // PUI-17313 - value === undefined && a soft lock (applyAriaDisabled or readOnly, the same lock) -> 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 soft locked 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 (a soft lock && value = undefined)\n value={value === undefined && (applyAriaDisabled || readOnly) ? '' : value}\n readOnly={readOnly}\n {...ownerPropsConfig}\n />\n {readOnly ? (\n <p hidden id={readOnlyHelperId}>\n Read only\n </p>\n ) : null}\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;ADwFjB;AAxFN,mBAA6E;AAC7E,8BAUO;AACP,uBAA0B;AAC1B,mCAAwC;AACxC,oBAA+D;AAC/D,8BAAuF;AAEvF,gCAAmC;AACnC,qCAAwC;AAExC,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;AAAA,IACJ;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,oBAAoB;AAAA,IACpB,GAAG;AAAA,EACL,QAAI,gDAAuB,UAAU;AAErC,QAAM,mBAAe,4CAAmB,UAAU;AAClD,QAAM,WAAW,QAAQ;AAEzB,QAAM,CAAC,qBAAqB,sBA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aAAa,qBAAqB,UACtG;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,UAAU;AAAA,cACV,kBAAc;AAAA,cACd,YAAY;AAAA,cACZ,YAAY;AAAA,cACZ,sBAAsB;AAAA,cACtB,UAAU;AAAA,cACV;AAAA,cACA;AAAA,cACA,eAAa,+DAAuC;AAAA,cACpD,MAAM;AAAA,cACN,oBAAkB;AAAA,cAClB,gBAAc;AAAA,cACb,OAAG,4CAAmB,kBAAkB,UAAU,QAAQ;AAAA,cAG3D,qBAAe,6CAAoB;AAAA,gBACjC,UAAU,WAAW;AAAA,gBACrB,YAAY,qBAAqB;AAAA,gBACjC,eAAe,iBAAiB,eAAe;AAAA,cACjD,CAAC;AAAA,cAUD,OAAO,UAAU,WAAc,qBAAqB,YAAY,KAAK;AAAA,cACrE;AAAA,cACC,GAAG;AAAA;AAAA,UACN;AAAA,UACC,WACC,4CAAC,OAAE,QAAM,MAAC,IAAI,kBAAkB,uBAEhC,IACE;AAAA,WACN;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
  }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var useAriaDescribedBy_exports = {};
30
+ __export(useAriaDescribedBy_exports, {
31
+ useAriaDescribedBy: () => useAriaDescribedBy
32
+ });
33
+ module.exports = __toCommonJS(useAriaDescribedBy_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_react = require("react");
36
+ var import_uid = require("uid");
37
+ const useAriaDescribedBy = ({ id, readOnly, consumerAriaDescribedBy }) => {
38
+ const generatedId = (0, import_react.useMemo)(() => `ds-textarea-${(0, import_uid.uid)()}`, []);
39
+ const readOnlyHelperId = (0, import_react.useMemo)(() => `${id || generatedId}-read-only-helper-msg`, [id, generatedId]);
40
+ const ariaDescribedBy = (0, import_react.useMemo)(() => {
41
+ const computed = consumerAriaDescribedBy ?? (id !== void 0 ? `${id}_feedback_message ${id}_error_message ${id}_remaining_characters` : void 0);
42
+ return [computed, readOnly ? readOnlyHelperId : void 0].filter(Boolean).join(" ") || void 0;
43
+ }, [consumerAriaDescribedBy, id, readOnly, readOnlyHelperId]);
44
+ return { readOnlyHelperId, ariaDescribedBy };
45
+ };
46
+ //# sourceMappingURL=useAriaDescribedBy.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/config/useAriaDescribedBy.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import { useMemo } from 'react';\nimport { uid } from 'uid';\n\nexport interface UseAriaDescribedByArgs {\n id?: string;\n readOnly?: boolean;\n consumerAriaDescribedBy?: string;\n}\n\nexport const useAriaDescribedBy = ({ id, readOnly, consumerAriaDescribedBy }: UseAriaDescribedByArgs) => {\n // uid is only a fallback; id is expected from the consumer, the helper id must be unique per instance\n // (uid, not React's useId: hosts that dedupe to React 17 do not have it). The prefix keeps the id starting with a\n // letter: a uid can start with a digit, which is a valid id but an invalid unescaped CSS selector (`#3fa2`)\n const generatedId = useMemo(() => `ds-textarea-${uid()}`, []);\n const readOnlyHelperId = useMemo(() => `${id || generatedId}-read-only-helper-msg`, [id, generatedId]);\n const ariaDescribedBy = useMemo(() => {\n // `${id}_feedback_message` and `${id}_error_message` are rendered by DSFormLayoutBlockItem (from its inputID),\n // not by the textarea; a consumer-provided raw aria-describedby replaces the computed ids (existing behavior)\n const computed =\n consumerAriaDescribedBy ??\n (id !== undefined ? `${id}_feedback_message ${id}_error_message ${id}_remaining_characters` : undefined);\n // readOnly appends the \"Read only\" helper id to whichever value wins\n return [computed, readOnly ? readOnlyHelperId : undefined].filter(Boolean).join(' ') || undefined;\n }, [consumerAriaDescribedBy, id, readOnly, readOnlyHelperId]);\n return { readOnlyHelperId, ariaDescribedBy };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwB;AACxB,iBAAoB;AAQb,MAAM,qBAAqB,CAAC,EAAE,IAAI,UAAU,wBAAwB,MAA8B;AAIvG,QAAM,kBAAc,sBAAQ,MAAM,mBAAe,gBAAI,CAAC,IAAI,CAAC,CAAC;AAC5D,QAAM,uBAAmB,sBAAQ,MAAM,GAAG,MAAM,WAAW,yBAAyB,CAAC,IAAI,WAAW,CAAC;AACrG,QAAM,sBAAkB,sBAAQ,MAAM;AAGpC,UAAM,WACJ,4BACC,OAAO,SAAY,GAAG,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,0BAA0B;AAEhG,WAAO,CAAC,UAAU,WAAW,mBAAmB,MAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,KAAK;AAAA,EAC1F,GAAG,CAAC,yBAAyB,IAAI,UAAU,gBAAgB,CAAC;AAC5D,SAAO,EAAE,kBAAkB,gBAAgB;AAC7C;",
6
+ "names": []
7
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var useTextareaInteractions_exports = {};
30
+ __export(useTextareaInteractions_exports, {
31
+ useTextareaInteractions: () => useTextareaInteractions
32
+ });
33
+ module.exports = __toCommonJS(useTextareaInteractions_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_react = require("react");
36
+ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
37
+ const useTextareaInteractions = ({
38
+ disabled,
39
+ applyAriaDisabled,
40
+ readOnly,
41
+ onChange
42
+ }) => {
43
+ const locked = (0, import_ds_props_helpers.isLocked)({ disabled, applyAriaDisabled, readOnly });
44
+ const handleOnChange = (0, import_react.useCallback)(
45
+ (e) => {
46
+ if (locked) return;
47
+ onChange(e.currentTarget.value, e);
48
+ },
49
+ [locked, onChange]
50
+ );
51
+ return { isLocked: locked, handleOnChange };
52
+ };
53
+ //# sourceMappingURL=useTextareaInteractions.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/config/useTextareaInteractions.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import type React from 'react';\nimport { useCallback } from 'react';\nimport { isLocked } from '@elliemae/ds-props-helpers';\n\nexport interface UseTextareaInteractionsArgs {\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n readOnly?: boolean;\n onChange: (value: string, e: React.KeyboardEvent<HTMLTextAreaElement>) => void;\n}\n\n// disabled, applyAriaDisabled and readOnly lock the field identically. While locked the consumer's onChange is not\n// invoked: a controlled textarea is put back by React, whatever path the edit took (keys, paste, drop, autofill, IME).\n// The consumer's action handlers are withheld by `omitLockedHandlers` on the global attributes spread.\nexport const useTextareaInteractions = ({\n disabled,\n applyAriaDisabled,\n readOnly,\n onChange,\n}: UseTextareaInteractionsArgs) => {\n const locked = isLocked({ disabled, applyAriaDisabled, readOnly });\n\n const handleOnChange = useCallback<React.KeyboardEventHandler<HTMLTextAreaElement>>(\n (e) => {\n if (locked) return;\n onChange(e.currentTarget.value, e);\n },\n [locked, onChange],\n );\n\n return { isLocked: locked, handleOnChange };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA4B;AAC5B,8BAAyB;AAYlB,MAAM,0BAA0B,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAmC;AACjC,QAAM,aAAS,kCAAS,EAAE,UAAU,mBAAmB,SAAS,CAAC;AAEjE,QAAM,qBAAiB;AAAA,IACrB,CAAC,MAAM;AACL,UAAI,OAAQ;AACZ,eAAS,EAAE,cAAc,OAAO,CAAC;AAAA,IACnC;AAAA,IACA,CAAC,QAAQ,QAAQ;AAAA,EACnB;AAEA,SAAO,EAAE,UAAU,QAAQ,eAAe;AAC5C;",
6
+ "names": []
7
+ }
@@ -55,11 +55,13 @@ const propTypes = {
55
55
  id: import_ds_props_helpers.PropTypes.string.description("Unique id."),
56
56
  innerRef: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.object, import_ds_props_helpers.PropTypes.func]).description("Inner ref to the input."),
57
57
  disabled: import_ds_props_helpers.PropTypes.bool.description("Set disabled state."),
58
- readOnly: import_ds_props_helpers.PropTypes.bool.description("Set readonly state."),
58
+ readOnly: import_ds_props_helpers.PropTypes.bool.description(
59
+ 'Soft lock, same as applyAriaDisabled: aria-disabled="true", CAN STILL RECEIVE FOCUS, WITHHOLDS THE CHANGE: onChange is not called and the value does not change. Clicks and keys are only observed (they still reach your handlers). Also announces "Read only" through a hidden description. Dimsum never writes aria-readonly.'
60
+ ),
59
61
  maxHeight: import_ds_props_helpers.PropTypes.number.description("Set max height to resize input text"),
60
62
  hasError: import_ds_props_helpers.PropTypes.bool.description("Set error state.").defaultValue(false),
61
63
  applyAriaDisabled: import_ds_props_helpers.PropTypes.bool.description(
62
- "Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION."
64
+ "Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. WITHHOLDS THE CHANGE: onChange is not called and the value does not change. Clicks and keys are only observed (they still reach your handlers)."
63
65
  ).defaultValue(false)
64
66
  };
65
67
  //# sourceMappingURL=react-desc-prop-types.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import type React from 'react';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n type GlobalAttributesT,\n type XstyledProps,\n} from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSControlledLargeTextInputName, DSControlledLargeTextInputSlots } from './exported-related/index.js';\n\nconst noop = () => {};\n\nexport declare namespace DSControlledLargeTextInputT {\n export interface DefaultProps {\n value: string;\n onChange: (newVal: string, event: React.SyntheticEvent<HTMLTextAreaElement>) => void;\n hasError: boolean;\n applyAriaDisabled: boolean;\n }\n\n export interface RequiredProps {}\n\n export interface PropsOptional extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSControlledLargeTextInputName,\n typeof DSControlledLargeTextInputSlots\n > {\n name?: string;\n id: string;\n rows?: string;\n disabled?: boolean;\n readOnly?: boolean;\n maxHeight?: number;\n innerRef?: React.MutableRefObject<HTMLTextAreaElement | null>;\n }\n\n export interface Props\n extends\n Partial<DefaultProps>,\n PropsOptional,\n RequiredProps,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof PropsOptional>,\n Omit<XstyledProps, keyof PropsOptional> {}\n\n export interface InternalProps\n extends\n DefaultProps,\n PropsOptional,\n RequiredProps,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof PropsOptional>,\n Omit<XstyledProps, keyof PropsOptional> {}\n}\n\nexport const defaultProps: DSControlledLargeTextInputT.DefaultProps = {\n value: '',\n onChange: noop,\n hasError: false,\n applyAriaDisabled: false,\n};\n\nexport const propTypes = {\n ...getPropsPerSlotPropTypes(DSControlledLargeTextInputName, DSControlledLargeTextInputSlots),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n value: PropTypes.string.description('Text are value.').defaultValue(''),\n onChange: PropTypes.func.description('OnChange cb.').defaultValue('() => {}'),\n rows: PropTypes.string.description(\n 'Sets the number of lines for the default height. Once lines are reached, scroll behavior enables.',\n ),\n id: PropTypes.string.description('Unique id.'),\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Inner ref to the input.'),\n disabled: PropTypes.bool.description('Set disabled state.'),\n readOnly: PropTypes.bool.description('Set readonly state.'),\n maxHeight: PropTypes.number.description('Set max height to resize input text'),\n hasError: PropTypes.bool.description('Set error state.').defaultValue(false),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue(false),\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAOO;AAEP,8BAAgF;AAEhF,MAAM,OAAO,MAAM;AAAC;AA0Cb,MAAM,eAAyD;AAAA,EACpE,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,mBAAmB;AACrB;AAEO,MAAM,YAAY;AAAA,EACvB,OAAG,kDAAyB,wDAAgC,uDAA+B;AAAA,EAC3F,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO,kCAAU,OAAO,YAAY,iBAAiB,EAAE,aAAa,EAAE;AAAA,EACtE,UAAU,kCAAU,KAAK,YAAY,cAAc,EAAE,aAAa,UAAU;AAAA,EAC5E,MAAM,kCAAU,OAAO;AAAA,IACrB;AAAA,EACF;AAAA,EACA,IAAI,kCAAU,OAAO,YAAY,YAAY;AAAA,EAC7C,UAAU,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,IAAI,CAAC,EAAE,YAAY,yBAAyB;AAAA,EACvG,UAAU,kCAAU,KAAK,YAAY,qBAAqB;AAAA,EAC1D,UAAU,kCAAU,KAAK,YAAY,qBAAqB;AAAA,EAC1D,WAAW,kCAAU,OAAO,YAAY,qCAAqC;AAAA,EAC7E,UAAU,kCAAU,KAAK,YAAY,kBAAkB,EAAE,aAAa,KAAK;AAAA,EAC3E,mBAAmB,kCAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AACvB;",
4
+ "sourcesContent": ["import type React from 'react';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n type GlobalAttributesT,\n type XstyledProps,\n} from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSControlledLargeTextInputName, DSControlledLargeTextInputSlots } from './exported-related/index.js';\n\nconst noop = () => {};\n\nexport declare namespace DSControlledLargeTextInputT {\n export interface DefaultProps {\n value: string;\n onChange: (newVal: string, event: React.SyntheticEvent<HTMLTextAreaElement>) => void;\n hasError: boolean;\n applyAriaDisabled: boolean;\n }\n\n export interface RequiredProps {}\n\n export interface PropsOptional extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSControlledLargeTextInputName,\n typeof DSControlledLargeTextInputSlots\n > {\n name?: string;\n id: string;\n rows?: string;\n disabled?: boolean;\n readOnly?: boolean;\n maxHeight?: number;\n innerRef?: React.MutableRefObject<HTMLTextAreaElement | null>;\n }\n\n export interface Props\n extends\n Partial<DefaultProps>,\n PropsOptional,\n RequiredProps,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof PropsOptional>,\n Omit<XstyledProps, keyof PropsOptional> {}\n\n export interface InternalProps\n extends\n DefaultProps,\n PropsOptional,\n RequiredProps,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof PropsOptional>,\n Omit<XstyledProps, keyof PropsOptional> {}\n}\n\nexport const defaultProps: DSControlledLargeTextInputT.DefaultProps = {\n value: '',\n onChange: noop,\n hasError: false,\n applyAriaDisabled: false,\n};\n\nexport const propTypes = {\n ...getPropsPerSlotPropTypes(DSControlledLargeTextInputName, DSControlledLargeTextInputSlots),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n value: PropTypes.string.description('Text are value.').defaultValue(''),\n onChange: PropTypes.func.description('OnChange cb.').defaultValue('() => {}'),\n rows: PropTypes.string.description(\n 'Sets the number of lines for the default height. Once lines are reached, scroll behavior enables.',\n ),\n id: PropTypes.string.description('Unique id.'),\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Inner ref to the input.'),\n disabled: PropTypes.bool.description('Set disabled state.'),\n readOnly: PropTypes.bool.description(\n 'Soft lock, same as applyAriaDisabled: aria-disabled=\"true\", CAN STILL RECEIVE FOCUS, WITHHOLDS THE CHANGE: onChange is not called and the value does not change. Clicks and keys are only observed (they still reach your handlers). Also announces \"Read only\" through a hidden description. Dimsum never writes aria-readonly.',\n ),\n maxHeight: PropTypes.number.description('Set max height to resize input text'),\n hasError: PropTypes.bool.description('Set error state.').defaultValue(false),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. WITHHOLDS THE CHANGE: onChange is not called and the value does not change. Clicks and keys are only observed (they still reach your handlers).',\n )\n .defaultValue(false),\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAOO;AAEP,8BAAgF;AAEhF,MAAM,OAAO,MAAM;AAAC;AA0Cb,MAAM,eAAyD;AAAA,EACpE,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,mBAAmB;AACrB;AAEO,MAAM,YAAY;AAAA,EACvB,OAAG,kDAAyB,wDAAgC,uDAA+B;AAAA,EAC3F,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO,kCAAU,OAAO,YAAY,iBAAiB,EAAE,aAAa,EAAE;AAAA,EACtE,UAAU,kCAAU,KAAK,YAAY,cAAc,EAAE,aAAa,UAAU;AAAA,EAC5E,MAAM,kCAAU,OAAO;AAAA,IACrB;AAAA,EACF;AAAA,EACA,IAAI,kCAAU,OAAO,YAAY,YAAY;AAAA,EAC7C,UAAU,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,IAAI,CAAC,EAAE,YAAY,yBAAyB;AAAA,EACvG,UAAU,kCAAU,KAAK,YAAY,qBAAqB;AAAA,EAC1D,UAAU,kCAAU,KAAK;AAAA,IACvB;AAAA,EACF;AAAA,EACA,WAAW,kCAAU,OAAO,YAAY,qCAAqC;AAAA,EAC7E,UAAU,kCAAU,KAAK,YAAY,kBAAkB,EAAE,aAAa,KAAK;AAAA,EAC3E,mBAAmB,kCAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AACvB;",
6
6
  "names": []
7
7
  }
@@ -102,12 +102,10 @@ const StyledTextArea = (0, import_ds_system.styled)("textarea", {
102
102
  overflow: hidden;
103
103
  background-color: ${theme.colors.neutral["080"]};
104
104
  color: ${theme.colors.neutral["500"]};
105
- cursor: not-allowed;
106
105
  ` : ""}
107
106
  &[aria-disabled='true'] {
108
107
  overflow: hidden;
109
108
  background-color: ${({ theme }) => theme.colors.neutral["050"]};
110
- cursor: text;
111
109
  caret-color: transparent;
112
110
  }
113
111
 
@@ -115,5 +113,6 @@ const StyledTextArea = (0, import_ds_system.styled)("textarea", {
115
113
  if (rows === void 0 && $maxHeight === void 0) return "overflow: hidden;";
116
114
  return "";
117
115
  }}
116
+ ${import_ds_system.lockedStateInteractionCss}
118
117
  `;
119
118
  //# sourceMappingURL=styles.js.map
@@ -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 $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,IACN,CAAC,EAAE,mBAAmB,MAAM,MAC5B,oBACI;AAAA,wBACgB,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA;AAAA,0BAGzB,MAAM,OAAO,QAAQ,KAAK,CAAC;A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K,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAK9D,CAAC,EAAE,MAAM,WAAW,MAAM;AAC1B,MAAI,SAAS,UAAa,eAAe,OAAW,QAAO;AAC3D,SAAO;AACT,CAAC;AAAA;",
4
+ "sourcesContent": ["import { styled, xStyledCommonProps, lockedStateInteractionCss } 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 `\n : ''}\n &[aria-disabled='true'] {\n overflow: hidden;\n background-color: ${({ theme }) => theme.colors.neutral['050']};\n caret-color: transparent;\n }\n\n ${({ rows, $maxHeight }) => {\n if (rows === undefined && $maxHeight === undefined) return 'overflow: hidden;';\n return '';\n }}\n ${lockedStateInteractionCss}\n`;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAsE;AACtE,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,MAG7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AAA;AAAA,IAI9D,CAAC,EAAE,MAAM,WAAW,MAAM;AAC1B,MAAI,SAAS,UAAa,eAAe,OAAW,QAAO;AAC3D,SAAO;AACT,CAAC;AAAA,IACC,0CAAyB;AAAA;",
6
6
  "names": []
7
7
  }
@@ -1,24 +1,34 @@
1
1
  import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useCallback, useMemo, useRef, useState, useLayoutEffect, useEffect } from "react";
3
+ import { useMemo, useRef, useState, useLayoutEffect, useEffect } from "react";
4
4
  import {
5
5
  describe,
6
6
  useValidateTypescriptPropTypes,
7
7
  useMemoMergePropsWithDefault,
8
8
  useGetGlobalAttributes,
9
9
  useGetXstyledProps,
10
- useOwnerProps
10
+ useOwnerProps,
11
+ omitLockedHandlers,
12
+ resolveAriaDisabled
11
13
  } from "@elliemae/ds-props-helpers";
12
14
  import { mergeRefs } from "@elliemae/ds-system";
13
15
  import { propTypes, defaultProps } from "./react-desc-prop-types.js";
14
16
  import { StyledTextArea, StyledContainer, WrapperBorder } from "./styles.js";
15
17
  import { DSControlledLargeTextInputName, DSControlledLargetTextInputDatatestids } from "./exported-related/index.js";
18
+ import { useAriaDescribedBy } from "./config/useAriaDescribedBy.js";
19
+ import { useTextareaInteractions } from "./config/useTextareaInteractions.js";
16
20
  const DSControlledLargeTextInput = (props) => {
17
21
  const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
18
22
  useValidateTypescriptPropTypes(propsWithDefault, propTypes, DSControlledLargeTextInputName);
19
23
  const ownerPropsConfig = useOwnerProps(propsWithDefault, { ...props });
20
24
  const { value, onChange, readOnly, innerRef, name, id, hasError, maxHeight, applyAriaDisabled, ...otherProps } = propsWithDefault;
21
- const { className, rows, value: discardedVal, ...globalAttributes } = useGetGlobalAttributes(otherProps);
25
+ const {
26
+ className,
27
+ rows,
28
+ value: discardedVal,
29
+ "aria-describedby": consumerAriaDescribedBy,
30
+ ...globalAttributes
31
+ } = useGetGlobalAttributes(otherProps);
22
32
  const xstyledProps = useGetXstyledProps(otherProps);
23
33
  const baseRows = rows ?? 2;
24
34
  const [calculatedMinHeight, setCalculatedMinHeight] = useState();
@@ -26,13 +36,12 @@ const DSControlledLargeTextInput = (props) => {
26
36
  const [hasVerticalOverflow, setHasVerticalOverflow] = useState(false);
27
37
  const textareaRef = useRef(null);
28
38
  const ghostRef = useRef(null);
29
- const handleOnChange = useCallback(
30
- (e) => {
31
- if (applyAriaDisabled) return;
32
- onChange(e.currentTarget.value, e);
33
- },
34
- [onChange, applyAriaDisabled]
35
- );
39
+ const { isLocked, handleOnChange } = useTextareaInteractions({
40
+ disabled: otherProps.disabled,
41
+ applyAriaDisabled,
42
+ readOnly,
43
+ onChange
44
+ });
36
45
  useEffect(() => {
37
46
  if (textareaRef && textareaRef.current) {
38
47
  const { offsetWidth, clientWidth, scrollHeight, clientHeight } = textareaRef.current;
@@ -49,6 +58,11 @@ const DSControlledLargeTextInput = (props) => {
49
58
  }
50
59
  }, [maxHeight, value, rows]);
51
60
  const referenceSetter = useMemo(() => mergeRefs(textareaRef, innerRef), [innerRef]);
61
+ const { readOnlyHelperId, ariaDescribedBy: finalAriaDescribedBy } = useAriaDescribedBy({
62
+ id,
63
+ readOnly,
64
+ consumerAriaDescribedBy
65
+ });
52
66
  return /* @__PURE__ */ jsxs(
53
67
  StyledContainer,
54
68
  {
@@ -59,29 +73,35 @@ const DSControlledLargeTextInput = (props) => {
59
73
  ...xstyledProps,
60
74
  ...ownerPropsConfig,
61
75
  children: [
62
- /* @__PURE__ */ jsx(WrapperBorder, { $hasError: hasError, $isDisabled: otherProps.disabled, $isReadOnly: applyAriaDisabled || readOnly, children: /* @__PURE__ */ jsx(
63
- StyledTextArea,
64
- {
65
- innerRef: referenceSetter,
66
- "aria-multiline": true,
67
- $maxHeight: maxHeight,
68
- $minHeight: calculatedMinHeight,
69
- $hasVerticalOverflow: hasVerticalOverflow,
70
- onChange: handleOnChange,
71
- name,
72
- id,
73
- "data-testid": DSControlledLargetTextInputDatatestids.INPUT,
74
- rows: baseRows,
75
- "aria-describedby": id !== void 0 ? `${id}_feedback_message ${id}_error_message ${id}_remaining_characters` : void 0,
76
- "aria-invalid": hasError,
77
- "aria-disabled": applyAriaDisabled,
78
- ...globalAttributes,
79
- value: value === void 0 && applyAriaDisabled ? "" : value,
80
- readOnly,
81
- "aria-readonly": readOnly,
82
- ...ownerPropsConfig
83
- }
84
- ) }),
76
+ /* @__PURE__ */ jsxs(WrapperBorder, { $hasError: hasError, $isDisabled: otherProps.disabled, $isReadOnly: applyAriaDisabled || readOnly, children: [
77
+ /* @__PURE__ */ jsx(
78
+ StyledTextArea,
79
+ {
80
+ innerRef: referenceSetter,
81
+ "aria-multiline": true,
82
+ $maxHeight: maxHeight,
83
+ $minHeight: calculatedMinHeight,
84
+ $hasVerticalOverflow: hasVerticalOverflow,
85
+ onChange: handleOnChange,
86
+ name,
87
+ id,
88
+ "data-testid": DSControlledLargetTextInputDatatestids.INPUT,
89
+ rows: baseRows,
90
+ "aria-describedby": finalAriaDescribedBy,
91
+ "aria-invalid": hasError,
92
+ ...omitLockedHandlers(globalAttributes, isLocked, "change"),
93
+ "aria-disabled": resolveAriaDisabled({
94
+ disabled: otherProps.disabled,
95
+ softLocked: applyAriaDisabled || readOnly,
96
+ consumerValue: globalAttributes["aria-disabled"]
97
+ }),
98
+ value: value === void 0 && (applyAriaDisabled || readOnly) ? "" : value,
99
+ readOnly,
100
+ ...ownerPropsConfig
101
+ }
102
+ ),
103
+ readOnly ? /* @__PURE__ */ jsx("p", { hidden: true, id: readOnlyHelperId, children: "Read only" }) : null
104
+ ] }),
85
105
  /* @__PURE__ */ jsx(
86
106
  StyledTextArea,
87
107
  {
@@ -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 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"],
5
- "mappings": "AAAA,YAAY,WAAW;ACiEnB,SASI,KATJ;AAjEJ,SAAgB,aAAa,SAAS,QAAQ,UAAU,iBAAiB,iBAAiB;AAC1F;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B,SAAS,WAAW,oBAAoB;AACxC,SAAS,gBAAgB,iBAAiB,qBAAqB;AAC/D,SAAS,gCAAgC,8CAA8C;AAGvF,MAAM,6BAA6B,CAAC,UAA0D;AAC5F,QAAM,mBAAmB,6BAAwE,OAAO,YAAY;AACpH,iCAA+B,kBAAkB,WAAW,8BAA8B;AAE1F,QAAM,mBAAmB,cAAc,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,IAAI,uBAAuB,UAAU;AAEvG,QAAM,eAAe,mBAAmB,UAAU;AAClD,QAAM,WAAW,QAAQ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C,UAAU;AAAA,YACV,kBAAc;AAAA,YACd,YAAY;AAAA,YACZ,YAAY;AAAA,YACZ,sBAAsB;AAAA,YACtB,UAAU;AAAA,YACV;AAAA,YACA;AAAA,YACA,eAAa,uCAAuC;AAAA,YACpD,MAAM;AAAA,YACN,oBACE,OAAO,SAAY,GAAG,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,0BAA0B;AAAA,YAE/F,gBAAc;AAAA,YACd,iBAAe;AAAA,YACd,GAAG;AAAA,YAUJ,OAAO,UAAU,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,uCAAuC,SAAS,0BAA0B;AAChF,qCAAqC,YAAY;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo, useRef, useState, useLayoutEffect, useEffect } from 'react';\nimport {\n describe,\n useValidateTypescriptPropTypes,\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useGetXstyledProps,\n type ValidationMap,\n useOwnerProps,\n omitLockedHandlers,\n resolveAriaDisabled,\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';\nimport { useAriaDescribedBy } from './config/useAriaDescribedBy.js';\nimport { useTextareaInteractions } from './config/useTextareaInteractions.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 {\n className,\n rows,\n value: discardedVal,\n 'aria-describedby': consumerAriaDescribedBy,\n ...globalAttributes\n } = 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 { isLocked, handleOnChange } = useTextareaInteractions({\n disabled: otherProps.disabled,\n applyAriaDisabled,\n readOnly,\n onChange,\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 const { readOnlyHelperId, ariaDescribedBy: finalAriaDescribedBy } = useAriaDescribedBy({\n id,\n readOnly,\n consumerAriaDescribedBy,\n });\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={finalAriaDescribedBy}\n aria-invalid={hasError}\n {...omitLockedHandlers(globalAttributes, isLocked, 'change')}\n // after the spread: a soft lock prints \"true\" whatever the consumer passes, a natively disabled textarea prints none\n // of its own, otherwise the consumer's own aria-disabled passes through (inversion of control)\n aria-disabled={resolveAriaDisabled({\n disabled: otherProps.disabled,\n softLocked: applyAriaDisabled || readOnly,\n consumerValue: globalAttributes['aria-disabled'],\n })}\n // PUI-17313 - value === undefined && a soft lock (applyAriaDisabled or readOnly, the same lock) -> 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 soft locked 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 (a soft lock && value = undefined)\n value={value === undefined && (applyAriaDisabled || readOnly) ? '' : value}\n readOnly={readOnly}\n {...ownerPropsConfig}\n />\n {readOnly ? (\n <p hidden id={readOnlyHelperId}>\n Read only\n </p>\n ) : null}\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"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACwFjB,SACE,KADF;AAxFN,SAAgB,SAAS,QAAQ,UAAU,iBAAiB,iBAAiB;AAC7E;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B,SAAS,WAAW,oBAAoB;AACxC,SAAS,gBAAgB,iBAAiB,qBAAqB;AAC/D,SAAS,gCAAgC,8CAA8C;AAEvF,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AAExC,MAAM,6BAA6B,CAAC,UAA0D;AAC5F,QAAM,mBAAmB,6BAAwE,OAAO,YAAY;AACpH,iCAA+B,kBAAkB,WAAW,8BAA8B;AAE1F,QAAM,mBAAmB,cAAc,kBAAkB,EAAE,GAAG,MAAM,CAAC;AAErE,QAAM,EAAE,OAAO,UAAU,UAAU,UAAU,MAAM,IAAI,UAAU,WAAW,mBAAmB,GAAG,WAAW,IAC3G;AAEF,QAA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
7
7
  }
@@ -0,0 +1,16 @@
1
+ import * as React from "react";
2
+ import { useMemo } from "react";
3
+ import { uid } from "uid";
4
+ const useAriaDescribedBy = ({ id, readOnly, consumerAriaDescribedBy }) => {
5
+ const generatedId = useMemo(() => `ds-textarea-${uid()}`, []);
6
+ const readOnlyHelperId = useMemo(() => `${id || generatedId}-read-only-helper-msg`, [id, generatedId]);
7
+ const ariaDescribedBy = useMemo(() => {
8
+ const computed = consumerAriaDescribedBy ?? (id !== void 0 ? `${id}_feedback_message ${id}_error_message ${id}_remaining_characters` : void 0);
9
+ return [computed, readOnly ? readOnlyHelperId : void 0].filter(Boolean).join(" ") || void 0;
10
+ }, [consumerAriaDescribedBy, id, readOnly, readOnlyHelperId]);
11
+ return { readOnlyHelperId, ariaDescribedBy };
12
+ };
13
+ export {
14
+ useAriaDescribedBy
15
+ };
16
+ //# sourceMappingURL=useAriaDescribedBy.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useAriaDescribedBy.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo } from 'react';\nimport { uid } from 'uid';\n\nexport interface UseAriaDescribedByArgs {\n id?: string;\n readOnly?: boolean;\n consumerAriaDescribedBy?: string;\n}\n\nexport const useAriaDescribedBy = ({ id, readOnly, consumerAriaDescribedBy }: UseAriaDescribedByArgs) => {\n // uid is only a fallback; id is expected from the consumer, the helper id must be unique per instance\n // (uid, not React's useId: hosts that dedupe to React 17 do not have it). The prefix keeps the id starting with a\n // letter: a uid can start with a digit, which is a valid id but an invalid unescaped CSS selector (`#3fa2`)\n const generatedId = useMemo(() => `ds-textarea-${uid()}`, []);\n const readOnlyHelperId = useMemo(() => `${id || generatedId}-read-only-helper-msg`, [id, generatedId]);\n const ariaDescribedBy = useMemo(() => {\n // `${id}_feedback_message` and `${id}_error_message` are rendered by DSFormLayoutBlockItem (from its inputID),\n // not by the textarea; a consumer-provided raw aria-describedby replaces the computed ids (existing behavior)\n const computed =\n consumerAriaDescribedBy ??\n (id !== undefined ? `${id}_feedback_message ${id}_error_message ${id}_remaining_characters` : undefined);\n // readOnly appends the \"Read only\" helper id to whichever value wins\n return [computed, readOnly ? readOnlyHelperId : undefined].filter(Boolean).join(' ') || undefined;\n }, [consumerAriaDescribedBy, id, readOnly, readOnlyHelperId]);\n return { readOnlyHelperId, ariaDescribedBy };\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,eAAe;AACxB,SAAS,WAAW;AAQb,MAAM,qBAAqB,CAAC,EAAE,IAAI,UAAU,wBAAwB,MAA8B;AAIvG,QAAM,cAAc,QAAQ,MAAM,eAAe,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5D,QAAM,mBAAmB,QAAQ,MAAM,GAAG,MAAM,WAAW,yBAAyB,CAAC,IAAI,WAAW,CAAC;AACrG,QAAM,kBAAkB,QAAQ,MAAM;AAGpC,UAAM,WACJ,4BACC,OAAO,SAAY,GAAG,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,0BAA0B;AAEhG,WAAO,CAAC,UAAU,WAAW,mBAAmB,MAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,KAAK;AAAA,EAC1F,GAAG,CAAC,yBAAyB,IAAI,UAAU,gBAAgB,CAAC;AAC5D,SAAO,EAAE,kBAAkB,gBAAgB;AAC7C;",
6
+ "names": []
7
+ }
@@ -0,0 +1,23 @@
1
+ import * as React from "react";
2
+ import { useCallback } from "react";
3
+ import { isLocked } from "@elliemae/ds-props-helpers";
4
+ const useTextareaInteractions = ({
5
+ disabled,
6
+ applyAriaDisabled,
7
+ readOnly,
8
+ onChange
9
+ }) => {
10
+ const locked = isLocked({ disabled, applyAriaDisabled, readOnly });
11
+ const handleOnChange = useCallback(
12
+ (e) => {
13
+ if (locked) return;
14
+ onChange(e.currentTarget.value, e);
15
+ },
16
+ [locked, onChange]
17
+ );
18
+ return { isLocked: locked, handleOnChange };
19
+ };
20
+ export {
21
+ useTextareaInteractions
22
+ };
23
+ //# sourceMappingURL=useTextareaInteractions.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useTextareaInteractions.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport { useCallback } from 'react';\nimport { isLocked } from '@elliemae/ds-props-helpers';\n\nexport interface UseTextareaInteractionsArgs {\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n readOnly?: boolean;\n onChange: (value: string, e: React.KeyboardEvent<HTMLTextAreaElement>) => void;\n}\n\n// disabled, applyAriaDisabled and readOnly lock the field identically. While locked the consumer's onChange is not\n// invoked: a controlled textarea is put back by React, whatever path the edit took (keys, paste, drop, autofill, IME).\n// The consumer's action handlers are withheld by `omitLockedHandlers` on the global attributes spread.\nexport const useTextareaInteractions = ({\n disabled,\n applyAriaDisabled,\n readOnly,\n onChange,\n}: UseTextareaInteractionsArgs) => {\n const locked = isLocked({ disabled, applyAriaDisabled, readOnly });\n\n const handleOnChange = useCallback<React.KeyboardEventHandler<HTMLTextAreaElement>>(\n (e) => {\n if (locked) return;\n onChange(e.currentTarget.value, e);\n },\n [locked, onChange],\n );\n\n return { isLocked: locked, handleOnChange };\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AAYlB,MAAM,0BAA0B,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAmC;AACjC,QAAM,SAAS,SAAS,EAAE,UAAU,mBAAmB,SAAS,CAAC;AAEjE,QAAM,iBAAiB;AAAA,IACrB,CAAC,MAAM;AACL,UAAI,OAAQ;AACZ,eAAS,EAAE,cAAc,OAAO,CAAC;AAAA,IACnC;AAAA,IACA,CAAC,QAAQ,QAAQ;AAAA,EACnB;AAEA,SAAO,EAAE,UAAU,QAAQ,eAAe;AAC5C;",
6
+ "names": []
7
+ }
@@ -26,11 +26,13 @@ const propTypes = {
26
26
  id: PropTypes.string.description("Unique id."),
27
27
  innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description("Inner ref to the input."),
28
28
  disabled: PropTypes.bool.description("Set disabled state."),
29
- readOnly: PropTypes.bool.description("Set readonly state."),
29
+ readOnly: PropTypes.bool.description(
30
+ 'Soft lock, same as applyAriaDisabled: aria-disabled="true", CAN STILL RECEIVE FOCUS, WITHHOLDS THE CHANGE: onChange is not called and the value does not change. Clicks and keys are only observed (they still reach your handlers). Also announces "Read only" through a hidden description. Dimsum never writes aria-readonly.'
31
+ ),
30
32
  maxHeight: PropTypes.number.description("Set max height to resize input text"),
31
33
  hasError: PropTypes.bool.description("Set error state.").defaultValue(false),
32
34
  applyAriaDisabled: PropTypes.bool.description(
33
- "Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION."
35
+ "Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. WITHHOLDS THE CHANGE: onChange is not called and the value does not change. Clicks and keys are only observed (they still reach your handlers)."
34
36
  ).defaultValue(false)
35
37
  };
36
38
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n type GlobalAttributesT,\n type XstyledProps,\n} from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSControlledLargeTextInputName, DSControlledLargeTextInputSlots } from './exported-related/index.js';\n\nconst noop = () => {};\n\nexport declare namespace DSControlledLargeTextInputT {\n export interface DefaultProps {\n value: string;\n onChange: (newVal: string, event: React.SyntheticEvent<HTMLTextAreaElement>) => void;\n hasError: boolean;\n applyAriaDisabled: boolean;\n }\n\n export interface RequiredProps {}\n\n export interface PropsOptional extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSControlledLargeTextInputName,\n typeof DSControlledLargeTextInputSlots\n > {\n name?: string;\n id: string;\n rows?: string;\n disabled?: boolean;\n readOnly?: boolean;\n maxHeight?: number;\n innerRef?: React.MutableRefObject<HTMLTextAreaElement | null>;\n }\n\n export interface Props\n extends\n Partial<DefaultProps>,\n PropsOptional,\n RequiredProps,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof PropsOptional>,\n Omit<XstyledProps, keyof PropsOptional> {}\n\n export interface InternalProps\n extends\n DefaultProps,\n PropsOptional,\n RequiredProps,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof PropsOptional>,\n Omit<XstyledProps, keyof PropsOptional> {}\n}\n\nexport const defaultProps: DSControlledLargeTextInputT.DefaultProps = {\n value: '',\n onChange: noop,\n hasError: false,\n applyAriaDisabled: false,\n};\n\nexport const propTypes = {\n ...getPropsPerSlotPropTypes(DSControlledLargeTextInputName, DSControlledLargeTextInputSlots),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n value: PropTypes.string.description('Text are value.').defaultValue(''),\n onChange: PropTypes.func.description('OnChange cb.').defaultValue('() => {}'),\n rows: PropTypes.string.description(\n 'Sets the number of lines for the default height. Once lines are reached, scroll behavior enables.',\n ),\n id: PropTypes.string.description('Unique id.'),\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Inner ref to the input.'),\n disabled: PropTypes.bool.description('Set disabled state.'),\n readOnly: PropTypes.bool.description('Set readonly state.'),\n maxHeight: PropTypes.number.description('Set max height to resize input text'),\n hasError: PropTypes.bool.description('Set error state.').defaultValue(false),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue(false),\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACCvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAEP,SAAS,gCAAgC,uCAAuC;AAEhF,MAAM,OAAO,MAAM;AAAC;AA0Cb,MAAM,eAAyD;AAAA,EACpE,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,mBAAmB;AACrB;AAEO,MAAM,YAAY;AAAA,EACvB,GAAG,yBAAyB,gCAAgC,+BAA+B;AAAA,EAC3F,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO,UAAU,OAAO,YAAY,iBAAiB,EAAE,aAAa,EAAE;AAAA,EACtE,UAAU,UAAU,KAAK,YAAY,cAAc,EAAE,aAAa,UAAU;AAAA,EAC5E,MAAM,UAAU,OAAO;AAAA,IACrB;AAAA,EACF;AAAA,EACA,IAAI,UAAU,OAAO,YAAY,YAAY;AAAA,EAC7C,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,IAAI,CAAC,EAAE,YAAY,yBAAyB;AAAA,EACvG,UAAU,UAAU,KAAK,YAAY,qBAAqB;AAAA,EAC1D,UAAU,UAAU,KAAK,YAAY,qBAAqB;AAAA,EAC1D,WAAW,UAAU,OAAO,YAAY,qCAAqC;AAAA,EAC7E,UAAU,UAAU,KAAK,YAAY,kBAAkB,EAAE,aAAa,KAAK;AAAA,EAC3E,mBAAmB,UAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AACvB;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n type GlobalAttributesT,\n type XstyledProps,\n} from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSControlledLargeTextInputName, DSControlledLargeTextInputSlots } from './exported-related/index.js';\n\nconst noop = () => {};\n\nexport declare namespace DSControlledLargeTextInputT {\n export interface DefaultProps {\n value: string;\n onChange: (newVal: string, event: React.SyntheticEvent<HTMLTextAreaElement>) => void;\n hasError: boolean;\n applyAriaDisabled: boolean;\n }\n\n export interface RequiredProps {}\n\n export interface PropsOptional extends TypescriptHelpersT.PropsForGlobalOnSlots<\n typeof DSControlledLargeTextInputName,\n typeof DSControlledLargeTextInputSlots\n > {\n name?: string;\n id: string;\n rows?: string;\n disabled?: boolean;\n readOnly?: boolean;\n maxHeight?: number;\n innerRef?: React.MutableRefObject<HTMLTextAreaElement | null>;\n }\n\n export interface Props\n extends\n Partial<DefaultProps>,\n PropsOptional,\n RequiredProps,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof PropsOptional>,\n Omit<XstyledProps, keyof PropsOptional> {}\n\n export interface InternalProps\n extends\n DefaultProps,\n PropsOptional,\n RequiredProps,\n Omit<GlobalAttributesT, keyof DefaultProps | keyof PropsOptional>,\n Omit<XstyledProps, keyof PropsOptional> {}\n}\n\nexport const defaultProps: DSControlledLargeTextInputT.DefaultProps = {\n value: '',\n onChange: noop,\n hasError: false,\n applyAriaDisabled: false,\n};\n\nexport const propTypes = {\n ...getPropsPerSlotPropTypes(DSControlledLargeTextInputName, DSControlledLargeTextInputSlots),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n value: PropTypes.string.description('Text are value.').defaultValue(''),\n onChange: PropTypes.func.description('OnChange cb.').defaultValue('() => {}'),\n rows: PropTypes.string.description(\n 'Sets the number of lines for the default height. Once lines are reached, scroll behavior enables.',\n ),\n id: PropTypes.string.description('Unique id.'),\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Inner ref to the input.'),\n disabled: PropTypes.bool.description('Set disabled state.'),\n readOnly: PropTypes.bool.description(\n 'Soft lock, same as applyAriaDisabled: aria-disabled=\"true\", CAN STILL RECEIVE FOCUS, WITHHOLDS THE CHANGE: onChange is not called and the value does not change. Clicks and keys are only observed (they still reach your handlers). Also announces \"Read only\" through a hidden description. Dimsum never writes aria-readonly.',\n ),\n maxHeight: PropTypes.number.description('Set max height to resize input text'),\n hasError: PropTypes.bool.description('Set error state.').defaultValue(false),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. WITHHOLDS THE CHANGE: onChange is not called and the value does not change. Clicks and keys are only observed (they still reach your handlers).',\n )\n .defaultValue(false),\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACCvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAEP,SAAS,gCAAgC,uCAAuC;AAEhF,MAAM,OAAO,MAAM;AAAC;AA0Cb,MAAM,eAAyD;AAAA,EACpE,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,mBAAmB;AACrB;AAEO,MAAM,YAAY;AAAA,EACvB,GAAG,yBAAyB,gCAAgC,+BAA+B;AAAA,EAC3F,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO,UAAU,OAAO,YAAY,iBAAiB,EAAE,aAAa,EAAE;AAAA,EACtE,UAAU,UAAU,KAAK,YAAY,cAAc,EAAE,aAAa,UAAU;AAAA,EAC5E,MAAM,UAAU,OAAO;AAAA,IACrB;AAAA,EACF;AAAA,EACA,IAAI,UAAU,OAAO,YAAY,YAAY;AAAA,EAC7C,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,IAAI,CAAC,EAAE,YAAY,yBAAyB;AAAA,EACvG,UAAU,UAAU,KAAK,YAAY,qBAAqB;AAAA,EAC1D,UAAU,UAAU,KAAK;AAAA,IACvB;AAAA,EACF;AAAA,EACA,WAAW,UAAU,OAAO,YAAY,qCAAqC;AAAA,EAC7E,UAAU,UAAU,KAAK,YAAY,kBAAkB,EAAE,aAAa,KAAK;AAAA,EAC3E,mBAAmB,UAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AACvB;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { styled, xStyledCommonProps } from "@elliemae/ds-system";
2
+ import { styled, xStyledCommonProps, lockedStateInteractionCss } from "@elliemae/ds-system";
3
3
  import { DSControlledLargeTextInputName, DSControlledLargeTextInputSlots } from "./exported-related/index.js";
4
4
  const StyledContainer = styled("div", {
5
5
  name: DSControlledLargeTextInputName,
@@ -67,12 +67,10 @@ const StyledTextArea = styled("textarea", {
67
67
  overflow: hidden;
68
68
  background-color: ${theme.colors.neutral["080"]};
69
69
  color: ${theme.colors.neutral["500"]};
70
- cursor: not-allowed;
71
70
  ` : ""}
72
71
  &[aria-disabled='true'] {
73
72
  overflow: hidden;
74
73
  background-color: ${({ theme }) => theme.colors.neutral["050"]};
75
- cursor: text;
76
74
  caret-color: transparent;
77
75
  }
78
76
 
@@ -80,6 +78,7 @@ const StyledTextArea = styled("textarea", {
80
78
  if (rows === void 0 && $maxHeight === void 0) return "overflow: hidden;";
81
79
  return "";
82
80
  }}
81
+ ${lockedStateInteractionCss}
83
82
  `;
84
83
  export {
85
84
  StyledContainer,
@@ -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 $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,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;AAY1F,MAAM,iBAAiB,OAAO,YAAY;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,gCAAgC;AACxC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOG,CAAC,EAAE,qBAAqB,MAAO,uBAAuB,uBAAuB,EAAG;AAAA;AAAA,WAEzE,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,IACjD,CAAC,EAAE,WAAW,MAAO,aAAa,eAAe,UAAU,QAAQ,EAAG;AAAA,IACtE,CAAC,EAAE,WAAW,MAAO,aAAa,eAAe,UAAU,QAAQ,EAAG;AAAA,IACtE,CAAC,EAAE,UAAU,MAAM,MACnB,WACI;AAAA;AAAA,sBAEc,MAAM,OAAO,QAAQ,KAAK,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;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, xStyledCommonProps, lockedStateInteractionCss } 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 `\n : ''}\n &[aria-disabled='true'] {\n overflow: hidden;\n background-color: ${({ theme }) => theme.colors.neutral['050']};\n caret-color: transparent;\n }\n\n ${({ rows, $maxHeight }) => {\n if (rows === undefined && $maxHeight === undefined) return 'overflow: hidden;';\n return '';\n }}\n ${lockedStateInteractionCss}\n`;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,oBAAoB,iCAAiC;AACtE,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;AAY1F,MAAM,iBAAiB,OAAO,YAAY;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,gCAAgC;AACxC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOG,CAAC,EAAE,qBAAqB,MAAO,uBAAuB,uBAAuB,EAAG;AAAA;AAAA,WAEzE,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,IACjD,CAAC,EAAE,WAAW,MAAO,aAAa,eAAe,UAAU,QAAQ,EAAG;AAAA,IACtE,CAAC,EAAE,WAAW,MAAO,aAAa,eAAe,UAAU,QAAQ,EAAG;AAAA,IACtE,CAAC,EAAE,UAAU,MAAM,MACnB,WACI;AAAA;AAAA,sBAEc,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,WACtC,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,MAE9B,EAAE;AAAA;AAAA;AAAA,wBAGc,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA;AAAA;AAAA,IAI9D,CAAC,EAAE,MAAM,WAAW,MAAM;AAC1B,MAAI,SAAS,UAAa,eAAe,OAAW,QAAO;AAC3D,SAAO;AACT,CAAC;AAAA,IACC,yBAAyB;AAAA;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,9 @@
1
+ export interface UseAriaDescribedByArgs {
2
+ id?: string;
3
+ readOnly?: boolean;
4
+ consumerAriaDescribedBy?: string;
5
+ }
6
+ export declare const useAriaDescribedBy: ({ id, readOnly, consumerAriaDescribedBy }: UseAriaDescribedByArgs) => {
7
+ readOnlyHelperId: string;
8
+ ariaDescribedBy: string | undefined;
9
+ };
@@ -0,0 +1,11 @@
1
+ import type React from 'react';
2
+ export interface UseTextareaInteractionsArgs {
3
+ disabled?: boolean;
4
+ applyAriaDisabled?: boolean;
5
+ readOnly?: boolean;
6
+ onChange: (value: string, e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
7
+ }
8
+ export declare const useTextareaInteractions: ({ disabled, applyAriaDisabled, readOnly, onChange, }: UseTextareaInteractionsArgs) => {
9
+ isLocked: boolean;
10
+ handleOnChange: React.KeyboardEventHandler<HTMLTextAreaElement>;
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-form-input-textarea",
3
- "version": "3.80.0-next.71",
3
+ "version": "3.80.0-next.75",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Controlled Form Input Textarea",
6
6
  "files": [
@@ -36,12 +36,13 @@
36
36
  "indent": 4
37
37
  },
38
38
  "dependencies": {
39
- "@elliemae/ds-props-helpers": "3.80.0-next.71",
40
- "@elliemae/ds-system": "3.80.0-next.71"
39
+ "@elliemae/ds-props-helpers": "3.80.0-next.75",
40
+ "@elliemae/ds-system": "3.80.0-next.75",
41
+ "uid": "^2.0.2"
41
42
  },
42
43
  "devDependencies": {
43
- "@elliemae/ds-monorepo-devops": "3.80.0-next.71",
44
- "@elliemae/ds-test-utils": "3.80.0-next.71",
44
+ "@elliemae/ds-monorepo-devops": "3.80.0-next.75",
45
+ "@elliemae/ds-test-utils": "3.80.0-next.75",
45
46
  "@elliemae/pui-theme": "~2.13.0",
46
47
  "@xstyled/system": "~3.8.1",
47
48
  "jest": "^30.0.0",