@elliemae/ds-text-wrapper 3.3.0-next.2 → 3.3.0-next.5
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,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -81,12 +64,14 @@ const DSTextWrapper = ({
|
|
|
81
64
|
className: classNameElement("line")
|
|
82
65
|
}, textpart));
|
|
83
66
|
}
|
|
84
|
-
return /* @__PURE__ */ import_react.default.createElement("span",
|
|
67
|
+
return /* @__PURE__ */ import_react.default.createElement("span", {
|
|
68
|
+
...containerProps,
|
|
85
69
|
className: cssClassName,
|
|
86
|
-
style:
|
|
87
|
-
maxWidth: maxCharacters < 1 ? maxWidth : null
|
|
88
|
-
|
|
89
|
-
|
|
70
|
+
style: {
|
|
71
|
+
maxWidth: maxCharacters < 1 ? maxWidth : null,
|
|
72
|
+
...style
|
|
73
|
+
}
|
|
74
|
+
}, textEllipsis ? /* @__PURE__ */ import_react.default.createElement("span", {
|
|
90
75
|
className: classNameElement("ellipsis-wrapperRef")
|
|
91
76
|
}, displayText) : displayText);
|
|
92
77
|
};
|
|
@@ -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": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAkB;AAClB,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;AAAA,MACI;AACJ,QAAM,EAAE,cAAc,qBAAqB,oDACzC,mBACA,WACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF,CACF;AACA,QAAM,oBAAoB,MACxB,KAAK,MAAM,GAAG,EAAE,OACd,CAAC,QAAQ,SAAS;AAChB,QAAI,cAAc,OAAO,SAAS;AAClC,QAAI,OAAO,aAAa,SAAS,KAAK,SAAS;AAC7C,qBAAe;AACjB,WAAO,eAAe,GAAG,OAAO,gBAAgB,MAAM;AACtD,WAAO;AAAA,EACT,GACA,CAAC,EAAE,CACL;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,mDAAC;AAAA,MAAK,KAAK;AAAA,MAAO,WAAW,iBAAiB,MAAM;AAAA,OACjD,QACH,CACD;AAAA,EACH;AAEA,SACE,mDAAC;AAAA,IACE,GAAG;AAAA,IACJ,WAAW;AAAA,IACX,OAAO;AAAA,MACL,UAAU,gBAAgB,IAAI,WAAW;AAAA,MACzC,GAAG;AAAA,IACL;AAAA,KAEC,eACC,mDAAC;AAAA,IAAK,WAAW,iBAAiB,qBAAqB;AAAA,KACpD,WACH,IAEA,WAEJ;AAEJ;AAEA,cAAc,YAAY;AAC1B,cAAc,eAAe;AAC7B,cAAc,cAAc;AAC5B,MAAM,wBAAwB,kCAAS,aAAa;AACpD,sBAAsB,YAAY;AAGlC,IAAO,wBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
import * as React from "react";
|
|
22
3
|
import React2 from "react";
|
|
23
4
|
import { describe } from "@elliemae/ds-utilities";
|
|
@@ -56,12 +37,14 @@ const DSTextWrapper = ({
|
|
|
56
37
|
className: classNameElement("line")
|
|
57
38
|
}, textpart));
|
|
58
39
|
}
|
|
59
|
-
return /* @__PURE__ */ React2.createElement("span",
|
|
40
|
+
return /* @__PURE__ */ React2.createElement("span", {
|
|
41
|
+
...containerProps,
|
|
60
42
|
className: cssClassName,
|
|
61
|
-
style:
|
|
62
|
-
maxWidth: maxCharacters < 1 ? maxWidth : null
|
|
63
|
-
|
|
64
|
-
|
|
43
|
+
style: {
|
|
44
|
+
maxWidth: maxCharacters < 1 ? maxWidth : null,
|
|
45
|
+
...style
|
|
46
|
+
}
|
|
47
|
+
}, textEllipsis ? /* @__PURE__ */ React2.createElement("span", {
|
|
65
48
|
className: classNameElement("ellipsis-wrapperRef")
|
|
66
49
|
}, displayText) : displayText);
|
|
67
50
|
};
|
|
@@ -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": "
|
|
5
|
+
"mappings": ";AAAA;ACCA;AACA;AACA;AACA;AACA;AASA,MAAM,gBAAgB,CAAC;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MACI;AACJ,QAAM,EAAE,cAAc,qBAAqB,0BACzC,mBACA,WACA;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF,CACF;AACA,QAAM,oBAAoB,MACxB,KAAK,MAAM,GAAG,EAAE,OACd,CAAC,QAAQ,SAAS;AAChB,QAAI,cAAc,OAAO,SAAS;AAClC,QAAI,OAAO,aAAa,SAAS,KAAK,SAAS;AAC7C,qBAAe;AACjB,WAAO,eAAe,GAAG,OAAO,gBAAgB,MAAM;AACtD,WAAO;AAAA,EACT,GACA,CAAC,EAAE,CACL;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,qCAAC;AAAA,MAAK,KAAK;AAAA,MAAO,WAAW,iBAAiB,MAAM;AAAA,OACjD,QACH,CACD;AAAA,EACH;AAEA,SACE,qCAAC;AAAA,IACE,GAAG;AAAA,IACJ,WAAW;AAAA,IACX,OAAO;AAAA,MACL,UAAU,gBAAgB,IAAI,WAAW;AAAA,MACzC,GAAG;AAAA,IACL;AAAA,KAEC,eACC,qCAAC;AAAA,IAAK,WAAW,iBAAiB,qBAAqB;AAAA,KACpD,WACH,IAEA,WAEJ;AAEJ;AAEA,cAAc,YAAY;AAC1B,cAAc,eAAe;AAC7B,cAAc,cAAc;AAC5B,MAAM,wBAAwB,SAAS,aAAa;AACpD,sBAAsB,YAAY;AAGlC,IAAO,wBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-text-wrapper",
|
|
3
|
-
"version": "3.3.0-next.
|
|
3
|
+
"version": "3.3.0-next.5",
|
|
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.3.0-next.
|
|
51
|
-
"@elliemae/ds-utilities": "3.3.0-next.
|
|
50
|
+
"@elliemae/ds-classnames": "3.3.0-next.5",
|
|
51
|
+
"@elliemae/ds-utilities": "3.3.0-next.5"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"lodash": "^4.17.21",
|