@pingux/astro 2.92.0-alpha.1 → 2.92.0-alpha.2
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/lib/cjs/components/CodeView/CodeView.js +6 -3
- package/lib/cjs/components/CodeView/CodeView.stories.js +6 -1
- package/lib/cjs/components/CopyText/CopyButton.d.ts +1 -1
- package/lib/cjs/types/codeView.d.ts +2 -0
- package/lib/cjs/types/copyText.d.ts +1 -4
- package/lib/components/CodeView/CodeView.js +6 -3
- package/lib/components/CodeView/CodeView.stories.js +6 -1
- package/package.json +1 -1
@@ -31,7 +31,7 @@ var _useGetTheme = _interopRequireDefault(require("../../hooks/useGetTheme"));
|
|
31
31
|
var _codeView = _interopRequireDefault(require("../../styles/themes/next-gen/codeView/codeView"));
|
32
32
|
var _CodeView = _interopRequireDefault(require("./CodeView.styles"));
|
33
33
|
var _react2 = require("@emotion/react");
|
34
|
-
var _excluded = ["children", "className", "hasLineNumbers", "hasNoCopyButton", "language", "Prism", "stylesProp"];
|
34
|
+
var _excluded = ["children", "className", "hasLineNumbers", "hasNoCopyButton", "language", "Prism", "stylesProp", "iconButtonProps"];
|
35
35
|
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); }
|
36
36
|
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; }
|
37
37
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
@@ -44,6 +44,7 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
44
44
|
language = props.language,
|
45
45
|
customPrism = props.Prism,
|
46
46
|
stylesProp = props.stylesProp,
|
47
|
+
iconButtonProps = props.iconButtonProps,
|
47
48
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
48
49
|
var _useFocusRing = (0, _focus.useFocusRing)(),
|
49
50
|
isFocusVisible = _useFocusRing.isFocusVisible,
|
@@ -126,7 +127,8 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
126
127
|
}, language === null || language === void 0 ? void 0 : language.toUpperCase()), (0, _react2.jsx)(_.CopyText, {
|
127
128
|
ref: ref,
|
128
129
|
mode: "rightText",
|
129
|
-
textToCopy: children
|
130
|
+
textToCopy: children,
|
131
|
+
iconButtonProps: iconButtonProps
|
130
132
|
}, "Copy")), content);
|
131
133
|
}
|
132
134
|
if (hasNoCopyButton) {
|
@@ -148,7 +150,8 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
148
150
|
wrapperProps: _objectSpread({
|
149
151
|
className: classNames,
|
150
152
|
variant: 'codeView.wrapper'
|
151
|
-
}, others)
|
153
|
+
}, others),
|
154
|
+
iconButtonProps: iconButtonProps
|
152
155
|
}, content);
|
153
156
|
});
|
154
157
|
CodeView.defaultProps = {
|
@@ -7,6 +7,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
7
7
|
});
|
8
8
|
exports["default"] = exports.WithLineNumbers = exports.WithCustomSize = exports.WithAdditionalLanguage = exports.Default = void 0;
|
9
9
|
var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
11
12
|
var _prismjs = _interopRequireDefault(require("prismjs"));
|
12
13
|
var _storybookAddonDesigns = require("storybook-addon-designs");
|
@@ -59,7 +60,11 @@ var _default = {
|
|
59
60
|
};
|
60
61
|
exports["default"] = _default;
|
61
62
|
var Default = function Default(args) {
|
62
|
-
return (0, _react2.jsx)(_index.CodeView, args
|
63
|
+
return (0, _react2.jsx)(_index.CodeView, (0, _extends2["default"])({}, args, {
|
64
|
+
iconButtonProps: {
|
65
|
+
'data-testid': 'custom_data_id'
|
66
|
+
}
|
67
|
+
}));
|
63
68
|
};
|
64
69
|
exports.Default = Default;
|
65
70
|
Default.parameters = {
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { CopyButtonProps } from '../../types';
|
3
|
-
declare const CopyButton: React.ForwardRefExoticComponent<CopyButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
3
|
+
declare const CopyButton: React.ForwardRefExoticComponent<Omit<CopyButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
4
4
|
export default CopyButton;
|
@@ -2,6 +2,7 @@ import type { PrismTheme } from 'prism-react-renderer';
|
|
2
2
|
import { Language, Prism as PrismRR } from 'prism-react-renderer';
|
3
3
|
import Prism from 'prismjs';
|
4
4
|
import { ThemeUICSSObject } from 'theme-ui';
|
5
|
+
import { IconButtonProps } from './iconButton';
|
5
6
|
import { HoverProps, StyleProps } from './shared';
|
6
7
|
export type PrismProps = typeof PrismRR & typeof Prism;
|
7
8
|
export type PrismThemeProps = PrismTheme;
|
@@ -15,4 +16,5 @@ export interface CodeViewProps extends HoverProps, StyleProps {
|
|
15
16
|
sx?: ThemeUICSSObject;
|
16
17
|
stylesProp?: ThemeUICSSObject;
|
17
18
|
isNextGen?: boolean;
|
19
|
+
iconButtonProps?: IconButtonProps;
|
18
20
|
}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { RefObject } from 'react';
|
2
|
-
import { ThemeUIStyleObject } from 'theme-ui';
|
3
2
|
import { TestingAttributes } from './shared/test';
|
4
3
|
import { IconProps } from './icon';
|
5
4
|
import { IconButtonProps } from './iconButton';
|
@@ -22,8 +21,6 @@ export interface CopyTextProps extends HoverProps, TestingAttributes {
|
|
22
21
|
wrapperProps?: TooltipWrapperProps;
|
23
22
|
iconButtonProps?: Omit<IconButtonProps, 'onPress'>;
|
24
23
|
}
|
25
|
-
export interface CopyButtonProps {
|
24
|
+
export interface CopyButtonProps extends IconButtonProps {
|
26
25
|
iconProps?: IconProps;
|
27
|
-
onPress?: () => void;
|
28
|
-
sx?: ThemeUIStyleObject;
|
29
26
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
2
2
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
3
3
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
4
|
-
var _excluded = ["children", "className", "hasLineNumbers", "hasNoCopyButton", "language", "Prism", "stylesProp"];
|
4
|
+
var _excluded = ["children", "className", "hasLineNumbers", "hasNoCopyButton", "language", "Prism", "stylesProp", "iconButtonProps"];
|
5
5
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
7
7
|
import _trimInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/trim";
|
@@ -33,6 +33,7 @@ var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
33
33
|
language = props.language,
|
34
34
|
customPrism = props.Prism,
|
35
35
|
stylesProp = props.stylesProp,
|
36
|
+
iconButtonProps = props.iconButtonProps,
|
36
37
|
others = _objectWithoutProperties(props, _excluded);
|
37
38
|
var _useFocusRing = useFocusRing(),
|
38
39
|
isFocusVisible = _useFocusRing.isFocusVisible,
|
@@ -115,7 +116,8 @@ var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
115
116
|
}, language === null || language === void 0 ? void 0 : language.toUpperCase()), ___EmotionJSX(CopyText, {
|
116
117
|
ref: ref,
|
117
118
|
mode: "rightText",
|
118
|
-
textToCopy: children
|
119
|
+
textToCopy: children,
|
120
|
+
iconButtonProps: iconButtonProps
|
119
121
|
}, "Copy")), content);
|
120
122
|
}
|
121
123
|
if (hasNoCopyButton) {
|
@@ -137,7 +139,8 @@ var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
137
139
|
wrapperProps: _objectSpread({
|
138
140
|
className: classNames,
|
139
141
|
variant: 'codeView.wrapper'
|
140
|
-
}, others)
|
142
|
+
}, others),
|
143
|
+
iconButtonProps: iconButtonProps
|
141
144
|
}, content);
|
142
145
|
});
|
143
146
|
CodeView.defaultProps = {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
1
2
|
import _trimInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/trim";
|
2
3
|
import React from 'react';
|
3
4
|
import Prism from 'prismjs';
|
@@ -50,7 +51,11 @@ export default {
|
|
50
51
|
}
|
51
52
|
};
|
52
53
|
export var Default = function Default(args) {
|
53
|
-
return ___EmotionJSX(CodeView, args
|
54
|
+
return ___EmotionJSX(CodeView, _extends({}, args, {
|
55
|
+
iconButtonProps: {
|
56
|
+
'data-testid': 'custom_data_id'
|
57
|
+
}
|
58
|
+
}));
|
54
59
|
};
|
55
60
|
Default.parameters = {
|
56
61
|
design: {
|