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

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.
@@ -37,13 +37,14 @@ const CapUnifiedSelect = ({
37
37
  searchBasedOn = 'label',
38
38
  onConfirm,
39
39
  onCancel,
40
+ noResultText = 'No results found',
40
41
  ...rest
41
42
  }) => {
42
43
 
43
44
  const [searchText, setSearchText] = useState('');
44
45
  const [tempValue, setTempValue] = useState(value);
45
46
  const [allSelected, setAllSelected] = useState(false);
46
- const [dropdownOpen, setDropdownOpen] = useState(false);
47
+
47
48
 
48
49
  useEffect(() => {
49
50
  setTempValue(value);
@@ -54,10 +55,10 @@ const CapUnifiedSelect = ({
54
55
  listItemHeight: 32,
55
56
  };
56
57
 
57
- const NoResult = () => (
58
- <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: 200, color: '#8c8c8c', fontSize: 14 }}>
59
- <WarningFilled style={{ fontSize: 36, marginBottom: 8, color: '#bfbfbf' }} />
60
- <div style={{ fontWeight: 500 }}>No results found</div>
58
+ const NoResult = ({ noResultText, className }) => (
59
+ <div className={classnames(className, "cap-unified-select-no-result")}>
60
+ <WarningFilled className="cap-unified-select-no-result-icon" />
61
+ <div className="cap-unified-select-no-result-text">{noResultText}</div>
61
62
  </div>
62
63
  );
63
64
 
@@ -102,7 +103,6 @@ const CapUnifiedSelect = ({
102
103
  const leafValues = flattenLeafValues(filteredTree);
103
104
 
104
105
  const handleSelectAll = () => {
105
- console.log('Select All clicked');
106
106
  const availableValues = leafValues;
107
107
  if (allSelected) {
108
108
  // If currently all selected, then unselect all
@@ -124,25 +124,16 @@ const CapUnifiedSelect = ({
124
124
  const handleConfirm = () => {
125
125
  console.log('Confirm clicked');
126
126
  if (onChange) onChange(tempValue);
127
- setDropdownOpen(false);
128
127
  };
129
128
 
130
129
  const handleCancel = () => {
131
130
  console.log('Cancel clicked');
132
131
  setTempValue(value);
133
- setDropdownOpen(false);
134
132
  };
135
133
 
136
134
  const handleTempChange = newValue => {
137
135
  setTempValue(newValue);
138
136
  };
139
-
140
- const handleDropdownVisibilityChange = open => {
141
- if (!open) {
142
- setTempValue(value);
143
- }
144
- setDropdownOpen(open);
145
- };
146
137
 
147
138
  const suffix = isMulti && Array.isArray(value) && value?.length > 1 ? (
148
139
  <>
@@ -230,7 +221,7 @@ const CapUnifiedSelect = ({
230
221
  </div>
231
222
  )}
232
223
 
233
- {currentItems.length === 0 ? <NoResult /> : menu}
224
+ {currentItems.length === 0 ? <NoResult noResultText={noResultText} className={classnames(className, "cap-unified-select-no-result")}/> : menu}
234
225
 
235
226
  {currentItems.length > 0 && isMulti && (
236
227
  <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', padding: '8px 12px', borderTop: '1px solid #f0f0f0' }}>
@@ -268,8 +259,6 @@ const CapUnifiedSelect = ({
268
259
  virtual
269
260
  disabled={disabled}
270
261
  filterTreeNode={false}
271
- open={dropdownOpen}
272
- onOpenChange={handleDropdownVisibilityChange}
273
262
  {...treeSelectVirtualizationProps}
274
263
  popupRender={renderCustomDropdown}
275
264
  />
@@ -279,7 +268,7 @@ const CapUnifiedSelect = ({
279
268
  };
280
269
 
281
270
  return (
282
- <SelectWrapper className={classnames(`cap-unified-select-container ${className || ''}`)}>
271
+ <SelectWrapper className={classnames(className, 'cap-unified-select-container')}>
283
272
  {renderHeader()}
284
273
  {renderDropdown()}
285
274
  </SelectWrapper>
@@ -141,6 +141,23 @@ export const selectStyles = css`
141
141
  .multiSelect-popup-container .ant-select-tree-treenode{
142
142
  margin-left: 10px !important;
143
143
  }
144
+ .cap-unified-select-no-result{
145
+ display: flex;
146
+ flex-direction: column;
147
+ align-items: center;
148
+ justify-content: center;
149
+ height: 200px;
150
+ color: #8c8c8c;
151
+ font-size: 14px;
152
+ }
153
+ .cap-unified-select-no-result-icon{
154
+ font-size: 36px;
155
+ margin-bottom: 8px;
156
+ color: #bfbfbf;
157
+ }
158
+ .cap-unified-select-no-result-text{
159
+ font-weight: 500;
160
+ }
144
161
  }
145
162
  &.cap-unified-select {
146
163
  width: 100%;
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.38",
4
+ "version": "0.1.6-alpha.39",
5
5
  "description": "Capillary UI component library with Ant Design v5",
6
6
  "main": "./index.js",
7
7
  "sideEffects": [