ywana-core8 0.1.82 → 0.1.83

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.1.82",
3
+ "version": "0.1.83",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
package/src/html/list.js CHANGED
@@ -125,8 +125,8 @@ export const List = (props) => {
125
125
  if (onSort) onSort(newConfig)
126
126
  }, [sortable, sortConfig, onSort])
127
127
 
128
- // Search component
129
- const SearchComponent = () => (
128
+ // Search component JSX - memoized to prevent focus loss
129
+ const searchComponent = useMemo(() => (
130
130
  searchable && (
131
131
  <div className="list__search">
132
132
  <TextField
@@ -140,7 +140,7 @@ export const List = (props) => {
140
140
  />
141
141
  </div>
142
142
  )
143
- )
143
+ ), [searchable, searchPlaceholder, searchTerm, handleSearch])
144
144
 
145
145
  // Generate CSS classes
146
146
  const cssClasses = [
@@ -178,12 +178,12 @@ export const List = (props) => {
178
178
  if (empty || sortedItems.length === 0) {
179
179
  return (
180
180
  <div className={cssClasses} style={style} {...ariaAttributes} {...restProps}>
181
- {searchPosition === 'top' && <SearchComponent />}
181
+ {searchPosition === 'top' && searchComponent}
182
182
  <div className="list__empty">
183
183
  <Icon icon={emptyIcon} size="large" />
184
184
  <Text>{emptyMessage}</Text>
185
185
  </div>
186
- {searchPosition === 'bottom' && <SearchComponent />}
186
+ {searchPosition === 'bottom' && searchComponent}
187
187
  {children}
188
188
  </div>
189
189
  )
@@ -204,7 +204,7 @@ export const List = (props) => {
204
204
  />
205
205
  ) : (
206
206
  <div className={cssClasses} style={style} ref={listRef} {...ariaAttributes} {...restProps}>
207
- {searchPosition === 'top' && <SearchComponent />}
207
+ {searchPosition === 'top' && searchComponent}
208
208
 
209
209
  {sortable && sortBy && (
210
210
  <div className="list__sort">
@@ -241,7 +241,7 @@ export const List = (props) => {
241
241
  />
242
242
  ))}
243
243
  </ul>
244
- {searchPosition === 'bottom' && <SearchComponent />}
244
+ {searchPosition === 'bottom' && searchComponent}
245
245
  {children}
246
246
  </div>
247
247
  )
@@ -301,8 +301,8 @@ const GroupedList = (props) => {
301
301
  })
302
302
  }, [])
303
303
 
304
- // Search component for grouped list
305
- const GroupedSearchComponent = () => (
304
+ // Search component for grouped list - memoized to prevent focus loss
305
+ const groupedSearchComponent = useMemo(() => (
306
306
  searchable && (
307
307
  <div className="list__search">
308
308
  <TextField
@@ -316,11 +316,11 @@ const GroupedList = (props) => {
316
316
  />
317
317
  </div>
318
318
  )
319
- )
319
+ ), [searchable, searchPlaceholder, searchTerm, onSearch])
320
320
 
321
321
  return (
322
322
  <div className={`${cssClasses} grouped`} style={style} {...ariaAttributes} {...restProps}>
323
- {searchPosition === 'top' && <GroupedSearchComponent />}
323
+ {searchPosition === 'top' && groupedSearchComponent}
324
324
 
325
325
  {groups.map(group => {
326
326
  const isCollapsed = collapsedGroups.has(group.name)
@@ -377,7 +377,7 @@ const GroupedList = (props) => {
377
377
  </Fragment>
378
378
  )
379
379
  })}
380
- {searchPosition === 'bottom' && <GroupedSearchComponent />}
380
+ {searchPosition === 'bottom' && groupedSearchComponent}
381
381
  {children}
382
382
  </div>
383
383
  )