@elliemae/ds-read-more 2.0.0-next.8 → 2.0.0-rc.11

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/cjs/DSReadMore.js CHANGED
@@ -19,30 +19,37 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
19
19
 
20
20
  const Text = /*#__PURE__*/styled__default["default"].span.withConfig({
21
21
  componentId: "sc-1c4w5m6-0"
22
- })(["display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;word-break:break-all;"], ({
23
- lines,
24
- expanded
25
- }) => expanded ? 'unset' : lines);
26
-
27
- const DSReadMore = ({
28
- lines = 2,
29
- more = 'more',
30
- less = 'less',
31
- onMore = () => null,
32
- onLess = () => null,
33
- content,
34
- buttonType = 'link',
35
- size = 's',
36
- ellipsis = '...'
37
- }) => {
22
+ })(["display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;word-break:break-all;"], _ref => {
23
+ let {
24
+ lines,
25
+ expanded
26
+ } = _ref;
27
+ return expanded ? 'unset' : lines;
28
+ });
29
+
30
+ const DSReadMore = _ref2 => {
31
+ let {
32
+ lines = 2,
33
+ more = 'more',
34
+ less = 'less',
35
+ onMore = () => null,
36
+ onLess = () => null,
37
+ content,
38
+ buttonType = 'link',
39
+ size = 's',
40
+ ellipsis = '...'
41
+ } = _ref2;
38
42
  const ref = react.useRef();
39
43
  const [showButton, setShowButton] = react.useState(false);
40
44
  const [expanded, setExpanded] = react.useState(false); // offsetHeight + 2 takes into consideration any size of the button
41
45
 
42
- const overflows = ({
43
- offsetHeight,
44
- scrollHeight
45
- }) => offsetHeight + 2 < scrollHeight; // Searchs the optimum cut on the text to have the button in the same line
46
+ const overflows = _ref3 => {
47
+ let {
48
+ offsetHeight,
49
+ scrollHeight
50
+ } = _ref3;
51
+ return offsetHeight + 2 < scrollHeight;
52
+ }; // Searchs the optimum cut on the text to have the button in the same line
46
53
 
47
54
 
48
55
  const binSearchTextOverflow = (element, parent) => {
@@ -11,19 +11,22 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
11
11
  var _jsx2__default = /*#__PURE__*/_interopDefaultLegacy(_jsx2);
12
12
  var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
13
13
 
14
- const MoreLessButton = ({
15
- expanded,
16
- label,
17
- onClick,
18
- buttonType,
19
- size,
20
- ellipsis
21
- }) => /*#__PURE__*/_jsx2__default["default"]("span", {}, void 0, expanded ? ' ' : ellipsis, /*#__PURE__*/_jsx2__default["default"](DSButton__default["default"], {
22
- buttonType: buttonType,
23
- labelText: label,
24
- onClick: onClick,
25
- size: size,
26
- "data-testid": "ds-read_more-button"
27
- }));
14
+ const MoreLessButton = _ref => {
15
+ let {
16
+ expanded,
17
+ label,
18
+ onClick,
19
+ buttonType,
20
+ size,
21
+ ellipsis
22
+ } = _ref;
23
+ return /*#__PURE__*/_jsx2__default["default"]("span", {}, void 0, expanded ? ' ' : ellipsis, /*#__PURE__*/_jsx2__default["default"](DSButton__default["default"], {
24
+ buttonType: buttonType,
25
+ labelText: label,
26
+ onClick: onClick,
27
+ size: size,
28
+ "data-testid": "ds-read_more-button"
29
+ }));
30
+ };
28
31
 
29
32
  exports.MoreLessButton = MoreLessButton;
package/esm/DSReadMore.js CHANGED
@@ -10,30 +10,37 @@ import { jsx } from 'react/jsx-runtime';
10
10
 
11
11
  const Text = /*#__PURE__*/styled.span.withConfig({
12
12
  componentId: "sc-1c4w5m6-0"
13
- })(["display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;word-break:break-all;"], ({
14
- lines,
15
- expanded
16
- }) => expanded ? 'unset' : lines);
17
-
18
- const DSReadMore = ({
19
- lines = 2,
20
- more = 'more',
21
- less = 'less',
22
- onMore = () => null,
23
- onLess = () => null,
24
- content,
25
- buttonType = 'link',
26
- size = 's',
27
- ellipsis = '...'
28
- }) => {
13
+ })(["display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;word-break:break-all;"], _ref => {
14
+ let {
15
+ lines,
16
+ expanded
17
+ } = _ref;
18
+ return expanded ? 'unset' : lines;
19
+ });
20
+
21
+ const DSReadMore = _ref2 => {
22
+ let {
23
+ lines = 2,
24
+ more = 'more',
25
+ less = 'less',
26
+ onMore = () => null,
27
+ onLess = () => null,
28
+ content,
29
+ buttonType = 'link',
30
+ size = 's',
31
+ ellipsis = '...'
32
+ } = _ref2;
29
33
  const ref = useRef();
30
34
  const [showButton, setShowButton] = useState(false);
31
35
  const [expanded, setExpanded] = useState(false); // offsetHeight + 2 takes into consideration any size of the button
32
36
 
33
- const overflows = ({
34
- offsetHeight,
35
- scrollHeight
36
- }) => offsetHeight + 2 < scrollHeight; // Searchs the optimum cut on the text to have the button in the same line
37
+ const overflows = _ref3 => {
38
+ let {
39
+ offsetHeight,
40
+ scrollHeight
41
+ } = _ref3;
42
+ return offsetHeight + 2 < scrollHeight;
43
+ }; // Searchs the optimum cut on the text to have the button in the same line
37
44
 
38
45
 
39
46
  const binSearchTextOverflow = (element, parent) => {
@@ -2,19 +2,22 @@ import _jsx2 from '@babel/runtime/helpers/esm/jsx';
2
2
  import 'react';
3
3
  import DSButton from '@elliemae/ds-button';
4
4
 
5
- const MoreLessButton = ({
6
- expanded,
7
- label,
8
- onClick,
9
- buttonType,
10
- size,
11
- ellipsis
12
- }) => /*#__PURE__*/_jsx2("span", {}, void 0, expanded ? ' ' : ellipsis, /*#__PURE__*/_jsx2(DSButton, {
13
- buttonType: buttonType,
14
- labelText: label,
15
- onClick: onClick,
16
- size: size,
17
- "data-testid": "ds-read_more-button"
18
- }));
5
+ const MoreLessButton = _ref => {
6
+ let {
7
+ expanded,
8
+ label,
9
+ onClick,
10
+ buttonType,
11
+ size,
12
+ ellipsis
13
+ } = _ref;
14
+ return /*#__PURE__*/_jsx2("span", {}, void 0, expanded ? ' ' : ellipsis, /*#__PURE__*/_jsx2(DSButton, {
15
+ buttonType: buttonType,
16
+ labelText: label,
17
+ onClick: onClick,
18
+ size: size,
19
+ "data-testid": "ds-read_more-button"
20
+ }));
21
+ };
19
22
 
20
23
  export { MoreLessButton };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-read-more",
3
- "version": "2.0.0-next.8",
3
+ "version": "2.0.0-rc.11",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Read More",
6
6
  "module": "./esm/index.js",
@@ -40,16 +40,18 @@
40
40
  "build": "node ../../scripts/build/build.js"
41
41
  },
42
42
  "dependencies": {
43
- "@elliemae/ds-button": "2.0.0-next.8",
43
+ "@elliemae/ds-button": "2.0.0-rc.11",
44
+ "@elliemae/ds-shared": "2.0.0-rc.11",
44
45
  "react-desc": "~4.1.3"
45
46
  },
46
47
  "devDependencies": {
47
- "styled-components": "~5.3.1"
48
+ "@testing-library/react": "~12.1.2",
49
+ "styled-components": "~5.3.3"
48
50
  },
49
51
  "peerDependencies": {
50
52
  "react": "^17.0.2",
51
53
  "react-dom": "^17.0.2",
52
- "styled-components": "^5.3.1"
54
+ "styled-components": "^5.3.3"
53
55
  },
54
56
  "publishConfig": {
55
57
  "access": "public",
@@ -1,3 +1,4 @@
1
+ /// <reference path="../../../../shared/typings/react-desc.d.ts" />
1
2
  /// <reference types="react" />
2
3
  declare const DSReadMore: {
3
4
  ({ lines, more, less, onMore, onLess, content, buttonType, size, ellipsis, }: {
@@ -13,25 +14,47 @@ declare const DSReadMore: {
13
14
  }): JSX.Element;
14
15
  propTypes: {
15
16
  /** Ammount of lines after you want to display an ellipsis + more/less button */
16
- lines: any;
17
+ lines: {
18
+ deprecated: import("react-desc").PropTypesDescValidator;
19
+ };
17
20
  /** Label which will appear on the 'More' button */
18
- more: any;
21
+ more: {
22
+ deprecated: import("react-desc").PropTypesDescValidator;
23
+ };
19
24
  /** Label which will appear on the 'Less' button */
20
- less: any;
25
+ less: {
26
+ deprecated: import("react-desc").PropTypesDescValidator;
27
+ };
21
28
  /** Function which will execute when the user click the 'More' button */
22
- onMore: any;
29
+ onMore: {
30
+ defaultValue<T = unknown>(arg: T): {
31
+ deprecated: import("react-desc").PropTypesDescValidator;
32
+ };
33
+ isRequired: import("react-desc").PropTypesDescValidator;
34
+ };
23
35
  /** Function which will execute when the user click the 'Less' button */
24
- onLess: any;
36
+ onLess: {
37
+ defaultValue<T = unknown>(arg: T): {
38
+ deprecated: import("react-desc").PropTypesDescValidator;
39
+ };
40
+ isRequired: import("react-desc").PropTypesDescValidator;
41
+ };
25
42
  /** The text content you want displayed */
26
43
  content: any;
27
44
  /** 'The type of button for more/less button' */
28
- buttonType: any;
45
+ buttonType: {
46
+ deprecated: import("react-desc").PropTypesDescValidator;
47
+ };
29
48
  /**
30
49
  * ['s', 'm', 'l']
31
50
  */
32
- size: any;
51
+ size: {
52
+ deprecated: import("react-desc").PropTypesDescValidator;
53
+ };
33
54
  /** The text you want to appear when truncating */
34
- ellipsis: any;
55
+ ellipsis: {
56
+ deprecated: import("react-desc").PropTypesDescValidator;
57
+ };
35
58
  };
36
59
  };
37
60
  declare const DSReadMoreWithSchema: any;
@@ -1,3 +1,4 @@
1
+ /// <reference path="../../../../shared/typings/react-desc.d.ts" />
1
2
  /// <reference types="react" />
2
3
  declare const MoreLessButton: {
3
4
  ({ expanded, label, onClick, buttonType, size, ellipsis, }: {
@@ -10,11 +11,11 @@ declare const MoreLessButton: {
10
11
  }): JSX.Element;
11
12
  propTypes: {
12
13
  expanded: any;
13
- label: any;
14
- onClick: any;
15
- buttonType: any;
16
- size: any;
17
- ellipsis: any;
14
+ label: import("react-desc").PropTypesDescValue;
15
+ onClick: import("react-desc").PropTypesDescValue;
16
+ buttonType: import("react-desc").PropTypesDescValue;
17
+ size: import("react-desc").PropTypesDescValue;
18
+ ellipsis: import("react-desc").PropTypesDescValue;
18
19
  };
19
20
  };
20
21
  export { MoreLessButton };