@synerise/ds-typography 0.12.9 → 0.13.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.d.ts +1 -0
- package/dist/CommonElements.js +5 -1
- package/dist/Ellipsis.d.ts +6 -0
- package/dist/Ellipsis.js +23 -0
- package/dist/Text.d.ts +5 -2
- package/dist/Text.js +11 -3
- package/dist/Title.d.ts +2 -2
- package/dist/Title.js +11 -5
- package/dist/Title.types.d.ts +3 -1
- package/package.json +3 -2
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.13.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-typography@0.12.10...@synerise/ds-typography@0.13.0) (2023-09-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **typography:** ellipsis with conditional tooltip ([4448c30](https://github.com/synerise/synerise-design/commit/4448c304837bf8a04d5009ffcb47f67421003738))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.12.10](https://github.com/synerise/synerise-design/compare/@synerise/ds-typography@0.12.9...@synerise/ds-typography@0.12.10) (2023-09-08)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **table:** virtual table wrapping issue fixed ([4fcac9d](https://github.com/synerise/synerise-design/commit/4fcac9da76b0543e26e9e27a92ffc994d297108b))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [0.12.9](https://github.com/synerise/synerise-design/compare/@synerise/ds-typography@0.12.8...@synerise/ds-typography@0.12.9) (2023-09-05)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package @synerise/ds-typography
|
package/dist/CommonElements.d.ts
CHANGED
|
@@ -30,3 +30,4 @@ export declare const H6: import("styled-components").StyledComponent<"h6", any,
|
|
|
30
30
|
export declare const H7: import("styled-components").StyledComponent<"h6", any, {
|
|
31
31
|
withoutMargin: boolean;
|
|
32
32
|
}, never>;
|
|
33
|
+
export declare const EllipsisText: import("styled-components").StyledComponent<"div", any, {}, never>;
|
package/dist/CommonElements.js
CHANGED
|
@@ -111,4 +111,8 @@ export var H7 = styled.h6.withConfig({
|
|
|
111
111
|
return css(["", ";"], h100);
|
|
112
112
|
}, function (props) {
|
|
113
113
|
return props.withoutMargin && css(["margin-bottom:0;"]);
|
|
114
|
-
});
|
|
114
|
+
});
|
|
115
|
+
export var EllipsisText = styled.div.withConfig({
|
|
116
|
+
displayName: "CommonElements__EllipsisText",
|
|
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);
|
package/dist/Ellipsis.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useState } from 'react';
|
|
2
|
+
import Tooltip from '@synerise/ds-tooltip';
|
|
3
|
+
import { EllipsisText } from './CommonElements';
|
|
4
|
+
export var Ellipsis = function Ellipsis(_ref) {
|
|
5
|
+
var tooltip = _ref.tooltip,
|
|
6
|
+
children = _ref.children;
|
|
7
|
+
var textComponentRef = useRef(null);
|
|
8
|
+
|
|
9
|
+
var _useState = useState(false),
|
|
10
|
+
truncated = _useState[0],
|
|
11
|
+
setTruncated = _useState[1];
|
|
12
|
+
|
|
13
|
+
useEffect(function () {
|
|
14
|
+
if (textComponentRef != null && textComponentRef.current) {
|
|
15
|
+
setTruncated((textComponentRef == null ? void 0 : textComponentRef.current.offsetWidth) < (textComponentRef == null ? void 0 : textComponentRef.current.scrollWidth));
|
|
16
|
+
}
|
|
17
|
+
}, [children]);
|
|
18
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
19
|
+
title: truncated ? tooltip : undefined
|
|
20
|
+
}, /*#__PURE__*/React.createElement(EllipsisText, {
|
|
21
|
+
ref: textComponentRef
|
|
22
|
+
}, children));
|
|
23
|
+
};
|
package/dist/Text.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { EllipsisProps } from './Ellipsis';
|
|
2
3
|
export declare type TextSize = 'medium' | 'small' | 'xsmall';
|
|
3
4
|
declare type TextProps = {
|
|
4
5
|
size?: TextSize;
|
|
6
|
+
ellipsis?: EllipsisProps;
|
|
7
|
+
children?: ReactNode;
|
|
5
8
|
};
|
|
6
|
-
export declare const Text:
|
|
9
|
+
export declare const Text: ({ size, children, ellipsis }: TextProps) => JSX.Element;
|
|
7
10
|
export {};
|
package/dist/Text.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { MediumText, SmallText, XSmallText } from './CommonElements';
|
|
3
|
+
import { Ellipsis } from './Ellipsis';
|
|
3
4
|
var MapSizeToComponent = {
|
|
4
5
|
medium: MediumText,
|
|
5
6
|
small: SmallText,
|
|
@@ -9,9 +10,16 @@ var MapSizeToComponent = {
|
|
|
9
10
|
export var Text = function Text(_ref) {
|
|
10
11
|
var _ref$size = _ref.size,
|
|
11
12
|
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
12
|
-
children = _ref.children
|
|
13
|
+
children = _ref.children,
|
|
14
|
+
ellipsis = _ref.ellipsis;
|
|
13
15
|
var Component = MapSizeToComponent[size];
|
|
14
|
-
|
|
16
|
+
var content = /*#__PURE__*/React.createElement(Component, {
|
|
15
17
|
className: "ds-text"
|
|
16
18
|
}, children);
|
|
19
|
+
|
|
20
|
+
if (ellipsis === undefined) {
|
|
21
|
+
return content;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return /*#__PURE__*/React.createElement(Ellipsis, ellipsis, content);
|
|
17
25
|
};
|
package/dist/Title.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { Props } from './Title.types';
|
|
3
|
-
declare const Title:
|
|
3
|
+
declare const Title: ({ level, withoutMargin, children, className, ellipsis }: Props) => JSX.Element;
|
|
4
4
|
export default Title;
|
package/dist/Title.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { H1, H2, H3, H4, H5, H6, H7 } from './CommonElements';
|
|
4
|
+
import { Ellipsis } from './Ellipsis';
|
|
4
5
|
var StyledElements = {
|
|
5
6
|
1: H1,
|
|
6
7
|
2: H2,
|
|
@@ -16,15 +17,20 @@ var Title = function Title(_ref) {
|
|
|
16
17
|
level = _ref$level === void 0 ? 1 : _ref$level,
|
|
17
18
|
withoutMargin = _ref.withoutMargin,
|
|
18
19
|
children = _ref.children,
|
|
19
|
-
className = _ref.className
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}, [level]);
|
|
20
|
+
className = _ref.className,
|
|
21
|
+
ellipsis = _ref.ellipsis;
|
|
22
|
+
var TitleElement = StyledElements[level];
|
|
23
23
|
var elementClassName = classNames('ds-title', className);
|
|
24
|
-
|
|
24
|
+
var content = /*#__PURE__*/React.createElement(TitleElement, {
|
|
25
25
|
className: elementClassName,
|
|
26
26
|
withoutMargin: Boolean(withoutMargin)
|
|
27
27
|
}, children);
|
|
28
|
+
|
|
29
|
+
if (ellipsis === undefined) {
|
|
30
|
+
return content;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return /*#__PURE__*/React.createElement(Ellipsis, ellipsis, content);
|
|
28
34
|
};
|
|
29
35
|
|
|
30
36
|
export default Title;
|
package/dist/Title.types.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { TitleProps } from 'antd/es/typography/Title';
|
|
2
|
-
|
|
2
|
+
import type { EllipsisProps } from './Ellipsis';
|
|
3
|
+
export interface Props extends Omit<TitleProps, 'level' | 'ellipsis'> {
|
|
3
4
|
level: 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
4
5
|
withoutMargin?: boolean;
|
|
6
|
+
ellipsis?: EllipsisProps;
|
|
5
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-typography",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Typography UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
],
|
|
33
33
|
"types": "dist/index.d.ts",
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"@synerise/ds-tooltip": "0.14.2",
|
|
35
36
|
"classnames": "2.2.6"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
@@ -43,5 +44,5 @@
|
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"enzyme": "3.11.0"
|
|
45
46
|
},
|
|
46
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "f1f520c4c5ef9f90bacb5d5e0b2e778ceb8fdf79"
|
|
47
48
|
}
|