@elliemae/ds-text-wrapper 3.5.0-rc.7 → 3.5.1-next.0
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.
|
@@ -30,7 +30,7 @@ __export(DSTextWrapper_exports, {
|
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(DSTextWrapper_exports);
|
|
32
32
|
var React = __toESM(require("react"));
|
|
33
|
-
var
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
34
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
35
35
|
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
36
36
|
var import_props = require("./props");
|
|
@@ -69,21 +69,23 @@ const DSTextWrapper = ({
|
|
|
69
69
|
if (textEllipsis)
|
|
70
70
|
displayText = maxCharacters > 0 ? displayText.substring(0, maxCharacters) : displayText;
|
|
71
71
|
else if (maxCharacters > 0) {
|
|
72
|
-
displayText = limitPerCharacter().map((textpart, index) => /* @__PURE__ */
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
},
|
|
72
|
+
displayText = limitPerCharacter().map((textpart, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
73
|
+
className: classNameElement("line"),
|
|
74
|
+
children: textpart
|
|
75
|
+
}, index));
|
|
76
76
|
}
|
|
77
|
-
return /* @__PURE__ */
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
78
78
|
...containerProps,
|
|
79
79
|
className: cssClassName,
|
|
80
80
|
style: {
|
|
81
81
|
maxWidth: maxCharacters < 1 ? maxWidth : null,
|
|
82
82
|
...style
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
},
|
|
84
|
+
children: textEllipsis ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
85
|
+
className: classNameElement("ellipsis-wrapperRef"),
|
|
86
|
+
children: displayText
|
|
87
|
+
}) : displayText
|
|
88
|
+
});
|
|
87
89
|
};
|
|
88
90
|
DSTextWrapper.propTypes = import_props.textProps;
|
|
89
91
|
DSTextWrapper.defaultProps = import_defaultProps.defaultProps;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSTextWrapper.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable react/no-array-index-key */\nimport React from 'react';\nimport { describe } from '@elliemae/ds-utilities';\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;\nDSTextWrapper.displayName = 'DSTextWrapper';\nconst TextWrapperWithSchema = describe(DSTextWrapper);\nTextWrapperWithSchema.propTypes = textProps;\n\nexport { DSTextWrapper, TextWrapperWithSchema };\nexport default DSTextWrapper;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAEA,0BAAyB;AACzB,2BAA0C;AAC1C,mBAA0B;AAC1B,0BAA6B;AAS7B,MAAM,gBAAgB,CAAC;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,cAAc,iBAAiB,QAAI;AAAA,IACzC;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,QAAM,oBAAoB,MACxB,KAAK,MAAM,GAAG,EAAE;AAAA,IACd,CAAC,QAAQ,SAAS;AAChB,UAAI,cAAc,OAAO,SAAS;AAClC,UAAI,OAAO,aAAa,SAAS,KAAK,SAAS;AAC7C,uBAAe;AACjB,aAAO,eAAe,GAAG,OAAO,gBAAgB,MAAM;AACtD,aAAO;AAAA,IACT;AAAA,IACA,CAAC,EAAE;AAAA,EACL;AAEF,MAAI,cAAc;AAElB,MAAI;AACF,kBACE,gBAAgB,IAAI,YAAY,UAAU,GAAG,aAAa,IAAI;AAAA,WACzD,gBAAgB,GAAG;AAC1B,kBAAc,kBAAkB,EAAE,IAAI,CAAC,UAAU,UAC/C,4CAAC;AAAA,MAAiB,WAAW,iBAAiB,MAAM;AAAA,MACjD;AAAA,OADQ,KAEX,CACD;AAAA,EACH;AAEA,SACE,4CAAC;AAAA,IACE,GAAG;AAAA,IACJ,WAAW;AAAA,IACX,OAAO;AAAA,MACL,UAAU,gBAAgB,IAAI,WAAW;AAAA,MACzC,GAAG;AAAA,IACL;AAAA,IAEC,yBACC,4CAAC;AAAA,MAAK,WAAW,iBAAiB,qBAAqB;AAAA,MACpD;AAAA,KACH,IAEA;AAAA,GAEJ;AAEJ;AAEA,cAAc,YAAY;AAC1B,cAAc,eAAe;AAC7B,cAAc,cAAc;AAC5B,MAAM,4BAAwB,8BAAS,aAAa;AACpD,sBAAsB,YAAY;AAGlC,IAAO,wBAAQ;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { describe } from "@elliemae/ds-utilities";
|
|
4
4
|
import { convertPropToCssClassName } from "@elliemae/ds-classnames";
|
|
5
5
|
import { textProps } from "./props";
|
|
@@ -38,21 +38,23 @@ const DSTextWrapper = ({
|
|
|
38
38
|
if (textEllipsis)
|
|
39
39
|
displayText = maxCharacters > 0 ? displayText.substring(0, maxCharacters) : displayText;
|
|
40
40
|
else if (maxCharacters > 0) {
|
|
41
|
-
displayText = limitPerCharacter().map((textpart, index) => /* @__PURE__ */
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
41
|
+
displayText = limitPerCharacter().map((textpart, index) => /* @__PURE__ */ jsx("span", {
|
|
42
|
+
className: classNameElement("line"),
|
|
43
|
+
children: textpart
|
|
44
|
+
}, index));
|
|
45
45
|
}
|
|
46
|
-
return /* @__PURE__ */
|
|
46
|
+
return /* @__PURE__ */ jsx("span", {
|
|
47
47
|
...containerProps,
|
|
48
48
|
className: cssClassName,
|
|
49
49
|
style: {
|
|
50
50
|
maxWidth: maxCharacters < 1 ? maxWidth : null,
|
|
51
51
|
...style
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
},
|
|
53
|
+
children: textEllipsis ? /* @__PURE__ */ jsx("span", {
|
|
54
|
+
className: classNameElement("ellipsis-wrapperRef"),
|
|
55
|
+
children: displayText
|
|
56
|
+
}) : displayText
|
|
57
|
+
});
|
|
56
58
|
};
|
|
57
59
|
DSTextWrapper.propTypes = textProps;
|
|
58
60
|
DSTextWrapper.defaultProps = defaultProps;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSTextWrapper.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/no-array-index-key */\nimport React from 'react';\nimport { describe } from '@elliemae/ds-utilities';\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;\nDSTextWrapper.displayName = 'DSTextWrapper';\nconst TextWrapperWithSchema = describe(DSTextWrapper);\nTextWrapperWithSchema.propTypes = textProps;\n\nexport { DSTextWrapper, TextWrapperWithSchema };\nexport default DSTextWrapper;\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAEA,SAAS,gBAAgB;AACzB,SAAS,iCAAiC;AAC1C,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAS7B,MAAM,gBAAgB,CAAC;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,cAAc,iBAAiB,IAAI;AAAA,IACzC;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,QAAM,oBAAoB,MACxB,KAAK,MAAM,GAAG,EAAE;AAAA,IACd,CAAC,QAAQ,SAAS;AAChB,UAAI,cAAc,OAAO,SAAS;AAClC,UAAI,OAAO,aAAa,SAAS,KAAK,SAAS;AAC7C,uBAAe;AACjB,aAAO,eAAe,GAAG,OAAO,gBAAgB,MAAM;AACtD,aAAO;AAAA,IACT;AAAA,IACA,CAAC,EAAE;AAAA,EACL;AAEF,MAAI,cAAc;AAElB,MAAI;AACF,kBACE,gBAAgB,IAAI,YAAY,UAAU,GAAG,aAAa,IAAI;AAAA,WACzD,gBAAgB,GAAG;AAC1B,kBAAc,kBAAkB,EAAE,IAAI,CAAC,UAAU,UAC/C,oBAAC;AAAA,MAAiB,WAAW,iBAAiB,MAAM;AAAA,MACjD;AAAA,OADQ,KAEX,CACD;AAAA,EACH;AAEA,SACE,oBAAC;AAAA,IACE,GAAG;AAAA,IACJ,WAAW;AAAA,IACX,OAAO;AAAA,MACL,UAAU,gBAAgB,IAAI,WAAW;AAAA,MACzC,GAAG;AAAA,IACL;AAAA,IAEC,yBACC,oBAAC;AAAA,MAAK,WAAW,iBAAiB,qBAAqB;AAAA,MACpD;AAAA,KACH,IAEA;AAAA,GAEJ;AAEJ;AAEA,cAAc,YAAY;AAC1B,cAAc,eAAe;AAC7B,cAAc,cAAc;AAC5B,MAAM,wBAAwB,SAAS,aAAa;AACpD,sBAAsB,YAAY;AAGlC,IAAO,wBAAQ;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-text-wrapper",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.1-next.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Text Wrapper",
|
|
6
6
|
"files": [
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"indent": 4
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@elliemae/ds-classnames": "3.5.
|
|
51
|
-
"@elliemae/ds-utilities": "3.5.
|
|
50
|
+
"@elliemae/ds-classnames": "3.5.1-next.0",
|
|
51
|
+
"@elliemae/ds-utilities": "3.5.1-next.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"lodash": "^4.17.21",
|