@elliemae/ds-chat 1.61.8 → 1.61.10

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.
@@ -42,6 +42,7 @@ var ChatComposer = function ChatComposer(props) {
42
42
  placeholder = props.placeholder,
43
43
  inputMaxLength = props.inputMaxLength,
44
44
  maxLengthMessage = props.maxLengthMessage,
45
+ ariaMaxLengthMessage = props.ariaMaxLengthMessage,
45
46
  buttonDisabled = props.buttonDisabled,
46
47
  dataTestid = props.dataTestid,
47
48
  actionRef = props.actionRef;
@@ -157,7 +158,7 @@ var ChatComposer = function ChatComposer(props) {
157
158
  "data-testid": "composer-counter-area"
158
159
  }, inputMaxLength && hasError ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(parts_chatComposer_styled.StyledCounterErrorA11y, {
159
160
  role: "alert"
160
- }, maxLengthMessage || "You have entered ".concat(inputLength, " characters and have exceeded the limit by ").concat(inputLength - inputMaxLength, ". Please limit to less than ").concat(inputMaxLength, " characters. ")), maxLengthMessage || "Please limit to less than ".concat(inputMaxLength, " characters. ")) : '', inputMaxLength && !maxLengthMessage ? " ".concat(inputLength, " / ").concat(inputMaxLength) : ''), /*#__PURE__*/React__default['default'].createElement(dsGrid.Grid, null)));
161
+ }, ariaMaxLengthMessage || "You have entered ".concat(inputLength, " characters and have exceeded the limit by ").concat(inputLength - inputMaxLength, ". Please limit to less than ").concat(inputMaxLength, " characters. ")), maxLengthMessage || "Please limit to less than ".concat(inputMaxLength, " characters. ")) : '', inputMaxLength ? " ".concat(inputLength, " / ").concat(inputMaxLength) : ''), /*#__PURE__*/React__default['default'].createElement(dsGrid.Grid, null)));
161
162
  };
162
163
 
163
164
  ChatComposer.propTypes = parts_chatComposer_props.composerProps;
@@ -1 +1 @@
1
- {"version":3,"file":"ChatContainerComposer.js","sources":["../../../../src/parts/chat-composer/ChatContainerComposer.tsx"],"sourcesContent":["/* eslint-disable max-lines */\nimport React from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { describe } from 'react-desc';\nimport { PaperAirplane } from '@elliemae/ds-icons';\nimport {\n StyledChatContainerContentComposer,\n StyledComposerInput,\n StyledComposerButton,\n StyledCounterArea,\n StyledCounterErrorA11y,\n} from './styled';\nimport { useValidateProps } from './config/useValidateProps';\n\nimport { defaultComposerPros, composerProps, ChatComposerProps } from './props';\n\n// eslint-disable-next-line complexity\nconst ChatComposer = (props: ChatComposerProps): JSX.Element => {\n useValidateProps(props, ChatComposerWithSchema.toJSON());\n\n const {\n inputValue,\n onChange,\n onResize,\n onSend,\n onFocus,\n onBlur,\n onKeyDown,\n maxHeight = 300,\n placeholder,\n inputMaxLength,\n maxLengthMessage,\n buttonDisabled,\n dataTestid,\n actionRef,\n } = props;\n\n const COMPOSER_MIN_HEIGHT = 32;\n const input = React.useRef<HTMLTextAreaElement>();\n const inputSize = React.useRef<HTMLTextAreaElement>();\n const inputSend = React.useRef<HTMLButtonElement>();\n const [height, setHeight] = React.useState(32);\n const internalMaxHeight = React.useMemo(() => maxHeight - 24, [maxHeight]);\n const [showScroll, setShowScroll] = React.useState(true);\n\n React.useEffect(() => {\n const newHeight =\n inputSize.current?.scrollHeight > internalMaxHeight ? internalMaxHeight : inputSize.current?.scrollHeight;\n if (newHeight !== height && newHeight > COMPOSER_MIN_HEIGHT) onResize(newHeight);\n setHeight(newHeight);\n setShowScroll(inputSize.current?.scrollHeight - inputSize.current?.clientHeight > 5);\n }, [inputValue, internalMaxHeight, height, onResize]);\n\n React.useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusToComposer = () => {\n input.current.focus();\n };\n actionRef.current.focusToSend = () => {\n inputSend.current.focus();\n };\n }\n }, [actionRef]);\n\n const handleChange = React.useCallback(\n (e) => {\n onChange(e.target.value);\n },\n [onChange],\n );\n const heightProps = { height, overflow: showScroll ? 'auto' : 'hidden' };\n\n const inputLength = String(inputValue || '').length;\n const hasError = React.useMemo(() => inputLength > inputMaxLength, [inputLength, inputMaxLength]);\n return (\n <StyledChatContainerContentComposer rows={['auto', '15px']} maxHeight={`${maxHeight}px`} data-testid={dataTestid}>\n <Grid\n cols={['1fr', '24px']}\n style={{ height: heightProps.height }}\n justifyContent=\"center\"\n alignItems=\"flex-end\"\n gutter=\"xxs\"\n >\n <StyledComposerInput\n ref={input}\n onChange={handleChange}\n style={{ ...heightProps }}\n value={inputValue}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n aria-label=\"Message to send\"\n data-testid=\"chat-composer-textarea\"\n name=\"chat-composer-textarea\"\n id=\"chat-composer-textarea\"\n />\n\n <Grid height=\"32px\" alignItems=\"center\">\n <StyledComposerButton\n buttonType=\"text\"\n icon={<PaperAirplane width={18} height={18} />}\n onClick={onSend}\n size=\"s\"\n disabled={!inputValue || buttonDisabled || hasError}\n data-testid=\"chat-composer-send-button\"\n aria-label=\"Send\"\n innerRef={inputSend}\n />\n </Grid>\n </Grid>\n <StyledComposerInput\n ref={inputSize}\n style={{\n height: 32,\n visibility: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n top: 0,\n width: input.current?.clientWidth,\n }}\n onChange={handleChange}\n value={inputValue}\n />\n <Grid cols={['1fr', '24px']} justifyContent=\"flex-end\" alignItems=\"center\" gutter=\"xxs\" pb=\"xxs\">\n <StyledCounterArea hasError={hasError} data-testid=\"composer-counter-area\">\n {inputMaxLength && hasError ? (\n <>\n <StyledCounterErrorA11y role=\"alert\">\n {maxLengthMessage ||\n `You have entered ${inputLength} characters and have exceeded the limit by ${\n inputLength - inputMaxLength\n }. Please limit to less than ${inputMaxLength} characters. `}\n </StyledCounterErrorA11y>\n {maxLengthMessage || `Please limit to less than ${inputMaxLength} characters. `}\n </>\n ) : (\n ''\n )}\n {inputMaxLength && !maxLengthMessage ? ` ${inputLength} / ${inputMaxLength}` : ''}\n </StyledCounterArea>\n <Grid />\n </Grid>\n </StyledChatContainerContentComposer>\n );\n};\n\nChatComposer.propTypes = composerProps;\nChatComposer.defaultProps = defaultComposerPros;\nconst ChatComposerWithSchema = describe(ChatComposer);\nChatComposerWithSchema.propTypes = composerProps;\n\nexport { ChatComposer, ChatComposerWithSchema };\n"],"names":["ChatComposer","props","useValidateProps","ChatComposerWithSchema","toJSON","inputValue","onChange","onResize","onSend","onFocus","onBlur","onKeyDown","maxHeight","placeholder","inputMaxLength","maxLengthMessage","buttonDisabled","dataTestid","actionRef","COMPOSER_MIN_HEIGHT","input","React","useRef","inputSize","inputSend","useState","height","setHeight","internalMaxHeight","useMemo","showScroll","setShowScroll","useEffect","newHeight","current","scrollHeight","clientHeight","focusToComposer","focus","focusToSend","handleChange","useCallback","e","target","value","heightProps","overflow","inputLength","String","length","hasError","StyledChatContainerContentComposer","Grid","StyledComposerInput","StyledComposerButton","PaperAirplane","visibility","pointerEvents","position","top","width","clientWidth","StyledCounterArea","StyledCounterErrorA11y","propTypes","composerProps","defaultProps","defaultComposerPros","describe"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiBMA,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAA2C;AAAA;;AAC9DC,EAAAA,2DAAgB,CAACD,KAAD,EAAQE,sBAAsB,CAACC,MAAvB,EAAR,CAAhB;AAEA,MACEC,UADF,GAeIJ,KAfJ,CACEI,UADF;AAAA,MAEEC,QAFF,GAeIL,KAfJ,CAEEK,QAFF;AAAA,MAGEC,QAHF,GAeIN,KAfJ,CAGEM,QAHF;AAAA,MAIEC,MAJF,GAeIP,KAfJ,CAIEO,MAJF;AAAA,MAKEC,OALF,GAeIR,KAfJ,CAKEQ,OALF;AAAA,MAMEC,MANF,GAeIT,KAfJ,CAMES,MANF;AAAA,MAOEC,SAPF,GAeIV,KAfJ,CAOEU,SAPF;AAAA,yBAeIV,KAfJ,CAQEW,SARF;AAAA,MAQEA,SARF,iCAQc,GARd;AAAA,MASEC,WATF,GAeIZ,KAfJ,CASEY,WATF;AAAA,MAUE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AE,UAJL;AAKLC,MAAAA,GAAG,EAAE,CALA;AAMLC,MAAAA,KAAK,oBAAExC,KAAK,CAACc,OAAR,mDAAE,eAAe2B;AANjB,KAFT;AAUE,IAAA,QAAQ,EAAErB,YAVZ;AAWE,IAAA,KAAK,EAAEnC;AAXT,IApCF,eAiDEgB,wCAAC+B,WAAD;AAAM,IAAA,IAAI,EAAE,CAAC,KAAD,EAAQ,MAAR,CAAZ;AAA6B,IAAA,cAAc,EAAC,UAA5C;AAAuD,IAAA,UAAU,EAAC,QAAlE;AAA2E,IAAA,MAAM,EAAC,KAAlF;AAAwF,IAAA,EAAE,EAAC;AAA3F,kBACE/B,wCAACyC,2CAAD;AAAmB,IAAA,QAAQ,EAAEZ,QAA7B;AAAuC,mBAAY;AAAnD,KACGpC,cAAc,IAAIoC,QAAlB,gBACC7B,+FACEA,wCAAC0C,gDAAD;AAAwB,IAAA,IAAI,EAAC;AAA7B,KACGhD,gBAAgB,+BACKgC,WADL,wDAEbA,WAAW,GAAGjC,cAFD,yCAGgBA,cAHhB,kBADnB,CADF,EAOGC,gBAAgB,wCAAiCD,cAAjC,kBAPnB,CADD,GAWC,EAZJ,EAcGA,cAAc,IAAI,CAACC,gBAAnB,cAA0CgC,WAA1C,gBAA2DjC,cAA3D,IAA8E,EAdjF,CADF,eAiBEO,wCAAC+B,WAAD,OAjBF,CAjDF,CADF;AAuED;;AAEDpD,YAAY,CAACgE,SAAb,GAAyBC,sCAAzB;AACAjE,YAAY,CAACkE,YAAb,GAA4BC,4CAA5B;IACMhE,sBAAsB,GAAGiE,kBAAQ,CAACpE,YAAD;AACvCG,sBAAsB,CAAC6D,SAAvB,GAAmCC,sCAAnC;;;;;"}
1
+ {"version":3,"file":"ChatContainerComposer.js","sources":["../../../../src/parts/chat-composer/ChatContainerComposer.tsx"],"sourcesContent":["/* eslint-disable max-lines */\nimport React from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { describe } from 'react-desc';\nimport { PaperAirplane } from '@elliemae/ds-icons';\nimport {\n StyledChatContainerContentComposer,\n StyledComposerInput,\n StyledComposerButton,\n StyledCounterArea,\n StyledCounterErrorA11y,\n} from './styled';\nimport { useValidateProps } from './config/useValidateProps';\n\nimport { defaultComposerPros, composerProps, ChatComposerProps } from './props';\n\n// eslint-disable-next-line complexity\nconst ChatComposer = (props: ChatComposerProps): JSX.Element => {\n useValidateProps(props, ChatComposerWithSchema.toJSON());\n\n const {\n inputValue,\n onChange,\n onResize,\n onSend,\n onFocus,\n onBlur,\n onKeyDown,\n maxHeight = 300,\n placeholder,\n inputMaxLength,\n maxLengthMessage,\n ariaMaxLengthMessage,\n buttonDisabled,\n dataTestid,\n actionRef,\n } = props;\n\n const COMPOSER_MIN_HEIGHT = 32;\n const input = React.useRef<HTMLTextAreaElement>();\n const inputSize = React.useRef<HTMLTextAreaElement>();\n const inputSend = React.useRef<HTMLButtonElement>();\n const [height, setHeight] = React.useState(32);\n const internalMaxHeight = React.useMemo(() => maxHeight - 24, [maxHeight]);\n const [showScroll, setShowScroll] = React.useState(true);\n\n React.useEffect(() => {\n const newHeight =\n inputSize.current?.scrollHeight > internalMaxHeight ? internalMaxHeight : inputSize.current?.scrollHeight;\n if (newHeight !== height && newHeight > COMPOSER_MIN_HEIGHT) onResize(newHeight);\n setHeight(newHeight);\n setShowScroll(inputSize.current?.scrollHeight - inputSize.current?.clientHeight > 5);\n }, [inputValue, internalMaxHeight, height, onResize]);\n\n React.useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusToComposer = () => {\n input.current.focus();\n };\n actionRef.current.focusToSend = () => {\n inputSend.current.focus();\n };\n }\n }, [actionRef]);\n\n const handleChange = React.useCallback(\n (e) => {\n onChange(e.target.value);\n },\n [onChange],\n );\n const heightProps = { height, overflow: showScroll ? 'auto' : 'hidden' };\n\n const inputLength = String(inputValue || '').length;\n const hasError = React.useMemo(() => inputLength > inputMaxLength, [inputLength, inputMaxLength]);\n return (\n <StyledChatContainerContentComposer rows={['auto', '15px']} maxHeight={`${maxHeight}px`} data-testid={dataTestid}>\n <Grid\n cols={['1fr', '24px']}\n style={{ height: heightProps.height }}\n justifyContent=\"center\"\n alignItems=\"flex-end\"\n gutter=\"xxs\"\n >\n <StyledComposerInput\n ref={input}\n onChange={handleChange}\n style={{ ...heightProps }}\n value={inputValue}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n aria-label=\"Message to send\"\n data-testid=\"chat-composer-textarea\"\n name=\"chat-composer-textarea\"\n id=\"chat-composer-textarea\"\n />\n\n <Grid height=\"32px\" alignItems=\"center\">\n <StyledComposerButton\n buttonType=\"text\"\n icon={<PaperAirplane width={18} height={18} />}\n onClick={onSend}\n size=\"s\"\n disabled={!inputValue || buttonDisabled || hasError}\n data-testid=\"chat-composer-send-button\"\n aria-label=\"Send\"\n innerRef={inputSend}\n />\n </Grid>\n </Grid>\n <StyledComposerInput\n ref={inputSize}\n style={{\n height: 32,\n visibility: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n top: 0,\n width: input.current?.clientWidth,\n }}\n onChange={handleChange}\n value={inputValue}\n />\n <Grid cols={['1fr', '24px']} justifyContent=\"flex-end\" alignItems=\"center\" gutter=\"xxs\" pb=\"xxs\">\n <StyledCounterArea hasError={hasError} data-testid=\"composer-counter-area\">\n {inputMaxLength && hasError ? (\n <>\n <StyledCounterErrorA11y role=\"alert\">\n {ariaMaxLengthMessage ||\n `You have entered ${inputLength} characters and have exceeded the limit by ${\n inputLength - inputMaxLength\n }. Please limit to less than ${inputMaxLength} characters. `}\n </StyledCounterErrorA11y>\n {maxLengthMessage || `Please limit to less than ${inputMaxLength} characters. `}\n </>\n ) : (\n ''\n )}\n {inputMaxLength ? ` ${inputLength} / ${inputMaxLength}` : ''}\n </StyledCounterArea>\n <Grid />\n </Grid>\n </StyledChatContainerContentComposer>\n );\n};\n\nChatComposer.propTypes = composerProps;\nChatComposer.defaultProps = defaultComposerPros;\nconst ChatComposerWithSchema = describe(ChatComposer);\nChatComposerWithSchema.propTypes = composerProps;\n\nexport { ChatComposer, ChatComposerWithSchema };\n"],"names":["ChatComposer","props","useValidateProps","ChatComposerWithSchema","toJSON","inputValue","onChange","onResize","onSend","onFocus","onBlur","onKeyDown","maxHeight","placeholder","inputMaxLength","maxLengthMessage","ariaMaxLengthMessage","buttonDisabled","dataTestid","actionRef","COMPOSER_MIN_HEIGHT","input","React","useRef","inputSize","inputSend","useState","height","setHeight","internalMaxHeight","useMemo","showScroll","setShowScroll","useEffect","newHeight","current","scrollHeight","clientHeight","focusToComposer","focus","focusToSend","handleChange","useCallback","e","target","value","heightProps","overflow","inputLength","String","length","hasError","StyledChatContainerContentComposer","Grid","StyledComposerInput","StyledComposerButton","PaperAirplane","visibility","pointerEvents","position","top","width","clientWidth","StyledCounterArea","StyledCounterErrorA11y","propTypes","composerProps","defaultProps","defaultComposerPros","describe"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiBMA,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAA2C;AAAA;;AAC9DC,EAAAA,2DAAgB,CAACD,KAAD,EAAQE,sBAAsB,CAACC,MAAvB,EAAR,CAAhB;AAEA,MACEC,UADF,GAgBIJ,KAhBJ,CACEI,UADF;AAAA,MAEEC,QAFF,GAgBIL,KAhBJ,CAEEK,QAFF;AAAA,MAGEC,QAHF,GAgBIN,KAhBJ,CAGEM,QAHF;AAAA,MAIEC,MAJF,GAgBIP,KAhBJ,CAIEO,MAJF;AAAA,MAKEC,OALF,GAgBIR,KAhBJ,CAKEQ,OALF;AAAA,MAMEC,MANF,GAgBIT,KAhBJ,CAMES,MANF;AAAA,MAOEC,SAPF,GAgBIV,KAhBJ,CAOEU,SAPF;AAAA,yBAgBIV,KAhBJ,CAQEW,SARF;AAAA,MAQEA,SARF,iCAQc,GARd;AAAA,MASEC,WATF,GAgBIZ,KAhBJ,CASEY,WATF;AAAA,MAUEC,cAVF,GAgBIb,KAhBJ,CAUEa,cAVF;A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AAILC,MAAAA,QAAQ,EAAE,UAJL;AAKLC,MAAAA,GAAG,EAAE,CALA;AAMLC,MAAAA,KAAK,oBAAExC,KAAK,CAACc,OAAR,mDAAE,eAAe2B;AANjB,KAFT;AAUE,IAAA,QAAQ,EAAErB,YAVZ;AAWE,IAAA,KAAK,EAAEpC;AAXT,IApCF,eAiDEiB,wCAAC+B,WAAD;AAAM,IAAA,IAAI,EAAE,CAAC,KAAD,EAAQ,MAAR,CAAZ;AAA6B,IAAA,cAAc,EAAC,UAA5C;AAAuD,IAAA,UAAU,EAAC,QAAlE;AAA2E,IAAA,MAAM,EAAC,KAAlF;AAAwF,IAAA,EAAE,EAAC;AAA3F,kBACE/B,wCAACyC,2CAAD;AAAmB,IAAA,QAAQ,EAAEZ,QAA7B;AAAuC,mBAAY;AAAnD,KACGrC,cAAc,IAAIqC,QAAlB,gBACC7B,+FACEA,wCAAC0C,gDAAD;AAAwB,IAAA,IAAI,EAAC;AAA7B,KACGhD,oBAAoB,+BACCgC,WADD,wDAEjBA,WAAW,GAAGlC,cAFG,yCAGYA,cAHZ,kBADvB,CADF,EAOGC,gBAAgB,wCAAiCD,cAAjC,kBAPnB,CADD,GAWC,EAZJ,EAcGA,cAAc,cAAOkC,WAAP,gBAAwBlC,cAAxB,IAA2C,EAd5D,CADF,eAiBEQ,wCAAC+B,WAAD,OAjBF,CAjDF,CADF;AAuED;;AAEDrD,YAAY,CAACiE,SAAb,GAAyBC,sCAAzB;AACAlE,YAAY,CAACmE,YAAb,GAA4BC,4CAA5B;IACMjE,sBAAsB,GAAGkE,kBAAQ,CAACrE,YAAD;AACvCG,sBAAsB,CAAC8D,SAAvB,GAAmCC,sCAAnC;;;;;"}
@@ -8,6 +8,7 @@ var lodash = require('lodash');
8
8
  var defaultComposerPros = {
9
9
  placeholder: 'Type your message',
10
10
  inputValue: '',
11
+ ariaMaxLengthMessage: '',
11
12
  onChange: lodash.noop,
12
13
  onResize: lodash.noop,
13
14
  onSend: lodash.noop,
@@ -24,6 +25,7 @@ var defaultComposerPros = {
24
25
  var composerProps = {
25
26
  placeholder: reactDesc.PropTypes.string.description('Input Placeholder').defaultValue(defaultComposerPros.placeholder),
26
27
  inputValue: reactDesc.PropTypes.string.description('Input value').defaultValue(defaultComposerPros.inputValue),
28
+ ariaMaxLengthMessage: reactDesc.PropTypes.string.description('Aria message for Max length message when exceeded').defaultValue(defaultComposerPros.maxLengthMessage),
27
29
  maxLengthMessage: reactDesc.PropTypes.string.description('Max length message').defaultValue(defaultComposerPros.maxLengthMessage),
28
30
  onChange: reactDesc.PropTypes.func.description('Called when the user types').defaultValue(defaultComposerPros.onChange),
29
31
  onResize: reactDesc.PropTypes.func.description('Called the input changes his height').defaultValue(defaultComposerPros.onResize),
@@ -1 +1 @@
1
- {"version":3,"file":"props.js","sources":["../../../../src/parts/chat-composer/props.tsx"],"sourcesContent":["import React from 'react';\nimport { PropTypes } from 'react-desc';\nimport { noop } from 'lodash';\n\nexport interface TextAreaProps {\n height: string | number;\n style: React.CSSProperties;\n}\n\nexport const defaultComposerPros: ChatComposerProps = {\n placeholder: 'Type your message',\n inputValue: '',\n onChange: noop,\n onResize: noop,\n onSend: noop,\n onFocus: noop,\n onBlur: noop,\n onKeyDown: noop,\n maxHeight: 0,\n inputMaxLength: undefined,\n maxLengthMessage: undefined,\n buttonDisabled: false,\n dataTestid: 'ds-chat-composer',\n actionRef: noop,\n};\n\nexport interface ChatComposerProps {\n placeholder?: string;\n inputValue?: string;\n maxLengthMessage?: string;\n onChange: (value: string) => void;\n onResize?: (value: number) => void;\n onSend: (value: string) => void;\n onFocus?: (e: React.ChangeEvent<HTMLTextAreaElement>, value: string) => void;\n onBlur?: (e: React.ChangeEvent<HTMLTextAreaElement>, value: string) => void;\n onKeyDown?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;\n maxHeight?: number;\n inputMaxLength: number | undefined;\n buttonDisabled: boolean;\n dataTestid?: string;\n actionRef: PropTypes.func;\n}\n\nexport const composerProps = {\n placeholder: PropTypes.string.description('Input Placeholder').defaultValue(defaultComposerPros.placeholder),\n inputValue: PropTypes.string.description('Input value').defaultValue(defaultComposerPros.inputValue),\n maxLengthMessage: PropTypes.string\n .description('Max length message')\n .defaultValue(defaultComposerPros.maxLengthMessage),\n onChange: PropTypes.func.description('Called when the user types').defaultValue(defaultComposerPros.onChange),\n onResize: PropTypes.func\n .description('Called the input changes his height')\n .defaultValue(defaultComposerPros.onResize),\n onSend: PropTypes.func.description('Called when the click send').defaultValue(defaultComposerPros.onSend),\n onFocus: PropTypes.func.description('Input focus').defaultValue(defaultComposerPros.onFocus),\n onBlur: PropTypes.func.description('Input blur').defaultValue(defaultComposerPros.onBlur),\n onKeyDown: PropTypes.func.description('Input on key down').defaultValue(defaultComposerPros.onKeyDown),\n maxHeight: PropTypes.number\n .description('Max height of the composer. Use 0 for no limit')\n .defaultValue(defaultComposerPros.onBlur),\n inputMaxLength: PropTypes.number\n .description('Max length of the composer. `undefined` for no limit')\n .defaultValue(defaultComposerPros.inputMaxLength),\n buttonDisabled: PropTypes.bool\n .description('Control the disabled for the send button')\n .defaultValue(defaultComposerPros.buttonDisabled),\n dataTestid: PropTypes.string.description('Data testid').defaultValue(defaultComposerPros.placeholder),\n actionRef: PropTypes.object\n .description(\n `Reference: \n { \n scrollToIndex: (n: number) => void,\n getMessagesInView: () => number[],\n focusToIndex: (n: number) => void,\n focusToList: () => void,\n focusToComposer: () => void,\n focusToSend: () => void,\n }\n \n `,\n )\n .defaultValue(defaultComposerPros.actionRef),\n};\n"],"names":["defaultComposerPros","placeholder","inputValue","onChange","noop","onResize","onSend","onFocus","onBlur","onKeyDown","maxHeight","inputMaxLength","undefined","maxLengthMessage","buttonDisabled","dataTestid","actionRef","composerProps","PropTypes","string","description","defaultValue","func","number","bool","object"],"mappings":";;;;;;;IASaA,mBAAsC,GAAG;AACpDC,EAAAA,WAAW,EAAE,mBADuC;AAEpDC,EAAAA,UAAU,EAAE,EAFwC;AAGpDC,EAAAA,QAAQ,EA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S,CAACI,IAAV,CAAeF,WAAf,CAA2B,aAA3B,EAA0CC,YAA1C,CAAuDrB,mBAAmB,CAACO,OAA3E,CAXkB;AAY3BC,EAAAA,MAAM,EAAEU,mBAAS,CAACI,IAAV,CAAeF,WAAf,CAA2B,YAA3B,EAAyCC,YAAzC,CAAsDrB,mBAAmB,CAACQ,MAA1E,CAZmB;AAa3BC,EAAAA,SAAS,EAAES,mBAAS,CAACI,IAAV,CAAeF,WAAf,CAA2B,mBAA3B,EAAgDC,YAAhD,CAA6DrB,mBAAmB,CAACS,SAAjF,CAbgB;AAc3BC,EAAAA,SAAS,EAAEQ,mBAAS,CAACK,MAAV,CACRH,WADQ,CACI,gDADJ,EAERC,YAFQ,CAEKrB,mBAAmB,CAACQ,MAFzB,CAdgB;AAiB3BG,EAAAA,cAAc,EAAEO,mBAAS,CAACK,MAAV,CACbH,WADa,CACD,sDADC,EAEbC,YAFa,CAEArB,mBAAmB,CAACW,cAFpB,CAjBW;AAoB3BG,EAAAA,cAAc,EAAEI,mBAAS,CAACM,IAAV,CACbJ,WADa,CACD,0CADC,EAEbC,YAFa,CAEArB,mBAAmB,CAACc,cAFpB,CApBW;AAuB3BC,EAAAA,UAAU,EAAEG,mBAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,aAA7B,EAA4CC,YAA5C,CAAyDrB,mBAAmB,CAACC,WAA7E,CAvBe;AAwB3Be,EAAAA,SAAS,EAAEE,mBAAS,CAACO,MAAV,CACRL,WADQ,oTAcRC,YAdQ,CAcKrB,mBAAmB,CAACgB,SAdzB;AAxBgB;;;;;"}
1
+ {"version":3,"file":"props.js","sources":["../../../../src/parts/chat-composer/props.tsx"],"sourcesContent":["import React from 'react';\nimport { PropTypes } from 'react-desc';\nimport { noop } from 'lodash';\n\nexport interface TextAreaProps {\n height: string | number;\n style: React.CSSProperties;\n}\n\nexport const defaultComposerPros: ChatComposerProps = {\n placeholder: 'Type your message',\n inputValue: '',\n ariaMaxLengthMessage: '',\n onChange: noop,\n onResize: noop,\n onSend: noop,\n onFocus: noop,\n onBlur: noop,\n onKeyDown: noop,\n maxHeight: 0,\n inputMaxLength: undefined,\n maxLengthMessage: undefined,\n buttonDisabled: false,\n dataTestid: 'ds-chat-composer',\n actionRef: noop,\n};\n\nexport interface ChatComposerProps {\n placeholder?: string;\n inputValue?: string;\n ariaMaxLengthMessage?: string;\n maxLengthMessage?: string;\n onChange: (value: string) => void;\n onResize?: (value: number) => void;\n onSend: (value: string) => void;\n onFocus?: (e: React.ChangeEvent<HTMLTextAreaElement>, value: string) => void;\n onBlur?: (e: React.ChangeEvent<HTMLTextAreaElement>, value: string) => void;\n onKeyDown?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;\n maxHeight?: number;\n inputMaxLength: number | undefined;\n buttonDisabled: boolean;\n dataTestid?: string;\n actionRef: PropTypes.func;\n}\n\nexport const composerProps = {\n placeholder: PropTypes.string.description('Input Placeholder').defaultValue(defaultComposerPros.placeholder),\n inputValue: PropTypes.string.description('Input value').defaultValue(defaultComposerPros.inputValue),\n ariaMaxLengthMessage: PropTypes.string\n .description('Aria message for Max length message when exceeded')\n .defaultValue(defaultComposerPros.maxLengthMessage),\n maxLengthMessage: PropTypes.string\n .description('Max length message')\n .defaultValue(defaultComposerPros.maxLengthMessage),\n onChange: PropTypes.func.description('Called when the user types').defaultValue(defaultComposerPros.onChange),\n onResize: PropTypes.func\n .description('Called the input changes his height')\n .defaultValue(defaultComposerPros.onResize),\n onSend: PropTypes.func.description('Called when the click send').defaultValue(defaultComposerPros.onSend),\n onFocus: PropTypes.func.description('Input focus').defaultValue(defaultComposerPros.onFocus),\n onBlur: PropTypes.func.description('Input blur').defaultValue(defaultComposerPros.onBlur),\n onKeyDown: PropTypes.func.description('Input on key down').defaultValue(defaultComposerPros.onKeyDown),\n maxHeight: PropTypes.number\n .description('Max height of the composer. Use 0 for no limit')\n .defaultValue(defaultComposerPros.onBlur),\n inputMaxLength: PropTypes.number\n .description('Max length of the composer. `undefined` for no limit')\n .defaultValue(defaultComposerPros.inputMaxLength),\n buttonDisabled: PropTypes.bool\n .description('Control the disabled for the send button')\n .defaultValue(defaultComposerPros.buttonDisabled),\n dataTestid: PropTypes.string.description('Data testid').defaultValue(defaultComposerPros.placeholder),\n actionRef: PropTypes.object\n .description(\n `Reference: \n { \n scrollToIndex: (n: number) => void,\n getMessagesInView: () => number[],\n focusToIndex: (n: number) => void,\n focusToList: () => void,\n focusToComposer: () => void,\n focusToSend: () => void,\n }\n \n `,\n )\n .defaultValue(defaultComposerPros.actionRef),\n};\n"],"names":["defaultComposerPros","placeholder","inputValue","ariaMaxLengthMessage","onChange","noop","onResize","onSend","onFocus","onBlur","onKeyDown","maxHeight","inputMaxLength","undefined","maxLengthMessage","buttonDisabled","dataTestid","actionRef","composerProps","PropTypes","string","description","defaultValue","func","number","bool","object"],"mappings":";;;;;;;IASaA,mBAAsC,GAAG;AACpDC,EAAAA,WAAW,EAAE,mBADuC;AAEpDC,EAAAA,UAAU,EAAE,EAFwC;AAGpDC,EAAAA,oBAAoB,EAAE,EAH8B;AAIpDC,EAAAA,QAAQ,EAAEC,WAJ0C;AAKpDC,EAAAA,QAAQ,EAAED,WAL0C;AAMpDE,EAAAA,MAAM,EAAEF,WAN4C;AAOpDG,EAAAA,OAAO,EAAEH,WAP2C;AAQpDI,EAAAA,MAAM,EAAEJ,WAR4C;AASpDK,EAAAA,SAAS,EAAEL,WATyC;AAUpDM,EAAAA,SAAS,EAAE,CAVyC;AAWpDC,EAAAA,cAAc,EAAEC,SAXoC;AAYpDC,EAAAA,gBAAgB,EAAED,SAZkC;AAapDE,EAAAA,cAAc,EAAE,KAboC;AAcpDC,EAAAA,UAAU,EAAE,kBAdwC;AAepDC,EAAAA,SAAS,EAAEZ;AAfyC;IAoCzCa,aAAa,GAAG;AAC3BjB,EAAAA,WAAW,EAAEkB,mBAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,mBAA7B,EAAkDC,YAAlD,CAA+DtB,mBAAmB,CA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,CACI,gDADJ,EAERC,YAFQ,CAEKtB,mBAAmB,CAACS,MAFzB,CAjBgB;AAoB3BG,EAAAA,cAAc,EAAEO,mBAAS,CAACK,MAAV,CACbH,WADa,CACD,sDADC,EAEbC,YAFa,CAEAtB,mBAAmB,CAACY,cAFpB,CApBW;AAuB3BG,EAAAA,cAAc,EAAEI,mBAAS,CAACM,IAAV,CACbJ,WADa,CACD,0CADC,EAEbC,YAFa,CAEAtB,mBAAmB,CAACe,cAFpB,CAvBW;AA0B3BC,EAAAA,UAAU,EAAEG,mBAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,aAA7B,EAA4CC,YAA5C,CAAyDtB,mBAAmB,CAACC,WAA7E,CA1Be;AA2B3BgB,EAAAA,SAAS,EAAEE,mBAAS,CAACO,MAAV,CACRL,WADQ,oTAcRC,YAdQ,CAcKtB,mBAAmB,CAACiB,SAdzB;AA3BgB;;;;;"}
@@ -32,6 +32,7 @@ var ChatComposer = function ChatComposer(props) {
32
32
  placeholder = props.placeholder,
33
33
  inputMaxLength = props.inputMaxLength,
34
34
  maxLengthMessage = props.maxLengthMessage,
35
+ ariaMaxLengthMessage = props.ariaMaxLengthMessage,
35
36
  buttonDisabled = props.buttonDisabled,
36
37
  dataTestid = props.dataTestid,
37
38
  actionRef = props.actionRef;
@@ -147,7 +148,7 @@ var ChatComposer = function ChatComposer(props) {
147
148
  "data-testid": "composer-counter-area"
148
149
  }, inputMaxLength && hasError ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledCounterErrorA11y, {
149
150
  role: "alert"
150
- }, maxLengthMessage || "You have entered ".concat(inputLength, " characters and have exceeded the limit by ").concat(inputLength - inputMaxLength, ". Please limit to less than ").concat(inputMaxLength, " characters. ")), maxLengthMessage || "Please limit to less than ".concat(inputMaxLength, " characters. ")) : '', inputMaxLength && !maxLengthMessage ? " ".concat(inputLength, " / ").concat(inputMaxLength) : ''), /*#__PURE__*/React.createElement(Grid, null)));
151
+ }, ariaMaxLengthMessage || "You have entered ".concat(inputLength, " characters and have exceeded the limit by ").concat(inputLength - inputMaxLength, ". Please limit to less than ").concat(inputMaxLength, " characters. ")), maxLengthMessage || "Please limit to less than ".concat(inputMaxLength, " characters. ")) : '', inputMaxLength ? " ".concat(inputLength, " / ").concat(inputMaxLength) : ''), /*#__PURE__*/React.createElement(Grid, null)));
151
152
  };
152
153
 
153
154
  ChatComposer.propTypes = composerProps;
@@ -1 +1 @@
1
- {"version":3,"file":"ChatContainerComposer.js","sources":["../../../../src/parts/chat-composer/ChatContainerComposer.tsx"],"sourcesContent":["/* eslint-disable max-lines */\nimport React from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { describe } from 'react-desc';\nimport { PaperAirplane } from '@elliemae/ds-icons';\nimport {\n StyledChatContainerContentComposer,\n StyledComposerInput,\n StyledComposerButton,\n StyledCounterArea,\n StyledCounterErrorA11y,\n} from './styled';\nimport { useValidateProps } from './config/useValidateProps';\n\nimport { defaultComposerPros, composerProps, ChatComposerProps } from './props';\n\n// eslint-disable-next-line complexity\nconst ChatComposer = (props: ChatComposerProps): JSX.Element => {\n useValidateProps(props, ChatComposerWithSchema.toJSON());\n\n const {\n inputValue,\n onChange,\n onResize,\n onSend,\n onFocus,\n onBlur,\n onKeyDown,\n maxHeight = 300,\n placeholder,\n inputMaxLength,\n maxLengthMessage,\n buttonDisabled,\n dataTestid,\n actionRef,\n } = props;\n\n const COMPOSER_MIN_HEIGHT = 32;\n const input = React.useRef<HTMLTextAreaElement>();\n const inputSize = React.useRef<HTMLTextAreaElement>();\n const inputSend = React.useRef<HTMLButtonElement>();\n const [height, setHeight] = React.useState(32);\n const internalMaxHeight = React.useMemo(() => maxHeight - 24, [maxHeight]);\n const [showScroll, setShowScroll] = React.useState(true);\n\n React.useEffect(() => {\n const newHeight =\n inputSize.current?.scrollHeight > internalMaxHeight ? internalMaxHeight : inputSize.current?.scrollHeight;\n if (newHeight !== height && newHeight > COMPOSER_MIN_HEIGHT) onResize(newHeight);\n setHeight(newHeight);\n setShowScroll(inputSize.current?.scrollHeight - inputSize.current?.clientHeight > 5);\n }, [inputValue, internalMaxHeight, height, onResize]);\n\n React.useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusToComposer = () => {\n input.current.focus();\n };\n actionRef.current.focusToSend = () => {\n inputSend.current.focus();\n };\n }\n }, [actionRef]);\n\n const handleChange = React.useCallback(\n (e) => {\n onChange(e.target.value);\n },\n [onChange],\n );\n const heightProps = { height, overflow: showScroll ? 'auto' : 'hidden' };\n\n const inputLength = String(inputValue || '').length;\n const hasError = React.useMemo(() => inputLength > inputMaxLength, [inputLength, inputMaxLength]);\n return (\n <StyledChatContainerContentComposer rows={['auto', '15px']} maxHeight={`${maxHeight}px`} data-testid={dataTestid}>\n <Grid\n cols={['1fr', '24px']}\n style={{ height: heightProps.height }}\n justifyContent=\"center\"\n alignItems=\"flex-end\"\n gutter=\"xxs\"\n >\n <StyledComposerInput\n ref={input}\n onChange={handleChange}\n style={{ ...heightProps }}\n value={inputValue}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n aria-label=\"Message to send\"\n data-testid=\"chat-composer-textarea\"\n name=\"chat-composer-textarea\"\n id=\"chat-composer-textarea\"\n />\n\n <Grid height=\"32px\" alignItems=\"center\">\n <StyledComposerButton\n buttonType=\"text\"\n icon={<PaperAirplane width={18} height={18} />}\n onClick={onSend}\n size=\"s\"\n disabled={!inputValue || buttonDisabled || hasError}\n data-testid=\"chat-composer-send-button\"\n aria-label=\"Send\"\n innerRef={inputSend}\n />\n </Grid>\n </Grid>\n <StyledComposerInput\n ref={inputSize}\n style={{\n height: 32,\n visibility: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n top: 0,\n width: input.current?.clientWidth,\n }}\n onChange={handleChange}\n value={inputValue}\n />\n <Grid cols={['1fr', '24px']} justifyContent=\"flex-end\" alignItems=\"center\" gutter=\"xxs\" pb=\"xxs\">\n <StyledCounterArea hasError={hasError} data-testid=\"composer-counter-area\">\n {inputMaxLength && hasError ? (\n <>\n <StyledCounterErrorA11y role=\"alert\">\n {maxLengthMessage ||\n `You have entered ${inputLength} characters and have exceeded the limit by ${\n inputLength - inputMaxLength\n }. Please limit to less than ${inputMaxLength} characters. `}\n </StyledCounterErrorA11y>\n {maxLengthMessage || `Please limit to less than ${inputMaxLength} characters. `}\n </>\n ) : (\n ''\n )}\n {inputMaxLength && !maxLengthMessage ? ` ${inputLength} / ${inputMaxLength}` : ''}\n </StyledCounterArea>\n <Grid />\n </Grid>\n </StyledChatContainerContentComposer>\n );\n};\n\nChatComposer.propTypes = composerProps;\nChatComposer.defaultProps = defaultComposerPros;\nconst ChatComposerWithSchema = describe(ChatComposer);\nChatComposerWithSchema.propTypes = composerProps;\n\nexport { ChatComposer, ChatComposerWithSchema };\n"],"names":["ChatComposer","props","useValidateProps","ChatComposerWithSchema","toJSON","inputValue","onChange","onResize","onSend","onFocus","onBlur","onKeyDown","maxHeight","placeholder","inputMaxLength","maxLengthMessage","buttonDisabled","dataTestid","actionRef","COMPOSER_MIN_HEIGHT","input","React","useRef","inputSize","inputSend","useState","height","setHeight","internalMaxHeight","useMemo","showScroll","setShowScroll","useEffect","newHeight","current","scrollHeight","clientHeight","focusToComposer","focus","focusToSend","handleChange","useCallback","e","target","value","heightProps","overflow","inputLength","String","length","hasError","visibility","pointerEvents","position","top","width","clientWidth","propTypes","composerProps","defaultProps","defaultComposerPros","describe"],"mappings":";;;;;;;;;;;;;;;;;;IAiBMA,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAA2C;AAAA;;AAC9DC,EAAAA,gBAAgB,CAACD,KAAD,EAAQE,sBAAsB,CAACC,MAAvB,EAAR,CAAhB;AAEA,MACEC,UADF,GAeIJ,KAfJ,CACEI,UADF;AAAA,MAEEC,QAFF,GAeIL,KAfJ,CAEEK,QAFF;AAAA,MAGEC,QAHF,GAeIN,KAfJ,CAGEM,QAHF;AAAA,MAI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B,CAACsD,SAAvB,GAAmCC,aAAnC;;;;"}
1
+ {"version":3,"file":"ChatContainerComposer.js","sources":["../../../../src/parts/chat-composer/ChatContainerComposer.tsx"],"sourcesContent":["/* eslint-disable max-lines */\nimport React from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { describe } from 'react-desc';\nimport { PaperAirplane } from '@elliemae/ds-icons';\nimport {\n StyledChatContainerContentComposer,\n StyledComposerInput,\n StyledComposerButton,\n StyledCounterArea,\n StyledCounterErrorA11y,\n} from './styled';\nimport { useValidateProps } from './config/useValidateProps';\n\nimport { defaultComposerPros, composerProps, ChatComposerProps } from './props';\n\n// eslint-disable-next-line complexity\nconst ChatComposer = (props: ChatComposerProps): JSX.Element => {\n useValidateProps(props, ChatComposerWithSchema.toJSON());\n\n const {\n inputValue,\n onChange,\n onResize,\n onSend,\n onFocus,\n onBlur,\n onKeyDown,\n maxHeight = 300,\n placeholder,\n inputMaxLength,\n maxLengthMessage,\n ariaMaxLengthMessage,\n buttonDisabled,\n dataTestid,\n actionRef,\n } = props;\n\n const COMPOSER_MIN_HEIGHT = 32;\n const input = React.useRef<HTMLTextAreaElement>();\n const inputSize = React.useRef<HTMLTextAreaElement>();\n const inputSend = React.useRef<HTMLButtonElement>();\n const [height, setHeight] = React.useState(32);\n const internalMaxHeight = React.useMemo(() => maxHeight - 24, [maxHeight]);\n const [showScroll, setShowScroll] = React.useState(true);\n\n React.useEffect(() => {\n const newHeight =\n inputSize.current?.scrollHeight > internalMaxHeight ? internalMaxHeight : inputSize.current?.scrollHeight;\n if (newHeight !== height && newHeight > COMPOSER_MIN_HEIGHT) onResize(newHeight);\n setHeight(newHeight);\n setShowScroll(inputSize.current?.scrollHeight - inputSize.current?.clientHeight > 5);\n }, [inputValue, internalMaxHeight, height, onResize]);\n\n React.useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusToComposer = () => {\n input.current.focus();\n };\n actionRef.current.focusToSend = () => {\n inputSend.current.focus();\n };\n }\n }, [actionRef]);\n\n const handleChange = React.useCallback(\n (e) => {\n onChange(e.target.value);\n },\n [onChange],\n );\n const heightProps = { height, overflow: showScroll ? 'auto' : 'hidden' };\n\n const inputLength = String(inputValue || '').length;\n const hasError = React.useMemo(() => inputLength > inputMaxLength, [inputLength, inputMaxLength]);\n return (\n <StyledChatContainerContentComposer rows={['auto', '15px']} maxHeight={`${maxHeight}px`} data-testid={dataTestid}>\n <Grid\n cols={['1fr', '24px']}\n style={{ height: heightProps.height }}\n justifyContent=\"center\"\n alignItems=\"flex-end\"\n gutter=\"xxs\"\n >\n <StyledComposerInput\n ref={input}\n onChange={handleChange}\n style={{ ...heightProps }}\n value={inputValue}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n aria-label=\"Message to send\"\n data-testid=\"chat-composer-textarea\"\n name=\"chat-composer-textarea\"\n id=\"chat-composer-textarea\"\n />\n\n <Grid height=\"32px\" alignItems=\"center\">\n <StyledComposerButton\n buttonType=\"text\"\n icon={<PaperAirplane width={18} height={18} />}\n onClick={onSend}\n size=\"s\"\n disabled={!inputValue || buttonDisabled || hasError}\n data-testid=\"chat-composer-send-button\"\n aria-label=\"Send\"\n innerRef={inputSend}\n />\n </Grid>\n </Grid>\n <StyledComposerInput\n ref={inputSize}\n style={{\n height: 32,\n visibility: 'hidden',\n pointerEvents: 'none',\n position: 'absolute',\n top: 0,\n width: input.current?.clientWidth,\n }}\n onChange={handleChange}\n value={inputValue}\n />\n <Grid cols={['1fr', '24px']} justifyContent=\"flex-end\" alignItems=\"center\" gutter=\"xxs\" pb=\"xxs\">\n <StyledCounterArea hasError={hasError} data-testid=\"composer-counter-area\">\n {inputMaxLength && hasError ? (\n <>\n <StyledCounterErrorA11y role=\"alert\">\n {ariaMaxLengthMessage ||\n `You have entered ${inputLength} characters and have exceeded the limit by ${\n inputLength - inputMaxLength\n }. Please limit to less than ${inputMaxLength} characters. `}\n </StyledCounterErrorA11y>\n {maxLengthMessage || `Please limit to less than ${inputMaxLength} characters. `}\n </>\n ) : (\n ''\n )}\n {inputMaxLength ? ` ${inputLength} / ${inputMaxLength}` : ''}\n </StyledCounterArea>\n <Grid />\n </Grid>\n </StyledChatContainerContentComposer>\n );\n};\n\nChatComposer.propTypes = composerProps;\nChatComposer.defaultProps = defaultComposerPros;\nconst ChatComposerWithSchema = describe(ChatComposer);\nChatComposerWithSchema.propTypes = composerProps;\n\nexport { ChatComposer, ChatComposerWithSchema };\n"],"names":["ChatComposer","props","useValidateProps","ChatComposerWithSchema","toJSON","inputValue","onChange","onResize","onSend","onFocus","onBlur","onKeyDown","maxHeight","placeholder","inputMaxLength","maxLengthMessage","ariaMaxLengthMessage","buttonDisabled","dataTestid","actionRef","COMPOSER_MIN_HEIGHT","input","React","useRef","inputSize","inputSend","useState","height","setHeight","internalMaxHeight","useMemo","showScroll","setShowScroll","useEffect","newHeight","current","scrollHeight","clientHeight","focusToComposer","focus","focusToSend","handleChange","useCallback","e","target","value","heightProps","overflow","inputLength","String","length","hasError","visibility","pointerEvents","position","top","width","clientWidth","propTypes","composerProps","defaultProps","defaultComposerPros","describe"],"mappings":";;;;;;;;;;;;;;;;;;IAiBMA,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAA2C;AAAA;;AAC9DC,EAAAA,gBAAgB,CAACD,KAAD,EAAQE,sBAAsB,CAACC,MAAvB,EAAR,CAAhB;AAEA,MACEC,UADF,GAgBIJ,KAhBJ,CACEI,UADF;AAAA,MAEEC,QAFF,GAgBIL,KAhBJ,CAEEK,QAFF;AAAA,MAGEC,QAHF,GAgBIN,KAhBJ,CAGEM,QAHF;AAAA,MAIEC,MAJF,GAgBIP,KAhBJ,CAIEO,MAJF;AAAA,MAKEC,OALF,GAgBIR,KAhBJ,CAKEQ,OALF;AAAA,MAMEC,MANF,GAgBIT,KAhBJ,CAMES,MANF;AAAA,MAOEC,SAPF,GAgBIV,KAhBJ,CAOEU,SAPF;AAAA,yBAgBIV,KAhBJ,CAQEW,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
8
  onChange: noop,
8
9
  onResize: noop,
9
10
  onSend: noop,
@@ -20,6 +21,7 @@ var defaultComposerPros = {
20
21
  var composerProps = {
21
22
  placeholder: PropTypes.string.description('Input Placeholder').defaultValue(defaultComposerPros.placeholder),
22
23
  inputValue: PropTypes.string.description('Input value').defaultValue(defaultComposerPros.inputValue),
24
+ ariaMaxLengthMessage: PropTypes.string.description('Aria message for Max length message when exceeded').defaultValue(defaultComposerPros.maxLengthMessage),
23
25
  maxLengthMessage: PropTypes.string.description('Max length message').defaultValue(defaultComposerPros.maxLengthMessage),
24
26
  onChange: PropTypes.func.description('Called when the user types').defaultValue(defaultComposerPros.onChange),
25
27
  onResize: PropTypes.func.description('Called the input changes his height').defaultValue(defaultComposerPros.onResize),
@@ -1 +1 @@
1
- {"version":3,"file":"props.js","sources":["../../../../src/parts/chat-composer/props.tsx"],"sourcesContent":["import React from 'react';\nimport { PropTypes } from 'react-desc';\nimport { noop } from 'lodash';\n\nexport interface TextAreaProps {\n height: string | number;\n style: React.CSSProperties;\n}\n\nexport const defaultComposerPros: ChatComposerProps = {\n placeholder: 'Type your message',\n inputValue: '',\n onChange: noop,\n onResize: noop,\n onSend: noop,\n onFocus: noop,\n onBlur: noop,\n onKeyDown: noop,\n maxHeight: 0,\n inputMaxLength: undefined,\n maxLengthMessage: undefined,\n buttonDisabled: false,\n dataTestid: 'ds-chat-composer',\n actionRef: noop,\n};\n\nexport interface ChatComposerProps {\n placeholder?: string;\n inputValue?: string;\n maxLengthMessage?: string;\n onChange: (value: string) => void;\n onResize?: (value: number) => void;\n onSend: (value: string) => void;\n onFocus?: (e: React.ChangeEvent<HTMLTextAreaElement>, value: string) => void;\n onBlur?: (e: React.ChangeEvent<HTMLTextAreaElement>, value: string) => void;\n onKeyDown?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;\n maxHeight?: number;\n inputMaxLength: number | undefined;\n buttonDisabled: boolean;\n dataTestid?: string;\n actionRef: PropTypes.func;\n}\n\nexport const composerProps = {\n placeholder: PropTypes.string.description('Input Placeholder').defaultValue(defaultComposerPros.placeholder),\n inputValue: PropTypes.string.description('Input value').defaultValue(defaultComposerPros.inputValue),\n maxLengthMessage: PropTypes.string\n .description('Max length message')\n .defaultValue(defaultComposerPros.maxLengthMessage),\n onChange: PropTypes.func.description('Called when the user types').defaultValue(defaultComposerPros.onChange),\n onResize: PropTypes.func\n .description('Called the input changes his height')\n .defaultValue(defaultComposerPros.onResize),\n onSend: PropTypes.func.description('Called when the click send').defaultValue(defaultComposerPros.onSend),\n onFocus: PropTypes.func.description('Input focus').defaultValue(defaultComposerPros.onFocus),\n onBlur: PropTypes.func.description('Input blur').defaultValue(defaultComposerPros.onBlur),\n onKeyDown: PropTypes.func.description('Input on key down').defaultValue(defaultComposerPros.onKeyDown),\n maxHeight: PropTypes.number\n .description('Max height of the composer. Use 0 for no limit')\n .defaultValue(defaultComposerPros.onBlur),\n inputMaxLength: PropTypes.number\n .description('Max length of the composer. `undefined` for no limit')\n .defaultValue(defaultComposerPros.inputMaxLength),\n buttonDisabled: PropTypes.bool\n .description('Control the disabled for the send button')\n .defaultValue(defaultComposerPros.buttonDisabled),\n dataTestid: PropTypes.string.description('Data testid').defaultValue(defaultComposerPros.placeholder),\n actionRef: PropTypes.object\n .description(\n `Reference: \n { \n scrollToIndex: (n: number) => void,\n getMessagesInView: () => number[],\n focusToIndex: (n: number) => void,\n focusToList: () => void,\n focusToComposer: () => void,\n focusToSend: () => void,\n }\n \n `,\n )\n .defaultValue(defaultComposerPros.actionRef),\n};\n"],"names":["defaultComposerPros","placeholder","inputValue","onChange","noop","onResize","onSend","onFocus","onBlur","onKeyDown","maxHeight","inputMaxLength","undefined","maxLengthMessage","buttonDisabled","dataTestid","actionRef","composerProps","PropTypes","string","description","defaultValue","func","number","bool","object"],"mappings":";;;IASaA,mBAAsC,GAAG;AACpDC,EAAAA,WAAW,EAAE,mBADuC;AAEpDC,EAAAA,UAAU,EAAE,EAFwC;AAGpDC,EAAAA,QAAQ,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I,IAAV,CAAeF,WAAf,CAA2B,aAA3B,EAA0CC,YAA1C,CAAuDrB,mBAAmB,CAACO,OAA3E,CAXkB;AAY3BC,EAAAA,MAAM,EAAEU,SAAS,CAACI,IAAV,CAAeF,WAAf,CAA2B,YAA3B,EAAyCC,YAAzC,CAAsDrB,mBAAmB,CAACQ,MAA1E,CAZmB;AAa3BC,EAAAA,SAAS,EAAES,SAAS,CAACI,IAAV,CAAeF,WAAf,CAA2B,mBAA3B,EAAgDC,YAAhD,CAA6DrB,mBAAmB,CAACS,SAAjF,CAbgB;AAc3BC,EAAAA,SAAS,EAAEQ,SAAS,CAACK,MAAV,CACRH,WADQ,CACI,gDADJ,EAERC,YAFQ,CAEKrB,mBAAmB,CAACQ,MAFzB,CAdgB;AAiB3BG,EAAAA,cAAc,EAAEO,SAAS,CAACK,MAAV,CACbH,WADa,CACD,sDADC,EAEbC,YAFa,CAEArB,mBAAmB,CAACW,cAFpB,CAjBW;AAoB3BG,EAAAA,cAAc,EAAEI,SAAS,CAACM,IAAV,CACbJ,WADa,CACD,0CADC,EAEbC,YAFa,CAEArB,mBAAmB,CAACc,cAFpB,CApBW;AAuB3BC,EAAAA,UAAU,EAAEG,SAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,aAA7B,EAA4CC,YAA5C,CAAyDrB,mBAAmB,CAACC,WAA7E,CAvBe;AAwB3Be,EAAAA,SAAS,EAAEE,SAAS,CAACO,MAAV,CACRL,WADQ,oTAcRC,YAdQ,CAcKrB,mBAAmB,CAACgB,SAdzB;AAxBgB;;;;"}
1
+ {"version":3,"file":"props.js","sources":["../../../../src/parts/chat-composer/props.tsx"],"sourcesContent":["import React from 'react';\nimport { PropTypes } from 'react-desc';\nimport { noop } from 'lodash';\n\nexport interface TextAreaProps {\n height: string | number;\n style: React.CSSProperties;\n}\n\nexport const defaultComposerPros: ChatComposerProps = {\n placeholder: 'Type your message',\n inputValue: '',\n ariaMaxLengthMessage: '',\n onChange: noop,\n onResize: noop,\n onSend: noop,\n onFocus: noop,\n onBlur: noop,\n onKeyDown: noop,\n maxHeight: 0,\n inputMaxLength: undefined,\n maxLengthMessage: undefined,\n buttonDisabled: false,\n dataTestid: 'ds-chat-composer',\n actionRef: noop,\n};\n\nexport interface ChatComposerProps {\n placeholder?: string;\n inputValue?: string;\n ariaMaxLengthMessage?: string;\n maxLengthMessage?: string;\n onChange: (value: string) => void;\n onResize?: (value: number) => void;\n onSend: (value: string) => void;\n onFocus?: (e: React.ChangeEvent<HTMLTextAreaElement>, value: string) => void;\n onBlur?: (e: React.ChangeEvent<HTMLTextAreaElement>, value: string) => void;\n onKeyDown?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;\n maxHeight?: number;\n inputMaxLength: number | undefined;\n buttonDisabled: boolean;\n dataTestid?: string;\n actionRef: PropTypes.func;\n}\n\nexport const composerProps = {\n placeholder: PropTypes.string.description('Input Placeholder').defaultValue(defaultComposerPros.placeholder),\n inputValue: PropTypes.string.description('Input value').defaultValue(defaultComposerPros.inputValue),\n ariaMaxLengthMessage: PropTypes.string\n .description('Aria message for Max length message when exceeded')\n .defaultValue(defaultComposerPros.maxLengthMessage),\n maxLengthMessage: PropTypes.string\n .description('Max length message')\n .defaultValue(defaultComposerPros.maxLengthMessage),\n onChange: PropTypes.func.description('Called when the user types').defaultValue(defaultComposerPros.onChange),\n onResize: PropTypes.func\n .description('Called the input changes his height')\n .defaultValue(defaultComposerPros.onResize),\n onSend: PropTypes.func.description('Called when the click send').defaultValue(defaultComposerPros.onSend),\n onFocus: PropTypes.func.description('Input focus').defaultValue(defaultComposerPros.onFocus),\n onBlur: PropTypes.func.description('Input blur').defaultValue(defaultComposerPros.onBlur),\n onKeyDown: PropTypes.func.description('Input on key down').defaultValue(defaultComposerPros.onKeyDown),\n maxHeight: PropTypes.number\n .description('Max height of the composer. Use 0 for no limit')\n .defaultValue(defaultComposerPros.onBlur),\n inputMaxLength: PropTypes.number\n .description('Max length of the composer. `undefined` for no limit')\n .defaultValue(defaultComposerPros.inputMaxLength),\n buttonDisabled: PropTypes.bool\n .description('Control the disabled for the send button')\n .defaultValue(defaultComposerPros.buttonDisabled),\n dataTestid: PropTypes.string.description('Data testid').defaultValue(defaultComposerPros.placeholder),\n actionRef: PropTypes.object\n .description(\n `Reference: \n { \n scrollToIndex: (n: number) => void,\n getMessagesInView: () => number[],\n focusToIndex: (n: number) => void,\n focusToList: () => void,\n focusToComposer: () => void,\n focusToSend: () => void,\n }\n \n `,\n )\n .defaultValue(defaultComposerPros.actionRef),\n};\n"],"names":["defaultComposerPros","placeholder","inputValue","ariaMaxLengthMessage","onChange","noop","onResize","onSend","onFocus","onBlur","onKeyDown","maxHeight","inputMaxLength","undefined","maxLengthMessage","buttonDisabled","dataTestid","actionRef","composerProps","PropTypes","string","description","defaultValue","func","number","bool","object"],"mappings":";;;IASaA,mBAAsC,GAAG;AACpDC,EAAAA,WAAW,EAAE,mBADuC;AAEpDC,EAAAA,UAAU,EAAE,EAFwC;AAGpDC,EAAAA,oBAAoB,EAAE,EAH8B;AAIpDC,EAAAA,QAAQ,EAAEC,IAJ0C;AAKpDC,EAAAA,QAAQ,EAAED,IAL0C;AAMpDE,EAAAA,MAAM,EAAEF,IAN4C;AAOpDG,EAAAA,OAAO,EAAEH,IAP2C;AAQpDI,EAAAA,MAAM,EAAEJ,IAR4C;AASpDK,EAAAA,SAAS,EAAEL,IATyC;AAUpDM,EAAAA,SAAS,EAAE,CAVyC;AAWpDC,EAAAA,cAAc,EAAEC,SAXoC;AAYpDC,EAAAA,gBAAgB,EAAED,SAZkC;AAapDE,EAAAA,cAAc,EAAE,KAboC;AAcpDC,EAAAA,UAAU,EAAE,kBAdwC;AAepDC,EAAAA,SAAS,EAAEZ;AAfyC;IAoCzCa,aAAa,GAAG;AAC3BjB,EAAAA,WAAW,EAAEkB,SAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,mBAA7B,EAAkDC,YAAlD,CAA+DtB,mBAAmB,CAACC,WAAnF,CADc;AAE3B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B,mBAAmB,CAACS,MAFzB,CAjBgB;AAoB3BG,EAAAA,cAAc,EAAEO,SAAS,CAACK,MAAV,CACbH,WADa,CACD,sDADC,EAEbC,YAFa,CAEAtB,mBAAmB,CAACY,cAFpB,CApBW;AAuB3BG,EAAAA,cAAc,EAAEI,SAAS,CAACM,IAAV,CACbJ,WADa,CACD,0CADC,EAEbC,YAFa,CAEAtB,mBAAmB,CAACe,cAFpB,CAvBW;AA0B3BC,EAAAA,UAAU,EAAEG,SAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,aAA7B,EAA4CC,YAA5C,CAAyDtB,mBAAmB,CAACC,WAA7E,CA1Be;AA2B3BgB,EAAAA,SAAS,EAAEE,SAAS,CAACO,MAAV,CACRL,WADQ,oTAcRC,YAdQ,CAcKtB,mBAAmB,CAACiB,SAdzB;AA3BgB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-chat",
3
- "version": "1.61.8",
3
+ "version": "1.61.10",
4
4
  "license": "MIT",
5
5
  "description": "Ellie Mae - Dim Sum - Chat",
6
6
  "main": "cjs/index.js",
@@ -16,14 +16,14 @@
16
16
  "directory": "dist"
17
17
  },
18
18
  "dependencies": {
19
- "@elliemae/ds-banner": "1.61.8",
20
- "@elliemae/ds-basic": "1.61.8",
21
- "@elliemae/ds-button": "1.61.8",
22
- "@elliemae/ds-grid": "1.61.8",
23
- "@elliemae/ds-icons": "1.61.8",
24
- "@elliemae/ds-props-helpers": "1.61.8",
25
- "@elliemae/ds-tooltip": "1.61.8",
26
- "@elliemae/ds-truncated-tooltip-text": "1.61.8",
19
+ "@elliemae/ds-banner": "1.61.10",
20
+ "@elliemae/ds-basic": "1.61.10",
21
+ "@elliemae/ds-button": "1.61.10",
22
+ "@elliemae/ds-grid": "1.61.10",
23
+ "@elliemae/ds-icons": "1.61.10",
24
+ "@elliemae/ds-props-helpers": "1.61.10",
25
+ "@elliemae/ds-tooltip": "1.61.10",
26
+ "@elliemae/ds-truncated-tooltip-text": "1.61.10",
27
27
  "prop-types": "~15.7.2",
28
28
  "react-desc": "^4.1.2",
29
29
  "react-virtual": "^2.3.2"