diff --git a/components/simple-transfer/README.md b/components/simple-transfer/README.md
index 5d67b5904..9c76bebfd 100644
--- a/components/simple-transfer/README.md
+++ b/components/simple-transfer/README.md
@@ -5,4 +5,4 @@
> guide](https://github.com/dhis2/ui/blob/master/docs/getting-started.md)
> for more information.
-For usage instructions see [the documentation for this component](https://ui.dhis2.nu/components/transfer).
+For usage instructions see [the documentation for this component](https://ui.dhis2.nu/components/simple-transfer).
diff --git a/components/simple-transfer/src/__e2e__/add_remove-highlighted-options.e2e.stories.js b/components/simple-transfer/src/__e2e__/add_remove-highlighted-options.e2e.stories.js
index 0a60f202d..401bfd603 100644
--- a/components/simple-transfer/src/__e2e__/add_remove-highlighted-options.e2e.stories.js
+++ b/components/simple-transfer/src/__e2e__/add_remove-highlighted-options.e2e.stories.js
@@ -8,6 +8,14 @@ export default {
decorators: [statefulDecorator()],
}
+export const HasOptions = (_, { onChange, selected }) => (
+
+)
export const HasSelected = (_, { onChange, selected }) => (
)
diff --git a/components/simple-transfer/src/features/disabled-transfer-buttons.feature b/components/simple-transfer/src/features/disabled-transfer-buttons.feature
index caeb6e4e1..e3b8f5c5d 100644
--- a/components/simple-transfer/src/features/disabled-transfer-buttons.feature
+++ b/components/simple-transfer/src/features/disabled-transfer-buttons.feature
@@ -1,4 +1,4 @@
-@component-transfer @button-states
+@component-simple-transfer @button-states
Feature: Disable transfer buttons when actions are not possible
Scenario: None of the selectable options are highlighted
diff --git a/components/simple-transfer/src/features/disabled-transfer-options.feature b/components/simple-transfer/src/features/disabled-transfer-options.feature
index 97389870a..0ec34cb49 100644
--- a/components/simple-transfer/src/features/disabled-transfer-options.feature
+++ b/components/simple-transfer/src/features/disabled-transfer-options.feature
@@ -1,4 +1,4 @@
-@component-transfer @disabled-options
+@component-simple-transfer @disabled-options
Feature: Options can be disabled
Scenario: The user clicks a disabled option
diff --git a/components/simple-transfer/src/features/display-order.feature b/components/simple-transfer/src/features/display-order.feature
index e788df0bd..e442260da 100644
--- a/components/simple-transfer/src/features/display-order.feature
+++ b/components/simple-transfer/src/features/display-order.feature
@@ -1,4 +1,4 @@
-@component-transfer @display-ordering
+@component-simple-transfer @display-ordering
Feature: Display order of items in lists
Scenario: All supplied options are rendered in the options-side
diff --git a/components/simple-transfer/src/features/filter-options-list.feature b/components/simple-transfer/src/features/filter-options-list.feature
index 8e784f6a2..b5dea5d6d 100644
--- a/components/simple-transfer/src/features/filter-options-list.feature
+++ b/components/simple-transfer/src/features/filter-options-list.feature
@@ -1,4 +1,4 @@
-@component-transfer @filtering
+@component-simple-transfer @filtering
Feature: Filter options list
Background:
diff --git a/components/simple-transfer/src/features/reorder-with-buttons.feature b/components/simple-transfer/src/features/reorder-with-buttons.feature
index f087aa1d3..294f0713e 100644
--- a/components/simple-transfer/src/features/reorder-with-buttons.feature
+++ b/components/simple-transfer/src/features/reorder-with-buttons.feature
@@ -1,4 +1,4 @@
-@component-transfer @reordering
+@component-simple-transfer @reordering
Feature: Reorder items in the selected list using buttons
Background:
diff --git a/components/simple-transfer/src/features/set_unset-highlighted-option.feature b/components/simple-transfer/src/features/set_unset-highlighted-option.feature
index 825a0bdfa..12a3e1ac7 100644
--- a/components/simple-transfer/src/features/set_unset-highlighted-option.feature
+++ b/components/simple-transfer/src/features/set_unset-highlighted-option.feature
@@ -1,4 +1,4 @@
-@component-transfer @highlighting
+@component-simple-transfer @highlighting
Feature: Set&unset the highlighted option
Scenario Outline: The user clicks an item that is not already highlighted
diff --git a/components/simple-transfer/src/features/transferring-items.feature b/components/simple-transfer/src/features/transferring-items.feature
index 3a81c231c..94681252e 100644
--- a/components/simple-transfer/src/features/transferring-items.feature
+++ b/components/simple-transfer/src/features/transferring-items.feature
@@ -1,4 +1,4 @@
-@component-transfer @transferring
+@component-simple-transfer @transferring
Feature: Transferring items between lists
Scenario: The user selects multiple items
diff --git a/components/simple-transfer/src/options-container.js b/components/simple-transfer/src/options-container.js
index 8986e4ef8..5bb5b569f 100644
--- a/components/simple-transfer/src/options-container.js
+++ b/components/simple-transfer/src/options-container.js
@@ -1,11 +1,13 @@
+import { spacers } from '@dhis2/ui-constants'
import { CircularLoader } from '@dhis2-ui/loader'
import PropTypes from 'prop-types'
-import React, { Fragment, useRef } from 'react'
+import React, { Fragment, useEffect, useRef } from 'react'
import { SimpleTransferOption } from './simple-transfer-option.js'
export const OptionsContainer = ({
dataTest,
emptyComponent,
+ onEndReached,
highlightedOptions,
loading,
maxSelections,
@@ -14,8 +16,37 @@ export const OptionsContainer = ({
selectionHandler,
setHighlightedOptions,
}) => {
- const optionsRef = useRef(null)
+ const selectRef = useRef(null)
const wrapperRef = useRef(null)
+ // const resizeCounter = useResizeCounter(wrapperRef.current)
+ const lastOptionRef = useRef(null)
+
+ useEffect(() => {
+ const observer = new IntersectionObserver(
+ (entries) => {
+ entries.forEach((entry) => {
+ if (entry.isIntersecting) {
+ onEndReached && onEndReached()
+ }
+ })
+ },
+ {
+ root: wrapperRef.current,
+ threshold: 1.0,
+ }
+ )
+
+ if (lastOptionRef.current) {
+ observer.observe(lastOptionRef.current)
+ }
+
+ return () => {
+ if (lastOptionRef.current) {
+ observer.unobserve(lastOptionRef.current)
+ }
+ observer.disconnect()
+ }
+ }, [options])
return (
@@ -25,14 +56,14 @@ export const OptionsContainer = ({
)}
-
+
{!options.length && emptyComponent}
{!!options.length && (