@elliemae/ds-read-more 2.0.0-alpha.10 → 2.0.0-alpha.14

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
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _jsx2 = require('@babel/runtime/helpers/jsx');
6
+ require('core-js/modules/web.dom-collections.iterator.js');
6
7
  var react = require('react');
7
8
  var reactDesc = require('react-desc');
8
9
  var styled = require('styled-components');
@@ -18,30 +19,37 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
18
19
 
19
20
  const Text = /*#__PURE__*/styled__default["default"].span.withConfig({
20
21
  componentId: "sc-1c4w5m6-0"
21
- })(["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;"], ({
22
- lines,
23
- expanded
24
- }) => expanded ? 'unset' : lines);
25
-
26
- const DSReadMore = ({
27
- lines = 2,
28
- more = 'more',
29
- less = 'less',
30
- onMore = () => null,
31
- onLess = () => null,
32
- content,
33
- buttonType = 'link',
34
- size = 's',
35
- ellipsis = '...'
36
- }) => {
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;
37
42
  const ref = react.useRef();
38
43
  const [showButton, setShowButton] = react.useState(false);
39
44
  const [expanded, setExpanded] = react.useState(false); // offsetHeight + 2 takes into consideration any size of the button
40
45
 
41
- const overflows = ({
42
- offsetHeight,
43
- scrollHeight
44
- }) => 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
45
53
 
46
54
 
47
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
@@ -1,4 +1,5 @@
1
1
  import _jsx2 from '@babel/runtime/helpers/esm/jsx';
2
+ import 'core-js/modules/web.dom-collections.iterator.js';
2
3
  import { useRef, useState, useLayoutEffect } from 'react';
3
4
  import { PropTypes, describe } from 'react-desc';
4
5
  import styled from 'styled-components';
@@ -9,30 +10,37 @@ import { jsx } from 'react/jsx-runtime';
9
10
 
10
11
  const Text = /*#__PURE__*/styled.span.withConfig({
11
12
  componentId: "sc-1c4w5m6-0"
12
- })(["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;"], ({
13
- lines,
14
- expanded
15
- }) => expanded ? 'unset' : lines);
16
-
17
- const DSReadMore = ({
18
- lines = 2,
19
- more = 'more',
20
- less = 'less',
21
- onMore = () => null,
22
- onLess = () => null,
23
- content,
24
- buttonType = 'link',
25
- size = 's',
26
- ellipsis = '...'
27
- }) => {
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;
28
33
  const ref = useRef();
29
34
  const [showButton, setShowButton] = useState(false);
30
35
  const [expanded, setExpanded] = useState(false); // offsetHeight + 2 takes into consideration any size of the button
31
36
 
32
- const overflows = ({
33
- offsetHeight,
34
- scrollHeight
35
- }) => 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
36
44
 
37
45
 
38
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-alpha.10",
3
+ "version": "2.0.0-alpha.14",
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-alpha.10",
43
+ "@elliemae/ds-button": "2.0.0-alpha.14",
44
+ "@elliemae/ds-shared": "2.0.0-alpha.14",
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 };
package/cjs/package.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "type": "commonjs",
3
- "sideEffects": [
4
- "*.css",
5
- "*.scss"
6
- ]
7
- }
package/esm/package.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "type": "module",
3
- "sideEffects": [
4
- "*.css",
5
- "*.scss"
6
- ]
7
- }