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

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 (101) 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/CapInput.js +1 -1
  8. package/CapInput/Number.js +1 -1
  9. package/CapInput/Search.js +1 -1
  10. package/CapInput/TextArea.js +1 -1
  11. package/CapInput/loadable.js +9 -0
  12. package/CapLabel/CapLabel.js +81 -101
  13. package/CapLabel/index.js +1 -3
  14. package/CapLabel/styles.js +212 -250
  15. package/CapRow/CapRow.js +10 -111
  16. package/CapRow/index.js +1 -3
  17. package/CapRow/styles.js +6 -47
  18. package/CapTable/loadable.js +4 -4
  19. package/CapTable/styles.js +1 -1
  20. package/CapTooltip/CapTooltip.js +25 -87
  21. package/CapTooltip/index.js +1 -3
  22. package/CapTooltip/styles.js +27 -19
  23. package/CapUnifiedSelect/CapUnifiedSelect.js +67 -546
  24. package/CapUnifiedSelect/index.js +4 -1
  25. package/CapUnifiedSelect/loadable.js +3 -0
  26. package/CapUnifiedSelect/styles.js +168 -300
  27. package/dist/235.index.js +2 -0
  28. package/dist/235.index.js.LICENSE.txt +29 -0
  29. package/dist/603.index.js +1 -0
  30. package/dist/CapInput/CapInput.js +66 -0
  31. package/dist/CapInput/Number.js +42 -0
  32. package/dist/CapInput/Search.js +35 -0
  33. package/dist/CapInput/TextArea.js +42 -0
  34. package/dist/CapInput/index.js +15 -0
  35. package/dist/CapInput/messages.js +32 -0
  36. package/dist/CapInput/styles.js +11 -0
  37. package/dist/CapTable/CapTable.js +148 -0
  38. package/dist/CapTable/index.js +9 -0
  39. package/dist/CapTable/loadable.js +23 -0
  40. package/dist/CapTable/styles.js +26 -0
  41. package/dist/LocaleHoc/index.js +40 -0
  42. package/dist/esm/CapHeading/CapHeading.js +41 -0
  43. package/dist/esm/CapHeading/index.js +1 -0
  44. package/dist/esm/CapHeading/styles.js +123 -0
  45. package/dist/esm/CapInfoNote/CapInfoNote.js +62 -0
  46. package/dist/esm/CapInfoNote/index.js +1 -0
  47. package/dist/esm/CapInfoNote/styles.js +6 -0
  48. package/dist/esm/CapInput/CapInput.js +57 -0
  49. package/dist/esm/CapInput/Number.js +35 -0
  50. package/dist/esm/CapInput/Search.js +28 -0
  51. package/dist/esm/CapInput/TextArea.js +35 -0
  52. package/dist/esm/CapInput/index.js +8 -0
  53. package/dist/esm/CapInput/loadable.js +9 -0
  54. package/dist/esm/CapInput/messages.js +25 -0
  55. package/dist/esm/CapInput/styles.js +3 -0
  56. package/dist/esm/CapLabel/CapLabel.js +50 -0
  57. package/dist/esm/CapLabel/index.js +1 -0
  58. package/dist/esm/CapLabel/styles.js +219 -0
  59. package/dist/esm/CapRow/CapRow.js +22 -0
  60. package/dist/esm/CapRow/index.js +1 -0
  61. package/dist/esm/CapRow/styles.js +5 -0
  62. package/dist/esm/CapTable/CapTable.js +140 -0
  63. package/dist/esm/CapTable/index.js +2 -0
  64. package/dist/esm/CapTable/loadable.js +12 -0
  65. package/dist/esm/CapTable/styles.js +17 -0
  66. package/dist/esm/CapTooltip/CapTooltip.js +34 -0
  67. package/dist/esm/CapTooltip/index.js +1 -0
  68. package/dist/esm/CapTooltip/styles.js +6 -0
  69. package/dist/esm/CapUnifiedSelect/CapUnifiedSelect.js +101 -0
  70. package/dist/esm/CapUnifiedSelect/index.js +3 -0
  71. package/dist/esm/CapUnifiedSelect/loadable.js +4 -0
  72. package/dist/esm/CapUnifiedSelect/messages.js +23 -0
  73. package/dist/esm/CapUnifiedSelect/styles.js +15 -0
  74. package/dist/esm/LocaleHoc/index.js +31 -0
  75. package/dist/esm/index.js +11 -0
  76. package/dist/esm/styled/index.js +5 -0
  77. package/dist/esm/styled/variables.js +88 -0
  78. package/dist/esm/translations/en.js +329 -0
  79. package/dist/index.js +39 -0
  80. package/dist/index.js.LICENSE.txt +7 -0
  81. package/dist/styled/index.js +22 -0
  82. package/dist/styled/variables.js +94 -0
  83. package/dist/translations/en.js +335 -0
  84. package/index.js +1 -12
  85. package/package.json +11 -5
  86. package/.DS_Store +0 -0
  87. package/CapIcon/CapIcon.js +0 -183
  88. package/CapIcon/index.js +0 -3
  89. package/CapIcon/styles.js +0 -76
  90. package/CapSkeleton/CapSkeleton.js +0 -17
  91. package/CapSkeleton/index.js +0 -1
  92. package/CapSpin/CapSpin.js +0 -23
  93. package/CapSpin/index.js +0 -1
  94. package/CapTestSelect/CapTestSelect.js +0 -47
  95. package/CapTestSelect/index.js +0 -1
  96. package/CapTooltipWithInfo/CapTooltipWithInfo.js +0 -82
  97. package/CapTooltipWithInfo/index.js +0 -3
  98. package/CapTooltipWithInfo/styles.js +0 -22
  99. package/assets/upload.svg +0 -3
  100. package/utils/index.js +0 -1
  101. package/utils/withStyles.js +0 -24
@@ -1,600 +1,121 @@
1
- // Enhanced CapUnifiedSelect supporting 4 scenarios with advanced features in a single TreeSelect
2
- import React, { useState, useEffect, useMemo, useCallback, memo } from 'react';
1
+ // CapUnifiedSelect component using Ant Design v5 Select and TreeSelect directly
2
+ import React from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import classnames from 'classnames';
5
- import { TreeSelect, Input, Button, Checkbox } from 'antd-v5';
6
- import styled from 'styled-components';
7
- import * as styledVars from '../styled/variables';
8
- import { CapLabel, CapTooltipWithInfo, CapRow, CapIcon } from '../';
9
- import withStyles from '../utils/withStyles';
10
- import { HeaderWrapper, selectStyles } from './styles';
4
+ import { Select, TreeSelect } from 'antd';
5
+ import { SelectWrapper, HeaderWrapper, StyledInfoIcon } from './styles';
6
+ import CapLabel from '../CapLabel';
7
+ import CapTooltip from '../CapTooltip';
11
8
 
12
- const StyledTreeSelect = styled(TreeSelect)`
13
- ${selectStyles}
14
- `;
15
-
16
- const CapUnifiedSelect = ({
9
+ function CapUnifiedSelect({
17
10
  type,
18
11
  options = [],
12
+ treeData,
19
13
  value,
20
14
  onChange,
21
15
  placeholder = 'Select an option',
22
16
  className,
23
17
  style,
24
- isError = false,
25
- errorMessage,
26
- containerClassName,
27
- popoverClassName,
28
18
  allowClear = false,
29
- headerLabel,
30
- onUpload,
19
+ showSearch = false,
20
+ label,
31
21
  tooltip,
32
- bylineText,
33
22
  disabled = false,
34
- showUpload = false,
35
- customPopupRender = true,
36
- showSearch = true,
37
- searchBasedOn = 'label',
38
- onConfirm,
39
- onCancel,
40
- size = 'm',
41
- noResultCustomText = 'No results found',
42
- noResultCustomIcon = 'warning',
43
- ...rest
44
- }) => {
45
- const [searchText, setSearchText] = useState('');
46
- const [tempValue, setTempValue] = useState(value);
47
- const [dropdownOpen, setDropdownOpen] = useState(false);
48
-
49
- useEffect(() => {
50
- setTempValue(value);
51
- }, [value]);
23
+ }) {
24
+ const selectVirtualizationProps = {
25
+ listHeight: 256,
26
+ };
52
27
 
53
28
  const treeSelectVirtualizationProps = {
54
29
  listHeight: 256,
55
30
  listItemHeight: 32,
56
31
  };
57
32
 
58
- const NoResult = ({ noResultCustomText, className, showUpload, options }) => (
59
- <CapRow
60
- className={classnames(className, 'cap-unified-select-no-result')}
61
- align="middle"
62
- gap={8}
63
- >
64
- <CapIcon type={noResultCustomIcon} size="m" />
65
- <CapLabel className="cap-unified-select-no-result-text">
66
- {showUpload && options?.length === 0
67
- ? noResultCustomText
68
- : 'No results found'}
69
- </CapLabel>
70
- </CapRow>
71
- );
72
-
73
- const getFilteredTreeData = useCallback(
74
- (data, search) => {
75
- if (!search || !data || data.length === 0) return data;
76
- const searchLower = search.toLowerCase();
77
-
78
- const filterNode = (node) => {
79
- if (!node) return false;
80
-
81
- let textToSearch = '';
82
-
83
- if (searchBasedOn === 'value') {
84
- textToSearch = String(node.value || '').toLowerCase();
85
- } else if (searchBasedOn === 'key') {
86
- textToSearch = String(node.key || '').toLowerCase();
87
- } else {
88
- textToSearch = String(node.label || node.title || '').toLowerCase();
89
- }
90
-
91
- return textToSearch.includes(searchLower);
92
- };
93
-
94
- const loop = (data) => {
95
- if (!data) return [];
96
-
97
- return data
98
- .map((item) => {
99
- if (!item) return null;
100
-
101
- const children =
102
- item.children && item.children.length > 0
103
- ? loop(item.children)
104
- : [];
105
-
106
- if (filterNode(item) || children.length > 0) {
107
- return { ...item, children };
108
- }
109
- return null;
110
- })
111
- .filter(Boolean);
112
- };
113
-
114
- return loop(data);
115
- },
116
- [searchBasedOn],
117
- );
118
-
119
- const processTreeData = useCallback((nodes, selectedValues = null) => {
120
- const result = {
121
- leafValues: [],
122
- parentChildMap: {},
123
- nodeMap: {},
124
- selectedCount: 0,
125
- };
126
-
127
- if (!nodes) return result;
128
-
129
- const traverse = (items) => {
130
- items.forEach((item) => {
131
- result.nodeMap[item.value] = item;
132
-
133
- if (item.children && item.children.length > 0) {
134
- result.parentChildMap[item.value] = item.children.map(
135
- (child) => child.value,
136
- );
137
- traverse(item.children);
138
- } else {
139
- result.leafValues.push(item.value);
140
- }
141
- });
142
- };
143
- traverse(nodes);
144
-
145
- if (
146
- selectedValues &&
147
- Array.isArray(selectedValues) &&
148
- selectedValues.length > 0
149
- ) {
150
- const expandedSet = new Set(selectedValues);
151
-
152
- const processNode = (value) => {
153
- const children = result.parentChildMap[value];
154
- if (!children) return;
155
-
156
- children.forEach((childValue) => {
157
- expandedSet.add(childValue);
158
- processNode(childValue);
159
- });
160
- };
161
-
162
- selectedValues.forEach(processNode);
163
-
164
- result.leafValues.forEach((value) => {
165
- if (expandedSet.has(value)) result.selectedCount++;
166
- });
167
- }
168
-
169
- return result;
170
- }, []);
171
-
172
- const isMulti = useMemo(
173
- () => type === 'multiSelect' || type === 'multiTreeSelect',
174
- [type],
175
- );
176
- const isTree = useMemo(
177
- () => type === 'treeSelect' || type === 'multiTreeSelect',
178
- [type],
179
- );
180
-
181
- const dataSource = useMemo(() => {
182
- // Skip transformation if options is empty or undefined
183
- if (!options || options.length === 0) return [];
184
-
185
- // Only transform if not a tree select
186
- return isTree
187
- ? options
188
- : options.map((opt) => ({
189
- title: opt?.label,
190
- value: opt?.value,
191
- key: opt?.key || opt?.value,
192
- }));
193
- }, [isTree, options]);
194
-
195
- const filteredTree = useMemo(() => {
196
- // Skip filtering if search text is empty
197
- if (!searchText) return dataSource;
198
-
199
- return getFilteredTreeData(dataSource, searchText);
200
- }, [dataSource, searchText, getFilteredTreeData]);
201
-
202
- const handleConfirm = useCallback(() => {
203
- if (onChange) onChange(tempValue);
204
- setDropdownOpen(false);
205
- if (onConfirm) onConfirm(tempValue);
206
- }, [onChange, onConfirm, tempValue]);
207
-
208
- const handleCancel = useCallback(() => {
209
- setTempValue(value);
210
- setDropdownOpen(false);
211
- if (onCancel) onCancel();
212
- }, [value, onCancel]);
213
-
214
- const handleTempChange = useCallback((newValue) => {
215
- setTempValue(newValue);
216
- }, []);
217
-
218
- const handleDropdownVisibilityChange = useCallback(
219
- (open) => {
220
- if (open === false && !customPopupRender) {
221
- if (onChange) onChange(tempValue);
222
- } else if (open === false) {
223
- setTempValue(value);
224
- }
225
- setDropdownOpen(open);
226
- },
227
- [value, onChange, tempValue, customPopupRender],
228
- );
229
-
230
- const suffix = useMemo(() => {
231
- const displayValue = dropdownOpen ? tempValue : value;
232
- const showMore = isMulti && Array.isArray(displayValue) && displayValue.length > 1;
233
- return (
234
- <>
235
- {showMore && <span>+{displayValue.length - 1} more </span>}
236
- <CapIcon className="cap-unified-select-suffix-icon" type={dropdownOpen ? 'up' : 'down'} size="s" />
237
- </>
238
- );
239
- }, [isMulti, value, tempValue, dropdownOpen]);
240
-
241
- const prefix = useMemo(() => {
242
- if (isMulti) {
243
- if (Array.isArray(tempValue) && tempValue?.length > 0) {
244
- const firstSelectedValue = tempValue[0];
245
- const firstSelectedOption = options?.find(
246
- (opt) => opt?.value === firstSelectedValue,
247
- );
248
- return firstSelectedOption?.label || null;
249
- } else if (Array.isArray(value) && value?.length > 0) {
250
- const firstSelectedValue = value[0];
251
- const firstSelectedOption = options?.find(
252
- (opt) => opt?.value === firstSelectedValue,
253
- );
254
- return firstSelectedOption?.label || null;
255
- }
256
- }
257
- return null;
258
- }, [isMulti, value, tempValue, options]);
259
-
260
- const renderHeader = useCallback(() => {
261
- if (!headerLabel && !tooltip) return null;
33
+ const renderHeader = () => {
34
+ if (!label && !tooltip) return null;
35
+
262
36
  return (
263
- <>
264
- <HeaderWrapper
265
- className={classnames(
266
- disabled ? 'disabled' : '',
267
- 'cap-unified-select-header',
268
- )}
269
- >
270
- {headerLabel && (
271
- <CapLabel
272
- type="label16"
273
- className={classnames(
274
- disabled ? 'disabled' : '',
275
- 'cap-unified-select-header-label',
276
- )}
277
- >
278
- {headerLabel}
279
- </CapLabel>
280
- )}
281
- {tooltip && (
282
- <CapTooltipWithInfo
283
- title={tooltip}
284
- className={classnames(
285
- disabled ? 'disabled' : '',
286
- 'cap-unified-select-header-tooltip',
287
- )}
288
- iconProps={{ disabled }}
289
- />
290
- )}
291
- </HeaderWrapper>
292
- {bylineText && (
293
- <div className="cap-unified-select-header-byline-text">
294
- <CapLabel
295
- className={classnames(
296
- disabled ? 'disabled' : '',
297
- 'cap-unified-select-header-byline-text',
298
- )}
299
- >
300
- {bylineText}
301
- </CapLabel>
302
- </div>
37
+ <HeaderWrapper className={disabled ? 'disabled' : ''}>
38
+ {label && (
39
+ <CapLabel type="label16" className={disabled ? 'disabled' : ''}>
40
+ {label}
41
+ </CapLabel>
303
42
  )}
304
- </>
305
- );
306
- }, [headerLabel, tooltip, bylineText, disabled]);
307
-
308
- const renderDropdown = useCallback(() => {
309
- const currentItems = filteredTree;
310
- const selectedCount = Array.isArray(tempValue)
311
- ? isTree
312
- ? processTreeData(dataSource, tempValue).selectedCount
313
- : tempValue?.length || 0
314
- : tempValue
315
- ? 1
316
- : 0;
317
-
318
- const renderCustomDropdown = useCallback(
319
- (menu) => {
320
- if (!customPopupRender) return menu;
321
-
322
- return (
323
- <div
324
- className={classnames(popoverClassName, `${type}-popup-container`)}
325
- >
326
- {showSearch && (
327
- <CapRow
328
- className={classnames('cap-unified-select-search-container')}
329
- align="middle"
330
- >
331
- <Input
332
- prefix={
333
- <CapIcon
334
- type="search"
335
- size="s"
336
- style={{ color: styledVars.CAP_G06 }}
337
- />
338
- }
339
- placeholder="Search"
340
- variant="borderless"
341
- value={searchText}
342
- onChange={(e) => setSearchText(e.target.value)}
343
- />
344
- </CapRow>
345
- )}
346
- {isMulti && showUpload && (
347
- <CapRow
348
- className={classnames('cap-unified-select-upload-container')}
349
- align="middle"
350
- onClick={onUpload}
351
- >
352
- <CapIcon
353
- type="upload"
354
- size="s"
355
- style={{ color: styledVars.CAP_SECONDARY.base }}
356
- />
357
- <CapLabel
358
- type="label14"
359
- className={classnames('cap-unified-select-upload-label')}
360
- >
361
- Upload
362
- </CapLabel>
363
- </CapRow>
364
- )}
365
- {isMulti &&
366
- currentItems.length > 0 &&
367
- (() => {
368
- const { leafValues } = processTreeData(currentItems);
369
- const totalAvailable = leafValues.length;
370
- const selectedInScope = processTreeData(
371
- currentItems,
372
- tempValue,
373
- ).selectedCount;
374
-
375
- return (
376
- <CapRow
377
- className={classnames(
378
- 'cap-unified-select-select-all-container',
379
- )}
380
- align="middle"
381
- >
382
- <Checkbox
383
- className={classnames(
384
- 'cap-unified-select-select-all-checkbox',
385
- )}
386
- checked={
387
- totalAvailable > 0 && selectedInScope === totalAvailable
388
- }
389
- indeterminate={
390
- selectedInScope > 0 && selectedInScope < totalAvailable
391
- }
392
- onChange={(e) => {
393
- setTempValue(e.target.checked ? leafValues : []);
394
- }}
395
- >
396
- <CapLabel
397
- type="label14"
398
- className={classnames(
399
- 'cap-unified-select-select-all-label',
400
- )}
401
- >
402
- Select all
403
- </CapLabel>
404
- </Checkbox>
405
- </CapRow>
406
- );
407
- })()}
408
-
409
- {currentItems.length === 0 ? (
410
- <NoResult
411
- noResultCustomText={noResultCustomText}
412
- className={classnames(
413
- className,
414
- 'cap-unified-select-no-result',
415
- )}
416
- showUpload={showUpload}
417
- options={options}
418
- />
419
- ) : (
420
- menu
421
- )}
422
-
423
- {currentItems.length > 0 && isMulti && (
424
- <div className="cap-unified-select-confirm-container">
425
- <div className="cap-unified-select-confirm-button-group">
426
- <Button
427
- type="primary"
428
- size="small"
429
- className="cap-unified-select-confirm-button"
430
- onClick={handleConfirm}
431
- >
432
- Confirm
433
- </Button>
434
- <Button
435
- type="text"
436
- className="cap-unified-select-cancel-button"
437
- size="small"
438
- onClick={handleCancel}
439
- >
440
- Cancel
441
- </Button>
442
- <CapLabel className="cap-unified-select-selected-count">
443
- {selectedCount} selected
444
- </CapLabel>
445
- </div>
446
- </div>
447
- )}
448
- </div>
449
- );
450
- },
451
- [
452
- customPopupRender,
453
- popoverClassName,
454
- type,
455
- showSearch,
456
- searchText,
457
- isMulti,
458
- showUpload,
459
- currentItems,
460
- tempValue,
461
- className,
462
- noResultCustomText,
463
- onUpload,
464
- handleConfirm,
465
- handleCancel,
466
- processTreeData,
467
- ],
43
+ {tooltip && (
44
+ <CapTooltip title={tooltip}>
45
+ <StyledInfoIcon className={disabled ? 'disabled' : ''} />
46
+ </CapTooltip>
47
+ )}
48
+ </HeaderWrapper>
468
49
  );
50
+ };
469
51
 
470
- return (
471
- <>
472
- <StyledTreeSelect
473
- type={type}
474
- treeData={filteredTree}
475
- value={customPopupRender ? tempValue : value}
52
+ const renderDropdown = () => {
53
+ if (type === 'treeSelect' || type === 'multiTreeSelect') {
54
+ return (
55
+ <TreeSelect
56
+ treeData={treeData || options}
57
+ value={value}
476
58
  onChange={onChange}
477
59
  placeholder={placeholder}
478
- showSearch={false}
479
- maxTagCount={0}
480
- maxTagPlaceholder={() => null}
481
- prefix={tempValue?.length > 0 ? prefix : undefined}
482
- suffixIcon={suffix}
483
- className={classnames(
484
- containerClassName,
485
- `cap-unified-tree-select`,
486
- className,
487
- )}
488
- classNames={{
489
- popup: { root: classnames('custom-popup-container', className) },
490
- }}
60
+ className={className}
491
61
  style={style}
492
- status={isError ? 'error' : ''}
493
62
  allowClear={allowClear}
494
- multiple={isMulti}
495
- treeCheckable={isMulti}
496
- open={dropdownOpen}
497
- onOpenChange={handleDropdownVisibilityChange}
498
- showCheckedStrategy={TreeSelect.SHOW_PARENT}
63
+ showSearch={showSearch}
64
+ multiple={type === 'multiTreeSelect' ? true : false}
499
65
  virtual
66
+ treeDefaultExpandAll
500
67
  disabled={disabled}
501
- filterTreeNode={false}
502
68
  {...treeSelectVirtualizationProps}
503
- popupRender={renderCustomDropdown}
504
- {...rest}
505
69
  />
506
- {isError && (
507
- <CapLabel
508
- className={classnames('cap-unified-select-status')}
509
- style={{ color: 'red' }}
510
- >
511
- {errorMessage}
512
- </CapLabel>
513
- )}
514
- </>
70
+ );
71
+ }
72
+
73
+ return (
74
+ <Select
75
+ value={value}
76
+ onChange={onChange}
77
+ placeholder={placeholder}
78
+ className={className}
79
+ style={style}
80
+ allowClear={allowClear}
81
+ showSearch={showSearch}
82
+ options={options}
83
+ mode={type === 'multiSelect' ? 'multiple' : undefined}
84
+ virtual
85
+ disabled={disabled}
86
+ {...selectVirtualizationProps}
87
+ />
515
88
  );
516
- }, [
517
- filteredTree,
518
- tempValue,
519
- value,
520
- prefix,
521
- suffix,
522
- className,
523
- style,
524
- isError,
525
- errorMessage,
526
- allowClear,
527
- isMulti,
528
- isTree,
529
- dropdownOpen,
530
- customPopupRender,
531
- handleTempChange,
532
- onChange,
533
- disabled,
534
- handleDropdownVisibilityChange,
535
- treeSelectVirtualizationProps,
536
- dataSource,
537
- processTreeData,
538
- ]);
89
+ };
539
90
 
540
91
  return (
541
- <CapRow className={classnames(className, 'cap-unified-select-container')}>
92
+ <SelectWrapper>
542
93
  {renderHeader()}
543
94
  {renderDropdown()}
544
- </CapRow>
95
+ </SelectWrapper>
545
96
  );
546
- };
97
+ }
547
98
 
548
99
  CapUnifiedSelect.propTypes = {
549
- type: PropTypes.oneOf([
550
- 'select',
551
- 'multiSelect',
552
- 'treeSelect',
553
- 'multiTreeSelect',
554
- ]),
100
+ type: PropTypes.oneOf(['select', 'multiSelect', 'treeSelect', 'multiTreeSelect']),
555
101
  options: PropTypes.array,
102
+ treeData: PropTypes.array,
556
103
  value: PropTypes.any,
557
104
  onChange: PropTypes.func,
558
105
  placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
559
106
  className: PropTypes.string,
560
107
  style: PropTypes.object,
561
108
  allowClear: PropTypes.bool,
562
- headerLabel: PropTypes.string,
109
+ showSearch: PropTypes.bool,
110
+ label: PropTypes.string,
563
111
  tooltip: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
564
112
  disabled: PropTypes.bool,
565
- customPopupRender: PropTypes.bool,
566
- showSearch: PropTypes.bool,
567
- searchBasedOn: PropTypes.oneOf(['label', 'value', 'key']),
568
- onConfirm: PropTypes.func,
569
- onCancel: PropTypes.func,
570
- isError: PropTypes.bool,
571
- errorMessage: PropTypes.string,
572
- popupClassName: PropTypes.string,
573
- showUpload: PropTypes.bool,
574
- onUpload: PropTypes.func,
575
- size: PropTypes.oneOf(['s', 'm', 'l', 'xl']),
576
113
  };
577
114
 
578
115
  CapUnifiedSelect.defaultProps = {
579
116
  type: 'select',
580
- placeholder: 'Select an option',
581
- searchBasedOn: 'label',
582
- noResultCustomText: 'No results found',
583
- noResultCustomIcon: 'warning',
584
- options: [],
585
- size: 'm',
586
117
  allowClear: false,
587
- customPopupRender: true,
588
- showSearch: true,
589
- className: '',
590
- popupClassName: '',
591
- disabled: false,
592
- showUpload: false,
593
- isError: false,
594
- onUpload: () => {},
595
- onChange: () => {},
596
- onConfirm: () => {},
597
- onCancel: () => {},
118
+ showSearch: false,
598
119
  };
599
120
 
600
- export default withStyles(CapUnifiedSelect, selectStyles);
121
+ export default CapUnifiedSelect;
@@ -1 +1,4 @@
1
- export { default } from './CapUnifiedSelect';
1
+ import CapUnifiedSelect from './CapUnifiedSelect';
2
+ import CapUnifiedSelectLoadable from './loadable';
3
+
4
+ export default CapUnifiedSelectLoadable;
@@ -0,0 +1,3 @@
1
+ import loadable from '@loadable/component';
2
+
3
+ export default loadable(() => import('./CapUnifiedSelect'));