UNPKG

@carbon/ibm-products

Version:
29 lines (27 loc) 1.08 kB
/** * Copyright IBM Corp. 2020, 2026 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ require("../../../_virtual/_rolldown/runtime.js"); let react = require("react"); //#region src/global/js/hooks/useValidCreateStepCount.js /** * Copyright IBM Corp. 2021, 2021 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ /** * Logs a warning to console if an invalid number of steps are used with the given CreateComponent * @param {number} stepCount * @param {string} componentName */ const useValidCreateStepCount = (stepCount, componentName) => { (0, react.useEffect)(() => { if (stepCount === 1) console.warn(`${componentName}: ${componentName}s with one step are not permitted. If you require only one step, please use either the CreateTearsheetNarrow, CreateSidePanel, or CreateModal components.`); }, [stepCount, componentName]); }; //#endregion exports.useValidCreateStepCount = useValidCreateStepCount;