@capillarytech/blaze-ui 0.1.6-alpha.6 → 0.1.6-alpha.61

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 (102) hide show
  1. package/.DS_Store +0 -0
  2. package/CapIcon/CapIcon.js +183 -0
  3. package/CapIcon/index.js +3 -0
  4. package/CapIcon/styles.js +76 -0
  5. package/CapInput/CapInput.js +2 -2
  6. package/CapInput/Number.js +1 -1
  7. package/CapInput/Search.js +1 -1
  8. package/CapInput/TextArea.js +1 -1
  9. package/CapLabel/CapLabel.js +101 -81
  10. package/CapLabel/index.js +3 -1
  11. package/CapLabel/styles.js +250 -212
  12. package/CapRow/CapRow.js +111 -10
  13. package/CapRow/index.js +3 -1
  14. package/CapRow/styles.js +47 -6
  15. package/CapSkeleton/CapSkeleton.js +17 -0
  16. package/CapSkeleton/index.js +1 -0
  17. package/CapSpin/CapSpin.js +23 -0
  18. package/CapSpin/index.js +1 -0
  19. package/CapTable/loadable.js +4 -4
  20. package/CapTable/styles.js +1 -1
  21. package/CapTestSelect/CapTestSelect.js +47 -0
  22. package/CapTestSelect/index.js +1 -0
  23. package/CapTooltip/CapTooltip.js +87 -25
  24. package/CapTooltip/index.js +3 -1
  25. package/CapTooltip/styles.js +19 -27
  26. package/CapTooltipWithInfo/CapTooltipWithInfo.js +82 -0
  27. package/CapTooltipWithInfo/index.js +3 -0
  28. package/CapTooltipWithInfo/styles.js +22 -0
  29. package/CapUnifiedSelect/CapUnifiedSelect.js +415 -74
  30. package/CapUnifiedSelect/index.js +1 -4
  31. package/CapUnifiedSelect/styles.js +300 -168
  32. package/assets/upload.svg +3 -0
  33. package/index.js +12 -1
  34. package/package.json +6 -12
  35. package/utils/index.js +1 -0
  36. package/utils/withMemo.js +33 -0
  37. package/utils/withStyles.js +24 -0
  38. package/CapHeading/CapHeading.js +0 -71
  39. package/CapHeading/index.js +0 -1
  40. package/CapHeading/styles.js +0 -125
  41. package/CapInfoNote/CapInfoNote.js +0 -54
  42. package/CapInfoNote/index.js +0 -1
  43. package/CapInfoNote/styles.js +0 -63
  44. package/CapInput/loadable.js +0 -9
  45. package/CapUnifiedSelect/loadable.js +0 -3
  46. package/dist/235.index.js +0 -2
  47. package/dist/235.index.js.LICENSE.txt +0 -29
  48. package/dist/603.index.js +0 -1
  49. package/dist/CapInput/CapInput.js +0 -66
  50. package/dist/CapInput/Number.js +0 -42
  51. package/dist/CapInput/Search.js +0 -35
  52. package/dist/CapInput/TextArea.js +0 -42
  53. package/dist/CapInput/index.js +0 -15
  54. package/dist/CapInput/messages.js +0 -32
  55. package/dist/CapInput/styles.js +0 -11
  56. package/dist/CapTable/CapTable.js +0 -148
  57. package/dist/CapTable/index.js +0 -9
  58. package/dist/CapTable/loadable.js +0 -23
  59. package/dist/CapTable/styles.js +0 -26
  60. package/dist/LocaleHoc/index.js +0 -40
  61. package/dist/esm/CapHeading/CapHeading.js +0 -41
  62. package/dist/esm/CapHeading/index.js +0 -1
  63. package/dist/esm/CapHeading/styles.js +0 -123
  64. package/dist/esm/CapInfoNote/CapInfoNote.js +0 -62
  65. package/dist/esm/CapInfoNote/index.js +0 -1
  66. package/dist/esm/CapInfoNote/styles.js +0 -6
  67. package/dist/esm/CapInput/CapInput.js +0 -57
  68. package/dist/esm/CapInput/Number.js +0 -35
  69. package/dist/esm/CapInput/Search.js +0 -28
  70. package/dist/esm/CapInput/TextArea.js +0 -35
  71. package/dist/esm/CapInput/index.js +0 -8
  72. package/dist/esm/CapInput/loadable.js +0 -9
  73. package/dist/esm/CapInput/messages.js +0 -25
  74. package/dist/esm/CapInput/styles.js +0 -3
  75. package/dist/esm/CapLabel/CapLabel.js +0 -50
  76. package/dist/esm/CapLabel/index.js +0 -1
  77. package/dist/esm/CapLabel/styles.js +0 -219
  78. package/dist/esm/CapRow/CapRow.js +0 -22
  79. package/dist/esm/CapRow/index.js +0 -1
  80. package/dist/esm/CapRow/styles.js +0 -5
  81. package/dist/esm/CapTable/CapTable.js +0 -140
  82. package/dist/esm/CapTable/index.js +0 -2
  83. package/dist/esm/CapTable/loadable.js +0 -12
  84. package/dist/esm/CapTable/styles.js +0 -17
  85. package/dist/esm/CapTooltip/CapTooltip.js +0 -34
  86. package/dist/esm/CapTooltip/index.js +0 -1
  87. package/dist/esm/CapTooltip/styles.js +0 -6
  88. package/dist/esm/CapUnifiedSelect/CapUnifiedSelect.js +0 -101
  89. package/dist/esm/CapUnifiedSelect/index.js +0 -3
  90. package/dist/esm/CapUnifiedSelect/loadable.js +0 -4
  91. package/dist/esm/CapUnifiedSelect/messages.js +0 -23
  92. package/dist/esm/CapUnifiedSelect/styles.js +0 -15
  93. package/dist/esm/LocaleHoc/index.js +0 -31
  94. package/dist/esm/index.js +0 -11
  95. package/dist/esm/styled/index.js +0 -5
  96. package/dist/esm/styled/variables.js +0 -88
  97. package/dist/esm/translations/en.js +0 -329
  98. package/dist/index.js +0 -39
  99. package/dist/index.js.LICENSE.txt +0 -7
  100. package/dist/styled/index.js +0 -22
  101. package/dist/styled/variables.js +0 -94
  102. package/dist/translations/en.js +0 -335
@@ -1,121 +1,462 @@
1
- // CapUnifiedSelect component using Ant Design v5 Select and TreeSelect directly
2
- import React from 'react';
1
+ import React, { useState, useEffect, useMemo, useCallback, memo } from 'react';
3
2
  import PropTypes from 'prop-types';
4
- import { Select, TreeSelect } from 'antd';
5
- import { SelectWrapper, HeaderWrapper, StyledInfoIcon } from './styles';
6
- import CapLabel from '../CapLabel';
7
- import CapTooltip from '../CapTooltip';
3
+ import classnames from 'classnames';
4
+ import { TreeSelect, Input, Button, Checkbox } from 'antd-v5';
5
+ import styled from 'styled-components';
6
+ import * as styledVars from '../styled/variables';
7
+ import { CapLabel, CapTooltipWithInfo, CapRow, CapIcon } from '../';
8
+ import withStyles from '../utils/withStyles';
9
+ import withMemo from '../utils/withMemo';
10
+ import { HeaderWrapper, selectStyles } from './styles';
8
11
 
9
- function CapUnifiedSelect({
12
+ const StyledTreeSelect = styled(TreeSelect)`
13
+ ${selectStyles}
14
+ `;
15
+
16
+ const NoResult = memo(({ noResultCustomText, className, showUpload, options, noResultCustomIcon }) => (
17
+ <CapRow
18
+ className={classnames(className, 'cap-unified-select-no-result')}
19
+ align="middle"
20
+ gap={8}
21
+ >
22
+ <CapIcon type={noResultCustomIcon} size="m" />
23
+ <CapLabel className="cap-unified-select-no-result-text">
24
+ {showUpload && options?.length === 0
25
+ ? noResultCustomText
26
+ : 'No results found'}
27
+ </CapLabel>
28
+ </CapRow>
29
+ ));
30
+
31
+ const SelectAllCheckbox = memo(({ currentItems, tempValue, setTempValue, processTreeData }) => {
32
+ const { leafValues } = processTreeData(currentItems);
33
+ const totalAvailable = leafValues.length;
34
+ const leafSet = new Set(leafValues);
35
+ const selectedInScope = Array.isArray(tempValue)
36
+ ? tempValue.filter((v) => leafSet.has(v)).length
37
+ : 0;
38
+
39
+ const allChecked = totalAvailable > 0 && selectedInScope === totalAvailable;
40
+ const indeterminate = selectedInScope > 0 && selectedInScope < totalAvailable;
41
+
42
+ const handleChange = (e) => {
43
+ if (e.target.checked) {
44
+ const merged = new Set(Array.isArray(tempValue) ? tempValue : []);
45
+ leafValues.forEach((v) => merged.add(v));
46
+ setTempValue(Array.from(merged));
47
+ } else {
48
+ const toRemove = new Set(leafValues);
49
+ const next = (Array.isArray(tempValue) ? tempValue : []).filter(
50
+ (v) => !toRemove.has(v)
51
+ );
52
+ setTempValue(next);
53
+ }
54
+ };
55
+
56
+ return (
57
+ <CapRow className="cap-unified-select-select-all-container" align="middle">
58
+ <Checkbox
59
+ className="cap-unified-select-select-all-checkbox"
60
+ checked={allChecked}
61
+ indeterminate={indeterminate}
62
+ onChange={handleChange}
63
+ >
64
+ <CapLabel type="label14" className="cap-unified-select-select-all-label">Select all</CapLabel>
65
+ </Checkbox>
66
+ </CapRow>
67
+ );
68
+ });
69
+
70
+ const buildTreeMaps = (nodes) => {
71
+ const result = {
72
+ leafValues: [],
73
+ parentChildMap: {},
74
+ nodeMap: {},
75
+ };
76
+ if (!nodes) return result;
77
+
78
+ const traverse = (items) => {
79
+ items.forEach((item) => {
80
+ result.nodeMap[item.value] = item;
81
+ if (item.children && item.children.length > 0) {
82
+ result.parentChildMap[item.value] = item.children.map(child => child.value);
83
+ traverse(item.children);
84
+ } else {
85
+ result.leafValues.push(item.value);
86
+ }
87
+ });
88
+ };
89
+ traverse(nodes);
90
+ return result;
91
+ };
92
+
93
+ const countSelectedLeaves = (treeMaps, selectedValues) => {
94
+ if (!Array.isArray(selectedValues) || !selectedValues.length) return 0;
95
+ const expandedSet = new Set(selectedValues);
96
+ const processNode = (value) => {
97
+ const children = treeMaps.parentChildMap[value];
98
+ if (!children) return;
99
+ children.forEach(childValue => {
100
+ expandedSet.add(childValue);
101
+ processNode(childValue);
102
+ });
103
+ };
104
+ selectedValues.forEach(processNode);
105
+ return treeMaps.leafValues.reduce((count, leaf) => expandedSet.has(leaf) ? count + 1 : count, 0);
106
+ };
107
+
108
+ const filterTreeData = (data, search, searchBasedOn) => {
109
+ if (!data?.length || !search) return data;
110
+ const searchLower = search.toLowerCase();
111
+ const nodeMatchesSearch = (node) => {
112
+ const target = searchBasedOn === 'value'
113
+ ? String(node.value ?? '')
114
+ : searchBasedOn === 'key'
115
+ ? String(node.key ?? '')
116
+ : String(node.label ?? node.title ?? '');
117
+ return target.toLowerCase().includes(searchLower);
118
+ };
119
+ const loop = (items) =>
120
+ items.reduce((acc, item) => {
121
+ if (!item) return acc;
122
+ const children = item.children?.length ? loop(item.children) : [];
123
+ if (nodeMatchesSearch(item) || children.length) {
124
+ acc.push({ ...item, children });
125
+ }
126
+ return acc;
127
+ }, []);
128
+ return loop(data);
129
+ };
130
+
131
+ const CapUnifiedSelect = ({
10
132
  type,
11
133
  options = [],
12
- treeData,
13
134
  value,
14
135
  onChange,
15
136
  placeholder = 'Select an option',
16
137
  className,
17
138
  style,
139
+ isError = false,
140
+ errorMessage,
141
+ containerClassName,
142
+ popoverClassName,
18
143
  allowClear = false,
19
- showSearch = false,
20
- label,
144
+ headerLabel,
145
+ onUpload,
21
146
  tooltip,
147
+ bylineText,
22
148
  disabled = false,
23
- }) {
24
- const selectVirtualizationProps = {
25
- listHeight: 256,
26
- };
149
+ showUpload = false,
150
+ customPopupRender = true,
151
+ showSearch = true,
152
+ searchBasedOn = 'label',
153
+ onConfirm,
154
+ onCancel,
155
+ noResultCustomText = 'No results found',
156
+ noResultCustomIcon = 'warning',
157
+ ...rest
158
+ }) => {
159
+ const [searchText, setSearchText] = useState('');
160
+ const [tempValue, setTempValue] = useState(value);
161
+ const [dropdownOpen, setDropdownOpen] = useState(false);
27
162
 
28
- const treeSelectVirtualizationProps = {
29
- listHeight: 256,
30
- listItemHeight: 32,
31
- };
163
+ useEffect(() => {
164
+ const isEqual = Array.isArray(value) && Array.isArray(tempValue)
165
+ ? value.length === tempValue.length && value.every((v) => tempValue.includes(v))
166
+ : value === tempValue;
167
+ if (!isEqual) setTempValue(value);
168
+ }, [value]);
32
169
 
33
- const renderHeader = () => {
34
- if (!label && !tooltip) return null;
35
-
170
+ const isMulti = useMemo(() => type === 'multiSelect' || type === 'multiTreeSelect', [type]);
171
+ const isTree = useMemo(() => type === 'treeSelect' || type === 'multiTreeSelect', [type]);
172
+
173
+ const dataSource = useMemo(() => {
174
+ if (!options?.length) return [];
175
+ return isTree
176
+ ? options
177
+ : options.map((opt) => ({
178
+ title: opt?.label,
179
+ value: opt?.value,
180
+ key: opt?.key || opt?.value,
181
+ }));
182
+ }, [isTree, options]);
183
+
184
+ const filteredTree = useMemo(
185
+ () => filterTreeData(dataSource, searchText, searchBasedOn),
186
+ [dataSource, searchText, searchBasedOn]
187
+ );
188
+
189
+ const treeMaps = useMemo(() => buildTreeMaps(options), [options]);
190
+ const selectedLeafCount = useMemo(() => countSelectedLeaves(treeMaps, tempValue), [treeMaps, tempValue]);
191
+
192
+ const displayValue = dropdownOpen ? tempValue : value;
193
+
194
+ const suffix = useMemo(() => {
195
+ const count = Array.isArray(displayValue) ? displayValue.length : (displayValue ? 1 : 0);
36
196
  return (
37
- <HeaderWrapper className={disabled ? 'disabled' : ''}>
38
- {label && (
39
- <CapLabel type="label16" className={disabled ? 'disabled' : ''}>
40
- {label}
41
- </CapLabel>
42
- )}
43
- {tooltip && (
44
- <CapTooltip title={tooltip}>
45
- <StyledInfoIcon className={disabled ? 'disabled' : ''} />
46
- </CapTooltip>
197
+ <>
198
+ {isMulti && count > 1 && <span>+{count - 1} more </span>}
199
+ <CapIcon
200
+ className="cap-unified-select-suffix-icon"
201
+ type={dropdownOpen ? 'up' : 'down'}
202
+ size="s"
203
+ />
204
+ </>
205
+ );
206
+ }, [isMulti, displayValue, dropdownOpen]);
207
+
208
+ const prefix = useMemo(() => {
209
+ if (isMulti && Array.isArray(displayValue) && displayValue.length > 0) {
210
+ const firstLeafValue = displayValue.find(val => treeMaps.leafValues.includes(val));
211
+ return treeMaps.nodeMap[firstLeafValue]?.label || treeMaps.nodeMap[firstLeafValue]?.title || null;
212
+ }
213
+ return null;
214
+ }, [isMulti, displayValue, treeMaps]);
215
+
216
+ const handleConfirm = useCallback(() => {
217
+ onChange?.(tempValue);
218
+ setDropdownOpen(false);
219
+ setSearchText('');
220
+ onConfirm?.(tempValue);
221
+ }, [onChange, onConfirm, tempValue]);
222
+
223
+ const handleCancel = useCallback(() => {
224
+ setTempValue(value);
225
+ setDropdownOpen(false);
226
+ onCancel?.();
227
+ }, [value, onCancel]);
228
+
229
+ const handleDropdownVisibilityChange = useCallback((open) => {
230
+ if (!open && !customPopupRender) {
231
+ onChange?.(tempValue);
232
+ } else if (!open) {
233
+ setTempValue(value);
234
+ }
235
+ setDropdownOpen(open);
236
+ }, [customPopupRender, value, onChange, tempValue]);
237
+
238
+ const renderHeader = useMemo(() => {
239
+ if (!headerLabel && !tooltip) return null;
240
+ return (
241
+ <>
242
+ <HeaderWrapper className={classnames(disabled && 'disabled', 'cap-unified-select-header')}>
243
+ {headerLabel && (
244
+ <CapLabel
245
+ type="label16"
246
+ className={classnames(disabled && 'disabled', 'cap-unified-select-header-label')}
247
+ >
248
+ {headerLabel}
249
+ </CapLabel>
250
+ )}
251
+ {tooltip && (
252
+ <CapTooltipWithInfo
253
+ title={tooltip}
254
+ className={classnames(disabled && 'disabled', 'cap-unified-select-header-tooltip')}
255
+ iconProps={{ disabled }}
256
+ />
257
+ )}
258
+ </HeaderWrapper>
259
+ {bylineText && (
260
+ <div className="cap-unified-select-header-byline-text">
261
+ <CapLabel
262
+ className={classnames(disabled && 'disabled', 'cap-unified-select-header-byline-text')}
263
+ >
264
+ {bylineText}
265
+ </CapLabel>
266
+ </div>
47
267
  )}
48
- </HeaderWrapper>
268
+ </>
49
269
  );
50
- };
270
+ }, [headerLabel, tooltip, bylineText, disabled]);
271
+
272
+ const renderCustomDropdown = useCallback(
273
+ (menu) => {
274
+ if (!customPopupRender) return menu;
275
+ const currentItems = filteredTree;
51
276
 
52
- const renderDropdown = () => {
53
- if (type === 'treeSelect' || type === 'multiTreeSelect') {
54
277
  return (
55
- <TreeSelect
56
- treeData={treeData || options}
57
- value={value}
58
- onChange={onChange}
59
- placeholder={placeholder}
60
- className={className}
61
- style={style}
62
- allowClear={allowClear}
63
- showSearch={showSearch}
64
- multiple={type === 'multiTreeSelect' ? true : false}
65
- virtual
66
- treeDefaultExpandAll
67
- disabled={disabled}
68
- {...treeSelectVirtualizationProps}
69
- />
278
+ <div className={classnames(popoverClassName, `${type}-popup-container`)}>
279
+ {showSearch && (
280
+ <CapRow className="cap-unified-select-search-container" align="middle">
281
+ <Input
282
+ prefix={<CapIcon type="search" size="s" style={{ color: styledVars.CAP_G06 }} />}
283
+ placeholder="Search"
284
+ variant="borderless"
285
+ value={searchText}
286
+ onChange={(e) => setSearchText(e.target.value)}
287
+ allowClear
288
+ />
289
+ </CapRow>
290
+ )}
291
+
292
+ {isMulti && showUpload && (
293
+ <CapRow className="cap-unified-select-upload-container" align="middle" onClick={onUpload}>
294
+ <CapIcon type="upload" size="s" style={{ color: styledVars.CAP_SECONDARY.base }} />
295
+ <CapLabel type="label14" className="cap-unified-select-upload-label">Upload</CapLabel>
296
+ </CapRow>
297
+ )}
298
+
299
+ {isMulti && currentItems.length > 0 && (
300
+ <SelectAllCheckbox
301
+ currentItems={currentItems}
302
+ tempValue={tempValue}
303
+ setTempValue={setTempValue}
304
+ processTreeData={buildTreeMaps}
305
+ />
306
+ )}
307
+
308
+ {currentItems.length === 0 ? (
309
+ <NoResult
310
+ noResultCustomText={noResultCustomText}
311
+ className={className}
312
+ showUpload={showUpload}
313
+ options={options}
314
+ noResultCustomIcon={noResultCustomIcon}
315
+ />
316
+ ) : (
317
+ menu
318
+ )}
319
+
320
+ {currentItems.length > 0 && isMulti && (
321
+ <div className="cap-unified-select-confirm-container">
322
+ <div className="cap-unified-select-confirm-button-group">
323
+ <Button
324
+ type="primary"
325
+ size="small"
326
+ className="cap-unified-select-confirm-button"
327
+ onClick={handleConfirm}
328
+ >
329
+ Confirm
330
+ </Button>
331
+ <Button
332
+ type="text"
333
+ className="cap-unified-select-cancel-button"
334
+ size="small"
335
+ onClick={handleCancel}
336
+ >
337
+ Cancel
338
+ </Button>
339
+ <CapLabel className="cap-unified-select-selected-count">
340
+ {selectedLeafCount} selected
341
+ </CapLabel>
342
+ </div>
343
+ </div>
344
+ )}
345
+ </div>
70
346
  );
71
- }
347
+ },
348
+ [
349
+ customPopupRender,
350
+ filteredTree,
351
+ searchText,
352
+ isMulti,
353
+ showUpload,
354
+ onUpload,
355
+ noResultCustomText,
356
+ noResultCustomIcon,
357
+ options,
358
+ type,
359
+ tempValue,
360
+ handleConfirm,
361
+ handleCancel,
362
+ popoverClassName,
363
+ className,
364
+ selectedLeafCount,
365
+ ]
366
+ );
72
367
 
73
- return (
74
- <Select
75
- value={value}
76
- onChange={onChange}
368
+ const combinedClassName = useMemo(
369
+ () => classnames(containerClassName, 'cap-unified-tree-select', className),
370
+ [containerClassName, className]
371
+ );
372
+
373
+ return (
374
+ <CapRow className={classnames(className, 'cap-unified-select-container')}>
375
+ {renderHeader}
376
+ <StyledTreeSelect
377
+ type={type}
378
+ treeData={filteredTree}
379
+ value={customPopupRender ? tempValue : value}
380
+ onChange={isMulti ? setTempValue : onChange}
77
381
  placeholder={placeholder}
78
- className={className}
382
+ showSearch={false}
383
+ maxTagCount={0}
384
+ maxTagPlaceholder={() => null}
385
+ prefix={prefix || undefined}
386
+ suffixIcon={suffix}
387
+ className={combinedClassName}
388
+ classNames={{
389
+ popup: { root: classnames('custom-popup-container', className) },
390
+ }}
79
391
  style={style}
392
+ status={isError ? 'error' : ''}
80
393
  allowClear={allowClear}
81
- showSearch={showSearch}
82
- options={options}
83
- mode={type === 'multiSelect' ? 'multiple' : undefined}
394
+ multiple={isMulti}
395
+ treeCheckable={isMulti}
396
+ treeCheckStrictly={false}
397
+ showCheckedStrategy={TreeSelect.SHOW_CHILD}
398
+ open={dropdownOpen}
399
+ onOpenChange={handleDropdownVisibilityChange}
84
400
  virtual
85
401
  disabled={disabled}
86
- {...selectVirtualizationProps}
402
+ filterTreeNode={false}
403
+ listHeight={256}
404
+ listItemHeight={32}
405
+ popupRender={renderCustomDropdown}
406
+ {...rest}
87
407
  />
88
- );
89
- };
90
-
91
- return (
92
- <SelectWrapper>
93
- {renderHeader()}
94
- {renderDropdown()}
95
- </SelectWrapper>
408
+ {isError && (
409
+ <CapLabel className="cap-unified-select-status" style={{ color: 'red' }}>
410
+ {errorMessage}
411
+ </CapLabel>
412
+ )}
413
+ </CapRow>
96
414
  );
97
- }
415
+ };
98
416
 
99
417
  CapUnifiedSelect.propTypes = {
100
418
  type: PropTypes.oneOf(['select', 'multiSelect', 'treeSelect', 'multiTreeSelect']),
101
419
  options: PropTypes.array,
102
- treeData: PropTypes.array,
103
420
  value: PropTypes.any,
104
421
  onChange: PropTypes.func,
105
422
  placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
106
423
  className: PropTypes.string,
107
424
  style: PropTypes.object,
108
425
  allowClear: PropTypes.bool,
109
- showSearch: PropTypes.bool,
110
- label: PropTypes.string,
426
+ headerLabel: PropTypes.string,
111
427
  tooltip: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
112
428
  disabled: PropTypes.bool,
429
+ customPopupRender: PropTypes.bool,
430
+ showSearch: PropTypes.bool,
431
+ searchBasedOn: PropTypes.oneOf(['label', 'value', 'key']),
432
+ onConfirm: PropTypes.func,
433
+ onCancel: PropTypes.func,
434
+ isError: PropTypes.bool,
435
+ errorMessage: PropTypes.string,
436
+ popupClassName: PropTypes.string,
437
+ showUpload: PropTypes.bool,
438
+ onUpload: PropTypes.func,
113
439
  };
114
440
 
115
441
  CapUnifiedSelect.defaultProps = {
116
442
  type: 'select',
443
+ placeholder: 'Select an option',
444
+ searchBasedOn: 'label',
445
+ noResultCustomText: 'No results found',
446
+ noResultCustomIcon: 'warning',
447
+ options: [],
117
448
  allowClear: false,
118
- showSearch: false,
449
+ customPopupRender: true,
450
+ showSearch: true,
451
+ className: '',
452
+ popupClassName: '',
453
+ disabled: false,
454
+ showUpload: false,
455
+ isError: false,
456
+ onUpload: () => {},
457
+ onChange: () => {},
458
+ onConfirm: () => {},
459
+ onCancel: () => {},
119
460
  };
120
461
 
121
- export default CapUnifiedSelect;
462
+ export default withMemo(withStyles(CapUnifiedSelect, selectStyles));
@@ -1,4 +1 @@
1
- import CapUnifiedSelect from './CapUnifiedSelect';
2
- import CapUnifiedSelectLoadable from './loadable';
3
-
4
- export default CapUnifiedSelectLoadable;
1
+ export { default } from './CapUnifiedSelect';