@synerise/ds-code-snippet 0.3.1 → 0.3.5

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,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.5](https://github.com/Synerise/synerise-design/compare/@synerise/ds-code-snippet@0.3.4...@synerise/ds-code-snippet@0.3.5) (2022-02-03)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-code-snippet
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.3.4](https://github.com/Synerise/synerise-design/compare/@synerise/ds-code-snippet@0.3.3...@synerise/ds-code-snippet@0.3.4) (2022-01-17)
15
+
16
+ **Note:** Version bump only for package @synerise/ds-code-snippet
17
+
18
+
19
+
20
+
21
+
22
+ ## [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)
23
+
24
+ **Note:** Version bump only for package @synerise/ds-code-snippet
25
+
26
+
27
+
28
+
29
+
30
+ ## [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)
31
+
32
+ **Note:** Version bump only for package @synerise/ds-code-snippet
33
+
34
+
35
+
36
+
37
+
6
38
  ## [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)
7
39
 
8
40
  **Note:** Version bump only for package @synerise/ds-code-snippet
@@ -1,17 +1,5 @@
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(o); 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) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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';
@@ -43,19 +31,16 @@ var MultiCode = function MultiCode(_ref) {
43
31
  onCopy = _ref.onCopy;
44
32
 
45
33
  var _React$useState = React.useState(false),
46
- _React$useState2 = _slicedToArray(_React$useState, 2),
47
- expandedState = _React$useState2[0],
48
- setExpandedState = _React$useState2[1];
34
+ expandedState = _React$useState[0],
35
+ setExpandedState = _React$useState[1];
49
36
 
50
- var _React$useState3 = React.useState(false),
51
- _React$useState4 = _slicedToArray(_React$useState3, 2),
52
- scrollable = _React$useState4[0],
53
- setScrollable = _React$useState4[1];
37
+ var _React$useState2 = React.useState(false),
38
+ scrollable = _React$useState2[0],
39
+ setScrollable = _React$useState2[1];
54
40
 
55
- var _React$useState5 = React.useState(1),
56
- _React$useState6 = _slicedToArray(_React$useState5, 2),
57
- allRows = _React$useState6[0],
58
- setAllRows = _React$useState6[1];
41
+ var _React$useState3 = React.useState(1),
42
+ allRows = _React$useState3[0],
43
+ setAllRows = _React$useState3[1];
59
44
 
60
45
  var codeRef = React.useRef(null);
61
46
  var buttonProps = React.useMemo(function () {
@@ -71,7 +56,7 @@ var MultiCode = function MultiCode(_ref) {
71
56
  return (numberRows + 1) * LINE_HEIGHT_DEFAULT;
72
57
  }, [rows, allRows]);
73
58
  var onMounting = React.useCallback(function () {
74
- if (!!codeRef && !!(codeRef !== null && codeRef !== void 0 && codeRef.current)) {
59
+ if (!!codeRef && !!(codeRef != null && codeRef.current)) {
75
60
  setAllRows(Math.round(codeRef.current.offsetHeight / LINE_HEIGHT_DEFAULT));
76
61
  }
77
62
  }, [codeRef]);
@@ -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:".concat(LINE_HEIGHT_DEFAULT, "px;\n background-color:").concat(props.theme.palette['grey-100'], ";\n z-index:10;\n }\n ");
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",
@@ -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: ".concat(props.fontSize === FontSize.SMALL ? '4px' : '12px', ";\n padding-bottom: ").concat(props.fontSize === FontSize.SMALL ? '4px' : '12px', ";\n ");
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 "".concat(props.fontSize || FONT_SIZE_DEFAULT, "px");
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(o); 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) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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
- _React$useState2 = _slicedToArray(_React$useState, 2),
31
- hideHoverTooltip = _React$useState2[0],
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);
@@ -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/".concat(language)));
15
+ hljs.registerLanguage(language, require("highlight.js/lib/languages/" + language));
16
16
  });
17
17
  elements.forEach(function (element) {
18
18
  hljs.highlightElement(element);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-code-snippet",
3
- "version": "0.3.1",
3
+ "version": "0.3.5",
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.16.1",
36
- "@synerise/ds-icon": "^0.46.1",
37
- "@synerise/ds-scrollbar": "^0.4.1",
38
- "@synerise/ds-tooltip": "^0.11.1",
35
+ "@synerise/ds-button": "^0.16.5",
36
+ "@synerise/ds-icon": "^0.47.1",
37
+ "@synerise/ds-scrollbar": "^0.4.4",
38
+ "@synerise/ds-tooltip": "^0.11.5",
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": "14733fd96fcf0727a2baf45444e54e9a490d64f4"
47
+ "gitHead": "27ef26e44f1814e7fc97b46668078e9a78e8f217"
48
48
  }