@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.
- package/dist/definitions/utils/windowSize/createWindowSizeHelper.d.ts +7 -2
- package/dist/definitions/utils/windowSize/createWindowSizeHelper.d.ts.map +1 -1
- package/dist/definitions/utils/windowSize/useMatchWindowSize.d.ts +5 -2
- package/dist/definitions/utils/windowSize/useMatchWindowSize.d.ts.map +1 -1
- package/dist/index-browser-all.es.android.js +23 -15
- package/dist/index-browser-all.es.android.js.map +1 -1
- package/dist/index-browser-all.es.ios.js +23 -15
- package/dist/index-browser-all.es.ios.js.map +1 -1
- package/dist/index-browser-all.es.js +23 -15
- package/dist/index-browser-all.es.js.map +1 -1
- package/dist/index-browser-all.es.web.js +23 -15
- package/dist/index-browser-all.es.web.js.map +1 -1
- package/dist/index-node-14.17.cjs.js +24 -14
- package/dist/index-node-14.17.cjs.js.map +1 -1
- package/dist/index-node-14.17.cjs.web.js +24 -14
- package/dist/index-node-14.17.cjs.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -3035,23 +3035,35 @@ function TypographyLink({
|
|
|
3035
3035
|
});
|
|
3036
3036
|
}
|
|
3037
3037
|
|
|
3038
|
-
function matchWindowSize(
|
|
3038
|
+
function matchWindowSize({
|
|
3039
|
+
width,
|
|
3040
|
+
height
|
|
3041
|
+
}, {
|
|
3039
3042
|
minWidth,
|
|
3040
|
-
maxWidth
|
|
3043
|
+
maxWidth,
|
|
3044
|
+
minHeight,
|
|
3045
|
+
maxHeight
|
|
3041
3046
|
}) {
|
|
3042
|
-
|
|
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(
|
|
3056
|
+
return matchWindowSize({
|
|
3057
|
+
width,
|
|
3058
|
+
height
|
|
3059
|
+
}, options);
|
|
3049
3060
|
}
|
|
3050
3061
|
|
|
3051
|
-
|
|
3062
|
+
// eslint-disable-next-line no-restricted-imports
|
|
3063
|
+
function createWindowSizeHelper(dimensions) {
|
|
3052
3064
|
return {
|
|
3053
|
-
matchWindowSize: options => matchWindowSize(
|
|
3054
|
-
ifWindowSizeMatches: (options, valueIfTrue, valueIfFalse) => matchWindowSize(
|
|
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(
|
|
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(
|
|
3092
|
+
responsive: createWindowSizeHelper(dimensions),
|
|
3083
3093
|
breakpoints
|
|
3084
3094
|
};
|
|
3085
|
-
}, [
|
|
3095
|
+
}, [dimensions]);
|
|
3086
3096
|
}
|
|
3087
3097
|
|
|
3088
3098
|
function KittThemeProvider({
|