@synerise/ds-typography 0.13.2 → 0.14.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/CHANGELOG.md +22 -0
- package/dist/CommonElements.js +1 -1
- package/dist/Ellipsis.d.ts +2 -1
- package/dist/Ellipsis.js +22 -4
- package/dist/Text.d.ts +3 -2
- package/dist/Text.js +11 -5
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.14.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-typography@0.13.3...@synerise/ds-typography@0.14.0) (2023-12-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **table:** ported avatar label solution from UL ([46dfcfe](https://github.com/synerise/synerise-design/commit/46dfcfe7a557aa45aa9b2d35a406da696428f61a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.13.3](https://github.com/synerise/synerise-design/compare/@synerise/ds-typography@0.13.2...@synerise/ds-typography@0.13.3) (2023-11-09)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **table:** avatarlabel cell renderer ([d93ca75](https://github.com/synerise/synerise-design/commit/d93ca7586633a698b6a26923d8618c104276845b))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [0.13.2](https://github.com/synerise/synerise-design/compare/@synerise/ds-typography@0.13.1...@synerise/ds-typography@0.13.2) (2023-10-11)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package @synerise/ds-typography
|
package/dist/CommonElements.js
CHANGED
|
@@ -115,4 +115,4 @@ export var H7 = styled.h6.withConfig({
|
|
|
115
115
|
export var EllipsisText = styled.div.withConfig({
|
|
116
116
|
displayName: "CommonElements__EllipsisText",
|
|
117
117
|
componentId: "sc-102d2aw-16"
|
|
118
|
-
})(["display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;", ",", ",", ",", ",", ",", ",", "{display:inline;}"], H1, H2, H3, H4, H5, H6, H7);
|
|
118
|
+
})(["display:block;white-space:nowrap;text-overflow:ellipsis;max-width:100%;overflow:hidden;", ",", ",", ",", ",", ",", ",", "{display:inline;}", ",", ",", "{font-size:inherit;color:inherit;line-height:inherit;font-weight:inherit;}"], H1, H2, H3, H4, H5, H6, H7, MediumText, SmallText, XSmallText);
|
package/dist/Ellipsis.d.ts
CHANGED
|
@@ -2,5 +2,6 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
export type EllipsisProps = {
|
|
3
3
|
tooltip?: ReactNode;
|
|
4
4
|
children?: ReactNode;
|
|
5
|
+
className?: string;
|
|
5
6
|
};
|
|
6
|
-
export declare const Ellipsis: ({ tooltip, children }: EllipsisProps) => JSX.Element;
|
|
7
|
+
export declare const Ellipsis: ({ tooltip, children, className }: EllipsisProps) => JSX.Element;
|
package/dist/Ellipsis.js
CHANGED
|
@@ -1,23 +1,41 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useState } from 'react';
|
|
2
|
+
import { debounce } from 'lodash';
|
|
2
3
|
import Tooltip from '@synerise/ds-tooltip';
|
|
3
4
|
import { EllipsisText } from './CommonElements';
|
|
4
5
|
export var Ellipsis = function Ellipsis(_ref) {
|
|
5
6
|
var tooltip = _ref.tooltip,
|
|
6
|
-
children = _ref.children
|
|
7
|
+
children = _ref.children,
|
|
8
|
+
className = _ref.className;
|
|
7
9
|
var textComponentRef = useRef(null);
|
|
8
10
|
|
|
9
11
|
var _useState = useState(false),
|
|
10
12
|
truncated = _useState[0],
|
|
11
13
|
setTruncated = _useState[1];
|
|
12
14
|
|
|
15
|
+
var debouncedResize = useRef(debounce(function () {
|
|
16
|
+
if (textComponentRef && textComponentRef.current) {
|
|
17
|
+
setTruncated(textComponentRef.current.offsetWidth < textComponentRef.current.scrollWidth);
|
|
18
|
+
}
|
|
19
|
+
}, 100, {
|
|
20
|
+
leading: true,
|
|
21
|
+
trailing: true
|
|
22
|
+
})).current;
|
|
23
|
+
var resizeObserver = useRef(new window.ResizeObserver(debouncedResize)).current;
|
|
13
24
|
useEffect(function () {
|
|
14
|
-
if (textComponentRef
|
|
15
|
-
|
|
25
|
+
if (textComponentRef.current) {
|
|
26
|
+
resizeObserver.observe(textComponentRef.current);
|
|
27
|
+
resizeObserver.observe(document.body);
|
|
16
28
|
}
|
|
17
|
-
|
|
29
|
+
|
|
30
|
+
return function () {
|
|
31
|
+
resizeObserver.disconnect();
|
|
32
|
+
debouncedResize.cancel();
|
|
33
|
+
};
|
|
34
|
+
}, [resizeObserver, debouncedResize]);
|
|
18
35
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
19
36
|
title: truncated ? tooltip : undefined
|
|
20
37
|
}, /*#__PURE__*/React.createElement(EllipsisText, {
|
|
38
|
+
className: className,
|
|
21
39
|
ref: textComponentRef
|
|
22
40
|
}, children));
|
|
23
41
|
};
|
package/dist/Text.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ type TextProps = {
|
|
|
5
5
|
size?: TextSize;
|
|
6
6
|
ellipsis?: EllipsisProps;
|
|
7
7
|
children?: ReactNode;
|
|
8
|
+
className?: string;
|
|
8
9
|
};
|
|
9
|
-
export declare const Text: ({ size, children, ellipsis }: TextProps) => JSX.Element;
|
|
10
|
-
export
|
|
10
|
+
export declare const Text: ({ size, className, children, ellipsis }: TextProps) => JSX.Element;
|
|
11
|
+
export default Text;
|
package/dist/Text.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { MediumText, SmallText, XSmallText } from './CommonElements';
|
|
3
5
|
import { Ellipsis } from './Ellipsis';
|
|
@@ -5,21 +7,25 @@ var MapSizeToComponent = {
|
|
|
5
7
|
medium: MediumText,
|
|
6
8
|
small: SmallText,
|
|
7
9
|
xsmall: XSmallText
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
+
};
|
|
10
11
|
export var Text = function Text(_ref) {
|
|
11
12
|
var _ref$size = _ref.size,
|
|
12
13
|
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
14
|
+
className = _ref.className,
|
|
13
15
|
children = _ref.children,
|
|
14
16
|
ellipsis = _ref.ellipsis;
|
|
15
17
|
var Component = MapSizeToComponent[size];
|
|
18
|
+
var textClassNames = "ds-text " + (!ellipsis && className);
|
|
16
19
|
var content = /*#__PURE__*/React.createElement(Component, {
|
|
17
|
-
className:
|
|
20
|
+
className: textClassNames
|
|
18
21
|
}, children);
|
|
19
22
|
|
|
20
23
|
if (ellipsis === undefined) {
|
|
21
24
|
return content;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
return /*#__PURE__*/React.createElement(Ellipsis,
|
|
25
|
-
|
|
27
|
+
return /*#__PURE__*/React.createElement(Ellipsis, _extends({
|
|
28
|
+
className: className
|
|
29
|
+
}, ellipsis), content);
|
|
30
|
+
};
|
|
31
|
+
export default Text;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-typography",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Typography UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"types": "dist/index.d.ts",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@synerise/ds-tooltip": "0.14.2",
|
|
37
|
-
"classnames": "2.3.2"
|
|
37
|
+
"classnames": "2.3.2",
|
|
38
|
+
"lodash": "^4.17.20"
|
|
38
39
|
},
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"@synerise/ds-core": "*",
|
|
@@ -45,5 +46,5 @@
|
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"enzyme": "3.11.0"
|
|
47
48
|
},
|
|
48
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "b5c243a1f88351e9bc0185d35fc35ea3673dab89"
|
|
49
50
|
}
|