@elliemae/ds-chat 1.61.3 → 1.61.4

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.
@@ -150,9 +150,9 @@ var ChatComposer = function ChatComposer(props) {
150
150
  }, /*#__PURE__*/React__default['default'].createElement(parts_chatComposer_styled.StyledCounterArea, {
151
151
  hasError: hasError,
152
152
  "data-testid": "composer-counter-area"
153
- }, inputMaxLength && hasError ? /*#__PURE__*/React__default['default'].createElement(parts_chatComposer_styled.StyledCounterErrorA11y, {
153
+ }, inputMaxLength && hasError ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(parts_chatComposer_styled.StyledCounterErrorA11y, {
154
154
  role: "alert"
155
- }, maxLengthMessage || "You have entered ".concat(inputLength, " characters and have exceeded the limit by ").concat(inputLength - inputMaxLength, ". Please limit to less than ").concat(inputMaxLength, " characters. ")) : '', inputMaxLength ? " ".concat(inputLength, " / ").concat(inputMaxLength) : ''), /*#__PURE__*/React__default['default'].createElement(dsGrid.Grid, null)));
155
+ }, 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 ? " ".concat(inputLength, " / ").concat(inputMaxLength) : ''), /*#__PURE__*/React__default['default'].createElement(dsGrid.Grid, null)));
156
156
  };
157
157
 
158
158
  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\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 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 onResize(newHeight);\n setHeight(newHeight);\n setShowScroll(inputSize.current?.scrollHeight - inputSize.current?.clientHeight > 5);\n }, [inputValue, internalMaxHeight, 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\n return (\n <StyledChatContainerContentComposer rows={['auto', '15px']} maxHeight={`${maxHeight}px`} data-testid={dataTestid}>\n <Grid cols={['1fr', '24px']} justifyContent=\"center\" alignItems=\"flex-end\" gutter=\"xxs\">\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 />\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 // maxLength={inputMaxLength}\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 <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 ) : (\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","buttonDisabled","dataTestid","actionRef","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgBMA,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,MAUEC,cAVF,GAeIb,KAfJ,CAUEa,cAVF;AAAA,MAWEC,gBAXF,GAeId,KAfJ,CAWEc,gBAXF;AAAA,MAYEC,cAZF,GAeIf,KAfJ,CAYEe,cAZF;AAAA,MAaEC,UAbF,GAeIhB,KAfJ,CAaEgB,UAbF;AAAA,MAcEC,SAdF,GAeIjB,KAfJ,CAcEiB,SAdF;AAiBA,MAAMC,KAAK,GAAGC,yBAAK,CAACC,MAAN,EAAd;AACA,MAAMC,SAAS,GAAGF,yBAAK,CAACC,MAAN,EAAlB;AACA,MAAME,SAAS,GAAGH,yBAAK,CAACC,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AAGhC,cAFD,yCAGgBA,cAHhB,kBADnB,CADD,GAQC,EATJ,EAWGA,cAAc,cAAOgC,WAAP,gBAAwBhC,cAAxB,IAA2C,EAX5D,CADF,eAcEM,wCAAC+B,WAAD,OAdF,CA1CF,CADF;AA6DD;;AAEDnD,YAAY,CAAC+D,SAAb,GAAyBC,sCAAzB;AACAhE,YAAY,CAACiE,YAAb,GAA4BC,4CAA5B;IACM/D,sBAAsB,GAAGgE,kBAAQ,CAACnE,YAAD;AACvCG,sBAAsB,CAAC4D,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\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 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 onResize(newHeight);\n setHeight(newHeight);\n setShowScroll(inputSize.current?.scrollHeight - inputSize.current?.clientHeight > 5);\n }, [inputValue, internalMaxHeight, 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\n return (\n <StyledChatContainerContentComposer rows={['auto', '15px']} maxHeight={`${maxHeight}px`} data-testid={dataTestid}>\n <Grid cols={['1fr', '24px']} justifyContent=\"center\" alignItems=\"flex-end\" gutter=\"xxs\">\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 />\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 // maxLength={inputMaxLength}\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 ? ` ${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","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgBMA,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,GA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AAE,MAHV;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,EAAElC,UAXT;;AAAA,IA5BF,eA0CEe,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,KACGnC,cAAc,IAAImC,QAAlB,gBACC7B,+FACEA,wCAAC0C,gDAAD;AAAwB,IAAA,IAAI,EAAC;AAA7B,KACG/C,gBAAgB,+BACK+B,WADL,wDAEbA,WAAW,GAAGhC,cAFD,yCAGgBA,cAHhB,kBADnB,CADF,EAOGC,gBAAgB,wCAAiCD,cAAjC,kBAPnB,CADD,GAWC,EAZJ,EAcGA,cAAc,cAAOgC,WAAP,gBAAwBhC,cAAxB,IAA2C,EAd5D,CADF,eAiBEM,wCAAC+B,WAAD,OAjBF,CA1CF,CADF;AAgED;;AAEDnD,YAAY,CAAC+D,SAAb,GAAyBC,sCAAzB;AACAhE,YAAY,CAACiE,YAAb,GAA4BC,4CAA5B;IACM/D,sBAAsB,GAAGgE,kBAAQ,CAACnE,YAAD;AACvCG,sBAAsB,CAAC4D,SAAvB,GAAmCC,sCAAnC;;;;;"}
@@ -140,9 +140,9 @@ var ChatComposer = function ChatComposer(props) {
140
140
  }, /*#__PURE__*/React.createElement(StyledCounterArea, {
141
141
  hasError: hasError,
142
142
  "data-testid": "composer-counter-area"
143
- }, inputMaxLength && hasError ? /*#__PURE__*/React.createElement(StyledCounterErrorA11y, {
143
+ }, inputMaxLength && hasError ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledCounterErrorA11y, {
144
144
  role: "alert"
145
- }, maxLengthMessage || "You have entered ".concat(inputLength, " characters and have exceeded the limit by ").concat(inputLength - inputMaxLength, ". Please limit to less than ").concat(inputMaxLength, " characters. ")) : '', inputMaxLength ? " ".concat(inputLength, " / ").concat(inputMaxLength) : ''), /*#__PURE__*/React.createElement(Grid, null)));
145
+ }, 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 ? " ".concat(inputLength, " / ").concat(inputMaxLength) : ''), /*#__PURE__*/React.createElement(Grid, null)));
146
146
  };
147
147
 
148
148
  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\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 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 onResize(newHeight);\n setHeight(newHeight);\n setShowScroll(inputSize.current?.scrollHeight - inputSize.current?.clientHeight > 5);\n }, [inputValue, internalMaxHeight, 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\n return (\n <StyledChatContainerContentComposer rows={['auto', '15px']} maxHeight={`${maxHeight}px`} data-testid={dataTestid}>\n <Grid cols={['1fr', '24px']} justifyContent=\"center\" alignItems=\"flex-end\" gutter=\"xxs\">\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 />\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 // maxLength={inputMaxLength}\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 <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 ) : (\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","buttonDisabled","dataTestid","actionRef","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":";;;;;;;;;;;;;;;;;;IAgBMA,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,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ELyB,MAAAA,UAAU,EAAE,QAFP;AAGLC,MAAAA,aAAa,EAAE,MAHV;AAILC,MAAAA,QAAQ,EAAE,UAJL;AAKLC,MAAAA,GAAG,EAAE,CALA;AAMLC,MAAAA,KAAK,oBAAEnC,KAAK,CAACc,OAAR,mDAAE,eAAesB;AANjB,KAFT;AAUE,IAAA,QAAQ,EAAEhB,YAVZ;AAWE,IAAA,KAAK,EAAElC,UAXT;;AAAA,IA5BF,eA0CE,oBAAC,IAAD;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,oBAAC,iBAAD;AAAmB,IAAA,QAAQ,EAAE4C,QAA7B;AAAuC,mBAAY;AAAnD,KACGnC,cAAc,IAAImC,QAAlB,gBACC,oBAAC,sBAAD;AAAwB,IAAA,IAAI,EAAC;AAA7B,KACGlC,gBAAgB,+BACK+B,WADL,wDAEbA,WAAW,GAAGhC,cAFD,yCAGgBA,cAHhB,kBADnB,CADD,GAQC,EATJ,EAWGA,cAAc,cAAOgC,WAAP,gBAAwBhC,cAAxB,IAA2C,EAX5D,CADF,eAcE,oBAAC,IAAD,OAdF,CA1CF,CADF;AA6DD;;AAEDd,YAAY,CAACwD,SAAb,GAAyBC,aAAzB;AACAzD,YAAY,CAAC0D,YAAb,GAA4BC,mBAA5B;IACMxD,sBAAsB,GAAGyD,QAAQ,CAAC5D,YAAD;AACvCG,sBAAsB,CAACqD,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\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 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 onResize(newHeight);\n setHeight(newHeight);\n setShowScroll(inputSize.current?.scrollHeight - inputSize.current?.clientHeight > 5);\n }, [inputValue, internalMaxHeight, 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\n return (\n <StyledChatContainerContentComposer rows={['auto', '15px']} maxHeight={`${maxHeight}px`} data-testid={dataTestid}>\n <Grid cols={['1fr', '24px']} justifyContent=\"center\" alignItems=\"flex-end\" gutter=\"xxs\">\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 />\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 // maxLength={inputMaxLength}\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 ? ` ${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","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":";;;;;;;;;;;;;;;;;;IAgBMA,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,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,MAUEC,cAVF,GAeIb,KAfJ,CAUEa,cAVF;AAAA,MAWEC,gBAXF,GAeId,KAfJ,CAWEc,gBAXF;AAAA,MAYEC,cAZF,GAeIf,KAfJ,CAYEe,cAZF;AAAA,MAaEC,UAbF,GAeIhB,KAfJ,CAaEgB,UAbF;AAAA,MAcEC,SAdF,GAeIjB,KAfJ,CAcEiB,SAdF;AAiBA,MAAMC,KAAK,GAAGC,KAAK,CAACC,MAAN,EAAd;AACA,MAAMC,SAAS,GAAGF,KAAK,CAACC,MAAN,EAAlB;AACA,MAAME,SAAS,GAAGH,KAAK,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F,EAOGC,gBAAgB,wCAAiCD,cAAjC,kBAPnB,CADD,GAWC,EAZJ,EAcGA,cAAc,cAAOgC,WAAP,gBAAwBhC,cAAxB,IAA2C,EAd5D,CADF,eAiBE,oBAAC,IAAD,OAjBF,CA1CF,CADF;AAgED;;AAEDd,YAAY,CAACwD,SAAb,GAAyBC,aAAzB;AACAzD,YAAY,CAAC0D,YAAb,GAA4BC,mBAA5B;IACMxD,sBAAsB,GAAGyD,QAAQ,CAAC5D,YAAD;AACvCG,sBAAsB,CAACqD,SAAvB,GAAmCC,aAAnC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-chat",
3
- "version": "1.61.3",
3
+ "version": "1.61.4",
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.3",
20
- "@elliemae/ds-basic": "1.61.3",
21
- "@elliemae/ds-button": "1.61.3",
22
- "@elliemae/ds-grid": "1.61.3",
23
- "@elliemae/ds-icons": "1.61.3",
24
- "@elliemae/ds-props-helpers": "1.61.3",
25
- "@elliemae/ds-tooltip": "1.61.3",
26
- "@elliemae/ds-truncated-tooltip-text": "1.61.3",
19
+ "@elliemae/ds-banner": "1.61.4",
20
+ "@elliemae/ds-basic": "1.61.4",
21
+ "@elliemae/ds-button": "1.61.4",
22
+ "@elliemae/ds-grid": "1.61.4",
23
+ "@elliemae/ds-icons": "1.61.4",
24
+ "@elliemae/ds-props-helpers": "1.61.4",
25
+ "@elliemae/ds-tooltip": "1.61.4",
26
+ "@elliemae/ds-truncated-tooltip-text": "1.61.4",
27
27
  "prop-types": "~15.7.2",
28
28
  "react-desc": "^4.1.2",
29
29
  "react-virtual": "^2.3.2"