@pingux/astro 2.48.0-alpha.2 → 2.48.0-alpha.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.
@@ -23,7 +23,7 @@ var _index = require("../../index");
|
|
23
23
|
var _CopyButton = _interopRequireDefault(require("./CopyButton"));
|
24
24
|
var _react2 = require("@emotion/react");
|
25
25
|
var _excluded = ["children", "tooltip"],
|
26
|
-
_excluded2 = ["children", "textToCopy", "tooltipText", "mode", "tooltipProps", "wrapperProps"];
|
26
|
+
_excluded2 = ["children", "textToCopy", "tooltipText", "mode", "tooltipProps", "wrapperProps", "iconButtonProps"];
|
27
27
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
28
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
29
29
|
var TooltipWrapper = function TooltipWrapper(_ref) {
|
@@ -47,6 +47,7 @@ var CopyText = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
47
47
|
mode = props.mode,
|
48
48
|
tooltipProps = props.tooltipProps,
|
49
49
|
wrapperProps = props.wrapperProps,
|
50
|
+
iconButtonProps = props.iconButtonProps,
|
50
51
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded2);
|
51
52
|
var value = textToCopy || (mode === 'link' ? children.props.href : children.props.children);
|
52
53
|
var _useState = (0, _react.useState)(false),
|
@@ -118,7 +119,7 @@ var CopyText = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
118
119
|
tabIndex: 0
|
119
120
|
}, (0, _reactAria.mergeProps)(hoverProps, others), wrapperProps), content, (0, _react2.jsx)(_CopyButton["default"], (0, _extends2["default"])({
|
120
121
|
onPress: copyToClipboard
|
121
|
-
}, focusProps))));
|
122
|
+
}, focusProps, iconButtonProps))));
|
122
123
|
}
|
123
124
|
if (mode === 'link') {
|
124
125
|
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
|
@@ -130,7 +131,7 @@ var CopyText = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
130
131
|
tooltip: tooltip
|
131
132
|
}, (0, _react2.jsx)(_CopyButton["default"], (0, _extends2["default"])({
|
132
133
|
onPress: copyToClipboard
|
133
|
-
}, (0, _reactAria.mergeProps)(hoverProps, focusProps)))));
|
134
|
+
}, (0, _reactAria.mergeProps)(hoverProps, focusProps, iconButtonProps)))));
|
134
135
|
}
|
135
136
|
return (0, _react2.jsx)(TooltipWrapper, {
|
136
137
|
isOpen: isTooltipOpen,
|
@@ -148,7 +149,7 @@ var CopyText = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
148
149
|
variant: "copyText.copy"
|
149
150
|
}, others), content, (0, _react2.jsx)(_CopyButton["default"], (0, _extends2["default"])({
|
150
151
|
onPress: copyToClipboard
|
151
|
-
}, focusProps)))));
|
152
|
+
}, focusProps, iconButtonProps)))));
|
152
153
|
});
|
153
154
|
CopyText.propTypes = {
|
154
155
|
/** The behavioral pattern to apply to the component. */
|
@@ -160,7 +161,9 @@ CopyText.propTypes = {
|
|
160
161
|
/** Props to apply to the tooltip in nonClickableContent mode. */
|
161
162
|
tooltipProps: _propTypes["default"].shape({}),
|
162
163
|
/** Props to apply to the wrapper in nonClickableContent mode. */
|
163
|
-
wrapperProps: _propTypes["default"].shape({})
|
164
|
+
wrapperProps: _propTypes["default"].shape({}),
|
165
|
+
/** Props to apply to the icon button */
|
166
|
+
iconButtonProps: _propTypes["default"].shape({})
|
164
167
|
};
|
165
168
|
CopyText.defaultProps = {
|
166
169
|
mode: 'text',
|
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
2
2
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
3
3
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
4
4
|
var _excluded = ["children", "tooltip"],
|
5
|
-
_excluded2 = ["children", "textToCopy", "tooltipText", "mode", "tooltipProps", "wrapperProps"];
|
5
|
+
_excluded2 = ["children", "textToCopy", "tooltipText", "mode", "tooltipProps", "wrapperProps", "iconButtonProps"];
|
6
6
|
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
7
7
|
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
8
8
|
import { mergeProps, useFocusRing } from 'react-aria';
|
@@ -34,6 +34,7 @@ var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
34
34
|
mode = props.mode,
|
35
35
|
tooltipProps = props.tooltipProps,
|
36
36
|
wrapperProps = props.wrapperProps,
|
37
|
+
iconButtonProps = props.iconButtonProps,
|
37
38
|
others = _objectWithoutProperties(props, _excluded2);
|
38
39
|
var value = textToCopy || (mode === 'link' ? children.props.href : children.props.children);
|
39
40
|
var _useState = useState(false),
|
@@ -105,7 +106,7 @@ var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
105
106
|
tabIndex: 0
|
106
107
|
}, mergeProps(hoverProps, others), wrapperProps), content, ___EmotionJSX(CopyButton, _extends({
|
107
108
|
onPress: copyToClipboard
|
108
|
-
}, focusProps))));
|
109
|
+
}, focusProps, iconButtonProps))));
|
109
110
|
}
|
110
111
|
if (mode === 'link') {
|
111
112
|
return ___EmotionJSX(Box, _extends({
|
@@ -117,7 +118,7 @@ var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
117
118
|
tooltip: tooltip
|
118
119
|
}, ___EmotionJSX(CopyButton, _extends({
|
119
120
|
onPress: copyToClipboard
|
120
|
-
}, mergeProps(hoverProps, focusProps)))));
|
121
|
+
}, mergeProps(hoverProps, focusProps, iconButtonProps)))));
|
121
122
|
}
|
122
123
|
return ___EmotionJSX(TooltipWrapper, {
|
123
124
|
isOpen: isTooltipOpen,
|
@@ -135,7 +136,7 @@ var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
135
136
|
variant: "copyText.copy"
|
136
137
|
}, others), content, ___EmotionJSX(CopyButton, _extends({
|
137
138
|
onPress: copyToClipboard
|
138
|
-
}, focusProps)))));
|
139
|
+
}, focusProps, iconButtonProps)))));
|
139
140
|
});
|
140
141
|
CopyText.propTypes = {
|
141
142
|
/** The behavioral pattern to apply to the component. */
|
@@ -147,7 +148,9 @@ CopyText.propTypes = {
|
|
147
148
|
/** Props to apply to the tooltip in nonClickableContent mode. */
|
148
149
|
tooltipProps: PropTypes.shape({}),
|
149
150
|
/** Props to apply to the wrapper in nonClickableContent mode. */
|
150
|
-
wrapperProps: PropTypes.shape({})
|
151
|
+
wrapperProps: PropTypes.shape({}),
|
152
|
+
/** Props to apply to the icon button */
|
153
|
+
iconButtonProps: PropTypes.shape({})
|
151
154
|
};
|
152
155
|
CopyText.defaultProps = {
|
153
156
|
mode: 'text',
|