@synerise/ds-code-snippet 1.1.18 → 1.1.20

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,22 @@
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
+ ## [1.1.20](https://github.com/Synerise/synerise-design/compare/@synerise/ds-code-snippet@1.1.19...@synerise/ds-code-snippet@1.1.20) (2025-11-28)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-code-snippet
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.1.19](https://github.com/Synerise/synerise-design/compare/@synerise/ds-code-snippet@1.1.18...@synerise/ds-code-snippet@1.1.19) (2025-11-06)
15
+
16
+ **Note:** Version bump only for package @synerise/ds-code-snippet
17
+
18
+
19
+
20
+
21
+
6
22
  ## [1.1.18](https://github.com/Synerise/synerise-design/compare/@synerise/ds-code-snippet@1.1.17...@synerise/ds-code-snippet@1.1.18) (2025-10-22)
7
23
 
8
24
  **Note:** Version bump only for package @synerise/ds-code-snippet
@@ -1,10 +1,8 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import copy from 'copy-to-clipboard';
3
2
  import React from 'react';
4
3
  import AnimateHeight from 'react-animate-height';
5
4
  import Icon, { ArrowDownCircleM, DuplicateS } from '@synerise/ds-icon';
6
5
  import Scrollbar from '@synerise/ds-scrollbar';
7
- import CopyAction from '../../CopyAction/CopyAction';
8
6
  import Highlight from '../../Highlight/Highlight';
9
7
  import { ICON_CLASSNAME, LINE_HEIGHT_DEFAULT } from '../SingleCode/SingleCode.styles';
10
8
  import * as S from './MultiCode.styles';
@@ -110,16 +108,18 @@ var MultiCode = function MultiCode(_ref) {
110
108
  }, children))));
111
109
  }, [wrap, rows, expandedState, isButtonVisible, scrollable, codeRef, extraHeightOption, children]);
112
110
  var iconElement = React.useMemo(function () {
113
- return !hideCopyButton && /*#__PURE__*/React.createElement(CopyAction, {
114
- tooltipTitleHover: tooltipTitleHover,
115
- tooltipTitleClick: tooltipTitleClick,
116
- className: ICON_CLASSNAME,
117
- onClick: function onClick() {
118
- copy(children);
119
- onCopy && onCopy();
111
+ return !hideCopyButton && /*#__PURE__*/React.createElement(S.MultiIconCopy, {
112
+ copyValue: children,
113
+ texts: {
114
+ copyTooltip: tooltipTitleHover,
115
+ copiedTooltip: tooltipTitleClick
120
116
  },
121
- icon: /*#__PURE__*/React.createElement(DuplicateS, null),
122
- customTriggerComponent: customTriggerComponent
117
+ onCopy: onCopy,
118
+ className: ICON_CLASSNAME,
119
+ icon: customTriggerComponent || /*#__PURE__*/React.createElement(Icon, {
120
+ component: /*#__PURE__*/React.createElement(DuplicateS, null),
121
+ size: 24
122
+ })
123
123
  });
124
124
  }, [children, tooltipTitleHover, tooltipTitleClick, onCopy, customTriggerComponent, hideCopyButton]);
125
125
  return /*#__PURE__*/React.createElement(S.CodeSnippetWrapperMulti, {
@@ -1,4 +1,3 @@
1
- import Button from '@synerise/ds-button';
2
1
  export declare const ContentIconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
3
2
  export declare const CodeSnippetWrapperMulti: import("styled-components").StyledComponent<"div", any, {
4
3
  fontSize?: import("../../CodeSnippet.types").FontSize;
@@ -6,7 +5,35 @@ export declare const CodeSnippetWrapperMulti: import("styled-components").Styled
6
5
  expanded?: boolean;
7
6
  isButtonVisible?: boolean;
8
7
  }, never>;
9
- export declare const ExpanderButton: import("styled-components").StyledComponent<typeof Button, any, {
8
+ export declare const MultiIconCopy: import("styled-components").StyledComponent<({ copyValue, texts, onMouseEnter, onMouseLeave, icon, placement, onCopy, ...rest }: import("@synerise/ds-copy-icon").CopyIconProps) => React.JSX.Element, any, {}, never>;
9
+ export declare const ExpanderButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Omit<Partial<{
10
+ href: string;
11
+ target?: string;
12
+ onClick?: React.MouseEventHandler<HTMLElement>;
13
+ } & import("antd/lib/button/button").BaseButtonProps & Omit<import("react").AnchorHTMLAttributes<any>, "type" | "onClick"> & {
14
+ htmlType?: import("antd/lib/button/button").ButtonHTMLType;
15
+ onClick?: React.MouseEventHandler<HTMLElement>;
16
+ } & Omit<import("react").ButtonHTMLAttributes<any>, "type" | "onClick">>, "type" | "ghost"> & {
17
+ type?: import("@synerise/ds-utils").LiteralStringUnion<import("@synerise/ds-button/dist/Button.types").ButtonType>;
18
+ mode?: import("@synerise/ds-utils").LiteralStringUnion<"single-icon" | "split" | "two-icons" | "label-icon" | "icon-label">;
19
+ color?: import("@synerise/ds-utils").LiteralStringUnion<"blue" | "grey" | "red" | "green" | "yellow" | "pink" | "mars" | "orange" | "fern" | "cyan" | "purple" | "violet">;
20
+ groupVariant?: import("@synerise/ds-utils").LiteralStringUnion<"left-rounded" | "squared" | "right-rounded">;
21
+ justifyContent?: string;
22
+ loading?: boolean | {
23
+ delay?: number;
24
+ };
25
+ onClick?: (event: import("react").MouseEvent<HTMLElement>) => void;
26
+ iconColor?: import("@synerise/ds-utils").LiteralStringUnion<"blue" | "grey" | "red" | "green" | "yellow" | "pink" | "mars" | "orange" | "fern" | "cyan" | "purple" | "violet">;
27
+ error?: boolean;
28
+ readOnly?: boolean;
29
+ tagProps?: import("@synerise/ds-tag").TagProps;
30
+ tooltipProps?: import("@synerise/ds-tooltip").TooltipProps;
31
+ } & import("react").RefAttributes<HTMLButtonElement>> & {
32
+ Creator: import("react").ForwardRefExoticComponent<Omit<import("@synerise/ds-button").CreatorProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
33
+ Expander: ({ size, expanded, disabled, onClick, className, }: import("@synerise/ds-button").ExpanderProps) => import("react").JSX.Element;
34
+ Star: (props: import("@synerise/ds-button").StarButtonProps) => React.ReactElement;
35
+ Checkbox: (props: import("@synerise/ds-button").CheckboxButtonProps) => React.ReactElement;
36
+ }, any, {
10
37
  expanded?: boolean;
11
38
  }, never>;
12
39
  export declare const BlockCodeWrapperMulti: import("styled-components").StyledComponent<"code", any, {
@@ -1,7 +1,7 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import Button from '@synerise/ds-button';
3
3
  import { IconContainer } from '@synerise/ds-icon';
4
- import { BlockCodeWrapperSingle, CodeSnippetWrapperSingle, FONT_SIZE_DEFAULT, LINE_HEIGHT_DEFAULT } from '../SingleCode/SingleCode.styles';
4
+ import { BlockCodeWrapperSingle, CodeSnippetWrapperSingle, FONT_SIZE_DEFAULT, LINE_HEIGHT_DEFAULT, StyledCopyIcon } from '../SingleCode/SingleCode.styles';
5
5
  export var ContentIconWrapper = styled.div.withConfig({
6
6
  displayName: "MultiCodestyles__ContentIconWrapper",
7
7
  componentId: "sc-1u5vxm9-0"
@@ -9,26 +9,30 @@ export var ContentIconWrapper = styled.div.withConfig({
9
9
  export var CodeSnippetWrapperMulti = styled(CodeSnippetWrapperSingle).withConfig({
10
10
  displayName: "MultiCodestyles__CodeSnippetWrapperMulti",
11
11
  componentId: "sc-1u5vxm9-1"
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) {
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;}", ";}"], function (props) {
13
13
  return props.theme.palette['grey-100'];
14
14
  }, function (props) {
15
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
+ export var MultiIconCopy = styled(StyledCopyIcon).withConfig({
18
+ displayName: "MultiCodestyles__MultiIconCopy",
19
+ componentId: "sc-1u5vxm9-2"
20
+ })(["&&{position:absolute;top:0;right:0;z-index:13;}"]);
17
21
  export var ExpanderButton = styled(Button).withConfig({
18
22
  displayName: "MultiCodestyles__ExpanderButton",
19
- componentId: "sc-1u5vxm9-2"
23
+ componentId: "sc-1u5vxm9-3"
20
24
  })(["&&{position:relative;z-index:15;top:-5px;", "{svg{transition:transform 0.2s linear;transform:rotate( ", " );}}}"], IconContainer, function (props) {
21
25
  return props.expanded ? '180deg' : '0deg';
22
26
  });
23
27
  export var BlockCodeWrapperMulti = styled(BlockCodeWrapperSingle).withConfig({
24
28
  displayName: "MultiCodestyles__BlockCodeWrapperMulti",
25
- componentId: "sc-1u5vxm9-3"
29
+ componentId: "sc-1u5vxm9-4"
26
30
  })(["&{padding-bottom:", ";}"], function (props) {
27
31
  return props.isButtonVisible ? '17px' : '12px';
28
32
  });
29
33
  export var PreBlock = styled.pre.withConfig({
30
34
  displayName: "MultiCodestyles__PreBlock",
31
- componentId: "sc-1u5vxm9-4"
35
+ componentId: "sc-1u5vxm9-5"
32
36
  })(["&{font-family:'IBM Plex Mono Regular',monospace;font-size:", "px;line-height:", "px;margin:0;", ";.ps__rail-x{height:", "px;z-index:11;opacity:0;}.ps__rail-x > .ps__thumb-x{bottom:", ";}.ps__rail-y{opacity:0;z-index:11;}}"], FONT_SIZE_DEFAULT, LINE_HEIGHT_DEFAULT, function (props) {
33
37
  return !!props.wrap && css(["white-space:pre-wrap;word-wrap:break-world;"]);
34
38
  }, LINE_HEIGHT_DEFAULT, function (props) {
@@ -1,8 +1,6 @@
1
- import copy from 'copy-to-clipboard';
2
1
  import React from 'react';
3
- import { DuplicateS } from '@synerise/ds-icon';
2
+ import Icon, { DuplicateS } from '@synerise/ds-icon';
4
3
  import { FontSize } from '../../CodeSnippet.types';
5
- import CopyAction from '../../CopyAction/CopyAction';
6
4
  import * as S from './SingleCode.styles';
7
5
  var SingleCode = function SingleCode(_ref) {
8
6
  var _ref$children = _ref.children,
@@ -15,16 +13,18 @@ var SingleCode = function SingleCode(_ref) {
15
13
  onCopy = _ref.onCopy,
16
14
  customTriggerComponent = _ref.customTriggerComponent;
17
15
  var iconElement = React.useMemo(function () {
18
- return /*#__PURE__*/React.createElement(CopyAction, {
19
- tooltipTitleHover: tooltipTitleHover,
20
- tooltipTitleClick: tooltipTitleClick,
21
- className: S.ICON_CLASSNAME,
22
- onClick: function onClick() {
23
- copy(children);
24
- onCopy && onCopy();
16
+ return /*#__PURE__*/React.createElement(S.StyledCopyIcon, {
17
+ copyValue: children,
18
+ texts: {
19
+ copyTooltip: tooltipTitleHover,
20
+ copiedTooltip: tooltipTitleClick
25
21
  },
26
- icon: /*#__PURE__*/React.createElement(DuplicateS, null),
27
- customTriggerComponent: customTriggerComponent,
22
+ onCopy: onCopy,
23
+ icon: customTriggerComponent || /*#__PURE__*/React.createElement(Icon, {
24
+ component: /*#__PURE__*/React.createElement(DuplicateS, null),
25
+ size: 24
26
+ }),
27
+ className: S.ICON_CLASSNAME,
28
28
  "data-testid": "ds-copy-code-snippet"
29
29
  });
30
30
  }, [children, tooltipTitleHover, tooltipTitleClick, onCopy, customTriggerComponent]);
@@ -3,6 +3,7 @@ export declare const FONT_SIZE_DEFAULT = FontSize.SMALL;
3
3
  export declare const LINE_HEIGHT_DEFAULT = 17;
4
4
  export declare const ICON_CLASSNAME = "copy";
5
5
  export declare const ContentIconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
6
+ export declare const StyledCopyIcon: import("styled-components").StyledComponent<({ copyValue, texts, onMouseEnter, onMouseLeave, icon, placement, onCopy, ...rest }: import("@synerise/ds-copy-icon").CopyIconProps) => React.JSX.Element, any, {}, never>;
6
7
  export declare const CodeSnippetWrapperSingle: import("styled-components").StyledComponent<"div", any, {
7
8
  fontSize?: FontSize;
8
9
  }, never>;
@@ -1,4 +1,5 @@
1
1
  import styled from 'styled-components';
2
+ import CopyIcon from '@synerise/ds-copy-icon';
2
3
  import { FontSize } from '../../CodeSnippet.types';
3
4
  export var FONT_SIZE_DEFAULT = FontSize.SMALL;
4
5
  export var LINE_HEIGHT_DEFAULT = 17;
@@ -7,23 +8,27 @@ export var ContentIconWrapper = styled.div.withConfig({
7
8
  displayName: "SingleCodestyles__ContentIconWrapper",
8
9
  componentId: "sc-1l78lb-0"
9
10
  })(["display:flex;justify-content:space-between;align-items:center;"]);
10
- export var CodeSnippetWrapperSingle = styled.div.withConfig({
11
- displayName: "SingleCodestyles__CodeSnippetWrapperSingle",
11
+ export var StyledCopyIcon = styled(CopyIcon).withConfig({
12
+ displayName: "SingleCodestyles__StyledCopyIcon",
12
13
  componentId: "sc-1l78lb-1"
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
- return props.theme.palette['grey-100'];
15
- }, function (props) {
16
- return !!props.fontSize && "\n padding-top: " + (props.fontSize === FontSize.SMALL ? '4px' : '12px') + ";\n padding-bottom: " + (props.fontSize === FontSize.SMALL ? '4px' : '12px') + ";\n ";
17
- }, function (props) {
14
+ })(["&&{cursor:pointer;background-color:", ";color:", ";}&:hover{color:", ";}"], function (props) {
18
15
  return props.theme.palette['grey-100'];
19
16
  }, function (props) {
20
17
  return props.theme.palette['grey-400'];
21
18
  }, function (props) {
22
19
  return props.theme.palette['blue-600'];
23
20
  });
21
+ export var CodeSnippetWrapperSingle = styled.div.withConfig({
22
+ displayName: "SingleCodestyles__CodeSnippetWrapperSingle",
23
+ componentId: "sc-1l78lb-2"
24
+ })(["&{height:100%;background-color:", ";border-radius:3px;padding:12px 8px 0 12px;.content-animation{position:relative;}", ";}"], function (props) {
25
+ return props.theme.palette['grey-100'];
26
+ }, function (props) {
27
+ return !!props.fontSize && "\n padding-top: " + (props.fontSize === FontSize.SMALL ? '4px' : '12px') + ";\n padding-bottom: " + (props.fontSize === FontSize.SMALL ? '4px' : '12px') + ";\n ";
28
+ });
24
29
  export var BlockCodeWrapperSingle = styled.code.withConfig({
25
30
  displayName: "SingleCodestyles__BlockCodeWrapperSingle",
26
- componentId: "sc-1l78lb-2"
31
+ componentId: "sc-1l78lb-3"
27
32
  })(["&{display:block;font-family:'IBM Plex Mono Regular',monospace;font-size:", ";line-height:", "px;color:", ";", ";}"], function (props) {
28
33
  return (props.fontSize || FONT_SIZE_DEFAULT) + "px";
29
34
  }, LINE_HEIGHT_DEFAULT, function (props) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-code-snippet",
3
- "version": "1.1.18",
3
+ "version": "1.1.20",
4
4
  "description": "CodeSnippet UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -36,10 +36,11 @@
36
36
  ],
37
37
  "types": "dist/index.d.ts",
38
38
  "dependencies": {
39
- "@synerise/ds-button": "^1.4.16",
40
- "@synerise/ds-icon": "^1.7.3",
41
- "@synerise/ds-scrollbar": "^1.1.9",
42
- "@synerise/ds-tooltip": "^1.2.1",
39
+ "@synerise/ds-button": "^1.5.1",
40
+ "@synerise/ds-copy-icon": "^1.0.1",
41
+ "@synerise/ds-icon": "^1.9.0",
42
+ "@synerise/ds-scrollbar": "^1.2.1",
43
+ "@synerise/ds-tooltip": "^1.3.1",
43
44
  "@synerise/ds-utils": "^1.5.0",
44
45
  "copy-to-clipboard": "^3.3.1",
45
46
  "highlight.js": "^10.7.2",
@@ -50,5 +51,5 @@
50
51
  "react": ">=16.9.0 <= 18.3.1",
51
52
  "styled-components": "^5.3.3"
52
53
  },
53
- "gitHead": "a40fca2cc78eda64afa96d18dc4d177538a22404"
54
+ "gitHead": "d5bd7fbc9d840ac30e2b79b36c451b486e178445"
54
55
  }
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { type CopyActionProps } from './CopyAction.types';
3
- declare const CopyAction: React.FC<CopyActionProps>;
4
- export default CopyAction;
@@ -1,62 +0,0 @@
1
- import React from 'react';
2
- import Icon from '@synerise/ds-icon';
3
- import Tooltip from '@synerise/ds-tooltip';
4
- import { useOnClickOutside } from '@synerise/ds-utils';
5
- import * as S from './CopyAction.styles';
6
- var CopyAction = function CopyAction(_ref) {
7
- var tooltipTitleHover = _ref.tooltipTitleHover,
8
- tooltipTitleClick = _ref.tooltipTitleClick,
9
- className = _ref.className,
10
- _onClick = _ref.onClick,
11
- icon = _ref.icon,
12
- iconSize = _ref.iconSize,
13
- customTriggerComponent = _ref.customTriggerComponent,
14
- _ref$timeToHideToolti = _ref.timeToHideTooltip,
15
- timeToHideTooltip = _ref$timeToHideToolti === void 0 ? 3000 : _ref$timeToHideToolti;
16
- var _React$useState = React.useState(false),
17
- hideHoverTooltip = _React$useState[0],
18
- setHideHoverTooltip = _React$useState[1];
19
- var iconRef = React.useRef(null);
20
- var timeoutClickRef = React.useRef(null);
21
- React.useEffect(function () {
22
- return function () {
23
- timeoutClickRef.current && clearTimeout(timeoutClickRef.current);
24
- };
25
- }, []);
26
- useOnClickOutside(iconRef, function () {
27
- if (hideHoverTooltip) {
28
- setHideHoverTooltip(false);
29
- timeoutClickRef.current && clearTimeout(timeoutClickRef.current);
30
- }
31
- });
32
- var handleIconClickTooltip = function handleIconClickTooltip() {
33
- timeoutClickRef.current && clearTimeout(timeoutClickRef.current);
34
- setHideHoverTooltip(true);
35
- timeoutClickRef.current = setTimeout(function () {
36
- setHideHoverTooltip(false);
37
- }, 3000);
38
- };
39
- return /*#__PURE__*/React.createElement(Tooltip, {
40
- title: tooltipTitleClick,
41
- trigger: "click",
42
- timeToHideAfterClick: timeToHideTooltip
43
- }, /*#__PURE__*/React.createElement(Tooltip, {
44
- title: tooltipTitleHover,
45
- overlayStyle: hideHoverTooltip ? {
46
- display: 'none'
47
- } : undefined
48
- }, /*#__PURE__*/React.createElement(S.IconWrapper, {
49
- customTriggerComponent: !!customTriggerComponent,
50
- ref: iconRef,
51
- className: className,
52
- onClick: function onClick(e) {
53
- !!e && e.stopPropagation();
54
- handleIconClickTooltip();
55
- _onClick && _onClick();
56
- }
57
- }, customTriggerComponent || /*#__PURE__*/React.createElement(Icon, {
58
- component: icon,
59
- size: iconSize || 24
60
- }))));
61
- };
62
- export default CopyAction;
@@ -1,3 +0,0 @@
1
- export declare const IconWrapper: import("styled-components").StyledComponent<"div", any, {
2
- customTriggerComponent?: boolean;
3
- }, never>;
@@ -1,7 +0,0 @@
1
- import styled from 'styled-components';
2
- export var IconWrapper = styled.div.withConfig({
3
- displayName: "CopyActionstyles__IconWrapper",
4
- componentId: "sc-1hrgvb2-0"
5
- })(["margin-left:", ";"], function (props) {
6
- return props.customTriggerComponent ? '8px' : '0';
7
- });
@@ -1,11 +0,0 @@
1
- import type React from 'react';
2
- export type CopyActionProps = {
3
- tooltipTitleHover: React.ReactNode;
4
- tooltipTitleClick: React.ReactNode;
5
- customTriggerComponent?: React.ReactNode;
6
- className?: string;
7
- onClick: () => void;
8
- icon: React.ReactNode;
9
- iconSize?: number;
10
- timeToHideTooltip?: number;
11
- };
@@ -1 +0,0 @@
1
- export {};