From ee209d0c66253974991b7b7f62bb418673b24867 Mon Sep 17 00:00:00 2001 From: Mohammer5 Date: Wed, 24 Jul 2024 12:37:00 +0200 Subject: [PATCH] feat(transfer): use native single-/multi selects --- components/transfer/src/options-container.js | 86 ++++++++++++-------- components/transfer/src/transfer-option.js | 53 ++++-------- components/transfer/src/transfer.js | 4 + 3 files changed, 73 insertions(+), 70 deletions(-) diff --git a/components/transfer/src/options-container.js b/components/transfer/src/options-container.js index ce3c60a55e..fec1ce21eb 100644 --- a/components/transfer/src/options-container.js +++ b/components/transfer/src/options-container.js @@ -12,10 +12,12 @@ export const OptionsContainer = ({ getOptionClickHandlers, highlightedOptions, loading, + maxSelections, renderOption, options, selected, selectionHandler, + setHighlightedOptions, toggleHighlightedOption, }) => { const optionsRef = useRef(null) @@ -31,51 +33,62 @@ export const OptionsContainer = ({ )}
-
- {!options.length && emptyComponent} - {options.map((option) => { - const highlighted = !!highlightedOptions.find( - (highlightedSourceOption) => - highlightedSourceOption === option.value - ) + {!options.length && emptyComponent} + {!!options.length && ( + + )}
-
+ ) } @@ -81,7 +61,6 @@ TransferOption.propTypes = { className: PropTypes.string, dataTest: PropTypes.string, disabled: PropTypes.bool, - highlighted: PropTypes.bool, onClick: PropTypes.func, onDoubleClick: PropTypes.func, } diff --git a/components/transfer/src/transfer.js b/components/transfer/src/transfer.js index deca9a9f9f..1df39c9765 100644 --- a/components/transfer/src/transfer.js +++ b/components/transfer/src/transfer.js @@ -217,6 +217,8 @@ export const Transfer = ({ )}