@elliemae/ds-read-more 2.1.0-rc.6 → 2.1.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.
- package/cjs/DSReadMore.js +41 -26
- package/cjs/MoreLessButton.js +38 -13
- package/cjs/index.d.js +2 -0
- package/esm/DSReadMore.js +40 -25
- package/esm/MoreLessButton.js +37 -12
- package/esm/index.d.js +1 -0
- package/package.json +3 -3
- package/types/DSReadMore.d.ts +9 -57
- package/types/MoreLessButton.d.ts +2 -19
- package/types/index.d.d.ts +19 -0
package/cjs/DSReadMore.js
CHANGED
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _jsx2 = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
7
|
var react = require('react');
|
|
8
|
+
var lodash = require('lodash');
|
|
8
9
|
var reactDesc = require('react-desc');
|
|
9
10
|
var styled = require('styled-components');
|
|
10
|
-
var
|
|
11
|
+
var dsTooltip = require('@elliemae/ds-tooltip');
|
|
12
|
+
var dsButton = require('@elliemae/ds-button');
|
|
11
13
|
var propTypes = require('@elliemae/ds-shared/prop-types');
|
|
12
14
|
var MoreLessButton = require('./MoreLessButton.js');
|
|
13
15
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -27,32 +29,31 @@ const Text = /*#__PURE__*/styled__default["default"].span.withConfig({
|
|
|
27
29
|
return expanded ? 'unset' : lines;
|
|
28
30
|
});
|
|
29
31
|
|
|
30
|
-
const DSReadMore =
|
|
31
|
-
|
|
32
|
+
const DSReadMore = props => {
|
|
33
|
+
const {
|
|
32
34
|
lines = 2,
|
|
33
35
|
more = 'more',
|
|
34
36
|
less = 'less',
|
|
35
|
-
onMore =
|
|
36
|
-
onLess =
|
|
37
|
+
onMore = lodash.noop,
|
|
38
|
+
onLess = lodash.noop,
|
|
37
39
|
content,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const ref = react.useRef();
|
|
40
|
+
ellipsis = '...',
|
|
41
|
+
withTooltip = false
|
|
42
|
+
} = props;
|
|
43
|
+
const ref = react.useRef(null);
|
|
43
44
|
const [showButton, setShowButton] = react.useState(false);
|
|
44
45
|
const [expanded, setExpanded] = react.useState(false); // offsetHeight + 2 takes into consideration any size of the button
|
|
45
46
|
|
|
46
|
-
const overflows =
|
|
47
|
+
const overflows = _ref2 => {
|
|
47
48
|
let {
|
|
48
49
|
offsetHeight,
|
|
49
50
|
scrollHeight
|
|
50
|
-
} =
|
|
51
|
+
} = _ref2;
|
|
51
52
|
return offsetHeight + 2 < scrollHeight;
|
|
52
53
|
}; // Searchs the optimum cut on the text to have the button in the same line
|
|
53
54
|
|
|
54
55
|
|
|
55
|
-
const binSearchTextOverflow = (element, parent) => {
|
|
56
|
+
const binSearchTextOverflow = react.useCallback((element, parent) => {
|
|
56
57
|
const text = element.innerText;
|
|
57
58
|
let left = 1;
|
|
58
59
|
let right = text.length;
|
|
@@ -68,15 +69,14 @@ const DSReadMore = _ref2 => {
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
element.innerText = content.slice(0, textEnd);
|
|
71
|
-
};
|
|
72
|
-
|
|
72
|
+
}, [content]);
|
|
73
73
|
react.useLayoutEffect(() => {
|
|
74
74
|
var _ref$current;
|
|
75
75
|
|
|
76
76
|
const textElement = ref.current;
|
|
77
77
|
const parentElement = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.parentElement;
|
|
78
78
|
|
|
79
|
-
if (parentElement) {
|
|
79
|
+
if (parentElement && textElement) {
|
|
80
80
|
textElement.innerText = content;
|
|
81
81
|
setShowButton(expanded || overflows(parentElement));
|
|
82
82
|
|
|
@@ -84,7 +84,7 @@ const DSReadMore = _ref2 => {
|
|
|
84
84
|
binSearchTextOverflow(textElement, parentElement);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
}, [lines, content, expanded, showButton, more, less]);
|
|
87
|
+
}, [lines, content, binSearchTextOverflow, expanded, showButton, withTooltip, more, less]);
|
|
88
88
|
|
|
89
89
|
const toggleExpanded = newExpanded => {
|
|
90
90
|
setExpanded(newExpanded);
|
|
@@ -97,15 +97,29 @@ const DSReadMore = _ref2 => {
|
|
|
97
97
|
}, void 0, /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
98
98
|
ref: ref,
|
|
99
99
|
"data-testid": "ds-read_more-text",
|
|
100
|
+
"aria-label": content,
|
|
100
101
|
children: content
|
|
101
|
-
}), showButton &&
|
|
102
|
+
}), showButton && !withTooltip && /*#__PURE__*/_jsx2__default["default"](MoreLessButton.MoreLessButton, {
|
|
102
103
|
expanded: expanded,
|
|
103
104
|
label: expanded ? less : more,
|
|
104
105
|
onClick: () => toggleExpanded(!expanded),
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
})
|
|
106
|
+
ariaLabel: expanded ? less : more,
|
|
107
|
+
ellipsis: ellipsis,
|
|
108
|
+
dataTestId: "ds-read_more-button"
|
|
109
|
+
}), withTooltip && /*#__PURE__*/_jsx2__default["default"]("div", {
|
|
110
|
+
style: {
|
|
111
|
+
display: 'inline-block'
|
|
112
|
+
}
|
|
113
|
+
}, void 0, /*#__PURE__*/_jsx2__default["default"](dsTooltip.DSTooltipV3, {
|
|
114
|
+
text: content
|
|
115
|
+
}, void 0, /*#__PURE__*/_jsx2__default["default"](MoreLessButton.MoreLessButton, {
|
|
116
|
+
expanded: expanded,
|
|
117
|
+
label: "...",
|
|
118
|
+
ariaLabel: content,
|
|
119
|
+
ellipsis: ellipsis,
|
|
120
|
+
withTooltip: withTooltip,
|
|
121
|
+
dataTestId: "ds-read_more-tooltip-button"
|
|
122
|
+
}))));
|
|
109
123
|
};
|
|
110
124
|
|
|
111
125
|
const DSReadMoreProps = {
|
|
@@ -125,10 +139,10 @@ const DSReadMoreProps = {
|
|
|
125
139
|
onLess: reactDesc.PropTypes.func.description("Function which will execute when the user click the 'Less' button"),
|
|
126
140
|
|
|
127
141
|
/** The text content you want displayed */
|
|
128
|
-
content: reactDesc.PropTypes.string.
|
|
142
|
+
content: reactDesc.PropTypes.string.description('The text content you want displayed').isRequired,
|
|
129
143
|
|
|
130
144
|
/** 'The type of button for more/less button' */
|
|
131
|
-
buttonType: reactDesc.PropTypes.oneOf(
|
|
145
|
+
buttonType: reactDesc.PropTypes.oneOf(dsButton.buttonTypes).description('The type for the more/less button').defaultValue('link'),
|
|
132
146
|
|
|
133
147
|
/**
|
|
134
148
|
* ['s', 'm', 'l']
|
|
@@ -136,9 +150,10 @@ const DSReadMoreProps = {
|
|
|
136
150
|
size: reactDesc.PropTypes.oneOf(propTypes.dsBasicSizes).description('Size of the button').defaultValue('s'),
|
|
137
151
|
|
|
138
152
|
/** The text you want to appear when truncating */
|
|
139
|
-
ellipsis: reactDesc.PropTypes.string.description('The text you want to appear when truncating').defaultValue('...')
|
|
153
|
+
ellipsis: reactDesc.PropTypes.string.description('The text you want to appear when truncating').defaultValue('...'),
|
|
154
|
+
withTooltip: reactDesc.PropTypes.bool.description('Whether to show expandable tooltip on ellipsis focus instead of expandable buttons').defaultValue('false')
|
|
140
155
|
};
|
|
141
|
-
const DSReadMoreWithSchema = reactDesc.describe(DSReadMore)
|
|
156
|
+
const DSReadMoreWithSchema = reactDesc.describe(DSReadMore);
|
|
142
157
|
DSReadMoreWithSchema.propTypes = DSReadMoreProps;
|
|
143
158
|
|
|
144
159
|
exports.DSReadMore = DSReadMore;
|
package/cjs/MoreLessButton.js
CHANGED
|
@@ -4,29 +4,54 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _jsx2 = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
require('react');
|
|
7
|
-
var
|
|
7
|
+
var styled = require('styled-components');
|
|
8
|
+
var dsButton = require('@elliemae/ds-button');
|
|
8
9
|
|
|
9
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
11
|
|
|
11
12
|
var _jsx2__default = /*#__PURE__*/_interopDefaultLegacy(_jsx2);
|
|
12
|
-
var
|
|
13
|
+
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
13
14
|
|
|
14
|
-
const
|
|
15
|
+
const StyledButton = /*#__PURE__*/styled__default["default"](dsButton.DSButtonV2).withConfig({
|
|
16
|
+
componentId: "sc-1innsd2-0"
|
|
17
|
+
})(["padding:0;color:", ";border:0;margin:0;font-size:12px;font-weight:200;min-width:0px;height:auto;text-transform:unset;&:hover:not([disabled]){color:", ";background-color:transparent;text-decoration:", ";}"], _ref => {
|
|
15
18
|
let {
|
|
19
|
+
withTooltip,
|
|
20
|
+
theme
|
|
21
|
+
} = _ref;
|
|
22
|
+
return withTooltip ? 'inherit' : "".concat(theme.colors.brand['600']);
|
|
23
|
+
}, _ref2 => {
|
|
24
|
+
let {
|
|
25
|
+
withTooltip,
|
|
26
|
+
theme
|
|
27
|
+
} = _ref2;
|
|
28
|
+
return withTooltip ? 'inherit' : "".concat(theme.colors.brand['600']);
|
|
29
|
+
}, _ref3 => {
|
|
30
|
+
let {
|
|
31
|
+
withTooltip
|
|
32
|
+
} = _ref3;
|
|
33
|
+
return withTooltip ? '' : 'underline';
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const MoreLessButton = props => {
|
|
37
|
+
const {
|
|
16
38
|
expanded,
|
|
39
|
+
ariaLabel,
|
|
17
40
|
label,
|
|
18
41
|
onClick,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} =
|
|
23
|
-
return /*#__PURE__*/_jsx2__default["default"]("span", {}, void 0, expanded ? ' ' : ellipsis, /*#__PURE__*/_jsx2__default["default"](
|
|
24
|
-
|
|
25
|
-
|
|
42
|
+
ellipsis,
|
|
43
|
+
withTooltip,
|
|
44
|
+
dataTestId
|
|
45
|
+
} = props;
|
|
46
|
+
return /*#__PURE__*/_jsx2__default["default"]("span", {}, void 0, expanded || withTooltip ? ' ' : ellipsis, /*#__PURE__*/_jsx2__default["default"](StyledButton, {
|
|
47
|
+
withTooltip: withTooltip,
|
|
48
|
+
"aria-label": ariaLabel,
|
|
49
|
+
buttonType: "text",
|
|
26
50
|
onClick: onClick,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
51
|
+
"aria-hidden": true,
|
|
52
|
+
size: "s",
|
|
53
|
+
"data-testid": dataTestId
|
|
54
|
+
}, void 0, label));
|
|
30
55
|
};
|
|
31
56
|
|
|
32
57
|
exports.MoreLessButton = MoreLessButton;
|
package/cjs/index.d.js
ADDED
package/esm/DSReadMore.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import _jsx2 from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
-
import { useRef, useState, useLayoutEffect } from 'react';
|
|
3
|
+
import { useRef, useState, useCallback, useLayoutEffect } from 'react';
|
|
4
|
+
import { noop } from 'lodash';
|
|
4
5
|
import { PropTypes, describe } from 'react-desc';
|
|
5
6
|
import styled from 'styled-components';
|
|
7
|
+
import { DSTooltipV3 } from '@elliemae/ds-tooltip';
|
|
6
8
|
import { buttonTypes } from '@elliemae/ds-button';
|
|
7
9
|
import { dsBasicSizes } from '@elliemae/ds-shared/prop-types';
|
|
8
10
|
import { MoreLessButton } from './MoreLessButton.js';
|
|
@@ -18,32 +20,31 @@ const Text = /*#__PURE__*/styled.span.withConfig({
|
|
|
18
20
|
return expanded ? 'unset' : lines;
|
|
19
21
|
});
|
|
20
22
|
|
|
21
|
-
const DSReadMore =
|
|
22
|
-
|
|
23
|
+
const DSReadMore = props => {
|
|
24
|
+
const {
|
|
23
25
|
lines = 2,
|
|
24
26
|
more = 'more',
|
|
25
27
|
less = 'less',
|
|
26
|
-
onMore =
|
|
27
|
-
onLess =
|
|
28
|
+
onMore = noop,
|
|
29
|
+
onLess = noop,
|
|
28
30
|
content,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const ref = useRef();
|
|
31
|
+
ellipsis = '...',
|
|
32
|
+
withTooltip = false
|
|
33
|
+
} = props;
|
|
34
|
+
const ref = useRef(null);
|
|
34
35
|
const [showButton, setShowButton] = useState(false);
|
|
35
36
|
const [expanded, setExpanded] = useState(false); // offsetHeight + 2 takes into consideration any size of the button
|
|
36
37
|
|
|
37
|
-
const overflows =
|
|
38
|
+
const overflows = _ref2 => {
|
|
38
39
|
let {
|
|
39
40
|
offsetHeight,
|
|
40
41
|
scrollHeight
|
|
41
|
-
} =
|
|
42
|
+
} = _ref2;
|
|
42
43
|
return offsetHeight + 2 < scrollHeight;
|
|
43
44
|
}; // Searchs the optimum cut on the text to have the button in the same line
|
|
44
45
|
|
|
45
46
|
|
|
46
|
-
const binSearchTextOverflow = (element, parent) => {
|
|
47
|
+
const binSearchTextOverflow = useCallback((element, parent) => {
|
|
47
48
|
const text = element.innerText;
|
|
48
49
|
let left = 1;
|
|
49
50
|
let right = text.length;
|
|
@@ -59,15 +60,14 @@ const DSReadMore = _ref2 => {
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
element.innerText = content.slice(0, textEnd);
|
|
62
|
-
};
|
|
63
|
-
|
|
63
|
+
}, [content]);
|
|
64
64
|
useLayoutEffect(() => {
|
|
65
65
|
var _ref$current;
|
|
66
66
|
|
|
67
67
|
const textElement = ref.current;
|
|
68
68
|
const parentElement = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.parentElement;
|
|
69
69
|
|
|
70
|
-
if (parentElement) {
|
|
70
|
+
if (parentElement && textElement) {
|
|
71
71
|
textElement.innerText = content;
|
|
72
72
|
setShowButton(expanded || overflows(parentElement));
|
|
73
73
|
|
|
@@ -75,7 +75,7 @@ const DSReadMore = _ref2 => {
|
|
|
75
75
|
binSearchTextOverflow(textElement, parentElement);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
}, [lines, content, expanded, showButton, more, less]);
|
|
78
|
+
}, [lines, content, binSearchTextOverflow, expanded, showButton, withTooltip, more, less]);
|
|
79
79
|
|
|
80
80
|
const toggleExpanded = newExpanded => {
|
|
81
81
|
setExpanded(newExpanded);
|
|
@@ -88,15 +88,29 @@ const DSReadMore = _ref2 => {
|
|
|
88
88
|
}, void 0, /*#__PURE__*/jsx("span", {
|
|
89
89
|
ref: ref,
|
|
90
90
|
"data-testid": "ds-read_more-text",
|
|
91
|
+
"aria-label": content,
|
|
91
92
|
children: content
|
|
92
|
-
}), showButton &&
|
|
93
|
+
}), showButton && !withTooltip && /*#__PURE__*/_jsx2(MoreLessButton, {
|
|
93
94
|
expanded: expanded,
|
|
94
95
|
label: expanded ? less : more,
|
|
95
96
|
onClick: () => toggleExpanded(!expanded),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
})
|
|
97
|
+
ariaLabel: expanded ? less : more,
|
|
98
|
+
ellipsis: ellipsis,
|
|
99
|
+
dataTestId: "ds-read_more-button"
|
|
100
|
+
}), withTooltip && /*#__PURE__*/_jsx2("div", {
|
|
101
|
+
style: {
|
|
102
|
+
display: 'inline-block'
|
|
103
|
+
}
|
|
104
|
+
}, void 0, /*#__PURE__*/_jsx2(DSTooltipV3, {
|
|
105
|
+
text: content
|
|
106
|
+
}, void 0, /*#__PURE__*/_jsx2(MoreLessButton, {
|
|
107
|
+
expanded: expanded,
|
|
108
|
+
label: "...",
|
|
109
|
+
ariaLabel: content,
|
|
110
|
+
ellipsis: ellipsis,
|
|
111
|
+
withTooltip: withTooltip,
|
|
112
|
+
dataTestId: "ds-read_more-tooltip-button"
|
|
113
|
+
}))));
|
|
100
114
|
};
|
|
101
115
|
|
|
102
116
|
const DSReadMoreProps = {
|
|
@@ -116,7 +130,7 @@ const DSReadMoreProps = {
|
|
|
116
130
|
onLess: PropTypes.func.description("Function which will execute when the user click the 'Less' button"),
|
|
117
131
|
|
|
118
132
|
/** The text content you want displayed */
|
|
119
|
-
content: PropTypes.string.
|
|
133
|
+
content: PropTypes.string.description('The text content you want displayed').isRequired,
|
|
120
134
|
|
|
121
135
|
/** 'The type of button for more/less button' */
|
|
122
136
|
buttonType: PropTypes.oneOf(buttonTypes).description('The type for the more/less button').defaultValue('link'),
|
|
@@ -127,9 +141,10 @@ const DSReadMoreProps = {
|
|
|
127
141
|
size: PropTypes.oneOf(dsBasicSizes).description('Size of the button').defaultValue('s'),
|
|
128
142
|
|
|
129
143
|
/** The text you want to appear when truncating */
|
|
130
|
-
ellipsis: PropTypes.string.description('The text you want to appear when truncating').defaultValue('...')
|
|
144
|
+
ellipsis: PropTypes.string.description('The text you want to appear when truncating').defaultValue('...'),
|
|
145
|
+
withTooltip: PropTypes.bool.description('Whether to show expandable tooltip on ellipsis focus instead of expandable buttons').defaultValue('false')
|
|
131
146
|
};
|
|
132
|
-
const DSReadMoreWithSchema = describe(DSReadMore)
|
|
147
|
+
const DSReadMoreWithSchema = describe(DSReadMore);
|
|
133
148
|
DSReadMoreWithSchema.propTypes = DSReadMoreProps;
|
|
134
149
|
|
|
135
150
|
export { DSReadMore, DSReadMoreWithSchema, DSReadMore as default };
|
package/esm/MoreLessButton.js
CHANGED
|
@@ -1,23 +1,48 @@
|
|
|
1
1
|
import _jsx2 from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import 'react';
|
|
3
|
-
import
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { DSButtonV2 } from '@elliemae/ds-button';
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
+
const StyledButton = /*#__PURE__*/styled(DSButtonV2).withConfig({
|
|
7
|
+
componentId: "sc-1innsd2-0"
|
|
8
|
+
})(["padding:0;color:", ";border:0;margin:0;font-size:12px;font-weight:200;min-width:0px;height:auto;text-transform:unset;&:hover:not([disabled]){color:", ";background-color:transparent;text-decoration:", ";}"], _ref => {
|
|
6
9
|
let {
|
|
10
|
+
withTooltip,
|
|
11
|
+
theme
|
|
12
|
+
} = _ref;
|
|
13
|
+
return withTooltip ? 'inherit' : "".concat(theme.colors.brand['600']);
|
|
14
|
+
}, _ref2 => {
|
|
15
|
+
let {
|
|
16
|
+
withTooltip,
|
|
17
|
+
theme
|
|
18
|
+
} = _ref2;
|
|
19
|
+
return withTooltip ? 'inherit' : "".concat(theme.colors.brand['600']);
|
|
20
|
+
}, _ref3 => {
|
|
21
|
+
let {
|
|
22
|
+
withTooltip
|
|
23
|
+
} = _ref3;
|
|
24
|
+
return withTooltip ? '' : 'underline';
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const MoreLessButton = props => {
|
|
28
|
+
const {
|
|
7
29
|
expanded,
|
|
30
|
+
ariaLabel,
|
|
8
31
|
label,
|
|
9
32
|
onClick,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} =
|
|
14
|
-
return /*#__PURE__*/_jsx2("span", {}, void 0, expanded ? ' ' : ellipsis, /*#__PURE__*/_jsx2(
|
|
15
|
-
|
|
16
|
-
|
|
33
|
+
ellipsis,
|
|
34
|
+
withTooltip,
|
|
35
|
+
dataTestId
|
|
36
|
+
} = props;
|
|
37
|
+
return /*#__PURE__*/_jsx2("span", {}, void 0, expanded || withTooltip ? ' ' : ellipsis, /*#__PURE__*/_jsx2(StyledButton, {
|
|
38
|
+
withTooltip: withTooltip,
|
|
39
|
+
"aria-label": ariaLabel,
|
|
40
|
+
buttonType: "text",
|
|
17
41
|
onClick: onClick,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
42
|
+
"aria-hidden": true,
|
|
43
|
+
size: "s",
|
|
44
|
+
"data-testid": dataTestId
|
|
45
|
+
}, void 0, label));
|
|
21
46
|
};
|
|
22
47
|
|
|
23
48
|
export { MoreLessButton };
|
package/esm/index.d.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-read-more",
|
|
3
|
-
"version": "2.1.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Read More",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"build": "node ../../scripts/build/build.js"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@elliemae/ds-button": "2.1.0
|
|
44
|
-
"@elliemae/ds-shared": "2.1.0
|
|
43
|
+
"@elliemae/ds-button": "2.1.0",
|
|
44
|
+
"@elliemae/ds-shared": "2.1.0",
|
|
45
45
|
"react-desc": "~4.1.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
package/types/DSReadMore.d.ts
CHANGED
|
@@ -1,62 +1,14 @@
|
|
|
1
1
|
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
-
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { DSReadMoreT } from './index.d';
|
|
3
4
|
declare const DSReadMore: {
|
|
4
|
-
(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
buttonType?: string | undefined;
|
|
12
|
-
size?: string | undefined;
|
|
13
|
-
ellipsis?: string | undefined;
|
|
14
|
-
}): JSX.Element;
|
|
15
|
-
propTypes: {
|
|
16
|
-
/** Ammount of lines after you want to display an ellipsis + more/less button */
|
|
17
|
-
lines: {
|
|
18
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
19
|
-
};
|
|
20
|
-
/** Label which will appear on the 'More' button */
|
|
21
|
-
more: {
|
|
22
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
23
|
-
};
|
|
24
|
-
/** Label which will appear on the 'Less' button */
|
|
25
|
-
less: {
|
|
26
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
27
|
-
};
|
|
28
|
-
/** Function which will execute when the user click the 'More' button */
|
|
29
|
-
onMore: {
|
|
30
|
-
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
31
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
32
|
-
};
|
|
33
|
-
isRequired: import("react-desc").PropTypesDescValue;
|
|
34
|
-
};
|
|
35
|
-
/** Function which will execute when the user click the 'Less' button */
|
|
36
|
-
onLess: {
|
|
37
|
-
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
38
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
39
|
-
};
|
|
40
|
-
isRequired: import("react-desc").PropTypesDescValue;
|
|
41
|
-
};
|
|
42
|
-
/** The text content you want displayed */
|
|
43
|
-
content: any;
|
|
44
|
-
/** 'The type of button for more/less button' */
|
|
45
|
-
buttonType: {
|
|
46
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* ['s', 'm', 'l']
|
|
50
|
-
*/
|
|
51
|
-
size: {
|
|
52
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
53
|
-
};
|
|
54
|
-
/** The text you want to appear when truncating */
|
|
55
|
-
ellipsis: {
|
|
56
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
57
|
-
};
|
|
58
|
-
};
|
|
5
|
+
(props: DSReadMoreT): JSX.Element;
|
|
6
|
+
propTypes: React.WeakValidationMap<unknown>;
|
|
7
|
+
};
|
|
8
|
+
declare const DSReadMoreWithSchema: {
|
|
9
|
+
(props?: DSReadMoreT | undefined): JSX.Element;
|
|
10
|
+
propTypes: unknown;
|
|
11
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
59
12
|
};
|
|
60
|
-
declare const DSReadMoreWithSchema: any;
|
|
61
13
|
export { DSReadMore, DSReadMoreWithSchema };
|
|
62
14
|
export default DSReadMore;
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
1
|
/// <reference types="react" />
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
expanded: any;
|
|
6
|
-
label: any;
|
|
7
|
-
onClick: any;
|
|
8
|
-
buttonType: any;
|
|
9
|
-
size: any;
|
|
10
|
-
ellipsis: any;
|
|
11
|
-
}): JSX.Element;
|
|
12
|
-
propTypes: {
|
|
13
|
-
expanded: 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;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
2
|
+
import type { MoreLessButtonT } from './index.d';
|
|
3
|
+
declare const MoreLessButton: (props: MoreLessButtonT) => JSX.Element;
|
|
21
4
|
export { MoreLessButton };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface DSReadMoreT {
|
|
2
|
+
lines: number;
|
|
3
|
+
more: string;
|
|
4
|
+
less: string;
|
|
5
|
+
onMore: () => void;
|
|
6
|
+
onLess: () => void;
|
|
7
|
+
content: string;
|
|
8
|
+
ellipsis: string;
|
|
9
|
+
withTooltip?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface MoreLessButtonT {
|
|
12
|
+
expanded: boolean;
|
|
13
|
+
label: string;
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
ellipsis: string;
|
|
16
|
+
withTooltip?: boolean;
|
|
17
|
+
ariaLabel: string;
|
|
18
|
+
dataTestId: string;
|
|
19
|
+
}
|