@pingux/astro 2.151.0 → 2.151.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.
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
@@ -122,6 +122,7 @@ export declare const nextGenColors: {
122
122
  light: string;
123
123
  link: string;
124
124
  label: string;
125
+ reverse: string;
125
126
  };
126
127
  active: string;
127
128
  active_hover: string;
@@ -128,7 +128,8 @@ var nextGenColors = {
128
128
  'base': '#23282e',
129
129
  'light': '#5e6d82',
130
130
  'link': '#1a73e8',
131
- 'label': '#5e6d82'
131
+ 'label': '#5e6d82',
132
+ 'reverse': '#ffffff'
132
133
  },
133
134
  'active': '#1a73e8',
134
135
  'active_hover': '#1462C8',
@@ -1061,11 +1061,20 @@ declare const buttons: {
1061
1061
  boxShadow: string;
1062
1062
  };
1063
1063
  copyButton: {
1064
- mx: string;
1065
- path: {
1066
- fill: string;
1064
+ default: {
1065
+ mx: string;
1066
+ path: {
1067
+ fill: string;
1068
+ };
1069
+ border: string;
1070
+ };
1071
+ light: {
1072
+ mx: string;
1073
+ path: {
1074
+ fill: string;
1075
+ };
1076
+ border: string;
1067
1077
  };
1068
- border: string;
1069
1078
  };
1070
1079
  deleteAttachment: {
1071
1080
  backgroundColor: string;
@@ -251,116 +251,267 @@ declare const _default: {
251
251
  };
252
252
  };
253
253
  codeView: {
254
- theme: {
255
- plain: {
256
- color: string;
257
- backgroundColor: string;
258
- };
259
- styles: ({
260
- types: string[];
261
- style: {
254
+ default: {
255
+ theme: {
256
+ plain: {
262
257
  color: string;
263
- background?: undefined;
264
- fontWeight?: undefined;
265
- cursor?: undefined;
258
+ backgroundColor: string;
266
259
  };
267
- } | {
268
- types: string[];
269
- style: {
270
- color: string;
271
- background: string;
272
- fontWeight?: undefined;
273
- cursor?: undefined;
260
+ styles: ({
261
+ types: string[];
262
+ style: {
263
+ color: string;
264
+ background?: undefined;
265
+ fontWeight?: undefined;
266
+ cursor?: undefined;
267
+ };
268
+ } | {
269
+ types: string[];
270
+ style: {
271
+ color: string;
272
+ background: string;
273
+ fontWeight?: undefined;
274
+ cursor?: undefined;
275
+ };
276
+ } | {
277
+ types: string[];
278
+ style: {
279
+ fontWeight: string;
280
+ color?: undefined;
281
+ background?: undefined;
282
+ cursor?: undefined;
283
+ };
284
+ } | {
285
+ types: string[];
286
+ style: {
287
+ cursor: string;
288
+ color?: undefined;
289
+ background?: undefined;
290
+ fontWeight?: undefined;
291
+ };
292
+ })[];
293
+ };
294
+ wrapper: {
295
+ backgroundColor: string;
296
+ border: string;
297
+ borderColor: string;
298
+ borderRadius: string;
299
+ width: number;
300
+ height: number;
301
+ my: string;
302
+ overflow: string;
303
+ alignItems: string;
304
+ '&.is-focused, &:focus': {
305
+ boxShadow: string;
306
+ outline: string;
274
307
  };
275
- } | {
276
- types: string[];
277
- style: {
278
- fontWeight: string;
279
- color?: undefined;
280
- background?: undefined;
281
- cursor?: undefined;
308
+ pre: {
309
+ backgroundColor: string;
310
+ padding: string;
311
+ height: string;
312
+ width: string;
313
+ overflowX: string;
314
+ overflowY: string;
315
+ fontSize: string;
316
+ '& .token-line': {
317
+ display: string;
318
+ alignItems: string;
319
+ '& .token': {
320
+ whiteSpace: string;
321
+ wordBreak: string;
322
+ };
323
+ };
324
+ fontFamily: string;
325
+ lineHeight: string;
282
326
  };
283
- } | {
284
- types: string[];
285
- style: {
286
- cursor: string;
287
- color?: undefined;
288
- background?: undefined;
289
- fontWeight?: undefined;
327
+ '&.has-no-copy-button': {
328
+ pre: {
329
+ p: string;
330
+ };
331
+ };
332
+ '&.has-line-numbers': {
333
+ pre: {
334
+ p: string;
335
+ overflow: string;
336
+ '& .token-line:first-of-type *': {
337
+ pt: string;
338
+ };
339
+ '& .token-line': {
340
+ display: string;
341
+ '& .token': {
342
+ whiteSpace: string;
343
+ };
344
+ };
345
+ };
290
346
  };
291
- })[];
292
- };
293
- wrapper: {
294
- backgroundColor: string;
295
- border: string;
296
- borderColor: string;
297
- borderRadius: string;
298
- width: number;
299
- height: number;
300
- my: string;
301
- overflow: string;
302
- alignItems: string;
303
- '&.is-focused, &:focus': {
304
- boxShadow: string;
305
- outline: string;
306
347
  };
307
- pre: {
348
+ lineNo: {
349
+ display: string;
350
+ userSelect: string;
351
+ px: string;
352
+ m: string;
353
+ bg: string;
354
+ minWidth: number;
355
+ color: string;
356
+ lineHeight: string;
308
357
  backgroundColor: string;
309
- padding: string;
310
- height: string;
358
+ };
359
+ header: {
360
+ backgroundColor: string;
361
+ color: string;
362
+ px: string;
311
363
  width: string;
312
- overflowX: string;
313
- overflowY: string;
314
- fontSize: string;
315
- '& .token-line': {
316
- display: string;
317
- alignItems: string;
318
- '& .token': {
319
- whiteSpace: string;
320
- wordBreak: string;
364
+ borderBottom: string;
365
+ borderBottomColor: string;
366
+ lineHeight: string;
367
+ };
368
+ copyButton: {
369
+ default: {
370
+ mx: string;
371
+ path: {
372
+ fill: string;
321
373
  };
374
+ border: string;
375
+ };
376
+ light: {
377
+ mx: string;
378
+ path: {
379
+ fill: string;
380
+ };
381
+ border: string;
322
382
  };
323
- fontFamily: string;
324
- lineHeight: string;
325
383
  };
326
- '&.has-no-copy-button': {
327
- pre: {
328
- p: string;
384
+ };
385
+ light: {
386
+ theme: {
387
+ styles: ({
388
+ types: string[];
389
+ style: {
390
+ color: string;
391
+ background?: undefined;
392
+ fontWeight?: undefined;
393
+ cursor?: undefined;
394
+ };
395
+ } | {
396
+ types: string[];
397
+ style: {
398
+ color: string;
399
+ background: string;
400
+ fontWeight?: undefined;
401
+ cursor?: undefined;
402
+ };
403
+ } | {
404
+ types: string[];
405
+ style: {
406
+ fontWeight: string;
407
+ color?: undefined;
408
+ background?: undefined;
409
+ cursor?: undefined;
410
+ };
411
+ } | {
412
+ types: string[];
413
+ style: {
414
+ cursor: string;
415
+ color?: undefined;
416
+ background?: undefined;
417
+ fontWeight?: undefined;
418
+ };
419
+ })[];
420
+ plain: {
421
+ color: string;
422
+ backgroundColor: string;
329
423
  };
330
424
  };
331
- '&.has-line-numbers': {
425
+ wrapper: {
426
+ backgroundColor: string;
427
+ borderColor: string;
428
+ border: string;
429
+ borderRadius: string;
430
+ width: number;
431
+ height: number;
432
+ my: string;
433
+ overflow: string;
434
+ alignItems: string;
435
+ '&.is-focused, &:focus': {
436
+ boxShadow: string;
437
+ outline: string;
438
+ };
332
439
  pre: {
333
- p: string;
334
- overflow: string;
335
- '& .token-line:first-of-type *': {
336
- pt: string;
337
- };
440
+ backgroundColor: string;
441
+ padding: string;
442
+ height: string;
443
+ width: string;
444
+ overflowX: string;
445
+ overflowY: string;
446
+ fontSize: string;
338
447
  '& .token-line': {
339
448
  display: string;
449
+ alignItems: string;
340
450
  '& .token': {
341
451
  whiteSpace: string;
452
+ wordBreak: string;
453
+ };
454
+ };
455
+ fontFamily: string;
456
+ lineHeight: string;
457
+ };
458
+ '&.has-no-copy-button': {
459
+ pre: {
460
+ p: string;
461
+ };
462
+ };
463
+ '&.has-line-numbers': {
464
+ pre: {
465
+ p: string;
466
+ overflow: string;
467
+ '& .token-line:first-of-type *': {
468
+ pt: string;
469
+ };
470
+ '& .token-line': {
471
+ display: string;
472
+ '& .token': {
473
+ whiteSpace: string;
474
+ };
342
475
  };
343
476
  };
344
477
  };
345
478
  };
346
- };
347
- lineNo: {
348
- display: string;
349
- userSelect: string;
350
- px: string;
351
- m: string;
352
- bg: string;
353
- minWidth: number;
354
- color: string;
355
- lineHeight: string;
356
- };
357
- header: {
358
- color: string;
359
- px: string;
360
- width: string;
361
- border: string;
362
- borderColor: string;
363
- lineHeight: string;
479
+ header: {
480
+ backgroundColor: string;
481
+ borderBottomColor: string;
482
+ color: string;
483
+ px: string;
484
+ width: string;
485
+ borderBottom: string;
486
+ lineHeight: string;
487
+ };
488
+ lineNo: {
489
+ display: string;
490
+ userSelect: string;
491
+ px: string;
492
+ m: string;
493
+ bg: string;
494
+ minWidth: number;
495
+ color: string;
496
+ lineHeight: string;
497
+ backgroundColor: string;
498
+ };
499
+ copyButton: {
500
+ default: {
501
+ mx: string;
502
+ path: {
503
+ fill: string;
504
+ };
505
+ border: string;
506
+ };
507
+ light: {
508
+ mx: string;
509
+ path: {
510
+ fill: string;
511
+ };
512
+ border: string;
513
+ };
514
+ };
364
515
  };
365
516
  };
366
517
  dataTable: {
@@ -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", "textToCopy", "Prism", "stylesProp", "iconButtonProps"];
4
+ var _excluded = ["children", "className", "hasLineNumbers", "hasNoCopyButton", "language", "textToCopy", "Prism", "stylesProp", "iconButtonProps", "variant"];
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";
@@ -38,6 +38,8 @@ var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
38
38
  customPrism = props.Prism,
39
39
  stylesProp = props.stylesProp,
40
40
  iconButtonProps = props.iconButtonProps,
41
+ _props$variant = props.variant,
42
+ variant = _props$variant === void 0 ? 'default' : _props$variant,
41
43
  others = _objectWithoutProperties(props, _excluded);
42
44
  var _useFocusRing = useFocusRing(),
43
45
  isFocusVisible = _useFocusRing.isFocusVisible,
@@ -63,7 +65,7 @@ var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
63
65
  return tokens.length.toString().length * 12;
64
66
  };
65
67
  var code = (children === null || children === void 0 ? void 0 : _trimInstanceProperty(children).call(children)) || '';
66
- var codeViewTheme = (stylesProp === null || stylesProp === void 0 ? void 0 : stylesProp.theme) || (isOnyx ? codeViewStyle.theme : styles.theme);
68
+ var codeViewTheme = (stylesProp === null || stylesProp === void 0 ? void 0 : stylesProp.theme) || (isOnyx ? codeViewStyle[variant].theme : styles[variant].theme);
67
69
  useEffect(function () {
68
70
  try {
69
71
  // eslint-disable-next-line import/no-dynamic-require, global-require
@@ -96,7 +98,7 @@ var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
96
98
  key: i
97
99
  })), hasLineNumbers && ___EmotionJSX(Box, {
98
100
  as: "span",
99
- variant: "codeView.lineNo",
101
+ variant: "codeView.".concat(variant, ".lineNo"),
100
102
  sx: {
101
103
  minWidth: getLineNoWidth(tokens)
102
104
  }
@@ -113,7 +115,7 @@ var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
113
115
  if (isOnyx) {
114
116
  return ___EmotionJSX(Box, _extends({
115
117
  ref: ref,
116
- variant: "codeView.wrapper",
118
+ variant: "codeView.".concat(variant, ".wrapper"),
117
119
  className: classNames
118
120
  }, mergeProps(focusProps, hoverProps, others), {
119
121
  role: "none"
@@ -121,9 +123,9 @@ var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
121
123
  isRow: true,
122
124
  justifyContent: "space-between",
123
125
  alignItems: "center",
124
- variant: "codeView.header"
126
+ variant: "codeView.".concat(variant, ".header")
125
127
  }, ___EmotionJSX(Text, {
126
- color: "gray-300",
128
+ variant: "codeView.".concat(variant, ".header.color"),
127
129
  mb: "0",
128
130
  mr: "sm",
129
131
  py: "sm"
@@ -131,13 +133,15 @@ var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
131
133
  ref: ref,
132
134
  mode: "rightText",
133
135
  textToCopy: textToCopy || children,
134
- iconButtonProps: iconButtonProps
135
- }, "Copy")), content);
136
+ iconButtonProps: _objectSpread(_objectSpread({}, iconButtonProps), {}, {
137
+ variant: variant
138
+ })
139
+ })), content);
136
140
  }
137
141
  if (hasNoCopyButton) {
138
142
  return ___EmotionJSX(Box, _extends({
139
143
  ref: ref,
140
- variant: "codeView.wrapper",
144
+ variant: "codeView.".concat(variant, ".wrapper"),
141
145
  className: classNames
142
146
  }, mergeProps(focusProps, hoverProps, others), {
143
147
  role: "none"
@@ -152,7 +156,7 @@ var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
152
156
  },
153
157
  wrapperProps: _objectSpread({
154
158
  className: classNames,
155
- variant: 'codeView.wrapper'
159
+ variant: "codeView.".concat(variant, ".wrapper")
156
160
  }, others),
157
161
  iconButtonProps: iconButtonProps
158
162
  }, content);
@@ -168,4 +168,19 @@ WithCustomLanguage.parameters = {
168
168
  }]
169
169
  }
170
170
  }
171
+ };
172
+ export var Light = function Light(args) {
173
+ return ___EmotionJSX(CodeView, _extends({
174
+ variant: "light"
175
+ }, args));
176
+ };
177
+ Light.parameters = {
178
+ a11y: {
179
+ config: {
180
+ rules: [{
181
+ id: 'color-contrast',
182
+ enabled: false
183
+ }]
184
+ }
185
+ }
171
186
  };
@@ -155,7 +155,9 @@ var lineNo = {
155
155
  lineHeight: '20px'
156
156
  };
157
157
  export default {
158
- theme: theme,
159
- wrapper: wrapper,
160
- lineNo: lineNo
158
+ "default": {
159
+ theme: theme,
160
+ wrapper: wrapper,
161
+ lineNo: lineNo
162
+ }
161
163
  };
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["iconProps"];
3
+ var _excluded = ["iconProps", "variant"];
4
4
  import React, { forwardRef } from 'react';
5
5
  import ContentCopy from '@pingux/mdi-react/ContentCopyIcon';
6
6
  import { useGetTheme } from '../../hooks';
@@ -8,14 +8,20 @@ import Icon from '../Icon';
8
8
  import IconButton from '../IconButton';
9
9
  import { jsx as ___EmotionJSX } from "@emotion/react";
10
10
  var CopyButton = /*#__PURE__*/forwardRef(function (props, ref) {
11
+ /* istanbul ignore next */
11
12
  var iconProps = props.iconProps,
13
+ _props$variant = props.variant,
14
+ variant = _props$variant === void 0 ? 'default' : _props$variant,
12
15
  others = _objectWithoutProperties(props, _excluded);
13
16
  var _useGetTheme = useGetTheme(),
14
- copyButtonSize = _useGetTheme.copyButtonSize;
17
+ copyButtonSize = _useGetTheme.copyButtonSize,
18
+ themeState = _useGetTheme.themeState;
19
+ /* istanbul ignore next */
20
+ var themeVariant = !themeState.isOnyx ? 'copyButton' : "copyButton.".concat(variant);
15
21
  return ___EmotionJSX(IconButton, _extends({
16
22
  ref: ref,
17
23
  "aria-label": "copy to clipboard",
18
- variant: "copyButton"
24
+ variant: themeVariant
19
25
  }, others), ___EmotionJSX(Icon, _extends({
20
26
  icon: ContentCopy,
21
27
  size: copyButtonSize,
@@ -35,6 +35,16 @@ var badge = {
35
35
  background: nextGenColors['gray-800'],
36
36
  textColor: nextGenColors['gray-100']
37
37
  };
38
+ var background = {
39
+ base: nextGenColors['gray-900'],
40
+ secondary: '#1a1e22',
41
+ card: '#1a1e22',
42
+ hover: hoverDark
43
+ };
44
+ var codeEditor = {
45
+ backgroundColor: background.secondary,
46
+ headerColor: nextGenColors['gray-900']
47
+ };
38
48
  var twoTone = {
39
49
  bg: {
40
50
  orange: nextGenColors['orange-500'],
@@ -131,11 +141,13 @@ export var colors = _objectSpread(_objectSpread({
131
141
  message: 'white',
132
142
  fieldHelper: nextGenColors['gray-400']
133
143
  },
144
+ background: background,
134
145
  backgroundBase: backgroundBase,
135
146
  backgroundSecondary: backgroundSecondary,
136
147
  backgroundCard: backgroundCard,
137
148
  backgroundSuggestion: backgroundSuggestion,
138
149
  backgroundHover: backgroundHover,
139
150
  font: font,
140
- badge: badge
151
+ badge: badge,
152
+ codeEditor: codeEditor
141
153
  });