diff --git a/.changeset/spotty-schools-sniff.md b/.changeset/spotty-schools-sniff.md new file mode 100644 index 000000000..4c8f8e7b5 --- /dev/null +++ b/.changeset/spotty-schools-sniff.md @@ -0,0 +1,5 @@ +--- +"@ebay/ebayui-core": patch +--- + +optimize icons with toJSON diff --git a/src/components/components/ebay-tooltip-base/component-browser.ts b/src/components/components/ebay-tooltip-base/component-browser.ts index 780e83112..9aabf517b 100644 --- a/src/components/components/ebay-tooltip-base/component-browser.ts +++ b/src/components/components/ebay-tooltip-base/component-browser.ts @@ -15,7 +15,6 @@ import type { WithNormalizedProps } from "../../../global"; interface TooptipBaseInput { open?: boolean; - toJSON?: () => Object; type: string; offset?: number; "no-hover"?: boolean; diff --git a/src/components/components/ebay-tooltip-base/index.marko b/src/components/components/ebay-tooltip-base/index.marko index d74338692..e53e288a7 100644 --- a/src/components/components/ebay-tooltip-base/index.marko +++ b/src/components/components/ebay-tooltip-base/index.marko @@ -7,7 +7,7 @@ static function toJSON(this: any) { } } -$ input.toJSON = toJSON; +$ (input as any).toJSON = toJSON; $ const { overlayStyle, diff --git a/src/components/components/ebay-tooltip-overlay/component-browser.ts b/src/components/components/ebay-tooltip-overlay/component-browser.ts index 41c7c5661..8104e552e 100644 --- a/src/components/components/ebay-tooltip-overlay/component-browser.ts +++ b/src/components/components/ebay-tooltip-overlay/component-browser.ts @@ -3,7 +3,6 @@ import { typeRoles } from "./constants"; import type { WithNormalizedProps } from "../../../global"; interface TooltipOverlayInput { - toJSON?: any; "style-top"?: string; "style-left"?: string; "style-right"?: string; diff --git a/src/components/components/ebay-tooltip-overlay/index.marko b/src/components/components/ebay-tooltip-overlay/index.marko index b8c69a2bf..7c821f54e 100644 --- a/src/components/components/ebay-tooltip-overlay/index.marko +++ b/src/components/components/ebay-tooltip-overlay/index.marko @@ -3,7 +3,7 @@ import { typeRoles } from "./constants"; static function noop() {} -$ input.toJSON = noop; +$ (input as any).toJSON = noop; $ const { id, diff --git a/src/components/ebay-button/index.marko b/src/components/ebay-button/index.marko index 35d7e568f..f906ab421 100644 --- a/src/components/ebay-button/index.marko +++ b/src/components/ebay-button/index.marko @@ -12,7 +12,6 @@ export interface ButtonEvent { export interface ButtonInput extends Omit, `on${string}`> { href?: string; - toJSON?: () => Object; size?: (typeof validSizes)[number]; priority?: "primary" | "secondary" | "tertiary" | "none"; variant?: "standard" | "destructive" | "form"; @@ -68,7 +67,7 @@ static var validPriorities = [ ]; $ { - input.toJSON = toJSON; + (input as any).toJSON = toJSON; var size = inputSize && validSizes.includes(inputSize) ? inputSize : null; var priority = inputPriority || "secondary"; diff --git a/src/components/ebay-checkbox/component-browser.ts b/src/components/ebay-checkbox/component-browser.ts index 1846f2c2a..37e177b8b 100644 --- a/src/components/ebay-checkbox/component-browser.ts +++ b/src/components/ebay-checkbox/component-browser.ts @@ -6,7 +6,6 @@ export interface CheckboxEvent { checked: boolean; } interface CheckboxInput extends Omit, `on${string}`> { - toJSON?: any; "icon-style"?: "rounded" | "square"; "on-change"?: (e: CheckboxEvent) => void; "on-focus"?: (e: CheckboxEvent) => void; diff --git a/src/components/ebay-checkbox/index.marko b/src/components/ebay-checkbox/index.marko index 4df48286e..a0a1035b0 100644 --- a/src/components/ebay-checkbox/index.marko +++ b/src/components/ebay-checkbox/index.marko @@ -10,7 +10,7 @@ $ const { ...htmlInput } = input; -$ input.toJSON = noop; +$ (input as any).toJSON = noop; , `on${string}`> { - toJSON?: any; text: string; size?: "regular" | "small"; alignment?: "regular" | "center"; diff --git a/src/components/ebay-details/index.marko b/src/components/ebay-details/index.marko index 8d0cef2f4..b61519af7 100644 --- a/src/components/ebay-details/index.marko +++ b/src/components/ebay-details/index.marko @@ -10,11 +10,10 @@ $ const { text, renderBody, as: inputAs, - toJSON, ...htmlInput } = input; -$ input.toJSON = noop; +$ (input as any).toJSON = noop;
{ it("renders basic version", async () => { - const input = mock.Default_Details; + const input = { ...mock.Default_Details }; await htmlSnap(template, input); }); it("renders as div version", async () => { - const input = Object.assign({}, mock.Default_Details, { as: "div" }); + const input = { ...mock.Default_Details, as: "div" }; await htmlSnap(template, input); }); it("renders in open state", async () => { - const input = mock.Open_Details; + const input = { ...mock.Default_Details }; await htmlSnap(template, input); }); it("renders small version", async () => { - const input = Object.assign({}, mock.Default_Details, { - size: "small", - }); + const input = { ...mock.Default_Details, size: "small" }; await htmlSnap(template, input); }); it("renders center version", async () => { - const input = Object.assign({}, mock.Default_Details, { - alignment: "center", - }); + const input = { ...mock.Default_Details, alignment: "center" }; await htmlSnap(template, input); }); diff --git a/src/components/ebay-eek/eek-util.ts b/src/components/ebay-eek/eek-util.ts index 91b7a827f..216422941 100644 --- a/src/components/ebay-eek/eek-util.ts +++ b/src/components/ebay-eek/eek-util.ts @@ -8,7 +8,6 @@ const validRanges = { }; interface EekInput extends Omit, `on${string}`> { - toJSON?: any; max: string; min: string; rating: string; diff --git a/src/components/ebay-eek/index.marko b/src/components/ebay-eek/index.marko index 36f149dc5..960900284 100644 --- a/src/components/ebay-eek/index.marko +++ b/src/components/ebay-eek/index.marko @@ -14,7 +14,7 @@ $ const { ...htmlInput } = input; -$ input.toJSON = noop; +$ (input as any).toJSON = noop; $ const eekRating = eekUtil(input);
, `on${string}`> { - toJSON?: any; variant?: "inline" | "standalone"; "on-click"?: (event: { originalEvent: MouseEvent }) => void; "on-escape"?: (event: { originalEvent: KeyboardEvent }) => void; diff --git a/src/components/ebay-fake-link/index.marko b/src/components/ebay-fake-link/index.marko index 502b7b492..69204022e 100644 --- a/src/components/ebay-fake-link/index.marko +++ b/src/components/ebay-fake-link/index.marko @@ -14,7 +14,7 @@ $ const { ...htmlInput } = input; -$ input.toJSON = toJSON; +$ (input as any).toJSON = toJSON;