Skip to content

Commit

Permalink
feat: remove deprecated left and right util functions
Browse files Browse the repository at this point in the history
BREAKING CHANGE: these functions were deprecated and are now removed.
  • Loading branch information
DSil committed Dec 20, 2024
1 parent 222723e commit ef8236b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 37 deletions.
18 changes: 0 additions & 18 deletions packages/orbit-components/src/utils/rtl/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,3 @@ describe("rtlSpacing", () => {
expect(rtl.rtlSpacing("10px 20px 30px")(enabledRTL)).toBe("10px 20px 30px");
});
});

describe("right", () => {
it("should return right when rtl false", () => {
expect(rtl.right(disabledRTL)).toBe("right");
});
it("should return left when rtl true", () => {
expect(rtl.right(enabledRTL)).toBe("left");
});
});

describe("left", () => {
it("should return left when rtl false", () => {
expect(rtl.left(disabledRTL)).toBe("left");
});
it("should return right when rtl true", () => {
expect(rtl.left(enabledRTL)).toBe("right");
});
});
18 changes: 1 addition & 17 deletions packages/orbit-components/src/utils/rtl/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import type { Theme } from "../../defaultTheme";
import type { RtlSpacing, LeftToRight } from "./types";

const leftToRight: LeftToRight =
(left: string, right: string) =>
({ theme }: { theme: Theme }) =>
theme.rtl ? right : left;
import type { RtlSpacing } from "./types";

export const rtlSpacing: RtlSpacing =
value =>
Expand All @@ -13,13 +7,3 @@ export const rtlSpacing: RtlSpacing =
const parts = value.split(" ").filter(part => !Number.isNaN(parseFloat(part)) && part);
return parts.length === 4 ? [parts[0], parts[3], parts[2], parts[1]].join(" ") : value;
};

/**
* @deprecated This function is deprecated. Use `start` properties instead.
*/
export const left = leftToRight("left", "right");

/**
* @deprecated This function is deprecated. Use `end` properties instead.
*/
export const right = leftToRight("right", "left");
2 changes: 0 additions & 2 deletions packages/orbit-components/src/utils/rtl/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { ThemeProps } from "../../defaultTheme";

export type LeftToRight = (left: string, right: string) => (theme: ThemeProps) => string;

export type RtlSpacing = (value: string) => (theme: ThemeProps) => string;

0 comments on commit ef8236b

Please sign in to comment.