From e18f353e04cbf09fe32151f74a92d2707ac39860 Mon Sep 17 00:00:00 2001 From: JC Franco Date: Fri, 25 Oct 2024 01:15:13 -0700 Subject: [PATCH] refactor: move deprecation warnings to componentWillLoad to avoid incorrect messaging due to bundling --- .../src/components/modal/modal.tsx | 12 +++++------ .../tile-select-group/tile-select-group.tsx | 14 +++++++------ .../components/tile-select/tile-select.tsx | 12 +++++------ .../src/components/tip-group/tip-group.tsx | 20 +++++++++++++------ .../components/tip-manager/tip-manager.tsx | 12 +++++------ .../src/components/tip/tip.tsx | 12 +++++------ 6 files changed, 46 insertions(+), 36 deletions(-) diff --git a/packages/calcite-components/src/components/modal/modal.tsx b/packages/calcite-components/src/components/modal/modal.tsx index a898b580c17..aa0f8388554 100644 --- a/packages/calcite-components/src/components/modal/modal.tsx +++ b/packages/calcite-components/src/components/modal/modal.tsx @@ -50,12 +50,6 @@ import { CSS, ICONS, SLOTS } from "./resources"; let totalOpenModals: number = 0; let initialDocumentOverflowStyle: string = ""; -logger.deprecated("component", { - name: "modal", - removalVersion: 4, - suggested: "dialog", -}); - /** * @deprecated Use the `calcite-dialog` component instead. * @slot header - A slot for adding header text. @@ -171,6 +165,12 @@ export class Modal //-------------------------------------------------------------------------- async componentWillLoad(): Promise { + logger.deprecated("component", { + name: "modal", + removalVersion: 4, + suggested: "dialog", + }); + await setUpMessages(this); setUpLoadableComponent(this); // when modal initially renders, if active was set we need to open as watcher doesn't fire diff --git a/packages/calcite-components/src/components/tile-select-group/tile-select-group.tsx b/packages/calcite-components/src/components/tile-select-group/tile-select-group.tsx index a84a5ca8197..c82e21cec04 100644 --- a/packages/calcite-components/src/components/tile-select-group/tile-select-group.tsx +++ b/packages/calcite-components/src/components/tile-select-group/tile-select-group.tsx @@ -7,12 +7,6 @@ import { import { logger } from "../../utils/logger"; import { TileSelectGroupLayout } from "./interfaces"; -logger.deprecated("component", { - name: "tile-select-group", - removalVersion: 4, - suggested: ["tile", "tile-group"], -}); - /** * @deprecated Use the `calcite-tile-group` component instead. * @slot - A slot for adding `calcite-tile-select` elements. @@ -53,6 +47,14 @@ export class TileSelectGroup implements InteractiveComponent { // //-------------------------------------------------------------------------- + componentWillLoad(): void { + logger.deprecated("component", { + name: "tile-select-group", + removalVersion: 4, + suggested: ["tile", "tile-group"], + }); + } + componentDidRender(): void { updateHostInteraction(this); } diff --git a/packages/calcite-components/src/components/tile-select/tile-select.tsx b/packages/calcite-components/src/components/tile-select/tile-select.tsx index a03d5adcfe4..a9405d111fd 100644 --- a/packages/calcite-components/src/components/tile-select/tile-select.tsx +++ b/packages/calcite-components/src/components/tile-select/tile-select.tsx @@ -29,12 +29,6 @@ import { logger } from "../../utils/logger"; import { TileSelectType } from "./interfaces"; import { CSS } from "./resources"; -logger.deprecated("component", { - name: "tile-select", - removalVersion: 4, - suggested: ["tile", "tile-group"], -}); - /** * @deprecated Use the `calcite-tile` component instead. * @slot - A slot for adding custom content. @@ -258,6 +252,12 @@ export class TileSelect implements InteractiveComponent, LoadableComponent { } componentWillLoad(): void { + logger.deprecated("component", { + name: "tile-select", + removalVersion: 4, + suggested: ["tile", "tile-group"], + }); + setUpLoadableComponent(this); } diff --git a/packages/calcite-components/src/components/tip-group/tip-group.tsx b/packages/calcite-components/src/components/tip-group/tip-group.tsx index 886b10ba657..bc1ed4649cc 100644 --- a/packages/calcite-components/src/components/tip-group/tip-group.tsx +++ b/packages/calcite-components/src/components/tip-group/tip-group.tsx @@ -1,12 +1,6 @@ import { Component, h, Prop, VNode } from "@stencil/core"; import { logger } from "../../utils/logger"; -logger.deprecated("component", { - name: "tip-group", - removalVersion: 4, - suggested: ["carousel", "carousel-item"], -}); - /** * @deprecated Use the `calcite-carousel` and `calcite-carousel-item` components instead. * @slot - A slot for adding `calcite-tip`s. @@ -17,6 +11,20 @@ logger.deprecated("component", { shadow: true, }) export class TipGroup { + //-------------------------------------------------------------------------- + // + // Lifecycle + // + //-------------------------------------------------------------------------- + + componentWillLoad(): void { + logger.deprecated("component", { + name: "tip-group", + removalVersion: 4, + suggested: ["carousel", "carousel-item"], + }); + } + // -------------------------------------------------------------------------- // // Properties diff --git a/packages/calcite-components/src/components/tip-manager/tip-manager.tsx b/packages/calcite-components/src/components/tip-manager/tip-manager.tsx index 5da31cb5c96..a2c67c3806a 100644 --- a/packages/calcite-components/src/components/tip-manager/tip-manager.tsx +++ b/packages/calcite-components/src/components/tip-manager/tip-manager.tsx @@ -24,12 +24,6 @@ import { logger } from "../../utils/logger"; import { TipManagerMessages } from "./assets/tip-manager/t9n"; import { CSS, ICONS } from "./resources"; -logger.deprecated("component", { - name: "tip-manager", - removalVersion: 4, - suggested: "carousel", -}); - /** * @deprecated Use the `calcite-carousel` and `calcite-carousel-item` components instead. * @slot - A slot for adding `calcite-tip`s. @@ -132,6 +126,12 @@ export class TipManager { } async componentWillLoad(): Promise { + logger.deprecated("component", { + name: "tip-manager", + removalVersion: 4, + suggested: "carousel", + }); + await setUpMessages(this); this.updateGroupTitle(); } diff --git a/packages/calcite-components/src/components/tip/tip.tsx b/packages/calcite-components/src/components/tip/tip.tsx index ce7b6e5c55d..a39a8fb8a44 100644 --- a/packages/calcite-components/src/components/tip/tip.tsx +++ b/packages/calcite-components/src/components/tip/tip.tsx @@ -24,12 +24,6 @@ import { slotChangeHasAssignedElement } from "../../utils/dom"; import { TipMessages } from "./assets/tip/t9n"; import { CSS, ICONS, SLOTS } from "./resources"; -logger.deprecated("component", { - name: "tip", - removalVersion: 4, - suggested: ["card", "notice", "panel", "tile"], -}); - /** * @deprecated Use the `calcite-card`, `calcite-notice`, `calcite-panel`, or `calcite-tile` component instead. * @slot - A slot for adding text and a hyperlink. @@ -124,6 +118,12 @@ export class Tip implements LocalizedComponent, T9nComponent { } async componentWillLoad(): Promise { + logger.deprecated("component", { + name: "tip", + removalVersion: 4, + suggested: ["card", "notice", "panel", "tile"], + }); + await setUpMessages(this); }