@luminati-io/uikit 1.3.0 → 1.4.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/maximize.svg +1 -1
- package/dist/uikit.umd.js +1 -1
- package/package.json +6 -3
- package/src/button/button.js +121 -0
- package/src/button/index.js +6 -0
- package/src/button/loading_icon.js +46 -0
- package/src/icon.js +2 -6
- package/src/icon_button.js +8 -8
- package/src/index.js +26 -10
- package/src/progress/index.js +1 -1
- package/src/tooltip.js +96 -0
- package/src/utils.js +131 -1
- package/src/button.js +0 -180
package/src/button.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
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 typography from './Typography';
|
|
9
|
-
|
|
10
|
-
const {Typography, Label} = typography;
|
|
11
|
-
const {theme, toPixel, getCommonProps} = utils;
|
|
12
|
-
|
|
13
|
-
const Button = React.forwardRef((props, ref)=>{
|
|
14
|
-
const {text, variant, size, icon, iconPlacement, disabled} = props;
|
|
15
|
-
const iconLeft = !!icon&&iconPlacement=='left';
|
|
16
|
-
const iconRight = !!icon&&iconPlacement=='right';
|
|
17
|
-
const iconName = `ic_${icon}.svg`;
|
|
18
|
-
const iconSize = {sm: 'xs', xs: 'xxs'}[size]||'sm';
|
|
19
|
-
return <StyledButton ref={ref} {...getCommonProps(props)} variant={variant}
|
|
20
|
-
size={size} disabled={disabled} $inline={!icon}>
|
|
21
|
-
{/* {iconLeft&&<Icon name={iconName} size={iconSize}/>} */}
|
|
22
|
-
<Label variant={size=='xs'?'sm':'lg'} no_wrap>{text}</Label>
|
|
23
|
-
{/* {iconRight&&<Icon name={iconName} size={iconSize}/>} */}
|
|
24
|
-
</StyledButton>;
|
|
25
|
-
});
|
|
26
|
-
Button.displayName = 'Button';
|
|
27
|
-
Button.defaultProps = {size: 'md', iconPlacement: 'left'};
|
|
28
|
-
Button.propTypes = {
|
|
29
|
-
text: PT.string.isRequired,
|
|
30
|
-
variant: PT.oneOf(['primary', 'secondary', 'negative',
|
|
31
|
-
'negative_secondary', 'positive', 'white']).isRequired,
|
|
32
|
-
size: PT.oneOf(['xs', 'sm', 'md', 'lg']),
|
|
33
|
-
icon: PT.string,
|
|
34
|
-
iconPlacement: PT.oneOf(['left', 'right']),
|
|
35
|
-
disabled: PT.bool,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const StyledButton = styled.button`
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
justify-content: center;
|
|
42
|
-
border-radius: 4px;
|
|
43
|
-
${props=>{
|
|
44
|
-
let gap = 4;
|
|
45
|
-
let paddingLeft = 12;
|
|
46
|
-
let paddingRight = 16;
|
|
47
|
-
if (props.$inline)
|
|
48
|
-
paddingLeft = paddingRight;
|
|
49
|
-
if (props.size=='xs')
|
|
50
|
-
{
|
|
51
|
-
gap = 2;
|
|
52
|
-
paddingLeft = paddingRight = 8;
|
|
53
|
-
}
|
|
54
|
-
return css`
|
|
55
|
-
gap: ${toPixel(gap)};
|
|
56
|
-
padding-left: ${toPixel(paddingLeft)};
|
|
57
|
-
padding-right: ${toPixel(paddingRight)};
|
|
58
|
-
`;
|
|
59
|
-
}}
|
|
60
|
-
${props=>{
|
|
61
|
-
const getColors = ()=>{
|
|
62
|
-
const {variant, disabled} = props;
|
|
63
|
-
if (disabled)
|
|
64
|
-
{
|
|
65
|
-
return {
|
|
66
|
-
color: theme.color.gray_9,
|
|
67
|
-
backColor: theme.color.gray_2,
|
|
68
|
-
borderColor: theme.color.gray_6,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
const styles = {
|
|
72
|
-
primary: {
|
|
73
|
-
color: theme.color.white,
|
|
74
|
-
backColor: theme.color.blue_11,
|
|
75
|
-
borderColor: theme.color.blue_11,
|
|
76
|
-
hover: {
|
|
77
|
-
backColor: theme.color.blue_10,
|
|
78
|
-
borderColor: theme.color.blue_10,
|
|
79
|
-
},
|
|
80
|
-
active: {
|
|
81
|
-
backColor: theme.color.blue_11,
|
|
82
|
-
borderColor: theme.color.blue_11,
|
|
83
|
-
boxShadow: '0 0 0 2px rgba(0, 106, 220, 0.4)',
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
secondary: {
|
|
87
|
-
color: theme.color.blue_11,
|
|
88
|
-
backColor: theme.color.white,
|
|
89
|
-
borderColor: theme.color.blue_11,
|
|
90
|
-
hover: {backColor: theme.color.blue_2},
|
|
91
|
-
active: {
|
|
92
|
-
backColor: theme.color.white,
|
|
93
|
-
boxShadow: '0 0 0 2px rgba(0, 106, 220, 0.4)',
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
negative: {
|
|
97
|
-
color: theme.color.white,
|
|
98
|
-
backColor: theme.color.red_11,
|
|
99
|
-
borderColor: theme.color.red_11,
|
|
100
|
-
hover: {
|
|
101
|
-
backColor: theme.color.red_10,
|
|
102
|
-
borderColor: theme.color.red_10,
|
|
103
|
-
},
|
|
104
|
-
active: {
|
|
105
|
-
backColor: theme.color.red_11,
|
|
106
|
-
borderColor: theme.color.red_11,
|
|
107
|
-
boxShadow: '0 0 0 2px rgba(205, 43, 49, 0.4)',
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
negative_secondary: {
|
|
111
|
-
color: theme.color.red_11,
|
|
112
|
-
backColor: theme.color.white,
|
|
113
|
-
borderColor: theme.color.red_11,
|
|
114
|
-
hover: {backColor: theme.color.red_2},
|
|
115
|
-
active: {
|
|
116
|
-
backColor: theme.color.white,
|
|
117
|
-
boxShadow: '0 0 0 2px rgba(205, 43, 49, 0.4)',
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
positive: {
|
|
121
|
-
color: theme.color.green_11,
|
|
122
|
-
backColor: theme.color.white,
|
|
123
|
-
borderColor: theme.color.green_11,
|
|
124
|
-
hover: {backColor: theme.color.green_2},
|
|
125
|
-
active: {
|
|
126
|
-
backColor: theme.color.white,
|
|
127
|
-
boxShadow: '0 0 0 2px rgba(6, 122, 111, 0.4)',
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
white: {
|
|
131
|
-
color: theme.color.gray_11_50,
|
|
132
|
-
iconColor: theme.color.gray_10,
|
|
133
|
-
backColor: theme.color.white,
|
|
134
|
-
borderColor: theme.color.gray_8,
|
|
135
|
-
hover: {backColor: theme.color.gray_2},
|
|
136
|
-
active: {
|
|
137
|
-
backColor: theme.color.gray_3,
|
|
138
|
-
borderColor: theme.color.gray_9,
|
|
139
|
-
iconColor: theme.color.gray_11_50,
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
return styles[variant]||styles.primary;
|
|
144
|
-
};
|
|
145
|
-
const colors = getColors();
|
|
146
|
-
return css`
|
|
147
|
-
background-color: ${colors.backColor};
|
|
148
|
-
border: 1px solid ${colors.borderColor};
|
|
149
|
-
${Typography} { color: ${colors.color}; }
|
|
150
|
-
${'' /* ${IconContainer} {
|
|
151
|
-
background-color: ${colors.iconColor||colors.color};
|
|
152
|
-
} */}
|
|
153
|
-
${colors.hover&&`&:hover {
|
|
154
|
-
background-color: ${colors.hover.backColor};
|
|
155
|
-
border: 1px solid ${colors.hover.borderColor};
|
|
156
|
-
}`}
|
|
157
|
-
${colors.active&&`&:active {
|
|
158
|
-
background-color: ${colors.active.backColor};
|
|
159
|
-
border: 1px solid ${colors.active.borderColor};
|
|
160
|
-
box-shadow: ${colors.active.boxShadow};
|
|
161
|
-
${'' /* ${colors.active.iconColor&&`${IconContainer} {
|
|
162
|
-
background-color: ${colors.active.iconColor};
|
|
163
|
-
}`} */}
|
|
164
|
-
}`}
|
|
165
|
-
`;
|
|
166
|
-
}}
|
|
167
|
-
${props=>{
|
|
168
|
-
let w = 40; // md
|
|
169
|
-
if (props.size=='lg')
|
|
170
|
-
w = 48;
|
|
171
|
-
if (props.size=='sm')
|
|
172
|
-
w = 36;
|
|
173
|
-
if (props.size=='xs')
|
|
174
|
-
w = 28;
|
|
175
|
-
return css`height: ${toPixel(w)};`;
|
|
176
|
-
}}
|
|
177
|
-
`;
|
|
178
|
-
StyledButton.displayName = 'StyledButton';
|
|
179
|
-
|
|
180
|
-
export default Button;
|