From ba6d3ff893fd2c200f2015a8cf411f6402f0d7b1 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Wed, 3 Jan 2024 13:41:10 +0000 Subject: [PATCH] Update sharedUtils.js --- components/lib/theme/utils/sharedUtils.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/lib/theme/utils/sharedUtils.js b/components/lib/theme/utils/sharedUtils.js index 9212d2d0a..e607967c3 100644 --- a/components/lib/theme/utils/sharedUtils.js +++ b/components/lib/theme/utils/sharedUtils.js @@ -74,13 +74,15 @@ export default { if (this.isString(value)) { const regex = /{([^}]*)}/g; const val = value.trim(); + const px = prefix.trim(); if (this.test(regex, val)) { + const computedPx = this.isNotEmpty(px) ? `${px}-` : px; const _val = val.replaceAll(regex, (v) => { const path = v.replace(/{|}/g, ''); const keys = path.split('.').filter((_v) => !excludedKeyRegexes.some((_r) => this.test(_r, _v))); - return `var(--${prefix}-${this.toKebabCase(keys.join('-'))})`; + return `var(--${computedPx}${this.toKebabCase(keys.join('-'))})`; }); const calculationRegex = /(\d+\s+[\+\-\*\/]\s+\d+)/g;