@elliemae/ds-text-wrapper 3.0.0-next.9 → 3.0.1
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.
- package/dist/cjs/DSTextWrapper.js +10 -16
- package/dist/cjs/DSTextWrapper.js.map +2 -2
- package/dist/cjs/defaultProps.js +9 -16
- package/dist/cjs/defaultProps.js.map +1 -1
- package/dist/cjs/index.js +11 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/props.js +9 -16
- package/dist/cjs/props.js.map +1 -1
- package/dist/esm/DSTextWrapper.js +1 -0
- package/dist/esm/DSTextWrapper.js.map +2 -2
- package/dist/esm/defaultProps.js.map +1 -1
- package/dist/esm/props.js.map +1 -1
- package/package.json +10 -10
|
@@ -21,33 +21,27 @@ var __spreadValues = (a, b) => {
|
|
|
21
21
|
return a;
|
|
22
22
|
};
|
|
23
23
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
24
|
var __export = (target, all) => {
|
|
26
25
|
for (var name in all)
|
|
27
26
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
28
27
|
};
|
|
29
|
-
var
|
|
30
|
-
if (
|
|
31
|
-
for (let key of __getOwnPropNames(
|
|
32
|
-
if (!__hasOwnProp.call(
|
|
33
|
-
__defProp(
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
34
33
|
}
|
|
35
|
-
return
|
|
34
|
+
return to;
|
|
36
35
|
};
|
|
37
|
-
var __toESM = (
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
41
|
-
return (module2, temp) => {
|
|
42
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
43
|
-
};
|
|
44
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
45
38
|
var DSTextWrapper_exports = {};
|
|
46
39
|
__export(DSTextWrapper_exports, {
|
|
47
40
|
DSTextWrapper: () => DSTextWrapper,
|
|
48
41
|
TextWrapperWithSchema: () => TextWrapperWithSchema,
|
|
49
42
|
default: () => DSTextWrapper_default
|
|
50
43
|
});
|
|
44
|
+
module.exports = __toCommonJS(DSTextWrapper_exports);
|
|
51
45
|
var React = __toESM(require("react"));
|
|
52
46
|
var import_react = __toESM(require("react"));
|
|
53
47
|
var import_react_desc = require("react-desc");
|
|
@@ -97,8 +91,8 @@ const DSTextWrapper = ({
|
|
|
97
91
|
};
|
|
98
92
|
DSTextWrapper.propTypes = import_props.textProps;
|
|
99
93
|
DSTextWrapper.defaultProps = import_defaultProps.defaultProps;
|
|
94
|
+
DSTextWrapper.displayName = "DSTextWrapper";
|
|
100
95
|
const TextWrapperWithSchema = (0, import_react_desc.describe)(DSTextWrapper);
|
|
101
96
|
TextWrapperWithSchema.propTypes = import_props.textProps;
|
|
102
97
|
var DSTextWrapper_default = DSTextWrapper;
|
|
103
|
-
module.exports = __toCommonJS(DSTextWrapper_exports);
|
|
104
98
|
//# sourceMappingURL=DSTextWrapper.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSTextWrapper.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"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;\
|
|
5
|
-
"mappings": "
|
|
4
|
+
"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;\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;ADCvB,mBAAkB;AAClB,wBAAyB;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,yCACK,iBADL;AAAA,IAEC,WAAW;AAAA,IACX,OAAO;AAAA,MACL,UAAU,gBAAgB,IAAI,WAAW;AAAA,OACtC;AAAA,MAGJ,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,gCAAS,aAAa;AACpD,sBAAsB,YAAY;AAGlC,IAAO,wBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/defaultProps.js
CHANGED
|
@@ -4,31 +4,25 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
10
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
16
|
}
|
|
18
|
-
return
|
|
17
|
+
return to;
|
|
19
18
|
};
|
|
20
|
-
var __toESM = (
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
21
|
var defaultProps_exports = {};
|
|
29
22
|
__export(defaultProps_exports, {
|
|
30
23
|
defaultProps: () => defaultProps
|
|
31
24
|
});
|
|
25
|
+
module.exports = __toCommonJS(defaultProps_exports);
|
|
32
26
|
var React = __toESM(require("react"));
|
|
33
27
|
const defaultProps = {
|
|
34
28
|
containerProps: {},
|
|
@@ -41,5 +35,4 @@ const defaultProps = {
|
|
|
41
35
|
textAlignment: "left",
|
|
42
36
|
wordBreak: true
|
|
43
37
|
};
|
|
44
|
-
module.exports = __toCommonJS(defaultProps_exports);
|
|
45
38
|
//# sourceMappingURL=defaultProps.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/defaultProps.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,eAAe;AAAA,EAC1B,gBAAgB,CAAC;AAAA,EACjB,WAAW;AAAA,EACX,OAAO,CAAC;AAAA,EACR,MAAM;AAAA,EACN,eAAe;AAAA,EACf,UAAU;AAAA,EACV,cAAc;AAAA,EACd,eAAe;AAAA,EACf,WAAW;AACb;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -4,33 +4,27 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
10
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
16
|
}
|
|
18
|
-
return
|
|
17
|
+
return to;
|
|
19
18
|
};
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
22
|
var src_exports = {};
|
|
29
23
|
__export(src_exports, {
|
|
30
24
|
default: () => import_DSTextWrapper.default
|
|
31
25
|
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
32
27
|
var React = __toESM(require("react"));
|
|
33
|
-
__reExport(src_exports, require("./DSTextWrapper"));
|
|
28
|
+
__reExport(src_exports, require("./DSTextWrapper"), module.exports);
|
|
34
29
|
var import_DSTextWrapper = __toESM(require("./DSTextWrapper"));
|
|
35
|
-
module.exports = __toCommonJS(src_exports);
|
|
36
30
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["export * from './DSTextWrapper';\nexport { default } from './DSTextWrapper';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc,4BAAd;AACA,2BAAwB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/props.js
CHANGED
|
@@ -4,31 +4,25 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
10
|
};
|
|
12
|
-
var
|
|
13
|
-
if (
|
|
14
|
-
for (let key of __getOwnPropNames(
|
|
15
|
-
if (!__hasOwnProp.call(
|
|
16
|
-
__defProp(
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
16
|
}
|
|
18
|
-
return
|
|
17
|
+
return to;
|
|
19
18
|
};
|
|
20
|
-
var __toESM = (
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
21
|
var props_exports = {};
|
|
29
22
|
__export(props_exports, {
|
|
30
23
|
textProps: () => textProps
|
|
31
24
|
});
|
|
25
|
+
module.exports = __toCommonJS(props_exports);
|
|
32
26
|
var React = __toESM(require("react"));
|
|
33
27
|
var import_react_desc = require("react-desc");
|
|
34
28
|
const textProps = {
|
|
@@ -42,5 +36,4 @@ const textProps = {
|
|
|
42
36
|
textAlignment: import_react_desc.PropTypes.oneOf(["left", "center", "right"]).description("Text alignement"),
|
|
43
37
|
wordBreak: import_react_desc.PropTypes.bool.description("Whether to break the line or not")
|
|
44
38
|
};
|
|
45
|
-
module.exports = __toCommonJS(props_exports);
|
|
46
39
|
//# sourceMappingURL=props.js.map
|
package/dist/cjs/props.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/props.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAA0B;AAEnB,MAAM,YAAY;AAAA,EACvB,gBAAgB,4BAAU,OAAO,YAC/B,kDACF;AAAA,EACA,WAAW,4BAAU,OAAO,YAAY,WAAW;AAAA,EACnD,OAAO,4BAAU,OAAO,YAAY,WAAW;AAAA,EAC/C,MAAM,4BAAU,OAAO,YAAY,iBAAiB,EAAE;AAAA,EACtD,eAAe,4BAAU,OAAO,YAC9B,uCACF;AAAA,EACA,UAAU,4BAAU,OAAO,YAAY,uBAAuB;AAAA,EAC9D,cAAc,4BAAU,KAAK,YAAY,iCAAiC;AAAA,EAC1E,eAAe,4BAAU,MAAM,CAAC,QAAQ,UAAU,OAAO,CAAC,EAAE,YAC1D,iBACF;AAAA,EACA,WAAW,4BAAU,KAAK,YAAY,kCAAkC;AAC1E;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -66,6 +66,7 @@ const DSTextWrapper = ({
|
|
|
66
66
|
};
|
|
67
67
|
DSTextWrapper.propTypes = textProps;
|
|
68
68
|
DSTextWrapper.defaultProps = defaultProps;
|
|
69
|
+
DSTextWrapper.displayName = "DSTextWrapper";
|
|
69
70
|
const TextWrapperWithSchema = describe(DSTextWrapper);
|
|
70
71
|
TextWrapperWithSchema.propTypes = textProps;
|
|
71
72
|
var DSTextWrapper_default = DSTextWrapper;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSTextWrapper.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* 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;\
|
|
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;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* 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;\nDSTextWrapper.displayName = 'DSTextWrapper';\nconst TextWrapperWithSchema = describe(DSTextWrapper);\nTextWrapperWithSchema.propTypes = textProps;\n\nexport { DSTextWrapper, TextWrapperWithSchema };\nexport default DSTextWrapper;\n"],
|
|
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,yCACK,iBADL;AAAA,IAEC,WAAW;AAAA,IACX,OAAO;AAAA,MACL,UAAU,gBAAgB,IAAI,WAAW;AAAA,OACtC;AAAA,MAGJ,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
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/defaultProps.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
|
|
5
|
-
"mappings": "AAAA;ACAO,MAAM,eAAe;AAAA,EAC1B,gBAAgB;AAAA,
|
|
5
|
+
"mappings": "AAAA;ACAO,MAAM,eAAe;AAAA,EAC1B,gBAAgB,CAAC;AAAA,EACjB,WAAW;AAAA,EACX,OAAO,CAAC;AAAA,EACR,MAAM;AAAA,EACN,eAAe;AAAA,EACf,UAAU;AAAA,EACV,cAAc;AAAA,EACd,eAAe;AAAA,EACf,WAAW;AACb;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/props.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/props.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AAEO,MAAM,YAAY;AAAA,EACvB,gBAAgB,UAAU,OAAO,YAC/B;AAAA,
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEO,MAAM,YAAY;AAAA,EACvB,gBAAgB,UAAU,OAAO,YAC/B,kDACF;AAAA,EACA,WAAW,UAAU,OAAO,YAAY,WAAW;AAAA,EACnD,OAAO,UAAU,OAAO,YAAY,WAAW;AAAA,EAC/C,MAAM,UAAU,OAAO,YAAY,iBAAiB,EAAE;AAAA,EACtD,eAAe,UAAU,OAAO,YAC9B,uCACF;AAAA,EACA,UAAU,UAAU,OAAO,YAAY,uBAAuB;AAAA,EAC9D,cAAc,UAAU,KAAK,YAAY,iCAAiC;AAAA,EAC1E,eAAe,UAAU,MAAM,CAAC,QAAQ,UAAU,OAAO,CAAC,EAAE,YAC1D,iBACF;AAAA,EACA,WAAW,UAAU,KAAK,YAAY,kCAAkC;AAC1E;",
|
|
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.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Text Wrapper",
|
|
6
6
|
"files": [
|
|
@@ -46,8 +46,15 @@
|
|
|
46
46
|
"reportFile": "tests.xml",
|
|
47
47
|
"indent": 4
|
|
48
48
|
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
|
|
51
|
+
"test": "node ../../scripts/testing/test.mjs",
|
|
52
|
+
"lint": "node ../../scripts/lint.mjs",
|
|
53
|
+
"dts": "node ../../scripts/dts.mjs",
|
|
54
|
+
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
|
|
55
|
+
},
|
|
49
56
|
"dependencies": {
|
|
50
|
-
"@elliemae/ds-classnames": "
|
|
57
|
+
"@elliemae/ds-classnames": "workspace:*",
|
|
51
58
|
"react-desc": "~4.1.3"
|
|
52
59
|
},
|
|
53
60
|
"peerDependencies": {
|
|
@@ -58,12 +65,5 @@
|
|
|
58
65
|
"publishConfig": {
|
|
59
66
|
"access": "public",
|
|
60
67
|
"typeSafety": false
|
|
61
|
-
},
|
|
62
|
-
"scripts": {
|
|
63
|
-
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
|
|
64
|
-
"test": "node ../../scripts/testing/test.mjs",
|
|
65
|
-
"lint": "node ../../scripts/lint.mjs",
|
|
66
|
-
"dts": "node ../../scripts/dts.mjs",
|
|
67
|
-
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
|
|
68
68
|
}
|
|
69
|
-
}
|
|
69
|
+
}
|