From 71f77d46e48b75e1f42d67102992ce32e4423f80 Mon Sep 17 00:00:00 2001 From: Ali Stump Date: Thu, 24 Oct 2024 12:41:20 -0700 Subject: [PATCH] chore(cssTokenValues): provide default value map as a util # Conflicts: # packages/calcite-components/src/tests/utils/cssTokenValues.ts --- .../src/tests/utils/cssTokenValues.ts | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/calcite-components/src/tests/utils/cssTokenValues.ts b/packages/calcite-components/src/tests/utils/cssTokenValues.ts index 46a9f4ec12d..cc8d9810f6f 100644 --- a/packages/calcite-components/src/tests/utils/cssTokenValues.ts +++ b/packages/calcite-components/src/tests/utils/cssTokenValues.ts @@ -1,3 +1,19 @@ +export const tokenValueMap = { + background$: "rgb(252, 244, 52)", + "text-color$": "rgb(239, 118, 39)", + "shadow-color$": "0, 191, 255", + "border-color$": "rgb(156, 89, 209)", + "background-color$": "rgb(252, 244, 52)", + hover$: "rgb(255, 105, 180)", + pressed$: "rgb(44, 44, 44)", + selected$: "rgb(156, 89, 209)", + shadow$: + "rgb(255, 255, 255) 0px 0px 0px 4px, rgb(255, 105, 180) 0px 0px 0px 5px inset, rgb(0, 191, 255) 0px 0px 0px 9px", + "(z-index)$": "42", + "(columns|gap|height|offset|radius|size|size-y|size-x|space|space-x|space-y|width)": "42px", + color$: "rgb(0, 191, 255)", +} as const; + /** * Sets the value of a CSS variable to a test value. * This is useful for testing themed components. @@ -6,22 +22,6 @@ * @returns string - the new value for the token */ export function getTokenValue(token: string): string { - const tokenValueMap = { - background$: "rgb(252, 244, 52)", - "text-color$": "rgb(239, 118, 39)", - "border-color$": "rgb(156, 89, 209)", - "background-color$": "rgb(252, 244, 52)", - color$: "rgb(0, 191, 255)", - hover$: "rgb(255, 105, 180)", - pressed$: "rgb(44, 44, 44)", - press$: "rgb(44, 44, 44)", - selected$: "rgb(156, 89, 209)", - shadow$: - "rgb(255, 255, 255) 0px 0px 0px 4px, rgb(255, 105, 180) 0px 0px 0px 5px inset, rgb(0, 191, 255) 0px 0px 0px 9px", - "(z-index)$": "42", - "(columns|gap|height|offset|radius|size|size-y|size-x|space|space-x|space-y|width|margin-bottom)": "42px", - } as const; - const match = Object.entries(tokenValueMap).find(([regexStr]) => { return new RegExp(regexStr, "g").test(token); });