Skip to content

Commit 3d75ca2

Browse files
authored
chore: add deprecation warnings (#3238)
1 parent 7edc0ec commit 3d75ca2

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

packages/core/src/components/Combobox/Combobox.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Search from "../Search/Search";
99
import { BASE_SIZES } from "../../constants";
1010
import { Button } from "@vibe/button";
1111
import { Text } from "@vibe/typography";
12+
import { useWarnDeprecated } from "../../utils/warn-deprecated";
1213
import ComboboxOption from "./components/ComboboxOption/ComboboxOption";
1314
import { defaultFilter } from "./ComboboxService";
1415
import { ComboboxItems } from "./components/ComboboxItems/ComboboxItems";
@@ -232,6 +233,12 @@ const Combobox = forwardRef(
232233
}: ComboboxProps,
233234
ref: React.ForwardedRef<HTMLElement>
234235
) => {
236+
useWarnDeprecated({
237+
component: "Combobox",
238+
message:
239+
"This component is deprecated and will be removed in the next major version. Please use Dropdown box mode from @vibe/core/next instead."
240+
});
241+
235242
const componentRef = useRef(null);
236243
const inputRef = useRef(null);
237244
const mergedRef = useMergeRef(ref, componentRef);

packages/core/src/components/DatePicker/DatePicker.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { type VibeComponentProps } from "../../types";
1919
import { getTestId } from "../../tests/test-ids-utils";
2020
import { ComponentDefaultTestId, ComponentVibeId } from "../../tests/constants";
2121
import { NOOP } from "../../utils/function-utils";
22+
import { useWarnDeprecated } from "../../utils/warn-deprecated";
2223
import styles from "./DatePicker.module.scss";
2324
// Make sure to update when upgrading react-dates
2425
import "./external_datepicker.scss";
@@ -105,6 +106,12 @@ const DatePicker = forwardRef(
105106
}: DatePickerProps,
106107
ref: React.ForwardedRef<HTMLDivElement>
107108
) => {
109+
useWarnDeprecated({
110+
component: "DatePicker",
111+
message:
112+
"This component is deprecated and will be removed in the next major version. Please use DatePicker from @vibe/core/next instead."
113+
});
114+
108115
const [focusedInput, setFocusedInput] = useState(FocusInput.startDate);
109116
const [isMonthYearSelection, setIsMonthYearSelection] = useState(false); //show Month/Year selection dropdown
110117
const [overrideDateForView, setOverrideDateForView] = useState<Moment | null>(null);

packages/core/src/components/Dropdown/Dropdown.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
import generateBaseStyles, { customTheme } from "./Dropdown.styles";
2828
import Control from "./components/Control/Control";
2929
import { Text } from "@vibe/typography";
30+
import { useWarnDeprecated } from "../../utils/warn-deprecated";
3031
import menuStyles from "./components/menu/menu.module.scss";
3132
import styles from "./Dropdown.module.scss";
3233
import {
@@ -120,6 +121,12 @@ const Dropdown = forwardRef(
120121
}: DropdownComponentProps,
121122
ref: React.ForwardedRef<HTMLElement>
122123
) => {
124+
useWarnDeprecated({
125+
component: "Dropdown",
126+
message:
127+
"This component is deprecated and will be removed in the next major version. Please use Dropdown from @vibe/core/next instead."
128+
});
129+
123130
const controlRef = useRef();
124131
const { layerRef } = useContext(LayerContext);
125132
const overrideMenuPortalTarget =

packages/core/src/components/LegacyModal/LegacyModal.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { NOOP } from "../../utils/function-utils";
1717
import { withStaticPropsWithoutForwardRef } from "../../types";
1818
import { getTestId } from "../../tests/test-ids-utils";
1919
import { ComponentDefaultTestId } from "../../tests/constants";
20+
import { useWarnDeprecated } from "../../utils/warn-deprecated";
2021
import styles from "./LegacyModal.module.scss";
2122
import { type ModalWidth } from "./LegacyModal.types";
2223
import { LayerProvider } from "@vibe/layer";
@@ -104,6 +105,12 @@ const Modal = ({
104105
unmountOnClose = true,
105106
"data-testid": dataTestId
106107
}: LegacyModalProps) => {
108+
useWarnDeprecated({
109+
component: "Modal (Legacy)",
110+
message:
111+
"This component is deprecated and will be removed in the next major version. Please use Modal from @vibe/core/next instead."
112+
});
113+
107114
const childrenArray: ReactElement[] = useMemo(
108115
() => (children ? (React.Children.toArray(children) as ReactElement[]) : []),
109116
[children]

0 commit comments

Comments
 (0)