$36 GRAYBYTE WORDPRESS FILE MANAGER $65

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.162.162 | ADMIN IP 216.73.216.51
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/home/bravetechrwanda/itiministry.org/plugins/give/src/Admin/fields/AssociatedDonor/

HOME
Current File : /home/bravetechrwanda/itiministry.org/plugins/give/src/Admin/fields/AssociatedDonor//index.tsx
import {__} from '@wordpress/i18n';
import {useFormContext, useFormState} from 'react-hook-form';
import {SelectOption} from '@givewp/admin/types';
import useDonorAsyncSelectOptions from './useDonorAsyncSelectOptions';
import AsyncSelectOption from '@givewp/admin/fields/AsyncSelectOption';

type AssociatedDonorProps = {
    name: string;
    mode: 'test' | 'live';
    label: string;
    description: string;
}

/**
 * @since 4.11.0 use AsyncSelectOption
 * @since 4.9.0 Add error prop to all AdminSectionField components
 * @since 4.8.0 updated to async donor dropdown
 * @since 4.6.0
 */
export default function AssociatedDonor({name, mode, label, description}: AssociatedDonorProps) {
    const {watch, setValue} = useFormContext();
    const {errors} = useFormState();
    const donorId = watch(name);

    const {selectedOption, loadOptions, mapOptionsForMenu, error} = useDonorAsyncSelectOptions(donorId, {mode});

    const handleChange = (selectedOption: SelectOption) => {
        setValue(name, selectedOption?.value ?? null, {shouldDirty: true});
    };

    return (
        <AsyncSelectOption
            name={name}
            label={label}
            description={description}
            handleChange={handleChange}
            selectedOption={selectedOption}
            loadOptions={loadOptions}
            mapOptionsForMenu={mapOptionsForMenu}
            isLoadingError={error}
            errorMessage={errors[name]?.message as string}
            searchPlaceholder={__('Search for a donor...', 'give')}
            loadingMessage={__('Loading donors...', 'give')}
            loadingError={__('Error loading donors. Please try again.', 'give')}
            ariaLabel={__('Select a donor', 'give')}
            noOptionsMessage={__('No donors found.', 'give')}
        />
    );
}

Current_dir [ WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
25 May 2026 4.20 PM
bravetechrwanda / bravetechrwanda
0755
index.tsx
1.765 KB
16 Oct 2025 6.10 PM
bravetechrwanda / bravetechrwanda
0644
useDonorAsyncSelectOptions.ts
1.018 KB
16 Oct 2025 6.10 PM
bravetechrwanda / bravetechrwanda
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF Static GIF