@pingux/astro 2.151.0 → 2.151.1-alpha.1

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.
Files changed (29) hide show
  1. package/lib/cjs/components/CodeView/CodeView.js +14 -10
  2. package/lib/cjs/components/CodeView/CodeView.stories.d.ts +1 -0
  3. package/lib/cjs/components/CodeView/CodeView.stories.js +17 -1
  4. package/lib/cjs/components/CodeView/CodeView.styles.d.ts +79 -77
  5. package/lib/cjs/components/CodeView/CodeView.styles.js +5 -3
  6. package/lib/cjs/components/CopyText/CopyButton.js +9 -3
  7. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/colors.d.ts +10 -0
  8. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/colors.js +13 -1
  9. package/lib/cjs/styles/themes/next-gen/codeView/codeView.d.ts +252 -92
  10. package/lib/cjs/styles/themes/next-gen/codeView/codeView.js +104 -15
  11. package/lib/cjs/styles/themes/next-gen/colors/colors.d.ts +5 -0
  12. package/lib/cjs/styles/themes/next-gen/colors/colors.js +5 -0
  13. package/lib/cjs/styles/themes/next-gen/convertedComponentList.d.ts +1 -0
  14. package/lib/cjs/styles/themes/next-gen/convertedComponentList.js +1 -0
  15. package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +496 -180
  16. package/lib/cjs/styles/themes/next-gen/tokens/colorTokens.d.ts +1 -0
  17. package/lib/cjs/styles/themes/next-gen/tokens/colorTokens.js +2 -1
  18. package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +13 -4
  19. package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +239 -88
  20. package/lib/components/CodeView/CodeView.js +14 -10
  21. package/lib/components/CodeView/CodeView.stories.js +15 -0
  22. package/lib/components/CodeView/CodeView.styles.js +5 -3
  23. package/lib/components/CopyText/CopyButton.js +9 -3
  24. package/lib/styles/themeOverrides/nextGenDarkMode/colors.js +13 -1
  25. package/lib/styles/themes/next-gen/codeView/codeView.js +104 -15
  26. package/lib/styles/themes/next-gen/colors/colors.js +5 -0
  27. package/lib/styles/themes/next-gen/convertedComponentList.js +1 -0
  28. package/lib/styles/themes/next-gen/tokens/colorTokens.js +2 -1
  29. 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", "textToCopy", "Prism", "stylesProp", "iconButtonProps"];
34
+ var _excluded = ["children", "className", "hasLineNumbers", "hasNoCopyButton", "language", "textToCopy", "Prism", "stylesProp", "iconButtonProps", "variant"];
35
35
  /* istanbul ignore next */
36
36
  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); }
37
37
  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; }
@@ -48,6 +48,8 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
48
48
  customPrism = props.Prism,
49
49
  stylesProp = props.stylesProp,
50
50
  iconButtonProps = props.iconButtonProps,
51
+ _props$variant = props.variant,
52
+ variant = _props$variant === void 0 ? 'default' : _props$variant,
51
53
  others = (0, _objectWithoutProperties2["default"])(props, _excluded);
52
54
  var _useFocusRing = (0, _focus.useFocusRing)(),
53
55
  isFocusVisible = _useFocusRing.isFocusVisible,
@@ -73,7 +75,7 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
73
75
  return tokens.length.toString().length * 12;
74
76
  };
75
77
  var code = (children === null || children === void 0 ? void 0 : (0, _trim["default"])(children).call(children)) || '';
76
- var codeViewTheme = (stylesProp === null || stylesProp === void 0 ? void 0 : stylesProp.theme) || (isOnyx ? _codeView["default"].theme : _CodeView["default"].theme);
78
+ var codeViewTheme = (stylesProp === null || stylesProp === void 0 ? void 0 : stylesProp.theme) || (isOnyx ? _codeView["default"][variant].theme : _CodeView["default"][variant].theme);
77
79
  (0, _react.useEffect)(function () {
78
80
  try {
79
81
  // eslint-disable-next-line import/no-dynamic-require, global-require
@@ -106,7 +108,7 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
106
108
  key: i
107
109
  })), hasLineNumbers && (0, _react2.jsx)(_.Box, {
108
110
  as: "span",
109
- variant: "codeView.lineNo",
111
+ variant: "codeView.".concat(variant, ".lineNo"),
110
112
  sx: {
111
113
  minWidth: getLineNoWidth(tokens)
112
114
  }
@@ -123,7 +125,7 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
123
125
  if (isOnyx) {
124
126
  return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
125
127
  ref: ref,
126
- variant: "codeView.wrapper",
128
+ variant: "codeView.".concat(variant, ".wrapper"),
127
129
  className: classNames
128
130
  }, (0, _utils.mergeProps)(focusProps, hoverProps, others), {
129
131
  role: "none"
@@ -131,9 +133,9 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
131
133
  isRow: true,
132
134
  justifyContent: "space-between",
133
135
  alignItems: "center",
134
- variant: "codeView.header"
136
+ variant: "codeView.".concat(variant, ".header")
135
137
  }, (0, _react2.jsx)(_.Text, {
136
- color: "gray-300",
138
+ variant: "codeView.".concat(variant, ".header.color"),
137
139
  mb: "0",
138
140
  mr: "sm",
139
141
  py: "sm"
@@ -141,13 +143,15 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
141
143
  ref: ref,
142
144
  mode: "rightText",
143
145
  textToCopy: textToCopy || children,
144
- iconButtonProps: iconButtonProps
145
- }, "Copy")), content);
146
+ iconButtonProps: _objectSpread(_objectSpread({}, iconButtonProps), {}, {
147
+ variant: variant
148
+ })
149
+ })), content);
146
150
  }
147
151
  if (hasNoCopyButton) {
148
152
  return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({
149
153
  ref: ref,
150
- variant: "codeView.wrapper",
154
+ variant: "codeView.".concat(variant, ".wrapper"),
151
155
  className: classNames
152
156
  }, (0, _utils.mergeProps)(focusProps, hoverProps, others), {
153
157
  role: "none"
@@ -162,7 +166,7 @@ var CodeView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
162
166
  },
163
167
  wrapperProps: _objectSpread({
164
168
  className: classNames,
165
- variant: 'codeView.wrapper'
169
+ variant: "codeView.".concat(variant, ".wrapper")
166
170
  }, others),
167
171
  iconButtonProps: iconButtonProps
168
172
  }, content);
@@ -8,3 +8,4 @@ export declare const WithCustomSize: StoryFn;
8
8
  export declare const WithAdditionalLanguage: StoryFn;
9
9
  export declare const WithChangedCopiedValue: StoryFn<CodeViewProps>;
10
10
  export declare const WithCustomLanguage: StoryFn;
11
+ export declare const Light: StoryFn<CodeViewProps>;
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
5
5
  _Object$defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports["default"] = exports.WithLineNumbers = exports.WithCustomSize = exports.WithCustomLanguage = exports.WithChangedCopiedValue = exports.WithAdditionalLanguage = exports.Default = void 0;
8
+ exports["default"] = exports.WithLineNumbers = exports.WithCustomSize = exports.WithCustomLanguage = exports.WithChangedCopiedValue = exports.WithAdditionalLanguage = exports.Light = exports.Default = void 0;
9
9
  var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
11
11
  var _react = _interopRequireDefault(require("react"));
@@ -183,4 +183,20 @@ WithCustomLanguage.parameters = {
183
183
  }]
184
184
  }
185
185
  }
186
+ };
187
+ var Light = function Light(args) {
188
+ return (0, _react2.jsx)(_index.CodeView, (0, _extends2["default"])({
189
+ variant: "light"
190
+ }, args));
191
+ };
192
+ exports.Light = Light;
193
+ Light.parameters = {
194
+ a11y: {
195
+ config: {
196
+ rules: [{
197
+ id: 'color-contrast',
198
+ enabled: false
199
+ }]
200
+ }
201
+ }
186
202
  };
@@ -1,96 +1,98 @@
1
1
  declare const _default: {
2
- theme: {
3
- plain: {
4
- color: string;
5
- background: string;
6
- lineHeight: number;
7
- tabSize: number;
8
- fontFamily: string;
9
- };
10
- styles: ({
11
- types: string[];
12
- style: {
13
- color: string;
14
- fontStyle?: undefined;
15
- };
16
- } | {
17
- types: string[];
18
- style: {
2
+ default: {
3
+ theme: {
4
+ plain: {
19
5
  color: string;
20
- fontStyle: string;
21
- };
22
- } | {
23
- types: string[];
24
- style: {
25
- fontStyle: string;
26
- color?: undefined;
6
+ background: string;
7
+ lineHeight: number;
8
+ tabSize: number;
9
+ fontFamily: string;
27
10
  };
28
- })[];
29
- };
30
- wrapper: {
31
- bg: string;
32
- border: string;
33
- borderColor: string;
34
- width: number;
35
- height: number;
36
- my: number;
37
- overflow: string;
38
- alignItems: string;
39
- '&.is-focused, &:focus': {
40
- boxShadow: string;
41
- outline: string;
42
- };
43
- pre: {
44
- backgroundColor: string;
45
- m: number;
46
- p: string;
47
- pr: number;
48
- height: string;
49
- width: string;
50
- overflowX: string;
51
- overflowY: string;
52
- fontFamily: string;
53
- fontSize: string;
54
- lineHeight: string;
55
- '& .token-line': {
56
- display: string;
57
- alignItems: string;
58
- '& .token': {
59
- whiteSpace: string;
60
- wordBreak: string;
11
+ styles: ({
12
+ types: string[];
13
+ style: {
14
+ color: string;
15
+ fontStyle?: undefined;
61
16
  };
62
- };
17
+ } | {
18
+ types: string[];
19
+ style: {
20
+ color: string;
21
+ fontStyle: string;
22
+ };
23
+ } | {
24
+ types: string[];
25
+ style: {
26
+ fontStyle: string;
27
+ color?: undefined;
28
+ };
29
+ })[];
63
30
  };
64
- '&.has-no-copy-button': {
65
- pre: {
66
- p: number;
31
+ wrapper: {
32
+ bg: string;
33
+ border: string;
34
+ borderColor: string;
35
+ width: number;
36
+ height: number;
37
+ my: number;
38
+ overflow: string;
39
+ alignItems: string;
40
+ '&.is-focused, &:focus': {
41
+ boxShadow: string;
42
+ outline: string;
67
43
  };
68
- };
69
- '&.has-line-numbers': {
70
44
  pre: {
45
+ backgroundColor: string;
46
+ m: number;
71
47
  p: string;
72
- overflow: string;
73
- '& .token-line:first-of-type *': {
74
- pt: number;
75
- };
48
+ pr: number;
49
+ height: string;
50
+ width: string;
51
+ overflowX: string;
52
+ overflowY: string;
53
+ fontFamily: string;
54
+ fontSize: string;
55
+ lineHeight: string;
76
56
  '& .token-line': {
77
57
  display: string;
58
+ alignItems: string;
78
59
  '& .token': {
79
60
  whiteSpace: string;
61
+ wordBreak: string;
62
+ };
63
+ };
64
+ };
65
+ '&.has-no-copy-button': {
66
+ pre: {
67
+ p: number;
68
+ };
69
+ };
70
+ '&.has-line-numbers': {
71
+ pre: {
72
+ p: string;
73
+ overflow: string;
74
+ '& .token-line:first-of-type *': {
75
+ pt: number;
76
+ };
77
+ '& .token-line': {
78
+ display: string;
79
+ '& .token': {
80
+ whiteSpace: string;
81
+ };
80
82
  };
81
83
  };
82
84
  };
83
85
  };
84
- };
85
- lineNo: {
86
- display: string;
87
- userSelect: string;
88
- px: number;
89
- m: string;
90
- bg: string;
91
- minWidth: number;
92
- color: string;
93
- lineHeight: string;
86
+ lineNo: {
87
+ display: string;
88
+ userSelect: string;
89
+ px: number;
90
+ m: string;
91
+ bg: string;
92
+ minWidth: number;
93
+ color: string;
94
+ lineHeight: string;
95
+ };
94
96
  };
95
97
  };
96
98
  export default _default;
@@ -162,8 +162,10 @@ var lineNo = {
162
162
  lineHeight: '20px'
163
163
  };
164
164
  var _default = {
165
- theme: theme,
166
- wrapper: wrapper,
167
- lineNo: lineNo
165
+ "default": {
166
+ theme: theme,
167
+ wrapper: wrapper,
168
+ lineNo: lineNo
169
+ }
168
170
  };
169
171
  exports["default"] = _default;
@@ -17,18 +17,24 @@ var _hooks = require("../../hooks");
17
17
  var _Icon = _interopRequireDefault(require("../Icon"));
18
18
  var _IconButton = _interopRequireDefault(require("../IconButton"));
19
19
  var _react2 = require("@emotion/react");
20
- var _excluded = ["iconProps"];
20
+ var _excluded = ["iconProps", "variant"];
21
21
  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); }
22
22
  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; }
23
23
  var CopyButton = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
24
+ /* istanbul ignore next */
24
25
  var iconProps = props.iconProps,
26
+ _props$variant = props.variant,
27
+ variant = _props$variant === void 0 ? 'default' : _props$variant,
25
28
  others = (0, _objectWithoutProperties2["default"])(props, _excluded);
26
29
  var _useGetTheme = (0, _hooks.useGetTheme)(),
27
- copyButtonSize = _useGetTheme.copyButtonSize;
30
+ copyButtonSize = _useGetTheme.copyButtonSize,
31
+ themeState = _useGetTheme.themeState;
32
+ /* istanbul ignore next */
33
+ var themeVariant = !themeState.isOnyx ? 'copyButton' : "copyButton.".concat(variant);
28
34
  return (0, _react2.jsx)(_IconButton["default"], (0, _extends2["default"])({
29
35
  ref: ref,
30
36
  "aria-label": "copy to clipboard",
31
- variant: "copyButton"
37
+ variant: themeVariant
32
38
  }, others), (0, _react2.jsx)(_Icon["default"], (0, _extends2["default"])({
33
39
  icon: _ContentCopyIcon["default"],
34
40
  size: copyButtonSize,
@@ -71,6 +71,12 @@ export declare const colors: {
71
71
  message: string;
72
72
  fieldHelper: string;
73
73
  };
74
+ background: {
75
+ base: string;
76
+ secondary: string;
77
+ card: string;
78
+ hover: string;
79
+ };
74
80
  backgroundBase: string;
75
81
  backgroundSecondary: string;
76
82
  backgroundCard: string;
@@ -85,6 +91,10 @@ export declare const colors: {
85
91
  background: string;
86
92
  textColor: string;
87
93
  };
94
+ codeEditor: {
95
+ backgroundColor: string;
96
+ headerColor: string;
97
+ };
88
98
  neutral: {
89
99
  90: string;
90
100
  };
@@ -43,6 +43,16 @@ var badge = {
43
43
  background: _colorTokens.nextGenColors['gray-800'],
44
44
  textColor: _colorTokens.nextGenColors['gray-100']
45
45
  };
46
+ var background = {
47
+ base: _colorTokens.nextGenColors['gray-900'],
48
+ secondary: '#1a1e22',
49
+ card: '#1a1e22',
50
+ hover: hoverDark
51
+ };
52
+ var codeEditor = {
53
+ backgroundColor: background.secondary,
54
+ headerColor: _colorTokens.nextGenColors['gray-900']
55
+ };
46
56
  var twoTone = {
47
57
  bg: {
48
58
  orange: _colorTokens.nextGenColors['orange-500'],
@@ -139,12 +149,14 @@ var colors = _objectSpread(_objectSpread({
139
149
  message: 'white',
140
150
  fieldHelper: _colorTokens.nextGenColors['gray-400']
141
151
  },
152
+ background: background,
142
153
  backgroundBase: backgroundBase,
143
154
  backgroundSecondary: backgroundSecondary,
144
155
  backgroundCard: backgroundCard,
145
156
  backgroundSuggestion: backgroundSuggestion,
146
157
  backgroundHover: backgroundHover,
147
158
  font: font,
148
- badge: badge
159
+ badge: badge,
160
+ codeEditor: codeEditor
149
161
  });
150
162
  exports.colors = colors;