@elliemae/ds-text-wrapper 1.61.12 → 1.61.13

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.
@@ -1 +1 @@
1
- {"version":3,"file":"DSTextWrapper.js","sources":["../../src/DSTextWrapper.tsx"],"sourcesContent":["/* eslint-disable react/no-array-index-key */\nimport React from 'react';\nimport { describe } from 'react-desc';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { textProps } from './props';\nimport { defaultProps } from './defaultProps';\n\n/**\n * if we don't care about word break\n * const regx = new RegExp(`.{1,${maxCharacters}}`, 'g')\n * text.match(regx)\n *\n * @param {*} param0\n */\nconst DSTextWrapper = ({\n containerProps,\n className,\n style,\n text,\n maxCharacters,\n maxWidth,\n textEllipsis,\n textAlignment,\n wordBreak,\n}) => {\n const { cssClassName, classNameElement } = convertPropToCssClassName(\n 'text-wrapperRef',\n className,\n {\n textEllipsis,\n textAlignment,\n wordBreak,\n },\n );\n const limitPerCharacter = () =>\n text.split(' ').reduce(\n (result, word) => {\n let resultIndex = result.length - 1;\n if (result[resultIndex].length + word.length > maxCharacters)\n resultIndex += 1;\n result[resultIndex] = `${result[resultIndex] || ''} ${word}`;\n return result;\n },\n [''],\n );\n\n let displayText = text;\n\n if (textEllipsis)\n displayText =\n maxCharacters > 0 ? displayText.substring(0, maxCharacters) : displayText;\n else if (maxCharacters > 0) {\n displayText = limitPerCharacter().map((textpart, index) => (\n <span key={index} className={classNameElement('line')}>\n {textpart}\n </span>\n ));\n }\n\n return (\n <span\n {...containerProps}\n className={cssClassName}\n style={{\n maxWidth: maxCharacters < 1 ? maxWidth : null,\n ...style,\n }}\n >\n {textEllipsis ? (\n <span className={classNameElement('ellipsis-wrapperRef')}>\n {displayText}\n </span>\n ) : (\n displayText\n )}\n </span>\n );\n};\n\nDSTextWrapper.propTypes = textProps;\nDSTextWrapper.defaultProps = defaultProps;\n\nconst TextWrapperWithSchema = describe(DSTextWrapper);\nTextWrapperWithSchema.propTypes = textProps;\n\nexport { DSTextWrapper, TextWrapperWithSchema };\nexport default DSTextWrapper;\n"],"names":["DSTextWrapper","containerProps","className","style","text","maxCharacters","maxWidth","textEllipsis","textAlignment","wordBreak","convertPropToCssClassName","cssClassName","classNameElement","limitPerCharacter","split","reduce","result","word","resultIndex","length","displayText","substring","map","textpart","index","React","propTypes","textProps","defaultProps","TextWrapperWithSchema","describe"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;IACMA,aAAa,GAAG,SAAhBA,aAAgB,OAUhB;AAAA,MATJC,cASI,QATJA,cASI;AAAA,MARJC,SAQI,QARJA,SAQI;AAAA,MAPJC,KAOI,QAPJA,KAOI;AAAA,MANJC,IAMI,QANJA,IAMI;AAAA,MALJC,aAKI,QALJA,aAKI;AAAA,MAJJC,QAII,QAJJA,QAII;AAAA,MAHJC,YAGI,QAHJA,YAGI;AAAA,MAFJC,aAEI,QAFJA,aAEI;AAAA,MADJC,SACI,QADJA,SACI;;AACJ,8BAA2CC,sCAAyB,CAClE,iBADkE,EAElER,SAFkE,EAGlE;AACEK,IAAAA,YAAY,EAAZA,YADF;AAEEC,IAAAA,aAAa,EAAbA,aAFF;AAGEC,IAAAA,SAAS,EAATA;AAHF,GAHkE,CAApE;AAAA,MAAQE,YAAR,yBAAQA,YAAR;AAAA,MAAsBC,gBAAtB,yBAAsBA,gBAAtB;;AASA,MAAMC,iBAAiB,GAAG,SAApBA,iBAAoB;AAAA,WACxBT,IAAI,CAACU,KAAL,CAAW,GAAX,EAAgBC,MAAhB,CACE,UAACC,MAAD,EAASC,IAAT,EAAkB;AAChB,UAAIC,WAAW,GAAGF,MAAM,CAACG,MAAP,GAAgB,CAAlC;AACA,UAAIH,MAAM,CAACE,WAAD,CAAN,CAAoBC,MAApB,GAA6BF,IAAI,CAACE,MAAlC,GAA2Cd,aAA/C,EACEa,WAAW,IAAI,CAAf;AACFF,MAAAA,MAAM,CAACE,WAAD,CAAN,aAAyBF,MAAM,CAACE,WAAD,CAAN,IAAuB,EAAhD,cAAsDD,IAAtD;AACA,aAAOD,MAAP;AACD,KAPH,EAQE,CAAC,EAAD,CARF,CADwB;AAAA,GAA1B;;AAYA,MAAII,WAAW,GAAGhB,IAAlB;AAEA,MAAIG,YAAJ,EACEa,WAAW,GACTf,aAAa,GAAG,CAAhB,GAAoBe,WAAW,CAACC,SAAZ,CAAsB,CAAtB,EAAyBhB,aAAzB,CAApB,GAA8De,WADhE,CADF,KAGK,IAAIf,aAAa,GAAG,CAApB,EAAuB;AAC1Be,IAAAA,WAAW,GAAGP,iBAAiB,GAAGS,GAApB,CAAwB,UAACC,QAAD,EAAWC,KAAX;AAAA,0BACpCC;AAAM,QAAA,GAAG,EAAED,KAAX;AAAkB,QAAA,SAAS,EAAEZ,gBAAgB,CAAC,MAAD;AAA7C,SACGW,QADH,CADoC;AAAA,KAAxB,CAAd;AAKD;AAED,sBACEE,iFACMxB,cADN;AAEE,IAAA,SAAS,EAAEU,YAFb;AAGE,IAAA,KAAK;AACHL,MAAAA,QAAQ,EAAED,aAAa,GAAG,CAAhB,GAAoBC,QAApB,GAA+B;AADtC,OAEAH,KAFA;AAHP,MAQGI,YAAY,gBACXkB;AAAM,IAAA,SAAS,EAAEb,gBAAgB,CAAC,qBAAD;AAAjC,KACGQ,WADH,CADW,GAKXA,WAbJ,CADF;AAkBD;;AAEDpB,aAAa,CAAC0B,SAAd,GAA0BC,eAA1B;AACA3B,aAAa,CAAC4B,YAAd,GAA6BA,yBAA7B;IAEMC,qBAAqB,GAAGC,kBAAQ,CAAC9B,aAAD;AACtC6B,qBAAqB,CAACH,SAAtB,GAAkCC,eAAlC;;;;;;"}
1
+ {"version":3,"file":"DSTextWrapper.js","sources":["../../src/DSTextWrapper.tsx"],"sourcesContent":["/* eslint-disable react/no-array-index-key */\nimport React from 'react';\nimport { describe } from 'react-desc';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { textProps } from './props';\nimport { defaultProps } from './defaultProps';\n\n/**\n * if we don't care about word break\n * const regx = new RegExp(`.{1,${maxCharacters}}`, 'g')\n * text.match(regx)\n *\n * @param {*} param0\n */\nconst DSTextWrapper = ({\n containerProps,\n className,\n style,\n text,\n maxCharacters,\n maxWidth,\n textEllipsis,\n textAlignment,\n wordBreak,\n}) => {\n const { cssClassName, classNameElement } = convertPropToCssClassName(\n 'text-wrapperRef',\n className,\n {\n textEllipsis,\n textAlignment,\n wordBreak,\n },\n );\n const limitPerCharacter = () =>\n text.split(' ').reduce(\n (result, word) => {\n let resultIndex = result.length - 1;\n if (result[resultIndex].length + word.length > maxCharacters)\n resultIndex += 1;\n result[resultIndex] = `${result[resultIndex] || ''} ${word}`;\n return result;\n },\n [''],\n );\n\n let displayText = text;\n\n if (textEllipsis)\n displayText =\n maxCharacters > 0 ? displayText.substring(0, maxCharacters) : displayText;\n else if (maxCharacters > 0) {\n displayText = limitPerCharacter().map((textpart, index) => (\n <span key={index} className={classNameElement('line')}>\n {textpart}\n </span>\n ));\n }\n\n return (\n <span\n {...containerProps}\n className={cssClassName}\n style={{\n maxWidth: maxCharacters < 1 ? maxWidth : null,\n ...style,\n }}\n >\n {textEllipsis ? (\n <span className={classNameElement('ellipsis-wrapperRef')}>\n {displayText}\n </span>\n ) : (\n displayText\n )}\n </span>\n );\n};\n\nDSTextWrapper.propTypes = textProps;\nDSTextWrapper.defaultProps = defaultProps;\n\nconst TextWrapperWithSchema = describe(DSTextWrapper);\nTextWrapperWithSchema.propTypes = textProps;\n\nexport { DSTextWrapper, TextWrapperWithSchema };\nexport default DSTextWrapper;\n"],"names":["DSTextWrapper","containerProps","className","style","text","maxCharacters","maxWidth","textEllipsis","textAlignment","wordBreak","convertPropToCssClassName","cssClassName","classNameElement","limitPerCharacter","split","reduce","result","word","resultIndex","length","displayText","substring","map","textpart","index","React","propTypes","textProps","defaultProps","TextWrapperWithSchema","describe"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOA;AACA;AAC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QAAD,EAAWC,KAAX;MAAA,oBACpCC;QAAM,GAAG,EAAED,KAAX;QAAkB,SAAS,EAAEZ,gBAAgB,CAAC,MAAD;SAC1CW,QADH,CADoC;KAAxB,CAAd;;EAOF,oBACEE,iFACMxB,cADN;IAEE,SAAS,EAAEU,YAFb;IAGE,KAAK;MACHL,QAAQ,EAAED,aAAa,GAAG,CAAhB,GAAoBC,QAApB,GAA+B;OACtCH,KAFA;MAKJI,YAAY,gBACXkB;IAAM,SAAS,EAAEb,gBAAgB,CAAC,qBAAD;KAC9BQ,WADH,CADW,GAKXA,WAbJ,CADF;AAkBD;;AAEDpB,aAAa,CAAC0B,SAAd,GAA0BC,eAA1B;AACA3B,aAAa,CAAC4B,YAAd,GAA6BA,yBAA7B;IAEMC,qBAAqB,GAAGC,kBAAQ,CAAC9B,aAAD;AACtC6B,qBAAqB,CAACH,SAAtB,GAAkCC,eAAlC;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaultProps.js","sources":["../../src/defaultProps.tsx"],"sourcesContent":["export const defaultProps = {\n containerProps: {},\n className: '',\n style: {},\n text: '',\n maxCharacters: 0,\n maxWidth: '100%',\n textEllipsis: false,\n textAlignment: 'left',\n wordBreak: true,\n};\n"],"names":["defaultProps","containerProps","className","style","text","maxCharacters","maxWidth","textEllipsis","textAlignment","wordBreak"],"mappings":";;;;IAAaA,YAAY,GAAG;AAC1BC,EAAAA,cAAc,EAAE,EADU;AAE1BC,EAAAA,SAAS,EAAE,EAFe;AAG1BC,EAAAA,KAAK,EAAE,EAHmB;AAI1BC,EAAAA,IAAI,EAAE,EAJoB;AAK1BC,EAAAA,aAAa,EAAE,CALW;AAM1BC,EAAAA,QAAQ,EAAE,MANgB;AAO1BC,EAAAA,YAAY,EAAE,KAPY;AAQ1BC,EAAAA,aAAa,EAAE,MARW;AAS1BC,EAAAA,SAAS,EAAE;AATe;;;;"}
1
+ {"version":3,"file":"defaultProps.js","sources":["../../src/defaultProps.tsx"],"sourcesContent":["export const defaultProps = {\n containerProps: {},\n className: '',\n style: {},\n text: '',\n maxCharacters: 0,\n maxWidth: '100%',\n textEllipsis: false,\n textAlignment: 'left',\n wordBreak: true,\n};\n"],"names":["defaultProps","containerProps","className","style","text","maxCharacters","maxWidth","textEllipsis","textAlignment","wordBreak"],"mappings":";;;;IAAaA,YAAY,GAAG;EAC1BC,cAAc,EAAE,EADU;EAE1BC,SAAS,EAAE,EAFe;EAG1BC,KAAK,EAAE,EAHmB;EAI1BC,IAAI,EAAE,EAJoB;EAK1BC,aAAa,EAAE,CALW;EAM1BC,QAAQ,EAAE,MANgB;EAO1BC,YAAY,EAAE,KAPY;EAQ1BC,aAAa,EAAE,MARW;EAS1BC,SAAS,EAAE;AATe;;;;"}
package/cjs/props.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"props.js","sources":["../../src/props.tsx"],"sourcesContent":["import { PropTypes } from 'react-desc';\n\nexport const textProps = {\n containerProps: PropTypes.object.description(\n 'Set of Properties attached to the main container',\n ),\n className: PropTypes.string.description('css class'),\n style: PropTypes.object.description('css style'),\n text: PropTypes.string.description('Text to display').isRequired,\n maxCharacters: PropTypes.number.description(\n 'Maximum amount of charachters allowed',\n ),\n maxWidth: PropTypes.string.description('Maximum width allowed'),\n textEllipsis: PropTypes.bool.description('Whether to show ellipsis or not'),\n textAlignment: PropTypes.oneOf(['left', 'center', 'right']).description(\n 'Text alignement',\n ),\n wordBreak: PropTypes.bool.description('Whether to break the line or not'),\n};\n"],"names":["textProps","containerProps","PropTypes","object","description","className","string","style","text","isRequired","maxCharacters","number","maxWidth","textEllipsis","bool","textAlignment","oneOf","wordBreak"],"mappings":";;;;;;IAEaA,SAAS,GAAG;AACvBC,EAAAA,cAAc,EAAEC,mBAAS,CAACC,MAAV,CAAiBC,WAAjB,CACd,kDADc,CADO;AAIvBC,EAAAA,SAAS,EAAEH,mBAAS,CAACI,MAAV,CAAiBF,WAAjB,CAA6B,WAA7B,CAJY;AAKvBG,EAAAA,KAAK,EAAEL,mBAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,WAA7B,CALgB;AAMvBI,EAAAA,IAAI,EAAEN,mBAAS,CAACI,MAAV,CAAiBF,WAAjB,CAA6B,iBAA7B,EAAgDK,UAN/B;AAOvBC,EAAAA,aAAa,EAAER,mBAAS,CAACS,MAAV,CAAiBP,WAAjB,CACb,uCADa,CAPQ;AAUvBQ,EAAAA,QAAQ,EAAEV,mBAAS,CAACI,MAAV,CAAiBF,WAAjB,CAA6B,uBAA7B,CAVa;AAWvBS,EAAAA,YAAY,EAAEX,mBAAS,CAACY,IAAV,CAAeV,WAAf,CAA2B,iCAA3B,CAXS;AAYvBW,EAAAA,aAAa,EAAEb,mBAAS,CAACc,KAAV,CAAgB,CAAC,MAAD,EAAS,QAAT,EAAmB,OAAnB,CAAhB,EAA6CZ,WAA7C,CACb,iBADa,CAZQ;AAevBa,EAAAA,SAAS,EAAEf,mBAAS,CAACY,IAAV,CAAeV,WAAf,CAA2B,kCAA3B;AAfY;;;;"}
1
+ {"version":3,"file":"props.js","sources":["../../src/props.tsx"],"sourcesContent":["import { PropTypes } from 'react-desc';\n\nexport const textProps = {\n containerProps: PropTypes.object.description(\n 'Set of Properties attached to the main container',\n ),\n className: PropTypes.string.description('css class'),\n style: PropTypes.object.description('css style'),\n text: PropTypes.string.description('Text to display').isRequired,\n maxCharacters: PropTypes.number.description(\n 'Maximum amount of charachters allowed',\n ),\n maxWidth: PropTypes.string.description('Maximum width allowed'),\n textEllipsis: PropTypes.bool.description('Whether to show ellipsis or not'),\n textAlignment: PropTypes.oneOf(['left', 'center', 'right']).description(\n 'Text alignement',\n ),\n wordBreak: PropTypes.bool.description('Whether to break the line or not'),\n};\n"],"names":["textProps","containerProps","PropTypes","object","description","className","string","style","text","isRequired","maxCharacters","number","maxWidth","textEllipsis","bool","textAlignment","oneOf","wordBreak"],"mappings":";;;;;;IAEaA,SAAS,GAAG;EACvBC,cAAc,EAAEC,mBAAS,CAACC,MAAV,CAAiBC,WAAjB,CACd,kDADc,CADO;EAIvBC,SAAS,EAAEH,mBAAS,CAACI,MAAV,CAAiBF,WAAjB,CAA6B,WAA7B,CAJY;EAKvBG,KAAK,EAAEL,mBAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,WAA7B,CALgB;EAMvBI,IAAI,EAAEN,mBAAS,CAACI,MAAV,CAAiBF,WAAjB,CAA6B,iBAA7B,EAAgDK,UAN/B;EAOvBC,aAAa,EAAER,mBAAS,CAACS,MAAV,CAAiBP,WAAjB,CACb,uCADa,CAPQ;EAUvBQ,QAAQ,EAAEV,mBAAS,CAACI,MAAV,CAAiBF,WAAjB,CAA6B,uBAA7B,CAVa;EAWvBS,YAAY,EAAEX,mBAAS,CAACY,IAAV,CAAeV,WAAf,CAA2B,iCAA3B,CAXS;EAYvBW,aAAa,EAAEb,mBAAS,CAACc,KAAV,CAAgB,CAAC,MAAD,EAAS,QAAT,EAAmB,OAAnB,CAAhB,EAA6CZ,WAA7C,CACb,iBADa,CAZQ;EAevBa,SAAS,EAAEf,mBAAS,CAACY,IAAV,CAAeV,WAAf,CAA2B,kCAA3B;AAfY;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DSTextWrapper.js","sources":["../../src/DSTextWrapper.tsx"],"sourcesContent":["/* eslint-disable react/no-array-index-key */\nimport React from 'react';\nimport { describe } from 'react-desc';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { textProps } from './props';\nimport { defaultProps } from './defaultProps';\n\n/**\n * if we don't care about word break\n * const regx = new RegExp(`.{1,${maxCharacters}}`, 'g')\n * text.match(regx)\n *\n * @param {*} param0\n */\nconst DSTextWrapper = ({\n containerProps,\n className,\n style,\n text,\n maxCharacters,\n maxWidth,\n textEllipsis,\n textAlignment,\n wordBreak,\n}) => {\n const { cssClassName, classNameElement } = convertPropToCssClassName(\n 'text-wrapperRef',\n className,\n {\n textEllipsis,\n textAlignment,\n wordBreak,\n },\n );\n const limitPerCharacter = () =>\n text.split(' ').reduce(\n (result, word) => {\n let resultIndex = result.length - 1;\n if (result[resultIndex].length + word.length > maxCharacters)\n resultIndex += 1;\n result[resultIndex] = `${result[resultIndex] || ''} ${word}`;\n return result;\n },\n [''],\n );\n\n let displayText = text;\n\n if (textEllipsis)\n displayText =\n maxCharacters > 0 ? displayText.substring(0, maxCharacters) : displayText;\n else if (maxCharacters > 0) {\n displayText = limitPerCharacter().map((textpart, index) => (\n <span key={index} className={classNameElement('line')}>\n {textpart}\n </span>\n ));\n }\n\n return (\n <span\n {...containerProps}\n className={cssClassName}\n style={{\n maxWidth: maxCharacters < 1 ? maxWidth : null,\n ...style,\n }}\n >\n {textEllipsis ? (\n <span className={classNameElement('ellipsis-wrapperRef')}>\n {displayText}\n </span>\n ) : (\n displayText\n )}\n </span>\n );\n};\n\nDSTextWrapper.propTypes = textProps;\nDSTextWrapper.defaultProps = defaultProps;\n\nconst TextWrapperWithSchema = describe(DSTextWrapper);\nTextWrapperWithSchema.propTypes = textProps;\n\nexport { DSTextWrapper, TextWrapperWithSchema };\nexport default DSTextWrapper;\n"],"names":["DSTextWrapper","containerProps","className","style","text","maxCharacters","maxWidth","textEllipsis","textAlignment","wordBreak","convertPropToCssClassName","cssClassName","classNameElement","limitPerCharacter","split","reduce","result","word","resultIndex","length","displayText","substring","map","textpart","index","propTypes","textProps","defaultProps","TextWrapperWithSchema","describe"],"mappings":";;;;;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;IACMA,aAAa,GAAG,SAAhBA,aAAgB,OAUhB;AAAA,MATJC,cASI,QATJA,cASI;AAAA,MARJC,SAQI,QARJA,SAQI;AAAA,MAPJC,KAOI,QAPJA,KAOI;AAAA,MANJC,IAMI,QANJA,IAMI;AAAA,MALJC,aAKI,QALJA,aAKI;AAAA,MAJJC,QAII,QAJJA,QAII;AAAA,MAHJC,YAGI,QAHJA,YAGI;AAAA,MAFJC,aAEI,QAFJA,aAEI;AAAA,MADJC,SACI,QADJA,SACI;;AACJ,8BAA2C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HL,MAAAA,QAAQ,EAAED,aAAa,GAAG,CAAhB,GAAoBC,QAApB,GAA+B;AADtC,OAEAH,KAFA;AAHP,MAQGI,YAAY,gBACX;AAAM,IAAA,SAAS,EAAEK,gBAAgB,CAAC,qBAAD;AAAjC,KACGQ,WADH,CADW,GAKXA,WAbJ,CADF;AAkBD;;AAEDpB,aAAa,CAACyB,SAAd,GAA0BC,SAA1B;AACA1B,aAAa,CAAC2B,YAAd,GAA6BA,YAA7B;IAEMC,qBAAqB,GAAGC,QAAQ,CAAC7B,aAAD;AACtC4B,qBAAqB,CAACH,SAAtB,GAAkCC,SAAlC;;;;"}
1
+ {"version":3,"file":"DSTextWrapper.js","sources":["../../src/DSTextWrapper.tsx"],"sourcesContent":["/* eslint-disable react/no-array-index-key */\nimport React from 'react';\nimport { describe } from 'react-desc';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { textProps } from './props';\nimport { defaultProps } from './defaultProps';\n\n/**\n * if we don't care about word break\n * const regx = new RegExp(`.{1,${maxCharacters}}`, 'g')\n * text.match(regx)\n *\n * @param {*} param0\n */\nconst DSTextWrapper = ({\n containerProps,\n className,\n style,\n text,\n maxCharacters,\n maxWidth,\n textEllipsis,\n textAlignment,\n wordBreak,\n}) => {\n const { cssClassName, classNameElement } = convertPropToCssClassName(\n 'text-wrapperRef',\n className,\n {\n textEllipsis,\n textAlignment,\n wordBreak,\n },\n );\n const limitPerCharacter = () =>\n text.split(' ').reduce(\n (result, word) => {\n let resultIndex = result.length - 1;\n if (result[resultIndex].length + word.length > maxCharacters)\n resultIndex += 1;\n result[resultIndex] = `${result[resultIndex] || ''} ${word}`;\n return result;\n },\n [''],\n );\n\n let displayText = text;\n\n if (textEllipsis)\n displayText =\n maxCharacters > 0 ? displayText.substring(0, maxCharacters) : displayText;\n else if (maxCharacters > 0) {\n displayText = limitPerCharacter().map((textpart, index) => (\n <span key={index} className={classNameElement('line')}>\n {textpart}\n </span>\n ));\n }\n\n return (\n <span\n {...containerProps}\n className={cssClassName}\n style={{\n maxWidth: maxCharacters < 1 ? maxWidth : null,\n ...style,\n }}\n >\n {textEllipsis ? (\n <span className={classNameElement('ellipsis-wrapperRef')}>\n {displayText}\n </span>\n ) : (\n displayText\n )}\n </span>\n );\n};\n\nDSTextWrapper.propTypes = textProps;\nDSTextWrapper.defaultProps = defaultProps;\n\nconst TextWrapperWithSchema = describe(DSTextWrapper);\nTextWrapperWithSchema.propTypes = textProps;\n\nexport { DSTextWrapper, TextWrapperWithSchema };\nexport default DSTextWrapper;\n"],"names":["DSTextWrapper","containerProps","className","style","text","maxCharacters","maxWidth","textEllipsis","textAlignment","wordBreak","convertPropToCssClassName","cssClassName","classNameElement","limitPerCharacter","split","reduce","result","word","resultIndex","length","displayText","substring","map","textpart","index","propTypes","textProps","defaultProps","TextWrapperWithSchema","describe"],"mappings":";;;;;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;IACMA,aAAa,GAAG,SAAhBA,aAAgB,OAUhB;EAAA,IATJC,cASI,QATJA,cASI;MARJC,SAQI,QARJA,SAQI;MAPJC,KAOI,QAPJA,KAOI;MANJC,IAMI,QANJA,IAMI;MALJC,aAKI,QALJA,aAKI;MAJJC,QAII,QAJJA,QAII;MAHJC,YAGI,QAHJA,YAGI;MAFJC,aAEI,QAFJA,aAEI;MADJC,SACI,QADJA,SACI;;EACJ,4BAA2CC,yBAAyB,CAClE,iBADkE,EAElER,SAFkE,EAGlE;IACEK,YAAY,EAAZA,YADF;IAEEC,aAAa,EAAbA,aAFF;IAGEC,SAAS,EAATA;GANgE,CAApE;MAAQE,YAAR,yBAAQA,YAAR;MAAsBC,gBAAtB,yBAAsBA,gBAAtB;;EASA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB;IAAA,OACxBT,IAAI,CAACU,KAAL,CAAW,GAAX,EAAgBC,MAAhB,CACE,UAACC,MAAD,EAASC,IAAT,EAAkB;MAChB,IAAIC,WAAW,GAAGF,MAAM,CAACG,MAAP,GAAgB,CAAlC;MACA,IAAIH,MAAM,CAACE,WAAD,CAAN,CAAoBC,MAApB,GAA6BF,IAAI,CAACE,MAAlC,GAA2Cd,aAA/C,EACEa,WAAW,IAAI,CAAf;MACFF,MAAM,CAACE,WAAD,CAAN,aAAyBF,MAAM,CAACE,WAAD,CAAN,IAAuB,EAAhD,cAAsDD,IAAtD;MACA,OAAOD,MAAP;KANJ,EAQE,CAAC,EAAD,CARF,CADwB;GAA1B;;EAYA,IAAII,WAAW,GAAGhB,IAAlB;EAEA,IAAIG,YAAJ,EACEa,WAAW,GACTf,aAAa,GAAG,CAAhB,GAAoBe,WAAW,CAACC,SAAZ,CAAsB,CAAtB,EAAyBhB,aAAzB,CAApB,GAA8De,WADhE,CADF,KAGK,IAAIf,aAAa,GAAG,CAApB,EAAuB;IAC1Be,WAAW,GAAGP,iBAAiB,GAAGS,GAApB,CAAwB,UAACC,QAAD,EAAWC,KAAX;MAAA,oBACpC;QAAM,GAAG,EAAEA,KAAX;QAAkB,SAAS,EAAEZ,gBAAgB,CAAC,MAAD;SAC1CW,QADH,CADoC;KAAxB,CAAd;;EAOF,oBACE,yCACMtB,cADN;IAEE,SAAS,EAAEU,YAFb;IAGE,KAAK;MACHL,QAAQ,EAAED,aAAa,GAAG,CAAhB,GAAoBC,QAApB,GAA+B;OACtCH,KAFA;MAKJI,YAAY,gBACX;IAAM,SAAS,EAAEK,gBAAgB,CAAC,qBAAD;KAC9BQ,WADH,CADW,GAKXA,WAbJ,CADF;AAkBD;;AAEDpB,aAAa,CAACyB,SAAd,GAA0BC,SAA1B;AACA1B,aAAa,CAAC2B,YAAd,GAA6BA,YAA7B;IAEMC,qBAAqB,GAAGC,QAAQ,CAAC7B,aAAD;AACtC4B,qBAAqB,CAACH,SAAtB,GAAkCC,SAAlC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaultProps.js","sources":["../../src/defaultProps.tsx"],"sourcesContent":["export const defaultProps = {\n containerProps: {},\n className: '',\n style: {},\n text: '',\n maxCharacters: 0,\n maxWidth: '100%',\n textEllipsis: false,\n textAlignment: 'left',\n wordBreak: true,\n};\n"],"names":["defaultProps","containerProps","className","style","text","maxCharacters","maxWidth","textEllipsis","textAlignment","wordBreak"],"mappings":"IAAaA,YAAY,GAAG;AAC1BC,EAAAA,cAAc,EAAE,EADU;AAE1BC,EAAAA,SAAS,EAAE,EAFe;AAG1BC,EAAAA,KAAK,EAAE,EAHmB;AAI1BC,EAAAA,IAAI,EAAE,EAJoB;AAK1BC,EAAAA,aAAa,EAAE,CALW;AAM1BC,EAAAA,QAAQ,EAAE,MANgB;AAO1BC,EAAAA,YAAY,EAAE,KAPY;AAQ1BC,EAAAA,aAAa,EAAE,MARW;AAS1BC,EAAAA,SAAS,EAAE;AATe;;;;"}
1
+ {"version":3,"file":"defaultProps.js","sources":["../../src/defaultProps.tsx"],"sourcesContent":["export const defaultProps = {\n containerProps: {},\n className: '',\n style: {},\n text: '',\n maxCharacters: 0,\n maxWidth: '100%',\n textEllipsis: false,\n textAlignment: 'left',\n wordBreak: true,\n};\n"],"names":["defaultProps","containerProps","className","style","text","maxCharacters","maxWidth","textEllipsis","textAlignment","wordBreak"],"mappings":"IAAaA,YAAY,GAAG;EAC1BC,cAAc,EAAE,EADU;EAE1BC,SAAS,EAAE,EAFe;EAG1BC,KAAK,EAAE,EAHmB;EAI1BC,IAAI,EAAE,EAJoB;EAK1BC,aAAa,EAAE,CALW;EAM1BC,QAAQ,EAAE,MANgB;EAO1BC,YAAY,EAAE,KAPY;EAQ1BC,aAAa,EAAE,MARW;EAS1BC,SAAS,EAAE;AATe;;;;"}
package/esm/props.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"props.js","sources":["../../src/props.tsx"],"sourcesContent":["import { PropTypes } from 'react-desc';\n\nexport const textProps = {\n containerProps: PropTypes.object.description(\n 'Set of Properties attached to the main container',\n ),\n className: PropTypes.string.description('css class'),\n style: PropTypes.object.description('css style'),\n text: PropTypes.string.description('Text to display').isRequired,\n maxCharacters: PropTypes.number.description(\n 'Maximum amount of charachters allowed',\n ),\n maxWidth: PropTypes.string.description('Maximum width allowed'),\n textEllipsis: PropTypes.bool.description('Whether to show ellipsis or not'),\n textAlignment: PropTypes.oneOf(['left', 'center', 'right']).description(\n 'Text alignement',\n ),\n wordBreak: PropTypes.bool.description('Whether to break the line or not'),\n};\n"],"names":["textProps","containerProps","PropTypes","object","description","className","string","style","text","isRequired","maxCharacters","number","maxWidth","textEllipsis","bool","textAlignment","oneOf","wordBreak"],"mappings":";;IAEaA,SAAS,GAAG;AACvBC,EAAAA,cAAc,EAAEC,SAAS,CAACC,MAAV,CAAiBC,WAAjB,CACd,kDADc,CADO;AAIvBC,EAAAA,SAAS,EAAEH,SAAS,CAACI,MAAV,CAAiBF,WAAjB,CAA6B,WAA7B,CAJY;AAKvBG,EAAAA,KAAK,EAAEL,SAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,WAA7B,CALgB;AAMvBI,EAAAA,IAAI,EAAEN,SAAS,CAACI,MAAV,CAAiBF,WAAjB,CAA6B,iBAA7B,EAAgDK,UAN/B;AAOvBC,EAAAA,aAAa,EAAER,SAAS,CAACS,MAAV,CAAiBP,WAAjB,CACb,uCADa,CAPQ;AAUvBQ,EAAAA,QAAQ,EAAEV,SAAS,CAACI,MAAV,CAAiBF,WAAjB,CAA6B,uBAA7B,CAVa;AAWvBS,EAAAA,YAAY,EAAEX,SAAS,CAACY,IAAV,CAAeV,WAAf,CAA2B,iCAA3B,CAXS;AAYvBW,EAAAA,aAAa,EAAEb,SAAS,CAACc,KAAV,CAAgB,CAAC,MAAD,EAAS,QAAT,EAAmB,OAAnB,CAAhB,EAA6CZ,WAA7C,CACb,iBADa,CAZQ;AAevBa,EAAAA,SAAS,EAAEf,SAAS,CAACY,IAAV,CAAeV,WAAf,CAA2B,kCAA3B;AAfY;;;;"}
1
+ {"version":3,"file":"props.js","sources":["../../src/props.tsx"],"sourcesContent":["import { PropTypes } from 'react-desc';\n\nexport const textProps = {\n containerProps: PropTypes.object.description(\n 'Set of Properties attached to the main container',\n ),\n className: PropTypes.string.description('css class'),\n style: PropTypes.object.description('css style'),\n text: PropTypes.string.description('Text to display').isRequired,\n maxCharacters: PropTypes.number.description(\n 'Maximum amount of charachters allowed',\n ),\n maxWidth: PropTypes.string.description('Maximum width allowed'),\n textEllipsis: PropTypes.bool.description('Whether to show ellipsis or not'),\n textAlignment: PropTypes.oneOf(['left', 'center', 'right']).description(\n 'Text alignement',\n ),\n wordBreak: PropTypes.bool.description('Whether to break the line or not'),\n};\n"],"names":["textProps","containerProps","PropTypes","object","description","className","string","style","text","isRequired","maxCharacters","number","maxWidth","textEllipsis","bool","textAlignment","oneOf","wordBreak"],"mappings":";;IAEaA,SAAS,GAAG;EACvBC,cAAc,EAAEC,SAAS,CAACC,MAAV,CAAiBC,WAAjB,CACd,kDADc,CADO;EAIvBC,SAAS,EAAEH,SAAS,CAACI,MAAV,CAAiBF,WAAjB,CAA6B,WAA7B,CAJY;EAKvBG,KAAK,EAAEL,SAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,WAA7B,CALgB;EAMvBI,IAAI,EAAEN,SAAS,CAACI,MAAV,CAAiBF,WAAjB,CAA6B,iBAA7B,EAAgDK,UAN/B;EAOvBC,aAAa,EAAER,SAAS,CAACS,MAAV,CAAiBP,WAAjB,CACb,uCADa,CAPQ;EAUvBQ,QAAQ,EAAEV,SAAS,CAACI,MAAV,CAAiBF,WAAjB,CAA6B,uBAA7B,CAVa;EAWvBS,YAAY,EAAEX,SAAS,CAACY,IAAV,CAAeV,WAAf,CAA2B,iCAA3B,CAXS;EAYvBW,aAAa,EAAEb,SAAS,CAACc,KAAV,CAAgB,CAAC,MAAD,EAAS,QAAT,EAAmB,OAAnB,CAAhB,EAA6CZ,WAA7C,CACb,iBADa,CAZQ;EAevBa,SAAS,EAAEf,SAAS,CAACY,IAAV,CAAeV,WAAf,CAA2B,kCAA3B;AAfY;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-text-wrapper",
3
- "version": "1.61.12",
3
+ "version": "1.61.13",
4
4
  "license": "MIT",
5
5
  "description": "Ellie Mae - Dim Sum - Text Wrapper",
6
6
  "module": "esm/index.js",
@@ -16,7 +16,7 @@
16
16
  "build": "node ../../scripts/build/build.js"
17
17
  },
18
18
  "dependencies": {
19
- "@elliemae/ds-classnames": "1.61.12",
19
+ "@elliemae/ds-classnames": "1.61.13",
20
20
  "react-desc": "^4.1.2"
21
21
  },
22
22
  "peerDependencies": {