@carbon/react
Version:
React components for the Carbon Design System
63 lines (62 loc) • 2.75 kB
TypeScript
/**
* Copyright IBM Corp. 2015, 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 PropTypes from 'prop-types';
import React, { ReactNode, type JSX } from 'react';
export interface FeatureFlagsProps {
children?: ReactNode;
flags?: Record<string, boolean>;
enableV12TileDefaultIcons?: boolean;
enableV12TileRadioIcons?: boolean;
enableV12Overflowmenu?: boolean;
enableTreeviewControllable?: boolean;
enableExperimentalFocusWrapWithoutSentinels?: boolean;
enableDialogElement?: boolean;
enableV12DynamicFloatingStyles?: boolean;
enableEnhancedFileUploader?: boolean;
}
/**
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
* or disable feature flags in a given React tree
*/
declare const FeatureFlagContext: React.Context<any>;
/**
* Supports an object of feature flag values with the `flags` prop, merging them
* along with the current `FeatureFlagContext` to provide consumers to check if
* a feature flag is enabled or disabled in a given React tree
*/
declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, enableEnhancedFileUploader, }: FeatureFlagsProps): JSX.Element;
declare namespace FeatureFlags {
var propTypes: {
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
/**
* Provide the feature flags to enabled or disabled in the current Rea,ct tree
*/
flags: (props: Record<string, any>, propName: string, componentName: string, ...rest: any[]) => any;
enableV12TileDefaultIcons: PropTypes.Requireable<boolean>;
enableV12TileRadioIcons: PropTypes.Requireable<boolean>;
enableV12Overflowmenu: PropTypes.Requireable<boolean>;
enableTreeviewControllable: PropTypes.Requireable<boolean>;
enableExperimentalFocusWrapWithoutSentinels: PropTypes.Requireable<boolean>;
enableDialogElement: PropTypes.Requireable<boolean>;
enableV12DynamicFloatingStyles: PropTypes.Requireable<boolean>;
enableEnhancedFileUploader: PropTypes.Requireable<boolean>;
};
}
/**
* Access whether a given flag is enabled or disabled in a given
* FeatureFlagContext
*
* @returns {boolean}
*/
declare function useFeatureFlag(flag: any): any;
/**
* Access all feature flag information for the given FeatureFlagContext
*
* @returns {FeatureFlagScope}
*/
declare function useFeatureFlags(): any;
export { FeatureFlags, FeatureFlagContext, useFeatureFlags, useFeatureFlag };