@synerise/ds-code-snippet 0.2.1 → 0.3.3
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 +32 -0
- package/dist/CodeSnippet.js +3 -3
- package/dist/CodeTypes/InlineCode/InlineCode.js +1 -1
- package/dist/CodeTypes/MultiCode/MultiCode.js +21 -37
- package/dist/CodeTypes/MultiCode/MultiCode.styles.js +2 -2
- package/dist/CodeTypes/SingleCode/SingleCode.js +5 -5
- package/dist/CodeTypes/SingleCode/SingleCode.styles.js +2 -2
- package/dist/CopyAction/CopyAction.js +6 -19
- package/dist/CopyAction/CopyAction.types.js +1 -0
- package/dist/Highlight/Highlight.js +2 -2
- package/dist/Highlight/Highlight.types.js +1 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,38 @@
|
|
|
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.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-code-snippet@0.3.2...@synerise/ds-code-snippet@0.3.3) (2021-12-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-code-snippet
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.3.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-code-snippet@0.3.1...@synerise/ds-code-snippet@0.3.2) (2021-11-22)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @synerise/ds-code-snippet
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.3.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-code-snippet@0.2.1...@synerise/ds-code-snippet@0.3.1) (2021-11-09)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @synerise/ds-code-snippet
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# [0.3.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-code-snippet@0.2.1...@synerise/ds-code-snippet@0.3.0) (2021-11-09)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @synerise/ds-code-snippet
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
6
38
|
## [0.2.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-code-snippet@0.2.0...@synerise/ds-code-snippet@0.2.1) (2021-11-05)
|
|
7
39
|
|
|
8
40
|
**Note:** Version bump only for package @synerise/ds-code-snippet
|
package/dist/CodeSnippet.js
CHANGED
|
@@ -33,7 +33,7 @@ var CodeSnippet = function CodeSnippet(_ref) {
|
|
|
33
33
|
|
|
34
34
|
switch (type) {
|
|
35
35
|
case CodeSnippetType.SINGLE_LINE:
|
|
36
|
-
return React.createElement(SingleCode, {
|
|
36
|
+
return /*#__PURE__*/React.createElement(SingleCode, {
|
|
37
37
|
fontSize: fontSize,
|
|
38
38
|
tooltipTitleHover: tooltipTitleHover,
|
|
39
39
|
tooltipTitleClick: tooltipTitleClick,
|
|
@@ -42,7 +42,7 @@ var CodeSnippet = function CodeSnippet(_ref) {
|
|
|
42
42
|
}, children);
|
|
43
43
|
|
|
44
44
|
case CodeSnippetType.MULTI_LINE:
|
|
45
|
-
return React.createElement(MultiCode, {
|
|
45
|
+
return /*#__PURE__*/React.createElement(MultiCode, {
|
|
46
46
|
languages: languages,
|
|
47
47
|
colorSyntax: colorSyntax,
|
|
48
48
|
fontSize: fontSize,
|
|
@@ -58,7 +58,7 @@ var CodeSnippet = function CodeSnippet(_ref) {
|
|
|
58
58
|
}, children);
|
|
59
59
|
|
|
60
60
|
default:
|
|
61
|
-
return React.createElement(InlineCode, {
|
|
61
|
+
return /*#__PURE__*/React.createElement(InlineCode, {
|
|
62
62
|
className: className
|
|
63
63
|
}, children);
|
|
64
64
|
}
|
|
@@ -5,7 +5,7 @@ var InlineCode = function InlineCode(_ref) {
|
|
|
5
5
|
var _ref$children = _ref.children,
|
|
6
6
|
children = _ref$children === void 0 ? '' : _ref$children,
|
|
7
7
|
className = _ref.className;
|
|
8
|
-
return React.createElement(S.InlineCodeWrapper, {
|
|
8
|
+
return /*#__PURE__*/React.createElement(S.InlineCodeWrapper, {
|
|
9
9
|
className: className
|
|
10
10
|
}, children);
|
|
11
11
|
};
|
|
@@ -1,22 +1,9 @@
|
|
|
1
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
2
|
|
|
3
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
-
|
|
5
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
|
|
7
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
-
|
|
9
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
-
|
|
11
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
-
|
|
13
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
-
|
|
15
3
|
import * as React from 'react';
|
|
16
4
|
import AnimateHeight from 'react-animate-height';
|
|
17
5
|
import * as copy from 'copy-to-clipboard';
|
|
18
|
-
import Icon from '@synerise/ds-icon';
|
|
19
|
-
import { DuplicateS, ArrowDownCircleM } from '@synerise/ds-icon/dist/icons';
|
|
6
|
+
import Icon, { DuplicateS, ArrowDownCircleM } from '@synerise/ds-icon';
|
|
20
7
|
import Scrollbar from '@synerise/ds-scrollbar';
|
|
21
8
|
import Highlight from '../../Highlight/Highlight';
|
|
22
9
|
import * as S from './MultiCode.styles';
|
|
@@ -44,19 +31,16 @@ var MultiCode = function MultiCode(_ref) {
|
|
|
44
31
|
onCopy = _ref.onCopy;
|
|
45
32
|
|
|
46
33
|
var _React$useState = React.useState(false),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
setExpandedState = _React$useState2[1];
|
|
34
|
+
expandedState = _React$useState[0],
|
|
35
|
+
setExpandedState = _React$useState[1];
|
|
50
36
|
|
|
51
|
-
var _React$
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
setScrollable = _React$useState4[1];
|
|
37
|
+
var _React$useState2 = React.useState(false),
|
|
38
|
+
scrollable = _React$useState2[0],
|
|
39
|
+
setScrollable = _React$useState2[1];
|
|
55
40
|
|
|
56
|
-
var _React$
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
setAllRows = _React$useState6[1];
|
|
41
|
+
var _React$useState3 = React.useState(1),
|
|
42
|
+
allRows = _React$useState3[0],
|
|
43
|
+
setAllRows = _React$useState3[1];
|
|
60
44
|
|
|
61
45
|
var codeRef = React.useRef(null);
|
|
62
46
|
var buttonProps = React.useMemo(function () {
|
|
@@ -72,7 +56,7 @@ var MultiCode = function MultiCode(_ref) {
|
|
|
72
56
|
return (numberRows + 1) * LINE_HEIGHT_DEFAULT;
|
|
73
57
|
}, [rows, allRows]);
|
|
74
58
|
var onMounting = React.useCallback(function () {
|
|
75
|
-
if (!!codeRef && !!(codeRef
|
|
59
|
+
if (!!codeRef && !!(codeRef != null && codeRef.current)) {
|
|
76
60
|
setAllRows(Math.round(codeRef.current.offsetHeight / LINE_HEIGHT_DEFAULT));
|
|
77
61
|
}
|
|
78
62
|
}, [codeRef]);
|
|
@@ -99,29 +83,29 @@ var MultiCode = function MultiCode(_ref) {
|
|
|
99
83
|
return isButtonVisible ? initialContentHeight : 'auto';
|
|
100
84
|
}, [isButtonVisible, initialContentHeight]);
|
|
101
85
|
var multilineStructureContent = React.useMemo(function () {
|
|
102
|
-
return React.createElement(S.PreBlock, {
|
|
86
|
+
return /*#__PURE__*/React.createElement(S.PreBlock, {
|
|
103
87
|
wrap: wrap,
|
|
104
88
|
expanded: expandedState,
|
|
105
89
|
isButtonVisible: isButtonVisible
|
|
106
|
-
}, React.createElement(AnimateHeight, {
|
|
90
|
+
}, /*#__PURE__*/React.createElement(AnimateHeight, {
|
|
107
91
|
className: "content-animation",
|
|
108
92
|
duration: ANIMATE_HEIGHT_TIME,
|
|
109
93
|
height: !expandedState ? extraHeightOption : 'auto',
|
|
110
94
|
style: {
|
|
111
95
|
minHeight: LINE_HEIGHT_DEFAULT
|
|
112
96
|
}
|
|
113
|
-
}, React.createElement(Scrollbar, {
|
|
97
|
+
}, /*#__PURE__*/React.createElement(Scrollbar, {
|
|
114
98
|
maxHeight: !scrollable ? (rows + 1) * LINE_HEIGHT_DEFAULT : '100%',
|
|
115
99
|
style: {
|
|
116
100
|
marginRight: '17px'
|
|
117
101
|
}
|
|
118
|
-
}, React.createElement(S.BlockCodeWrapperMulti, {
|
|
102
|
+
}, /*#__PURE__*/React.createElement(S.BlockCodeWrapperMulti, {
|
|
119
103
|
ref: codeRef,
|
|
120
104
|
isButtonVisible: isButtonVisible
|
|
121
105
|
}, children))));
|
|
122
106
|
}, [wrap, rows, expandedState, isButtonVisible, scrollable, codeRef, extraHeightOption, children]);
|
|
123
107
|
var iconElement = React.useMemo(function () {
|
|
124
|
-
return React.createElement(CopyAction, {
|
|
108
|
+
return /*#__PURE__*/React.createElement(CopyAction, {
|
|
125
109
|
tooltipTitleHover: tooltipTitleHover,
|
|
126
110
|
tooltipTitleClick: tooltipTitleClick,
|
|
127
111
|
className: ICON_CLASSNAME,
|
|
@@ -129,21 +113,21 @@ var MultiCode = function MultiCode(_ref) {
|
|
|
129
113
|
copy(children);
|
|
130
114
|
onCopy && onCopy();
|
|
131
115
|
},
|
|
132
|
-
icon: React.createElement(DuplicateS, null)
|
|
116
|
+
icon: /*#__PURE__*/React.createElement(DuplicateS, null)
|
|
133
117
|
});
|
|
134
118
|
}, [children, tooltipTitleHover, tooltipTitleClick, onCopy]);
|
|
135
|
-
return React.createElement(S.CodeSnippetWrapperMulti, {
|
|
119
|
+
return /*#__PURE__*/React.createElement(S.CodeSnippetWrapperMulti, {
|
|
136
120
|
expanded: expandedState,
|
|
137
121
|
isButtonVisible: isButtonVisible,
|
|
138
122
|
className: className
|
|
139
|
-
}, React.createElement(S.ContentIconWrapper, null, colorSyntax && languages ? React.createElement(Highlight, {
|
|
123
|
+
}, /*#__PURE__*/React.createElement(S.ContentIconWrapper, null, colorSyntax && languages ? /*#__PURE__*/React.createElement(Highlight, {
|
|
140
124
|
languages: languages
|
|
141
|
-
}, multilineStructureContent) : multilineStructureContent, iconElement), rows && isButtonVisible && React.createElement(S.ExpanderButton, _extends({}, buttonProps, {
|
|
125
|
+
}, multilineStructureContent) : multilineStructureContent, iconElement), rows && isButtonVisible && /*#__PURE__*/React.createElement(S.ExpanderButton, _extends({}, buttonProps, {
|
|
142
126
|
onClick: function onClick() {
|
|
143
127
|
return handleButton(expandedState);
|
|
144
128
|
}
|
|
145
|
-
}), React.createElement(Icon, {
|
|
146
|
-
component: React.createElement(ArrowDownCircleM, null)
|
|
129
|
+
}), /*#__PURE__*/React.createElement(Icon, {
|
|
130
|
+
component: /*#__PURE__*/React.createElement(ArrowDownCircleM, null)
|
|
147
131
|
}), expandedState ? labelAfterExpanded : labelBeforeExpanded));
|
|
148
132
|
};
|
|
149
133
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import Button from '@synerise/ds-button';
|
|
3
|
-
import { IconContainer } from '@synerise/ds-icon
|
|
3
|
+
import { IconContainer } from '@synerise/ds-icon';
|
|
4
4
|
import { CodeSnippetWrapperSingle, BlockCodeWrapperSingle, LINE_HEIGHT_DEFAULT, FONT_SIZE_DEFAULT } from '../SingleCode/SingleCode.styles';
|
|
5
5
|
export var ContentIconWrapper = styled.div.withConfig({
|
|
6
6
|
displayName: "MultiCodestyles__ContentIconWrapper",
|
|
@@ -12,7 +12,7 @@ export var CodeSnippetWrapperMulti = styled(CodeSnippetWrapperSingle).withConfig
|
|
|
12
12
|
})(["&{min-width:250px;pre::before{background-color:", ";content:'';display:block;position:absolute;top:0;bottom:0;right:0;width:28px;z-index:10;}.content-animation{position:relative;}", ";}.copy{position:absolute;top:0;right:0;z-index:13;}"], function (props) {
|
|
13
13
|
return props.theme.palette['grey-100'];
|
|
14
14
|
}, function (props) {
|
|
15
|
-
return !!props.isButtonVisible && "\n padding-bottom:7px;\n .content-animation::after{\n content:'';\n display:block;\n position:absolute;\n bottom:0;\n left:0;\n right:0;\n height:"
|
|
15
|
+
return !!props.isButtonVisible && "\n padding-bottom:7px;\n .content-animation::after{\n content:'';\n display:block;\n position:absolute;\n bottom:0;\n left:0;\n right:0;\n height:" + LINE_HEIGHT_DEFAULT + "px;\n background-color:" + props.theme.palette['grey-100'] + ";\n z-index:10;\n }\n ";
|
|
16
16
|
});
|
|
17
17
|
export var ExpanderButton = styled(Button).withConfig({
|
|
18
18
|
displayName: "MultiCodestyles__ExpanderButton",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as copy from 'copy-to-clipboard';
|
|
3
|
-
import { DuplicateS } from '@synerise/ds-icon
|
|
3
|
+
import { DuplicateS } from '@synerise/ds-icon';
|
|
4
4
|
import CopyAction from '../../CopyAction/CopyAction';
|
|
5
5
|
import * as S from './SingleCode.styles';
|
|
6
6
|
import { FontSize } from '../../CodeSnippet.types';
|
|
@@ -15,7 +15,7 @@ var SingleCode = function SingleCode(_ref) {
|
|
|
15
15
|
className = _ref.className,
|
|
16
16
|
onCopy = _ref.onCopy;
|
|
17
17
|
var iconElement = React.useMemo(function () {
|
|
18
|
-
return React.createElement(CopyAction, {
|
|
18
|
+
return /*#__PURE__*/React.createElement(CopyAction, {
|
|
19
19
|
tooltipTitleHover: tooltipTitleHover,
|
|
20
20
|
tooltipTitleClick: tooltipTitleClick,
|
|
21
21
|
className: S.ICON_CLASSNAME,
|
|
@@ -23,14 +23,14 @@ var SingleCode = function SingleCode(_ref) {
|
|
|
23
23
|
copy(children);
|
|
24
24
|
onCopy && onCopy();
|
|
25
25
|
},
|
|
26
|
-
icon: React.createElement(DuplicateS, null),
|
|
26
|
+
icon: /*#__PURE__*/React.createElement(DuplicateS, null),
|
|
27
27
|
"data-testid": "ds-copy-code-snippet"
|
|
28
28
|
});
|
|
29
29
|
}, [children, tooltipTitleHover, tooltipTitleClick, onCopy]);
|
|
30
|
-
return React.createElement(S.CodeSnippetWrapperSingle, {
|
|
30
|
+
return /*#__PURE__*/React.createElement(S.CodeSnippetWrapperSingle, {
|
|
31
31
|
fontSize: fontSize,
|
|
32
32
|
className: className
|
|
33
|
-
}, React.createElement(S.ContentIconWrapper, null, React.createElement(S.BlockCodeWrapperSingle, {
|
|
33
|
+
}, /*#__PURE__*/React.createElement(S.ContentIconWrapper, null, /*#__PURE__*/React.createElement(S.BlockCodeWrapperSingle, {
|
|
34
34
|
fontSize: fontSize
|
|
35
35
|
}, children), iconElement));
|
|
36
36
|
};
|
|
@@ -13,7 +13,7 @@ export var CodeSnippetWrapperSingle = styled.div.withConfig({
|
|
|
13
13
|
})(["&{height:100%;background-color:", ";border-radius:3px;padding:12px 8px 0 12px;.content-animation{position:relative;}", ";}.copy{cursor:pointer;background-color:", ";svg{fill:", ";}}.copy:hover{svg{fill:", ";}}"], function (props) {
|
|
14
14
|
return props.theme.palette['grey-100'];
|
|
15
15
|
}, function (props) {
|
|
16
|
-
return !!props.fontSize && "\n padding-top: "
|
|
16
|
+
return !!props.fontSize && "\n padding-top: " + (props.fontSize === FontSize.SMALL ? '4px' : '12px') + ";\n padding-bottom: " + (props.fontSize === FontSize.SMALL ? '4px' : '12px') + ";\n ";
|
|
17
17
|
}, function (props) {
|
|
18
18
|
return props.theme.palette['grey-100'];
|
|
19
19
|
}, function (props) {
|
|
@@ -25,7 +25,7 @@ export var BlockCodeWrapperSingle = styled.code.withConfig({
|
|
|
25
25
|
displayName: "SingleCodestyles__BlockCodeWrapperSingle",
|
|
26
26
|
componentId: "sc-1l78lb-2"
|
|
27
27
|
})(["&{display:block;font-family:Monaco;font-size:", ";line-height:", "px;color:", ";", ";}"], function (props) {
|
|
28
|
-
return
|
|
28
|
+
return (props.fontSize || FONT_SIZE_DEFAULT) + "px";
|
|
29
29
|
}, LINE_HEIGHT_DEFAULT, function (props) {
|
|
30
30
|
return props.theme.palette["grey-600"];
|
|
31
31
|
}, function (props) {
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
-
|
|
3
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
|
|
5
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
|
|
7
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
-
|
|
9
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
-
|
|
11
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
|
|
13
1
|
import * as React from 'react';
|
|
14
2
|
import Tooltip from '@synerise/ds-tooltip/dist/Tooltip';
|
|
15
3
|
import Icon from '@synerise/ds-icon';
|
|
@@ -27,9 +15,8 @@ var CopyAction = function CopyAction(_ref) {
|
|
|
27
15
|
timeToHideTooltip = _ref$timeToHideToolti === void 0 ? 3000 : _ref$timeToHideToolti;
|
|
28
16
|
|
|
29
17
|
var _React$useState = React.useState(false),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
setHideHoverTooltip = _React$useState2[1];
|
|
18
|
+
hideHoverTooltip = _React$useState[0],
|
|
19
|
+
setHideHoverTooltip = _React$useState[1];
|
|
33
20
|
|
|
34
21
|
var iconRef = React.useRef(null);
|
|
35
22
|
var timeoutClickRef = React.useRef(null);
|
|
@@ -53,16 +40,16 @@ var CopyAction = function CopyAction(_ref) {
|
|
|
53
40
|
}, 3000);
|
|
54
41
|
};
|
|
55
42
|
|
|
56
|
-
return React.createElement(Tooltip, {
|
|
43
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
57
44
|
title: tooltipTitleClick,
|
|
58
45
|
trigger: "click",
|
|
59
46
|
timeToHideAfterClick: timeToHideTooltip
|
|
60
|
-
}, React.createElement(Tooltip, {
|
|
47
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
61
48
|
title: tooltipTitleHover,
|
|
62
49
|
overlayStyle: hideHoverTooltip ? {
|
|
63
50
|
display: 'none'
|
|
64
51
|
} : undefined
|
|
65
|
-
}, React.createElement(S.IconWrapper, {
|
|
52
|
+
}, /*#__PURE__*/React.createElement(S.IconWrapper, {
|
|
66
53
|
ref: iconRef,
|
|
67
54
|
className: className,
|
|
68
55
|
onClick: function onClick(e) {
|
|
@@ -70,7 +57,7 @@ var CopyAction = function CopyAction(_ref) {
|
|
|
70
57
|
handleIconClickTooltip();
|
|
71
58
|
_onClick && _onClick();
|
|
72
59
|
}
|
|
73
|
-
}, React.createElement(Icon, {
|
|
60
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
74
61
|
component: icon,
|
|
75
62
|
size: iconSize || 24
|
|
76
63
|
}))));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -12,7 +12,7 @@ var Highlight = function Highlight(_ref) {
|
|
|
12
12
|
var elements = elementRef.current.querySelectorAll('pre code');
|
|
13
13
|
languages.forEach(function (language) {
|
|
14
14
|
// eslint-disable-next-line import/no-dynamic-require, global-require, @typescript-eslint/no-var-requires
|
|
15
|
-
hljs.registerLanguage(language, require("highlight.js/lib/languages/"
|
|
15
|
+
hljs.registerLanguage(language, require("highlight.js/lib/languages/" + language));
|
|
16
16
|
});
|
|
17
17
|
elements.forEach(function (element) {
|
|
18
18
|
hljs.highlightElement(element);
|
|
@@ -22,7 +22,7 @@ var Highlight = function Highlight(_ref) {
|
|
|
22
22
|
React.useEffect(function () {
|
|
23
23
|
manageHighlight();
|
|
24
24
|
}, [manageHighlight]);
|
|
25
|
-
return React.createElement(S.Highlight, {
|
|
25
|
+
return /*#__PURE__*/React.createElement(S.Highlight, {
|
|
26
26
|
ref: elementRef,
|
|
27
27
|
style: style
|
|
28
28
|
}, children);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-code-snippet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "CodeSnippet UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
],
|
|
33
33
|
"types": "dist/index.d.ts",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@synerise/ds-button": "^0.
|
|
36
|
-
"@synerise/ds-icon": "^0.
|
|
37
|
-
"@synerise/ds-scrollbar": "^0.
|
|
38
|
-
"@synerise/ds-tooltip": "^0.
|
|
35
|
+
"@synerise/ds-button": "^0.16.3",
|
|
36
|
+
"@synerise/ds-icon": "^0.46.2",
|
|
37
|
+
"@synerise/ds-scrollbar": "^0.4.2",
|
|
38
|
+
"@synerise/ds-tooltip": "^0.11.3",
|
|
39
39
|
"copy-to-clipboard": "^3.3.1",
|
|
40
40
|
"highlight.js": "^11.2.0",
|
|
41
41
|
"react-animate-height": "^2.0.23"
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"@synerise/ds-core": "*",
|
|
45
45
|
"react": ">=16.9.0 < 17.0.0"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "a89cd14cdbe25b06949b3b9763e58a080111c160"
|
|
48
48
|
}
|