@ornikar/kitt-universal 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3035,23 +3035,35 @@ function TypographyLink({
3035
3035
  });
3036
3036
  }
3037
3037
 
3038
- function matchWindowSize(currentWidth, {
3038
+ function matchWindowSize({
3039
+ width,
3040
+ height
3041
+ }, {
3039
3042
  minWidth,
3040
- maxWidth
3043
+ maxWidth,
3044
+ minHeight,
3045
+ maxHeight
3041
3046
  }) {
3042
- return currentWidth >= minWidth && (!maxWidth || currentWidth <= maxWidth);
3047
+ const hasWidthMatched = width ? (!minWidth || width >= minWidth) && (!maxWidth || width <= maxWidth) : true;
3048
+ const hasHeightMatched = height ? (!minHeight || height >= minHeight) && (!maxHeight || height <= maxHeight) : true;
3049
+ return hasWidthMatched && hasHeightMatched;
3043
3050
  }
3044
3051
  function useMatchWindowSize(options) {
3045
3052
  const {
3046
- width
3053
+ width,
3054
+ height
3047
3055
  } = BabelPluginStyledComponentsReactNative.useWindowDimensions();
3048
- return matchWindowSize(width, options);
3056
+ return matchWindowSize({
3057
+ width,
3058
+ height
3059
+ }, options);
3049
3060
  }
3050
3061
 
3051
- function createWindowSizeHelper(currentWidth) {
3062
+ // eslint-disable-next-line no-restricted-imports
3063
+ function createWindowSizeHelper(dimensions) {
3052
3064
  return {
3053
- matchWindowSize: options => matchWindowSize(currentWidth, options),
3054
- ifWindowSizeMatches: (options, valueIfTrue, valueIfFalse) => matchWindowSize(currentWidth, options) ? valueIfTrue : valueIfFalse,
3065
+ matchWindowSize: options => matchWindowSize(dimensions, options),
3066
+ ifWindowSizeMatches: (options, valueIfTrue, valueIfFalse) => matchWindowSize(dimensions, options) ? valueIfTrue : valueIfFalse,
3055
3067
  mapWindowWidth: (...widthList) => {
3056
3068
  if ((process.env.NODE_ENV !== "production")) {
3057
3069
  widthList.slice(1).forEach(([minWidth], index) => {
@@ -3063,7 +3075,7 @@ function createWindowSizeHelper(currentWidth) {
3063
3075
  });
3064
3076
  }
3065
3077
 
3066
- const found = widthList.find(([minWidth, value]) => matchWindowSize(currentWidth, {
3078
+ const found = widthList.find(([minWidth, value]) => matchWindowSize(dimensions, {
3067
3079
  minWidth: Number(minWidth)
3068
3080
  }));
3069
3081
  if (!found) return null;
@@ -3073,16 +3085,14 @@ function createWindowSizeHelper(currentWidth) {
3073
3085
  }
3074
3086
 
3075
3087
  function useKittTheme() {
3076
- const {
3077
- width
3078
- } = BabelPluginStyledComponentsReactNative.useWindowDimensions();
3088
+ const dimensions = BabelPluginStyledComponentsReactNative.useWindowDimensions();
3079
3089
  return react$1.useMemo(() => {
3080
3090
  return {
3081
3091
  kitt: theme,
3082
- responsive: createWindowSizeHelper(width),
3092
+ responsive: createWindowSizeHelper(dimensions),
3083
3093
  breakpoints
3084
3094
  };
3085
- }, [width]);
3095
+ }, [dimensions]);
3086
3096
  }
3087
3097
 
3088
3098
  function KittThemeProvider({