From 2cca1a76e6faad1ebc7ad9e422382a19e2ffc6bd Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Mon, 4 Dec 2023 10:00:35 +0300 Subject: [PATCH] Shared:Utils: fix export --- packages/shared/utils/domHelpers.ts | 10 +++++----- packages/shared/utils/index.ts | 8 +++++--- packages/shared/utils/rtlUtils.ts | 2 +- packages/shared/utils/trimSeparator.ts | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/shared/utils/domHelpers.ts b/packages/shared/utils/domHelpers.ts index e90c3ce6e5..b9f96d6a99 100644 --- a/packages/shared/utils/domHelpers.ts +++ b/packages/shared/utils/domHelpers.ts @@ -14,7 +14,7 @@ export default class DomHelpers { return { width: w, height: h }; } - static getOffset(el: HTMLElement) { + static getOffset(el?: HTMLElement | null) { if (el) { const rect = el.getBoundingClientRect(); @@ -40,7 +40,7 @@ export default class DomHelpers { }; } - static getOuterWidth(el: HTMLElement, margin: string) { + static getOuterWidth(el: HTMLElement, margin?: string) { if (el) { let width = el.offsetWidth; @@ -54,7 +54,7 @@ export default class DomHelpers { return 0; } - static getHiddenElementOuterWidth(element: HTMLElement) { + static getHiddenElementOuterWidth(element: HTMLElement | null) { if (element) { element.style.visibility = "hidden"; element.style.display = "block"; @@ -67,7 +67,7 @@ export default class DomHelpers { return 0; } - static getHiddenElementOuterHeight(element: HTMLElement) { + static getHiddenElementOuterHeight(element: HTMLElement | null) { if (element) { element.style.visibility = "hidden"; element.style.display = "block"; @@ -80,7 +80,7 @@ export default class DomHelpers { return 0; } - static calculateScrollbarWidth(el: HTMLElement) { + static calculateScrollbarWidth(el?: HTMLElement) { if (el) { const style = getComputedStyle(el); return ( diff --git a/packages/shared/utils/index.ts b/packages/shared/utils/index.ts index ba14e0e54e..d3e763cbad 100644 --- a/packages/shared/utils/index.ts +++ b/packages/shared/utils/index.ts @@ -9,16 +9,17 @@ import { getCorrectFourValuesStyle, } from "./rtlUtils"; import * as useClickOutside from "./useClickOutside"; -import * as trimSeparator from "./trimSeparator"; +import { trimSeparator } from "./trimSeparator"; import * as getCorrectDate from "./getCorrectDate"; import { handleAnyClick } from "./event"; -import * as DomHelpers from "./domHelpers"; -import * as ObjectUtils from "./objectUtils"; +import DomHelpers from "./domHelpers"; +import ObjectUtils from "./objectUtils"; import { size, mobile, mobileMore, tablet, + desktop, transitionalScreenSize, isMobile, isTablet, @@ -33,6 +34,7 @@ import { classNames } from "./classNames"; import { getBannerAttribute, getLanguage } from "./banner"; export { + desktop, checkIsSSR, getLanguage, isArrayEqual, diff --git a/packages/shared/utils/rtlUtils.ts b/packages/shared/utils/rtlUtils.ts index 429bc28e3c..8cc455b33e 100644 --- a/packages/shared/utils/rtlUtils.ts +++ b/packages/shared/utils/rtlUtils.ts @@ -42,7 +42,7 @@ export const getCorrectFourValuesStyle = ( /* Returns correct border-radius value depending on interface direction (ltr/rtl) */ export const getCorrectBorderRadius = ( borderRadiusStr: string, - interfaceDirection: TInterfaceDirection, + interfaceDirection: TInterfaceDirection | string, ) => { if (interfaceDirection === "ltr") return borderRadiusStr; diff --git a/packages/shared/utils/trimSeparator.ts b/packages/shared/utils/trimSeparator.ts index 4254713724..47a5e9a944 100644 --- a/packages/shared/utils/trimSeparator.ts +++ b/packages/shared/utils/trimSeparator.ts @@ -1,4 +1,4 @@ -import type { ContextMenuModel } from "../components/context-menu"; +import type { ContextMenuModel } from "../components"; export function trimSeparator(array: ContextMenuModel[]) { if (!array || !Array.isArray(array) || array.length === 0) return array;