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

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 (60) hide show
  1. package/components/CapUnifiedSelect/CapUnifiedSelect.js +128 -126
  2. package/components/CapUnifiedSelect/styles.js +1 -1
  3. package/components/assets/Images/Upload.png +0 -0
  4. package/dist/{components/CapUnifiedSelect → CapUnifiedSelect}/CapUnifiedSelect.js +2 -3
  5. package/dist/esm/{components/CapUnifiedSelect → CapUnifiedSelect}/CapUnifiedSelect.js +2 -2
  6. package/dist/esm/{components/index.js → index.js} +1 -5
  7. package/dist/{components/index.js → index.js} +0 -27
  8. package/package.json +1 -1
  9. package/dist/components/CapTestSelect/CapTestSelect.js +0 -40
  10. package/dist/components/CapTestSelect/index.js +0 -13
  11. package/dist/esm/components/CapTestSelect/CapTestSelect.js +0 -34
  12. package/dist/esm/components/CapTestSelect/index.js +0 -1
  13. package/dist/esm/utils/index.js +0 -1
  14. package/dist/esm/utils/withStyles.js +0 -23
  15. package/dist/utils/index.js +0 -13
  16. package/dist/utils/withStyles.js +0 -29
  17. /package/dist/{components/CapInput → CapInput}/CapInput.js +0 -0
  18. /package/dist/{components/CapInput → CapInput}/Number.js +0 -0
  19. /package/dist/{components/CapInput → CapInput}/Search.js +0 -0
  20. /package/dist/{components/CapInput → CapInput}/TextArea.js +0 -0
  21. /package/dist/{components/CapInput → CapInput}/index.js +0 -0
  22. /package/dist/{components/CapInput → CapInput}/messages.js +0 -0
  23. /package/dist/{components/CapInput → CapInput}/styles.js +0 -0
  24. /package/dist/{components/CapSkeleton → CapSkeleton}/CapSkeleton.js +0 -0
  25. /package/dist/{components/CapSkeleton → CapSkeleton}/index.js +0 -0
  26. /package/dist/{components/CapSpin → CapSpin}/CapSpin.js +0 -0
  27. /package/dist/{components/CapSpin → CapSpin}/index.js +0 -0
  28. /package/dist/{components/CapTable → CapTable}/CapTable.js +0 -0
  29. /package/dist/{components/CapTable → CapTable}/index.js +0 -0
  30. /package/dist/{components/CapTable → CapTable}/loadable.js +0 -0
  31. /package/dist/{components/CapTable → CapTable}/styles.js +0 -0
  32. /package/dist/{components/CapUnifiedSelect → CapUnifiedSelect}/index.js +0 -0
  33. /package/dist/{components/CapUnifiedSelect → CapUnifiedSelect}/messages.js +0 -0
  34. /package/dist/{components/CapUnifiedSelect → CapUnifiedSelect}/styles.js +0 -0
  35. /package/dist/{components/LocaleHoc → LocaleHoc}/index.js +0 -0
  36. /package/dist/esm/{components/CapInput → CapInput}/CapInput.js +0 -0
  37. /package/dist/esm/{components/CapInput → CapInput}/Number.js +0 -0
  38. /package/dist/esm/{components/CapInput → CapInput}/Search.js +0 -0
  39. /package/dist/esm/{components/CapInput → CapInput}/TextArea.js +0 -0
  40. /package/dist/esm/{components/CapInput → CapInput}/index.js +0 -0
  41. /package/dist/esm/{components/CapInput → CapInput}/messages.js +0 -0
  42. /package/dist/esm/{components/CapInput → CapInput}/styles.js +0 -0
  43. /package/dist/esm/{components/CapSkeleton → CapSkeleton}/CapSkeleton.js +0 -0
  44. /package/dist/esm/{components/CapSkeleton → CapSkeleton}/index.js +0 -0
  45. /package/dist/esm/{components/CapSpin → CapSpin}/CapSpin.js +0 -0
  46. /package/dist/esm/{components/CapSpin → CapSpin}/index.js +0 -0
  47. /package/dist/esm/{components/CapTable → CapTable}/CapTable.js +0 -0
  48. /package/dist/esm/{components/CapTable → CapTable}/index.js +0 -0
  49. /package/dist/esm/{components/CapTable → CapTable}/loadable.js +0 -0
  50. /package/dist/esm/{components/CapTable → CapTable}/styles.js +0 -0
  51. /package/dist/esm/{components/CapUnifiedSelect → CapUnifiedSelect}/index.js +0 -0
  52. /package/dist/esm/{components/CapUnifiedSelect → CapUnifiedSelect}/messages.js +0 -0
  53. /package/dist/esm/{components/CapUnifiedSelect → CapUnifiedSelect}/styles.js +0 -0
  54. /package/dist/esm/{components/LocaleHoc → LocaleHoc}/index.js +0 -0
  55. /package/dist/esm/{components/styled → styled}/index.js +0 -0
  56. /package/dist/esm/{components/styled → styled}/variables.js +0 -0
  57. /package/dist/esm/{components/translations → translations}/en.js +0 -0
  58. /package/dist/{components/styled → styled}/index.js +0 -0
  59. /package/dist/{components/styled → styled}/variables.js +0 -0
  60. /package/dist/{components/translations → translations}/en.js +0 -0
@@ -7,6 +7,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
7
7
  var _classnames = _interopRequireDefault(require("classnames"));
8
8
  var _antd = require("antd");
9
9
  var _styledComponents = _interopRequireDefault(require("styled-components"));
10
+ var _image = _interopRequireDefault(require("./Utils/image.png"));
10
11
  var _icons = require("@ant-design/icons");
11
12
  var _withStyles = _interopRequireDefault(require("../../utils/withStyles"));
12
13
  var _styles = require("./styles");
@@ -17,30 +18,30 @@ const CapUnifiedSelect = _ref => {
17
18
  let {
18
19
  type,
19
20
  options = [],
20
- treeData,
21
21
  value,
22
22
  onChange,
23
23
  placeholder = 'Select an option',
24
24
  className,
25
25
  style,
26
- status,
27
- statusMessage,
26
+ isError = false,
27
+ errorMessage,
28
+ popupClassName,
28
29
  allowClear = false,
29
- label,
30
+ headerLabel,
30
31
  tooltip,
32
+ bylineText,
31
33
  disabled = false,
32
- treeCheckable = false,
33
- customPopupRender = false,
34
+ showUpload = false,
35
+ customPopupRender = true,
36
+ showSearch = true,
37
+ searchBasedOn = 'label',
34
38
  onConfirm,
35
- onCancel
39
+ onCancel,
40
+ ...rest
36
41
  } = _ref;
37
- const StyledSelect = (0, _styledComponents.default)(_antd.Select).withConfig({
38
- displayName: "StyledSelect",
39
- componentId: "sc-wsphu8-0"
40
- })(["", ""], _styles.selectStyles);
41
42
  const StyledTreeSelect = (0, _styledComponents.default)(_antd.TreeSelect).withConfig({
42
43
  displayName: "StyledTreeSelect",
43
- componentId: "sc-wsphu8-1"
44
+ componentId: "sc-wsphu8-0"
44
45
  })(["", ""], _styles.selectStyles);
45
46
  const [searchText, setSearchText] = (0, _react.useState)('');
46
47
  const [tempValue, setTempValue] = (0, _react.useState)(value);
@@ -48,9 +49,6 @@ const CapUnifiedSelect = _ref => {
48
49
  (0, _react.useEffect)(() => {
49
50
  setTempValue(value);
50
51
  }, [value]);
51
- const selectVirtualizationProps = {
52
- listHeight: 256
53
- };
54
52
  const treeSelectVirtualizationProps = {
55
53
  listHeight: 256,
56
54
  listItemHeight: 32
@@ -81,10 +79,17 @@ const CapUnifiedSelect = _ref => {
81
79
  const getFilteredTreeData = (data, search) => {
82
80
  if (!search) return data;
83
81
  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());
82
+ if (searchBasedOn === 'value') {
83
+ const valueText = String(node.value || '').toLowerCase();
84
+ return valueText.includes(search.toLowerCase());
85
+ } else if (searchBasedOn === 'key') {
86
+ const keyText = String(node.key || '').toLowerCase();
87
+ return keyText.includes(search.toLowerCase());
88
+ } else {
89
+ var _node$label;
90
+ const labelText = ((_node$label = node.label) == null ? void 0 : _node$label.toLowerCase()) || '';
91
+ return labelText.includes(search.toLowerCase());
92
+ }
88
93
  };
89
94
  const loop = data => data.map(item => {
90
95
  const children = item.children ? loop(item.children) : [];
@@ -98,98 +103,89 @@ const CapUnifiedSelect = _ref => {
98
103
  }).filter(Boolean);
99
104
  return loop(data);
100
105
  };
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
- }
106
+ const flattenLeafValues = nodes => (nodes == null ? void 0 : nodes.flatMap(node => node.children ? flattenLeafValues(node.children) : [node.value])) || [];
107
+ const isMulti = type === 'multiSelect' || type === 'multiTreeSelect';
108
+ const isTree = type === 'treeSelect' || type === 'multiTreeSelect';
109
+ const dataSource = isTree ? options : options.map(opt => ({
110
+ title: opt.label,
111
+ value: opt.value,
112
+ key: opt.key || opt.value
113
+ }));
114
+ const filteredTree = getFilteredTreeData(dataSource, searchText);
115
+ const leafValues = flattenLeafValues(filteredTree);
116
+ const handleSelectAll = () => {
117
+ const availableValues = leafValues;
118
+ setTempValue(allSelected ? [] : availableValues);
118
119
  setAllSelected(!allSelected);
119
120
  };
120
121
  (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);
122
+ if (isMulti && Array.isArray(tempValue)) {
123
+ setAllSelected(tempValue.length > 0 && tempValue.length === leafValues.length);
125
124
  }
126
- }, [tempValue, filteredOptions, leafValues, type]);
125
+ }, [tempValue, leafValues, isMulti]);
127
126
  const handleConfirm = () => {
128
- if (onConfirm) {
129
- onConfirm(tempValue);
130
- } else {
131
- onChange(tempValue);
132
- }
127
+ if (onConfirm) onConfirm(tempValue);else onChange(tempValue);
133
128
  setSearchText('');
134
129
  };
135
130
  const handleCancel = () => {
136
- if (onCancel) {
137
- onCancel();
138
- }
131
+ if (onCancel) onCancel();
139
132
  setTempValue(value);
140
133
  setSearchText('');
141
134
  };
142
135
  const handleTempChange = newValue => {
143
136
  setTempValue(newValue);
144
137
  };
145
- const suffix = (type === "multiTreeSelect" || type === "multiSelect") && Array.isArray(value) && value.length > 1 ? (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
138
+ const suffix = isMulti && Array.isArray(value) && (value == null ? void 0 : value.length) > 1 ? (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
146
139
  children: (0, _jsxRuntime.jsxs)("span", {
147
- children: ["+", value.length - 1, " more", (0, _jsxRuntime.jsx)(_icons.DownOutlined, {})]
140
+ children: ["+", value.length - 1, " more ", (0, _jsxRuntime.jsx)(_icons.DownOutlined, {})]
148
141
  })
149
142
  }) : (0, _jsxRuntime.jsx)(_icons.DownOutlined, {});
150
143
  const prefix = () => {
151
- if ((type === "multiTreeSelect" || type === "multiSelect") && Array.isArray(value) && value.length > 0) {
144
+ if (isMulti && Array.isArray(value) && (value == null ? void 0 : value.length) > 0) {
152
145
  const selectedLabels = options.filter(opt => value.includes(opt.value)).map(opt => opt.label);
153
146
  return selectedLabels[0];
154
- } else {
155
- return null;
156
147
  }
148
+ return null;
157
149
  };
158
150
  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
- }
151
+ if (!headerLabel && !tooltip) return null;
152
+ return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
153
+ children: [(0, _jsxRuntime.jsxs)(_styles.HeaderWrapper, {
154
+ className: (0, _classnames.default)(disabled ? 'disabled' : '', 'cap-unified-select-header'),
155
+ children: [headerLabel && (0, _jsxRuntime.jsx)("label", {
156
+ type: "label16",
157
+ className: (0, _classnames.default)(disabled ? 'disabled' : '', 'cap-unified-select-header-label'),
158
+ children: headerLabel
159
+ }), tooltip && (0, _jsxRuntime.jsx)(_antd.Tooltip, {
160
+ title: tooltip,
161
+ rootClassName: "cap-unified-tooltip",
162
+ className: (0, _classnames.default)(disabled ? 'disabled' : '', 'cap-unified-select-header-tooltip'),
163
+ children: (0, _jsxRuntime.jsx)(_icons.InfoCircleOutlined, {})
164
+ })]
165
+ }), (0, _jsxRuntime.jsx)("div", {
166
+ className: "cap-unified-select-header-byline-text",
167
+ children: bylineText && (0, _jsxRuntime.jsx)("label", {
168
+ className: (0, _classnames.default)(disabled ? 'disabled' : '', 'cap-unified-select-header-byline-text'),
169
+ children: bylineText
173
170
  })
174
171
  })]
175
172
  });
176
173
  };
177
174
  const renderDropdown = () => {
178
- const isMultipleSelect = type === 'multiSelect' || type === 'multiTreeSelect';
179
- const isTreeMode = type === 'treeSelect' || type === 'multiTreeSelect';
180
- const currentItems = isTreeMode ? filteredTree : filteredOptions;
175
+ const currentItems = filteredTree;
181
176
  const selectedCount = Array.isArray(tempValue) ? tempValue.length : tempValue ? 1 : 0;
182
177
  const renderCustomDropdown = menu => {
183
178
  if (!customPopupRender) return menu;
184
- return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
185
- children: [(0, _jsxRuntime.jsx)("div", {
179
+ return (0, _jsxRuntime.jsxs)("div", {
180
+ className: (0, _classnames.default)(popupClassName, `${type}-popup-container`),
181
+ children: [showSearch && (0, _jsxRuntime.jsx)("div", {
186
182
  style: {
187
183
  borderBottom: '1px solid #f0f0f0'
188
184
  },
189
185
  children: (0, _jsxRuntime.jsx)(_antd.Input, {
190
186
  prefix: (0, _jsxRuntime.jsx)(_icons.SearchOutlined, {
191
187
  style: {
192
- color: "#B3BAC5"
188
+ color: '#B3BAC5'
193
189
  }
194
190
  }),
195
191
  placeholder: "Search",
@@ -198,7 +194,36 @@ const CapUnifiedSelect = _ref => {
198
194
  onChange: e => setSearchText(e.target.value),
199
195
  onKeyDown: e => e.stopPropagation()
200
196
  })
201
- }), isMultipleSelect && currentItems.length > 0 && (0, _jsxRuntime.jsxs)("div", {
197
+ }), isMulti && showUpload && (0, _jsxRuntime.jsx)("div", {
198
+ style: {
199
+ cursor: 'pointer',
200
+ display: 'flex',
201
+ alignItems: 'center',
202
+ borderBottom: '1px solid #f0f0f0',
203
+ height: '36px'
204
+ },
205
+ children: (0, _jsxRuntime.jsx)(_antd.Button, {
206
+ type: "link",
207
+ icon: (0, _jsxRuntime.jsx)("img", {
208
+ src: _image.default,
209
+ alt: "upload",
210
+ style: {
211
+ width: "16px",
212
+ height: "20px"
213
+ }
214
+ }),
215
+ onClick: () => {},
216
+ style: {
217
+ color: '#2466EA',
218
+ display: 'flex',
219
+ alignItems: 'center',
220
+ fontSize: '14px',
221
+ fontWeight: '400',
222
+ lineHeight: '20px'
223
+ },
224
+ children: "Upload"
225
+ })
226
+ }), isMulti && currentItems.length > 0 && (0, _jsxRuntime.jsxs)("div", {
202
227
  style: {
203
228
  padding: '8px 12px',
204
229
  cursor: 'pointer',
@@ -208,7 +233,7 @@ const CapUnifiedSelect = _ref => {
208
233
  },
209
234
  onClick: e => {
210
235
  e.stopPropagation();
211
- handleSelectAll(isTreeMode);
236
+ handleSelectAll();
212
237
  },
213
238
  children: [(0, _jsxRuntime.jsx)("input", {
214
239
  type: "checkbox",
@@ -225,7 +250,7 @@ const CapUnifiedSelect = _ref => {
225
250
  },
226
251
  children: "Select all"
227
252
  })]
228
- }), currentItems.length === 0 ? (0, _jsxRuntime.jsx)(NoResult, {}) : menu, currentItems.length > 0 && isMultipleSelect && (0, _jsxRuntime.jsxs)("div", {
253
+ }), currentItems.length === 0 ? (0, _jsxRuntime.jsx)(NoResult, {}) : menu, currentItems.length > 0 && isMulti && (0, _jsxRuntime.jsxs)("div", {
229
254
  style: {
230
255
  display: 'flex',
231
256
  justifyContent: 'space-between',
@@ -264,65 +289,36 @@ const CapUnifiedSelect = _ref => {
264
289
  })]
265
290
  });
266
291
  };
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
292
  return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
301
- children: [(0, _jsxRuntime.jsx)(StyledSelect, {
302
- options: filteredOptions,
293
+ children: [(0, _jsxRuntime.jsx)(StyledTreeSelect, {
294
+ ...rest,
295
+ type: type,
296
+ treeData: filteredTree,
303
297
  value: customPopupRender ? tempValue : value,
304
298
  onChange: customPopupRender ? handleTempChange : onChange,
305
299
  placeholder: placeholder,
306
300
  maxTagCount: 0,
307
301
  maxTagPlaceholder: () => null,
308
- prefix: type === "multiSelect" && value.length > 0 && prefix(),
302
+ prefix: isMulti && value.length > 0 && prefix(),
309
303
  suffixIcon: suffix,
310
- className: (0, _classnames.default)('cap-unified-select', className),
304
+ className: (0, _classnames.default)(`cap-unified-tree-select ${className || ''}`),
311
305
  style: style,
306
+ status: isError ? 'error' : '',
312
307
  allowClear: allowClear,
313
- showSearch: false,
314
- mode: type === 'multiSelect' ? 'multiple' : undefined,
308
+ multiple: isMulti,
309
+ treeCheckable: isMulti,
310
+ showCheckedStrategy: _antd.TreeSelect.SHOW_PARENT,
315
311
  virtual: true,
316
312
  disabled: disabled,
317
- status: status,
318
- ...selectVirtualizationProps,
313
+ filterTreeNode: false,
314
+ ...treeSelectVirtualizationProps,
319
315
  popupRender: renderCustomDropdown
320
- }), status === 'error' && (0, _jsxRuntime.jsx)("div", {
316
+ }), isError && (0, _jsxRuntime.jsx)("div", {
321
317
  style: {
322
318
  color: '#E83135'
323
319
  },
324
320
  className: "cap-unified-select-status",
325
- children: statusMessage
321
+ children: errorMessage
326
322
  })]
327
323
  });
328
324
  };
@@ -334,26 +330,32 @@ const CapUnifiedSelect = _ref => {
334
330
  CapUnifiedSelect.propTypes = {
335
331
  type: _propTypes.default.oneOf(['select', 'multiSelect', 'treeSelect', 'multiTreeSelect']),
336
332
  options: _propTypes.default.array,
337
- treeData: _propTypes.default.array,
338
333
  value: _propTypes.default.any,
339
334
  onChange: _propTypes.default.func,
340
335
  placeholder: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
341
336
  className: _propTypes.default.string,
342
337
  style: _propTypes.default.object,
343
338
  allowClear: _propTypes.default.bool,
344
- label: _propTypes.default.string,
339
+ headerLabel: _propTypes.default.string,
345
340
  tooltip: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
346
341
  disabled: _propTypes.default.bool,
347
- treeCheckable: _propTypes.default.bool,
348
342
  customPopupRender: _propTypes.default.bool,
343
+ showSearch: _propTypes.default.bool,
344
+ searchBasedOn: _propTypes.default.oneOf(['label', 'value', 'key']),
349
345
  onConfirm: _propTypes.default.func,
350
- onCancel: _propTypes.default.func
346
+ onCancel: _propTypes.default.func,
347
+ isError: _propTypes.default.bool,
348
+ errorMessage: _propTypes.default.string,
349
+ popupClassName: _propTypes.default.string,
350
+ showUpload: _propTypes.default.bool
351
351
  };
352
352
  CapUnifiedSelect.defaultProps = {
353
353
  type: 'select',
354
354
  allowClear: false,
355
355
  customPopupRender: false,
356
- treeCheckable: false,
357
- className: ''
356
+ showSearch: true,
357
+ searchBasedOn: 'label',
358
+ className: '',
359
+ popupClassName: ''
358
360
  };
359
361
  var _default = exports.default = (0, _withStyles.default)(CapUnifiedSelect, _styles.selectStyles);
@@ -33,4 +33,4 @@ const StyledInfoIcon = exports.StyledInfoIcon = _styledComponents.default.span.w
33
33
  displayName: "StyledInfoIcon",
34
34
  componentId: "sc-3v7xpu-6"
35
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);
36
+ const selectStyles = exports.selectStyles = (0, _styledComponents.css)(["&.cap-unified-select-container{.cap-unified-tree-select{height:32px !important;width:340px !important;}.ant-select-prefix{font-size:14px !important;font-weight:400 !important;color:#091E42 !important;line-height:20px !important;}.cap-unified-select-header-label{font-family:", " !important;font-weight:500 !important;font-size:14px !important;line-height:20px !important;letter-spacing:0px !important;}.cap-unified-select-header-tooltip{width:16px !important;height:16px !important;color:#B3BAC5 !important;}.cap-unified-select-header-byline-text{font-family:", " !important;font-weight:400 !important;font-size:12px !important;margin-top:-10px;letter-spacing:0px !important;color:#97A0AF !important;}.cap-unified-tree-select .ant-select-selector:hover{border:1px solid #7A869A !important;}.cap-unified-tree-select .select-popup-container .ant-select-tree-switcher-noop,.cap-unified-tree-select .multiSelect-popup-container .ant-select-tree-switcher-noop{display:none !important;}.ant-tree-select-dropdown .treeSelect-popup-container .ant-select-tree .ant-select-tree-treenode{margin:0px !important;}.cap-unified-tree-select .multiSelect-popup-container .ant-tree-select-dropdown .ant-select-tree .ant-select-tree-treenode{margin-left:10px !important;}.multiSelect-popup-container .ant-select-tree-treenode{margin-left:10px !important;}}&.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,&.ant-select-dropdown,&.ant-select-dropdown-placement-bottomLeft{padding:0;border-radius:12px !important;box-shadow:0 4px 12px rgba(0,0,0,0.08);overflow:hidden;.ant-select-item-option{padding:10px 16px;font-size:14px;color:#1c2530;font-weight:500;background-color:transparent !important;&:not(.ant-select-item-option-disabled):hover{background-color:#fffbe6 !important;border-radius:4px;color:#1c2530 !important;}&:hover:not(.ant-select-item-option-disabled):not(.ant-select-item-option-selected){background-color:#fffbe6 !important;color:#1c2530 !important;border-radius:4px;}&-selected:not(.ant-select-item-option-disabled){background-color:#e9f0fe !important;color:#1c2530 !important;font-weight:500;}&-active:not(:hover):not(.ant-select-item-option-disabled){background-color:transparent !important;}}.ant-select-dropdown-search,.ant-select-search{padding:8px 12px;border-bottom:1px solid #f0f0f0;input{border-radius:", ";transition:", ";&:focus{border-color:", ";box-shadow:none;}}}.rc-virtual-list-scrollbar-thumb{background-color:#dcdcdc;border-radius:4px;}.ant-divider-horizontal{margin:0;}.no-result{display:flex;flex-direction:column;align-items:center;justify-content:center;height:200px;color:#8c8c8c;font-size:14px;}.dropdown-search{padding:8px;border-bottom:1px solid #f0f0f0;}.select-all-checkbox{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;}}.dropdown-footer{display:flex;justify-content:space-between;align-items:center;padding:8px;border-top:1px solid #f0f0f0;}.selected-count{color:#8c8c8c;font-size:12px;}.ant-checkbox-inner{border-color:#42b040;}.ant-checkbox-checked .ant-checkbox-inner{background-color:#42b040;border-color:#42b040;}.ant-checkbox-checked .ant-checkbox-inner::after{border-color:#42b040;}}&.ant-select-multiple{.ant-select-selection-item{background-color:#e9f0fe !important;border:none;border-radius:", ";color:#1c2530;font-weight:500;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:", ";background-color:transparent !important;transition:background 0.3s;&:hover{background-color:#fffbe6 !important;color:#1c2530 !important;border-radius:4px;}&.ant-select-tree-node-selected{color:#1c2530;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-tree-treenode{padding:2px 0;&:hover{background-color:transparent;}}.ant-select-tree-checkbox-checked .ant-select-tree-checkbox-inner{background-color:#42b040;border-color:#42b040;}.ant-select-tree-checkbox-checked .ant-select-tree-node-content-wrapper{background-color:#e9f0fe !important;color:#1c2530 !important;font-weight:500;}}&.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:", ";}}}&.cap-unified-tree-select .ant-select-selection-overflow{display:none;}&.cap-unified-tree-select .suffix-counter{color:#1c2530;font-weight:500;margin-right:12px;}}"], styledVars.FONT_FAMILY, styledVars.FONT_FAMILY, 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.TRANSITION_ALL, styledVars.CAP_G01, styledVars.RADIUS_04, styledVars.CAP_PRIMARY.base, styledVars.CAP_PRIMARY.hover, styledVars.RADIUS_04, styledVars.CAP_PRIMARY.base);
@@ -9,10 +9,10 @@ var _react = _interopRequireWildcard(require("react"));
9
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
11
  var _antd = require("antd");
12
- var _styledComponents = _interopRequireDefault(require("styled-components"));
13
12
  var _icons = require("@ant-design/icons");
14
- var _withStyles = _interopRequireDefault(require("../utils/withStyles"));
15
13
  var _styles = require("./styles");
14
+ var _withStyles = _interopRequireDefault(require("./withStyles"));
15
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
16
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
17
17
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(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 (var _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); }
18
18
  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); }
@@ -27,7 +27,6 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
27
27
  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; }
28
28
  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; } }
29
29
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } // Enhanced CapUnifiedSelect supporting 4 scenarios with advanced features
30
- // Updated import path
31
30
  var CapUnifiedSelect = function CapUnifiedSelect(_ref) {
32
31
  var type = _ref.type,
33
32
  _ref$options = _ref.options,
@@ -16,10 +16,10 @@ import React, { useState, useEffect } from 'react';
16
16
  import PropTypes from 'prop-types';
17
17
  import classnames from 'classnames';
18
18
  import { Select, TreeSelect, Tooltip, Input, Button } from 'antd';
19
- import styled from 'styled-components';
20
19
  import { InfoCircleOutlined, SearchOutlined, WarningFilled, DownOutlined } from '@ant-design/icons';
21
- import withStyles from '../utils/withStyles'; // Updated import path
22
20
  import { SelectWrapper, HeaderWrapper, selectStyles } from './styles';
21
+ import withStyles from './withStyles';
22
+ import styled from 'styled-components';
23
23
  var CapUnifiedSelect = function CapUnifiedSelect(_ref) {
24
24
  var type = _ref.type,
25
25
  _ref$options = _ref.options,
@@ -1,7 +1,6 @@
1
1
  // Import and export all components
2
2
  export { default as CapInput } from './CapInput';
3
3
  export { default as CapTable } from './CapTable';
4
- export { default as CapTestSelect } from './CapTestSelect'; // Test component for Ant Design v5 integration
5
4
 
6
5
  // Export utilities
7
6
  export { default as LocaleHoc } from './LocaleHoc';
@@ -9,7 +8,4 @@ export { default as LocaleHoc } from './LocaleHoc';
9
8
  // Export styled utilities
10
9
  import * as _styledVars from './styled/variables';
11
10
  export { _styledVars as styledVars };
12
- export { default as styled } from './styled';
13
-
14
- // Export utils
15
- export * from '../utils';
11
+ export { default as styled } from './styled';
@@ -4,14 +4,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- var _exportNames = {
8
- CapInput: true,
9
- CapTable: true,
10
- CapTestSelect: true,
11
- LocaleHoc: true,
12
- styledVars: true,
13
- styled: true
14
- };
15
7
  Object.defineProperty(exports, "CapInput", {
16
8
  enumerable: true,
17
9
  get: function get() {
@@ -24,12 +16,6 @@ Object.defineProperty(exports, "CapTable", {
24
16
  return _CapTable["default"];
25
17
  }
26
18
  });
27
- Object.defineProperty(exports, "CapTestSelect", {
28
- enumerable: true,
29
- get: function get() {
30
- return _CapTestSelect["default"];
31
- }
32
- });
33
19
  Object.defineProperty(exports, "LocaleHoc", {
34
20
  enumerable: true,
35
21
  get: function get() {
@@ -45,22 +31,9 @@ Object.defineProperty(exports, "styled", {
45
31
  exports.styledVars = void 0;
46
32
  var _CapInput = _interopRequireDefault(require("./CapInput"));
47
33
  var _CapTable = _interopRequireDefault(require("./CapTable"));
48
- var _CapTestSelect = _interopRequireDefault(require("./CapTestSelect"));
49
34
  var _LocaleHoc = _interopRequireDefault(require("./LocaleHoc"));
50
35
  var _styledVars = _interopRequireWildcard(require("./styled/variables"));
51
36
  exports.styledVars = _styledVars;
52
37
  var _styled = _interopRequireDefault(require("./styled"));
53
- var _utils = require("../utils");
54
- Object.keys(_utils).forEach(function (key) {
55
- if (key === "default" || key === "__esModule") return;
56
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
57
- if (key in exports && exports[key] === _utils[key]) return;
58
- Object.defineProperty(exports, key, {
59
- enumerable: true,
60
- get: function get() {
61
- return _utils[key];
62
- }
63
- });
64
- });
65
38
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(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 (var _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); }
66
39
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/blaze-ui",
3
3
  "author": "Capillary Technologies",
4
- "version": "0.1.6-alpha.32",
4
+ "version": "0.1.6-alpha.33",
5
5
  "description": "Capillary UI component library with Ant Design v5",
6
6
  "main": "./components/index.js",
7
7
  "sideEffects": [
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _antd = require("antd");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
11
- /**
12
- * Test component to verify Ant Design v5 Select integration
13
- * This is a simple wrapper for testing purposes only
14
- */
15
- var CapTestSelect = function CapTestSelect(props) {
16
- return /*#__PURE__*/_react["default"].createElement(_antd.Select, props);
17
- };
18
- CapTestSelect.propTypes = {
19
- // Common Select props from antd
20
- allowClear: _propTypes["default"].bool,
21
- defaultValue: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number, _propTypes["default"].arrayOf(_propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]))]),
22
- disabled: _propTypes["default"].bool,
23
- loading: _propTypes["default"].bool,
24
- mode: _propTypes["default"].oneOf(['multiple', 'tags']),
25
- placeholder: _propTypes["default"].string,
26
- showSearch: _propTypes["default"].bool,
27
- value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number, _propTypes["default"].arrayOf(_propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]))]),
28
- options: _propTypes["default"].arrayOf(_propTypes["default"].shape({
29
- label: _propTypes["default"].node,
30
- value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
31
- disabled: _propTypes["default"].bool
32
- }))
33
- };
34
- CapTestSelect.defaultProps = {
35
- allowClear: false,
36
- disabled: false,
37
- loading: false,
38
- showSearch: false
39
- };
40
- var _default = exports["default"] = CapTestSelect;
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "default", {
7
- enumerable: true,
8
- get: function get() {
9
- return _CapTestSelect["default"];
10
- }
11
- });
12
- var _CapTestSelect = _interopRequireDefault(require("./CapTestSelect"));
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
@@ -1,34 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Select } from 'antd';
4
-
5
- /**
6
- * Test component to verify Ant Design v5 Select integration
7
- * This is a simple wrapper for testing purposes only
8
- */
9
- var CapTestSelect = function CapTestSelect(props) {
10
- return /*#__PURE__*/React.createElement(Select, props);
11
- };
12
- CapTestSelect.propTypes = {
13
- // Common Select props from antd
14
- allowClear: PropTypes.bool,
15
- defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))]),
16
- disabled: PropTypes.bool,
17
- loading: PropTypes.bool,
18
- mode: PropTypes.oneOf(['multiple', 'tags']),
19
- placeholder: PropTypes.string,
20
- showSearch: PropTypes.bool,
21
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))]),
22
- options: PropTypes.arrayOf(PropTypes.shape({
23
- label: PropTypes.node,
24
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
25
- disabled: PropTypes.bool
26
- }))
27
- };
28
- CapTestSelect.defaultProps = {
29
- allowClear: false,
30
- disabled: false,
31
- loading: false,
32
- showSearch: false
33
- };
34
- export default CapTestSelect;
@@ -1 +0,0 @@
1
- export { default } from './CapTestSelect';
@@ -1 +0,0 @@
1
- export { default as withStyles } from './withStyles';
@@ -1,23 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- /**
4
- * Enhances a React component with additional styles using styled-components.
5
- * @param {React.ComponentType} WrappedComponent - The React component to enhance.
6
- * @param {TemplateStringsArray} styles - CSS styles as a TemplateStringsArray.
7
- * @returns {React.ComponentType} Returns the enhanced styled component.
8
- */
9
- var withStyledComponent = function withStyledComponent(WrappedComponent, styles) {
10
- /**
11
- * A styled component generated by combining WrappedComponent with additional styles.
12
- * @type {React.ComponentType}
13
- */
14
- var StyledComponent = styled(WrappedComponent).withConfig({
15
- displayName: "StyledComponent",
16
- componentId: "sc-ujcdm3-0"
17
- })(["", ";"], styles);
18
-
19
- // Set default props from the original component to the styled component
20
- StyledComponent.defaultProps = WrappedComponent.defaultProps;
21
- return StyledComponent;
22
- };
23
- export default withStyledComponent;
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "withStyles", {
7
- enumerable: true,
8
- get: function get() {
9
- return _withStyles["default"];
10
- }
11
- });
12
- var _withStyles = _interopRequireDefault(require("./withStyles"));
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _styledComponents = _interopRequireDefault(require("styled-components"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
9
- /**
10
- * Enhances a React component with additional styles using styled-components.
11
- * @param {React.ComponentType} WrappedComponent - The React component to enhance.
12
- * @param {TemplateStringsArray} styles - CSS styles as a TemplateStringsArray.
13
- * @returns {React.ComponentType} Returns the enhanced styled component.
14
- */
15
- var withStyledComponent = function withStyledComponent(WrappedComponent, styles) {
16
- /**
17
- * A styled component generated by combining WrappedComponent with additional styles.
18
- * @type {React.ComponentType}
19
- */
20
- var StyledComponent = (0, _styledComponents["default"])(WrappedComponent).withConfig({
21
- displayName: "StyledComponent",
22
- componentId: "sc-ujcdm3-0"
23
- })(["", ";"], styles);
24
-
25
- // Set default props from the original component to the styled component
26
- StyledComponent.defaultProps = WrappedComponent.defaultProps;
27
- return StyledComponent;
28
- };
29
- var _default = exports["default"] = withStyledComponent;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes