graphen 1.9.12 → 1.10.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.
- package/dist/css.js +1 -1
- package/dist/scripts.js +1 -1
- package/package.json +26 -18
- package/src/components/Accordion/{index.jsx → index.tsx} +9 -5
- package/src/components/Button/{index.jsx → index.tsx} +7 -3
- package/src/components/Dialog/{index.jsx → index.tsx} +7 -2
- package/src/components/Dropdown/{index.jsx → index.tsx} +14 -10
- package/src/components/Icon/{index.jsx → index.tsx} +2 -3
- package/src/components/Image/{index.jsx → index.tsx} +12 -3
- package/src/components/Input/{index.jsx → index.tsx} +10 -3
- package/src/components/Joystick/{index.jsx → index.tsx} +18 -20
- package/src/components/Link/{index.jsx → index.tsx} +11 -5
- package/src/components/Logo/{index.jsx → index.tsx} +7 -1
- package/src/components/Scroller/{index.jsx → index.tsx} +15 -16
- package/src/components/Tooltip/{index.jsx → index.tsx} +9 -3
- package/src/components/Validation/{index.jsx → index.tsx} +10 -3
- package/src/{example.jsx → example.tsx} +8 -7
- package/src/mixes/_spacing.scss +40 -0
- package/src/variables/constants.js +1 -1
- package/src/variables/integration/colors.spec.js +1 -1
- package/dist/example.js +0 -2
- package/dist/example.js.LICENSE.txt +0 -44
- package/dist/styles.css +0 -1
- /package/src/components/Loader/{index.jsx → index.tsx} +0 -0
- /package/src/{index.js → index.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphen",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"description": "Graphen is a small library, that keeps reusable blocks of UI and helps making application design consistent across multiple projects.",
|
|
5
|
-
"main": "src/index.
|
|
5
|
+
"main": "src/index.ts",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist/**/*",
|
|
8
8
|
"src/**/*",
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"build:dev": "webpack --mode=development --config webpack.dev.config.js",
|
|
14
14
|
"build:prod": "webpack --mode=production --config webpack.prod.config.js",
|
|
15
15
|
"build:example": "webpack --mode=production --config webpack.example.config.js",
|
|
16
|
-
"lint": "eslint --ext .
|
|
17
|
-
"lint:fix": "eslint --fix .",
|
|
16
|
+
"lint": "eslint --config .eslintrc --ext .ts,.tsx ./src",
|
|
17
|
+
"lint:fix": "eslint --fix --config .eslintrc --ext .ts,.tsx ./src",
|
|
18
18
|
"csslint": "stylelint \"./**/*.scss\" --config .stylelintrc",
|
|
19
19
|
"csslint:fix": "stylelint \"./**/*.scss\" --fix --config .stylelintrc",
|
|
20
|
-
"flow": "flow",
|
|
21
20
|
"pretty": "prettier \"./src/**/*.{js,jsx}\" \"./example-server/**/*.{js,jsx}\" --list-different",
|
|
22
21
|
"pretty:fix": "prettier --write \"./src/**/*.{js,jsx}\" \"./example-server/**/*.{js,jsx}\"",
|
|
23
22
|
"cypress:open": "cypress open",
|
|
24
23
|
"cypress:run": "cypress run",
|
|
25
|
-
"example-run": "node ./example-server/index.js"
|
|
24
|
+
"example-run": "node ./example-server/index.js",
|
|
25
|
+
"tsc": "tsc"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"classnames": "^2.2.6",
|
|
@@ -31,27 +31,34 @@
|
|
|
31
31
|
"react-dom": "^18.2.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@babel/core": "^7.
|
|
35
|
-
"@babel/
|
|
36
|
-
"@babel/
|
|
37
|
-
"@babel/
|
|
38
|
-
"@babel/preset-
|
|
34
|
+
"@babel/core": "^7.13.8",
|
|
35
|
+
"@babel/eslint-parser": "^7.13.8",
|
|
36
|
+
"@babel/plugin-proposal-class-properties": "^7.12.13",
|
|
37
|
+
"@babel/plugin-proposal-optional-chaining": "^7.12.16",
|
|
38
|
+
"@babel/preset-env": "^7.12.16",
|
|
39
|
+
"@babel/preset-flow": "^7.12.13",
|
|
40
|
+
"@babel/preset-react": "^7.12.13",
|
|
41
|
+
"@babel/preset-typescript": "^7.13.0",
|
|
42
|
+
"@types/react": "^18.2.0",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^4.15.2",
|
|
44
|
+
"@typescript-eslint/parser": "^4.16.1",
|
|
39
45
|
"babel-eslint": "^10.1.0",
|
|
40
46
|
"babel-loader": "^8.1.0",
|
|
41
47
|
"classnames": "^2.2.6",
|
|
42
48
|
"css-loader": "^3.6.0",
|
|
43
|
-
"cypress": "^
|
|
49
|
+
"cypress": "^13.6.4",
|
|
44
50
|
"eslint": "^7.2.0",
|
|
45
|
-
"eslint-config-airbnb": "^
|
|
51
|
+
"eslint-config-airbnb-typescript": "^12.3.1",
|
|
46
52
|
"eslint-config-codait": "^1.1.1",
|
|
47
53
|
"eslint-config-prettier": "^8.10.0",
|
|
48
|
-
"eslint-
|
|
49
|
-
"eslint-plugin-
|
|
50
|
-
"eslint-plugin-import": "^2.
|
|
54
|
+
"eslint-import-resolver-typescript": "^2.4.0",
|
|
55
|
+
"eslint-plugin-cypress": "^2.11.2",
|
|
56
|
+
"eslint-plugin-import": "^2.22.1",
|
|
51
57
|
"eslint-plugin-jest": "^22.21.0",
|
|
52
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
58
|
+
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
53
59
|
"eslint-plugin-prettier": "^3.3.1",
|
|
54
60
|
"eslint-plugin-react": "^7.22.0",
|
|
61
|
+
"eslint-plugin-react-hooks": "^4.2.0",
|
|
55
62
|
"file-loader": "^5.1.0",
|
|
56
63
|
"flow-bin": "^0.94.0",
|
|
57
64
|
"koa": "^2.13.0",
|
|
@@ -60,7 +67,7 @@
|
|
|
60
67
|
"lodash": "^4.17.20",
|
|
61
68
|
"mini-css-extract-plugin": "^2.7.6",
|
|
62
69
|
"postcss-loader": "^3.0.0",
|
|
63
|
-
"prettier": "^
|
|
70
|
+
"prettier": "^2.2.1",
|
|
64
71
|
"react": "^18.2.0",
|
|
65
72
|
"react-dom": "^18.2.0",
|
|
66
73
|
"sass": "^1.67.0",
|
|
@@ -70,6 +77,7 @@
|
|
|
70
77
|
"stylelint-config-standard": "^18.2.0",
|
|
71
78
|
"terser-webpack-plugin": "^5.3.9",
|
|
72
79
|
"url-loader": "^3.0.0",
|
|
80
|
+
"typescript": "^4.2.0",
|
|
73
81
|
"webpack": "^5.88.2",
|
|
74
82
|
"webpack-cli": "^5.1.4"
|
|
75
83
|
},
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import React from "react";
|
|
3
2
|
import classNames from "classnames";
|
|
4
3
|
|
|
5
4
|
type Props = {
|
|
6
5
|
className?: string,
|
|
7
6
|
title: string,
|
|
8
|
-
children?: React.
|
|
7
|
+
children?: React.ReactNode,
|
|
9
8
|
isCollapsed?: boolean
|
|
10
9
|
};
|
|
11
10
|
|
|
@@ -14,6 +13,12 @@ type State = {
|
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
class Accordion extends React.PureComponent<Props, State> {
|
|
16
|
+
static defaultProps = {
|
|
17
|
+
className: '',
|
|
18
|
+
children: null,
|
|
19
|
+
isCollapsed: true,
|
|
20
|
+
};
|
|
21
|
+
|
|
17
22
|
constructor(props: Props) {
|
|
18
23
|
super(props);
|
|
19
24
|
|
|
@@ -45,10 +50,9 @@ class Accordion extends React.PureComponent<Props, State> {
|
|
|
45
50
|
|
|
46
51
|
return (
|
|
47
52
|
<article className={accordionClasses}>
|
|
48
|
-
{/* eslint-disable
|
|
53
|
+
{/* eslint-disable */}
|
|
49
54
|
<header
|
|
50
55
|
role="button"
|
|
51
|
-
tabIndex="0"
|
|
52
56
|
className="gc-accordion__title"
|
|
53
57
|
onClick={() => {
|
|
54
58
|
this.handleClick();
|
|
@@ -56,7 +60,7 @@ class Accordion extends React.PureComponent<Props, State> {
|
|
|
56
60
|
>
|
|
57
61
|
{indicator} {title}
|
|
58
62
|
</header>
|
|
59
|
-
{/* eslint-enable
|
|
63
|
+
{/* eslint-enable */}
|
|
60
64
|
<div className={contentClasses}>{children}</div>
|
|
61
65
|
</article>
|
|
62
66
|
);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import React from "react";
|
|
3
2
|
import classNames from "classnames";
|
|
4
3
|
|
|
5
4
|
type Props = {
|
|
6
5
|
className?: string,
|
|
7
6
|
children: string,
|
|
8
|
-
onClick?: () => void
|
|
7
|
+
onClick?: () => void,
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
function Button(props: Props) {
|
|
@@ -14,10 +13,15 @@ function Button(props: Props) {
|
|
|
14
13
|
const buttonClasses = classNames(className, "gc-btn");
|
|
15
14
|
|
|
16
15
|
return (
|
|
17
|
-
<button onClick={onClick} className={buttonClasses}>
|
|
16
|
+
<button onClick={onClick} className={buttonClasses} type='button'>
|
|
18
17
|
{children}
|
|
19
18
|
</button>
|
|
20
19
|
);
|
|
21
20
|
}
|
|
22
21
|
|
|
22
|
+
Button.defaultProps = {
|
|
23
|
+
className: '',
|
|
24
|
+
onClick: () => {},
|
|
25
|
+
};
|
|
26
|
+
|
|
23
27
|
export default Button;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import React from "react";
|
|
3
2
|
import classNames from "classnames";
|
|
4
3
|
|
|
5
4
|
type Props = {
|
|
6
5
|
className?: string,
|
|
7
|
-
children?: React
|
|
6
|
+
children?: React.ReactNode,
|
|
8
7
|
};
|
|
9
8
|
|
|
10
9
|
function Dialog(props: Props) {
|
|
@@ -14,4 +13,10 @@ function Dialog(props: Props) {
|
|
|
14
13
|
return <div className={dialogClasses}>{children}</div>;
|
|
15
14
|
}
|
|
16
15
|
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
Dialog.defaultProps = {
|
|
18
|
+
className: '',
|
|
19
|
+
children: null,
|
|
20
|
+
};
|
|
21
|
+
|
|
17
22
|
export default Dialog;
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import React, { useState, useCallback } from "react";
|
|
3
2
|
import * as _ from "lodash";
|
|
4
3
|
import classNames from "classnames";
|
|
5
4
|
|
|
6
5
|
type Props = {
|
|
7
|
-
initValue:
|
|
6
|
+
initValue: Readonly<{ value: string, label: string }>,
|
|
8
7
|
label: string,
|
|
9
|
-
items:
|
|
10
|
-
onChange: string => void
|
|
8
|
+
items: ReadonlyArray<{ value: string, label: string }>,
|
|
9
|
+
onChange: (arg0: string) => void,
|
|
11
10
|
};
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
function Dropdown(props: Props) {
|
|
14
13
|
const { initValue, label, items, onChange } = props;
|
|
15
14
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
16
15
|
const [selectedItem, setSelectedItem] = useState(initValue);
|
|
17
16
|
const expandMenu = useCallback(() => {
|
|
18
|
-
setIsExpanded(isShown => !isShown);
|
|
17
|
+
setIsExpanded((isShown) => !isShown);
|
|
19
18
|
}, [setIsExpanded]);
|
|
20
19
|
const selectItem = useCallback(
|
|
21
|
-
item => {
|
|
20
|
+
(item) => {
|
|
22
21
|
onChange(item.value);
|
|
23
22
|
setIsExpanded(false);
|
|
24
|
-
setSelectedItem(_.find(items, i => i.value === item.value));
|
|
23
|
+
setSelectedItem(_.find(items, (i) => i.value === item.value));
|
|
25
24
|
},
|
|
26
25
|
[setIsExpanded, setSelectedItem, items]
|
|
27
26
|
);
|
|
@@ -33,6 +32,7 @@ export default function Dropdown(props: Props) {
|
|
|
33
32
|
</label>
|
|
34
33
|
<div className="gc-dropdown__menu">
|
|
35
34
|
<button
|
|
35
|
+
type="button"
|
|
36
36
|
className="gc-dropdown__btn"
|
|
37
37
|
data-cy="dropdown-button"
|
|
38
38
|
onClick={expandMenu}
|
|
@@ -43,11 +43,12 @@ export default function Dropdown(props: Props) {
|
|
|
43
43
|
<div className="gc-dropdown__content">
|
|
44
44
|
<ul className="gc-dropdown__list">
|
|
45
45
|
{/* eslint-disable jsx-a11y/no-static-element-interactions */}
|
|
46
|
-
{_.map(items, item => {
|
|
46
|
+
{_.map(items, (item) => {
|
|
47
47
|
const dropdownItemClasses = classNames("gc-dropdown__item", {
|
|
48
|
-
"gc-dropdown__item--first": item === items[0]
|
|
48
|
+
"gc-dropdown__item--first": item === items[0],
|
|
49
49
|
});
|
|
50
50
|
return (
|
|
51
|
+
/* eslint-disable react/button-has-type */
|
|
51
52
|
<li
|
|
52
53
|
data-cy="dropdown-item"
|
|
53
54
|
className={dropdownItemClasses}
|
|
@@ -56,6 +57,7 @@ export default function Dropdown(props: Props) {
|
|
|
56
57
|
>
|
|
57
58
|
<a className="gc-dropdown__link">{item.label}</a>
|
|
58
59
|
</li>
|
|
60
|
+
/* eslint-enable react/button-has-type */
|
|
59
61
|
);
|
|
60
62
|
})}
|
|
61
63
|
{/* eslint-enable jsx-a11y/no-static-element-interactions */}
|
|
@@ -66,3 +68,5 @@ export default function Dropdown(props: Props) {
|
|
|
66
68
|
</div>
|
|
67
69
|
);
|
|
68
70
|
}
|
|
71
|
+
|
|
72
|
+
export default Dropdown;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import _ from "lodash";
|
|
3
2
|
import React from "react";
|
|
4
3
|
import classNames from "classnames";
|
|
5
4
|
|
|
6
5
|
type Props = {
|
|
7
6
|
type: string,
|
|
8
|
-
className: string
|
|
7
|
+
className: string,
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
const Icon = (props: Props) => {
|
|
12
11
|
const { type, className } = props;
|
|
13
12
|
|
|
14
13
|
const classes = classNames("gc-icon", className, {
|
|
15
|
-
[`gc-icon--${type}`]: !_.isEmpty(type)
|
|
14
|
+
[`gc-icon--${type}`]: !_.isEmpty(type),
|
|
16
15
|
});
|
|
17
16
|
|
|
18
17
|
return <span className={classes} />;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import React from "react";
|
|
3
2
|
import classNames from "classnames";
|
|
4
3
|
|
|
@@ -6,10 +5,10 @@ type Props = {
|
|
|
6
5
|
src: string,
|
|
7
6
|
className?: string,
|
|
8
7
|
height?: number,
|
|
9
|
-
width?: number
|
|
8
|
+
width?: number,
|
|
10
9
|
};
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
function Image(props: Props) {
|
|
13
12
|
const { src, height, width, className } = props;
|
|
14
13
|
const classes = classNames("gc-image", className);
|
|
15
14
|
|
|
@@ -24,3 +23,13 @@ export default function Image(props: Props) {
|
|
|
24
23
|
</object>
|
|
25
24
|
);
|
|
26
25
|
}
|
|
26
|
+
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
Image.defaultProps = {
|
|
29
|
+
className: '',
|
|
30
|
+
height: 200,
|
|
31
|
+
width: 200,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
export default Image;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import React from "react";
|
|
3
2
|
import classNames from "classnames";
|
|
4
3
|
|
|
@@ -7,7 +6,7 @@ type Props = {
|
|
|
7
6
|
type?: string,
|
|
8
7
|
label: string,
|
|
9
8
|
validation?: string,
|
|
10
|
-
onChange?:
|
|
9
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>,
|
|
11
10
|
};
|
|
12
11
|
|
|
13
12
|
function Input(props: Props) {
|
|
@@ -15,7 +14,7 @@ function Input(props: Props) {
|
|
|
15
14
|
const inputClasses = classNames(className, "gc-input");
|
|
16
15
|
const fieldClasses = classNames("gc-input__field", {
|
|
17
16
|
"gc-input__field--success": validation === "success",
|
|
18
|
-
"gc-input__field--danger": validation === "danger"
|
|
17
|
+
"gc-input__field--danger": validation === "danger",
|
|
19
18
|
});
|
|
20
19
|
const id = `input-${label}`;
|
|
21
20
|
|
|
@@ -29,4 +28,12 @@ function Input(props: Props) {
|
|
|
29
28
|
);
|
|
30
29
|
}
|
|
31
30
|
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
Input.defaultProps = {
|
|
33
|
+
className: '',
|
|
34
|
+
type: '',
|
|
35
|
+
validation: undefined,
|
|
36
|
+
onChange: () => {},
|
|
37
|
+
};
|
|
38
|
+
|
|
32
39
|
export default Input;
|
|
@@ -1,38 +1,33 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import _ from "lodash";
|
|
3
|
-
import React from
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import ReactDOM from "react-dom";
|
|
5
4
|
|
|
6
5
|
type Props = {
|
|
7
6
|
onPositionChange: (left: number, top: number) => void,
|
|
8
|
-
isEnabled: boolean
|
|
7
|
+
isEnabled: boolean,
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
type State = {
|
|
12
11
|
left: number,
|
|
13
|
-
top: number
|
|
12
|
+
top: number,
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
const JOYSTICK_RADIUS = 50;
|
|
17
16
|
|
|
18
17
|
class Joystick extends React.PureComponent<Props, State> {
|
|
19
|
-
static onDragOver(event:
|
|
18
|
+
static onDragOver(event: React.DragEvent<HTMLDivElement>) {
|
|
20
19
|
event.preventDefault();
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
constructor() {
|
|
28
|
-
super();
|
|
22
|
+
constructor(props: Props) {
|
|
23
|
+
super(props);
|
|
29
24
|
this.state = {
|
|
30
25
|
left: JOYSTICK_RADIUS * 0.5,
|
|
31
|
-
top: JOYSTICK_RADIUS * 0.5
|
|
26
|
+
top: JOYSTICK_RADIUS * 0.5,
|
|
32
27
|
};
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
onMove(event:
|
|
30
|
+
onMove(event: React.DragEvent<HTMLDivElement>) {
|
|
36
31
|
event.preventDefault();
|
|
37
32
|
const { clientX, clientY } = event;
|
|
38
33
|
|
|
@@ -49,7 +44,7 @@ class Joystick extends React.PureComponent<Props, State> {
|
|
|
49
44
|
this.move(mappedX, mappedY);
|
|
50
45
|
}
|
|
51
46
|
|
|
52
|
-
onDragEnd(event:
|
|
47
|
+
onDragEnd(event: React.DragEvent<HTMLDivElement>) {
|
|
53
48
|
event.preventDefault();
|
|
54
49
|
this.move(JOYSTICK_RADIUS * 0.5, JOYSTICK_RADIUS * 0.5);
|
|
55
50
|
}
|
|
@@ -63,7 +58,7 @@ class Joystick extends React.PureComponent<Props, State> {
|
|
|
63
58
|
onPositionChange(left, top);
|
|
64
59
|
this.setState({
|
|
65
60
|
left,
|
|
66
|
-
top
|
|
61
|
+
top,
|
|
67
62
|
});
|
|
68
63
|
}
|
|
69
64
|
|
|
@@ -74,26 +69,29 @@ class Joystick extends React.PureComponent<Props, State> {
|
|
|
74
69
|
const classes = `gc-joystick${isEnabled ? "" : " gc-joystick--inactive"}`;
|
|
75
70
|
|
|
76
71
|
return (
|
|
77
|
-
<div
|
|
72
|
+
<div
|
|
73
|
+
className={classes}
|
|
74
|
+
onDragOver={(event) => Joystick.onDragOver(event)}
|
|
75
|
+
>
|
|
78
76
|
<div
|
|
79
77
|
className="gc-joystick__knob"
|
|
80
78
|
style={{
|
|
81
79
|
left,
|
|
82
|
-
top
|
|
80
|
+
top,
|
|
83
81
|
}}
|
|
84
82
|
/>
|
|
85
83
|
<div
|
|
86
84
|
className="gc-joystick__drag"
|
|
87
85
|
draggable={isEnabled}
|
|
88
|
-
onDrag={(event:
|
|
86
|
+
onDrag={(event: React.DragEvent<HTMLDivElement>) => {
|
|
89
87
|
this.onMove(event);
|
|
90
88
|
}}
|
|
91
|
-
onDragEnd={(event:
|
|
89
|
+
onDragEnd={(event: React.DragEvent<HTMLDivElement>) => {
|
|
92
90
|
this.onDragEnd(event);
|
|
93
91
|
}}
|
|
94
92
|
style={{
|
|
95
93
|
left,
|
|
96
|
-
top
|
|
94
|
+
top,
|
|
97
95
|
}}
|
|
98
96
|
/>
|
|
99
97
|
</div>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import React from "react";
|
|
3
2
|
import classNames from "classnames";
|
|
4
3
|
import * as constants from "src/variables/constants";
|
|
@@ -6,19 +5,19 @@ import * as constants from "src/variables/constants";
|
|
|
6
5
|
type Props = {
|
|
7
6
|
link: string,
|
|
8
7
|
className?: string,
|
|
9
|
-
children?: React.
|
|
10
|
-
skin?: constants.Skin
|
|
8
|
+
children?: React.ReactNode,
|
|
9
|
+
skin?: constants.Skin,
|
|
11
10
|
};
|
|
12
11
|
|
|
13
12
|
function Link({
|
|
14
13
|
link,
|
|
15
14
|
className,
|
|
16
15
|
children,
|
|
17
|
-
skin = constants.SKINS.primary
|
|
16
|
+
skin = constants.SKINS.primary,
|
|
18
17
|
}: Props) {
|
|
19
18
|
const classes = classNames("gc-link", className, {
|
|
20
19
|
"gc-link--primary": skin === constants.SKINS.primary,
|
|
21
|
-
"gc-link--default": skin === constants.SKINS.default
|
|
20
|
+
"gc-link--default": skin === constants.SKINS.default,
|
|
22
21
|
});
|
|
23
22
|
|
|
24
23
|
return (
|
|
@@ -28,4 +27,11 @@ function Link({
|
|
|
28
27
|
);
|
|
29
28
|
}
|
|
30
29
|
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
Link.defaultProps = {
|
|
32
|
+
className: '',
|
|
33
|
+
children: null,
|
|
34
|
+
skin: undefined,
|
|
35
|
+
};
|
|
36
|
+
|
|
31
37
|
export default Link;
|
|
@@ -4,7 +4,7 @@ import classNames from "classnames";
|
|
|
4
4
|
|
|
5
5
|
type Props = {
|
|
6
6
|
className?: string,
|
|
7
|
-
onClick?: () => void
|
|
7
|
+
onClick?: () => void,
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
function Logo(props: Props) {
|
|
@@ -21,4 +21,10 @@ function Logo(props: Props) {
|
|
|
21
21
|
/* eslint-enable jsx-a11y/no-static-element-interactions */
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
Logo.defaultProps = {
|
|
26
|
+
className: '',
|
|
27
|
+
onClick: () => {},
|
|
28
|
+
};
|
|
29
|
+
|
|
24
30
|
export default Logo;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import _ from "lodash";
|
|
3
2
|
import React from "react";
|
|
4
3
|
import ReactDOM from "react-dom";
|
|
@@ -9,28 +8,28 @@ const BORDER_SIZE = 1;
|
|
|
9
8
|
type Props = {
|
|
10
9
|
onScrollChange: (value: number) => void,
|
|
11
10
|
min: number,
|
|
12
|
-
max: number
|
|
11
|
+
max: number,
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
type State = {
|
|
16
|
-
value: number
|
|
15
|
+
value: number,
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
class Scroller extends React.PureComponent<Props, State> {
|
|
20
|
-
constructor() {
|
|
21
|
-
super();
|
|
19
|
+
constructor(props: Props) {
|
|
20
|
+
super(props);
|
|
22
21
|
this.state = {
|
|
23
|
-
value: 0
|
|
22
|
+
value: 0,
|
|
24
23
|
};
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
onMove(event:
|
|
26
|
+
onMove(event: React.DragEvent<HTMLDivElement>) {
|
|
28
27
|
event.preventDefault();
|
|
29
28
|
this.scroll(event);
|
|
30
29
|
return false;
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
onDrop(event:
|
|
32
|
+
onDrop(event: React.DragEvent<HTMLDivElement>) {
|
|
34
33
|
event.preventDefault();
|
|
35
34
|
const { onScrollChange } = this.props;
|
|
36
35
|
const { value } = this.state;
|
|
@@ -39,7 +38,7 @@ class Scroller extends React.PureComponent<Props, State> {
|
|
|
39
38
|
return false;
|
|
40
39
|
}
|
|
41
40
|
|
|
42
|
-
scroll(event:
|
|
41
|
+
scroll(event: React.DragEvent<HTMLDivElement>) {
|
|
43
42
|
const { clientX } = event;
|
|
44
43
|
const { min, max } = this.props;
|
|
45
44
|
|
|
@@ -60,11 +59,11 @@ class Scroller extends React.PureComponent<Props, State> {
|
|
|
60
59
|
move(x: number, vx: number, maxWidth: number) {
|
|
61
60
|
const value = _.min([
|
|
62
61
|
_.max([x, 0]),
|
|
63
|
-
maxWidth - KNOB_SIZE - 2 * BORDER_SIZE
|
|
62
|
+
maxWidth - KNOB_SIZE - 2 * BORDER_SIZE,
|
|
64
63
|
]);
|
|
65
64
|
|
|
66
65
|
this.setState({
|
|
67
|
-
value
|
|
66
|
+
value,
|
|
68
67
|
});
|
|
69
68
|
}
|
|
70
69
|
|
|
@@ -74,28 +73,28 @@ class Scroller extends React.PureComponent<Props, State> {
|
|
|
74
73
|
return (
|
|
75
74
|
<div
|
|
76
75
|
className="gc-scroller"
|
|
77
|
-
onDragOver={(event:
|
|
76
|
+
onDragOver={(event: React.DragEvent<HTMLDivElement>) => {
|
|
78
77
|
event.preventDefault();
|
|
79
78
|
return false;
|
|
80
79
|
}}
|
|
81
|
-
onDrop={(event:
|
|
80
|
+
onDrop={(event: React.DragEvent<HTMLDivElement>) => {
|
|
82
81
|
this.onDrop(event);
|
|
83
82
|
}}
|
|
84
83
|
>
|
|
85
84
|
<div
|
|
86
85
|
className="gc-scroller__knob"
|
|
87
86
|
style={{
|
|
88
|
-
left: value
|
|
87
|
+
left: value,
|
|
89
88
|
}}
|
|
90
89
|
/>
|
|
91
90
|
<div
|
|
92
91
|
className="gc-scroller__drag"
|
|
93
92
|
draggable="true"
|
|
94
|
-
onDrag={(event:
|
|
93
|
+
onDrag={(event: React.DragEvent<HTMLDivElement>) => {
|
|
95
94
|
this.onMove(event);
|
|
96
95
|
}}
|
|
97
96
|
style={{
|
|
98
|
-
left: value
|
|
97
|
+
left: value,
|
|
99
98
|
}}
|
|
100
99
|
/>
|
|
101
100
|
</div>
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import React from "react";
|
|
3
2
|
import classNames from "classnames";
|
|
4
3
|
|
|
5
4
|
type Props = {
|
|
6
5
|
className?: string,
|
|
7
6
|
children?: string,
|
|
8
|
-
type?: string
|
|
7
|
+
type?: string,
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
function Tooltip(props: Props) {
|
|
12
11
|
const { children, className, type } = props;
|
|
13
12
|
const validationClasses = classNames(className, "gc-tooltip", {
|
|
14
13
|
"gc-tooltip--success": type === "success",
|
|
15
|
-
"gc-tooltip--danger": type === "danger"
|
|
14
|
+
"gc-tooltip--danger": type === "danger",
|
|
16
15
|
});
|
|
17
16
|
|
|
18
17
|
return <div className={validationClasses}>{children}</div>;
|
|
19
18
|
}
|
|
20
19
|
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
Tooltip.defaultProps = {
|
|
22
|
+
className: '',
|
|
23
|
+
children: null,
|
|
24
|
+
type: 'success',
|
|
25
|
+
};
|
|
26
|
+
|
|
21
27
|
export default Tooltip;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import React from "react";
|
|
3
2
|
import classNames from "classnames";
|
|
4
3
|
import Tooltip from "../Tooltip";
|
|
5
4
|
|
|
6
5
|
type Props = {
|
|
7
6
|
className?: string,
|
|
8
|
-
children?: React
|
|
7
|
+
children?: React.ReactNode,
|
|
9
8
|
type?: string,
|
|
10
|
-
message?: string | null
|
|
9
|
+
message?: string | null,
|
|
11
10
|
};
|
|
12
11
|
|
|
13
12
|
function Validation(props: Props) {
|
|
@@ -28,4 +27,12 @@ function Validation(props: Props) {
|
|
|
28
27
|
);
|
|
29
28
|
}
|
|
30
29
|
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
Validation.defaultProps = {
|
|
32
|
+
className: '',
|
|
33
|
+
children: null,
|
|
34
|
+
type: 'success',
|
|
35
|
+
message: null,
|
|
36
|
+
};
|
|
37
|
+
|
|
31
38
|
export default Validation;
|