@capillarytech/blaze-ui 0.1.6-alpha.39 → 0.1.6-alpha.4

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 (90) hide show
  1. package/CapHeading/CapHeading.js +71 -0
  2. package/CapHeading/index.js +1 -0
  3. package/CapHeading/styles.js +125 -0
  4. package/CapInfoNote/CapInfoNote.js +54 -0
  5. package/CapInfoNote/index.js +1 -0
  6. package/CapInfoNote/styles.js +63 -0
  7. package/CapInput/loadable.js +9 -0
  8. package/CapLabel/CapLabel.js +106 -0
  9. package/CapLabel/index.js +1 -0
  10. package/CapLabel/styles.js +221 -0
  11. package/CapRow/CapRow.js +22 -0
  12. package/CapRow/index.js +1 -0
  13. package/CapRow/styles.js +9 -0
  14. package/CapTable/loadable.js +4 -4
  15. package/CapTooltip/CapTooltip.js +36 -0
  16. package/CapTooltip/index.js +1 -0
  17. package/CapTooltip/styles.js +42 -0
  18. package/CapUnifiedSelect/CapUnifiedSelect.js +59 -249
  19. package/CapUnifiedSelect/index.js +4 -1
  20. package/CapUnifiedSelect/loadable.js +3 -0
  21. package/CapUnifiedSelect/styles.js +26 -272
  22. package/dist/235.index.js +2 -0
  23. package/dist/235.index.js.LICENSE.txt +29 -0
  24. package/dist/603.index.js +1 -0
  25. package/dist/CapInput/CapInput.js +66 -0
  26. package/dist/CapInput/Number.js +42 -0
  27. package/dist/CapInput/Search.js +35 -0
  28. package/dist/CapInput/TextArea.js +42 -0
  29. package/dist/CapInput/index.js +15 -0
  30. package/dist/CapInput/messages.js +32 -0
  31. package/dist/CapInput/styles.js +11 -0
  32. package/dist/CapTable/CapTable.js +148 -0
  33. package/dist/CapTable/index.js +9 -0
  34. package/dist/CapTable/loadable.js +23 -0
  35. package/dist/CapTable/styles.js +26 -0
  36. package/dist/LocaleHoc/index.js +40 -0
  37. package/dist/esm/CapHeading/CapHeading.js +41 -0
  38. package/dist/esm/CapHeading/index.js +1 -0
  39. package/dist/esm/CapHeading/styles.js +123 -0
  40. package/dist/esm/CapInfoNote/CapInfoNote.js +62 -0
  41. package/dist/esm/CapInfoNote/index.js +1 -0
  42. package/dist/esm/CapInfoNote/styles.js +6 -0
  43. package/dist/esm/CapInput/CapInput.js +57 -0
  44. package/dist/esm/CapInput/Number.js +35 -0
  45. package/dist/esm/CapInput/Search.js +28 -0
  46. package/dist/esm/CapInput/TextArea.js +35 -0
  47. package/dist/esm/CapInput/index.js +8 -0
  48. package/dist/esm/CapInput/loadable.js +9 -0
  49. package/dist/esm/CapInput/messages.js +25 -0
  50. package/dist/esm/CapInput/styles.js +3 -0
  51. package/dist/esm/CapLabel/CapLabel.js +50 -0
  52. package/dist/esm/CapLabel/index.js +1 -0
  53. package/dist/esm/CapLabel/styles.js +219 -0
  54. package/dist/esm/CapRow/CapRow.js +22 -0
  55. package/dist/esm/CapRow/index.js +1 -0
  56. package/dist/esm/CapRow/styles.js +5 -0
  57. package/dist/esm/CapTable/CapTable.js +140 -0
  58. package/dist/esm/CapTable/index.js +2 -0
  59. package/dist/esm/CapTable/loadable.js +12 -0
  60. package/dist/esm/CapTable/styles.js +17 -0
  61. package/dist/esm/CapTooltip/CapTooltip.js +34 -0
  62. package/dist/esm/CapTooltip/index.js +1 -0
  63. package/dist/esm/CapTooltip/styles.js +6 -0
  64. package/dist/esm/CapUnifiedSelect/CapUnifiedSelect.js +101 -0
  65. package/dist/esm/CapUnifiedSelect/index.js +3 -0
  66. package/dist/esm/CapUnifiedSelect/loadable.js +4 -0
  67. package/dist/esm/CapUnifiedSelect/messages.js +23 -0
  68. package/dist/esm/CapUnifiedSelect/styles.js +15 -0
  69. package/dist/esm/LocaleHoc/index.js +31 -0
  70. package/dist/esm/index.js +11 -0
  71. package/dist/esm/styled/index.js +5 -0
  72. package/dist/esm/styled/variables.js +88 -0
  73. package/dist/esm/translations/en.js +329 -0
  74. package/dist/index.js +39 -0
  75. package/dist/index.js.LICENSE.txt +7 -0
  76. package/dist/styled/index.js +22 -0
  77. package/dist/styled/variables.js +94 -0
  78. package/dist/translations/en.js +335 -0
  79. package/index.js +1 -7
  80. package/package.json +10 -6
  81. package/.DS_Store +0 -0
  82. package/CapSkeleton/CapSkeleton.js +0 -17
  83. package/CapSkeleton/index.js +0 -1
  84. package/CapSpin/CapSpin.js +0 -23
  85. package/CapSpin/index.js +0 -1
  86. package/CapTestSelect/CapTestSelect.js +0 -47
  87. package/CapTestSelect/index.js +0 -1
  88. package/assets/upload.svg +0 -3
  89. package/utils/index.js +0 -1
  90. package/utils/withStyles.js +0 -24
@@ -0,0 +1,219 @@
1
+ import styled, { css } from 'styled-components';
2
+ import * as styledVars from '../styled/variables';
3
+ var labels = {
4
+ label1: {
5
+ color: styledVars.CAP_G04,
6
+ fontSize: '12px',
7
+ fontWeight: 'normal',
8
+ lineHeight: 'normal'
9
+ },
10
+ label2: {
11
+ color: styledVars.CAP_G01,
12
+ fontSize: '12px',
13
+ fontWeight: 'normal',
14
+ lineHeight: 'normal'
15
+ },
16
+ label3: {
17
+ color: styledVars.CAP_G05,
18
+ fontSize: '12px',
19
+ fontWeight: 'normal',
20
+ lineHeight: 'normal'
21
+ },
22
+ label4: {
23
+ color: styledVars.CAP_G01,
24
+ fontSize: '12px',
25
+ fontWeight: '500',
26
+ lineHeight: 'normal'
27
+ },
28
+ label5: {
29
+ color: styledVars.CAP_G01,
30
+ fontSize: '10px',
31
+ fontWeight: 'normal',
32
+ lineHeight: 'normal'
33
+ },
34
+ label6: {
35
+ color: styledVars.CAP_G06,
36
+ fontSize: '12px',
37
+ fontWeight: 'normal',
38
+ lineHeight: 'normal'
39
+ },
40
+ label7: {
41
+ color: styledVars.CAP_G04,
42
+ fontSize: '14px',
43
+ fontWeight: '500',
44
+ lineHeight: 'normal'
45
+ },
46
+ label8: {
47
+ color: styledVars.CAP_G01,
48
+ fontSize: '12px',
49
+ fontWeight: '500',
50
+ lineHeight: 'normal'
51
+ },
52
+ label9: {
53
+ color: styledVars.CAP_G01,
54
+ fontSize: '12px',
55
+ fontWeight: 'normal',
56
+ lineHeight: '16px'
57
+ },
58
+ label10: {
59
+ color: styledVars.CAP_WHITE,
60
+ fontSize: '12px',
61
+ fontWeight: 'normal',
62
+ lineHeight: '16px'
63
+ },
64
+ label11: {
65
+ color: styledVars.CAP_G04,
66
+ fontSize: '10px',
67
+ fontWeight: 'normal',
68
+ lineHeight: 'normal'
69
+ },
70
+ label12: {
71
+ color: styledVars.CAP_WHITE,
72
+ fontSize: '12px',
73
+ fontWeight: 'normal',
74
+ lineHeight: 'normal'
75
+ },
76
+ label13: {
77
+ color: styledVars.CAP_G05,
78
+ fontSize: '10px',
79
+ fontWeight: 'normal',
80
+ lineHeight: 'normal'
81
+ },
82
+ label14: {
83
+ color: styledVars.CAP_G03,
84
+ fontSize: '14px',
85
+ fontWeight: 'normal',
86
+ lineHeight: 'normal'
87
+ },
88
+ label15: {
89
+ color: styledVars.CAP_G01,
90
+ fontSize: '14px',
91
+ fontWeight: 'normal',
92
+ lineHeight: 'normal'
93
+ },
94
+ label16: {
95
+ color: styledVars.CAP_G01,
96
+ fontSize: '14px',
97
+ fontWeight: '500',
98
+ lineHeight: 'normal'
99
+ },
100
+ label17: {
101
+ color: styledVars.CAP_G01,
102
+ fontSize: '16px',
103
+ fontWeight: '500',
104
+ lineHeight: 'normal'
105
+ },
106
+ label18: {
107
+ color: styledVars.CAP_G04,
108
+ fontSize: '14px',
109
+ fontWeight: 'normal',
110
+ lineHeight: 'normal'
111
+ },
112
+ label19: {
113
+ color: 'rgba(0, 0, 0, 0.87)',
114
+ fontSize: '12px',
115
+ fontWeight: 'normal',
116
+ lineHeight: '16px'
117
+ },
118
+ label20: {
119
+ color: styledVars.CAP_SECONDARY.base,
120
+ fontSize: '14px',
121
+ fontWeight: '500',
122
+ lineHeight: 'normal'
123
+ },
124
+ label21: {
125
+ color: styledVars.CAP_SECONDARY.base,
126
+ fontSize: '12px',
127
+ fontWeight: 'normal',
128
+ lineHeight: 'normal'
129
+ },
130
+ label22: {
131
+ color: styledVars.CAP_G04,
132
+ fontSize: '24px',
133
+ fontWeight: 'normal',
134
+ lineHeight: '28px'
135
+ },
136
+ label23: {
137
+ color: styledVars.CAP_WHITE,
138
+ fontSize: '14px',
139
+ fontWeight: 'normal',
140
+ lineHeight: 'normal'
141
+ },
142
+ label24: {
143
+ fontSize: '14px',
144
+ fontWeight: '400',
145
+ color: styledVars.CAP_G04,
146
+ lineHeight: '20px'
147
+ },
148
+ label25: {
149
+ fontSize: '14px',
150
+ fontWeight: '500',
151
+ color: styledVars.CAP_G04,
152
+ lineHeight: '20px'
153
+ },
154
+ label26: {
155
+ fontSize: '10px',
156
+ fontWeight: '400',
157
+ color: styledVars.CAP_G01,
158
+ lineHeight: '12px'
159
+ },
160
+ label27: {
161
+ fontSize: '12px',
162
+ fontWeight: '500',
163
+ color: styledVars.CAP_SECONDARY.base,
164
+ lineHeight: '16px'
165
+ },
166
+ label28: {
167
+ fontSize: '12px',
168
+ fontWeight: '500',
169
+ color: styledVars.CAP_WHITE,
170
+ lineHeight: '16px'
171
+ },
172
+ label29: {
173
+ fontSize: '10px',
174
+ fontWeight: '400',
175
+ color: styledVars.CAP_WHITE,
176
+ lineHeight: '12px'
177
+ },
178
+ label30: {
179
+ fontSize: '10px',
180
+ fontWeight: '400',
181
+ color: styledVars.CAP_WHITE,
182
+ lineHeight: '12px'
183
+ },
184
+ label31: {
185
+ color: styledVars.CAP_G01,
186
+ fontSize: '12px',
187
+ fontWeight: '400',
188
+ lineHeight: '16px'
189
+ },
190
+ label32: {
191
+ color: styledVars.CAP_WHITE,
192
+ fontSize: '14px',
193
+ fontWeight: '500',
194
+ lineHeight: '20px'
195
+ },
196
+ label33: {
197
+ color: styledVars.CAP_SECONDARY.base,
198
+ fontSize: '14px',
199
+ fontWeight: '500',
200
+ lineHeight: '20px'
201
+ }
202
+ };
203
+ var labelStyles = css(["font-size:", ";font-weight:", ";color:", ";line-height:", ";margin:0;padding:0;"], function (props) {
204
+ return labels[props.type].fontSize;
205
+ }, function (props) {
206
+ return props.fontWeight || labels[props.type].fontWeight;
207
+ }, function (props) {
208
+ return labels[props.type].color;
209
+ }, function (props) {
210
+ return props.lineHeight || labels[props.type].lineHeight || 'initial';
211
+ });
212
+ export var LabelWrapper = styled.div.withConfig({
213
+ displayName: "LabelWrapper",
214
+ componentId: "sc-1xg855n-0"
215
+ })(["", ""], labelStyles);
216
+ export var LabelInline = styled.span.withConfig({
217
+ displayName: "LabelInline",
218
+ componentId: "sc-1xg855n-1"
219
+ })(["", " display:inline-block;"], labelStyles);
@@ -0,0 +1,22 @@
1
+ var _excluded = ["className", "children"];
2
+ 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); }
3
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
5
+ import React from 'react';
6
+ import PropTypes from 'prop-types';
7
+ import { Row } from 'antd';
8
+ import classNames from 'classnames';
9
+ import { RowWrapper } from './styles';
10
+ var CapRow = function CapRow(_ref) {
11
+ var className = _ref.className,
12
+ children = _ref.children,
13
+ rest = _objectWithoutProperties(_ref, _excluded);
14
+ return /*#__PURE__*/React.createElement(RowWrapper, null, /*#__PURE__*/React.createElement(Row, _extends({}, rest, {
15
+ className: classNames('cap-row', className)
16
+ }), React.Children.toArray(children)));
17
+ };
18
+ CapRow.propTypes = {
19
+ children: PropTypes.node,
20
+ className: PropTypes.string
21
+ };
22
+ export default CapRow;
@@ -0,0 +1 @@
1
+ export { default } from './CapRow';
@@ -0,0 +1,5 @@
1
+ import styled from 'styled-components';
2
+ export var RowWrapper = styled.div.withConfig({
3
+ displayName: "RowWrapper",
4
+ componentId: "sc-y3x4h8-0"
5
+ })([".cap-row{display:flex;flex-flow:row wrap;min-width:0;}"]);
@@ -0,0 +1,140 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["id", "className", "children", "infiniteScroll", "pagination", "dataSource", "offset_limit", "setPagination", "scroll", "showLoader"];
3
+ 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); }
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
8
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
10
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
13
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
14
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
15
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
16
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
17
+ /**
18
+ * CapTable - Migrated to Ant Design v5
19
+ * A table component that supports:
20
+ * - Infinite scrolling with virtualization
21
+ * - Sequential data loading
22
+ * - Optimized scroll performance
23
+ */
24
+ import React, { useEffect, useCallback, useState, useRef } from 'react';
25
+ import PropTypes from 'prop-types';
26
+ import { debounce } from 'lodash';
27
+ import classNames from 'classnames';
28
+ import { StyledTable } from './styles';
29
+ import LocaleHoc from '../LocaleHoc';
30
+ var SCROLL_THRESHOLD = 80; // Percentage of scroll to trigger load
31
+ var DEBOUNCE_DELAY = 250; // ms to wait between scroll events
32
+ var DEFAULT_ROW_HEIGHT = 54;
33
+ var DEFAULT_SCROLL_HEIGHT = 400;
34
+ var CapTable = function CapTable(_ref) {
35
+ var id = _ref.id,
36
+ className = _ref.className,
37
+ children = _ref.children,
38
+ infiniteScroll = _ref.infiniteScroll,
39
+ pagination = _ref.pagination,
40
+ dataSource = _ref.dataSource,
41
+ offset_limit = _ref.offset_limit,
42
+ setPagination = _ref.setPagination,
43
+ scroll = _ref.scroll,
44
+ showLoader = _ref.showLoader,
45
+ rest = _objectWithoutProperties(_ref, _excluded);
46
+ var scrollRef = useRef(null);
47
+ var _useState = useState(true),
48
+ _useState2 = _slicedToArray(_useState, 2),
49
+ hasMore = _useState2[0],
50
+ setHasMore = _useState2[1];
51
+ var currentOffsetRef = useRef(0);
52
+ var loadMore = useCallback(function () {
53
+ if (!showLoader && hasMore) {
54
+ var nextOffset = currentOffsetRef.current + 1;
55
+ var newOffsetLimit = _objectSpread(_objectSpread({}, offset_limit), {}, {
56
+ offset: nextOffset
57
+ });
58
+ currentOffsetRef.current = nextOffset;
59
+ setPagination(newOffsetLimit);
60
+ }
61
+ }, [showLoader, hasMore, setPagination, offset_limit]);
62
+ var handleScroll = useCallback(debounce(function (event) {
63
+ var target = event.target;
64
+ if (!target || !infiniteScroll || !hasMore || showLoader) return;
65
+ var scrollTop = Math.ceil(target.scrollTop);
66
+ var visibleHeight = target.clientHeight;
67
+ var totalHeight = target.scrollHeight;
68
+ var scrolledPercentage = (scrollTop + visibleHeight) / totalHeight * 100;
69
+ if (scrolledPercentage >= SCROLL_THRESHOLD) {
70
+ loadMore();
71
+ }
72
+ }, DEBOUNCE_DELAY), [infiniteScroll, showLoader, hasMore, loadMore]);
73
+
74
+ // Setup scroll listener and handle initial load
75
+ useEffect(function () {
76
+ var tableBody = document.querySelector("#".concat(id, " .ant-table-body"));
77
+ if (!tableBody) return;
78
+ scrollRef.current = tableBody;
79
+ tableBody.addEventListener('scroll', handleScroll, {
80
+ passive: true
81
+ });
82
+
83
+ // Check if initial load needed
84
+ var shouldLoadInitially = tableBody.scrollHeight <= tableBody.clientHeight && !showLoader && hasMore;
85
+ if (shouldLoadInitially) {
86
+ currentOffsetRef.current = 0;
87
+ loadMore();
88
+ }
89
+
90
+ // Cleanup
91
+ return function () {
92
+ var _scrollRef$current;
93
+ (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.removeEventListener('scroll', handleScroll);
94
+ handleScroll.cancel();
95
+ };
96
+ }, [id, handleScroll, showLoader, hasMore, loadMore]);
97
+
98
+ // Handle data changes
99
+ useEffect(function () {
100
+ if (!(dataSource !== null && dataSource !== void 0 && dataSource.length)) {
101
+ currentOffsetRef.current = 0;
102
+ setHasMore(true);
103
+ } else {
104
+ setHasMore(true);
105
+ }
106
+ }, [dataSource]);
107
+ var tableClassName = classNames('cap-table-v2', className, {
108
+ 'show-loader': showLoader,
109
+ 'infinite-scroll': infiniteScroll,
110
+ 'has-more': hasMore
111
+ });
112
+ return /*#__PURE__*/React.createElement(StyledTable, _extends({
113
+ id: id,
114
+ className: tableClassName,
115
+ dataSource: dataSource,
116
+ pagination: false,
117
+ scroll: {
118
+ x: scroll === null || scroll === void 0 ? void 0 : scroll.x,
119
+ y: (scroll === null || scroll === void 0 ? void 0 : scroll.y) || DEFAULT_SCROLL_HEIGHT,
120
+ scrollToFirstRowOnChange: false
121
+ },
122
+ virtual: infiniteScroll,
123
+ rowHeight: DEFAULT_ROW_HEIGHT
124
+ }, rest), children);
125
+ };
126
+ CapTable.propTypes = {
127
+ id: PropTypes.string.isRequired,
128
+ className: PropTypes.string,
129
+ children: PropTypes.node,
130
+ infiniteScroll: PropTypes.bool,
131
+ pagination: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
132
+ dataSource: PropTypes.array,
133
+ offset_limit: PropTypes.object,
134
+ setPagination: PropTypes.func,
135
+ scroll: PropTypes.object,
136
+ showLoader: PropTypes.bool
137
+ };
138
+ export default LocaleHoc(CapTable, {
139
+ key: 'CapTable'
140
+ });
@@ -0,0 +1,2 @@
1
+ import CapTableLoadable from './loadable';
2
+ export default CapTableLoadable;
@@ -0,0 +1,12 @@
1
+ import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
2
+ import { loadable } from '@capillarytech/cap-ui-utils';
3
+ import React, { Suspense } from 'react';
4
+ var LoadableComponent = loadable(function () {
5
+ return import('./CapTable');
6
+ });
7
+ var CapTableLoadable = function CapTableLoadable() {
8
+ return /*#__PURE__*/React.createElement(Suspense, {
9
+ fallback: /*#__PURE__*/React.createElement(CapSpin, null)
10
+ }, /*#__PURE__*/React.createElement(LoadableComponent, null));
11
+ };
12
+ 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
+ var CAP_G09 = styledVars.CAP_G09,
5
+ CAP_G01 = styledVars.CAP_G01,
6
+ CAP_G06 = styledVars.CAP_G06,
7
+ CAP_G07 = styledVars.CAP_G07,
8
+ CAP_G10 = styledVars.CAP_G10,
9
+ SPACING_16 = styledVars.SPACING_16,
10
+ SPACING_24 = styledVars.SPACING_24,
11
+ FONT_SIZE_S = styledVars.FONT_SIZE_S;
12
+ export var StyledTable = styled(Table).withConfig({
13
+ displayName: "StyledTable",
14
+ componentId: "sc-1ldu1k4-0"
15
+ })(["&.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, function (props) {
16
+ return props.loadMoreData;
17
+ }, 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
+ var _excluded = ["overlayClassName", "children"];
2
+ 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); }
3
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
5
+ import React from 'react';
6
+ import PropTypes from 'prop-types';
7
+ import { Tooltip } from 'antd';
8
+ import classNames from 'classnames';
9
+ import { TooltipWrapper } from './styles';
10
+ var CapTooltip = function CapTooltip(_ref) {
11
+ var overlayClassName = _ref.overlayClassName,
12
+ children = _ref.children,
13
+ rest = _objectWithoutProperties(_ref, _excluded);
14
+ return /*#__PURE__*/React.createElement(TooltipWrapper, null, /*#__PURE__*/React.createElement(Tooltip, _extends({
15
+ overlayClassName: classNames('cap-tooltip', overlayClassName)
16
+ }, rest), children));
17
+ };
18
+
19
+ /*
20
+ NOTE:
21
+ While using a disabled button with tooltip, wrap the button with an element with className "button-disabled-tooltip-wrapper".
22
+
23
+ <CapTooltip title="disabled button with tooltip">
24
+ <span className="button-disabled-tooltip-wrapper">
25
+ <CapButton disabled>Button</CapButton>
26
+ </span>
27
+ </CapTooltip>
28
+ */
29
+
30
+ CapTooltip.propTypes = {
31
+ overlayClassName: PropTypes.string,
32
+ children: PropTypes.node
33
+ };
34
+ export default CapTooltip;
@@ -0,0 +1 @@
1
+ export { default } from './CapTooltip';
@@ -0,0 +1,6 @@
1
+ import styled from 'styled-components';
2
+ import * as styledVars from '../styled/variables';
3
+ export var TooltipWrapper = styled.span.withConfig({
4
+ displayName: "TooltipWrapper",
5
+ componentId: "sc-17x5zp5-0"
6
+ })([".cap-tooltip{max-width:324px;.ant-tooltip-inner{background-color:", ";font-size:", ";font-weight:", ";padding:6px 8px;min-height:32px;border-radius:", ";}&.cap-bgcolor-tooltip{.ant-tooltip-inner{background-color:", ";}}&.hide-tooltip-pointer{.ant-tooltip-arrow{display:none;}}}.button-disabled-tooltip-wrapper{display:inline-flex;cursor:not-allowed;.cap-button.ant-btn[disabled]{pointer-events:none;& > *{pointer-events:auto;cursor:not-allowed;}}}"], styledVars.FONT_COLOR_01, styledVars.FONT_SIZE_M, styledVars.FONT_WEIGHT_MEDIUM, styledVars.RADIUS_04, styledVars.FONT_COLOR_05);
@@ -0,0 +1,101 @@
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
+ // CapUnifiedSelect component using Ant Design v5 Select and TreeSelect directly
3
+ import React from 'react';
4
+ import PropTypes from 'prop-types';
5
+ import { Select, TreeSelect } from 'antd';
6
+ import { SelectWrapper, HeaderWrapper, StyledInfoIcon } from './styles';
7
+ import CapLabel from '../CapLabel';
8
+ import CapTooltip from '../CapTooltip';
9
+ function CapUnifiedSelect(_ref) {
10
+ var type = _ref.type,
11
+ _ref$options = _ref.options,
12
+ options = _ref$options === void 0 ? [] : _ref$options,
13
+ treeData = _ref.treeData,
14
+ value = _ref.value,
15
+ onChange = _ref.onChange,
16
+ _ref$placeholder = _ref.placeholder,
17
+ placeholder = _ref$placeholder === void 0 ? 'Select an option' : _ref$placeholder,
18
+ className = _ref.className,
19
+ style = _ref.style,
20
+ _ref$allowClear = _ref.allowClear,
21
+ allowClear = _ref$allowClear === void 0 ? false : _ref$allowClear,
22
+ _ref$showSearch = _ref.showSearch,
23
+ showSearch = _ref$showSearch === void 0 ? false : _ref$showSearch,
24
+ label = _ref.label,
25
+ tooltip = _ref.tooltip,
26
+ _ref$disabled = _ref.disabled,
27
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled;
28
+ var selectVirtualizationProps = {
29
+ listHeight: 256
30
+ };
31
+ var treeSelectVirtualizationProps = {
32
+ listHeight: 256,
33
+ listItemHeight: 32
34
+ };
35
+ var renderHeader = function renderHeader() {
36
+ if (!label && !tooltip) return null;
37
+ return /*#__PURE__*/React.createElement(HeaderWrapper, {
38
+ className: disabled ? 'disabled' : ''
39
+ }, label && /*#__PURE__*/React.createElement(CapLabel, {
40
+ type: "label16",
41
+ className: disabled ? 'disabled' : ''
42
+ }, label), tooltip && /*#__PURE__*/React.createElement(CapTooltip, {
43
+ title: tooltip
44
+ }, /*#__PURE__*/React.createElement(StyledInfoIcon, {
45
+ className: disabled ? 'disabled' : ''
46
+ })));
47
+ };
48
+ var renderDropdown = function renderDropdown() {
49
+ if (type === 'treeSelect' || type === 'multiTreeSelect') {
50
+ return /*#__PURE__*/React.createElement(TreeSelect, _extends({
51
+ treeData: treeData || options,
52
+ value: value,
53
+ onChange: onChange,
54
+ placeholder: placeholder,
55
+ className: className,
56
+ style: style,
57
+ allowClear: allowClear,
58
+ showSearch: showSearch,
59
+ multiple: type === 'multiTreeSelect' ? true : false,
60
+ virtual: true,
61
+ treeDefaultExpandAll: true,
62
+ disabled: disabled
63
+ }, treeSelectVirtualizationProps));
64
+ }
65
+ return /*#__PURE__*/React.createElement(Select, _extends({
66
+ value: value,
67
+ onChange: onChange,
68
+ placeholder: placeholder,
69
+ className: className,
70
+ style: style,
71
+ allowClear: allowClear,
72
+ showSearch: showSearch,
73
+ options: options,
74
+ mode: type === 'multiSelect' ? 'multiple' : undefined,
75
+ virtual: true,
76
+ disabled: disabled
77
+ }, selectVirtualizationProps));
78
+ };
79
+ return /*#__PURE__*/React.createElement(SelectWrapper, null, renderHeader(), renderDropdown());
80
+ }
81
+ CapUnifiedSelect.propTypes = {
82
+ type: PropTypes.oneOf(['select', 'multiSelect', 'treeSelect', 'multiTreeSelect']),
83
+ options: PropTypes.array,
84
+ treeData: PropTypes.array,
85
+ value: PropTypes.any,
86
+ onChange: PropTypes.func,
87
+ placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
88
+ className: PropTypes.string,
89
+ style: PropTypes.object,
90
+ allowClear: PropTypes.bool,
91
+ showSearch: PropTypes.bool,
92
+ label: PropTypes.string,
93
+ tooltip: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
94
+ disabled: PropTypes.bool
95
+ };
96
+ CapUnifiedSelect.defaultProps = {
97
+ type: 'select',
98
+ allowClear: false,
99
+ showSearch: false
100
+ };
101
+ export default CapUnifiedSelect;
@@ -0,0 +1,3 @@
1
+ import CapUnifiedSelect from './CapUnifiedSelect';
2
+ import CapUnifiedSelectLoadable from './loadable';
3
+ export default CapUnifiedSelectLoadable;
@@ -0,0 +1,4 @@
1
+ import loadable from '@loadable/component';
2
+ export default loadable(function () {
3
+ return import('./CapUnifiedSelect');
4
+ });
@@ -0,0 +1,23 @@
1
+ import { defineMessages } from 'react-intl';
2
+ export default defineMessages({
3
+ selectPlaceholder: {
4
+ id: 'cap.unified.select.placeholder',
5
+ defaultMessage: 'Select an option'
6
+ },
7
+ searchPlaceholder: {
8
+ id: 'cap.unified.select.search.placeholder',
9
+ defaultMessage: 'Search...'
10
+ },
11
+ noData: {
12
+ id: 'cap.unified.select.no.data',
13
+ defaultMessage: 'No data'
14
+ },
15
+ loading: {
16
+ id: 'cap.unified.select.loading',
17
+ defaultMessage: 'Loading...'
18
+ },
19
+ selected: {
20
+ id: 'cap.unified.select.selected',
21
+ defaultMessage: '{count} items selected'
22
+ }
23
+ });
@@ -0,0 +1,15 @@
1
+ import styled, { css } from 'styled-components';
2
+ import * as styledVars from '../styled/variables';
3
+ export var SelectWrapper = styled.div.withConfig({
4
+ displayName: "SelectWrapper",
5
+ componentId: "sc-3v7xpu-0"
6
+ })(["display:flex;flex-direction:column;gap:8px;width:100%;&.disabled{cursor:not-allowed;}"]);
7
+ export var HeaderWrapper = styled.div.withConfig({
8
+ displayName: "HeaderWrapper",
9
+ componentId: "sc-3v7xpu-1"
10
+ })(["display:flex;align-items:center;gap:4px;&.disabled{opacity:0.5;cursor:not-allowed;}"]);
11
+ export var StyledInfoIcon = styled.span.withConfig({
12
+ displayName: "StyledInfoIcon",
13
+ componentId: "sc-3v7xpu-2"
14
+ })(["color:", ";font-size:16px;cursor:help;&:hover{color:", ";}&.disabled{cursor:not-allowed;&:hover{color:", ";}}"], styledVars.CAP_G2, styledVars.CAP_G1, styledVars.CAP_G2);
15
+ export var selectStyles = css(["&.cap-unified-select{width:100%;font-family:", ";.ant-select-selector{border-radius:", ";transition:", ";padding:0 12px;min-height:32px;display:flex;align-items:center;&:hover{border-color:", ";}}.cap-unified-select-right-slot{display:flex;align-items:center;gap:8px;margin-left:8px;}&.ant-select-focused{.ant-select-selector{border-color:", " !important;box-shadow:none !important;}}&.ant-select-status-error{.ant-select-selector{border-color:", ";}}&.ant-select-disabled{.ant-select-selector{background-color:", ";cursor:not-allowed;}}.ant-select-dropdown{padding:4px;border-radius:", ";box-shadow:0 2px 8px rgba(0,0,0,0.15);.ant-select-item{border-radius:", ";padding:8px 12px;transition:", ";&-option-selected{background-color:", ";color:", ";font-weight:500;}&-option-active{background-color:", ";}}.ant-select-search{padding:8px;input{border-radius:", ";transition:", ";&:focus{border-color:", ";box-shadow:none;}}}}&.ant-select-multiple{.ant-select-selection-item{background-color:", ";border-color:", ";border-radius:", ";color:", ";margin:2px 4px 2px 0;padding:0 8px;height:24px;line-height:22px;&-remove{color:", ";&:hover{color:", ";}}}.ant-select-selection-overflow{flex-wrap:wrap;gap:4px;}}.ant-select-tree{padding:4px 0;.ant-select-tree-node-content-wrapper{padding:4px 8px;border-radius:", ";transition:", ";&:hover{background-color:", ";}&.ant-select-tree-node-selected{background-color:", ";color:", ";font-weight:500;}}.ant-select-tree-switcher{width:24px;height:24px;line-height:24px;}.ant-select-tree-checkbox{margin:4px 8px 4px 0;}}&.ant-select-lg{.ant-select-selector{height:40px;padding:0 16px;}.ant-select-selection-item{height:28px;line-height:26px;}}&.ant-select-sm{.ant-select-selector{height:24px;padding:0 8px;}.ant-select-selection-item{height:20px;line-height:18px;}}&.ant-select-loading{.ant-select-arrow{.anticon-loading{color:", ";}}}}"], styledVars.FONT_FAMILY, styledVars.RADIUS_04, styledVars.TRANSITION_ALL, styledVars.CAP_G11, styledVars.CAP_G01, styledVars.CAP_RED, styledVars.CAP_G08, styledVars.RADIUS_04, styledVars.RADIUS_04, styledVars.TRANSITION_ALL, styledVars.CAP_PRIMARY.light, styledVars.CAP_PRIMARY.base, styledVars.CAP_G08, styledVars.RADIUS_04, styledVars.TRANSITION_ALL, styledVars.CAP_G01, styledVars.CAP_PRIMARY.light, styledVars.CAP_PRIMARY.light, styledVars.RADIUS_04, styledVars.CAP_PRIMARY.base, styledVars.CAP_PRIMARY.base, styledVars.CAP_PRIMARY.hover, styledVars.RADIUS_04, styledVars.TRANSITION_ALL, styledVars.CAP_G08, styledVars.CAP_PRIMARY.light, styledVars.CAP_PRIMARY.base, styledVars.CAP_PRIMARY.base);
@@ -0,0 +1,31 @@
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, { useMemo } from 'react';
3
+ import { injectIntl } from 'react-intl';
4
+ import enTranslation from '../translations/en';
5
+ var prefix = "blaze.components";
6
+ var LocaleHoc = function LocaleHoc(WrapperComponent, customProps) {
7
+ var Wrapper = function Wrapper(props) {
8
+ var componentName = customProps.key;
9
+ var translatedDefaults = enTranslation[componentName];
10
+ var intl = props.intl;
11
+ var translatedProps = useMemo(function () {
12
+ if (!translatedDefaults) return {};
13
+ return Object.keys(translatedDefaults).reduce(function (acc, key) {
14
+ var id = "".concat(prefix, ".").concat(componentName, ".").concat(key);
15
+ var defaultMessage = translatedDefaults[key];
16
+ try {
17
+ acc[key] = intl.formatMessage({
18
+ id: id,
19
+ defaultMessage: defaultMessage
20
+ });
21
+ } catch (err) {
22
+ acc[key] = defaultMessage;
23
+ }
24
+ return acc;
25
+ }, {});
26
+ }, [translatedDefaults, intl]);
27
+ return /*#__PURE__*/React.createElement(WrapperComponent, _extends({}, translatedProps, props));
28
+ };
29
+ return injectIntl(Wrapper);
30
+ };
31
+ export default LocaleHoc;