@pingux/astro 1.1.0 → 1.1.1-alpha.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/lib/cjs/components/CodeView/CodeView.js +15 -5
- package/lib/cjs/components/CodeView/CodeView.stories.js +1 -1
- package/lib/cjs/components/PopoverMenu/PopoverMenu.js +1 -3
- package/lib/cjs/styles/variants/codeView.js +0 -3
- package/lib/components/CodeView/CodeView.js +14 -5
- package/lib/components/CodeView/CodeView.stories.js +1 -1
- package/lib/components/PopoverMenu/PopoverMenu.js +1 -3
- package/lib/styles/variants/codeView.js +0 -1
- package/package.json +1 -2
@@ -50,6 +50,8 @@ var _utils = require("@react-aria/utils");
|
|
50
50
|
|
51
51
|
var _prismReactRenderer = _interopRequireWildcard(require("prism-react-renderer"));
|
52
52
|
|
53
|
+
var _github = _interopRequireDefault(require("prism-react-renderer/themes/github"));
|
54
|
+
|
53
55
|
var _hooks = require("../../hooks");
|
54
56
|
|
55
57
|
var _ = require("../..");
|
@@ -61,10 +63,8 @@ function ownKeys(object, enumerableOnly) { var keys = (0, _keys["default"])(obje
|
|
61
63
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; (0, _forEach["default"])(_context = ownKeys(Object(source), true)).call(_context, function (key) { (0, _defineProperty3["default"])(target, key, source[key]); }); } else if (_getOwnPropertyDescriptors["default"]) { (0, _defineProperties["default"])(target, (0, _getOwnPropertyDescriptors["default"])(source)); } else { var _context2; (0, _forEach["default"])(_context2 = ownKeys(Object(source))).call(_context2, function (key) { (0, _defineProperty2["default"])(target, key, (0, _getOwnPropertyDescriptor["default"])(source, key)); }); } } return target; }
|
62
64
|
|
63
65
|
/**
|
64
|
-
*
|
65
|
-
* Built on top of
|
66
|
-
*
|
67
|
-
* A list of all supported languages that can be passed to `language` prop is [here](https://github.com/FormidableLabs/prism-react-renderer/blob/master/src/vendor/prism/includeLangs.js).
|
66
|
+
* Component for code syntax highlighting.
|
67
|
+
* Built on top of [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer).
|
68
68
|
*/
|
69
69
|
var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
70
70
|
var children = props.children,
|
@@ -96,7 +96,7 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
96
96
|
};
|
97
97
|
|
98
98
|
var content = (0, _react2.jsx)(_prismReactRenderer["default"], (0, _extends2["default"])({}, _prismReactRenderer.defaultProps, {
|
99
|
-
theme:
|
99
|
+
theme: _github["default"],
|
100
100
|
code: (children === null || children === void 0 ? void 0 : (0, _trim["default"])(children).call(children)) || '',
|
101
101
|
language: language
|
102
102
|
}), function (_ref) {
|
@@ -152,8 +152,18 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
152
152
|
}, content);
|
153
153
|
});
|
154
154
|
CodeView.propTypes = {
|
155
|
+
/** Whether the CodeView displays line numbers. */
|
155
156
|
hasLineNumbers: _propTypes["default"].bool,
|
157
|
+
|
158
|
+
/** Whether the CodeView hides the copy button. */
|
156
159
|
hasNoCopyButton: _propTypes["default"].bool,
|
160
|
+
|
161
|
+
/**
|
162
|
+
* Which programming language the CodeView should use for highlighting. A list of default languages is listed [here](https://github.com/FormidableLabs/prism-react-renderer/blob/master/src/vendor/prism/includeLangs.js).
|
163
|
+
*
|
164
|
+
*
|
165
|
+
* Additional languages may be added, see [this guidance](https://github.com/FormidableLabs/prism-react-renderer#faq) for more information.
|
166
|
+
*/
|
157
167
|
language: _propTypes["default"].string
|
158
168
|
};
|
159
169
|
CodeView.defaultProps = {
|
@@ -81,7 +81,7 @@ WithLineNumbers.story = {
|
|
81
81
|
|
82
82
|
var WithCustomSize = function WithCustomSize() {
|
83
83
|
return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_CodeView["default"], {
|
84
|
-
language: "
|
84
|
+
language: "jsx",
|
85
85
|
sx: {
|
86
86
|
width: '100%',
|
87
87
|
height: 300
|
@@ -166,9 +166,7 @@ PopoverMenu.propTypes = {
|
|
166
166
|
*/
|
167
167
|
isNotFlippable: _propTypes["default"].bool,
|
168
168
|
|
169
|
-
/**
|
170
|
-
* Allows to add an arrow to popover container
|
171
|
-
*/
|
169
|
+
/** Whether the PopoverMenu hides the arrow. */
|
172
170
|
hasNoArrow: _propTypes["default"].bool,
|
173
171
|
|
174
172
|
/**
|
@@ -22,13 +22,12 @@ import { useFocusRing } from '@react-aria/focus';
|
|
22
22
|
import { useHover } from '@react-aria/interactions';
|
23
23
|
import { mergeProps } from '@react-aria/utils';
|
24
24
|
import Highlight, { defaultProps } from 'prism-react-renderer';
|
25
|
+
import github from 'prism-react-renderer/themes/github';
|
25
26
|
import { useStatusClasses } from '../../hooks';
|
26
27
|
import { Box, CopyText } from '../..';
|
27
28
|
/**
|
28
|
-
*
|
29
|
-
* Built on top of
|
30
|
-
*
|
31
|
-
* A list of all supported languages that can be passed to `language` prop is [here](https://github.com/FormidableLabs/prism-react-renderer/blob/master/src/vendor/prism/includeLangs.js).
|
29
|
+
* Component for code syntax highlighting.
|
30
|
+
* Built on top of [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer).
|
32
31
|
*/
|
33
32
|
|
34
33
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -62,7 +61,7 @@ var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
62
61
|
};
|
63
62
|
|
64
63
|
var content = ___EmotionJSX(Highlight, _extends({}, defaultProps, {
|
65
|
-
theme:
|
64
|
+
theme: github,
|
66
65
|
code: (children === null || children === void 0 ? void 0 : _trimInstanceProperty(children).call(children)) || '',
|
67
66
|
language: language
|
68
67
|
}), function (_ref) {
|
@@ -118,8 +117,18 @@ var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
118
117
|
}, content);
|
119
118
|
});
|
120
119
|
CodeView.propTypes = {
|
120
|
+
/** Whether the CodeView displays line numbers. */
|
121
121
|
hasLineNumbers: PropTypes.bool,
|
122
|
+
|
123
|
+
/** Whether the CodeView hides the copy button. */
|
122
124
|
hasNoCopyButton: PropTypes.bool,
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Which programming language the CodeView should use for highlighting. A list of default languages is listed [here](https://github.com/FormidableLabs/prism-react-renderer/blob/master/src/vendor/prism/includeLangs.js).
|
128
|
+
*
|
129
|
+
*
|
130
|
+
* Additional languages may be added, see [this guidance](https://github.com/FormidableLabs/prism-react-renderer#faq) for more information.
|
131
|
+
*/
|
123
132
|
language: PropTypes.string
|
124
133
|
};
|
125
134
|
CodeView.defaultProps = {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pingux/astro",
|
3
|
-
"version": "1.1.0",
|
3
|
+
"version": "1.1.1-alpha.0",
|
4
4
|
"description": "PingUX themeable React component library",
|
5
5
|
"author": "uxdev@pingidentity.com",
|
6
6
|
"license": "Apache-2.0",
|
@@ -126,7 +126,6 @@
|
|
126
126
|
"@styled-system/props": "^5.1.5",
|
127
127
|
"@styled-system/theme-get": "^5.1.2",
|
128
128
|
"@tippyjs/react": "4.2.0",
|
129
|
-
"a11y-syntax-highlighting": "0.2.0",
|
130
129
|
"chroma-js": "^2.1.0",
|
131
130
|
"classnames": "^2.2.6",
|
132
131
|
"emotion-normalize": "^11.0.1",
|