UNPKG

@commercelayer/react-components

Version:
32 lines (31 loc) 1.56 kB
import { type JSX } from 'react'; import type { Address as AddressType } from '@commercelayer/sdk'; import { type AddressCardsTemplateChildren } from '../utils/AddressCardsTemplate'; import type { DefaultChildrenType } from '../../typings/globals'; interface Props extends Omit<JSX.IntrinsicElements['div'], 'children' | 'onSelect'> { children: DefaultChildrenType | AddressCardsTemplateChildren; selectedClassName?: string; disabledClassName?: string; onSelect?: (address: AddressType) => void; addresses?: AddressType[]; deselect?: boolean; } /** * The Address component is aimed to read from active context the list of available addresses to generate for each of them a suitable and interactive wrapper ready to deal with addresses data. * * It accept: * - a `selectedClassName` prop to define the className of selected generated address wrapper. * - a `disabledClassName` prop to define the className of disabled generated address wrapper. * - an `onSelect` prop to define a custom method triggered when an address wrapper is clicked. * - an `addresses` prop to define a list of addresses to be used instead of the ones available from active context. * - a `deselect` prop to define if the current address is deselected through a custom logic. * * <span title='Requirements' type='warning'> * Must be a child of the `<AddressesContainer>` component. * </span> * <span title='Children' type='info'> * `<AddressField>`, * </span> */ export declare function Address(props: Props): JSX.Element; export default Address;