@luminati-io/uikit 1.5.0 → 1.6.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.
@@ -7,6 +7,15 @@
7
7
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
8
8
  */
9
9
 
10
+ /**
11
+ * Prism: Lightweight, robust, elegant syntax highlighting
12
+ *
13
+ * @license MIT <https://opensource.org/licenses/MIT>
14
+ * @author Lea Verou <https://lea.verou.me>
15
+ * @namespace
16
+ * @public
17
+ */
18
+
10
19
  /** @license React v16.13.1
11
20
  * react-is.production.min.js
12
21
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luminati-io/uikit",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "author": "Bright Data (http://brightdata.com)",
5
5
  "license": "ISC",
6
6
  "description": "brightdata's design system",
@@ -13,7 +13,9 @@
13
13
  ],
14
14
  "dependencies": {
15
15
  "@popperjs/core": "^2.11.6",
16
+ "babel-plugin-prismjs": "^2.1.0",
16
17
  "lodash": "^4.17.21",
18
+ "prismjs": "^1.29.0",
17
19
  "prop-types": "^15.8.1",
18
20
  "react-popper": "^2.3.0",
19
21
  "styled-components": "^5.3.6"
@@ -8,7 +8,6 @@ import {
8
8
  iconNames,
9
9
  toPixel,
10
10
  toButtonSize,
11
- getCommonProps,
12
11
  getButtonColors,
13
12
  getIconProps,
14
13
  } from '../utils';
@@ -26,12 +25,13 @@ const Button = React.forwardRef((props, ref)=>{
26
25
  disabled,
27
26
  loading,
28
27
  loadingText,
28
+ ...rest
29
29
  } = props;
30
30
  const {isLeft, isRight, ...iconProps} = getIconProps('Button', props);
31
31
  return <StyledButton
32
32
  ref={ref}
33
33
  type="button"
34
- {...getCommonProps(props)}
34
+ {...rest}
35
35
  variant={variant}
36
36
  size={size}
37
37
  disabled={loading||disabled}
@@ -0,0 +1,127 @@
1
+ // LICENSE_CODE ZON
2
+ 'use strict'; /*jslint react:true*/
3
+
4
+ import React, {useEffect} from 'react';
5
+ import styled from 'styled-components';
6
+ import Prism from 'prismjs';
7
+ import PT from 'prop-types';
8
+ import {theme} from '../utils';
9
+
10
+ const Code = props=>{
11
+ const {text, lang} = props;
12
+ useEffect(()=>{
13
+ Prism.highlightAll();
14
+ }, [text, lang]);
15
+ return <CodeWrapper>
16
+ <code className={`language-${lang} content`}>{text}</code>
17
+ </CodeWrapper>;
18
+ };
19
+ Code.displayName = 'Code';
20
+ Code.propTypes = {
21
+ text: PT.string,
22
+ // XXX davidg: config langs
23
+ lang: PT.string,
24
+ };
25
+
26
+ export default Code;
27
+
28
+ const CodeWrapper = styled.pre`
29
+ &&& {
30
+ padding: 0;
31
+ font-family: ${theme.font_family.mono};
32
+ margin: 0;
33
+ border: none;
34
+ background-color: transparent;
35
+ width: 100%;
36
+ white-space: pre-wrap;
37
+ line-height: 1.5;
38
+ tab-size: 4;
39
+ text-align: left;
40
+ word-spacing: normal;
41
+ word-break: normal;
42
+ word-wrap: normal;
43
+ hyphens: none;
44
+ max-height: none;
45
+ code.content {
46
+ all: inherit;
47
+ color: ${theme.color.gray_8};
48
+ margin: 0;
49
+ padding: 0;
50
+ border: none;
51
+ background-color: transparent;
52
+ text-shadow: none;
53
+ }
54
+ ${'' /* prism selectors below */}
55
+ .token.comment,
56
+ .token.prolog,
57
+ .token.doctype,
58
+ .token.cdata {
59
+ color: slategray;
60
+ }
61
+
62
+ .token.punctuation {
63
+ color: #999;
64
+ }
65
+
66
+ .token.namespace {
67
+ opacity: .7;
68
+ }
69
+
70
+ .token.property,
71
+ .token.tag,
72
+ .token.boolean,
73
+ .token.constant,
74
+ .token.symbol,
75
+ .token.deleted {
76
+ color: #f8c555;
77
+ }
78
+
79
+ .token.selector,
80
+ .token.attr-name,
81
+ .token.string,
82
+ .token.char,
83
+ .token.builtin,
84
+ .token.inserted {
85
+ color: #7ec699;
86
+ }
87
+
88
+ .token.operator,
89
+ .token.entity,
90
+ .token.url,
91
+ .language-css .token.string,
92
+ .style .token.string {
93
+ color: #67cdcc;
94
+ }
95
+
96
+ .token.atrule,
97
+ .token.attr-value,
98
+ .token.keyword {
99
+ color: #cc99cd;
100
+ }
101
+
102
+ .token.function,
103
+ .token.number,
104
+ .token.class-name {
105
+ color: #f08d49;
106
+ }
107
+
108
+ .token.regex,
109
+ .token.important,
110
+ .token.variable {
111
+ color: #e90;
112
+ }
113
+
114
+ .token.important,
115
+ .token.bold {
116
+ font-weight: bold;
117
+ }
118
+ .token.italic {
119
+ font-style: italic;
120
+ }
121
+
122
+ .token.entity {
123
+ cursor: help;
124
+ }
125
+ }
126
+ `;
127
+ CodeWrapper.displayName = 'CodeWrapper';
@@ -0,0 +1,8 @@
1
+ // LICENSE_CODE ZON
2
+ 'use strict'; /*jslint react:true*/
3
+
4
+ import Code from './code';
5
+
6
+ export {Code};
7
+
8
+ export default {Code};
package/src/index.js CHANGED
@@ -10,6 +10,7 @@ import {Progress, ProgressBar} from './progress';
10
10
  import Icon from './icon';
11
11
  import IconButton from './icon_button';
12
12
  import Tooltip, {withTooltip} from './tooltip';
13
+ import {Code} from './code';
13
14
 
14
15
  export {
15
16
  Layout,
@@ -24,6 +25,7 @@ export {
24
25
  IconButton,
25
26
  Tooltip,
26
27
  withTooltip,
28
+ Code,
27
29
  };
28
30
 
29
31
  const UIKit = {
@@ -39,6 +41,7 @@ const UIKit = {
39
41
  IconButton,
40
42
  Tooltip,
41
43
  withTooltip,
44
+ Code,
42
45
  };
43
46
 
44
47
  export default UIKit;
package/src/link/link.js CHANGED
@@ -4,26 +4,19 @@
4
4
  import React from 'react';
5
5
  import styled from 'styled-components';
6
6
  import PT from 'prop-types';
7
- import {
8
- theme,
9
- iconNames,
10
- toPixel,
11
- getCommonProps,
12
- getIconProps,
13
- getLinkProps,
14
- } from '../utils';
7
+ import {theme, iconNames, toPixel, getIconProps, getLinkProps} from '../utils';
15
8
  import typography from '../Typography';
16
9
  import Icon from '../icon';
17
10
 
18
11
  const {Typography, Label} = typography;
19
12
 
20
13
  const Link = React.forwardRef((props, ref)=>{
21
- const {text, variant, size, icon} = props;
14
+ const {text, variant, size, icon, ...rest} = props;
22
15
  const {isLeft, isRight, ...iconProps} = getIconProps('Link', props);
23
16
  const labelVariant = {lg: 'lg', sm: 'xs'}[size]||'base';
24
17
  return <StyledLink
25
18
  ref={ref}
26
- {...getCommonProps(props)}
19
+ {...rest}
27
20
  {...getLinkProps(props)}
28
21
  variant={variant}
29
22
  size={size}