From a17342b2482475c2df63d1dbfec61fab9758e2de Mon Sep 17 00:00:00 2001
From: Fabrizio Signoretta <66087564+fabroos@users.noreply.github.com>
Date: Tue, 14 Jan 2025 14:19:22 -0300
Subject: [PATCH] Revert "Rename SVG -> Icon"
---
packages/basehub/react-icon.d.ts | 1 -
packages/basehub/react-icon.js | 1 -
packages/basehub/src/react/index.ts | 2 +-
.../basehub/src/react/{icon => svg}/index.ts | 0
.../src/react/{icon => svg}/primitive.tsx | 37 +++----------------
packages/basehub/tsup-client.config.ts | 3 +-
6 files changed, 7 insertions(+), 37 deletions(-)
delete mode 100644 packages/basehub/react-icon.d.ts
delete mode 100644 packages/basehub/react-icon.js
rename packages/basehub/src/react/{icon => svg}/index.ts (100%)
rename packages/basehub/src/react/{icon => svg}/primitive.tsx (89%)
diff --git a/packages/basehub/react-icon.d.ts b/packages/basehub/react-icon.d.ts
deleted file mode 100644
index 65ba64b2..00000000
--- a/packages/basehub/react-icon.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from "./dist/react-icon";
diff --git a/packages/basehub/react-icon.js b/packages/basehub/react-icon.js
deleted file mode 100644
index 65ba64b2..00000000
--- a/packages/basehub/react-icon.js
+++ /dev/null
@@ -1 +0,0 @@
-export * from "./dist/react-icon";
diff --git a/packages/basehub/src/react/index.ts b/packages/basehub/src/react/index.ts
index 9f1d927a..4d035d01 100644
--- a/packages/basehub/src/react/index.ts
+++ b/packages/basehub/src/react/index.ts
@@ -5,4 +5,4 @@ export {
type CustomBlocksBase,
type HandlerProps as RichTextHandlerProps,
} from "./rich-text/primitive";
-export { SVG, Icon } from "./icon/primitive";
+export { SVG } from "./svg/primitive";
diff --git a/packages/basehub/src/react/icon/index.ts b/packages/basehub/src/react/svg/index.ts
similarity index 100%
rename from packages/basehub/src/react/icon/index.ts
rename to packages/basehub/src/react/svg/index.ts
diff --git a/packages/basehub/src/react/icon/primitive.tsx b/packages/basehub/src/react/svg/primitive.tsx
similarity index 89%
rename from packages/basehub/src/react/icon/primitive.tsx
rename to packages/basehub/src/react/svg/primitive.tsx
index 6cd44168..19148bb7 100644
--- a/packages/basehub/src/react/icon/primitive.tsx
+++ b/packages/basehub/src/react/svg/primitive.tsx
@@ -110,7 +110,8 @@ const parseStyleString = (styleString: string): React.CSSProperties => {
};
/* COMPONENT */
-export const Icon = ({
+
+export const SVG = ({
content: _content,
children,
components = DEFAULT_COMPONENTS,
@@ -211,11 +212,9 @@ export const Icon = ({
.filter(Boolean);
// Create the component with children if they exist
- return children.length > 0 ? (
- {children}
- ) : (
-
- );
+ return children.length > 0
+ ? React.createElement(tag, props, children)
+ : React.createElement(tag, props);
};
if (!svgElement) return null;
@@ -231,29 +230,3 @@ export const Icon = ({
return parseAndRenderSVG as React.ReactElement;
};
-
-interface SVGProps {
- content: string;
- /**
- * @deprecated Use `content` instead.
- */
- children?: string;
- components?: Partial;
-}
-
-/**
- * @deprecated Use the `Icon` component instead.
- */
-export const SVG: React.FC = ({
- content: _content,
- children,
- components = DEFAULT_COMPONENTS,
-}) => {
- console.warn(
- "Warning: The SVG component is deprecated and will be removed in the next major version. Please use the Icon component instead."
- );
-
- const content = _content ?? children;
-
- return ;
-};
diff --git a/packages/basehub/tsup-client.config.ts b/packages/basehub/tsup-client.config.ts
index 74559d14..07a6f52f 100644
--- a/packages/basehub/tsup-client.config.ts
+++ b/packages/basehub/tsup-client.config.ts
@@ -7,8 +7,7 @@ export default defineConfig((_options: Options) => {
minify: false,
dts: true,
entry: {
- "react-svg": "./src/react/icon/index.ts",
- "react-icon": "./src/react/icon/index.ts",
+ "react-svg": "./src/react/svg/index.ts",
"react-rich-text": "./src/react/rich-text/index.ts",
"react-form": "./src/react/form/index.ts",
"react-code-block/index": "./src/react/code-block/index.ts",