@contentful/f36-copybutton 4.0.0
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/LICENSE.md +7 -0
- package/README.mdx +51 -0
- package/dist/main.js +123 -0
- package/dist/main.js.map +1 -0
- package/dist/module.js +116 -0
- package/dist/module.js.map +1 -0
- package/dist/types.d.ts +57 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +38 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright (c) 2018-present Contentful GmbH
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.mdx
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'CopyButton'
|
|
3
|
+
type: 'component'
|
|
4
|
+
status: 'stable'
|
|
5
|
+
section: 'buttonComponents'
|
|
6
|
+
slug: /components/copy-button/
|
|
7
|
+
github: 'https://github.com/contentful/forma-36/tree/forma-v4/packages/components/copybutton'
|
|
8
|
+
typescript: ./src/CopyButton.tsx
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
The `CopyButton` is a styled button that copies text into the user's clipboard.
|
|
12
|
+
|
|
13
|
+
`CopyButton` can be used in combination with text inputs where the input value should be easy to copy. In such cases it is best to position the `CopyButton` at the end of the input.
|
|
14
|
+
|
|
15
|
+
## Import
|
|
16
|
+
|
|
17
|
+
```js static=true
|
|
18
|
+
import { CopyButton } from '@contentful/f36-components';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Examples
|
|
22
|
+
|
|
23
|
+
### Basic
|
|
24
|
+
|
|
25
|
+
```jsx file=examples/CopyButtonExample.tsx
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Changing the tooltip
|
|
30
|
+
|
|
31
|
+
You can modify tooltip text and its placement by using the following properties: `tooltipCopiedText`, `tooltipText` and `tooltipProps`.
|
|
32
|
+
|
|
33
|
+
To read more about all possible values of `tooltipProps` object, refer to [Tooltip](../components/tooltip) documentation.
|
|
34
|
+
|
|
35
|
+
```jsx file=examples/CopyButtonModifiedTooltipsExample.tsx
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Using with `TextInput`
|
|
40
|
+
|
|
41
|
+
```jsx file=examples/CopyButtonWithInputExample.tsx
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Accessibility
|
|
46
|
+
|
|
47
|
+
You can pass a custom `aria-label` through the `label` prop.
|
|
48
|
+
|
|
49
|
+
## Props (API reference)
|
|
50
|
+
|
|
51
|
+
<Props of="CopyButton" storybookPath="/story/components-copybutton--default" />
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
var $2mOCL$emotion = require("emotion");
|
|
2
|
+
var $2mOCL$react = require("react");
|
|
3
|
+
var $2mOCL$reactcopytoclipboard = require("react-copy-to-clipboard");
|
|
4
|
+
var $2mOCL$contentfulf36icons = require("@contentful/f36-icons");
|
|
5
|
+
var $2mOCL$contentfulf36tooltip = require("@contentful/f36-tooltip");
|
|
6
|
+
var $2mOCL$contentfulf36tokens = require("@contentful/f36-tokens");
|
|
7
|
+
|
|
8
|
+
function $parcel$export(e, n, v, s) {
|
|
9
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
10
|
+
}
|
|
11
|
+
function $parcel$interopDefault(a) {
|
|
12
|
+
return a && a.__esModule ? a.default : a;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
$parcel$export(module.exports, "CopyButton", () => $7cfc52ec8d291deb$export$4f2558dd25106ae2);
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
const $a21422a7510521de$export$ffd58b7f6f099a57 = ({ size: size })=>{
|
|
24
|
+
const buttonSize = size === 'small' ? '32px' : '40px';
|
|
25
|
+
return {
|
|
26
|
+
wrapper: /*#__PURE__*/ $2mOCL$emotion.css({
|
|
27
|
+
display: 'inline-block',
|
|
28
|
+
height: buttonSize,
|
|
29
|
+
position: 'relative',
|
|
30
|
+
width: buttonSize
|
|
31
|
+
}),
|
|
32
|
+
copyButton: /*#__PURE__*/ $2mOCL$emotion.css({
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
background: ($parcel$interopDefault($2mOCL$contentfulf36tokens)).colorWhite,
|
|
35
|
+
border: `1px solid ${($parcel$interopDefault($2mOCL$contentfulf36tokens)).gray300}`,
|
|
36
|
+
display: 'inline-flex',
|
|
37
|
+
height: '100%',
|
|
38
|
+
justifyContent: 'center',
|
|
39
|
+
outline: 'none',
|
|
40
|
+
padding: 0,
|
|
41
|
+
transition: `background ${($parcel$interopDefault($2mOCL$contentfulf36tokens)).transitionDurationShort} ${($parcel$interopDefault($2mOCL$contentfulf36tokens)).transitionEasingDefault}`,
|
|
42
|
+
width: '100%',
|
|
43
|
+
'&:hover': {
|
|
44
|
+
backgroundColor: ($parcel$interopDefault($2mOCL$contentfulf36tokens)).gray100,
|
|
45
|
+
cursor: 'pointer'
|
|
46
|
+
},
|
|
47
|
+
'&:active': {
|
|
48
|
+
backgroundColor: ($parcel$interopDefault($2mOCL$contentfulf36tokens)).gray200,
|
|
49
|
+
cursor: 'pointer'
|
|
50
|
+
},
|
|
51
|
+
'&:focus': {
|
|
52
|
+
boxShadow: ($parcel$interopDefault($2mOCL$contentfulf36tokens)).glowMuted
|
|
53
|
+
}
|
|
54
|
+
}),
|
|
55
|
+
copyButtonDisabled: /*#__PURE__*/ $2mOCL$emotion.css({
|
|
56
|
+
cursor: 'not-allowed',
|
|
57
|
+
backgroundColor: ($parcel$interopDefault($2mOCL$contentfulf36tokens)).gray100,
|
|
58
|
+
'&:hover': {
|
|
59
|
+
cursor: 'not-allowed',
|
|
60
|
+
backgroundColor: ($parcel$interopDefault($2mOCL$contentfulf36tokens)).gray100
|
|
61
|
+
},
|
|
62
|
+
'&:focus': {
|
|
63
|
+
borderColor: ($parcel$interopDefault($2mOCL$contentfulf36tokens)).gray300,
|
|
64
|
+
boxShadow: 'none'
|
|
65
|
+
},
|
|
66
|
+
'&:active, &:active:hover': {
|
|
67
|
+
borderColor: ($parcel$interopDefault($2mOCL$contentfulf36tokens)).gray300,
|
|
68
|
+
boxShadow: 'none'
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
function $7cfc52ec8d291deb$var$_CopyButton(props, ref) {
|
|
76
|
+
const { onCopy: onCopy , value: value , className: className , testId: testId = 'cf-ui-copy-button' , tooltipText: tooltipText = 'Copy to clipboard' , tooltipCopiedText: tooltipCopiedText = 'Copied!' , tooltipProps: tooltipProps , isDisabled: isDisabled = false , size: size = 'medium' , ...otherProps } = props;
|
|
77
|
+
const styles = $a21422a7510521de$export$ffd58b7f6f099a57({
|
|
78
|
+
size: size
|
|
79
|
+
});
|
|
80
|
+
const [copied, setCopied] = $2mOCL$react.useState(false);
|
|
81
|
+
const button = $2mOCL$react.useRef(null);
|
|
82
|
+
const handleOnCopy = $2mOCL$react.useCallback((e)=>{
|
|
83
|
+
if (onCopy) onCopy(e);
|
|
84
|
+
setCopied(true);
|
|
85
|
+
setTimeout(()=>{
|
|
86
|
+
setCopied(false);
|
|
87
|
+
if (button.current) button.current.blur();
|
|
88
|
+
}, 1000);
|
|
89
|
+
}, [
|
|
90
|
+
onCopy
|
|
91
|
+
]);
|
|
92
|
+
return(/*#__PURE__*/ ($parcel$interopDefault($2mOCL$react)).createElement("div", {
|
|
93
|
+
ref: ref,
|
|
94
|
+
"data-test-id": testId,
|
|
95
|
+
className: $2mOCL$emotion.cx(styles.wrapper, className),
|
|
96
|
+
...otherProps
|
|
97
|
+
}, /*#__PURE__*/ ($parcel$interopDefault($2mOCL$react)).createElement(($parcel$interopDefault($2mOCL$reactcopytoclipboard)), {
|
|
98
|
+
text: value,
|
|
99
|
+
onCopy: handleOnCopy
|
|
100
|
+
}, /*#__PURE__*/ ($parcel$interopDefault($2mOCL$react)).createElement($2mOCL$contentfulf36tooltip.Tooltip, {
|
|
101
|
+
content: copied ? tooltipCopiedText : tooltipText,
|
|
102
|
+
...tooltipProps,
|
|
103
|
+
isDisabled: isDisabled
|
|
104
|
+
}, /*#__PURE__*/ ($parcel$interopDefault($2mOCL$react)).createElement("button", {
|
|
105
|
+
type: "button",
|
|
106
|
+
ref: button,
|
|
107
|
+
className: $2mOCL$emotion.cx(styles.copyButton, {
|
|
108
|
+
[styles.copyButtonDisabled]: isDisabled
|
|
109
|
+
}),
|
|
110
|
+
"aria-label": `Copy ${value} to clipboard`,
|
|
111
|
+
disabled: isDisabled,
|
|
112
|
+
"aria-live": "assertive"
|
|
113
|
+
}, /*#__PURE__*/ ($parcel$interopDefault($2mOCL$react)).createElement($2mOCL$contentfulf36icons.CopyIcon, {
|
|
114
|
+
variant: "muted",
|
|
115
|
+
size: size === 'small' ? 'tiny' : 'small'
|
|
116
|
+
}))))));
|
|
117
|
+
}
|
|
118
|
+
const $7cfc52ec8d291deb$export$4f2558dd25106ae2 = /*#__PURE__*/ ($parcel$interopDefault($2mOCL$react)).forwardRef($7cfc52ec8d291deb$var$_CopyButton);
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"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","sources":["packages/components/copybutton/src/index.ts","packages/components/copybutton/src/CopyButton.tsx","packages/components/copybutton/src/CopyButton.styles.ts"],"sourcesContent":["export { CopyButton } from './CopyButton';\nexport type { CopyButtonProps } from './CopyButton';\n","import { cx } from 'emotion';\nimport React, { useState, useCallback, useRef } from 'react';\nimport CopyToClipboard from 'react-copy-to-clipboard';\nimport { CopyIcon } from '@contentful/f36-icons';\nimport type { CommonProps, ExpandProps } from '@contentful/f36-core';\nimport { Tooltip } from '@contentful/f36-tooltip';\nimport type { TooltipProps } from '@contentful/f36-tooltip';\nimport { getStyles } from './CopyButton.styles';\n\nexport interface CopyButtonProps extends CommonProps {\n /**\n * Function that gets called when the button is clicked\n */\n onCopy?: (string) => void;\n /**\n * Text to be shown when the button is clicked\n * @default Copied!\n */\n tooltipCopiedText?: string;\n /**\n * Text to be shown when button is hovered or focused\n * @default Copy to clipboard\n */\n tooltipText?: string;\n /**\n * Props that are passed to the tooltip component\n */\n tooltipProps?: Omit<TooltipProps, 'content' | 'children'>;\n /**\n * Value that will be copied to clipboard when the button is clicked\n */\n value: string;\n /**\n * Label to be used on aria-label for the button\n * @default Copy {value} to clipboard\n */\n label?: string;\n /**\n * Allows to disable the copy button, when true the tooltip would not be shown\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Allows setting size of the copy button to small\n * @default medium\n */\n size?: 'small' | 'medium';\n}\n\nfunction _CopyButton(\n props: ExpandProps<CopyButtonProps>,\n ref: React.Ref<HTMLDivElement>,\n) {\n const {\n onCopy,\n value,\n className,\n testId = 'cf-ui-copy-button',\n tooltipText = 'Copy to clipboard',\n tooltipCopiedText = 'Copied!',\n tooltipProps,\n isDisabled = false,\n size = 'medium',\n ...otherProps\n } = props;\n const styles = getStyles({ size });\n\n const [copied, setCopied] = useState(false);\n const button = useRef<HTMLButtonElement | null>(null);\n const handleOnCopy = useCallback(\n (e: string) => {\n if (onCopy) {\n onCopy(e);\n }\n\n setCopied(true);\n\n setTimeout(() => {\n setCopied(false);\n if (button.current) {\n button.current.blur();\n }\n }, 1000);\n },\n [onCopy],\n );\n\n return (\n <div\n ref={ref}\n data-test-id={testId}\n className={cx(styles.wrapper, className)}\n {...otherProps}\n >\n <CopyToClipboard text={value} onCopy={handleOnCopy}>\n <Tooltip\n content={copied ? tooltipCopiedText : tooltipText}\n {...tooltipProps}\n isDisabled={isDisabled}\n >\n <button\n type=\"button\"\n ref={button}\n className={cx(styles.copyButton, {\n [styles.copyButtonDisabled]: isDisabled,\n })}\n aria-label={`Copy ${value} to clipboard`}\n disabled={isDisabled}\n aria-live=\"assertive\"\n >\n <CopyIcon\n variant=\"muted\"\n size={size === 'small' ? 'tiny' : 'small'}\n />\n </button>\n </Tooltip>\n </CopyToClipboard>\n </div>\n );\n}\n\nexport const CopyButton = React.forwardRef(_CopyButton);\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getStyles = ({ size }) => {\n const buttonSize = size === 'small' ? '32px' : '40px';\n\n return {\n wrapper: css({\n display: 'inline-block',\n height: buttonSize,\n position: 'relative',\n width: buttonSize,\n }),\n copyButton: css({\n alignItems: 'center',\n background: tokens.colorWhite,\n border: `1px solid ${tokens.gray300}`,\n display: 'inline-flex',\n height: '100%',\n justifyContent: 'center',\n outline: 'none',\n padding: 0,\n transition: `background ${tokens.transitionDurationShort} ${tokens.transitionEasingDefault}`,\n width: '100%',\n '&:hover': {\n backgroundColor: tokens.gray100,\n cursor: 'pointer',\n },\n '&:active': {\n backgroundColor: tokens.gray200,\n cursor: 'pointer',\n },\n '&:focus': {\n boxShadow: tokens.glowMuted,\n },\n }),\n copyButtonDisabled: css({\n cursor: 'not-allowed',\n backgroundColor: tokens.gray100,\n\n '&:hover': {\n cursor: 'not-allowed',\n backgroundColor: tokens.gray100,\n },\n\n '&:focus': {\n borderColor: tokens.gray300,\n boxShadow: 'none',\n },\n\n '&:active, &:active:hover': {\n borderColor: tokens.gray300,\n boxShadow: 'none',\n },\n }),\n };\n};\n"],"names":["CopyButton","CopyButtonProps","React","useState","useCallback","useRef","CopyToClipboard","CopyIcon","CommonProps","ExpandProps","Tooltip","TooltipProps","getStyles","onCopy","string","tooltipCopiedText","tooltipText","tooltipProps","Omit","value","label","isDisabled","size","_CopyButton","props","ref","Ref","HTMLDivElement","className","testId","otherProps","styles","copied","setCopied","button","HTMLButtonElement","handleOnCopy","e","setTimeout","current","blur","wrapper","copyButton","copyButtonDisabled","forwardRef","tokens","buttonSize","display","height","position","width","alignItems","background","colorWhite","border","gray300","justifyContent","outline","padding","transition","transitionDurationShort","transitionEasingDefault","backgroundColor","gray100","cursor","gray200","boxShadow","glowMuted","borderColor"],"version":3,"file":"main.js.map"}
|
package/dist/module.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import {cx as $dnnsg$cx, css as $dnnsg$css} from "emotion";
|
|
2
|
+
import $dnnsg$react, {useState as $dnnsg$useState, useRef as $dnnsg$useRef, useCallback as $dnnsg$useCallback} from "react";
|
|
3
|
+
import $dnnsg$reactcopytoclipboard from "react-copy-to-clipboard";
|
|
4
|
+
import {CopyIcon as $dnnsg$CopyIcon} from "@contentful/f36-icons";
|
|
5
|
+
import {Tooltip as $dnnsg$Tooltip} from "@contentful/f36-tooltip";
|
|
6
|
+
import $dnnsg$contentfulf36tokens from "@contentful/f36-tokens";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const $c5d0896db030b9aa$export$ffd58b7f6f099a57 = ({ size: size })=>{
|
|
16
|
+
const buttonSize = size === 'small' ? '32px' : '40px';
|
|
17
|
+
return {
|
|
18
|
+
wrapper: /*#__PURE__*/ $dnnsg$css({
|
|
19
|
+
display: 'inline-block',
|
|
20
|
+
height: buttonSize,
|
|
21
|
+
position: 'relative',
|
|
22
|
+
width: buttonSize
|
|
23
|
+
}),
|
|
24
|
+
copyButton: /*#__PURE__*/ $dnnsg$css({
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
background: $dnnsg$contentfulf36tokens.colorWhite,
|
|
27
|
+
border: `1px solid ${$dnnsg$contentfulf36tokens.gray300}`,
|
|
28
|
+
display: 'inline-flex',
|
|
29
|
+
height: '100%',
|
|
30
|
+
justifyContent: 'center',
|
|
31
|
+
outline: 'none',
|
|
32
|
+
padding: 0,
|
|
33
|
+
transition: `background ${$dnnsg$contentfulf36tokens.transitionDurationShort} ${$dnnsg$contentfulf36tokens.transitionEasingDefault}`,
|
|
34
|
+
width: '100%',
|
|
35
|
+
'&:hover': {
|
|
36
|
+
backgroundColor: $dnnsg$contentfulf36tokens.gray100,
|
|
37
|
+
cursor: 'pointer'
|
|
38
|
+
},
|
|
39
|
+
'&:active': {
|
|
40
|
+
backgroundColor: $dnnsg$contentfulf36tokens.gray200,
|
|
41
|
+
cursor: 'pointer'
|
|
42
|
+
},
|
|
43
|
+
'&:focus': {
|
|
44
|
+
boxShadow: $dnnsg$contentfulf36tokens.glowMuted
|
|
45
|
+
}
|
|
46
|
+
}),
|
|
47
|
+
copyButtonDisabled: /*#__PURE__*/ $dnnsg$css({
|
|
48
|
+
cursor: 'not-allowed',
|
|
49
|
+
backgroundColor: $dnnsg$contentfulf36tokens.gray100,
|
|
50
|
+
'&:hover': {
|
|
51
|
+
cursor: 'not-allowed',
|
|
52
|
+
backgroundColor: $dnnsg$contentfulf36tokens.gray100
|
|
53
|
+
},
|
|
54
|
+
'&:focus': {
|
|
55
|
+
borderColor: $dnnsg$contentfulf36tokens.gray300,
|
|
56
|
+
boxShadow: 'none'
|
|
57
|
+
},
|
|
58
|
+
'&:active, &:active:hover': {
|
|
59
|
+
borderColor: $dnnsg$contentfulf36tokens.gray300,
|
|
60
|
+
boxShadow: 'none'
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
function $b6698237aa721326$var$_CopyButton(props, ref) {
|
|
68
|
+
const { onCopy: onCopy , value: value , className: className , testId: testId = 'cf-ui-copy-button' , tooltipText: tooltipText = 'Copy to clipboard' , tooltipCopiedText: tooltipCopiedText = 'Copied!' , tooltipProps: tooltipProps , isDisabled: isDisabled = false , size: size = 'medium' , ...otherProps } = props;
|
|
69
|
+
const styles = $c5d0896db030b9aa$export$ffd58b7f6f099a57({
|
|
70
|
+
size: size
|
|
71
|
+
});
|
|
72
|
+
const [copied, setCopied] = $dnnsg$useState(false);
|
|
73
|
+
const button = $dnnsg$useRef(null);
|
|
74
|
+
const handleOnCopy = $dnnsg$useCallback((e)=>{
|
|
75
|
+
if (onCopy) onCopy(e);
|
|
76
|
+
setCopied(true);
|
|
77
|
+
setTimeout(()=>{
|
|
78
|
+
setCopied(false);
|
|
79
|
+
if (button.current) button.current.blur();
|
|
80
|
+
}, 1000);
|
|
81
|
+
}, [
|
|
82
|
+
onCopy
|
|
83
|
+
]);
|
|
84
|
+
return(/*#__PURE__*/ $dnnsg$react.createElement("div", {
|
|
85
|
+
ref: ref,
|
|
86
|
+
"data-test-id": testId,
|
|
87
|
+
className: $dnnsg$cx(styles.wrapper, className),
|
|
88
|
+
...otherProps
|
|
89
|
+
}, /*#__PURE__*/ $dnnsg$react.createElement($dnnsg$reactcopytoclipboard, {
|
|
90
|
+
text: value,
|
|
91
|
+
onCopy: handleOnCopy
|
|
92
|
+
}, /*#__PURE__*/ $dnnsg$react.createElement($dnnsg$Tooltip, {
|
|
93
|
+
content: copied ? tooltipCopiedText : tooltipText,
|
|
94
|
+
...tooltipProps,
|
|
95
|
+
isDisabled: isDisabled
|
|
96
|
+
}, /*#__PURE__*/ $dnnsg$react.createElement("button", {
|
|
97
|
+
type: "button",
|
|
98
|
+
ref: button,
|
|
99
|
+
className: $dnnsg$cx(styles.copyButton, {
|
|
100
|
+
[styles.copyButtonDisabled]: isDisabled
|
|
101
|
+
}),
|
|
102
|
+
"aria-label": `Copy ${value} to clipboard`,
|
|
103
|
+
disabled: isDisabled,
|
|
104
|
+
"aria-live": "assertive"
|
|
105
|
+
}, /*#__PURE__*/ $dnnsg$react.createElement($dnnsg$CopyIcon, {
|
|
106
|
+
variant: "muted",
|
|
107
|
+
size: size === 'small' ? 'tiny' : 'small'
|
|
108
|
+
}))))));
|
|
109
|
+
}
|
|
110
|
+
const $b6698237aa721326$export$4f2558dd25106ae2 = /*#__PURE__*/ $dnnsg$react.forwardRef($b6698237aa721326$var$_CopyButton);
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
export {$b6698237aa721326$export$4f2558dd25106ae2 as CopyButton};
|
|
116
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"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","sources":["packages/components/copybutton/src/index.ts","packages/components/copybutton/src/CopyButton.tsx","packages/components/copybutton/src/CopyButton.styles.ts"],"sourcesContent":["export { CopyButton } from './CopyButton';\nexport type { CopyButtonProps } from './CopyButton';\n","import { cx } from 'emotion';\nimport React, { useState, useCallback, useRef } from 'react';\nimport CopyToClipboard from 'react-copy-to-clipboard';\nimport { CopyIcon } from '@contentful/f36-icons';\nimport type { CommonProps, ExpandProps } from '@contentful/f36-core';\nimport { Tooltip } from '@contentful/f36-tooltip';\nimport type { TooltipProps } from '@contentful/f36-tooltip';\nimport { getStyles } from './CopyButton.styles';\n\nexport interface CopyButtonProps extends CommonProps {\n /**\n * Function that gets called when the button is clicked\n */\n onCopy?: (string) => void;\n /**\n * Text to be shown when the button is clicked\n * @default Copied!\n */\n tooltipCopiedText?: string;\n /**\n * Text to be shown when button is hovered or focused\n * @default Copy to clipboard\n */\n tooltipText?: string;\n /**\n * Props that are passed to the tooltip component\n */\n tooltipProps?: Omit<TooltipProps, 'content' | 'children'>;\n /**\n * Value that will be copied to clipboard when the button is clicked\n */\n value: string;\n /**\n * Label to be used on aria-label for the button\n * @default Copy {value} to clipboard\n */\n label?: string;\n /**\n * Allows to disable the copy button, when true the tooltip would not be shown\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Allows setting size of the copy button to small\n * @default medium\n */\n size?: 'small' | 'medium';\n}\n\nfunction _CopyButton(\n props: ExpandProps<CopyButtonProps>,\n ref: React.Ref<HTMLDivElement>,\n) {\n const {\n onCopy,\n value,\n className,\n testId = 'cf-ui-copy-button',\n tooltipText = 'Copy to clipboard',\n tooltipCopiedText = 'Copied!',\n tooltipProps,\n isDisabled = false,\n size = 'medium',\n ...otherProps\n } = props;\n const styles = getStyles({ size });\n\n const [copied, setCopied] = useState(false);\n const button = useRef<HTMLButtonElement | null>(null);\n const handleOnCopy = useCallback(\n (e: string) => {\n if (onCopy) {\n onCopy(e);\n }\n\n setCopied(true);\n\n setTimeout(() => {\n setCopied(false);\n if (button.current) {\n button.current.blur();\n }\n }, 1000);\n },\n [onCopy],\n );\n\n return (\n <div\n ref={ref}\n data-test-id={testId}\n className={cx(styles.wrapper, className)}\n {...otherProps}\n >\n <CopyToClipboard text={value} onCopy={handleOnCopy}>\n <Tooltip\n content={copied ? tooltipCopiedText : tooltipText}\n {...tooltipProps}\n isDisabled={isDisabled}\n >\n <button\n type=\"button\"\n ref={button}\n className={cx(styles.copyButton, {\n [styles.copyButtonDisabled]: isDisabled,\n })}\n aria-label={`Copy ${value} to clipboard`}\n disabled={isDisabled}\n aria-live=\"assertive\"\n >\n <CopyIcon\n variant=\"muted\"\n size={size === 'small' ? 'tiny' : 'small'}\n />\n </button>\n </Tooltip>\n </CopyToClipboard>\n </div>\n );\n}\n\nexport const CopyButton = React.forwardRef(_CopyButton);\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getStyles = ({ size }) => {\n const buttonSize = size === 'small' ? '32px' : '40px';\n\n return {\n wrapper: css({\n display: 'inline-block',\n height: buttonSize,\n position: 'relative',\n width: buttonSize,\n }),\n copyButton: css({\n alignItems: 'center',\n background: tokens.colorWhite,\n border: `1px solid ${tokens.gray300}`,\n display: 'inline-flex',\n height: '100%',\n justifyContent: 'center',\n outline: 'none',\n padding: 0,\n transition: `background ${tokens.transitionDurationShort} ${tokens.transitionEasingDefault}`,\n width: '100%',\n '&:hover': {\n backgroundColor: tokens.gray100,\n cursor: 'pointer',\n },\n '&:active': {\n backgroundColor: tokens.gray200,\n cursor: 'pointer',\n },\n '&:focus': {\n boxShadow: tokens.glowMuted,\n },\n }),\n copyButtonDisabled: css({\n cursor: 'not-allowed',\n backgroundColor: tokens.gray100,\n\n '&:hover': {\n cursor: 'not-allowed',\n backgroundColor: tokens.gray100,\n },\n\n '&:focus': {\n borderColor: tokens.gray300,\n boxShadow: 'none',\n },\n\n '&:active, &:active:hover': {\n borderColor: tokens.gray300,\n boxShadow: 'none',\n },\n }),\n };\n};\n"],"names":["CopyButton","CopyButtonProps","React","useState","useCallback","useRef","CopyToClipboard","CopyIcon","CommonProps","ExpandProps","Tooltip","TooltipProps","getStyles","onCopy","string","tooltipCopiedText","tooltipText","tooltipProps","Omit","value","label","isDisabled","size","_CopyButton","props","ref","Ref","HTMLDivElement","className","testId","otherProps","styles","copied","setCopied","button","HTMLButtonElement","handleOnCopy","e","setTimeout","current","blur","wrapper","copyButton","copyButtonDisabled","forwardRef","tokens","buttonSize","display","height","position","width","alignItems","background","colorWhite","border","gray300","justifyContent","outline","padding","transition","transitionDurationShort","transitionEasingDefault","backgroundColor","gray100","cursor","gray200","boxShadow","glowMuted","borderColor"],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CommonProps } from "@contentful/f36-core";
|
|
3
|
+
import { TooltipProps } from "@contentful/f36-tooltip";
|
|
4
|
+
export interface CopyButtonProps extends CommonProps {
|
|
5
|
+
/**
|
|
6
|
+
* Function that gets called when the button is clicked
|
|
7
|
+
*/
|
|
8
|
+
onCopy?: (string: any) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Text to be shown when the button is clicked
|
|
11
|
+
* @default Copied!
|
|
12
|
+
*/
|
|
13
|
+
tooltipCopiedText?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Text to be shown when button is hovered or focused
|
|
16
|
+
* @default Copy to clipboard
|
|
17
|
+
*/
|
|
18
|
+
tooltipText?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Props that are passed to the tooltip component
|
|
21
|
+
*/
|
|
22
|
+
tooltipProps?: Omit<TooltipProps, 'content' | 'children'>;
|
|
23
|
+
/**
|
|
24
|
+
* Value that will be copied to clipboard when the button is clicked
|
|
25
|
+
*/
|
|
26
|
+
value: string;
|
|
27
|
+
/**
|
|
28
|
+
* Label to be used on aria-label for the button
|
|
29
|
+
* @default Copy {value} to clipboard
|
|
30
|
+
*/
|
|
31
|
+
label?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Allows to disable the copy button, when true the tooltip would not be shown
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
isDisabled?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Allows setting size of the copy button to small
|
|
39
|
+
* @default medium
|
|
40
|
+
*/
|
|
41
|
+
size?: 'small' | 'medium';
|
|
42
|
+
}
|
|
43
|
+
export const CopyButton: React.ForwardRefExoticComponent<{
|
|
44
|
+
onCopy?: (string: any) => void;
|
|
45
|
+
tooltipCopiedText?: string;
|
|
46
|
+
tooltipText?: string;
|
|
47
|
+
tooltipProps?: Omit<TooltipProps, 'content' | 'children'>;
|
|
48
|
+
value: string;
|
|
49
|
+
label?: string;
|
|
50
|
+
isDisabled?: boolean;
|
|
51
|
+
size?: 'small' | 'medium';
|
|
52
|
+
className?: string;
|
|
53
|
+
testId?: string;
|
|
54
|
+
style?: React.CSSProperties;
|
|
55
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;ACSA,gCAAiC,SAAQ,WAAW;IAClD;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,KAAA,KAAK,IAAI,CAAC;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,UAAU,CAAC,CAAC;IAC1D;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC3B;AA0ED,OAAO,MAAM;8BA5GU,IAAI;wBAKL,MAAM;kBAKZ,MAAM;mBAIL,KAAK,YAAY,EAAE,SAAS,GAAG,UAAU,CAAC;WAIlD,MAAM;YAKL,MAAM;iBAKD,OAAO;WAKb,OAAO,GAAG,QAAQ;;;;wCA2E4B,CAAC","sources":["packages/components/copybutton/src/src/CopyButton.styles.ts","packages/components/copybutton/src/src/CopyButton.tsx","packages/components/copybutton/src/src/index.ts","packages/components/copybutton/src/index.ts"],"sourcesContent":[null,null,null,"export { CopyButton } from './CopyButton';\nexport type { CopyButtonProps } from './CopyButton';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contentful/f36-copybutton",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "Forma 36: CopyButton component",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "parcel build"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@babel/runtime": "^7.6.2",
|
|
10
|
+
"@contentful/f36-core": "^4.0.0",
|
|
11
|
+
"@contentful/f36-icons": "^4.0.0",
|
|
12
|
+
"@contentful/f36-tokens": "^4.0.0",
|
|
13
|
+
"@contentful/f36-tooltip": "^4.0.0",
|
|
14
|
+
"emotion": "^10.0.17",
|
|
15
|
+
"react-copy-to-clipboard": "^5.0.3"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"react": ">=16.8"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"main": "dist/main.js",
|
|
25
|
+
"module": "dist/module.js",
|
|
26
|
+
"types": "dist/types.d.ts",
|
|
27
|
+
"source": "src/index.ts",
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"browserslist": "extends @contentful/browserslist-config",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/contentful/forma-36"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"gitHead": "01d931c77410619d05cd00dbb3b5acc5d8ae2cdf"
|
|
38
|
+
}
|