@capillarytech/blaze-ui 0.1.6-alpha.28 → 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/loadable.js +9 -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/loadable.js +4 -4
- package/CapTooltip/CapTooltip.js +36 -0
- package/CapTooltip/index.js +1 -0
- package/CapTooltip/styles.js +42 -0
- package/CapUnifiedSelect/CapUnifiedSelect.js +51 -304
- package/CapUnifiedSelect/index.js +4 -1
- package/CapUnifiedSelect/loadable.js +3 -0
- package/CapUnifiedSelect/styles.js +174 -62
- 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/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/{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 +4 -4
- 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 +38 -335
- package/dist/esm/CapUnifiedSelect/index.js +3 -1
- package/dist/esm/CapUnifiedSelect/loadable.js +4 -0
- package/dist/esm/CapUnifiedSelect/styles.js +3 -19
- package/dist/esm/index.js +1 -5
- package/dist/index.js +0 -27
- package/dist/index.js.LICENSE.txt +7 -0
- package/index.js +1 -5
- package/package.json +10 -8
- package/CapSkeleton/CapSkeleton.js +0 -17
- package/CapSkeleton/index.js +0 -1
- package/CapSpin/CapSpin.js +0 -23
- package/CapSpin/index.js +0 -1
- package/CapTestSelect/CapTestSelect.js +0 -47
- package/CapTestSelect/index.js +0 -1
- package/components/CapInput/CapInput.js +0 -67
- package/components/CapInput/Number.js +0 -38
- package/components/CapInput/Search.js +0 -32
- package/components/CapInput/TextArea.js +0 -45
- package/components/CapInput/index.js +0 -10
- package/components/CapInput/messages.js +0 -27
- package/components/CapInput/styles.js +0 -81
- package/components/CapSkeleton/CapSkeleton.js +0 -17
- package/components/CapSkeleton/index.js +0 -1
- package/components/CapSpin/CapSpin.js +0 -23
- package/components/CapSpin/index.js +0 -1
- package/components/CapTable/CapTable.js +0 -146
- package/components/CapTable/index.js +0 -3
- package/components/CapTable/loadable.js +0 -13
- package/components/CapTable/styles.js +0 -134
- package/components/CapTestSelect/CapTestSelect.js +0 -47
- package/components/CapTestSelect/index.js +0 -1
- package/components/CapUnifiedSelect/CapUnifiedSelect.js +0 -374
- package/components/CapUnifiedSelect/index.js +0 -1
- package/components/CapUnifiedSelect/messages.js +0 -24
- package/components/CapUnifiedSelect/styles.js +0 -111
- package/components/LocaleHoc/index.js +0 -38
- package/components/index.js +0 -14
- package/components/styled/index.js +0 -6
- package/components/styled/variables.js +0 -89
- package/components/translations/en.js +0 -331
- package/dist/CapSkeleton/CapSkeleton.js +0 -29
- package/dist/CapSkeleton/index.js +0 -13
- package/dist/CapSpin/CapSpin.js +0 -35
- package/dist/CapSpin/index.js +0 -13
- package/dist/CapTestSelect/CapTestSelect.js +0 -40
- package/dist/CapTestSelect/index.js +0 -13
- package/dist/CapUnifiedSelect/CapUnifiedSelect.js +0 -405
- package/dist/CapUnifiedSelect/index.js +0 -13
- package/dist/CapUnifiedSelect/messages.js +0 -29
- package/dist/CapUnifiedSelect/styles.js +0 -39
- package/dist/components/CapInput/CapInput.js +0 -66
- package/dist/components/CapInput/Number.js +0 -42
- package/dist/components/CapInput/Search.js +0 -35
- package/dist/components/CapInput/TextArea.js +0 -42
- package/dist/components/CapInput/index.js +0 -15
- package/dist/components/CapInput/messages.js +0 -32
- package/dist/components/CapInput/styles.js +0 -11
- 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/CapTable/CapTable.js +0 -148
- package/dist/components/CapTable/index.js +0 -9
- package/dist/components/CapTable/loadable.js +0 -23
- package/dist/components/CapTable/styles.js +0 -26
- 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/components/LocaleHoc/index.js +0 -40
- package/dist/components/index.js +0 -66
- package/dist/components/styled/index.js +0 -22
- package/dist/components/styled/variables.js +0 -94
- package/dist/components/translations/en.js +0 -335
- package/dist/esm/CapSkeleton/index.js +0 -1
- package/dist/esm/CapSpin/CapSpin.js +0 -28
- package/dist/esm/CapSpin/index.js +0 -1
- package/dist/esm/CapTestSelect/CapTestSelect.js +0 -34
- package/dist/esm/CapTestSelect/index.js +0 -1
- package/dist/esm/components/CapInput/CapInput.js +0 -57
- package/dist/esm/components/CapInput/Number.js +0 -35
- package/dist/esm/components/CapInput/Search.js +0 -28
- package/dist/esm/components/CapInput/TextArea.js +0 -35
- package/dist/esm/components/CapInput/index.js +0 -8
- package/dist/esm/components/CapInput/messages.js +0 -25
- package/dist/esm/components/CapInput/styles.js +0 -3
- package/dist/esm/components/CapSkeleton/CapSkeleton.js +0 -22
- 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/CapTable.js +0 -140
- package/dist/esm/components/CapTable/index.js +0 -2
- package/dist/esm/components/CapTable/loadable.js +0 -12
- package/dist/esm/components/CapTable/styles.js +0 -17
- 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/messages.js +0 -23
- package/dist/esm/components/CapUnifiedSelect/styles.js +0 -31
- package/dist/esm/components/LocaleHoc/index.js +0 -31
- package/dist/esm/components/index.js +0 -15
- package/dist/esm/components/styled/index.js +0 -5
- package/dist/esm/components/styled/variables.js +0 -88
- package/dist/esm/components/translations/en.js +0 -329
- package/dist/esm/utils/index.js +0 -1
- package/dist/esm/utils/withStyles.js +0 -23
- package/dist/esm/withStyles.js +0 -23
- package/dist/utils/index.js +0 -13
- package/dist/utils/withStyles.js +0 -29
- package/dist/withStyles.js +0 -29
- package/utils/index.js +0 -1
- package/utils/withStyles.js +0 -24
package/CapSpin/CapSpin.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CapSpin - Migrated to Ant Design v5
|
|
3
|
-
*/
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import { Spin } from 'antd';
|
|
7
|
-
|
|
8
|
-
const CapSpin = ({ className, ...rest }) => (
|
|
9
|
-
<Spin className={className} {...rest} />
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
CapSpin.propTypes = {
|
|
13
|
-
className: PropTypes.string,
|
|
14
|
-
size: PropTypes.oneOf(['small', 'default', 'large']),
|
|
15
|
-
spinning: PropTypes.bool,
|
|
16
|
-
tip: PropTypes.string,
|
|
17
|
-
delay: PropTypes.number,
|
|
18
|
-
indicator: PropTypes.node,
|
|
19
|
-
fullscreen: PropTypes.bool,
|
|
20
|
-
wrapperClassName: PropTypes.string
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default CapSpin;
|
package/CapSpin/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './CapSpin';
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Select } from 'antd';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Test component to verify Ant Design v5 Select integration
|
|
7
|
-
* This is a simple wrapper for testing purposes only
|
|
8
|
-
*/
|
|
9
|
-
const CapTestSelect = (props) => {
|
|
10
|
-
return <Select {...props} />;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
CapTestSelect.propTypes = {
|
|
14
|
-
// Common Select props from antd
|
|
15
|
-
allowClear: PropTypes.bool,
|
|
16
|
-
defaultValue: PropTypes.oneOfType([
|
|
17
|
-
PropTypes.string,
|
|
18
|
-
PropTypes.number,
|
|
19
|
-
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))
|
|
20
|
-
]),
|
|
21
|
-
disabled: PropTypes.bool,
|
|
22
|
-
loading: PropTypes.bool,
|
|
23
|
-
mode: PropTypes.oneOf(['multiple', 'tags']),
|
|
24
|
-
placeholder: PropTypes.string,
|
|
25
|
-
showSearch: PropTypes.bool,
|
|
26
|
-
value: PropTypes.oneOfType([
|
|
27
|
-
PropTypes.string,
|
|
28
|
-
PropTypes.number,
|
|
29
|
-
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))
|
|
30
|
-
]),
|
|
31
|
-
options: PropTypes.arrayOf(
|
|
32
|
-
PropTypes.shape({
|
|
33
|
-
label: PropTypes.node,
|
|
34
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
35
|
-
disabled: PropTypes.bool
|
|
36
|
-
})
|
|
37
|
-
)
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
CapTestSelect.defaultProps = {
|
|
41
|
-
allowClear: false,
|
|
42
|
-
disabled: false,
|
|
43
|
-
loading: false,
|
|
44
|
-
showSearch: false
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export default CapTestSelect;
|
package/CapTestSelect/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './CapTestSelect';
|
|
@@ -1,67 +0,0 @@
|
|
|
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;
|
|
@@ -1,38 +0,0 @@
|
|
|
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;
|
|
@@ -1,32 +0,0 @@
|
|
|
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;
|
|
@@ -1,45 +0,0 @@
|
|
|
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;
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,81 +0,0 @@
|
|
|
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
|
-
`;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CapSkeleton - Migrated to Ant Design v5
|
|
3
|
-
*/
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import { Skeleton } from 'antd';
|
|
7
|
-
|
|
8
|
-
const CapSkeleton = ({ className, ...rest }) => {
|
|
9
|
-
const combinedClassName = `cap-skeleton-v2 ${className || ''}`.trim();
|
|
10
|
-
return <Skeleton className={combinedClassName} {...rest} />;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
CapSkeleton.propTypes = {
|
|
14
|
-
className: PropTypes.string
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default CapSkeleton;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './CapSkeleton';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CapSpin - Migrated to Ant Design v5
|
|
3
|
-
*/
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import { Spin } from 'antd';
|
|
7
|
-
|
|
8
|
-
const CapSpin = ({ className, ...rest }) => (
|
|
9
|
-
<Spin className={className} {...rest} />
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
CapSpin.propTypes = {
|
|
13
|
-
className: PropTypes.string,
|
|
14
|
-
size: PropTypes.oneOf(['small', 'default', 'large']),
|
|
15
|
-
spinning: PropTypes.bool,
|
|
16
|
-
tip: PropTypes.string,
|
|
17
|
-
delay: PropTypes.number,
|
|
18
|
-
indicator: PropTypes.node,
|
|
19
|
-
fullscreen: PropTypes.bool,
|
|
20
|
-
wrapperClassName: PropTypes.string
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default CapSpin;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './CapSpin';
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CapTable - Migrated to Ant Design v5
|
|
3
|
-
* A table component that supports:
|
|
4
|
-
* - Infinite scrolling with virtualization
|
|
5
|
-
* - Sequential data loading
|
|
6
|
-
* - Optimized scroll performance
|
|
7
|
-
*/
|
|
8
|
-
import React, { useEffect, useCallback, useState, useRef } from 'react';
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
import { debounce } from 'lodash';
|
|
11
|
-
import classNames from 'classnames';
|
|
12
|
-
import { StyledTable } from './styles';
|
|
13
|
-
import LocaleHoc from '../LocaleHoc';
|
|
14
|
-
|
|
15
|
-
const SCROLL_THRESHOLD = 80; // Percentage of scroll to trigger load
|
|
16
|
-
const DEBOUNCE_DELAY = 250; // ms to wait between scroll events
|
|
17
|
-
const DEFAULT_ROW_HEIGHT = 54;
|
|
18
|
-
const DEFAULT_SCROLL_HEIGHT = 400;
|
|
19
|
-
|
|
20
|
-
const CapTable = ({
|
|
21
|
-
id,
|
|
22
|
-
className,
|
|
23
|
-
children,
|
|
24
|
-
infiniteScroll,
|
|
25
|
-
pagination,
|
|
26
|
-
dataSource,
|
|
27
|
-
offset_limit,
|
|
28
|
-
setPagination,
|
|
29
|
-
scroll,
|
|
30
|
-
showLoader,
|
|
31
|
-
...rest
|
|
32
|
-
}) => {
|
|
33
|
-
const scrollRef = useRef(null);
|
|
34
|
-
const [hasMore, setHasMore] = useState(true);
|
|
35
|
-
const currentOffsetRef = useRef(0);
|
|
36
|
-
|
|
37
|
-
const loadMore = useCallback(() => {
|
|
38
|
-
if (!showLoader && hasMore) {
|
|
39
|
-
const nextOffset = currentOffsetRef.current + 1;
|
|
40
|
-
const newOffsetLimit = {
|
|
41
|
-
...offset_limit,
|
|
42
|
-
offset: nextOffset
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
currentOffsetRef.current = nextOffset;
|
|
46
|
-
setPagination(newOffsetLimit);
|
|
47
|
-
}
|
|
48
|
-
}, [showLoader, hasMore, setPagination, offset_limit]);
|
|
49
|
-
|
|
50
|
-
const handleScroll = useCallback(
|
|
51
|
-
debounce((event) => {
|
|
52
|
-
const target = event.target;
|
|
53
|
-
if (!target || !infiniteScroll || !hasMore || showLoader) return;
|
|
54
|
-
|
|
55
|
-
const scrollTop = Math.ceil(target.scrollTop);
|
|
56
|
-
const visibleHeight = target.clientHeight;
|
|
57
|
-
const totalHeight = target.scrollHeight;
|
|
58
|
-
|
|
59
|
-
const scrolledPercentage = (scrollTop + visibleHeight) / totalHeight * 100;
|
|
60
|
-
|
|
61
|
-
if (scrolledPercentage >= SCROLL_THRESHOLD) {
|
|
62
|
-
loadMore();
|
|
63
|
-
}
|
|
64
|
-
}, DEBOUNCE_DELAY),
|
|
65
|
-
[infiniteScroll, showLoader, hasMore, loadMore]
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
// Setup scroll listener and handle initial load
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
const tableBody = document.querySelector(`#${id} .ant-table-body`);
|
|
71
|
-
if (!tableBody) return;
|
|
72
|
-
|
|
73
|
-
scrollRef.current = tableBody;
|
|
74
|
-
tableBody.addEventListener('scroll', handleScroll, { passive: true });
|
|
75
|
-
|
|
76
|
-
// Check if initial load needed
|
|
77
|
-
const shouldLoadInitially = tableBody.scrollHeight <= tableBody.clientHeight
|
|
78
|
-
&& !showLoader
|
|
79
|
-
&& hasMore;
|
|
80
|
-
|
|
81
|
-
if (shouldLoadInitially) {
|
|
82
|
-
currentOffsetRef.current = 0;
|
|
83
|
-
loadMore();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Cleanup
|
|
87
|
-
return () => {
|
|
88
|
-
scrollRef.current?.removeEventListener('scroll', handleScroll);
|
|
89
|
-
handleScroll.cancel();
|
|
90
|
-
};
|
|
91
|
-
}, [id, handleScroll, showLoader, hasMore, loadMore]);
|
|
92
|
-
|
|
93
|
-
// Handle data changes
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
if (!dataSource?.length) {
|
|
96
|
-
currentOffsetRef.current = 0;
|
|
97
|
-
setHasMore(true);
|
|
98
|
-
} else {
|
|
99
|
-
setHasMore(true);
|
|
100
|
-
}
|
|
101
|
-
}, [dataSource]);
|
|
102
|
-
|
|
103
|
-
const tableClassName = classNames(
|
|
104
|
-
'cap-table-v2',
|
|
105
|
-
className,
|
|
106
|
-
{
|
|
107
|
-
'show-loader': showLoader,
|
|
108
|
-
'infinite-scroll': infiniteScroll,
|
|
109
|
-
'has-more': hasMore
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
return (
|
|
114
|
-
<StyledTable
|
|
115
|
-
id={id}
|
|
116
|
-
className={tableClassName}
|
|
117
|
-
dataSource={dataSource}
|
|
118
|
-
pagination={false}
|
|
119
|
-
scroll={{
|
|
120
|
-
x: scroll?.x,
|
|
121
|
-
y: scroll?.y || DEFAULT_SCROLL_HEIGHT,
|
|
122
|
-
scrollToFirstRowOnChange: false
|
|
123
|
-
}}
|
|
124
|
-
virtual={infiniteScroll}
|
|
125
|
-
rowHeight={DEFAULT_ROW_HEIGHT}
|
|
126
|
-
{...rest}
|
|
127
|
-
>
|
|
128
|
-
{children}
|
|
129
|
-
</StyledTable>
|
|
130
|
-
);
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
CapTable.propTypes = {
|
|
134
|
-
id: PropTypes.string.isRequired,
|
|
135
|
-
className: PropTypes.string,
|
|
136
|
-
children: PropTypes.node,
|
|
137
|
-
infiniteScroll: PropTypes.bool,
|
|
138
|
-
pagination: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
|
|
139
|
-
dataSource: PropTypes.array,
|
|
140
|
-
offset_limit: PropTypes.object,
|
|
141
|
-
setPagination: PropTypes.func,
|
|
142
|
-
scroll: PropTypes.object,
|
|
143
|
-
showLoader: PropTypes.bool,
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
export default LocaleHoc(CapTable, { key: 'CapTable' });
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import CapSkeleton from '../CapSkeleton';
|
|
2
|
-
import { loadable } from '@capillarytech/cap-ui-utils';
|
|
3
|
-
import React, { Suspense } from 'react';
|
|
4
|
-
|
|
5
|
-
const LoadableComponent = loadable(() => import('./CapTable'));
|
|
6
|
-
|
|
7
|
-
const CapTableLoadable = (props) => (
|
|
8
|
-
<Suspense fallback={<CapSkeleton />}>
|
|
9
|
-
<LoadableComponent {...props} />
|
|
10
|
-
</Suspense>
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
export default CapTableLoadable;
|