@elliemae/ds-read-more 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,8 @@ __export(DSReadMore_exports, {
30
30
  });
31
31
  module.exports = __toCommonJS(DSReadMore_exports);
32
32
  var React = __toESM(require("react"));
33
- var import_react = __toESM(require("react"));
33
+ var import_jsx_runtime = require("react/jsx-runtime");
34
+ var import_react = require("react");
34
35
  var import_lodash = require("lodash");
35
36
  var import_ds_utilities = require("@elliemae/ds-utilities");
36
37
  var import_ds_system = require("@elliemae/ds-system");
@@ -101,34 +102,42 @@ const DSReadMore = (props) => {
101
102
  else
102
103
  onLess();
103
104
  };
104
- return /* @__PURE__ */ import_react.default.createElement(Text, {
105
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
105
106
  lines,
106
- expanded
107
- }, /* @__PURE__ */ import_react.default.createElement("span", {
108
- ref,
109
- "data-testid": "ds-read_more-text",
110
- "aria-label": content
111
- }, content), showButton && !withTooltip && /* @__PURE__ */ import_react.default.createElement(import_MoreLessButton.MoreLessButton, {
112
107
  expanded,
113
- label: expanded ? less : more,
114
- onClick: () => toggleExpanded(!expanded),
115
- ariaLabel: expanded ? less : more,
116
- ellipsis,
117
- dataTestId: "ds-read_more-button"
118
- }), withTooltip && /* @__PURE__ */ import_react.default.createElement("div", {
119
- style: {
120
- display: "inline-block"
121
- }
122
- }, /* @__PURE__ */ import_react.default.createElement(import_ds_tooltip.DSTooltipV3, {
123
- text: content
124
- }, /* @__PURE__ */ import_react.default.createElement(import_MoreLessButton.MoreLessButton, {
125
- expanded,
126
- label: "...",
127
- ariaLabel: content,
128
- ellipsis,
129
- withTooltip,
130
- dataTestId: "ds-read_more-tooltip-button"
131
- }))));
108
+ children: [
109
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
110
+ ref,
111
+ "data-testid": "ds-read_more-text",
112
+ "aria-label": content,
113
+ children: content
114
+ }),
115
+ showButton && !withTooltip && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_MoreLessButton.MoreLessButton, {
116
+ expanded,
117
+ label: expanded ? less : more,
118
+ onClick: () => toggleExpanded(!expanded),
119
+ ariaLabel: expanded ? less : more,
120
+ ellipsis,
121
+ dataTestId: "ds-read_more-button"
122
+ }),
123
+ withTooltip && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
124
+ style: {
125
+ display: "inline-block"
126
+ },
127
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_tooltip.DSTooltipV3, {
128
+ text: content,
129
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_MoreLessButton.MoreLessButton, {
130
+ expanded,
131
+ label: "...",
132
+ ariaLabel: content,
133
+ ellipsis,
134
+ withTooltip,
135
+ dataTestId: "ds-read_more-tooltip-button"
136
+ })
137
+ })
138
+ })
139
+ ]
140
+ });
132
141
  };
133
142
  const DSReadMoreProps = {
134
143
  lines: import_ds_utilities.PropTypes.number.description("Ammount of lines after you want to display an ellipsis + more/less button").defaultValue(2),
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/DSReadMore.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
4
  "sourcesContent": ["/* eslint-disable max-lines */\nimport React, { useLayoutEffect, useRef, useState, useCallback } from 'react';\nimport { noop } from 'lodash';\nimport type { WeakValidationMap } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-utilities';\nimport { styled } from '@elliemae/ds-system';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\n\nimport { buttonTypes } from '@elliemae/ds-button';\nimport { dsBasicSizes } from '@elliemae/ds-shared';\nimport { MoreLessButton } from './MoreLessButton';\nimport { DSReadMoreT } from './index.d';\n\nconst Text = styled.span<{ lines: number; expanded: boolean }>`\n display: -webkit-box;\n -webkit-line-clamp: ${({ lines, expanded }) => (expanded ? 'unset' : lines)};\n -webkit-box-orient: vertical;\n -webkit-hyphens: auto;\n -moz-hyphens: auto;\n -ms-hyphens: auto;\n hyphens: auto;\n word-break: break-all;\n`;\n\nconst DSReadMore = (props: DSReadMoreT) => {\n const {\n lines = 2,\n more = 'more',\n less = 'less',\n onMore = noop,\n onLess = noop,\n content,\n ellipsis = '...',\n withTooltip = false,\n } = props;\n const ref = useRef<HTMLElement>(null);\n const [showButton, setShowButton] = useState(false);\n const [expanded, setExpanded] = useState(false);\n\n // offsetHeight + 2 takes into consideration any size of the button\n const overflows = ({ offsetHeight, scrollHeight }: { offsetHeight: number; scrollHeight: number }) =>\n offsetHeight + 2 < scrollHeight;\n\n // Searchs the optimum cut on the text to have the button in the same line\n const binSearchTextOverflow = useCallback(\n (element: HTMLElement, parent: HTMLElement) => {\n const text = element.innerText;\n let left = 1;\n let right = text.length;\n let textEnd = 0;\n while (left <= right) {\n const middle = (left + right) / 2;\n element.innerText = content.slice(0, middle);\n if (overflows(parent)) right = middle - 1;\n else {\n left = middle + 1;\n textEnd = middle;\n }\n }\n element.innerText = content.slice(0, textEnd);\n },\n [content],\n );\n\n useLayoutEffect(() => {\n const textElement = ref.current;\n const parentElement = ref.current?.parentElement;\n if (parentElement && textElement) {\n textElement.innerText = content;\n setShowButton(expanded || overflows(parentElement));\n if (!expanded && overflows(parentElement)) {\n binSearchTextOverflow(textElement, parentElement);\n }\n }\n }, [lines, content, binSearchTextOverflow, expanded, showButton, withTooltip, more, less]);\n\n const toggleExpanded = (newExpanded: boolean) => {\n setExpanded(newExpanded);\n if (newExpanded) onMore();\n else onLess();\n };\n\n return (\n <Text lines={lines} expanded={expanded}>\n <span ref={ref} data-testid=\"ds-read_more-text\" aria-label={content}>\n {content}\n </span>\n {showButton && !withTooltip && (\n <MoreLessButton\n expanded={expanded}\n label={expanded ? less : more}\n onClick={() => toggleExpanded(!expanded)}\n ariaLabel={expanded ? less : more}\n ellipsis={ellipsis}\n dataTestId=\"ds-read_more-button\"\n />\n )}\n {withTooltip && (\n <div\n style={{\n display: 'inline-block',\n }}\n >\n <DSTooltipV3 text={content}>\n <MoreLessButton\n expanded={expanded}\n label=\"...\"\n ariaLabel={content}\n ellipsis={ellipsis}\n withTooltip={withTooltip}\n dataTestId=\"ds-read_more-tooltip-button\"\n />\n </DSTooltipV3>\n </div>\n )}\n </Text>\n );\n};\n\nconst DSReadMoreProps = {\n /** Ammount of lines after you want to display an ellipsis + more/less button */\n lines: PropTypes.number\n .description('Ammount of lines after you want to display an ellipsis + more/less button')\n .defaultValue(2),\n /** Label which will appear on the 'More' button */\n more: PropTypes.string.description(\"Label which will appear on the 'More' button\").defaultValue('more'),\n /** Label which will appear on the 'Less' button */\n less: PropTypes.string.description(\"Label which will appear on the 'Less' button\").defaultValue('less'),\n /** Function which will execute when the user click the 'More' button */\n onMore: PropTypes.func.description(\"Function which will execute when the user click the 'More' button\"),\n /** Function which will execute when the user click the 'Less' button */\n onLess: PropTypes.func.description(\"Function which will execute when the user click the 'Less' button\"),\n /** The text content you want displayed */\n content: PropTypes.string.description('The text content you want displayed').isRequired,\n\n /** 'The type of button for more/less button' */\n buttonType: PropTypes.oneOf(buttonTypes).description('The type for the more/less button').defaultValue('link'),\n /**\n * ['s', 'm', 'l']\n */\n size: PropTypes.oneOf(dsBasicSizes as string[])\n .description('Size of the button')\n .defaultValue('s'),\n\n /** The text you want to appear when truncating */\n ellipsis: PropTypes.string.description('The text you want to appear when truncating').defaultValue('...'),\n withTooltip: PropTypes.bool\n .description('Whether to show expandable tooltip on ellipsis focus instead of expandable buttons')\n .defaultValue('false'),\n};\n\nDSReadMore.propTypes = DSReadMoreProps as WeakValidationMap<unknown>;\n\nconst DSReadMoreWithSchema = describe<DSReadMoreT>(DSReadMore);\n\nDSReadMoreWithSchema.propTypes = DSReadMoreProps;\n\nexport { DSReadMore, DSReadMoreWithSchema };\nexport default DSReadMore;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA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,QACC,OAAO;AAAA,UACL,SAAS;AAAA,QACX;AAAA,QAEA,sDAAC;AAAA,UAAY,MAAM;AAAA,UACjB,sDAAC;AAAA,YACC;AAAA,YACA,OAAM;AAAA,YACN,WAAW;AAAA,YACX;AAAA,YACA;AAAA,YACA,YAAW;AAAA,WACb;AAAA,SACF;AAAA,OACF;AAAA;AAAA,GAEJ;AAEJ;AAEA,MAAM,kBAAkB;AAAA,EAEtB,OAAO,8BAAU,OACd,YAAY,2EAA2E,EACvF,aAAa,CAAC;AAAA,EAEjB,MAAM,8BAAU,OAAO,YAAY,8CAA8C,EAAE,aAAa,MAAM;AAAA,EAEtG,MAAM,8BAAU,OAAO,YAAY,8CAA8C,EAAE,aAAa,MAAM;AAAA,EAEtG,QAAQ,8BAAU,KAAK,YAAY,mEAAmE;AAAA,EAEtG,QAAQ,8BAAU,KAAK,YAAY,mEAAmE;AAAA,EAEtG,SAAS,8BAAU,OAAO,YAAY,qCAAqC,EAAE;AAAA,EAG7E,YAAY,8BAAU,MAAM,4BAAW,EAAE,YAAY,mCAAmC,EAAE,aAAa,MAAM;AAAA,EAI7G,MAAM,8BAAU,MAAM,6BAAwB,EAC3C,YAAY,oBAAoB,EAChC,aAAa,GAAG;AAAA,EAGnB,UAAU,8BAAU,OAAO,YAAY,6CAA6C,EAAE,aAAa,KAAK;AAAA,EACxG,aAAa,8BAAU,KACpB,YAAY,oFAAoF,EAChG,aAAa,OAAO;AACzB;AAEA,WAAW,YAAY;AAEvB,MAAM,2BAAuB,8BAAsB,UAAU;AAE7D,qBAAqB,YAAY;AAGjC,IAAO,qBAAQ;",
6
+ "names": []
7
7
  }
@@ -28,7 +28,7 @@ __export(MoreLessButton_exports, {
28
28
  });
29
29
  module.exports = __toCommonJS(MoreLessButton_exports);
30
30
  var React = __toESM(require("react"));
31
- var import_react = __toESM(require("react"));
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
32
  var import_ds_system = require("@elliemae/ds-system");
33
33
  var import_ds_button = require("@elliemae/ds-button");
34
34
  const StyledButton = (0, import_ds_system.styled)(import_ds_button.DSButtonV2)`
@@ -49,14 +49,20 @@ const StyledButton = (0, import_ds_system.styled)(import_ds_button.DSButtonV2)`
49
49
  `;
50
50
  const MoreLessButton = (props) => {
51
51
  const { expanded, ariaLabel, label, onClick, ellipsis, withTooltip, dataTestId } = props;
52
- return /* @__PURE__ */ import_react.default.createElement("span", null, expanded || withTooltip ? " " : ellipsis, /* @__PURE__ */ import_react.default.createElement(StyledButton, {
53
- withTooltip,
54
- "aria-label": ariaLabel,
55
- buttonType: "text",
56
- onClick,
57
- "aria-hidden": true,
58
- size: "s",
59
- "data-testid": dataTestId
60
- }, label));
52
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
53
+ children: [
54
+ expanded || withTooltip ? " " : ellipsis,
55
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledButton, {
56
+ withTooltip,
57
+ "aria-label": ariaLabel,
58
+ buttonType: "text",
59
+ onClick,
60
+ "aria-hidden": true,
61
+ size: "s",
62
+ "data-testid": dataTestId,
63
+ children: label
64
+ })
65
+ ]
66
+ });
61
67
  };
62
68
  //# sourceMappingURL=MoreLessButton.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/MoreLessButton.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
4
  "sourcesContent": ["import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSButtonV2 } from '@elliemae/ds-button';\n\nimport type { MoreLessButtonT } from './index.d';\n\nconst StyledButton = styled(DSButtonV2)<{ withTooltip: boolean }>`\n padding: 0;\n color: ${({ withTooltip, theme }) => (withTooltip ? 'inherit' : `${theme.colors.brand['600']}`)};\n border: 0;\n margin: 0;\n font-size: 12px;\n font-weight: 200;\n min-width: 0px;\n height: auto;\n text-transform: unset;\n &:hover:not([disabled]) {\n color: ${({ withTooltip, theme }) => (withTooltip ? 'inherit' : `${theme.colors.brand['600']}`)};\n background-color: transparent;\n text-decoration: ${({ withTooltip }) => (withTooltip ? '' : 'underline')};\n }\n`;\nconst MoreLessButton = (props: MoreLessButtonT) => {\n const { expanded, ariaLabel, label, onClick, ellipsis, withTooltip, dataTestId } = props;\n\n return (\n <span>\n {expanded || withTooltip ? ' ' : ellipsis}\n\n <StyledButton\n withTooltip={withTooltip}\n aria-label={ariaLabel}\n buttonType=\"text\"\n onClick={onClick}\n aria-hidden\n size=\"s\"\n data-testid={dataTestId}\n >\n {label}\n </StyledButton>\n </span>\n );\n};\n\nexport { MoreLessButton };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,uBAAuB;AACvB,uBAA2B;AAI3B,MAAM,mBAAe,yBAAO,2BAAU;AAAA;AAAA,WAE3B,CAAC,EAAE,aAAa,MAAM,MAAO,cAAc,YAAY,GAAG,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAS3E,CAAC,EAAE,aAAa,MAAM,MAAO,cAAc,YAAY,GAAG,MAAM,OAAO,MAAM;AAAA;AAAA,uBAEnE,CAAC,EAAE,YAAY,MAAO,cAAc,KAAK;AAAA;AAAA;AAGhE,MAAM,iBAAiB,CAAC,UAA2B;AACjD,QAAM,EAAE,UAAU,WAAW,OAAO,SAAS,UAAU,aAAa,WAAW,IAAI;AAEnF,SACE,6BAAAA,QAAA,cAAC,cACE,YAAY,cAAc,MAAM,UAEjC,6BAAAA,QAAA,cAAC;AAAA,IACC;AAAA,IACA,cAAY;AAAA,IACZ,YAAW;AAAA,IACX;AAAA,IACA,eAAW;AAAA,IACX,MAAK;AAAA,IACL,eAAa;AAAA,KAEZ,KACH,CACF;AAEJ;",
6
- "names": ["React"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AACA,uBAAuB;AACvB,uBAA2B;AAI3B,MAAM,mBAAe,yBAAO,2BAAU;AAAA;AAAA,WAE3B,CAAC,EAAE,aAAa,MAAM,MAAO,cAAc,YAAY,GAAG,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAS3E,CAAC,EAAE,aAAa,MAAM,MAAO,cAAc,YAAY,GAAG,MAAM,OAAO,MAAM;AAAA;AAAA,uBAEnE,CAAC,EAAE,YAAY,MAAO,cAAc,KAAK;AAAA;AAAA;AAGhE,MAAM,iBAAiB,CAAC,UAA2B;AACjD,QAAM,EAAE,UAAU,WAAW,OAAO,SAAS,UAAU,aAAa,WAAW,IAAI;AAEnF,SACE,6CAAC;AAAA,IACE;AAAA,kBAAY,cAAc,MAAM;AAAA,MAEjC,4CAAC;AAAA,QACC;AAAA,QACA,cAAY;AAAA,QACZ,YAAW;AAAA,QACX;AAAA,QACA,eAAW;AAAA,QACX,MAAK;AAAA,QACL,eAAa;AAAA,QAEZ;AAAA,OACH;AAAA;AAAA,GACF;AAEJ;",
6
+ "names": []
7
7
  }
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
- import React2, { useLayoutEffect, useRef, useState, useCallback } from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useLayoutEffect, useRef, useState, useCallback } from "react";
3
4
  import { noop } from "lodash";
4
5
  import { describe, PropTypes } from "@elliemae/ds-utilities";
5
6
  import { styled } from "@elliemae/ds-system";
@@ -70,34 +71,42 @@ const DSReadMore = (props) => {
70
71
  else
71
72
  onLess();
72
73
  };
73
- return /* @__PURE__ */ React2.createElement(Text, {
74
+ return /* @__PURE__ */ jsxs(Text, {
74
75
  lines,
75
- expanded
76
- }, /* @__PURE__ */ React2.createElement("span", {
77
- ref,
78
- "data-testid": "ds-read_more-text",
79
- "aria-label": content
80
- }, content), showButton && !withTooltip && /* @__PURE__ */ React2.createElement(MoreLessButton, {
81
76
  expanded,
82
- label: expanded ? less : more,
83
- onClick: () => toggleExpanded(!expanded),
84
- ariaLabel: expanded ? less : more,
85
- ellipsis,
86
- dataTestId: "ds-read_more-button"
87
- }), withTooltip && /* @__PURE__ */ React2.createElement("div", {
88
- style: {
89
- display: "inline-block"
90
- }
91
- }, /* @__PURE__ */ React2.createElement(DSTooltipV3, {
92
- text: content
93
- }, /* @__PURE__ */ React2.createElement(MoreLessButton, {
94
- expanded,
95
- label: "...",
96
- ariaLabel: content,
97
- ellipsis,
98
- withTooltip,
99
- dataTestId: "ds-read_more-tooltip-button"
100
- }))));
77
+ children: [
78
+ /* @__PURE__ */ jsx("span", {
79
+ ref,
80
+ "data-testid": "ds-read_more-text",
81
+ "aria-label": content,
82
+ children: content
83
+ }),
84
+ showButton && !withTooltip && /* @__PURE__ */ jsx(MoreLessButton, {
85
+ expanded,
86
+ label: expanded ? less : more,
87
+ onClick: () => toggleExpanded(!expanded),
88
+ ariaLabel: expanded ? less : more,
89
+ ellipsis,
90
+ dataTestId: "ds-read_more-button"
91
+ }),
92
+ withTooltip && /* @__PURE__ */ jsx("div", {
93
+ style: {
94
+ display: "inline-block"
95
+ },
96
+ children: /* @__PURE__ */ jsx(DSTooltipV3, {
97
+ text: content,
98
+ children: /* @__PURE__ */ jsx(MoreLessButton, {
99
+ expanded,
100
+ label: "...",
101
+ ariaLabel: content,
102
+ ellipsis,
103
+ withTooltip,
104
+ dataTestId: "ds-read_more-tooltip-button"
105
+ })
106
+ })
107
+ })
108
+ ]
109
+ });
101
110
  };
102
111
  const DSReadMoreProps = {
103
112
  lines: PropTypes.number.description("Ammount of lines after you want to display an ellipsis + more/less button").defaultValue(2),
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSReadMore.tsx"],
4
4
  "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { useLayoutEffect, useRef, useState, useCallback } from 'react';\nimport { noop } from 'lodash';\nimport type { WeakValidationMap } from 'react';\nimport { describe, PropTypes } from '@elliemae/ds-utilities';\nimport { styled } from '@elliemae/ds-system';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\n\nimport { buttonTypes } from '@elliemae/ds-button';\nimport { dsBasicSizes } from '@elliemae/ds-shared';\nimport { MoreLessButton } from './MoreLessButton';\nimport { DSReadMoreT } from './index.d';\n\nconst Text = styled.span<{ lines: number; expanded: boolean }>`\n display: -webkit-box;\n -webkit-line-clamp: ${({ lines, expanded }) => (expanded ? 'unset' : lines)};\n -webkit-box-orient: vertical;\n -webkit-hyphens: auto;\n -moz-hyphens: auto;\n -ms-hyphens: auto;\n hyphens: auto;\n word-break: break-all;\n`;\n\nconst DSReadMore = (props: DSReadMoreT) => {\n const {\n lines = 2,\n more = 'more',\n less = 'less',\n onMore = noop,\n onLess = noop,\n content,\n ellipsis = '...',\n withTooltip = false,\n } = props;\n const ref = useRef<HTMLElement>(null);\n const [showButton, setShowButton] = useState(false);\n const [expanded, setExpanded] = useState(false);\n\n // offsetHeight + 2 takes into consideration any size of the button\n const overflows = ({ offsetHeight, scrollHeight }: { offsetHeight: number; scrollHeight: number }) =>\n offsetHeight + 2 < scrollHeight;\n\n // Searchs the optimum cut on the text to have the button in the same line\n const binSearchTextOverflow = useCallback(\n (element: HTMLElement, parent: HTMLElement) => {\n const text = element.innerText;\n let left = 1;\n let right = text.length;\n let textEnd = 0;\n while (left <= right) {\n const middle = (left + right) / 2;\n element.innerText = content.slice(0, middle);\n if (overflows(parent)) right = middle - 1;\n else {\n left = middle + 1;\n textEnd = middle;\n }\n }\n element.innerText = content.slice(0, textEnd);\n },\n [content],\n );\n\n useLayoutEffect(() => {\n const textElement = ref.current;\n const parentElement = ref.current?.parentElement;\n if (parentElement && textElement) {\n textElement.innerText = content;\n setShowButton(expanded || overflows(parentElement));\n if (!expanded && overflows(parentElement)) {\n binSearchTextOverflow(textElement, parentElement);\n }\n }\n }, [lines, content, binSearchTextOverflow, expanded, showButton, withTooltip, more, less]);\n\n const toggleExpanded = (newExpanded: boolean) => {\n setExpanded(newExpanded);\n if (newExpanded) onMore();\n else onLess();\n };\n\n return (\n <Text lines={lines} expanded={expanded}>\n <span ref={ref} data-testid=\"ds-read_more-text\" aria-label={content}>\n {content}\n </span>\n {showButton && !withTooltip && (\n <MoreLessButton\n expanded={expanded}\n label={expanded ? less : more}\n onClick={() => toggleExpanded(!expanded)}\n ariaLabel={expanded ? less : more}\n ellipsis={ellipsis}\n dataTestId=\"ds-read_more-button\"\n />\n )}\n {withTooltip && (\n <div\n style={{\n display: 'inline-block',\n }}\n >\n <DSTooltipV3 text={content}>\n <MoreLessButton\n expanded={expanded}\n label=\"...\"\n ariaLabel={content}\n ellipsis={ellipsis}\n withTooltip={withTooltip}\n dataTestId=\"ds-read_more-tooltip-button\"\n />\n </DSTooltipV3>\n </div>\n )}\n </Text>\n );\n};\n\nconst DSReadMoreProps = {\n /** Ammount of lines after you want to display an ellipsis + more/less button */\n lines: PropTypes.number\n .description('Ammount of lines after you want to display an ellipsis + more/less button')\n .defaultValue(2),\n /** Label which will appear on the 'More' button */\n more: PropTypes.string.description(\"Label which will appear on the 'More' button\").defaultValue('more'),\n /** Label which will appear on the 'Less' button */\n less: PropTypes.string.description(\"Label which will appear on the 'Less' button\").defaultValue('less'),\n /** Function which will execute when the user click the 'More' button */\n onMore: PropTypes.func.description(\"Function which will execute when the user click the 'More' button\"),\n /** Function which will execute when the user click the 'Less' button */\n onLess: PropTypes.func.description(\"Function which will execute when the user click the 'Less' button\"),\n /** The text content you want displayed */\n content: PropTypes.string.description('The text content you want displayed').isRequired,\n\n /** 'The type of button for more/less button' */\n buttonType: PropTypes.oneOf(buttonTypes).description('The type for the more/less button').defaultValue('link'),\n /**\n * ['s', 'm', 'l']\n */\n size: PropTypes.oneOf(dsBasicSizes as string[])\n .description('Size of the button')\n .defaultValue('s'),\n\n /** The text you want to appear when truncating */\n ellipsis: PropTypes.string.description('The text you want to appear when truncating').defaultValue('...'),\n withTooltip: PropTypes.bool\n .description('Whether to show expandable tooltip on ellipsis focus instead of expandable buttons')\n .defaultValue('false'),\n};\n\nDSReadMore.propTypes = DSReadMoreProps as WeakValidationMap<unknown>;\n\nconst DSReadMoreWithSchema = describe<DSReadMoreT>(DSReadMore);\n\nDSReadMoreWithSchema.propTypes = DSReadMoreProps;\n\nexport { DSReadMore, DSReadMoreWithSchema };\nexport default DSReadMore;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACCvB,OAAOA,UAAS,iBAAiB,QAAQ,UAAU,mBAAmB;AACtE,SAAS,YAAY;AAErB,SAAS,UAAU,iBAAiB;AACpC,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAE5B,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAG/B,MAAM,OAAO,OAAO;AAAA;AAAA,wBAEI,CAAC,EAAE,OAAO,SAAS,MAAO,WAAW,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASvE,MAAM,aAAa,CAAC,UAAuB;AACzC,QAAM;AAAA,IACJ,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS;AAAA,IACT;AAAA,IACA,WAAW;AAAA,IACX,cAAc;AAAA,EAChB,IAAI;AACJ,QAAM,MAAM,OAAoB,IAAI;AACpC,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAG9C,QAAM,YAAY,CAAC,EAAE,cAAc,aAAa,MAC9C,eAAe,IAAI;AAGrB,QAAM,wBAAwB;AAAA,IAC5B,CAAC,SAAsB,WAAwB;AAC7C,YAAM,OAAO,QAAQ;AACrB,UAAI,OAAO;AACX,UAAI,QAAQ,KAAK;AACjB,UAAI,UAAU;AACd,aAAO,QAAQ,OAAO;AACpB,cAAM,UAAU,OAAO,SAAS;AAChC,gBAAQ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YAAY;AAEvB,MAAM,uBAAuB,SAAsB,UAAU;AAE7D,qBAAqB,YAAY;AAGjC,IAAO,qBAAQ;",
6
+ "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import React2 from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { styled } from "@elliemae/ds-system";
4
4
  import { DSButtonV2 } from "@elliemae/ds-button";
5
5
  const StyledButton = styled(DSButtonV2)`
@@ -20,15 +20,21 @@ const StyledButton = styled(DSButtonV2)`
20
20
  `;
21
21
  const MoreLessButton = (props) => {
22
22
  const { expanded, ariaLabel, label, onClick, ellipsis, withTooltip, dataTestId } = props;
23
- return /* @__PURE__ */ React2.createElement("span", null, expanded || withTooltip ? " " : ellipsis, /* @__PURE__ */ React2.createElement(StyledButton, {
24
- withTooltip,
25
- "aria-label": ariaLabel,
26
- buttonType: "text",
27
- onClick,
28
- "aria-hidden": true,
29
- size: "s",
30
- "data-testid": dataTestId
31
- }, label));
23
+ return /* @__PURE__ */ jsxs("span", {
24
+ children: [
25
+ expanded || withTooltip ? " " : ellipsis,
26
+ /* @__PURE__ */ jsx(StyledButton, {
27
+ withTooltip,
28
+ "aria-label": ariaLabel,
29
+ buttonType: "text",
30
+ onClick,
31
+ "aria-hidden": true,
32
+ size: "s",
33
+ "data-testid": dataTestId,
34
+ children: label
35
+ })
36
+ ]
37
+ });
32
38
  };
33
39
  export {
34
40
  MoreLessButton
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/MoreLessButton.tsx"],
4
4
  "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSButtonV2 } from '@elliemae/ds-button';\n\nimport type { MoreLessButtonT } from './index.d';\n\nconst StyledButton = styled(DSButtonV2)<{ withTooltip: boolean }>`\n padding: 0;\n color: ${({ withTooltip, theme }) => (withTooltip ? 'inherit' : `${theme.colors.brand['600']}`)};\n border: 0;\n margin: 0;\n font-size: 12px;\n font-weight: 200;\n min-width: 0px;\n height: auto;\n text-transform: unset;\n &:hover:not([disabled]) {\n color: ${({ withTooltip, theme }) => (withTooltip ? 'inherit' : `${theme.colors.brand['600']}`)};\n background-color: transparent;\n text-decoration: ${({ withTooltip }) => (withTooltip ? '' : 'underline')};\n }\n`;\nconst MoreLessButton = (props: MoreLessButtonT) => {\n const { expanded, ariaLabel, label, onClick, ellipsis, withTooltip, dataTestId } = props;\n\n return (\n <span>\n {expanded || withTooltip ? ' ' : ellipsis}\n\n <StyledButton\n withTooltip={withTooltip}\n aria-label={ariaLabel}\n buttonType=\"text\"\n onClick={onClick}\n aria-hidden\n size=\"s\"\n data-testid={dataTestId}\n >\n {label}\n </StyledButton>\n </span>\n );\n};\n\nexport { MoreLessButton };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAI3B,MAAM,eAAe,OAAO,UAAU;AAAA;AAAA,WAE3B,CAAC,EAAE,aAAa,MAAM,MAAO,cAAc,YAAY,GAAG,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAS3E,CAAC,EAAE,aAAa,MAAM,MAAO,cAAc,YAAY,GAAG,MAAM,OAAO,MAAM;AAAA;AAAA,uBAEnE,CAAC,EAAE,YAAY,MAAO,cAAc,KAAK;AAAA;AAAA;AAGhE,MAAM,iBAAiB,CAAC,UAA2B;AACjD,QAAM,EAAE,UAAU,WAAW,OAAO,SAAS,UAAU,aAAa,WAAW,IAAI;AAEnF,SACE,gBAAAA,OAAA,cAAC,cACE,YAAY,cAAc,MAAM,UAEjC,gBAAAA,OAAA,cAAC;AAAA,IACC;AAAA,IACA,cAAY;AAAA,IACZ,YAAW;AAAA,IACX;AAAA,IACA,eAAW;AAAA,IACX,MAAK;AAAA,IACL,eAAa;AAAA,KAEZ,KACH,CACF;AAEJ;",
6
- "names": ["React"]
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAI3B,MAAM,eAAe,OAAO,UAAU;AAAA;AAAA,WAE3B,CAAC,EAAE,aAAa,MAAM,MAAO,cAAc,YAAY,GAAG,MAAM,OAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAS3E,CAAC,EAAE,aAAa,MAAM,MAAO,cAAc,YAAY,GAAG,MAAM,OAAO,MAAM;AAAA;AAAA,uBAEnE,CAAC,EAAE,YAAY,MAAO,cAAc,KAAK;AAAA;AAAA;AAGhE,MAAM,iBAAiB,CAAC,UAA2B;AACjD,QAAM,EAAE,UAAU,WAAW,OAAO,SAAS,UAAU,aAAa,WAAW,IAAI;AAEnF,SACE,qBAAC;AAAA,IACE;AAAA,kBAAY,cAAc,MAAM;AAAA,MAEjC,oBAAC;AAAA,QACC;AAAA,QACA,cAAY;AAAA,QACZ,YAAW;AAAA,QACX;AAAA,QACA,eAAW;AAAA,QACX,MAAK;AAAA,QACL,eAAa;AAAA,QAEZ;AAAA,OACH;AAAA;AAAA,GACF;AAEJ;",
6
+ "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-read-more",
3
- "version": "3.5.0-rc.7",
3
+ "version": "3.5.1-next.0",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Read More",
6
6
  "files": [
@@ -43,11 +43,11 @@
43
43
  "indent": 4
44
44
  },
45
45
  "dependencies": {
46
- "@elliemae/ds-button": "3.5.0-rc.7",
47
- "@elliemae/ds-shared": "3.5.0-rc.7",
48
- "@elliemae/ds-system": "3.5.0-rc.7",
49
- "@elliemae/ds-tooltip": "3.5.0-rc.7",
50
- "@elliemae/ds-utilities": "3.5.0-rc.7"
46
+ "@elliemae/ds-button": "3.5.1-next.0",
47
+ "@elliemae/ds-shared": "3.5.1-next.0",
48
+ "@elliemae/ds-system": "3.5.1-next.0",
49
+ "@elliemae/ds-tooltip": "3.5.1-next.0",
50
+ "@elliemae/ds-utilities": "3.5.1-next.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@testing-library/dom": "~8.13.0",