@luminati-io/uikit 1.2.2 → 1.3.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.
- package/assets/icons/account.svg +8 -0
- package/assets/icons/adapt.svg +4 -0
- package/assets/icons/add.svg +3 -0
- package/assets/icons/add_circle.svg +5 -0
- package/assets/icons/add_funds.svg +7 -0
- package/assets/icons/attach.svg +3 -0
- package/assets/icons/book_help.svg +4 -0
- package/assets/icons/building.svg +3 -0
- package/assets/icons/calendar.svg +13 -0
- package/assets/icons/calendar_graph.svg +14 -0
- package/assets/icons/call.svg +5 -0
- package/assets/icons/camera.svg +5 -0
- package/assets/icons/cart.svg +3 -0
- package/assets/icons/close.svg +3 -0
- package/assets/icons/close_circle.svg +3 -0
- package/assets/icons/close_small.svg +5 -0
- package/assets/icons/collapse.svg +4 -0
- package/assets/icons/column.svg +22 -0
- package/assets/icons/columns.svg +10 -0
- package/assets/icons/connect.svg +3 -0
- package/assets/icons/contact_support.svg +3 -0
- package/assets/icons/copy.svg +3 -0
- package/assets/icons/copy_small.svg +3 -0
- package/assets/icons/customize.svg +6 -0
- package/assets/icons/dataset.svg +3 -0
- package/assets/icons/delete.svg +4 -4
- package/assets/icons/desktop.svg +3 -0
- package/assets/icons/dislike.svg +3 -0
- package/assets/icons/doc_new.svg +8 -0
- package/assets/icons/document.svg +3 -0
- package/assets/icons/dots_horizontal.svg +3 -0
- package/assets/icons/dots_vertical.svg +3 -0
- package/assets/icons/download.svg +3 -0
- package/assets/icons/drag_and_drop.svg +3 -0
- package/assets/icons/edit.svg +3 -0
- package/assets/icons/edit_small.svg +3 -0
- package/assets/icons/envelope.svg +4 -0
- package/assets/icons/file_csv.svg +7 -0
- package/assets/icons/file_json.svg +8 -0
- package/assets/icons/filter.svg +3 -0
- package/assets/icons/folder.svg +3 -0
- package/assets/icons/forward.svg +3 -0
- package/assets/icons/index.js +162 -4
- package/assets/icons/info.svg +3 -0
- package/assets/icons/invite.svg +3 -0
- package/assets/icons/lightning.svg +3 -0
- package/assets/icons/like.svg +3 -0
- package/assets/icons/link_ext.svg +4 -0
- package/assets/icons/lock.svg +4 -0
- package/assets/icons/login.svg +12 -0
- package/assets/icons/logout.svg +4 -0
- package/assets/icons/maximize.svg +4 -0
- package/assets/icons/mention.svg +3 -0
- package/assets/icons/menu_close.svg +3 -0
- package/assets/icons/menu_expand.svg +3 -0
- package/assets/icons/message.svg +3 -0
- package/assets/icons/minimize.svg +4 -0
- package/assets/icons/minus.svg +3 -0
- package/assets/icons/monitor.svg +3 -0
- package/assets/icons/on_off.svg +8 -0
- package/assets/icons/pause.svg +3 -0
- package/assets/icons/pin.svg +3 -0
- package/assets/icons/play.svg +3 -0
- package/assets/icons/publish.svg +9 -0
- package/assets/icons/question.svg +3 -0
- package/assets/icons/queue.svg +8 -0
- package/assets/icons/referal.svg +4 -0
- package/assets/icons/refresh.svg +3 -0
- package/assets/icons/reset.svg +4 -0
- package/assets/icons/search.svg +10 -0
- package/assets/icons/seo.svg +17 -0
- package/assets/icons/settings.svg +3 -0
- package/assets/icons/smartphone.svg +4 -0
- package/assets/icons/sort.svg +4 -0
- package/assets/icons/sum.svg +3 -0
- package/assets/icons/trash.svg +3 -0
- package/assets/icons/unpin.svg +4 -0
- package/assets/icons/upgrade.svg +11 -0
- package/assets/icons/upload.svg +4 -0
- package/assets/icons/upload_cloud.svg +4 -0
- package/assets/icons/verify.svg +4 -0
- package/dist/uikit.umd.js +1 -1
- package/package.json +1 -1
- package/src/icon.js +20 -24
- package/src/icon_button.js +75 -0
- package/src/index.js +2 -1
- package/src/infochip.js +8 -6
- package/src/utils.js +5 -0
package/package.json
CHANGED
package/src/icon.js
CHANGED
|
@@ -5,7 +5,7 @@ import React from 'react';
|
|
|
5
5
|
import styled, {css} from 'styled-components';
|
|
6
6
|
import PT from 'prop-types';
|
|
7
7
|
|
|
8
|
-
import {theme, toPixel} from './utils';
|
|
8
|
+
import {theme, toPixel, colorNames, iconNames} from './utils';
|
|
9
9
|
import icons from '@icons';
|
|
10
10
|
|
|
11
11
|
const toIconSize = size=>{
|
|
@@ -27,40 +27,36 @@ const toIconSize = size=>{
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const Icon = React.forwardRef((props, ref)=>{
|
|
30
|
-
const {name, size, color
|
|
30
|
+
const {name, size, color} = props;
|
|
31
31
|
const ic = icons[name];
|
|
32
32
|
if (!ic)
|
|
33
33
|
return null;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
return <IconContainer ref={ref} size={size}>
|
|
44
|
-
<svg viewBox={ic.viewBox}>
|
|
45
|
-
<mask id={maskId}><use href={`#${ic.id}`}/></mask>
|
|
46
|
-
<rect fill={theme.color[color]} width="100%" height="100%"
|
|
47
|
-
mask={`url(#${maskId})`}/>
|
|
48
|
-
</svg>
|
|
49
|
-
</IconContainer>;
|
|
34
|
+
return <StyledSvg
|
|
35
|
+
ref={ref}
|
|
36
|
+
size={size}
|
|
37
|
+
viewBox={ic.viewBox}
|
|
38
|
+
color={theme.color[color]}
|
|
39
|
+
>
|
|
40
|
+
<use href={`#${ic.id}`}/>
|
|
41
|
+
</StyledSvg>;
|
|
50
42
|
});
|
|
51
43
|
Icon.displayName = 'Icon';
|
|
52
44
|
Icon.defaultProps = {size: 'md'};
|
|
53
45
|
Icon.propTypes = {
|
|
54
|
-
name: PT.
|
|
55
|
-
color: PT.
|
|
46
|
+
name: PT.oneOf(iconNames).isRequired,
|
|
47
|
+
color: PT.oneOf(colorNames),
|
|
56
48
|
size: PT.oneOf(['xxs', 'xs', 'sm', 'md', 'lg', 'xl']),
|
|
57
|
-
no_mask: PT.oneOfType([PT.bool, PT.number]),
|
|
58
49
|
};
|
|
59
50
|
|
|
60
|
-
const
|
|
61
|
-
|
|
51
|
+
export const IconColorComp = styled.rect.attrs({
|
|
52
|
+
width: '100%',
|
|
53
|
+
height: '100%',
|
|
54
|
+
})``;
|
|
55
|
+
|
|
56
|
+
const StyledSvg = styled.svg`
|
|
57
|
+
color: ${props=>props.color};
|
|
62
58
|
${props=>toIconSize(props.size)}
|
|
63
59
|
`;
|
|
64
|
-
|
|
60
|
+
StyledSvg.displayName = 'StyledSvg';
|
|
65
61
|
|
|
66
62
|
export default Icon;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// LICENSE_CODE ZON
|
|
2
|
+
'use strict'; /*jslint react:true*/
|
|
3
|
+
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import styled, {css} from 'styled-components';
|
|
6
|
+
import PT from 'prop-types';
|
|
7
|
+
import utils from './utils';
|
|
8
|
+
import Icon, {IconColorComp} from './icon';
|
|
9
|
+
|
|
10
|
+
const {theme, toPixel, getCommonProps, iconNames} = utils;
|
|
11
|
+
|
|
12
|
+
const IconButton = React.forwardRef((props, ref)=>{
|
|
13
|
+
const {variant: $variant, disabled, icon} = props;
|
|
14
|
+
const p = {...getCommonProps(props), disabled, $variant};
|
|
15
|
+
return <StyledIconButton ref={ref} {...p}>
|
|
16
|
+
<Icon name={icon} size="sm" />
|
|
17
|
+
</StyledIconButton>;
|
|
18
|
+
});
|
|
19
|
+
IconButton.displayName = 'IconButton';
|
|
20
|
+
IconButton.defaultProps = {variant: 'icon-button'};
|
|
21
|
+
IconButton.propTypes = {
|
|
22
|
+
variant: PT.oneOf(['icon', 'icon-button']),
|
|
23
|
+
icon: PT.oneOf(iconNames).isRequired,
|
|
24
|
+
disabled: PT.bool,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const StyledIconButton = styled.button`
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
border-radius: 4px;
|
|
32
|
+
padding: 0;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
${props=>{
|
|
35
|
+
return css`
|
|
36
|
+
background-color: ${theme.color.white};
|
|
37
|
+
border: ${props.$variant=='icon'?'0 none;':
|
|
38
|
+
`1px solid ${theme.color.gray_6}`};
|
|
39
|
+
${IconColorComp} {
|
|
40
|
+
fill: ${theme.color.gray_9};
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
}}
|
|
44
|
+
&:hover:not(:disabled) {
|
|
45
|
+
background-color: ${theme.color.gray_2};
|
|
46
|
+
border: ${props=>props.$variant=='icon'?'0 none;':
|
|
47
|
+
`1px solid ${theme.color.gray_8}`};
|
|
48
|
+
}
|
|
49
|
+
&:active:not(:disabled) {
|
|
50
|
+
background-color: ${theme.color.blue_4};
|
|
51
|
+
border: ${props=>props.$variant=='icon'?'0 none;':
|
|
52
|
+
`1px solid ${theme.color.blue_4}`};
|
|
53
|
+
${IconColorComp} {
|
|
54
|
+
fill: ${theme.color.blue_11};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
&:disabled {
|
|
58
|
+
border: ${props=>props.$variant=='icon'?'0 none;':
|
|
59
|
+
`1px solid ${theme.color.gray_7}`};
|
|
60
|
+
${IconColorComp} {
|
|
61
|
+
fill: ${theme.color.gray_7};
|
|
62
|
+
}
|
|
63
|
+
cursor: not-allowed;
|
|
64
|
+
}
|
|
65
|
+
${props=>{
|
|
66
|
+
let w = props.$variant=='icon'?24:36;
|
|
67
|
+
return css`
|
|
68
|
+
width: ${toPixel(w)};
|
|
69
|
+
height: ${toPixel(w)};
|
|
70
|
+
`;
|
|
71
|
+
}}
|
|
72
|
+
`;
|
|
73
|
+
StyledIconButton.displayName = 'StyledIconButton';
|
|
74
|
+
|
|
75
|
+
export default IconButton;
|
package/src/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import InfoChip from './infochip';
|
|
|
6
6
|
import layout from './layout';
|
|
7
7
|
import progress from './progress';
|
|
8
8
|
import Icon from './icon';
|
|
9
|
+
import IconButton from './icon_button';
|
|
9
10
|
|
|
10
11
|
const {Header, Label, Hyperlink, Paragraph} = typography;
|
|
11
12
|
const {Box, Flex} = layout;
|
|
@@ -16,6 +17,6 @@ export const Typography = {Header, Label, Hyperlink, Paragraph};
|
|
|
16
17
|
const UIKit = {
|
|
17
18
|
Layout,
|
|
18
19
|
Typography,
|
|
19
|
-
Button, InfoChip, Progress, ProgressBar, Icon,
|
|
20
|
+
Button, InfoChip, Progress, ProgressBar, Icon, IconButton,
|
|
20
21
|
};
|
|
21
22
|
export default UIKit;
|
package/src/infochip.js
CHANGED
|
@@ -5,9 +5,10 @@ import React from 'react';
|
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import PT from 'prop-types';
|
|
7
7
|
|
|
8
|
-
import {theme} from './utils';
|
|
8
|
+
import {theme, iconNames, getCommonProps} from './utils';
|
|
9
9
|
import Flex from './layout/flex';
|
|
10
10
|
import typography from './Typography';
|
|
11
|
+
import Icon from './icon';
|
|
11
12
|
|
|
12
13
|
const {Label} = typography;
|
|
13
14
|
|
|
@@ -23,14 +24,14 @@ const InfoChipWrapper = styled(Flex).attrs({
|
|
|
23
24
|
|
|
24
25
|
const InfoChip = props=>{
|
|
25
26
|
const {variant, text, icon} = props;
|
|
26
|
-
const
|
|
27
|
+
const bgColors = {
|
|
27
28
|
default: 'gray_3',
|
|
28
29
|
success: 'green_3',
|
|
29
30
|
alert: 'red_3',
|
|
30
31
|
warning: 'yellow_3',
|
|
31
32
|
info: 'blue_3',
|
|
32
33
|
};
|
|
33
|
-
const
|
|
34
|
+
const bgColor = bgColors[variant] || bgColors.default;
|
|
34
35
|
const colors = {
|
|
35
36
|
default: 'gray_11_50',
|
|
36
37
|
success: 'green_11',
|
|
@@ -39,8 +40,9 @@ const InfoChip = props=>{
|
|
|
39
40
|
info: 'blue_11',
|
|
40
41
|
};
|
|
41
42
|
const color = colors[variant] || colors.default;
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
const commonProps = getCommonProps(props);
|
|
44
|
+
return <InfoChipWrapper color={bgColor} {...commonProps}>
|
|
45
|
+
{icon && <Icon size="xxs" color={color} name={icon}/>}
|
|
44
46
|
<Label variant="xs" color={color}>{text}</Label>
|
|
45
47
|
</InfoChipWrapper>;
|
|
46
48
|
};
|
|
@@ -49,7 +51,7 @@ InfoChip.defaultProps = {variant: 'default'};
|
|
|
49
51
|
InfoChip.propTypes = {
|
|
50
52
|
variant: PT.oneOf(['default', 'success', 'alert', 'warning', 'info']),
|
|
51
53
|
text: PT.string,
|
|
52
|
-
icon: PT.
|
|
54
|
+
icon: PT.oneOf(iconNames),
|
|
53
55
|
};
|
|
54
56
|
|
|
55
57
|
export default InfoChip;
|
package/src/utils.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
'use strict'; /*jslint react:true*/
|
|
3
3
|
|
|
4
4
|
import _ from 'lodash';
|
|
5
|
+
import icons from '@icons';
|
|
5
6
|
|
|
6
7
|
export const theme = {
|
|
7
8
|
color: {
|
|
@@ -93,6 +94,10 @@ export const theme = {
|
|
|
93
94
|
}
|
|
94
95
|
};
|
|
95
96
|
|
|
97
|
+
export const colorNames = Object.keys(theme.color);
|
|
98
|
+
|
|
99
|
+
export const iconNames = Object.keys(icons);
|
|
100
|
+
|
|
96
101
|
export const toPixel = value=>`${value}px`;
|
|
97
102
|
|
|
98
103
|
export const getCommonProps = props=>_.pickBy(props, (v, k)=>{
|