Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

Drop deprecated components from design system (#1927)

Bogdan Chadkin5e23d43278ab
diff --git a/packages/design-system/package.json b/packages/design-system/package.json
index 758226a591..c7a535e6e0 100644
--- a/packages/design-system/package.json
+++ b/packages/design-system/package.json
@@ -20,7 +20,6 @@
"@jest/globals": "^29.3.1",
"@storybook/react": "^7.0.26",
"@testing-library/react-hooks": "^8.0.1",
- "@types/lodash.merge": "^4.6.6",
"@types/react": "^18.0.35",
"@types/react-dom": "^18.0.11",
"@webstudio-is/jest-config": "workspace:^",
@@ -71,7 +70,6 @@
"camelcase": "^7.0.1",
"downshift": "^6.1.7",
"immer": "^9.0.12",
- "lodash.merge": "^4.6.2",
"match-sorter": "^6.3.1",
"react-hot-toast": "^2.3.0",
"token-transformer": "^0.0.28",
diff --git a/packages/design-system/src/components/__DEPRECATED__/heading.tsx b/packages/design-system/src/components/__DEPRECATED__/heading.tsx
deleted file mode 100644
index acba113c5f..0000000000
--- a/packages/design-system/src/components/__DEPRECATED__/heading.tsx
+++ /dev/null
@@ -1,69 +0,0 @@
-import { type ComponentProps, type ElementRef, forwardRef } from "react";
-import { DeprecatedText } from "./text";
-import type { VariantProps, CSS } from "../../stitches.config";
-import merge from "lodash.merge";
-
-const DEFAULT_TAG = "h1";
-
-type TextSizeVariants = Pick<VariantProps<typeof DeprecatedText>, "size">;
-type HeadingSizeVariants = "1" | "2" | "3" | "4";
-type HeadingVariants = { size?: HeadingSizeVariants } & Omit<
- VariantProps<typeof DeprecatedText>,
- "size"
->;
-type HeadingProps = ComponentProps<typeof DEFAULT_TAG> &
- HeadingVariants & { css?: CSS; as?: string };
-
-export const DeprecatedHeading = forwardRef<
- ElementRef<typeof DEFAULT_TAG>,
- HeadingProps
->((props, forwardedRef) => {
- // '2' here is the default heading size variant
- const { size = "1", ...textProps } = props;
- // This is the mapping of Heading Variants to Text variants
- const textSize: Record<HeadingSizeVariants, TextSizeVariants["size"]> = {
- 1: { "@initial": "4", "@laptop": "5" },
- 2: { "@initial": "6", "@laptop": "7" },
- 3: { "@initial": "7", "@laptop": "8" },
- 4: { "@initial": "8", "@laptop": "9" },
- };
-
- // This is the mapping of Heading Variants to Text css
- const textCss: Record<HeadingSizeVariants, CSS> = {
- 1: {
- fontWeight: 500,
- lineHeight: "16px",
- "@laptop": { lineHeight: "23px" },
- },
- 2: {
- fontWeight: 500,
- lineHeight: "25px",
- "@laptop": { lineHeight: "30px" },
- },
- 3: {
- fontWeight: 500,
- lineHeight: "33px",
- "@laptop": { lineHeight: "41px" },
- },
- 4: {
- fontWeight: 500,
- lineHeight: "35px",
- "@laptop": { lineHeight: "55px" },
- },
- };
-
- return (
- <DeprecatedText
- as={DEFAULT_TAG}
- {...textProps}
- ref={forwardedRef}
- size={textSize[size]}
- css={{
- fontVariantNumeric: "proportional-nums",
- ...merge(textCss[size], props.css),
- }}
- />
- );
-});
-
-DeprecatedHeading.displayName = "DeprecatedHeading";
diff --git a/packages/design-system/src/components/__DEPRECATED__/label.tsx b/packages/design-system/src/components/__DEPRECATED__/label.tsx
deleted file mode 100644
index 8363cc74fd..0000000000
--- a/packages/design-system/src/components/__DEPRECATED__/label.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import { styled } from "../../stitches.config";
-import * as LabelPrimitive from "@radix-ui/react-label";
-import { DeprecatedText2 } from "./text2";
-
-export const DeprecatedLabel = styled(LabelPrimitive.Root, DeprecatedText2, {
- display: "inline-block",
- verticalAlign: "middle",
- cursor: "default",
- lineHeight: 1.5,
-});
diff --git a/packages/design-system/src/components/__DEPRECATED__/text.tsx b/packages/design-system/src/components/__DEPRECATED__/text.tsx
deleted file mode 100644
index 8dd05f7138..0000000000
--- a/packages/design-system/src/components/__DEPRECATED__/text.tsx
+++ /dev/null
@@ -1,240 +0,0 @@
-import { styled } from "../../stitches.config";
-import { theme } from "../../stitches.config";
-
-export const DeprecatedText = styled("div", {
- // Reset
- lineHeight: "1",
- margin: "0",
- fontWeight: 400,
- fontVariantNumeric: "tabular-nums",
- WebkitFontSmoothing: "antialiased",
- display: "block",
- userSelect: "none",
-
- variants: {
- size: {
- "1": {
- fontSize: theme.deprecatedFontSize[3],
- },
- "2": {
- fontSize: theme.deprecatedFontSize[3],
- },
- "3": {
- fontSize: theme.deprecatedFontSize[4],
- },
- "4": {
- fontSize: theme.deprecatedFontSize[4],
- },
- "5": {
- fontSize: theme.deprecatedFontSize[5],
- letterSpacing: "-.015em",
- },
- "6": {
- fontSize: theme.deprecatedFontSize[6],
- letterSpacing: "-.016em",
- },
- "7": {
- fontSize: theme.deprecatedFontSize[7],
- letterSpacing: "-.031em",
- textIndent: "-.005em",
- },
- "8": {
- fontSize: theme.deprecatedFontSize[8],
- letterSpacing: "-.034em",
- textIndent: "-.018em",
- },
- "9": {
- fontSize: theme.deprecatedFontSize[9],
- letterSpacing: "-.055em",
- textIndent: "-.025em",
- },
- },
- variant: {
- red: {
- color: theme.colors.red11,
- },
- crimson: {
- color: theme.colors.crimson11,
- },
- pink: {
- color: theme.colors.pink11,
- },
- purple: {
- color: theme.colors.purple11,
- },
- violet: {
- color: theme.colors.violet11,
- },
- indigo: {
- color: theme.colors.indigo11,
- },
- blue: {
- color: theme.colors.blue11,
- },
- cyan: {
- color: theme.colors.cyan11,
- },
- teal: {
- color: theme.colors.teal11,
- },
- green: {
- color: theme.colors.green11,
- },
- lime: {
- color: theme.colors.lime11,
- },
- yellow: {
- color: theme.colors.yellow11,
- },
- orange: {
- color: theme.colors.orange11,
- },
- gold: {
- color: theme.colors.gold11,
- },
- bronze: {
- color: theme.colors.bronze11,
- },
- gray: {
- color: theme.colors.slate11,
- },
- contrast: {
- color: theme.colors.hiContrast,
- },
- loContrast: {
- color: theme.colors.loContrast,
- },
- },
- gradient: {
- true: {
- WebkitBackgroundClip: "text",
- WebkitTextFillColor: "transparent",
- },
- },
- },
- compoundVariants: [
- {
- variant: "red",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.red11}, ${theme.colors.crimson11})`,
- },
- },
- {
- variant: "crimson",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.crimson11}, ${theme.colors.pink11})`,
- },
- },
- {
- variant: "pink",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.pink11}, ${theme.colors.purple11})`,
- },
- },
- {
- variant: "purple",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.purple11}, ${theme.colors.violet11})`,
- },
- },
- {
- variant: "violet",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.violet11}, ${theme.colors.indigo11})`,
- },
- },
- {
- variant: "indigo",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.indigo11}, ${theme.colors.blue11})`,
- },
- },
- {
- variant: "blue",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.blue11}, ${theme.colors.cyan11})`,
- },
- },
- {
- variant: "cyan",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.cyan11}, ${theme.colors.teal11})`,
- },
- },
- {
- variant: "teal",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.teal11}, ${theme.colors.green11})`,
- },
- },
- {
- variant: "green",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.green11}, ${theme.colors.lime11})`,
- },
- },
- {
- variant: "lime",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.lime11}, ${theme.colors.yellow11})`,
- },
- },
- {
- variant: "yellow",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.yellow11}, ${theme.colors.orange11})`,
- },
- },
- {
- variant: "orange",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.orange11}, ${theme.colors.red11})`,
- },
- },
- {
- variant: "gold",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.gold11}, ${theme.colors.gold9})`,
- },
- },
- {
- variant: "bronze",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.bronze11}, ${theme.colors.bronze9})`,
- },
- },
- {
- variant: "gray",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.gray11}, ${theme.colors.gray12})`,
- },
- },
- {
- variant: "contrast",
- gradient: "true",
- css: {
- background: `linear-gradient(to right, ${theme.colors.hiContrast}, ${theme.colors.gray12})`,
- },
- },
- ],
- defaultVariants: {
- size: "3",
- variant: "contrast",
- },
-});
diff --git a/packages/design-system/src/index.ts b/packages/design-system/src/index.ts
index 2269c46f0b..dcca908cdc 100644
--- a/packages/design-system/src/index.ts
+++ b/packages/design-system/src/index.ts
@@ -86,12 +86,9 @@ export * from "./components/primitives/list";
// Deprecated
-export * from "./components/__DEPRECATED__/text";
export * from "./components/__DEPRECATED__/text2";
export { DeprecatedButton } from "./components/__DEPRECATED__/button";
export { DeprecatedIconButton } from "./components/__DEPRECATED__/icon-button";
-export { DeprecatedHeading } from "./components/__DEPRECATED__/heading";
-export { DeprecatedLabel } from "./components/__DEPRECATED__/label";
export * from "./components/__DEPRECATED__/popover";
export * from "./components/__DEPRECATED__/text-field";
export * from "./components/__DEPRECATED__/list";
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index a94bea2cc4..adbdcce663 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -693,9 +693,6 @@ importers:
immer:
specifier: ^9.0.12
version: 9.0.15
- lodash.merge:
- specifier: ^4.6.2
- version: 4.6.2
match-sorter:
specifier: ^6.3.1
version: 6.3.1
@@ -718,9 +715,6 @@ importers:
'@testing-library/react-hooks':
specifier: ^8.0.1
- '@types/lodash.merge':
- specifier: ^4.6.6
- version: 4.6.7
'@types/react':
specifier: ^18.0.35
version: 18.0.35
@@ -8304,12 +8298,6 @@ packages:
'@types/lodash': 4.14.182
dev: true
- resolution: {integrity: sha512-OwxUJ9E50gw3LnAefSHJPHaBLGEKmQBQ7CZe/xflHkyy/wH2zVyEIAKReHvVrrn7zKdF58p16We9kMfh7v0RRQ==}
- dependencies:
- '@types/lodash': 4.14.182
- dev: true
-
resolution: {integrity: sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==}