react-responsive-tools 2.5.0 → 2.6.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/breakpoints.config.d.ts +2 -0
- package/dist/breakpoints.config.js +1 -0
- package/dist/components/horizontal.d.ts +8 -4
- package/dist/components/horizontal.js +9 -3
- package/dist/default.config.d.ts +3 -1
- package/dist/default.config.js +2 -1
- package/dist/functions/getBreakpoint.d.ts +1 -1
- package/dist/functions/getBreakpoint.js +1 -1
- package/dist/hooks/useBreakpoint.d.ts +4 -5
- package/dist/hooks/useBreakpoint.js +20 -10
- package/dist/hooks/useBreakpoint.test.d.ts +1 -0
- package/dist/hooks/useBreakpoint.test.js +153 -0
- package/dist/hooks/useVBreakpoint.d.ts +1 -3
- package/dist/hooks/useVBreakpoint.js +1 -7
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/scripts/createConfig.mjs +1 -1
- package/package.json +10 -4
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { TAdaptiveVariant } from "./interfaces/TAdaptiveVariant";
|
|
2
|
+
export declare const PREFERRED_VARIANT: TAdaptiveVariant;
|
|
1
3
|
declare const HORIZONTAL_BREAKPOINTS: Record<string, string>;
|
|
2
4
|
declare const VERTICAL_BREAKPOINTS: Record<string, string>;
|
|
3
5
|
export { HORIZONTAL_BREAKPOINTS, VERTICAL_BREAKPOINTS };
|
|
@@ -5,10 +5,14 @@ import React from "react";
|
|
|
5
5
|
import { TBreakpoint } from '../interfaces/TBreakpoint';
|
|
6
6
|
interface Props {
|
|
7
7
|
children: React.ReactNode;
|
|
8
|
-
}
|
|
9
|
-
interface ForComponentProps extends Props {
|
|
10
8
|
p: TBreakpoint | number;
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
interface BetweenProps {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
max: TBreakpoint | number;
|
|
13
|
+
min: TBreakpoint | number;
|
|
14
|
+
}
|
|
15
|
+
export declare function For({ children, p }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
export declare function Before({ children, p }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
export declare function Between({ children, min, max }: BetweenProps): import("react/jsx-runtime").JSX.Element | null;
|
|
14
18
|
export {};
|
|
@@ -3,15 +3,21 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
* Created by westp on 15.05.2023
|
|
4
4
|
*/
|
|
5
5
|
import { Fragment } from "react";
|
|
6
|
-
import {
|
|
6
|
+
import { useBreakpoint, useBreakpointBetween } from '../hooks/useBreakpoint.js';
|
|
7
7
|
export function For({ children, p }) {
|
|
8
|
-
const is =
|
|
8
|
+
const is = useBreakpoint(p, 'MtF');
|
|
9
9
|
if (is)
|
|
10
10
|
return _jsx(Fragment, { children: children });
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
export function Before({ children, p }) {
|
|
14
|
-
const is =
|
|
14
|
+
const is = useBreakpoint(p, 'DtF');
|
|
15
|
+
if (is)
|
|
16
|
+
return _jsx(Fragment, { children: children });
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
export function Between({ children, min, max }) {
|
|
20
|
+
const is = useBreakpointBetween(min, max);
|
|
15
21
|
if (is)
|
|
16
22
|
return _jsx(Fragment, { children: children });
|
|
17
23
|
return null;
|
package/dist/default.config.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { TAdaptiveVariant } from "./interfaces/TAdaptiveVariant";
|
|
2
|
+
declare const PREFERRED_VARIANT: TAdaptiveVariant;
|
|
1
3
|
declare const HORIZONTAL_BREAKPOINTS: Record<string, string>;
|
|
2
4
|
declare const VERTICAL_BREAKPOINTS: Record<string, string>;
|
|
3
|
-
export { HORIZONTAL_BREAKPOINTS, VERTICAL_BREAKPOINTS };
|
|
5
|
+
export { HORIZONTAL_BREAKPOINTS, VERTICAL_BREAKPOINTS, PREFERRED_VARIANT };
|
package/dist/default.config.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// breakpointConfig.js
|
|
2
|
+
const PREFERRED_VARIANT = 'DtF'; // DESKTOP_TO_FIRST
|
|
2
3
|
const HORIZONTAL_BREAKPOINTS = {
|
|
3
4
|
xs: '320px',
|
|
4
5
|
sm: '576px',
|
|
@@ -19,4 +20,4 @@ const VERTICAL_BREAKPOINTS = {
|
|
|
19
20
|
xl: '1600px',
|
|
20
21
|
xxl: '1601px',
|
|
21
22
|
};
|
|
22
|
-
export { HORIZONTAL_BREAKPOINTS, VERTICAL_BREAKPOINTS };
|
|
23
|
+
export { HORIZONTAL_BREAKPOINTS, VERTICAL_BREAKPOINTS, PREFERRED_VARIANT };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TBreakpoint, TVerticalBreakpoint } from '../interfaces/TBreakpoint.js';
|
|
2
|
-
export
|
|
2
|
+
export declare function getBreakpoint(b: TBreakpoint): string;
|
|
3
3
|
export declare function getVBreakpoint(b: TVerticalBreakpoint): string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { TBreakpoint } from '../interfaces/TBreakpoint
|
|
2
|
-
import { TAdaptiveVariant } from '../interfaces/TAdaptiveVariant
|
|
3
|
-
export
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function useBreakpointDF(b: TBreakpoint | number): boolean;
|
|
1
|
+
import { TBreakpoint } from '../interfaces/TBreakpoint';
|
|
2
|
+
import { TAdaptiveVariant } from '../interfaces/TAdaptiveVariant';
|
|
3
|
+
export declare function useBreakpoint(b: TBreakpoint | number, variant?: TAdaptiveVariant): boolean | null;
|
|
4
|
+
export declare function useBreakpointBetween(min: TBreakpoint | number, max: TBreakpoint | number, preferredVariant?: TAdaptiveVariant): boolean;
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import { useMediaQuery } from 'react-responsive';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { PREFERRED_VARIANT } from '../breakpoints.config';
|
|
3
|
+
import useVariant from './useVariant';
|
|
4
|
+
import { getBreakpoint } from "../functions/getBreakpoint";
|
|
5
|
+
export function useBreakpoint(b, variant = PREFERRED_VARIANT) {
|
|
6
|
+
let _bp = typeof b === 'number' ? b : +getBreakpoint(b);
|
|
6
7
|
const v = useVariant(variant);
|
|
7
|
-
|
|
8
|
+
if (variant !== PREFERRED_VARIANT)
|
|
9
|
+
_bp = _bp - 1;
|
|
10
|
+
return useMediaQuery({ query: `(${v}-width: ${_bp}px)` });
|
|
8
11
|
}
|
|
9
|
-
export function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
export function useBreakpointBetween(min, max, preferredVariant = PREFERRED_VARIANT) {
|
|
13
|
+
let _min = typeof min === 'number' ? min : +getBreakpoint(min);
|
|
14
|
+
let _max = typeof max === 'number' ? max : +getBreakpoint(max);
|
|
15
|
+
switch (preferredVariant) {
|
|
16
|
+
case 'MtF':
|
|
17
|
+
_max = _max - 1;
|
|
18
|
+
break;
|
|
19
|
+
case 'DtF':
|
|
20
|
+
_min = _min - 1;
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
return useMediaQuery({ minWidth: _min, maxWidth: _max });
|
|
14
24
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { useBreakpoint, useBreakpointBetween } from './useBreakpoint';
|
|
4
|
+
// Mock external dependencies
|
|
5
|
+
jest.mock('react-responsive', () => ({
|
|
6
|
+
useMediaQuery: jest.fn(),
|
|
7
|
+
}));
|
|
8
|
+
jest.mock('./useVariant', () => ({
|
|
9
|
+
__esModule: true,
|
|
10
|
+
default: jest.fn(),
|
|
11
|
+
}));
|
|
12
|
+
jest.mock('../functions/getBreakpoint', () => ({
|
|
13
|
+
__esModule: true,
|
|
14
|
+
getBreakpoint: jest.fn(),
|
|
15
|
+
}));
|
|
16
|
+
jest.mock('../breakpoints.config', () => ({
|
|
17
|
+
__esModule: true,
|
|
18
|
+
PREFERRED_VARIANT: 'MtF', // adjust to your real preferred variant if needed
|
|
19
|
+
}));
|
|
20
|
+
import { useMediaQuery } from 'react-responsive';
|
|
21
|
+
import useVariant from './useVariant';
|
|
22
|
+
import { getBreakpoint } from '../functions/getBreakpoint';
|
|
23
|
+
import { PREFERRED_VARIANT } from '../breakpoints.config';
|
|
24
|
+
const mockedUseMediaQuery = useMediaQuery;
|
|
25
|
+
const mockedUseVariant = useVariant;
|
|
26
|
+
const mockedGetBreakpoint = getBreakpoint;
|
|
27
|
+
// Small test components to use hooks inside React
|
|
28
|
+
function BreakpointTestComponent(props) {
|
|
29
|
+
const value = useBreakpoint(props.b, props.variant);
|
|
30
|
+
return _jsx("div", { "data-testid": "value", children: String(value) });
|
|
31
|
+
}
|
|
32
|
+
function BreakpointBetweenTestComponent(props) {
|
|
33
|
+
const value = useBreakpointBetween(props.min, props.max, props.preferredVariant);
|
|
34
|
+
return _jsx("div", { "data-testid": "value", children: String(value) });
|
|
35
|
+
}
|
|
36
|
+
describe('useBreakpoint', () => {
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
jest.clearAllMocks();
|
|
39
|
+
mockedUseVariant.mockReturnValue('min');
|
|
40
|
+
});
|
|
41
|
+
it('should call useMediaQuery with numeric breakpoint as-is when variant === PREFERRED_VARIANT', () => {
|
|
42
|
+
mockedUseMediaQuery.mockReturnValue(true);
|
|
43
|
+
const { getByTestId } = render(_jsx(BreakpointTestComponent, { b: 768, variant: PREFERRED_VARIANT }));
|
|
44
|
+
expect(mockedUseVariant).toHaveBeenCalledWith(PREFERRED_VARIANT);
|
|
45
|
+
expect(mockedUseMediaQuery).toHaveBeenCalledWith({
|
|
46
|
+
query: '(min-width: 768px)',
|
|
47
|
+
});
|
|
48
|
+
expect(getByTestId('value').textContent).toBe('true');
|
|
49
|
+
});
|
|
50
|
+
it('should convert named breakpoint using getBreakpoint', () => {
|
|
51
|
+
mockedGetBreakpoint.mockReturnValue('1024');
|
|
52
|
+
mockedUseMediaQuery.mockReturnValue(false);
|
|
53
|
+
const { getByTestId } = render(_jsx(BreakpointTestComponent, { b: 'lg', variant: PREFERRED_VARIANT }));
|
|
54
|
+
expect(mockedGetBreakpoint).toHaveBeenCalledWith('lg');
|
|
55
|
+
expect(mockedUseMediaQuery).toHaveBeenCalledWith({
|
|
56
|
+
query: '(min-width: 1024px)',
|
|
57
|
+
});
|
|
58
|
+
expect(getByTestId('value').textContent).toBe('false');
|
|
59
|
+
});
|
|
60
|
+
it('should decrease breakpoint by 1px when variant !== PREFERRED_VARIANT (numeric)', () => {
|
|
61
|
+
mockedUseVariant.mockReturnValue('max');
|
|
62
|
+
mockedUseMediaQuery.mockReturnValue(true);
|
|
63
|
+
const { getByTestId } = render(_jsx(BreakpointTestComponent, { b: 500, variant: 'DtF' }));
|
|
64
|
+
expect(mockedUseVariant).toHaveBeenCalledWith('DtF');
|
|
65
|
+
expect(mockedUseMediaQuery).toHaveBeenCalledWith({
|
|
66
|
+
query: '(max-width: 499px)',
|
|
67
|
+
});
|
|
68
|
+
expect(getByTestId('value').textContent).toBe('true');
|
|
69
|
+
});
|
|
70
|
+
it('should also decrease named breakpoint by 1px when variant !== PREFERRED_VARIANT', () => {
|
|
71
|
+
mockedGetBreakpoint.mockReturnValue('600');
|
|
72
|
+
mockedUseVariant.mockReturnValue('max');
|
|
73
|
+
mockedUseMediaQuery.mockReturnValue(false);
|
|
74
|
+
const { getByTestId } = render(_jsx(BreakpointTestComponent, { b: 'md', variant: 'DtF' }));
|
|
75
|
+
expect(mockedGetBreakpoint).toHaveBeenCalledWith('md');
|
|
76
|
+
expect(mockedUseMediaQuery).toHaveBeenCalledWith({
|
|
77
|
+
query: '(max-width: 599px)',
|
|
78
|
+
});
|
|
79
|
+
expect(getByTestId('value').textContent).toBe('false');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe('useBreakpointBetween', () => {
|
|
83
|
+
beforeEach(() => {
|
|
84
|
+
jest.clearAllMocks();
|
|
85
|
+
});
|
|
86
|
+
it('should use min and max as-is when preferredVariant === PREFERRED_VARIANT (numeric)', () => {
|
|
87
|
+
mockedUseMediaQuery.mockReturnValue(true);
|
|
88
|
+
const { getByTestId } = render(_jsx(BreakpointBetweenTestComponent, { min: 320, max: 768, preferredVariant: PREFERRED_VARIANT }));
|
|
89
|
+
expect(mockedUseMediaQuery).toHaveBeenCalledWith({
|
|
90
|
+
minWidth: 320,
|
|
91
|
+
maxWidth: 767, // 768 - 1 because PREFERRED_VARIANT === 'MtF'
|
|
92
|
+
});
|
|
93
|
+
expect(getByTestId('value').textContent).toBe('true');
|
|
94
|
+
});
|
|
95
|
+
it('should convert named min and max via getBreakpoint when preferredVariant === PREFERRED_VARIANT', () => {
|
|
96
|
+
mockedGetBreakpoint
|
|
97
|
+
.mockReturnValueOnce('320') // for min
|
|
98
|
+
.mockReturnValueOnce('768'); // for max
|
|
99
|
+
mockedUseMediaQuery.mockReturnValue(false);
|
|
100
|
+
const { getByTestId } = render(_jsx(BreakpointBetweenTestComponent, { min: 'sm', max: 'md', preferredVariant: PREFERRED_VARIANT }));
|
|
101
|
+
expect(mockedGetBreakpoint).toHaveBeenNthCalledWith(1, 'sm');
|
|
102
|
+
expect(mockedGetBreakpoint).toHaveBeenNthCalledWith(2, 'md');
|
|
103
|
+
expect(mockedUseMediaQuery).toHaveBeenCalledWith({
|
|
104
|
+
minWidth: 320,
|
|
105
|
+
maxWidth: 767, // 768 - 1 because PREFERRED_VARIANT === 'MtF'
|
|
106
|
+
});
|
|
107
|
+
expect(getByTestId('value').textContent).toBe('false');
|
|
108
|
+
});
|
|
109
|
+
it('for preferredVariant === "MtF" should decrease max by 1px', () => {
|
|
110
|
+
mockedUseMediaQuery.mockReturnValue(true);
|
|
111
|
+
const { getByTestId } = render(_jsx(BreakpointBetweenTestComponent, { min: 320, max: 768, preferredVariant: 'MtF' }));
|
|
112
|
+
expect(mockedUseMediaQuery).toHaveBeenCalledWith({
|
|
113
|
+
minWidth: 320,
|
|
114
|
+
maxWidth: 767,
|
|
115
|
+
});
|
|
116
|
+
expect(getByTestId('value').textContent).toBe('true');
|
|
117
|
+
});
|
|
118
|
+
it('for preferredVariant === "DtF" should decrease min by 1px', () => {
|
|
119
|
+
mockedUseMediaQuery.mockReturnValue(false);
|
|
120
|
+
const { getByTestId } = render(_jsx(BreakpointBetweenTestComponent, { min: 320, max: 768, preferredVariant: 'DtF' }));
|
|
121
|
+
expect(mockedUseMediaQuery).toHaveBeenCalledWith({
|
|
122
|
+
minWidth: 319,
|
|
123
|
+
maxWidth: 768,
|
|
124
|
+
});
|
|
125
|
+
expect(getByTestId('value').textContent).toBe('false');
|
|
126
|
+
});
|
|
127
|
+
it('MtF + named values: should decrease max after getBreakpoint', () => {
|
|
128
|
+
mockedGetBreakpoint
|
|
129
|
+
.mockReturnValueOnce('400') // min
|
|
130
|
+
.mockReturnValueOnce('900'); // max
|
|
131
|
+
mockedUseMediaQuery.mockReturnValue(true);
|
|
132
|
+
const { getByTestId } = render(_jsx(BreakpointBetweenTestComponent, { min: 'sm', max: 'xl', preferredVariant: 'MtF' }));
|
|
133
|
+
expect(mockedGetBreakpoint).toHaveBeenNthCalledWith(1, 'sm');
|
|
134
|
+
expect(mockedGetBreakpoint).toHaveBeenNthCalledWith(2, 'xl');
|
|
135
|
+
expect(mockedUseMediaQuery).toHaveBeenCalledWith({
|
|
136
|
+
minWidth: 400,
|
|
137
|
+
maxWidth: 899,
|
|
138
|
+
});
|
|
139
|
+
expect(getByTestId('value').textContent).toBe('true');
|
|
140
|
+
});
|
|
141
|
+
it('DtF + named values: should decrease min after getBreakpoint', () => {
|
|
142
|
+
mockedGetBreakpoint
|
|
143
|
+
.mockReturnValueOnce('400') // min
|
|
144
|
+
.mockReturnValueOnce('900'); // max
|
|
145
|
+
mockedUseMediaQuery.mockReturnValue(false);
|
|
146
|
+
const { getByTestId } = render(_jsx(BreakpointBetweenTestComponent, { min: 'sm', max: 'xl', preferredVariant: 'DtF' }));
|
|
147
|
+
expect(mockedUseMediaQuery).toHaveBeenCalledWith({
|
|
148
|
+
minWidth: 399,
|
|
149
|
+
maxWidth: 900,
|
|
150
|
+
});
|
|
151
|
+
expect(getByTestId('value').textContent).toBe('false');
|
|
152
|
+
});
|
|
153
|
+
});
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { TVerticalBreakpoint } from '../interfaces/TBreakpoint';
|
|
2
2
|
import { TAdaptiveVariant } from '../interfaces/TAdaptiveVariant';
|
|
3
|
-
export
|
|
4
|
-
export declare function useVBreakpointMF(b: TVerticalBreakpoint | number): boolean;
|
|
5
|
-
export declare function useVBreakpointDF(b: TVerticalBreakpoint | number): boolean;
|
|
3
|
+
export declare function useVBreakpoint(b: TVerticalBreakpoint | number, variant?: TAdaptiveVariant): boolean;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { useMediaQuery } from 'react-responsive';
|
|
2
2
|
import useVariant from './useVariant.js';
|
|
3
3
|
import { getVBreakpoint } from "../functions/getBreakpoint.js";
|
|
4
|
-
export
|
|
4
|
+
export function useVBreakpoint(b, variant = 'MtF') {
|
|
5
5
|
const _bp = typeof b === 'number' ? b + 'px' : getVBreakpoint(b);
|
|
6
6
|
const v = useVariant(variant);
|
|
7
7
|
return useMediaQuery({ query: `(${v}-height: ${_bp})` });
|
|
8
8
|
}
|
|
9
|
-
export function useVBreakpointMF(b) {
|
|
10
|
-
return useVBreakpoint(b, 'MtF');
|
|
11
|
-
}
|
|
12
|
-
export function useVBreakpointDF(b) {
|
|
13
|
-
return useVBreakpoint(b, 'DtF');
|
|
14
|
-
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { TBreakpoint, TVerticalBreakpoint } from './interfaces/TBreakpoint';
|
|
2
2
|
import { TBreakpoints, TVerticalBreakpoints } from './interfaces/TBreakpoints';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { useBreakpointBetween, useBreakpoint } from './hooks/useBreakpoint.js';
|
|
4
|
+
import { useVBreakpoint } from './hooks/useVBreakpoint.js';
|
|
5
|
+
import { getBreakpoint, getVBreakpoint } from './functions/getBreakpoint.js';
|
|
5
6
|
export type { TBreakpoints, TBreakpoint, TVerticalBreakpoint, TVerticalBreakpoints, };
|
|
7
|
+
export { useBreakpointBetween, useBreakpoint, useVBreakpoint, getBreakpoint, getVBreakpoint, };
|
|
6
8
|
export * from './components/horizontal.js';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { useBreakpointBetween, useBreakpoint } from './hooks/useBreakpoint.js';
|
|
2
|
+
import { useVBreakpoint } from './hooks/useVBreakpoint.js';
|
|
3
|
+
import { getBreakpoint, getVBreakpoint } from './functions/getBreakpoint.js';
|
|
4
|
+
export { useBreakpointBetween, useBreakpoint, useVBreakpoint, getBreakpoint, getVBreakpoint, };
|
|
3
5
|
export * from './components/horizontal.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"fs";import n from"path";import{fileURLToPath as e}from"url";import{HORIZONTAL_BREAKPOINTS as r,VERTICAL_BREAKPOINTS as i}from"../default.config.js";const
|
|
1
|
+
import o from"fs";import n from"path";import{fileURLToPath as e}from"url";import{HORIZONTAL_BREAKPOINTS as r,VERTICAL_BREAKPOINTS as s,PREFERRED_VARIANT as i}from"../default.config.js";const l=e(import.meta.url),t=n.dirname(l),R=n.resolve(t,"../../../../breakpoints.config.js");(async()=>{let e=r,l=s,a=i;if(o.existsSync(R))try{console.log(`User config file found at: ${R}`);const o=await import(R);console.log(`Loaded user config: ${JSON.stringify(o,null,2)}`),o.HORIZONTAL_BREAKPOINTS?(e=o.HORIZONTAL_BREAKPOINTS,console.log("Using user provided horizontal breakpoints.")):console.log("Using default horizontal breakpoints."),o.VERTICAL_BREAKPOINTS?(l=o.VERTICAL_BREAKPOINTS,console.log("Using user provided vertical breakpoints.")):console.log("Using default vertical breakpoints."),o.PREFERRED_VARIANT?(a=o.PREFERRED_VARIANT,console.log("Using user provided preferred variant.")):console.log("Using default preferred variant.")}catch(o){console.error("Error loading user config:",o)}else console.log(`User config file not found at: ${R}. Using default breakpoints.`);const c=`\n // breakpoints.config.mjs\n const HORIZONTAL_BREAKPOINTS = ${JSON.stringify(e,null,2)};\n\n const VERTICAL_BREAKPOINTS = ${JSON.stringify(l,null,2)};\n\n const PREFERRED_VARIANT = ${JSON.stringify(a)};\n\n export { HORIZONTAL_BREAKPOINTS, VERTICAL_BREAKPOINTS, PREFERRED_VARIANT };\n `;try{o.writeFileSync(n.resolve(t,"../breakpoints.config.js"),c),console.log("Config file has been generated successfully.")}catch(o){console.error("Error writing merged config file:",o)}})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-responsive-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -43,11 +43,13 @@
|
|
|
43
43
|
"@babel/preset-env": "^7.25.4",
|
|
44
44
|
"@babel/preset-react": "^7.24.7",
|
|
45
45
|
"@babel/preset-typescript": "^7.24.7",
|
|
46
|
+
"@testing-library/dom": "^10.4.1",
|
|
46
47
|
"@testing-library/jest-dom": "^6.5.0",
|
|
47
48
|
"@testing-library/react": "^16.0.1",
|
|
48
49
|
"@testing-library/react-hooks": "^8.0.1",
|
|
49
50
|
"@types/jest": "^29.5.12",
|
|
50
51
|
"@types/node": "^22.5.4",
|
|
52
|
+
"@types/react": "^19.1.8",
|
|
51
53
|
"@types/react-dom": "^18.3.0",
|
|
52
54
|
"@typescript-eslint/eslint-plugin": "^8.5.0",
|
|
53
55
|
"@typescript-eslint/parser": "^8.5.0",
|
|
@@ -69,6 +71,7 @@
|
|
|
69
71
|
"glob": "^11.0.0",
|
|
70
72
|
"husky": "^9.1.5",
|
|
71
73
|
"jest": "^29.7.0",
|
|
74
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
72
75
|
"react": "19.1.0",
|
|
73
76
|
"react-dom": "19.1.0",
|
|
74
77
|
"react-responsive": "^10.0.1",
|
|
@@ -83,10 +86,13 @@
|
|
|
83
86
|
"webpack": "^5.94.0",
|
|
84
87
|
"webpack-cli": "^5.1.4"
|
|
85
88
|
},
|
|
89
|
+
"resolutions": {
|
|
90
|
+
"string-width": "4.2.3",
|
|
91
|
+
"string-length": "4.0.2",
|
|
92
|
+
"strip-ansi": "6.0.1",
|
|
93
|
+
"wrap-ansi": "7.0.0"
|
|
94
|
+
},
|
|
86
95
|
"bin": {
|
|
87
96
|
"react-responsive-tools": "bin/react-responsive-tools.mjs"
|
|
88
|
-
},
|
|
89
|
-
"dependencies": {
|
|
90
|
-
"@types/react": "^19.1.8"
|
|
91
97
|
}
|
|
92
98
|
}
|