graphen 1.10.9 → 1.10.11
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/example.js +2 -0
- package/dist/example.js.LICENSE.txt +44 -0
- package/dist/scripts.js +1 -1
- package/dist/styles.css +1 -0
- package/package.json +3 -3
- package/src/components/Accordion/index.tsx +38 -59
- package/src/components/Button/index.tsx +7 -10
- package/src/components/Card/index.tsx +8 -12
- package/src/components/Dialog/index.tsx +10 -11
- package/src/components/Dialog/styles/_styles.scss +12 -0
- package/src/components/Dropdown/index.tsx +27 -23
- package/src/components/Flex/index.tsx +18 -22
- package/src/components/FlexItem/index.tsx +10 -14
- package/src/components/Icon/index.tsx +4 -4
- package/src/components/Image/index.tsx +5 -14
- package/src/components/Input/index.tsx +12 -15
- package/src/components/Joystick/index.tsx +5 -5
- package/src/components/Link/index.tsx +3 -10
- package/src/components/Logo/index.tsx +3 -11
- package/src/components/Panel/index.tsx +8 -12
- package/src/components/PanelContent/index.tsx +1 -8
- package/src/components/PanelFooter/index.tsx +1 -8
- package/src/components/PanelTitle/index.tsx +1 -8
- package/src/components/Scroller/index.tsx +4 -4
- package/src/components/Separator/index.tsx +2 -8
- package/src/components/Switch/index.tsx +45 -0
- package/src/components/Tooltip/index.tsx +4 -12
- package/src/components/Validation/index.tsx +10 -14
- package/src/example.tsx +580 -600
- package/src/index.d.ts +1 -1
- package/src/index.ts +3 -3
- package/src/variables/_z-index.scss +1 -0
|
@@ -2,15 +2,20 @@ import React from "react";
|
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
5
|
-
className?: string
|
|
6
|
-
type?: string
|
|
7
|
-
label: string
|
|
8
|
-
validation?: string
|
|
9
|
-
onChange?: React.ChangeEventHandler<HTMLInputElement
|
|
5
|
+
className?: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
label: string;
|
|
8
|
+
validation?: string;
|
|
9
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
function Input(
|
|
13
|
-
|
|
12
|
+
function Input({
|
|
13
|
+
className = "",
|
|
14
|
+
type = "",
|
|
15
|
+
label,
|
|
16
|
+
validation = undefined,
|
|
17
|
+
onChange = () => {},
|
|
18
|
+
}: Props) {
|
|
14
19
|
const inputClasses = classNames(className, "gc-input");
|
|
15
20
|
const fieldClasses = classNames("gc-input__field", {
|
|
16
21
|
"gc-input__field--success": validation === "success",
|
|
@@ -28,12 +33,4 @@ function Input(props: Props) {
|
|
|
28
33
|
);
|
|
29
34
|
}
|
|
30
35
|
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
Input.defaultProps = {
|
|
33
|
-
className: '',
|
|
34
|
-
type: '',
|
|
35
|
-
validation: undefined,
|
|
36
|
-
onChange: () => {},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
36
|
export default Input;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _ from "lodash";
|
|
2
|
-
import React from
|
|
2
|
+
import React from "react";
|
|
3
3
|
import ReactDOM from "react-dom";
|
|
4
4
|
|
|
5
5
|
type Props = {
|
|
6
|
-
onPositionChange: (left: number, top: number) => void
|
|
7
|
-
isEnabled: boolean
|
|
6
|
+
onPositionChange: (left: number, top: number) => void;
|
|
7
|
+
isEnabled: boolean;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
type State = {
|
|
11
|
-
left: number
|
|
12
|
-
top: number
|
|
11
|
+
left: number;
|
|
12
|
+
top: number;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
const JOYSTICK_RADIUS = 50;
|
|
@@ -10,10 +10,10 @@ type Props = {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
function Link({
|
|
13
|
+
className = "",
|
|
14
|
+
children = null,
|
|
15
|
+
skin = constants.SKIN_DEFAULT,
|
|
13
16
|
link,
|
|
14
|
-
className,
|
|
15
|
-
children,
|
|
16
|
-
skin,
|
|
17
17
|
}: Props) {
|
|
18
18
|
const classes = classNames("gc-link", className, {
|
|
19
19
|
"gc-link--primary": skin === constants.SKIN_PRIMARY,
|
|
@@ -27,11 +27,4 @@ function Link({
|
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
Link.defaultProps = {
|
|
32
|
-
className: '',
|
|
33
|
-
children: null,
|
|
34
|
-
skin: constants.SKIN_DEFAULT,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
30
|
export default Link;
|
|
@@ -2,13 +2,11 @@ import React from "react";
|
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
5
|
-
className?: string
|
|
6
|
-
onClick?: () => void
|
|
5
|
+
className?: string;
|
|
6
|
+
onClick?: () => void;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
function Logo(
|
|
10
|
-
const { onClick, className } = props;
|
|
11
|
-
|
|
9
|
+
function Logo({ className = "", onClick = () => {} }: Props) {
|
|
12
10
|
const logoClasses = classNames(className, "gc-logo");
|
|
13
11
|
|
|
14
12
|
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
@@ -20,10 +18,4 @@ function Logo(props: Props) {
|
|
|
20
18
|
/* eslint-enable jsx-a11y/no-static-element-interactions */
|
|
21
19
|
}
|
|
22
20
|
|
|
23
|
-
// @ts-ignore
|
|
24
|
-
Logo.defaultProps = {
|
|
25
|
-
className: '',
|
|
26
|
-
onClick: () => {},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
21
|
export default Logo;
|
|
@@ -8,22 +8,18 @@ type Props = {
|
|
|
8
8
|
isBordered?: boolean;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
function Panel(
|
|
12
|
-
|
|
11
|
+
function Panel({
|
|
12
|
+
children = null,
|
|
13
|
+
className = "",
|
|
14
|
+
isSeparator = false,
|
|
15
|
+
isBordered = false,
|
|
16
|
+
}: Props) {
|
|
13
17
|
const dialogClasses = classNames(className, "gc-panel", {
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
"gc-panel--separator": isSeparator,
|
|
19
|
+
"gc-panel--bordered": isBordered,
|
|
16
20
|
});
|
|
17
21
|
|
|
18
22
|
return <div className={dialogClasses}>{children}</div>;
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
// @ts-ignore
|
|
22
|
-
Panel.defaultProps = {
|
|
23
|
-
className: '',
|
|
24
|
-
children: null,
|
|
25
|
-
isSeparator: false,
|
|
26
|
-
isBordered: false,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
25
|
export default Panel;
|
|
@@ -6,17 +6,10 @@ type Props = {
|
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
function PanelContent(
|
|
10
|
-
const { children, className} = props;
|
|
9
|
+
function PanelContent({ className = "", children = null }: Props) {
|
|
11
10
|
const dialogClasses = classNames(className, "gc-panel__content");
|
|
12
11
|
|
|
13
12
|
return <article className={dialogClasses}>{children}</article>;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
PanelContent.defaultProps = {
|
|
18
|
-
className: '',
|
|
19
|
-
children: null,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
15
|
export default PanelContent;
|
|
@@ -6,17 +6,10 @@ type Props = {
|
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
function PanelFooter(
|
|
10
|
-
const { children, className} = props;
|
|
9
|
+
function PanelFooter({ className = "", children = null }: Props) {
|
|
11
10
|
const dialogClasses = classNames(className, "gc-panel__footer");
|
|
12
11
|
|
|
13
12
|
return <div className={dialogClasses}>{children}</div>;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
PanelFooter.defaultProps = {
|
|
18
|
-
className: '',
|
|
19
|
-
children: null,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
15
|
export default PanelFooter;
|
|
@@ -6,17 +6,10 @@ type Props = {
|
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
function PanelTitle(
|
|
10
|
-
const { children, className} = props;
|
|
9
|
+
function PanelTitle({ className = "", children = null }: Props) {
|
|
11
10
|
const dialogClasses = classNames(className, "gc-panel__title");
|
|
12
11
|
|
|
13
12
|
return <header className={dialogClasses}>{children}</header>;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
PanelTitle.defaultProps = {
|
|
18
|
-
className: '',
|
|
19
|
-
children: null,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
15
|
export default PanelTitle;
|
|
@@ -6,13 +6,13 @@ const KNOB_SIZE = 12;
|
|
|
6
6
|
const BORDER_SIZE = 1;
|
|
7
7
|
|
|
8
8
|
type Props = {
|
|
9
|
-
onScrollChange: (value: number) => void
|
|
10
|
-
min: number
|
|
11
|
-
max: number
|
|
9
|
+
onScrollChange: (value: number) => void;
|
|
10
|
+
min: number;
|
|
11
|
+
max: number;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
type State = {
|
|
15
|
-
value: number
|
|
15
|
+
value: number;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
class Scroller extends React.PureComponent<Props, State> {
|
|
@@ -2,19 +2,13 @@ import React from "react";
|
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
5
|
-
className?: string
|
|
5
|
+
className?: string;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
function Separator(
|
|
9
|
-
const { className} = props;
|
|
8
|
+
function Separator({ className = "" }: Props) {
|
|
10
9
|
const dialogClasses = classNames(className, "gc-separator");
|
|
11
10
|
|
|
12
11
|
return <div className={dialogClasses} />;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
Separator.defaultProps = {
|
|
17
|
-
className: '',
|
|
18
|
-
};
|
|
19
|
-
|
|
20
14
|
export default Separator;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
isSwitched?: boolean;
|
|
6
|
+
type?: "success" | "info" | "danger";
|
|
7
|
+
onChange?: (arg0: boolean) => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function Switch({
|
|
11
|
+
isSwitched = false,
|
|
12
|
+
type = undefined,
|
|
13
|
+
onChange = () => {},
|
|
14
|
+
}: Props) {
|
|
15
|
+
const [isChecked, setIsChecked] = useState(isSwitched);
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
setIsChecked(isSwitched);
|
|
19
|
+
}, [isSwitched]);
|
|
20
|
+
|
|
21
|
+
const switchClasses = classNames("gc-switch", {
|
|
22
|
+
"gc-switch--success": type === "success",
|
|
23
|
+
"gc-switch--info": type === "info",
|
|
24
|
+
"gc-switch--danger": type === "danger",
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
29
|
+
<label className={switchClasses}>
|
|
30
|
+
<input
|
|
31
|
+
className="gc-switch__input"
|
|
32
|
+
type="checkbox"
|
|
33
|
+
onChange={(event) => {
|
|
34
|
+
const { checked } = event.target;
|
|
35
|
+
setIsChecked(checked);
|
|
36
|
+
onChange(checked);
|
|
37
|
+
}}
|
|
38
|
+
checked={isChecked}
|
|
39
|
+
/>
|
|
40
|
+
<span className="gc-switch__slider" />
|
|
41
|
+
</label>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default Switch;
|
|
@@ -2,13 +2,12 @@ import React from "react";
|
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
5
|
-
className?: string
|
|
6
|
-
children?: string
|
|
7
|
-
type?: string
|
|
5
|
+
className?: string;
|
|
6
|
+
children?: string;
|
|
7
|
+
type?: string;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
function Tooltip(
|
|
11
|
-
const { children, className, type } = props;
|
|
10
|
+
function Tooltip({ className = "", children = null, type = "success" }: Props) {
|
|
12
11
|
const validationClasses = classNames(className, "gc-tooltip", {
|
|
13
12
|
"gc-tooltip--success": type === "success",
|
|
14
13
|
"gc-tooltip--danger": type === "danger",
|
|
@@ -17,11 +16,4 @@ function Tooltip(props: Props) {
|
|
|
17
16
|
return <div className={validationClasses}>{children}</div>;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
Tooltip.defaultProps = {
|
|
22
|
-
className: '',
|
|
23
|
-
children: null,
|
|
24
|
-
type: 'success',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
19
|
export default Tooltip;
|
|
@@ -3,14 +3,18 @@ import classNames from "classnames";
|
|
|
3
3
|
import Tooltip from "../Tooltip";
|
|
4
4
|
|
|
5
5
|
type Props = {
|
|
6
|
-
className?: string
|
|
7
|
-
children?: React.ReactNode
|
|
8
|
-
type?: string
|
|
9
|
-
message?: string | null
|
|
6
|
+
className?: string;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
type?: string;
|
|
9
|
+
message?: string | null;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
function Validation(
|
|
13
|
-
|
|
12
|
+
function Validation({
|
|
13
|
+
className = "",
|
|
14
|
+
children = null,
|
|
15
|
+
type = "success",
|
|
16
|
+
message = null,
|
|
17
|
+
}: Props) {
|
|
14
18
|
const validationClasses = classNames(className, "gc-validation");
|
|
15
19
|
|
|
16
20
|
const tooltip = message ? (
|
|
@@ -27,12 +31,4 @@ function Validation(props: Props) {
|
|
|
27
31
|
);
|
|
28
32
|
}
|
|
29
33
|
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
Validation.defaultProps = {
|
|
32
|
-
className: '',
|
|
33
|
-
children: null,
|
|
34
|
-
type: 'success',
|
|
35
|
-
message: null,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
34
|
export default Validation;
|