@capillarytech/blaze-ui 0.1.6-alpha.3 → 0.1.6-alpha.31

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.
Files changed (136) hide show
  1. package/components/CapInput/CapInput.js +51 -0
  2. package/{CapInput → components/CapInput}/Number.js +13 -18
  3. package/components/CapInput/Search.js +28 -0
  4. package/components/CapInput/TextArea.js +35 -0
  5. package/{CapInput → components/CapInput}/messages.js +6 -8
  6. package/components/CapInput/styles.js +3 -0
  7. package/components/CapSkeleton/CapSkeleton.js +21 -0
  8. package/components/CapSkeleton/index.js +1 -0
  9. package/components/CapSpin/CapSpin.js +27 -0
  10. package/components/CapSpin/index.js +1 -0
  11. package/{CapTable → components/CapTable}/CapTable.js +53 -75
  12. package/components/CapTable/loadable.js +8 -0
  13. package/components/CapTable/styles.js +17 -0
  14. package/components/CapTestSelect/CapTestSelect.js +34 -0
  15. package/components/CapTestSelect/index.js +1 -0
  16. package/components/CapUnifiedSelect/CapUnifiedSelect.js +344 -0
  17. package/components/CapUnifiedSelect/index.js +1 -0
  18. package/components/CapUnifiedSelect/styles.js +31 -0
  19. package/components/LocaleHoc/index.js +33 -0
  20. package/{index.js → components/index.js} +5 -1
  21. package/{styled → components/styled}/variables.js +3 -4
  22. package/dist/components/CapSkeleton/CapSkeleton.js +29 -0
  23. package/dist/components/CapSkeleton/index.js +13 -0
  24. package/dist/components/CapSpin/CapSpin.js +35 -0
  25. package/dist/components/CapSpin/index.js +13 -0
  26. package/dist/{CapTable → components/CapTable}/loadable.js +4 -4
  27. package/dist/components/CapTestSelect/CapTestSelect.js +40 -0
  28. package/dist/components/CapTestSelect/index.js +13 -0
  29. package/dist/components/CapUnifiedSelect/CapUnifiedSelect.js +406 -0
  30. package/dist/components/CapUnifiedSelect/index.js +13 -0
  31. package/dist/components/CapUnifiedSelect/messages.js +29 -0
  32. package/dist/components/CapUnifiedSelect/styles.js +39 -0
  33. package/dist/{index.js → components/index.js} +27 -0
  34. package/{CapInput → dist/esm/components/CapInput}/index.js +1 -3
  35. package/dist/esm/{CapRow/CapRow.js → components/CapSkeleton/CapSkeleton.js} +12 -12
  36. package/dist/esm/components/CapSkeleton/index.js +1 -0
  37. package/dist/esm/components/CapSpin/CapSpin.js +28 -0
  38. package/dist/esm/components/CapSpin/index.js +1 -0
  39. package/{CapTable → dist/esm/components/CapTable}/index.js +1 -2
  40. package/dist/esm/components/CapTable/loadable.js +12 -0
  41. package/dist/esm/components/CapTestSelect/CapTestSelect.js +34 -0
  42. package/dist/esm/components/CapTestSelect/index.js +1 -0
  43. package/dist/esm/components/CapUnifiedSelect/CapUnifiedSelect.js +398 -0
  44. package/dist/esm/components/CapUnifiedSelect/index.js +1 -0
  45. package/{CapUnifiedSelect → dist/esm/components/CapUnifiedSelect}/messages.js +7 -8
  46. package/dist/esm/components/CapUnifiedSelect/styles.js +31 -0
  47. package/dist/esm/{index.js → components/index.js} +5 -1
  48. package/{styled → dist/esm/components/styled}/index.js +1 -2
  49. package/{translations → dist/esm/components/translations}/en.js +32 -34
  50. package/dist/esm/utils/index.js +1 -0
  51. package/dist/esm/utils/withStyles.js +23 -0
  52. package/dist/utils/index.js +13 -0
  53. package/dist/utils/withStyles.js +29 -0
  54. package/package.json +6 -10
  55. package/utils/index.js +1 -0
  56. package/utils/withStyles.js +23 -0
  57. package/CapHeading/CapHeading.js +0 -71
  58. package/CapHeading/index.js +0 -1
  59. package/CapHeading/styles.js +0 -125
  60. package/CapInfoNote/CapInfoNote.js +0 -54
  61. package/CapInfoNote/index.js +0 -1
  62. package/CapInfoNote/styles.js +0 -63
  63. package/CapInput/CapInput.js +0 -67
  64. package/CapInput/Search.js +0 -32
  65. package/CapInput/TextArea.js +0 -45
  66. package/CapInput/loadable.js +0 -9
  67. package/CapInput/styles.js +0 -81
  68. package/CapLabel/CapLabel.js +0 -106
  69. package/CapLabel/index.js +0 -1
  70. package/CapLabel/styles.js +0 -221
  71. package/CapRow/CapRow.js +0 -22
  72. package/CapRow/index.js +0 -1
  73. package/CapRow/styles.js +0 -9
  74. package/CapTable/loadable.js +0 -13
  75. package/CapTable/styles.js +0 -134
  76. package/CapTooltip/CapTooltip.js +0 -36
  77. package/CapTooltip/index.js +0 -1
  78. package/CapTooltip/styles.js +0 -42
  79. package/CapUnifiedSelect/CapUnifiedSelect.js +0 -121
  80. package/CapUnifiedSelect/index.js +0 -4
  81. package/CapUnifiedSelect/loadable.js +0 -3
  82. package/CapUnifiedSelect/styles.js +0 -223
  83. package/LocaleHoc/index.js +0 -38
  84. package/dist/235.index.js +0 -2
  85. package/dist/235.index.js.LICENSE.txt +0 -29
  86. package/dist/603.index.js +0 -1
  87. package/dist/esm/CapHeading/CapHeading.js +0 -41
  88. package/dist/esm/CapHeading/index.js +0 -1
  89. package/dist/esm/CapHeading/styles.js +0 -123
  90. package/dist/esm/CapInfoNote/CapInfoNote.js +0 -62
  91. package/dist/esm/CapInfoNote/index.js +0 -1
  92. package/dist/esm/CapInfoNote/styles.js +0 -6
  93. package/dist/esm/CapInput/loadable.js +0 -9
  94. package/dist/esm/CapLabel/CapLabel.js +0 -50
  95. package/dist/esm/CapLabel/index.js +0 -1
  96. package/dist/esm/CapLabel/styles.js +0 -219
  97. package/dist/esm/CapRow/index.js +0 -1
  98. package/dist/esm/CapRow/styles.js +0 -5
  99. package/dist/esm/CapTable/loadable.js +0 -12
  100. package/dist/esm/CapTooltip/CapTooltip.js +0 -34
  101. package/dist/esm/CapTooltip/index.js +0 -1
  102. package/dist/esm/CapTooltip/styles.js +0 -6
  103. package/dist/esm/CapUnifiedSelect/CapUnifiedSelect.js +0 -101
  104. package/dist/esm/CapUnifiedSelect/index.js +0 -3
  105. package/dist/esm/CapUnifiedSelect/loadable.js +0 -4
  106. package/dist/esm/CapUnifiedSelect/styles.js +0 -15
  107. package/dist/index.js.LICENSE.txt +0 -7
  108. /package/{dist/esm → components}/CapInput/index.js +0 -0
  109. /package/{dist/esm → components}/CapTable/index.js +0 -0
  110. /package/{dist/esm → components}/CapUnifiedSelect/messages.js +0 -0
  111. /package/{dist/esm → components}/styled/index.js +0 -0
  112. /package/{dist/esm → components}/translations/en.js +0 -0
  113. /package/dist/{CapInput → components/CapInput}/CapInput.js +0 -0
  114. /package/dist/{CapInput → components/CapInput}/Number.js +0 -0
  115. /package/dist/{CapInput → components/CapInput}/Search.js +0 -0
  116. /package/dist/{CapInput → components/CapInput}/TextArea.js +0 -0
  117. /package/dist/{CapInput → components/CapInput}/index.js +0 -0
  118. /package/dist/{CapInput → components/CapInput}/messages.js +0 -0
  119. /package/dist/{CapInput → components/CapInput}/styles.js +0 -0
  120. /package/dist/{CapTable → components/CapTable}/CapTable.js +0 -0
  121. /package/dist/{CapTable → components/CapTable}/index.js +0 -0
  122. /package/dist/{CapTable → components/CapTable}/styles.js +0 -0
  123. /package/dist/{LocaleHoc → components/LocaleHoc}/index.js +0 -0
  124. /package/dist/{styled → components/styled}/index.js +0 -0
  125. /package/dist/{styled → components/styled}/variables.js +0 -0
  126. /package/dist/{translations → components/translations}/en.js +0 -0
  127. /package/dist/esm/{CapInput → components/CapInput}/CapInput.js +0 -0
  128. /package/dist/esm/{CapInput → components/CapInput}/Number.js +0 -0
  129. /package/dist/esm/{CapInput → components/CapInput}/Search.js +0 -0
  130. /package/dist/esm/{CapInput → components/CapInput}/TextArea.js +0 -0
  131. /package/dist/esm/{CapInput → components/CapInput}/messages.js +0 -0
  132. /package/dist/esm/{CapInput → components/CapInput}/styles.js +0 -0
  133. /package/dist/esm/{CapTable → components/CapTable}/CapTable.js +0 -0
  134. /package/dist/esm/{CapTable → components/CapTable}/styles.js +0 -0
  135. /package/dist/esm/{LocaleHoc → components/LocaleHoc}/index.js +0 -0
  136. /package/dist/esm/{styled → components/styled}/variables.js +0 -0
@@ -0,0 +1,51 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React, { useRef, useEffect } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { Input } from 'antd';
5
+ import { WarningOutlined, CheckCircleOutlined } from '@ant-design/icons';
6
+ import styled from 'styled-components';
7
+ import * as styledVars from '../styled/variables';
8
+ const StyledIcon = styled.span.withConfig({
9
+ displayName: "StyledIcon",
10
+ componentId: "sc-1ghbg8a-0"
11
+ })(["color:", ";color:", ";"], props => props.status === "error" && styledVars.CAP_RED, props => props.status === "success" && styledVars.CAP_PRIMARY.base);
12
+ const CapInput = /*#__PURE__*/React.forwardRef((props, ref) => {
13
+ const {
14
+ alwaysShowFocus,
15
+ errorMessage,
16
+ isVerified,
17
+ suffix,
18
+ showSuffix = true,
19
+ ...rest
20
+ } = props;
21
+ const inputRef = useRef(null);
22
+ useEffect(() => {
23
+ if (alwaysShowFocus && inputRef.current) {
24
+ inputRef.current.focus();
25
+ }
26
+ }, [alwaysShowFocus]);
27
+ const inputSuffix = errorMessage && /*#__PURE__*/React.createElement(StyledIcon, {
28
+ status: "error"
29
+ }, /*#__PURE__*/React.createElement(WarningOutlined, null)) || isVerified && /*#__PURE__*/React.createElement(StyledIcon, {
30
+ status: "success"
31
+ }, /*#__PURE__*/React.createElement(CheckCircleOutlined, null)) || suffix || null;
32
+ return /*#__PURE__*/React.createElement(Input, _extends({}, rest, {
33
+ ref: ref || inputRef,
34
+ suffix: showSuffix === false ? null : inputSuffix,
35
+ status: errorMessage ? 'error' : undefined
36
+ }));
37
+ });
38
+ CapInput.displayName = 'CapInput';
39
+ CapInput.propTypes = {
40
+ alwaysShowFocus: PropTypes.bool,
41
+ errorMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
42
+ isVerified: PropTypes.bool,
43
+ size: PropTypes.oneOf(['large', 'middle', 'small']),
44
+ suffix: PropTypes.node,
45
+ showSuffix: PropTypes.bool
46
+ };
47
+ CapInput.defaultProps = {
48
+ size: 'large',
49
+ showSuffix: true
50
+ };
51
+ export default CapInput;
@@ -1,21 +1,18 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
1
2
  import React from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  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
- );
5
+ const CapInputNumber = /*#__PURE__*/React.forwardRef((props, ref) => {
6
+ const {
7
+ size = 'large',
8
+ ...rest
9
+ } = props;
10
+ return /*#__PURE__*/React.createElement(InputNumber, _extends({}, rest, {
11
+ ref: ref,
12
+ size: size
13
+ }));
15
14
  });
16
-
17
15
  CapInputNumber.displayName = 'CapInputNumber';
18
-
19
16
  CapInputNumber.propTypes = {
20
17
  size: PropTypes.oneOf(['large', 'middle', 'small']),
21
18
  min: PropTypes.number,
@@ -27,12 +24,10 @@ CapInputNumber.propTypes = {
27
24
  parser: PropTypes.func,
28
25
  controls: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
29
26
  keyboard: PropTypes.bool,
30
- stringMode: PropTypes.bool,
27
+ stringMode: PropTypes.bool
31
28
  };
32
-
33
29
  CapInputNumber.defaultProps = {
34
30
  size: 'large',
35
- keyboard: true,
31
+ keyboard: true
36
32
  };
37
-
38
- export default CapInputNumber;
33
+ export default CapInputNumber;
@@ -0,0 +1,28 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { Input } from 'antd';
5
+ const {
6
+ Search
7
+ } = Input;
8
+ const CapInputSearch = /*#__PURE__*/React.forwardRef((props, ref) => {
9
+ const {
10
+ size = 'large',
11
+ ...rest
12
+ } = props;
13
+ return /*#__PURE__*/React.createElement(Search, _extends({}, rest, {
14
+ ref: ref,
15
+ size: size
16
+ }));
17
+ });
18
+ CapInputSearch.displayName = 'CapInputSearch';
19
+ CapInputSearch.propTypes = {
20
+ size: PropTypes.oneOf(['large', 'middle', 'small']),
21
+ enterButton: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
22
+ loading: PropTypes.bool,
23
+ onSearch: PropTypes.func
24
+ };
25
+ CapInputSearch.defaultProps = {
26
+ size: 'large'
27
+ };
28
+ export default CapInputSearch;
@@ -0,0 +1,35 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { Input } from 'antd';
5
+ const {
6
+ TextArea
7
+ } = Input;
8
+ const CapInputTextArea = /*#__PURE__*/React.forwardRef((props, ref) => {
9
+ const {
10
+ size = 'large',
11
+ ...rest
12
+ } = props;
13
+ return /*#__PURE__*/React.createElement(TextArea, _extends({}, rest, {
14
+ ref: ref,
15
+ size: size
16
+ }));
17
+ });
18
+ CapInputTextArea.displayName = 'CapInputTextArea';
19
+ CapInputTextArea.propTypes = {
20
+ size: PropTypes.oneOf(['large', 'middle', 'small']),
21
+ autoSize: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
22
+ minRows: PropTypes.number,
23
+ maxRows: PropTypes.number
24
+ })]),
25
+ rows: PropTypes.number,
26
+ maxLength: PropTypes.number,
27
+ showCount: PropTypes.oneOfType([PropTypes.bool, PropTypes.shape({
28
+ formatter: PropTypes.func
29
+ })])
30
+ };
31
+ CapInputTextArea.defaultProps = {
32
+ size: 'large',
33
+ rows: 4
34
+ };
35
+ export default CapInputTextArea;
@@ -4,24 +4,22 @@
4
4
  * This contains all the text for the CapInput component.
5
5
  */
6
6
  import { defineMessages } from 'react-intl';
7
-
8
7
  const scope = 'blaze.components.CapInput';
9
-
10
8
  export default defineMessages({
11
9
  placeholder: {
12
10
  id: `${scope}.placeholder`,
13
- defaultMessage: 'Enter text...',
11
+ defaultMessage: 'Enter text...'
14
12
  },
15
13
  searchPlaceholder: {
16
14
  id: `${scope}.searchPlaceholder`,
17
- defaultMessage: 'Search...',
15
+ defaultMessage: 'Search...'
18
16
  },
19
17
  textAreaPlaceholder: {
20
18
  id: `${scope}.textAreaPlaceholder`,
21
- defaultMessage: 'Enter your text here...',
19
+ defaultMessage: 'Enter your text here...'
22
20
  },
23
21
  numberPlaceholder: {
24
22
  id: `${scope}.numberPlaceholder`,
25
- defaultMessage: 'Enter number...',
26
- },
27
- });
23
+ defaultMessage: 'Enter number...'
24
+ }
25
+ });
@@ -0,0 +1,3 @@
1
+ import { css } from 'styled-components';
2
+ import * as styledVars from '../styled/variables';
3
+ export const inputStyles = css(["&.ant-input,&.ant-input-affix-wrapper,&.ant-input-number,&.ant-input-textarea{font-family:", ";border-radius:", ";transition:", ";&:hover{border-color:", ";}&:focus,&.ant-input-affix-wrapper-focused{border-color:", ";box-shadow:none;}&.ant-input-status-error,&.ant-input-affix-wrapper-status-error,&.ant-input-number-status-error{border-color:", ";&:hover{border-color:", ";}&:focus,&.ant-input-affix-wrapper-focused{border-color:", ";box-shadow:none;}}&.ant-input-disabled,&.ant-input-affix-wrapper-disabled{background-color:", ";cursor:not-allowed;}}&.ant-input-lg,&.ant-input-affix-wrapper-lg{font-size:14px;padding:10px 12px;}&.ant-input-textarea{.ant-input{font-family:", ";}}&.ant-input-number{width:100%;.ant-input-number-handler-wrap{opacity:1;}}&.ant-input-search{.ant-input-search-button{background-color:", ";border-color:", ";&:hover{background-color:", ";border-color:", ";}}}"], styledVars.FONT_FAMILY, styledVars.RADIUS_04, styledVars.TRANSITION_ALL, styledVars.CAP_G11, styledVars.CAP_G01, styledVars.CAP_RED, styledVars.CAP_RED, styledVars.CAP_RED, styledVars.CAP_G08, styledVars.FONT_FAMILY, styledVars.CAP_PRIMARY.base, styledVars.CAP_PRIMARY.base, styledVars.CAP_PRIMARY.hover, styledVars.CAP_PRIMARY.hover);
@@ -0,0 +1,21 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ /**
3
+ * CapSkeleton - Migrated to Ant Design v5
4
+ */
5
+ import React from 'react';
6
+ import PropTypes from 'prop-types';
7
+ import { Skeleton } from 'antd';
8
+ const CapSkeleton = _ref => {
9
+ let {
10
+ className,
11
+ ...rest
12
+ } = _ref;
13
+ const combinedClassName = `cap-skeleton-v2 ${className || ''}`.trim();
14
+ return /*#__PURE__*/React.createElement(Skeleton, _extends({
15
+ className: combinedClassName
16
+ }, rest));
17
+ };
18
+ CapSkeleton.propTypes = {
19
+ className: PropTypes.string
20
+ };
21
+ export default CapSkeleton;
@@ -0,0 +1 @@
1
+ export { default } from './CapSkeleton';
@@ -0,0 +1,27 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ /**
3
+ * CapSpin - Migrated to Ant Design v5
4
+ */
5
+ import React from 'react';
6
+ import PropTypes from 'prop-types';
7
+ import { Spin } from 'antd';
8
+ const CapSpin = _ref => {
9
+ let {
10
+ className,
11
+ ...rest
12
+ } = _ref;
13
+ return /*#__PURE__*/React.createElement(Spin, _extends({
14
+ className: className
15
+ }, rest));
16
+ };
17
+ CapSpin.propTypes = {
18
+ className: PropTypes.string,
19
+ size: PropTypes.oneOf(['small', 'default', 'large']),
20
+ spinning: PropTypes.bool,
21
+ tip: PropTypes.string,
22
+ delay: PropTypes.number,
23
+ indicator: PropTypes.node,
24
+ fullscreen: PropTypes.bool,
25
+ wrapperClassName: PropTypes.string
26
+ };
27
+ export default CapSpin;
@@ -0,0 +1 @@
1
+ export { default } from './CapSpin';
@@ -1,3 +1,4 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
1
2
  /**
2
3
  * CapTable - Migrated to Ant Design v5
3
4
  * A table component that supports:
@@ -11,29 +12,27 @@ import { debounce } from 'lodash';
11
12
  import classNames from 'classnames';
12
13
  import { StyledTable } from './styles';
13
14
  import LocaleHoc from '../LocaleHoc';
14
-
15
15
  const SCROLL_THRESHOLD = 80; // Percentage of scroll to trigger load
16
16
  const DEBOUNCE_DELAY = 250; // ms to wait between scroll events
17
17
  const DEFAULT_ROW_HEIGHT = 54;
18
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
- }) => {
19
+ const CapTable = _ref => {
20
+ let {
21
+ id,
22
+ className,
23
+ children,
24
+ infiniteScroll,
25
+ pagination,
26
+ dataSource,
27
+ offset_limit,
28
+ setPagination,
29
+ scroll,
30
+ showLoader,
31
+ ...rest
32
+ } = _ref;
33
33
  const scrollRef = useRef(null);
34
34
  const [hasMore, setHasMore] = useState(true);
35
35
  const currentOffsetRef = useRef(0);
36
-
37
36
  const loadMore = useCallback(() => {
38
37
  if (!showLoader && hasMore) {
39
38
  const nextOffset = currentOffsetRef.current + 1;
@@ -41,43 +40,33 @@ const CapTable = ({
41
40
  ...offset_limit,
42
41
  offset: nextOffset
43
42
  };
44
-
45
43
  currentOffsetRef.current = nextOffset;
46
44
  setPagination(newOffsetLimit);
47
45
  }
48
46
  }, [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
- );
47
+ const handleScroll = useCallback(debounce(event => {
48
+ const target = event.target;
49
+ if (!target || !infiniteScroll || !hasMore || showLoader) return;
50
+ const scrollTop = Math.ceil(target.scrollTop);
51
+ const visibleHeight = target.clientHeight;
52
+ const totalHeight = target.scrollHeight;
53
+ const scrolledPercentage = (scrollTop + visibleHeight) / totalHeight * 100;
54
+ if (scrolledPercentage >= SCROLL_THRESHOLD) {
55
+ loadMore();
56
+ }
57
+ }, DEBOUNCE_DELAY), [infiniteScroll, showLoader, hasMore, loadMore]);
67
58
 
68
59
  // Setup scroll listener and handle initial load
69
60
  useEffect(() => {
70
61
  const tableBody = document.querySelector(`#${id} .ant-table-body`);
71
62
  if (!tableBody) return;
72
-
73
63
  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;
64
+ tableBody.addEventListener('scroll', handleScroll, {
65
+ passive: true
66
+ });
80
67
 
68
+ // Check if initial load needed
69
+ const shouldLoadInitially = tableBody.scrollHeight <= tableBody.clientHeight && !showLoader && hasMore;
81
70
  if (shouldLoadInitially) {
82
71
  currentOffsetRef.current = 0;
83
72
  loadMore();
@@ -99,37 +88,25 @@ const CapTable = ({
99
88
  setHasMore(true);
100
89
  }
101
90
  }, [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
- );
91
+ const tableClassName = classNames('cap-table-v2', className, {
92
+ 'show-loader': showLoader,
93
+ 'infinite-scroll': infiniteScroll,
94
+ 'has-more': hasMore
95
+ });
96
+ return /*#__PURE__*/React.createElement(StyledTable, _extends({
97
+ id: id,
98
+ className: tableClassName,
99
+ dataSource: dataSource,
100
+ pagination: false,
101
+ scroll: {
102
+ x: scroll?.x,
103
+ y: scroll?.y || DEFAULT_SCROLL_HEIGHT,
104
+ scrollToFirstRowOnChange: false
105
+ },
106
+ virtual: infiniteScroll,
107
+ rowHeight: DEFAULT_ROW_HEIGHT
108
+ }, rest), children);
131
109
  };
132
-
133
110
  CapTable.propTypes = {
134
111
  id: PropTypes.string.isRequired,
135
112
  className: PropTypes.string,
@@ -140,7 +117,8 @@ CapTable.propTypes = {
140
117
  offset_limit: PropTypes.object,
141
118
  setPagination: PropTypes.func,
142
119
  scroll: PropTypes.object,
143
- showLoader: PropTypes.bool,
120
+ showLoader: PropTypes.bool
144
121
  };
145
-
146
- export default LocaleHoc(CapTable, { key: 'CapTable' });
122
+ export default LocaleHoc(CapTable, {
123
+ key: 'CapTable'
124
+ });
@@ -0,0 +1,8 @@
1
+ import CapSkeleton from '../CapSkeleton';
2
+ import { loadable } from '@capillarytech/cap-ui-utils';
3
+ import React, { Suspense } from 'react';
4
+ const LoadableComponent = loadable(() => import('./CapTable'));
5
+ const CapTableLoadable = props => /*#__PURE__*/React.createElement(Suspense, {
6
+ fallback: /*#__PURE__*/React.createElement(CapSkeleton, null)
7
+ }, /*#__PURE__*/React.createElement(LoadableComponent, props));
8
+ export default CapTableLoadable;
@@ -0,0 +1,17 @@
1
+ import { Table } from 'antd';
2
+ import styled from 'styled-components';
3
+ import * as styledVars from '../styled/variables';
4
+ const {
5
+ CAP_G09,
6
+ CAP_G01,
7
+ CAP_G06,
8
+ CAP_G07,
9
+ CAP_G10,
10
+ SPACING_16,
11
+ SPACING_24,
12
+ FONT_SIZE_S
13
+ } = styledVars;
14
+ export const StyledTable = styled(Table).withConfig({
15
+ displayName: "StyledTable",
16
+ componentId: "sc-1ldu1k4-0"
17
+ })(["&.cap-table-v2{.ant-table{border:1px solid ", ";}}&.show-loader{.ant-table-body > table > tbody::after{content:'", "';display:flex;justify-content:center;position:absolute;width:100%;align-items:center;height:60px;text-align:center;font-size:16px;color:gray;border-top:1px solid ", ";}}.ant-table{border:1px solid ", ";.ant-table-thead > tr > th{color:", ";font-size:", ";line-height:", ";background-color:", ";text-align:left;}.ant-table-thead > tr > th,.ant-table-tbody > tr > td{padding:", " ", ";}.ant-table-tbody > tr > td{border-bottom:1px solid ", ";}.ant-table-tbody > tr:last-child > td{border-bottom:none;}.ant-table-thead > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,.ant-table-tbody > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,.ant-table-thead > tr:hover:not(.ant-table-expanded-row) > td,.ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td{background-color:", ";}.ant-table-thead > tr > th .ant-table-column-sorter-up,.ant-table-thead > tr > th .ant-table-column-sorter-down{&.active{color:", ";}&:not(.active){color:", ";}}.ant-table-thead{.table-children{padding:6px ", " 16px;position:relative;}.table-parent{padding-bottom:0;padding-left:", ";}.table-children.show-separator:not(:last-child)::after{content:'';height:8px;width:1px;right:0;top:30%;background-color:", ";position:absolute;}}.ant-table-thead > tr > th .ant-table-column-sorter{vertical-align:unset;}.ant-table-body table{table-layout:fixed;width:100%;}}&.no-pagination-loader{.ant-table-body > table > tbody::after{content:'';height:unset;display:none;}}&.hide-hover{.ant-table{.ant-table-thead > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,.ant-table-tbody > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,.ant-table-thead > tr:hover:not(.ant-table-expanded-row) > td,.ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td{background:none;}}}a{color:", ";}"], CAP_G07, props => props.loadMoreData, CAP_G07, CAP_G07, CAP_G01, FONT_SIZE_S, SPACING_16, CAP_G10, SPACING_16, SPACING_24, CAP_G07, CAP_G09, CAP_G01, CAP_G06, SPACING_24, SPACING_24, CAP_G07, CAP_G01);
@@ -0,0 +1,34 @@
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 /*#__PURE__*/React.createElement(Select, props);
11
+ };
12
+ CapTestSelect.propTypes = {
13
+ // Common Select props from antd
14
+ allowClear: PropTypes.bool,
15
+ defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))]),
16
+ disabled: PropTypes.bool,
17
+ loading: PropTypes.bool,
18
+ mode: PropTypes.oneOf(['multiple', 'tags']),
19
+ placeholder: PropTypes.string,
20
+ showSearch: PropTypes.bool,
21
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))]),
22
+ options: PropTypes.arrayOf(PropTypes.shape({
23
+ label: PropTypes.node,
24
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
25
+ disabled: PropTypes.bool
26
+ }))
27
+ };
28
+ CapTestSelect.defaultProps = {
29
+ allowClear: false,
30
+ disabled: false,
31
+ loading: false,
32
+ showSearch: false
33
+ };
34
+ export default CapTestSelect;
@@ -0,0 +1 @@
1
+ export { default } from './CapTestSelect';