@synerise/ds-code-snippet 0.3.75 → 0.3.76
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 +11 -0
- package/dist/CodeSnippet.js +6 -3
- package/dist/CodeSnippet.types.d.ts +1 -0
- package/dist/CodeTypes/MultiCode/MultiCode.js +5 -3
- package/dist/CodeTypes/SingleCode/SingleCode.d.ts +1 -0
- package/dist/CodeTypes/SingleCode/SingleCode.js +4 -2
- package/dist/CopyAction/CopyAction.js +3 -1
- package/dist/CopyAction/CopyAction.styles.d.ts +3 -1
- package/dist/CopyAction/CopyAction.styles.js +3 -1
- package/dist/CopyAction/CopyAction.types.d.ts +3 -2
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.3.76](https://github.com/Synerise/synerise-design/compare/@synerise/ds-code-snippet@0.3.75...@synerise/ds-code-snippet@0.3.76) (2024-10-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **code-snippet:** new button with prop renderCopyButton ([daf3803](https://github.com/Synerise/synerise-design/commit/daf38032b6754da5900b65c5401e955438c6452b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [0.3.75](https://github.com/Synerise/synerise-design/compare/@synerise/ds-code-snippet@0.3.74...@synerise/ds-code-snippet@0.3.75) (2024-09-26)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @synerise/ds-code-snippet
|
package/dist/CodeSnippet.js
CHANGED
|
@@ -29,7 +29,8 @@ var CodeSnippet = function CodeSnippet(_ref) {
|
|
|
29
29
|
rows = _ref$rows === void 0 ? 6 : _ref$rows,
|
|
30
30
|
className = _ref.className,
|
|
31
31
|
onExpand = _ref.onExpand,
|
|
32
|
-
onCopy = _ref.onCopy
|
|
32
|
+
onCopy = _ref.onCopy,
|
|
33
|
+
customTriggerComponent = _ref.customTriggerComponent;
|
|
33
34
|
|
|
34
35
|
switch (type) {
|
|
35
36
|
case CodeSnippetType.SINGLE_LINE:
|
|
@@ -38,7 +39,8 @@ var CodeSnippet = function CodeSnippet(_ref) {
|
|
|
38
39
|
tooltipTitleHover: tooltipTitleHover,
|
|
39
40
|
tooltipTitleClick: tooltipTitleClick,
|
|
40
41
|
className: className,
|
|
41
|
-
onCopy: onCopy
|
|
42
|
+
onCopy: onCopy,
|
|
43
|
+
customTriggerComponent: customTriggerComponent
|
|
42
44
|
}, children);
|
|
43
45
|
|
|
44
46
|
case CodeSnippetType.MULTI_LINE:
|
|
@@ -54,7 +56,8 @@ var CodeSnippet = function CodeSnippet(_ref) {
|
|
|
54
56
|
wrap: wrap,
|
|
55
57
|
rows: rows,
|
|
56
58
|
onExpand: onExpand,
|
|
57
|
-
onCopy: onCopy
|
|
59
|
+
onCopy: onCopy,
|
|
60
|
+
customTriggerComponent: customTriggerComponent
|
|
58
61
|
}, children);
|
|
59
62
|
|
|
60
63
|
default:
|
|
@@ -28,7 +28,8 @@ var MultiCode = function MultiCode(_ref) {
|
|
|
28
28
|
_ref$rows = _ref.rows,
|
|
29
29
|
rows = _ref$rows === void 0 ? 6 : _ref$rows,
|
|
30
30
|
onExpand = _ref.onExpand,
|
|
31
|
-
onCopy = _ref.onCopy
|
|
31
|
+
onCopy = _ref.onCopy,
|
|
32
|
+
customTriggerComponent = _ref.customTriggerComponent;
|
|
32
33
|
|
|
33
34
|
var _React$useState = React.useState(false),
|
|
34
35
|
expandedState = _React$useState[0],
|
|
@@ -113,9 +114,10 @@ var MultiCode = function MultiCode(_ref) {
|
|
|
113
114
|
copy(children);
|
|
114
115
|
onCopy && onCopy();
|
|
115
116
|
},
|
|
116
|
-
icon: /*#__PURE__*/React.createElement(DuplicateS, null)
|
|
117
|
+
icon: /*#__PURE__*/React.createElement(DuplicateS, null),
|
|
118
|
+
customTriggerComponent: customTriggerComponent
|
|
117
119
|
});
|
|
118
|
-
}, [children, tooltipTitleHover, tooltipTitleClick, onCopy]);
|
|
120
|
+
}, [children, tooltipTitleHover, tooltipTitleClick, onCopy, customTriggerComponent]);
|
|
119
121
|
return /*#__PURE__*/React.createElement(S.CodeSnippetWrapperMulti, {
|
|
120
122
|
expanded: expandedState,
|
|
121
123
|
isButtonVisible: isButtonVisible,
|
|
@@ -13,7 +13,8 @@ var SingleCode = function SingleCode(_ref) {
|
|
|
13
13
|
tooltipTitleHover = _ref.tooltipTitleHover,
|
|
14
14
|
tooltipTitleClick = _ref.tooltipTitleClick,
|
|
15
15
|
className = _ref.className,
|
|
16
|
-
onCopy = _ref.onCopy
|
|
16
|
+
onCopy = _ref.onCopy,
|
|
17
|
+
customTriggerComponent = _ref.customTriggerComponent;
|
|
17
18
|
var iconElement = React.useMemo(function () {
|
|
18
19
|
return /*#__PURE__*/React.createElement(CopyAction, {
|
|
19
20
|
tooltipTitleHover: tooltipTitleHover,
|
|
@@ -24,9 +25,10 @@ var SingleCode = function SingleCode(_ref) {
|
|
|
24
25
|
onCopy && onCopy();
|
|
25
26
|
},
|
|
26
27
|
icon: /*#__PURE__*/React.createElement(DuplicateS, null),
|
|
28
|
+
customTriggerComponent: customTriggerComponent,
|
|
27
29
|
"data-testid": "ds-copy-code-snippet"
|
|
28
30
|
});
|
|
29
|
-
}, [children, tooltipTitleHover, tooltipTitleClick, onCopy]);
|
|
31
|
+
}, [children, tooltipTitleHover, tooltipTitleClick, onCopy, customTriggerComponent]);
|
|
30
32
|
return /*#__PURE__*/React.createElement(S.CodeSnippetWrapperSingle, {
|
|
31
33
|
fontSize: fontSize,
|
|
32
34
|
className: className
|
|
@@ -11,6 +11,7 @@ var CopyAction = function CopyAction(_ref) {
|
|
|
11
11
|
_onClick = _ref.onClick,
|
|
12
12
|
icon = _ref.icon,
|
|
13
13
|
iconSize = _ref.iconSize,
|
|
14
|
+
customTriggerComponent = _ref.customTriggerComponent,
|
|
14
15
|
_ref$timeToHideToolti = _ref.timeToHideTooltip,
|
|
15
16
|
timeToHideTooltip = _ref$timeToHideToolti === void 0 ? 3000 : _ref$timeToHideToolti;
|
|
16
17
|
|
|
@@ -50,6 +51,7 @@ var CopyAction = function CopyAction(_ref) {
|
|
|
50
51
|
display: 'none'
|
|
51
52
|
} : undefined
|
|
52
53
|
}, /*#__PURE__*/React.createElement(S.IconWrapper, {
|
|
54
|
+
customTriggerComponent: !!customTriggerComponent,
|
|
53
55
|
ref: iconRef,
|
|
54
56
|
className: className,
|
|
55
57
|
onClick: function onClick(e) {
|
|
@@ -57,7 +59,7 @@ var CopyAction = function CopyAction(_ref) {
|
|
|
57
59
|
handleIconClickTooltip();
|
|
58
60
|
_onClick && _onClick();
|
|
59
61
|
}
|
|
60
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
62
|
+
}, customTriggerComponent || /*#__PURE__*/React.createElement(Icon, {
|
|
61
63
|
component: icon,
|
|
62
64
|
size: iconSize || 24
|
|
63
65
|
}))));
|
|
@@ -3,4 +3,6 @@ import styled from 'styled-components'; // eslint-disable-next-line import/prefe
|
|
|
3
3
|
export var IconWrapper = styled.div.withConfig({
|
|
4
4
|
displayName: "CopyActionstyles__IconWrapper",
|
|
5
5
|
componentId: "sc-1hrgvb2-0"
|
|
6
|
-
})([""])
|
|
6
|
+
})(["margin-left:", ";"], function (props) {
|
|
7
|
+
return props.customTriggerComponent ? '8px' : '0';
|
|
8
|
+
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export type CopyActionProps = {
|
|
3
|
-
tooltipTitleHover: React.ReactNode
|
|
4
|
-
tooltipTitleClick: React.ReactNode
|
|
3
|
+
tooltipTitleHover: React.ReactNode;
|
|
4
|
+
tooltipTitleClick: React.ReactNode;
|
|
5
|
+
customTriggerComponent?: React.ReactNode;
|
|
5
6
|
className?: string;
|
|
6
7
|
onClick: () => void;
|
|
7
8
|
icon: React.ReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-code-snippet",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.76",
|
|
4
4
|
"description": "CodeSnippet UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-button": "^0.21.
|
|
38
|
-
"@synerise/ds-icon": "^0.65.
|
|
39
|
-
"@synerise/ds-scrollbar": "^0.11.
|
|
40
|
-
"@synerise/ds-tooltip": "^0.14.
|
|
41
|
-
"@synerise/ds-utils": "^0.
|
|
37
|
+
"@synerise/ds-button": "^0.21.13",
|
|
38
|
+
"@synerise/ds-icon": "^0.65.8",
|
|
39
|
+
"@synerise/ds-scrollbar": "^0.11.13",
|
|
40
|
+
"@synerise/ds-tooltip": "^0.14.43",
|
|
41
|
+
"@synerise/ds-utils": "^0.30.0",
|
|
42
42
|
"copy-to-clipboard": "^3.3.1",
|
|
43
43
|
"highlight.js": "^11.2.0",
|
|
44
44
|
"react-animate-height": "^2.0.23"
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react": ">=16.9.0 <= 17.0.2",
|
|
49
49
|
"styled-components": "5.0.1"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "2389b995aa44e42ec1dd9a177c7ab1f1a0001a70"
|
|
52
52
|
}
|