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

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 (145) hide show
  1. package/components/CapInput/CapInput.js +60 -0
  2. package/components/CapInput/Number.js +39 -0
  3. package/components/CapInput/Search.js +34 -0
  4. package/components/CapInput/TextArea.js +41 -0
  5. package/components/CapInput/index.js +13 -0
  6. package/components/CapInput/messages.js +24 -0
  7. package/components/CapInput/styles.js +8 -0
  8. package/components/CapSkeleton/CapSkeleton.js +24 -0
  9. package/components/CapSkeleton/index.js +7 -0
  10. package/components/CapSpin/CapSpin.js +30 -0
  11. package/components/CapSpin/index.js +7 -0
  12. package/components/CapTable/CapTable.js +118 -0
  13. package/components/CapTable/index.js +7 -0
  14. package/components/CapTable/loadable.js +18 -0
  15. package/components/CapTable/styles.js +23 -0
  16. package/components/CapTestSelect/CapTestSelect.js +36 -0
  17. package/components/CapTestSelect/index.js +7 -0
  18. package/components/CapUnifiedSelect/CapUnifiedSelect.js +359 -0
  19. package/components/CapUnifiedSelect/index.js +7 -0
  20. package/components/CapUnifiedSelect/messages.js +27 -0
  21. package/components/CapUnifiedSelect/styles.js +36 -0
  22. package/components/LocaleHoc/index.js +42 -0
  23. package/components/index.js +33 -0
  24. package/components/styled/index.js +14 -0
  25. package/components/styled/variables.js +70 -0
  26. package/{translations → components/translations}/en.js +37 -35
  27. package/dist/components/CapSkeleton/CapSkeleton.js +29 -0
  28. package/dist/components/CapSkeleton/index.js +13 -0
  29. package/dist/components/CapSpin/CapSpin.js +35 -0
  30. package/dist/components/CapSpin/index.js +13 -0
  31. package/dist/{CapTable → components/CapTable}/loadable.js +4 -4
  32. package/dist/components/CapTestSelect/CapTestSelect.js +40 -0
  33. package/dist/components/CapTestSelect/index.js +13 -0
  34. package/dist/components/CapUnifiedSelect/CapUnifiedSelect.js +406 -0
  35. package/dist/components/CapUnifiedSelect/index.js +13 -0
  36. package/dist/components/CapUnifiedSelect/messages.js +29 -0
  37. package/dist/components/CapUnifiedSelect/styles.js +39 -0
  38. package/dist/{index.js → components/index.js} +27 -0
  39. package/dist/esm/{CapRow/CapRow.js → components/CapSkeleton/CapSkeleton.js} +12 -12
  40. package/dist/esm/components/CapSkeleton/index.js +1 -0
  41. package/dist/esm/components/CapSpin/CapSpin.js +28 -0
  42. package/dist/esm/components/CapSpin/index.js +1 -0
  43. package/dist/esm/components/CapTable/loadable.js +12 -0
  44. package/dist/esm/components/CapTestSelect/CapTestSelect.js +34 -0
  45. package/dist/esm/components/CapTestSelect/index.js +1 -0
  46. package/dist/esm/components/CapUnifiedSelect/CapUnifiedSelect.js +398 -0
  47. package/dist/esm/components/CapUnifiedSelect/index.js +1 -0
  48. package/dist/esm/components/CapUnifiedSelect/styles.js +31 -0
  49. package/dist/esm/{index.js → components/index.js} +5 -1
  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 +7 -0
  56. package/utils/withStyles.js +15 -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/Number.js +0 -38
  65. package/CapInput/Search.js +0 -32
  66. package/CapInput/TextArea.js +0 -45
  67. package/CapInput/index.js +0 -10
  68. package/CapInput/loadable.js +0 -9
  69. package/CapInput/messages.js +0 -27
  70. package/CapInput/styles.js +0 -81
  71. package/CapLabel/CapLabel.js +0 -106
  72. package/CapLabel/index.js +0 -1
  73. package/CapLabel/styles.js +0 -221
  74. package/CapRow/CapRow.js +0 -22
  75. package/CapRow/index.js +0 -1
  76. package/CapRow/styles.js +0 -9
  77. package/CapTable/CapTable.js +0 -146
  78. package/CapTable/index.js +0 -3
  79. package/CapTable/loadable.js +0 -13
  80. package/CapTable/styles.js +0 -134
  81. package/CapTooltip/CapTooltip.js +0 -36
  82. package/CapTooltip/index.js +0 -1
  83. package/CapTooltip/styles.js +0 -42
  84. package/CapUnifiedSelect/CapUnifiedSelect.js +0 -121
  85. package/CapUnifiedSelect/index.js +0 -4
  86. package/CapUnifiedSelect/loadable.js +0 -3
  87. package/CapUnifiedSelect/messages.js +0 -24
  88. package/CapUnifiedSelect/styles.js +0 -223
  89. package/LocaleHoc/index.js +0 -38
  90. package/dist/235.index.js +0 -2
  91. package/dist/235.index.js.LICENSE.txt +0 -29
  92. package/dist/603.index.js +0 -1
  93. package/dist/esm/CapHeading/CapHeading.js +0 -41
  94. package/dist/esm/CapHeading/index.js +0 -1
  95. package/dist/esm/CapHeading/styles.js +0 -123
  96. package/dist/esm/CapInfoNote/CapInfoNote.js +0 -62
  97. package/dist/esm/CapInfoNote/index.js +0 -1
  98. package/dist/esm/CapInfoNote/styles.js +0 -6
  99. package/dist/esm/CapInput/loadable.js +0 -9
  100. package/dist/esm/CapLabel/CapLabel.js +0 -50
  101. package/dist/esm/CapLabel/index.js +0 -1
  102. package/dist/esm/CapLabel/styles.js +0 -219
  103. package/dist/esm/CapRow/index.js +0 -1
  104. package/dist/esm/CapRow/styles.js +0 -5
  105. package/dist/esm/CapTable/loadable.js +0 -12
  106. package/dist/esm/CapTooltip/CapTooltip.js +0 -34
  107. package/dist/esm/CapTooltip/index.js +0 -1
  108. package/dist/esm/CapTooltip/styles.js +0 -6
  109. package/dist/esm/CapUnifiedSelect/CapUnifiedSelect.js +0 -101
  110. package/dist/esm/CapUnifiedSelect/index.js +0 -3
  111. package/dist/esm/CapUnifiedSelect/loadable.js +0 -4
  112. package/dist/esm/CapUnifiedSelect/styles.js +0 -15
  113. package/dist/index.js.LICENSE.txt +0 -7
  114. package/index.js +0 -10
  115. package/styled/index.js +0 -6
  116. package/styled/variables.js +0 -89
  117. /package/dist/{CapInput → components/CapInput}/CapInput.js +0 -0
  118. /package/dist/{CapInput → components/CapInput}/Number.js +0 -0
  119. /package/dist/{CapInput → components/CapInput}/Search.js +0 -0
  120. /package/dist/{CapInput → components/CapInput}/TextArea.js +0 -0
  121. /package/dist/{CapInput → components/CapInput}/index.js +0 -0
  122. /package/dist/{CapInput → components/CapInput}/messages.js +0 -0
  123. /package/dist/{CapInput → components/CapInput}/styles.js +0 -0
  124. /package/dist/{CapTable → components/CapTable}/CapTable.js +0 -0
  125. /package/dist/{CapTable → components/CapTable}/index.js +0 -0
  126. /package/dist/{CapTable → components/CapTable}/styles.js +0 -0
  127. /package/dist/{LocaleHoc → components/LocaleHoc}/index.js +0 -0
  128. /package/dist/{styled → components/styled}/index.js +0 -0
  129. /package/dist/{styled → components/styled}/variables.js +0 -0
  130. /package/dist/{translations → components/translations}/en.js +0 -0
  131. /package/dist/esm/{CapInput → components/CapInput}/CapInput.js +0 -0
  132. /package/dist/esm/{CapInput → components/CapInput}/Number.js +0 -0
  133. /package/dist/esm/{CapInput → components/CapInput}/Search.js +0 -0
  134. /package/dist/esm/{CapInput → components/CapInput}/TextArea.js +0 -0
  135. /package/dist/esm/{CapInput → components/CapInput}/index.js +0 -0
  136. /package/dist/esm/{CapInput → components/CapInput}/messages.js +0 -0
  137. /package/dist/esm/{CapInput → components/CapInput}/styles.js +0 -0
  138. /package/dist/esm/{CapTable → components/CapTable}/CapTable.js +0 -0
  139. /package/dist/esm/{CapTable → components/CapTable}/index.js +0 -0
  140. /package/dist/esm/{CapTable → components/CapTable}/styles.js +0 -0
  141. /package/dist/esm/{CapUnifiedSelect → components/CapUnifiedSelect}/messages.js +0 -0
  142. /package/dist/esm/{LocaleHoc → components/LocaleHoc}/index.js +0 -0
  143. /package/dist/esm/{styled → components/styled}/index.js +0 -0
  144. /package/dist/esm/{styled → components/styled}/variables.js +0 -0
  145. /package/dist/esm/{translations → components/translations}/en.js +0 -0
@@ -0,0 +1,359 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+ var _react = _interopRequireWildcard(require("react"));
6
+ var _propTypes = _interopRequireDefault(require("prop-types"));
7
+ var _classnames = _interopRequireDefault(require("classnames"));
8
+ var _antd = require("antd");
9
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
10
+ var _icons = require("@ant-design/icons");
11
+ var _withStyles = _interopRequireDefault(require("../../utils/withStyles"));
12
+ var _styles = require("./styles");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
16
+ const CapUnifiedSelect = _ref => {
17
+ let {
18
+ type,
19
+ options = [],
20
+ treeData,
21
+ value,
22
+ onChange,
23
+ placeholder = 'Select an option',
24
+ className,
25
+ style,
26
+ status,
27
+ statusMessage,
28
+ allowClear = false,
29
+ label,
30
+ tooltip,
31
+ disabled = false,
32
+ treeCheckable = false,
33
+ customPopupRender = false,
34
+ onConfirm,
35
+ onCancel
36
+ } = _ref;
37
+ const StyledSelect = (0, _styledComponents.default)(_antd.Select).withConfig({
38
+ displayName: "StyledSelect",
39
+ componentId: "sc-wsphu8-0"
40
+ })(["", ""], _styles.selectStyles);
41
+ const StyledTreeSelect = (0, _styledComponents.default)(_antd.TreeSelect).withConfig({
42
+ displayName: "StyledTreeSelect",
43
+ componentId: "sc-wsphu8-1"
44
+ })(["", ""], _styles.selectStyles);
45
+ const [searchText, setSearchText] = (0, _react.useState)('');
46
+ const [tempValue, setTempValue] = (0, _react.useState)(value);
47
+ const [allSelected, setAllSelected] = (0, _react.useState)(false);
48
+ (0, _react.useEffect)(() => {
49
+ setTempValue(value);
50
+ }, [value]);
51
+ const selectVirtualizationProps = {
52
+ listHeight: 256
53
+ };
54
+ const treeSelectVirtualizationProps = {
55
+ listHeight: 256,
56
+ listItemHeight: 32
57
+ };
58
+ const NoResult = () => (0, _jsxRuntime.jsxs)("div", {
59
+ style: {
60
+ display: 'flex',
61
+ flexDirection: 'column',
62
+ alignItems: 'center',
63
+ justifyContent: 'center',
64
+ height: 200,
65
+ color: '#8c8c8c',
66
+ fontSize: 14
67
+ },
68
+ children: [(0, _jsxRuntime.jsx)(_icons.WarningFilled, {
69
+ style: {
70
+ fontSize: 36,
71
+ marginBottom: 8,
72
+ color: '#bfbfbf'
73
+ }
74
+ }), (0, _jsxRuntime.jsx)("div", {
75
+ style: {
76
+ fontWeight: 500
77
+ },
78
+ children: "No results found"
79
+ })]
80
+ });
81
+ const getFilteredTreeData = (data, search) => {
82
+ if (!search) return data;
83
+ const filterNode = node => {
84
+ var _node$title, _node$label;
85
+ const titleText = ((_node$title = node.title) == null ? void 0 : _node$title.toLowerCase()) || '';
86
+ const labelText = ((_node$label = node.label) == null ? void 0 : _node$label.toLowerCase()) || '';
87
+ return titleText.includes(search.toLowerCase()) || labelText.includes(search.toLowerCase());
88
+ };
89
+ const loop = data => data.map(item => {
90
+ const children = item.children ? loop(item.children) : [];
91
+ if (filterNode(item) || children.length) {
92
+ return {
93
+ ...item,
94
+ children
95
+ };
96
+ }
97
+ return null;
98
+ }).filter(Boolean);
99
+ return loop(data);
100
+ };
101
+ const flattenedLeafValues = nodes => (nodes == null ? void 0 : nodes.flatMap(node => node.children ? flattenedLeafValues(node.children) : [node.value])) || [];
102
+ const filteredTree = getFilteredTreeData(treeData || options, searchText);
103
+ const filteredOptions = !searchText ? options : options.filter(opt => {
104
+ var _opt$label;
105
+ return (_opt$label = opt.label) == null ? void 0 : _opt$label.toLowerCase().includes(searchText.toLowerCase());
106
+ });
107
+ const leafValues = flattenedLeafValues(filteredTree);
108
+ const handleSelectAll = function (isTree) {
109
+ if (isTree === void 0) {
110
+ isTree = false;
111
+ }
112
+ const availableValues = isTree ? leafValues : filteredOptions.map(opt => opt.value);
113
+ if (allSelected) {
114
+ setTempValue([]);
115
+ } else {
116
+ setTempValue(availableValues);
117
+ }
118
+ setAllSelected(!allSelected);
119
+ };
120
+ (0, _react.useEffect)(() => {
121
+ const isMultipleMode = type === 'multiSelect' || type === 'multiTreeSelect';
122
+ if (isMultipleMode && Array.isArray(tempValue)) {
123
+ const availableValues = type.includes('tree') ? leafValues : filteredOptions.map(opt => opt.value);
124
+ setAllSelected(tempValue.length > 0 && tempValue.length === availableValues.length);
125
+ }
126
+ }, [tempValue, filteredOptions, leafValues, type]);
127
+ const handleConfirm = () => {
128
+ if (onConfirm) {
129
+ onConfirm(tempValue);
130
+ } else {
131
+ onChange(tempValue);
132
+ }
133
+ setSearchText('');
134
+ };
135
+ const handleCancel = () => {
136
+ if (onCancel) {
137
+ onCancel();
138
+ }
139
+ setTempValue(value);
140
+ setSearchText('');
141
+ };
142
+ const handleTempChange = newValue => {
143
+ setTempValue(newValue);
144
+ };
145
+ const suffix = (type === "multiTreeSelect" || type === "multiSelect") && Array.isArray(value) && value.length > 1 ? (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
146
+ children: (0, _jsxRuntime.jsxs)("span", {
147
+ children: ["+", value.length - 1, " more", (0, _jsxRuntime.jsx)(_icons.DownOutlined, {})]
148
+ })
149
+ }) : (0, _jsxRuntime.jsx)(_icons.DownOutlined, {});
150
+ const prefix = () => {
151
+ if ((type === "multiTreeSelect" || type === "multiSelect") && Array.isArray(value) && value.length > 0) {
152
+ const selectedLabels = options.filter(opt => value.includes(opt.value)).map(opt => opt.label);
153
+ return selectedLabels[0];
154
+ } else {
155
+ return null;
156
+ }
157
+ };
158
+ const renderHeader = () => {
159
+ if (!label && !tooltip) return null;
160
+ return (0, _jsxRuntime.jsxs)(_styles.HeaderWrapper, {
161
+ className: disabled ? 'disabled' : '',
162
+ children: [label && (0, _jsxRuntime.jsx)("label", {
163
+ type: "label16",
164
+ className: disabled ? 'disabled' : '',
165
+ children: label
166
+ }), tooltip && (0, _jsxRuntime.jsx)(_antd.Tooltip, {
167
+ title: tooltip,
168
+ children: (0, _jsxRuntime.jsx)(_icons.InfoCircleOutlined, {
169
+ className: disabled ? 'disabled' : '',
170
+ style: {
171
+ color: '#B3BAC5'
172
+ }
173
+ })
174
+ })]
175
+ });
176
+ };
177
+ const renderDropdown = () => {
178
+ const isMultipleSelect = type === 'multiSelect' || type === 'multiTreeSelect';
179
+ const isTreeMode = type === 'treeSelect' || type === 'multiTreeSelect';
180
+ const currentItems = isTreeMode ? filteredTree : filteredOptions;
181
+ const selectedCount = Array.isArray(tempValue) ? tempValue.length : tempValue ? 1 : 0;
182
+ const renderCustomDropdown = menu => {
183
+ if (!customPopupRender) return menu;
184
+ return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
185
+ children: [(0, _jsxRuntime.jsx)("div", {
186
+ style: {
187
+ borderBottom: '1px solid #f0f0f0'
188
+ },
189
+ children: (0, _jsxRuntime.jsx)(_antd.Input, {
190
+ prefix: (0, _jsxRuntime.jsx)(_icons.SearchOutlined, {
191
+ style: {
192
+ color: "#B3BAC5"
193
+ }
194
+ }),
195
+ placeholder: "Search",
196
+ variant: "borderless",
197
+ value: searchText,
198
+ onChange: e => setSearchText(e.target.value),
199
+ onKeyDown: e => e.stopPropagation()
200
+ })
201
+ }), isMultipleSelect && currentItems.length > 0 && (0, _jsxRuntime.jsxs)("div", {
202
+ style: {
203
+ padding: '8px 12px',
204
+ cursor: 'pointer',
205
+ display: 'flex',
206
+ alignItems: 'center',
207
+ borderBottom: '1px solid #f0f0f0'
208
+ },
209
+ onClick: e => {
210
+ e.stopPropagation();
211
+ handleSelectAll(isTreeMode);
212
+ },
213
+ children: [(0, _jsxRuntime.jsx)("input", {
214
+ type: "checkbox",
215
+ checked: allSelected,
216
+ readOnly: true,
217
+ style: {
218
+ cursor: 'pointer'
219
+ },
220
+ onClick: e => e.stopPropagation()
221
+ }), (0, _jsxRuntime.jsx)("label", {
222
+ style: {
223
+ marginLeft: 8,
224
+ cursor: 'pointer'
225
+ },
226
+ children: "Select all"
227
+ })]
228
+ }), currentItems.length === 0 ? (0, _jsxRuntime.jsx)(NoResult, {}) : menu, currentItems.length > 0 && isMultipleSelect && (0, _jsxRuntime.jsxs)("div", {
229
+ style: {
230
+ display: 'flex',
231
+ justifyContent: 'space-between',
232
+ alignItems: 'center',
233
+ padding: '8px 12px',
234
+ borderTop: '1px solid #f0f0f0'
235
+ },
236
+ children: [(0, _jsxRuntime.jsxs)("div", {
237
+ children: [(0, _jsxRuntime.jsx)(_antd.Button, {
238
+ type: "primary",
239
+ size: "small",
240
+ style: {
241
+ marginRight: 8
242
+ },
243
+ onClick: e => {
244
+ e.stopPropagation();
245
+ handleConfirm();
246
+ },
247
+ children: "Confirm"
248
+ }), (0, _jsxRuntime.jsx)(_antd.Button, {
249
+ type: "text",
250
+ size: "small",
251
+ onClick: e => {
252
+ e.stopPropagation();
253
+ handleCancel();
254
+ },
255
+ children: "Cancel"
256
+ })]
257
+ }), selectedCount > 0 && (0, _jsxRuntime.jsxs)("span", {
258
+ style: {
259
+ color: '#8c8c8c',
260
+ fontSize: '14px'
261
+ },
262
+ children: [selectedCount, " selected"]
263
+ })]
264
+ })]
265
+ });
266
+ };
267
+ if (type === 'treeSelect' || type === 'multiTreeSelect') {
268
+ return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
269
+ children: [(0, _jsxRuntime.jsx)(StyledTreeSelect, {
270
+ treeData: filteredTree,
271
+ value: customPopupRender ? tempValue : value,
272
+ onChange: customPopupRender ? handleTempChange : onChange,
273
+ placeholder: placeholder,
274
+ maxTagCount: 0,
275
+ maxTagPlaceholder: () => null,
276
+ prefix: type === "multiTreeSelect" && value.length > 0 && prefix(),
277
+ suffixIcon: suffix,
278
+ className: (0, _classnames.default)(`cap-unified-tree-select ${className || ''}`),
279
+ style: style,
280
+ status: status,
281
+ allowClear: allowClear,
282
+ showSearch: false,
283
+ multiple: type === 'multiTreeSelect',
284
+ treeCheckable: treeCheckable,
285
+ showCheckedStrategy: _antd.TreeSelect.SHOW_PARENT,
286
+ virtual: true,
287
+ disabled: disabled,
288
+ filterTreeNode: false,
289
+ ...treeSelectVirtualizationProps,
290
+ popupRender: renderCustomDropdown
291
+ }), status === 'error' && (0, _jsxRuntime.jsx)("div", {
292
+ style: {
293
+ color: '#E83135'
294
+ },
295
+ className: "cap-unified-select-status",
296
+ children: statusMessage
297
+ })]
298
+ });
299
+ }
300
+ return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
301
+ children: [(0, _jsxRuntime.jsx)(StyledSelect, {
302
+ options: filteredOptions,
303
+ value: customPopupRender ? tempValue : value,
304
+ onChange: customPopupRender ? handleTempChange : onChange,
305
+ placeholder: placeholder,
306
+ maxTagCount: 0,
307
+ maxTagPlaceholder: () => null,
308
+ prefix: type === "multiSelect" && value.length > 0 && prefix(),
309
+ suffixIcon: suffix,
310
+ className: (0, _classnames.default)('cap-unified-select', className),
311
+ style: style,
312
+ allowClear: allowClear,
313
+ showSearch: false,
314
+ mode: type === 'multiSelect' ? 'multiple' : undefined,
315
+ virtual: true,
316
+ disabled: disabled,
317
+ status: status,
318
+ ...selectVirtualizationProps,
319
+ popupRender: renderCustomDropdown
320
+ }), status === 'error' && (0, _jsxRuntime.jsx)("div", {
321
+ style: {
322
+ color: '#E83135'
323
+ },
324
+ className: "cap-unified-select-status",
325
+ children: statusMessage
326
+ })]
327
+ });
328
+ };
329
+ return (0, _jsxRuntime.jsxs)(_styles.SelectWrapper, {
330
+ className: (0, _classnames.default)(`cap-unified-select-container ${className || ''}`),
331
+ children: [renderHeader(), renderDropdown()]
332
+ });
333
+ };
334
+ CapUnifiedSelect.propTypes = {
335
+ type: _propTypes.default.oneOf(['select', 'multiSelect', 'treeSelect', 'multiTreeSelect']),
336
+ options: _propTypes.default.array,
337
+ treeData: _propTypes.default.array,
338
+ value: _propTypes.default.any,
339
+ onChange: _propTypes.default.func,
340
+ placeholder: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
341
+ className: _propTypes.default.string,
342
+ style: _propTypes.default.object,
343
+ allowClear: _propTypes.default.bool,
344
+ label: _propTypes.default.string,
345
+ tooltip: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
346
+ disabled: _propTypes.default.bool,
347
+ treeCheckable: _propTypes.default.bool,
348
+ customPopupRender: _propTypes.default.bool,
349
+ onConfirm: _propTypes.default.func,
350
+ onCancel: _propTypes.default.func
351
+ };
352
+ CapUnifiedSelect.defaultProps = {
353
+ type: 'select',
354
+ allowClear: false,
355
+ customPopupRender: false,
356
+ treeCheckable: false,
357
+ className: ''
358
+ };
359
+ var _default = exports.default = (0, _withStyles.default)(CapUnifiedSelect, _styles.selectStyles);
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+ var _CapUnifiedSelect = _interopRequireDefault(require("./CapUnifiedSelect"));
6
+ exports.default = _CapUnifiedSelect.default;
7
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+ var _reactIntl = require("react-intl");
6
+ var _default = exports.default = (0, _reactIntl.defineMessages)({
7
+ selectPlaceholder: {
8
+ id: 'cap.unified.select.placeholder',
9
+ defaultMessage: 'Select an option'
10
+ },
11
+ searchPlaceholder: {
12
+ id: 'cap.unified.select.search.placeholder',
13
+ defaultMessage: 'Search...'
14
+ },
15
+ noData: {
16
+ id: 'cap.unified.select.no.data',
17
+ defaultMessage: 'No data'
18
+ },
19
+ loading: {
20
+ id: 'cap.unified.select.loading',
21
+ defaultMessage: 'Loading...'
22
+ },
23
+ selected: {
24
+ id: 'cap.unified.select.selected',
25
+ defaultMessage: '{count} items selected'
26
+ }
27
+ });
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.selectStyles = exports.StyledInfoIcon = exports.SelectWrapper = exports.SelectAllCheckbox = exports.SearchInputWrapper = exports.NoResultWrapper = exports.HeaderWrapper = exports.DropdownFooter = void 0;
5
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
6
+ var styledVars = _interopRequireWildcard(require("../styled/variables"));
7
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
8
+ const SelectWrapper = exports.SelectWrapper = _styledComponents.default.div.withConfig({
9
+ displayName: "SelectWrapper",
10
+ componentId: "sc-3v7xpu-0"
11
+ })(["display:flex;flex-direction:column;gap:8px;width:100%;&.disabled{cursor:not-allowed;}"]);
12
+ const HeaderWrapper = exports.HeaderWrapper = _styledComponents.default.div.withConfig({
13
+ displayName: "HeaderWrapper",
14
+ componentId: "sc-3v7xpu-1"
15
+ })(["display:flex;align-items:center;gap:4px;&.disabled{opacity:0.5;cursor:not-allowed;}"]);
16
+ const DropdownFooter = exports.DropdownFooter = _styledComponents.default.div.withConfig({
17
+ displayName: "DropdownFooter",
18
+ componentId: "sc-3v7xpu-2"
19
+ })(["display:flex;justify-content:space-between;align-items:center;padding:8px;border-top:1px solid #f0f0f0;.footer-buttons{display:flex;align-items:center;gap:8px;}.total-count{color:#8c8c8c;font-size:12px;}"]);
20
+ const SearchInputWrapper = exports.SearchInputWrapper = _styledComponents.default.div.withConfig({
21
+ displayName: "SearchInputWrapper",
22
+ componentId: "sc-3v7xpu-3"
23
+ })(["padding:8px;border-bottom:1px solid #f0f0f0;"]);
24
+ const SelectAllCheckbox = exports.SelectAllCheckbox = _styledComponents.default.div.withConfig({
25
+ displayName: "SelectAllCheckbox",
26
+ componentId: "sc-3v7xpu-4"
27
+ })(["display:flex;align-items:center;padding:8px 12px;cursor:pointer;font-weight:500;border-bottom:1px solid #f0f0f0;user-select:none;input[type=\"checkbox\"]{cursor:pointer;}"]);
28
+ const NoResultWrapper = exports.NoResultWrapper = _styledComponents.default.div.withConfig({
29
+ displayName: "NoResultWrapper",
30
+ componentId: "sc-3v7xpu-5"
31
+ })(["display:flex;flex-direction:column;align-items:center;justify-content:center;height:200px;color:#8c8c8c;font-size:14px;"]);
32
+ const StyledInfoIcon = exports.StyledInfoIcon = _styledComponents.default.span.withConfig({
33
+ displayName: "StyledInfoIcon",
34
+ componentId: "sc-3v7xpu-6"
35
+ })(["color:", ";font-size:16px;cursor:help;margin-left:4px;display:flex;align-items:center;&:hover{color:", ";}&.disabled{cursor:not-allowed;&:hover{color:", ";}}"], styledVars.CAP_G05, styledVars.CAP_G03, styledVars.CAP_G05);
36
+ const selectStyles = exports.selectStyles = (0, _styledComponents.css)(["&.cap-unified-select{width:100%;font-family:", ";}&.cap-unified-select-container{.ant-select-prefix{margin-left:-5px !important;font-size:14px !important;font-weight:400 !important;color:#091E42 !important;line-height:20px !important;}}"], styledVars.FONT_FAMILY);
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+ var _react = _interopRequireWildcard(require("react"));
6
+ var _reactIntl = require("react-intl");
7
+ var _en = _interopRequireDefault(require("../translations/en"));
8
+ var _jsxRuntime = require("react/jsx-runtime");
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
+ const prefix = `blaze.components`;
12
+ const LocaleHoc = (WrapperComponent, customProps) => {
13
+ const Wrapper = props => {
14
+ const componentName = customProps.key;
15
+ const translatedDefaults = _en.default[componentName];
16
+ const {
17
+ intl
18
+ } = props;
19
+ const translatedProps = (0, _react.useMemo)(() => {
20
+ if (!translatedDefaults) return {};
21
+ return Object.keys(translatedDefaults).reduce((acc, key) => {
22
+ const id = `${prefix}.${componentName}.${key}`;
23
+ const defaultMessage = translatedDefaults[key];
24
+ try {
25
+ acc[key] = intl.formatMessage({
26
+ id,
27
+ defaultMessage
28
+ });
29
+ } catch (err) {
30
+ acc[key] = defaultMessage;
31
+ }
32
+ return acc;
33
+ }, {});
34
+ }, [translatedDefaults, intl]);
35
+ return (0, _jsxRuntime.jsx)(WrapperComponent, {
36
+ ...translatedProps,
37
+ ...props
38
+ });
39
+ };
40
+ return (0, _reactIntl.injectIntl)(Wrapper);
41
+ };
42
+ var _default = exports.default = LocaleHoc;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ var _exportNames = {
5
+ CapInput: true,
6
+ CapTable: true,
7
+ CapTestSelect: true,
8
+ LocaleHoc: true,
9
+ styled: true,
10
+ styledVars: true
11
+ };
12
+ exports.styledVars = exports.styled = exports.LocaleHoc = exports.CapTestSelect = exports.CapTable = exports.CapInput = void 0;
13
+ var _CapInput = _interopRequireDefault(require("./CapInput"));
14
+ exports.CapInput = _CapInput.default;
15
+ var _CapTable = _interopRequireDefault(require("./CapTable"));
16
+ exports.CapTable = _CapTable.default;
17
+ var _CapTestSelect = _interopRequireDefault(require("./CapTestSelect"));
18
+ exports.CapTestSelect = _CapTestSelect.default;
19
+ var _LocaleHoc = _interopRequireDefault(require("./LocaleHoc"));
20
+ exports.LocaleHoc = _LocaleHoc.default;
21
+ var _styledVars = _interopRequireWildcard(require("./styled/variables"));
22
+ exports.styledVars = _styledVars;
23
+ var _styled = _interopRequireDefault(require("./styled"));
24
+ exports.styled = _styled.default;
25
+ var _utils = require("../utils");
26
+ Object.keys(_utils).forEach(function (key) {
27
+ if (key === "default" || key === "__esModule") return;
28
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
29
+ if (key in exports && exports[key] === _utils[key]) return;
30
+ exports[key] = _utils[key];
31
+ });
32
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
33
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ var _exportNames = {};
5
+ exports.default = void 0;
6
+ var styledVars = _interopRequireWildcard(require("./variables"));
7
+ Object.keys(styledVars).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
10
+ if (key in exports && exports[key] === styledVars[key]) return;
11
+ exports[key] = styledVars[key];
12
+ });
13
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
+ var _default = exports.default = styledVars;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.TRANSITION_ALL = exports.SPACING_32 = exports.SPACING_24 = exports.SPACING_16 = exports.SPACING_12 = exports.SPACING_08 = exports.SPACING_04 = exports.RADIUS_08 = exports.RADIUS_04 = exports.FONT_WEIGHT_REGULAR = exports.FONT_WEIGHT_MEDIUM = exports.FONT_FAMILY = exports.CAP_YELLOW02 = exports.CAP_YELLOW01 = exports.CAP_YELLOW = exports.CAP_WHITE = exports.CAP_SECONDARY = exports.CAP_RED03 = exports.CAP_RED02 = exports.CAP_RED01 = exports.CAP_RED = exports.CAP_PURPLE04 = exports.CAP_PURPLE03 = exports.CAP_PURPLE02 = exports.CAP_PURPLE01 = exports.CAP_PURPLE = exports.CAP_PRIMARY = exports.CAP_PINK = exports.CAP_PALE_GREY = exports.CAP_ORANGE02 = exports.CAP_ORANGE01 = exports.CAP_ORANGE = exports.CAP_ICON = exports.CAP_GREEN02 = exports.CAP_GREEN01 = exports.CAP_G20 = exports.CAP_G19 = exports.CAP_G18 = exports.CAP_G17 = exports.CAP_G16 = exports.CAP_G15 = exports.CAP_G14 = exports.CAP_G13 = exports.CAP_G12 = exports.CAP_G11 = exports.CAP_G10 = exports.CAP_G09 = exports.CAP_G08 = exports.CAP_G07 = exports.CAP_G06 = exports.CAP_G05 = exports.CAP_G04 = exports.CAP_G03 = exports.CAP_G02 = exports.CAP_G01 = exports.CAP_BLUE02 = exports.CAP_BLUE01 = exports.CAP_BLUE = exports.CAP_BLACK = void 0;
5
+ const CAP_PRIMARY = exports.CAP_PRIMARY = {
6
+ base: "#47af46",
7
+ hover: "#1f9a1d",
8
+ disabled: "#a1d8a0"
9
+ };
10
+ const CAP_SECONDARY = exports.CAP_SECONDARY = {
11
+ base: "#2466ea",
12
+ light: 'rgba("#2466ea", 0.1)'
13
+ };
14
+ const CAP_ORANGE = exports.CAP_ORANGE = "#f87d23";
15
+ const CAP_ORANGE01 = exports.CAP_ORANGE01 = "#ffe5d2";
16
+ const CAP_ORANGE02 = exports.CAP_ORANGE02 = "#fa7d02";
17
+ const CAP_YELLOW = exports.CAP_YELLOW = "#fec52e";
18
+ const CAP_YELLOW01 = exports.CAP_YELLOW01 = "#e8bc25";
19
+ const CAP_YELLOW02 = exports.CAP_YELLOW02 = "#f9d438";
20
+ const CAP_BLUE = exports.CAP_BLUE = "#23cccc";
21
+ const CAP_PURPLE = exports.CAP_PURPLE = "#8517e5";
22
+ const CAP_PINK = exports.CAP_PINK = "#e51fa3";
23
+ const CAP_RED = exports.CAP_RED = "#ea213a";
24
+ const CAP_ICON = exports.CAP_ICON = "#7a869a";
25
+ const CAP_PALE_GREY = exports.CAP_PALE_GREY = "#e9f0fe";
26
+ const CAP_BLUE01 = exports.CAP_BLUE01 = "#2466eb";
27
+ const CAP_BLUE02 = exports.CAP_BLUE02 = "#1d61ee";
28
+ const CAP_RED01 = exports.CAP_RED01 = "#e51fa3";
29
+ const CAP_RED02 = exports.CAP_RED02 = "#f5222d";
30
+ const CAP_RED03 = exports.CAP_RED03 = "#ed1b34";
31
+ const CAP_PURPLE01 = exports.CAP_PURPLE01 = "#6563ff";
32
+ const CAP_PURPLE02 = exports.CAP_PURPLE02 = "#a451ff";
33
+ const CAP_PURPLE03 = exports.CAP_PURPLE03 = "#f2e7fe";
34
+ const CAP_PURPLE04 = exports.CAP_PURPLE04 = "#d4e1fc";
35
+ const CAP_GREEN01 = exports.CAP_GREEN01 = "#6bb56b";
36
+ const CAP_GREEN02 = exports.CAP_GREEN02 = "#ecf7ec";
37
+ const CAP_G01 = exports.CAP_G01 = "#091e42";
38
+ const CAP_G02 = exports.CAP_G02 = "#253858";
39
+ const CAP_G03 = exports.CAP_G03 = "#42526e";
40
+ const CAP_G04 = exports.CAP_G04 = "#5e6c84";
41
+ const CAP_G05 = exports.CAP_G05 = "#97a0af";
42
+ const CAP_G06 = exports.CAP_G06 = "#b3bac5";
43
+ const CAP_G07 = exports.CAP_G07 = "#dfe2e7";
44
+ const CAP_G08 = exports.CAP_G08 = "#ebecf0";
45
+ const CAP_G09 = exports.CAP_G09 = "#f4f5f7";
46
+ const CAP_G10 = exports.CAP_G10 = "#fafbfc";
47
+ const CAP_G11 = exports.CAP_G11 = "#7a869a";
48
+ const CAP_G12 = exports.CAP_G12 = "#e8e8e8";
49
+ const CAP_G13 = exports.CAP_G13 = "#ecece7";
50
+ const CAP_G14 = exports.CAP_G14 = "#e9f0fd";
51
+ const CAP_G15 = exports.CAP_G15 = "#efefef";
52
+ const CAP_G16 = exports.CAP_G16 = "#2a2a2a";
53
+ const CAP_G17 = exports.CAP_G17 = "#7F8185";
54
+ const CAP_G18 = exports.CAP_G18 = "#dcdee2";
55
+ const CAP_G19 = exports.CAP_G19 = "#8a9ab2";
56
+ const CAP_G20 = exports.CAP_G20 = "#c2c2c2";
57
+ const CAP_WHITE = exports.CAP_WHITE = "#ffffff";
58
+ const CAP_BLACK = exports.CAP_BLACK = "#000000";
59
+ const FONT_FAMILY = exports.FONT_FAMILY = '"Roboto", sans-serif';
60
+ const FONT_WEIGHT_REGULAR = exports.FONT_WEIGHT_REGULAR = 400;
61
+ const FONT_WEIGHT_MEDIUM = exports.FONT_WEIGHT_MEDIUM = 500;
62
+ const SPACING_04 = exports.SPACING_04 = "4px";
63
+ const SPACING_08 = exports.SPACING_08 = "8px";
64
+ const SPACING_12 = exports.SPACING_12 = "12px";
65
+ const SPACING_16 = exports.SPACING_16 = "16px";
66
+ const SPACING_24 = exports.SPACING_24 = "24px";
67
+ const SPACING_32 = exports.SPACING_32 = "32px";
68
+ const RADIUS_04 = exports.RADIUS_04 = "4px";
69
+ const RADIUS_08 = exports.RADIUS_08 = "8px";
70
+ const TRANSITION_ALL = exports.TRANSITION_ALL = "all 0.3s ease";