@capillarytech/blaze-ui 0.1.6-alpha.29 → 0.1.6-alpha.3
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/CapHeading/CapHeading.js +71 -0
- package/CapHeading/index.js +1 -0
- package/CapHeading/styles.js +125 -0
- package/CapInfoNote/CapInfoNote.js +54 -0
- package/CapInfoNote/index.js +1 -0
- package/CapInfoNote/styles.js +63 -0
- package/CapInput/CapInput.js +67 -0
- package/CapInput/Number.js +38 -0
- package/CapInput/Search.js +32 -0
- package/CapInput/TextArea.js +45 -0
- package/CapInput/index.js +10 -0
- package/CapInput/loadable.js +9 -0
- package/CapInput/messages.js +27 -0
- package/CapInput/styles.js +81 -0
- package/CapLabel/CapLabel.js +106 -0
- package/CapLabel/index.js +1 -0
- package/CapLabel/styles.js +221 -0
- package/CapRow/CapRow.js +22 -0
- package/CapRow/index.js +1 -0
- package/CapRow/styles.js +9 -0
- package/CapTable/CapTable.js +146 -0
- package/CapTable/index.js +3 -0
- package/CapTable/loadable.js +13 -0
- package/CapTable/styles.js +134 -0
- package/CapTooltip/CapTooltip.js +36 -0
- package/CapTooltip/index.js +1 -0
- package/CapTooltip/styles.js +42 -0
- package/CapUnifiedSelect/CapUnifiedSelect.js +121 -0
- package/CapUnifiedSelect/index.js +4 -0
- package/CapUnifiedSelect/loadable.js +3 -0
- package/CapUnifiedSelect/messages.js +24 -0
- package/CapUnifiedSelect/styles.js +223 -0
- package/LocaleHoc/index.js +38 -0
- package/dist/235.index.js +2 -0
- package/dist/235.index.js.LICENSE.txt +29 -0
- package/dist/603.index.js +1 -0
- package/dist/{components/CapTable → CapTable}/loadable.js +4 -4
- package/dist/esm/CapHeading/CapHeading.js +41 -0
- package/dist/esm/CapHeading/index.js +1 -0
- package/dist/esm/CapHeading/styles.js +123 -0
- package/dist/esm/CapInfoNote/CapInfoNote.js +62 -0
- package/dist/esm/CapInfoNote/index.js +1 -0
- package/dist/esm/CapInfoNote/styles.js +6 -0
- package/dist/esm/CapInput/loadable.js +9 -0
- package/dist/esm/CapLabel/CapLabel.js +50 -0
- package/dist/esm/CapLabel/index.js +1 -0
- package/dist/esm/CapLabel/styles.js +219 -0
- package/dist/esm/{components/CapSkeleton/CapSkeleton.js → CapRow/CapRow.js} +12 -12
- package/dist/esm/CapRow/index.js +1 -0
- package/dist/esm/CapRow/styles.js +5 -0
- package/dist/esm/CapTable/loadable.js +12 -0
- package/dist/esm/CapTooltip/CapTooltip.js +34 -0
- package/dist/esm/CapTooltip/index.js +1 -0
- package/dist/esm/CapTooltip/styles.js +6 -0
- package/dist/esm/CapUnifiedSelect/CapUnifiedSelect.js +101 -0
- package/dist/esm/CapUnifiedSelect/index.js +3 -0
- package/dist/esm/CapUnifiedSelect/loadable.js +4 -0
- package/dist/esm/CapUnifiedSelect/styles.js +15 -0
- package/dist/esm/{components/index.js → index.js} +1 -5
- package/dist/{components/index.js → index.js} +0 -27
- package/dist/index.js.LICENSE.txt +7 -0
- package/index.js +10 -0
- package/package.json +10 -8
- package/styled/index.js +6 -0
- package/styled/variables.js +89 -0
- package/translations/en.js +331 -0
- package/dist/components/CapSkeleton/CapSkeleton.js +0 -29
- package/dist/components/CapSkeleton/index.js +0 -13
- package/dist/components/CapSpin/CapSpin.js +0 -35
- package/dist/components/CapSpin/index.js +0 -13
- package/dist/components/CapTestSelect/CapTestSelect.js +0 -40
- package/dist/components/CapTestSelect/index.js +0 -13
- package/dist/components/CapUnifiedSelect/CapUnifiedSelect.js +0 -406
- package/dist/components/CapUnifiedSelect/index.js +0 -13
- package/dist/components/CapUnifiedSelect/messages.js +0 -29
- package/dist/components/CapUnifiedSelect/styles.js +0 -39
- package/dist/esm/components/CapSkeleton/index.js +0 -1
- package/dist/esm/components/CapSpin/CapSpin.js +0 -28
- package/dist/esm/components/CapSpin/index.js +0 -1
- package/dist/esm/components/CapTable/loadable.js +0 -12
- package/dist/esm/components/CapTestSelect/CapTestSelect.js +0 -34
- package/dist/esm/components/CapTestSelect/index.js +0 -1
- package/dist/esm/components/CapUnifiedSelect/CapUnifiedSelect.js +0 -398
- package/dist/esm/components/CapUnifiedSelect/index.js +0 -1
- package/dist/esm/components/CapUnifiedSelect/styles.js +0 -31
- package/dist/esm/utils/index.js +0 -1
- package/dist/esm/utils/withStyles.js +0 -23
- package/dist/utils/index.js +0 -13
- package/dist/utils/withStyles.js +0 -29
- /package/dist/{components/CapInput → CapInput}/CapInput.js +0 -0
- /package/dist/{components/CapInput → CapInput}/Number.js +0 -0
- /package/dist/{components/CapInput → CapInput}/Search.js +0 -0
- /package/dist/{components/CapInput → CapInput}/TextArea.js +0 -0
- /package/dist/{components/CapInput → CapInput}/index.js +0 -0
- /package/dist/{components/CapInput → CapInput}/messages.js +0 -0
- /package/dist/{components/CapInput → CapInput}/styles.js +0 -0
- /package/dist/{components/CapTable → CapTable}/CapTable.js +0 -0
- /package/dist/{components/CapTable → CapTable}/index.js +0 -0
- /package/dist/{components/CapTable → CapTable}/styles.js +0 -0
- /package/dist/{components/LocaleHoc → LocaleHoc}/index.js +0 -0
- /package/dist/esm/{components/CapInput → CapInput}/CapInput.js +0 -0
- /package/dist/esm/{components/CapInput → CapInput}/Number.js +0 -0
- /package/dist/esm/{components/CapInput → CapInput}/Search.js +0 -0
- /package/dist/esm/{components/CapInput → CapInput}/TextArea.js +0 -0
- /package/dist/esm/{components/CapInput → CapInput}/index.js +0 -0
- /package/dist/esm/{components/CapInput → CapInput}/messages.js +0 -0
- /package/dist/esm/{components/CapInput → CapInput}/styles.js +0 -0
- /package/dist/esm/{components/CapTable → CapTable}/CapTable.js +0 -0
- /package/dist/esm/{components/CapTable → CapTable}/index.js +0 -0
- /package/dist/esm/{components/CapTable → CapTable}/styles.js +0 -0
- /package/dist/esm/{components/CapUnifiedSelect → CapUnifiedSelect}/messages.js +0 -0
- /package/dist/esm/{components/LocaleHoc → LocaleHoc}/index.js +0 -0
- /package/dist/esm/{components/styled → styled}/index.js +0 -0
- /package/dist/esm/{components/styled → styled}/variables.js +0 -0
- /package/dist/esm/{components/translations → translations}/en.js +0 -0
- /package/dist/{components/styled → styled}/index.js +0 -0
- /package/dist/{components/styled → styled}/variables.js +0 -0
- /package/dist/{components/translations → translations}/en.js +0 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { HeadingWrapper, HeadingSpan } from './styles';
|
|
4
|
+
|
|
5
|
+
const CapHeading = ({ type = 'h5', children, as, ...rest }) => {
|
|
6
|
+
return (
|
|
7
|
+
<HeadingWrapper type={type} as={as || 'div'} {...rest}>
|
|
8
|
+
{children}
|
|
9
|
+
</HeadingWrapper>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
CapHeading.propTypes = {
|
|
14
|
+
type: PropTypes.oneOf([
|
|
15
|
+
'h0',
|
|
16
|
+
'h1',
|
|
17
|
+
'h2',
|
|
18
|
+
'h3',
|
|
19
|
+
'h4',
|
|
20
|
+
'h5',
|
|
21
|
+
'h6',
|
|
22
|
+
'h7',
|
|
23
|
+
'h8',
|
|
24
|
+
'h9',
|
|
25
|
+
'h10',
|
|
26
|
+
'label1',
|
|
27
|
+
'label2',
|
|
28
|
+
'label3',
|
|
29
|
+
'label4',
|
|
30
|
+
'label5',
|
|
31
|
+
'label6',
|
|
32
|
+
]),
|
|
33
|
+
children: PropTypes.node,
|
|
34
|
+
as: PropTypes.string,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Inline span version
|
|
38
|
+
const CapHeadingSpan = ({ type = 'h5', children, ...rest }) => {
|
|
39
|
+
return (
|
|
40
|
+
<HeadingSpan type={type} {...rest}>
|
|
41
|
+
{children}
|
|
42
|
+
</HeadingSpan>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
CapHeadingSpan.propTypes = {
|
|
47
|
+
type: PropTypes.oneOf([
|
|
48
|
+
'h0',
|
|
49
|
+
'h1',
|
|
50
|
+
'h2',
|
|
51
|
+
'h3',
|
|
52
|
+
'h4',
|
|
53
|
+
'h5',
|
|
54
|
+
'h6',
|
|
55
|
+
'h7',
|
|
56
|
+
'h8',
|
|
57
|
+
'h9',
|
|
58
|
+
'h10',
|
|
59
|
+
'label1',
|
|
60
|
+
'label2',
|
|
61
|
+
'label3',
|
|
62
|
+
'label4',
|
|
63
|
+
'label5',
|
|
64
|
+
'label6',
|
|
65
|
+
]),
|
|
66
|
+
children: PropTypes.node,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
CapHeading.Span = CapHeadingSpan;
|
|
70
|
+
|
|
71
|
+
export default CapHeading;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CapHeading';
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import * as styledVars from '../styled/variables';
|
|
3
|
+
|
|
4
|
+
const headings = {
|
|
5
|
+
h0: {
|
|
6
|
+
fontSize: '28px',
|
|
7
|
+
fontWeight: '500',
|
|
8
|
+
color: styledVars.CAP_G01,
|
|
9
|
+
lineHeight: '36px',
|
|
10
|
+
},
|
|
11
|
+
h1: {
|
|
12
|
+
fontSize: '24px',
|
|
13
|
+
fontWeight: '500',
|
|
14
|
+
color: styledVars.CAP_G01,
|
|
15
|
+
lineHeight: '32px',
|
|
16
|
+
},
|
|
17
|
+
h2: {
|
|
18
|
+
fontSize: '20px',
|
|
19
|
+
fontWeight: '500',
|
|
20
|
+
color: styledVars.CAP_G01,
|
|
21
|
+
lineHeight: '28px',
|
|
22
|
+
},
|
|
23
|
+
h3: {
|
|
24
|
+
fontSize: '16px',
|
|
25
|
+
fontWeight: '500',
|
|
26
|
+
color: styledVars.CAP_G01,
|
|
27
|
+
lineHeight: '24px',
|
|
28
|
+
},
|
|
29
|
+
h4: {
|
|
30
|
+
fontSize: '14px',
|
|
31
|
+
fontWeight: '500',
|
|
32
|
+
color: styledVars.CAP_G01,
|
|
33
|
+
lineHeight: '20px',
|
|
34
|
+
},
|
|
35
|
+
h5: {
|
|
36
|
+
fontSize: '14px',
|
|
37
|
+
fontWeight: 'normal',
|
|
38
|
+
color: styledVars.CAP_G01,
|
|
39
|
+
lineHeight: '20px',
|
|
40
|
+
},
|
|
41
|
+
h6: {
|
|
42
|
+
color: styledVars.CAP_G04,
|
|
43
|
+
fontSize: '14px',
|
|
44
|
+
fontWeight: 'normal',
|
|
45
|
+
lineHeight: '20px',
|
|
46
|
+
},
|
|
47
|
+
h7: {
|
|
48
|
+
fontSize: '20px',
|
|
49
|
+
fontWeight: '500',
|
|
50
|
+
color: styledVars.CAP_G04,
|
|
51
|
+
lineHeight: '28px',
|
|
52
|
+
},
|
|
53
|
+
h8: {
|
|
54
|
+
fontSize: '14px',
|
|
55
|
+
fontWeight: '400',
|
|
56
|
+
color: styledVars.CAP_G01,
|
|
57
|
+
lineHeight: '20px',
|
|
58
|
+
},
|
|
59
|
+
h9: {
|
|
60
|
+
fontSize: '14px',
|
|
61
|
+
fontWeight: '500',
|
|
62
|
+
color: styledVars.CAP_WHITE,
|
|
63
|
+
lineHeight: '20px',
|
|
64
|
+
},
|
|
65
|
+
h10: {
|
|
66
|
+
fontSize: '12px',
|
|
67
|
+
fontWeight: '500',
|
|
68
|
+
color: styledVars.CAP_G01,
|
|
69
|
+
lineHeight: '16px',
|
|
70
|
+
},
|
|
71
|
+
label1: {
|
|
72
|
+
color: styledVars.CAP_G04,
|
|
73
|
+
fontSize: '12px',
|
|
74
|
+
fontWeight: 'normal',
|
|
75
|
+
lineHeight: '20px',
|
|
76
|
+
},
|
|
77
|
+
label2: {
|
|
78
|
+
color: styledVars.CAP_G01,
|
|
79
|
+
fontSize: '12px',
|
|
80
|
+
fontWeight: 'normal',
|
|
81
|
+
lineHeight: '20px',
|
|
82
|
+
},
|
|
83
|
+
label3: {
|
|
84
|
+
color: styledVars.CAP_G05,
|
|
85
|
+
fontSize: '12px',
|
|
86
|
+
fontWeight: 'normal',
|
|
87
|
+
lineHeight: '20px',
|
|
88
|
+
},
|
|
89
|
+
label4: {
|
|
90
|
+
color: styledVars.CAP_G04,
|
|
91
|
+
fontSize: '12px',
|
|
92
|
+
fontWeight: 'normal',
|
|
93
|
+
lineHeight: '16px',
|
|
94
|
+
},
|
|
95
|
+
label5: {
|
|
96
|
+
color: styledVars.CAP_G04,
|
|
97
|
+
fontSize: '16px',
|
|
98
|
+
fontWeight: 'normal',
|
|
99
|
+
lineHeight: '24px',
|
|
100
|
+
},
|
|
101
|
+
label6: {
|
|
102
|
+
color: styledVars.CAP_G01,
|
|
103
|
+
fontSize: '16px',
|
|
104
|
+
fontWeight: 'normal',
|
|
105
|
+
lineHeight: '24px',
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const headingStyles = css`
|
|
110
|
+
font-size: ${props => headings[props.type].fontSize};
|
|
111
|
+
font-weight: ${props => headings[props.type].fontWeight};
|
|
112
|
+
color: ${props => headings[props.type].color};
|
|
113
|
+
line-height: ${props => headings[props.type].lineHeight};
|
|
114
|
+
margin: 0;
|
|
115
|
+
padding: 0;
|
|
116
|
+
`;
|
|
117
|
+
|
|
118
|
+
export const HeadingWrapper = styled.div`
|
|
119
|
+
${headingStyles}
|
|
120
|
+
`;
|
|
121
|
+
|
|
122
|
+
export const HeadingSpan = styled.span`
|
|
123
|
+
${headingStyles}
|
|
124
|
+
display: inline-block;
|
|
125
|
+
`;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Alert } from 'antd';
|
|
4
|
+
import { InfoNoteWrapper } from './styles';
|
|
5
|
+
import CapLabel from '../CapLabel';
|
|
6
|
+
import CapRow from '../CapRow';
|
|
7
|
+
|
|
8
|
+
const Note = ({ noteText }) => (
|
|
9
|
+
<CapLabel.Inline type="label4" className="note-text">
|
|
10
|
+
{noteText}
|
|
11
|
+
</CapLabel.Inline>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
Note.propTypes = {
|
|
15
|
+
noteText: PropTypes.string,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const CapInfoNote = ({ message, style, noteText, type = 'info', className, ...rest }) => {
|
|
19
|
+
return (
|
|
20
|
+
<InfoNoteWrapper>
|
|
21
|
+
<Alert
|
|
22
|
+
message={(
|
|
23
|
+
<CapRow className="note-message-container">
|
|
24
|
+
<Note noteText={noteText} />:
|
|
25
|
+
<CapRow className="message-text">{message}</CapRow>
|
|
26
|
+
</CapRow>
|
|
27
|
+
)}
|
|
28
|
+
className={className}
|
|
29
|
+
type={type}
|
|
30
|
+
showIcon
|
|
31
|
+
style={{
|
|
32
|
+
marginTop: '0.857rem',
|
|
33
|
+
marginBottom: '0.857rem',
|
|
34
|
+
...style,
|
|
35
|
+
}}
|
|
36
|
+
{...rest}
|
|
37
|
+
/>
|
|
38
|
+
</InfoNoteWrapper>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
CapInfoNote.propTypes = {
|
|
43
|
+
message: PropTypes.node,
|
|
44
|
+
style: PropTypes.object,
|
|
45
|
+
noteText: PropTypes.string,
|
|
46
|
+
type: PropTypes.string,
|
|
47
|
+
className: PropTypes.string,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
CapInfoNote.defaultProps = {
|
|
51
|
+
type: 'info',
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default CapInfoNote;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CapInfoNote';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import * as styledVars from '../styled/variables';
|
|
3
|
+
|
|
4
|
+
export const InfoNoteWrapper = styled.div`
|
|
5
|
+
.note-text {
|
|
6
|
+
padding-left: ${styledVars.CAP_SPACE_24};
|
|
7
|
+
white-space: nowrap;
|
|
8
|
+
line-height: inherit;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.note-message-container {
|
|
12
|
+
display: flex;
|
|
13
|
+
.message-text {
|
|
14
|
+
margin-left: 0.22rem;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ant-alert {
|
|
19
|
+
padding: 8px 12px;
|
|
20
|
+
border-radius: ${styledVars.RADIUS_04};
|
|
21
|
+
|
|
22
|
+
.ant-alert-icon {
|
|
23
|
+
font-size: ${styledVars.ICON_SIZE_S};
|
|
24
|
+
top: 9px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.ant-alert-info {
|
|
28
|
+
background-color: ${styledVars.CAP_G09};
|
|
29
|
+
border: 1px solid ${styledVars.CAP_G07};
|
|
30
|
+
|
|
31
|
+
.ant-alert-icon {
|
|
32
|
+
color: ${styledVars.CAP_G01};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&.ant-alert-success {
|
|
37
|
+
background-color: ${styledVars.CAP_COLOR_01};
|
|
38
|
+
border: 1px solid ${styledVars.CAP_PRIMARY.base};
|
|
39
|
+
|
|
40
|
+
.ant-alert-icon {
|
|
41
|
+
color: ${styledVars.CAP_PRIMARY.base};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.ant-alert-warning {
|
|
46
|
+
background-color: ${styledVars.CAP_COLOR_02};
|
|
47
|
+
border: 1px solid ${styledVars.CAP_ORANGE};
|
|
48
|
+
|
|
49
|
+
.ant-alert-icon {
|
|
50
|
+
color: ${styledVars.CAP_ORANGE};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.ant-alert-error {
|
|
55
|
+
background-color: ${styledVars.CAP_COLOR_05};
|
|
56
|
+
border: 1px solid ${styledVars.CAP_RED};
|
|
57
|
+
|
|
58
|
+
.ant-alert-icon {
|
|
59
|
+
color: ${styledVars.CAP_RED};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Input } from 'antd';
|
|
4
|
+
import { WarningOutlined, CheckCircleOutlined } from '@ant-design/icons';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
import * as styledVars from '../styled/variables';
|
|
7
|
+
|
|
8
|
+
const StyledIcon = styled.span`
|
|
9
|
+
color: ${(props) => props.status === "error" && styledVars.CAP_RED};
|
|
10
|
+
color: ${(props) => props.status === "success" && styledVars.CAP_PRIMARY.base};
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
const CapInput = React.forwardRef((props, ref) => {
|
|
14
|
+
const {
|
|
15
|
+
alwaysShowFocus,
|
|
16
|
+
errorMessage,
|
|
17
|
+
isVerified,
|
|
18
|
+
suffix,
|
|
19
|
+
showSuffix = true,
|
|
20
|
+
...rest
|
|
21
|
+
} = props;
|
|
22
|
+
|
|
23
|
+
const inputRef = useRef(null);
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (alwaysShowFocus && inputRef.current) {
|
|
27
|
+
inputRef.current.focus();
|
|
28
|
+
}
|
|
29
|
+
}, [alwaysShowFocus]);
|
|
30
|
+
|
|
31
|
+
const inputSuffix = (errorMessage && (
|
|
32
|
+
<StyledIcon status="error">
|
|
33
|
+
<WarningOutlined />
|
|
34
|
+
</StyledIcon>
|
|
35
|
+
)) || (isVerified && (
|
|
36
|
+
<StyledIcon status="success">
|
|
37
|
+
<CheckCircleOutlined />
|
|
38
|
+
</StyledIcon>
|
|
39
|
+
)) || suffix || null;
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Input
|
|
43
|
+
{...rest}
|
|
44
|
+
ref={ref || inputRef}
|
|
45
|
+
suffix={showSuffix === false ? null : inputSuffix}
|
|
46
|
+
status={errorMessage ? 'error' : undefined}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
CapInput.displayName = 'CapInput';
|
|
52
|
+
|
|
53
|
+
CapInput.propTypes = {
|
|
54
|
+
alwaysShowFocus: PropTypes.bool,
|
|
55
|
+
errorMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
56
|
+
isVerified: PropTypes.bool,
|
|
57
|
+
size: PropTypes.oneOf(['large', 'middle', 'small']),
|
|
58
|
+
suffix: PropTypes.node,
|
|
59
|
+
showSuffix: PropTypes.bool,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
CapInput.defaultProps = {
|
|
63
|
+
size: 'large',
|
|
64
|
+
showSuffix: true,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default CapInput;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { InputNumber } from 'antd';
|
|
4
|
+
|
|
5
|
+
const CapInputNumber = React.forwardRef((props, ref) => {
|
|
6
|
+
const { size = 'large', ...rest } = props;
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<InputNumber
|
|
10
|
+
{...rest}
|
|
11
|
+
ref={ref}
|
|
12
|
+
size={size}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
CapInputNumber.displayName = 'CapInputNumber';
|
|
18
|
+
|
|
19
|
+
CapInputNumber.propTypes = {
|
|
20
|
+
size: PropTypes.oneOf(['large', 'middle', 'small']),
|
|
21
|
+
min: PropTypes.number,
|
|
22
|
+
max: PropTypes.number,
|
|
23
|
+
step: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
24
|
+
precision: PropTypes.number,
|
|
25
|
+
decimalSeparator: PropTypes.string,
|
|
26
|
+
formatter: PropTypes.func,
|
|
27
|
+
parser: PropTypes.func,
|
|
28
|
+
controls: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
|
|
29
|
+
keyboard: PropTypes.bool,
|
|
30
|
+
stringMode: PropTypes.bool,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
CapInputNumber.defaultProps = {
|
|
34
|
+
size: 'large',
|
|
35
|
+
keyboard: true,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default CapInputNumber;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Input } from 'antd';
|
|
4
|
+
|
|
5
|
+
const { Search } = Input;
|
|
6
|
+
|
|
7
|
+
const CapInputSearch = React.forwardRef((props, ref) => {
|
|
8
|
+
const { size = 'large', ...rest } = props;
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<Search
|
|
12
|
+
{...rest}
|
|
13
|
+
ref={ref}
|
|
14
|
+
size={size}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
CapInputSearch.displayName = 'CapInputSearch';
|
|
20
|
+
|
|
21
|
+
CapInputSearch.propTypes = {
|
|
22
|
+
size: PropTypes.oneOf(['large', 'middle', 'small']),
|
|
23
|
+
enterButton: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
|
|
24
|
+
loading: PropTypes.bool,
|
|
25
|
+
onSearch: PropTypes.func,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
CapInputSearch.defaultProps = {
|
|
29
|
+
size: 'large',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default CapInputSearch;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Input } from 'antd';
|
|
4
|
+
|
|
5
|
+
const { TextArea } = Input;
|
|
6
|
+
|
|
7
|
+
const CapInputTextArea = React.forwardRef((props, ref) => {
|
|
8
|
+
const { size = 'large', ...rest } = props;
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<TextArea
|
|
12
|
+
{...rest}
|
|
13
|
+
ref={ref}
|
|
14
|
+
size={size}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
CapInputTextArea.displayName = 'CapInputTextArea';
|
|
20
|
+
|
|
21
|
+
CapInputTextArea.propTypes = {
|
|
22
|
+
size: PropTypes.oneOf(['large', 'middle', 'small']),
|
|
23
|
+
autoSize: PropTypes.oneOfType([
|
|
24
|
+
PropTypes.bool,
|
|
25
|
+
PropTypes.shape({
|
|
26
|
+
minRows: PropTypes.number,
|
|
27
|
+
maxRows: PropTypes.number,
|
|
28
|
+
}),
|
|
29
|
+
]),
|
|
30
|
+
rows: PropTypes.number,
|
|
31
|
+
maxLength: PropTypes.number,
|
|
32
|
+
showCount: PropTypes.oneOfType([
|
|
33
|
+
PropTypes.bool,
|
|
34
|
+
PropTypes.shape({
|
|
35
|
+
formatter: PropTypes.func,
|
|
36
|
+
}),
|
|
37
|
+
]),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
CapInputTextArea.defaultProps = {
|
|
41
|
+
size: 'large',
|
|
42
|
+
rows: 4,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default CapInputTextArea;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* CapInput Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the CapInput component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
const scope = 'blaze.components.CapInput';
|
|
9
|
+
|
|
10
|
+
export default defineMessages({
|
|
11
|
+
placeholder: {
|
|
12
|
+
id: `${scope}.placeholder`,
|
|
13
|
+
defaultMessage: 'Enter text...',
|
|
14
|
+
},
|
|
15
|
+
searchPlaceholder: {
|
|
16
|
+
id: `${scope}.searchPlaceholder`,
|
|
17
|
+
defaultMessage: 'Search...',
|
|
18
|
+
},
|
|
19
|
+
textAreaPlaceholder: {
|
|
20
|
+
id: `${scope}.textAreaPlaceholder`,
|
|
21
|
+
defaultMessage: 'Enter your text here...',
|
|
22
|
+
},
|
|
23
|
+
numberPlaceholder: {
|
|
24
|
+
id: `${scope}.numberPlaceholder`,
|
|
25
|
+
defaultMessage: 'Enter number...',
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
import * as styledVars from '../styled/variables';
|
|
3
|
+
|
|
4
|
+
export const inputStyles = css`
|
|
5
|
+
&.ant-input,
|
|
6
|
+
&.ant-input-affix-wrapper,
|
|
7
|
+
&.ant-input-number,
|
|
8
|
+
&.ant-input-textarea {
|
|
9
|
+
font-family: ${styledVars.FONT_FAMILY};
|
|
10
|
+
border-radius: ${styledVars.RADIUS_04};
|
|
11
|
+
transition: ${styledVars.TRANSITION_ALL};
|
|
12
|
+
|
|
13
|
+
&:hover {
|
|
14
|
+
border-color: ${styledVars.CAP_G11};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&:focus,
|
|
18
|
+
&.ant-input-affix-wrapper-focused {
|
|
19
|
+
border-color: ${styledVars.CAP_G01};
|
|
20
|
+
box-shadow: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.ant-input-status-error,
|
|
24
|
+
&.ant-input-affix-wrapper-status-error,
|
|
25
|
+
&.ant-input-number-status-error {
|
|
26
|
+
border-color: ${styledVars.CAP_RED};
|
|
27
|
+
|
|
28
|
+
&:hover {
|
|
29
|
+
border-color: ${styledVars.CAP_RED};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:focus,
|
|
33
|
+
&.ant-input-affix-wrapper-focused {
|
|
34
|
+
border-color: ${styledVars.CAP_RED};
|
|
35
|
+
box-shadow: none;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&.ant-input-disabled,
|
|
40
|
+
&.ant-input-affix-wrapper-disabled {
|
|
41
|
+
background-color: ${styledVars.CAP_G08};
|
|
42
|
+
cursor: not-allowed;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Size variations */
|
|
47
|
+
&.ant-input-lg,
|
|
48
|
+
&.ant-input-affix-wrapper-lg {
|
|
49
|
+
font-size: 14px;
|
|
50
|
+
padding: 10px 12px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* TextArea specific */
|
|
54
|
+
&.ant-input-textarea {
|
|
55
|
+
.ant-input {
|
|
56
|
+
font-family: ${styledVars.FONT_FAMILY};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Number input specific */
|
|
61
|
+
&.ant-input-number {
|
|
62
|
+
width: 100%;
|
|
63
|
+
|
|
64
|
+
.ant-input-number-handler-wrap {
|
|
65
|
+
opacity: 1;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Search input specific */
|
|
70
|
+
&.ant-input-search {
|
|
71
|
+
.ant-input-search-button {
|
|
72
|
+
background-color: ${styledVars.CAP_PRIMARY.base};
|
|
73
|
+
border-color: ${styledVars.CAP_PRIMARY.base};
|
|
74
|
+
|
|
75
|
+
&:hover {
|
|
76
|
+
background-color: ${styledVars.CAP_PRIMARY.hover};
|
|
77
|
+
border-color: ${styledVars.CAP_PRIMARY.hover};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
`;
|