@synerise/ds-typography 0.12.8 → 0.12.10

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 CHANGED
@@ -3,6 +3,25 @@
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.12.10](https://github.com/synerise/synerise-design/compare/@synerise/ds-typography@0.12.9...@synerise/ds-typography@0.12.10) (2023-09-08)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **table:** virtual table wrapping issue fixed ([4fcac9d](https://github.com/synerise/synerise-design/commit/4fcac9da76b0543e26e9e27a92ffc994d297108b))
12
+
13
+
14
+
15
+
16
+
17
+ ## [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)
18
+
19
+ **Note:** Version bump only for package @synerise/ds-typography
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.12.8](https://github.com/synerise/synerise-design/compare/@synerise/ds-typography@0.12.7...@synerise/ds-typography@0.12.8) (2023-06-28)
7
26
 
8
27
 
@@ -1,6 +1,7 @@
1
1
  export declare const Description: import("styled-components").StyledComponent<"div", any, {
2
2
  disabled?: boolean | undefined;
3
3
  }, never>;
4
+ export declare const EllipsisText: import("styled-components").StyledComponent<"div", any, {}, never>;
4
5
  export declare const ErrorText: import("styled-components").StyledComponent<"div", any, {}, never>;
5
6
  export declare const Label: import("styled-components").StyledComponent<"label", any, {}, never>;
6
7
  export declare const MediumText: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -8,57 +8,61 @@ export var Description = styled.div.withConfig({
8
8
  }, function (props) {
9
9
  return props.disabled ? "opacity: 0.4;" : '';
10
10
  });
11
+ export var EllipsisText = styled.div.withConfig({
12
+ displayName: "CommonElements__EllipsisText",
13
+ componentId: "sc-102d2aw-1"
14
+ })(["display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;"]);
11
15
  export var ErrorText = styled.div.withConfig({
12
16
  displayName: "CommonElements__ErrorText",
13
- componentId: "sc-102d2aw-1"
17
+ componentId: "sc-102d2aw-2"
14
18
  })(["color:", ";margin-bottom:4px;"], function (props) {
15
19
  return props.theme.palette['red-600'];
16
20
  });
17
21
  export var Label = styled.label.withConfig({
18
22
  displayName: "CommonElements__Label",
19
- componentId: "sc-102d2aw-2"
23
+ componentId: "sc-102d2aw-3"
20
24
  })(["color:", ";font-weight:500;display:block;cursor:pointer;"], function (props) {
21
25
  return props.theme.palette['grey-800'];
22
26
  });
23
27
  export var MediumText = styled.span.withConfig({
24
28
  displayName: "CommonElements__MediumText",
25
- componentId: "sc-102d2aw-3"
29
+ componentId: "sc-102d2aw-4"
26
30
  })(["", ""], function () {
27
31
  return css(["", ";"], medium);
28
32
  });
29
33
  export var SmallText = styled.span.withConfig({
30
34
  displayName: "CommonElements__SmallText",
31
- componentId: "sc-102d2aw-4"
35
+ componentId: "sc-102d2aw-5"
32
36
  })(["", ""], function () {
33
37
  return css(["", ";"], small);
34
38
  });
35
39
  export var XSmallText = styled.span.withConfig({
36
40
  displayName: "CommonElements__XSmallText",
37
- componentId: "sc-102d2aw-5"
41
+ componentId: "sc-102d2aw-6"
38
42
  })(["", ""], function () {
39
43
  return css(["", ";"], xsmall);
40
44
  });
41
45
  export var MediumParagraph = styled.span.withConfig({
42
46
  displayName: "CommonElements__MediumParagraph",
43
- componentId: "sc-102d2aw-6"
47
+ componentId: "sc-102d2aw-7"
44
48
  })(["", ""], function () {
45
49
  return css(["", ";"], medium);
46
50
  });
47
51
  export var SmallParagraph = styled.span.withConfig({
48
52
  displayName: "CommonElements__SmallParagraph",
49
- componentId: "sc-102d2aw-7"
53
+ componentId: "sc-102d2aw-8"
50
54
  })(["", ""], function () {
51
55
  return css(["", ";"], small);
52
56
  });
53
57
  export var XSmallParagraph = styled.span.withConfig({
54
58
  displayName: "CommonElements__XSmallParagraph",
55
- componentId: "sc-102d2aw-8"
59
+ componentId: "sc-102d2aw-9"
56
60
  })(["", ""], function () {
57
61
  return css(["", ";"], xsmall);
58
62
  });
59
63
  export var H1 = styled.h1.withConfig({
60
64
  displayName: "CommonElements__H1",
61
- componentId: "sc-102d2aw-9"
65
+ componentId: "sc-102d2aw-10"
62
66
  })(["", " ", ""], function () {
63
67
  return css(["", ";"], h700);
64
68
  }, function (props) {
@@ -66,7 +70,7 @@ export var H1 = styled.h1.withConfig({
66
70
  });
67
71
  export var H2 = styled.h2.withConfig({
68
72
  displayName: "CommonElements__H2",
69
- componentId: "sc-102d2aw-10"
73
+ componentId: "sc-102d2aw-11"
70
74
  })(["", " ", ""], function () {
71
75
  return css(["", ";"], h600);
72
76
  }, function (props) {
@@ -74,7 +78,7 @@ export var H2 = styled.h2.withConfig({
74
78
  });
75
79
  export var H3 = styled.h3.withConfig({
76
80
  displayName: "CommonElements__H3",
77
- componentId: "sc-102d2aw-11"
81
+ componentId: "sc-102d2aw-12"
78
82
  })(["", " ", ""], function () {
79
83
  return css(["", ";"], h500);
80
84
  }, function (props) {
@@ -82,7 +86,7 @@ export var H3 = styled.h3.withConfig({
82
86
  });
83
87
  export var H4 = styled.h4.withConfig({
84
88
  displayName: "CommonElements__H4",
85
- componentId: "sc-102d2aw-12"
89
+ componentId: "sc-102d2aw-13"
86
90
  })(["", " ", ""], function () {
87
91
  return css(["", ";"], h400);
88
92
  }, function (props) {
@@ -90,7 +94,7 @@ export var H4 = styled.h4.withConfig({
90
94
  });
91
95
  export var H5 = styled.h5.withConfig({
92
96
  displayName: "CommonElements__H5",
93
- componentId: "sc-102d2aw-13"
97
+ componentId: "sc-102d2aw-14"
94
98
  })(["", " ", ""], function () {
95
99
  return css(["", ";"], h300);
96
100
  }, function (props) {
@@ -98,7 +102,7 @@ export var H5 = styled.h5.withConfig({
98
102
  });
99
103
  export var H6 = styled.h6.withConfig({
100
104
  displayName: "CommonElements__H6",
101
- componentId: "sc-102d2aw-14"
105
+ componentId: "sc-102d2aw-15"
102
106
  })(["", " ", ""], function () {
103
107
  return css(["", ";"], h200);
104
108
  }, function (props) {
@@ -106,7 +110,7 @@ export var H6 = styled.h6.withConfig({
106
110
  });
107
111
  export var H7 = styled.h6.withConfig({
108
112
  displayName: "CommonElements__H7",
109
- componentId: "sc-102d2aw-15"
113
+ componentId: "sc-102d2aw-16"
110
114
  })(["", " ", ""], function () {
111
115
  return css(["", ";"], h100);
112
116
  }, function (props) {
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ export declare type EllipsisProps = {
3
+ tooltip?: ReactNode;
4
+ children?: ReactNode;
5
+ };
6
+ export declare const Ellipsis: ({ tooltip, children }: EllipsisProps) => JSX.Element;
@@ -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 * as React from 'react';
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: React.FC<TextProps>;
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 * as React from 'react';
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
- return /*#__PURE__*/React.createElement(Component, {
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-typography",
3
- "version": "0.12.8",
3
+ "version": "0.12.10",
4
4
  "description": "Typography UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -31,10 +31,18 @@
31
31
  "*.less"
32
32
  ],
33
33
  "types": "dist/index.d.ts",
34
+ "dependencies": {
35
+ "@synerise/ds-tooltip": "0.14.2",
36
+ "classnames": "2.2.6"
37
+ },
34
38
  "peerDependencies": {
35
39
  "@synerise/ds-core": "*",
36
- "antd": "^4",
37
- "react": ">=16.9.0 < 17.0.0"
40
+ "antd": "4.7.0",
41
+ "react": ">=16.9.0 < 17.0.0",
42
+ "styled-components": "5.0.1"
43
+ },
44
+ "devDependencies": {
45
+ "enzyme": "3.11.0"
38
46
  },
39
- "gitHead": "948b33abd56086fc73880204892f90bd6ddc0a72"
47
+ "gitHead": "955a885f58b3fca4caa4f879deb147fe5b9dc6d8"
40
48
  }