@apify/ui-library 0.67.4 → 0.67.5-featoutputschemacomponent-327312.55

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.
@@ -5,6 +5,7 @@ export declare const inlineCodeStyles: import("styled-components").FlattenSimple
5
5
  export type InlineCodeProps = RegularBoxProps & {
6
6
  children: React.ReactNode;
7
7
  size?: SharedTextSize;
8
+ withCopyButton?: boolean;
8
9
  };
9
10
  export declare const InlineCode: React.FC<InlineCodeProps>;
10
11
  //# sourceMappingURL=inline_code.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inline_code.d.ts","sourceRoot":"","sources":["../../../../../src/components/code/inline_code/inline_code.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,eAAO,MAAM,gBAAgB,wDAM5B,CAAC;AAQF,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAC5C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,cAAc,CAAC;CACzB,CAAA;AAGD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAchD,CAAC"}
1
+ {"version":3,"file":"inline_code.d.ts","sourceRoot":"","sources":["../../../../../src/components/code/inline_code/inline_code.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,eAAO,MAAM,gBAAgB,wDAM5B,CAAC;AAsBF,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAC5C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAA;AAGD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAcvC,CAAC"}
@@ -1,6 +1,8 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import styled, { css } from 'styled-components';
3
+ import { CheckIcon, CopyIcon } from '@apify/ui-icons';
3
4
  import { theme } from '../../../design_system/theme.js';
5
+ import { useCopyToClipboard } from '../../../utils/copy_to_clipboard.js';
4
6
  import { Text } from '../../text/index.js';
5
7
  // TODO: We should not need to export these once we consolidate Markdown
6
8
  export const inlineCodeStyles = css `
@@ -10,11 +12,21 @@ export const inlineCodeStyles = css `
10
12
  border-radius: ${theme.radius.radius8};
11
13
  border: 1px solid ${theme.color.neutral.border};
12
14
  `;
15
+ const CopyButtonWrapper = styled.div `
16
+ display: inline-flex;
17
+ cursor: pointer;
18
+ vertical-align: text-top;
19
+ margin-left: ${theme.space.space4};
20
+ `;
21
+ const CopyButton = ({ text }) => {
22
+ const [isCopied, copyToClipboard] = useCopyToClipboard({ text });
23
+ return _jsx(CopyButtonWrapper, { role: 'button', onClick: copyToClipboard, title: 'Copy to clipboard', children: isCopied ? _jsx(CheckIcon, { size: "16" }) : _jsx(CopyIcon, { size: "16" }) });
24
+ };
13
25
  const Wrapper = styled.span `
14
26
  code {
15
27
  ${inlineCodeStyles}
16
28
  }
17
29
  `;
18
30
  // This might be just a Chip component
19
- export const InlineCode = ({ children, size, ...props }) => (_jsx(Wrapper, { ...props, children: _jsx(Text, { type: "code", as: "code", size: size, children: children }) }));
31
+ export const InlineCode = ({ children, size, withCopyButton, ...props }) => _jsx(Wrapper, { ...props, children: _jsxs(Text, { type: "code", as: "code", size: size, children: [children, withCopyButton && _jsx(CopyButton, { text: children?.toString() ?? '' })] }) });
20
32
  //# sourceMappingURL=inline_code.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"inline_code.js","sourceRoot":"","sources":["../../../../../src/components/code/inline_code/inline_code.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAExD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG3C,wEAAwE;AACxE,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAA;;eAEpB,KAAK,CAAC,KAAK,CAAC,MAAM;wBACT,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe;qBACtC,KAAK,CAAC,MAAM,CAAC,OAAO;wBACjB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM;CACjD,CAAC;AAEF,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAA;;UAEjB,gBAAgB;;CAEzB,CAAC;AAOF,sCAAsC;AACtC,MAAM,CAAC,MAAM,UAAU,GAA8B,CAAC,EAClD,QAAQ,EACR,IAAI,EACJ,GAAG,KAAK,EACX,EAAE,EAAE,CAAC,CACF,KAAC,OAAO,OAAK,KAAK,YACd,KAAC,IAAI,IACD,IAAI,EAAC,MAAM,EACX,EAAE,EAAC,MAAM,EACT,IAAI,EAAE,IAAI,YAET,QAAQ,GACN,GACD,CACb,CAAC"}
1
+ {"version":3,"file":"inline_code.js","sourceRoot":"","sources":["../../../../../src/components/code/inline_code/inline_code.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,EAAE,IAAI,EAAE,MAAM,qBA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