@carbon/ibm-products
Version:
Carbon for IBM Products
38 lines • 1.64 kB
TypeScript
/**
* Copyright IBM Corp. 2016, 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { type ComponentType, type FC, type PropsWithChildren } from 'react';
import { type PresenceContext } from './usePresenceContext';
export interface TearsheetPresenceProps {
/**
* Specify whether the Modal is currently open
*/
open: boolean;
/**
* Internal property for backwards compatibility. Specify whether the Modal should opt in to presence mode.
*/
_autoEnablePresence?: boolean;
/**
* Internal property to predefine the presence context's id for exclusivity.
*/
_presenceId?: string;
}
export declare const TearsheetPresence: ({ open, _presenceId: presenceId, _autoEnablePresence: autoEnablePresence, children, }: PropsWithChildren<TearsheetPresenceProps>) => React.JSX.Element;
interface ModalPresenceContextProps extends PresenceContext {
autoEnablePresence: boolean;
}
export declare const TearsheetPresenceContext: React.Context<ModalPresenceContextProps>;
/**
* Handles occurrences where only a single modal must consume a context.
*/
export declare const useExclusiveTearsheetPresenceContext: (id: string) => ModalPresenceContextProps;
type WithModalPresenceProps = Pick<TearsheetPresenceProps, 'open'>;
/**
* Higher-order function that wraps a component with ModalPresence
*/
export declare const withTearsheetPresence: <TProps extends object>(Component: ComponentType<TProps>) => FC<TProps & WithModalPresenceProps>;
export {};
//# sourceMappingURL=TearsheetPresence.d.ts.map