reso-ui 3.4.0 → 3.5.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/README.md +73 -0
- package/dist/cjs/context/ResponsiveContext.js +3 -0
- package/dist/cjs/context/ResponsiveContext.js.map +1 -1
- package/dist/cjs/providers/ResponsiveProvider.js +35 -17
- package/dist/cjs/providers/ResponsiveProvider.js.map +1 -1
- package/dist/cjs/utils/responsive.js +32 -0
- package/dist/cjs/utils/responsive.js.map +1 -0
- package/dist/esm/context/ResponsiveContext.d.ts +3 -0
- package/dist/esm/context/ResponsiveContext.js +3 -0
- package/dist/esm/context/ResponsiveContext.js.map +1 -1
- package/dist/esm/providers/ResponsiveProvider.js +36 -18
- package/dist/esm/providers/ResponsiveProvider.js.map +1 -1
- package/dist/esm/utils/responsive.d.ts +12 -0
- package/dist/esm/utils/responsive.js +25 -0
- package/dist/esm/utils/responsive.js.map +1 -0
- package/dist/src/library/components/Dialog/stories/Dialog.stories.d.ts +7 -7
- package/dist/src/library/context/ResponsiveContext.d.ts +3 -0
- package/dist/src/library/providers/__test__/ResponsiveProvider.test.d.ts +1 -0
- package/dist/src/library/utils/__test__/responsive.test.d.ts +1 -0
- package/dist/src/library/utils/responsive.d.ts +12 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,6 +33,7 @@ A React component library built with TypeScript + SCSS. Ships as tree-shakeable
|
|
|
33
33
|
- [Import styles](#import-styles)
|
|
34
34
|
- [Basic usage](#basic-usage)
|
|
35
35
|
- [Theming & Dark Mode Setup](#theming--dark-mode-setup)
|
|
36
|
+
- [Responsive Context](#responsive-context)
|
|
36
37
|
- [Overriding the Color Palette](#overriding-the-color-palette)
|
|
37
38
|
- [Utility Classes](#utility-classes)
|
|
38
39
|
- [Dev Notes](#dev-notes)
|
|
@@ -472,6 +473,78 @@ Scope dark-mode overrides with the same attribute selector:
|
|
|
472
473
|
|
|
473
474
|
---
|
|
474
475
|
|
|
476
|
+
## Responsive Context
|
|
477
|
+
|
|
478
|
+
`ResoUiProvider` includes a `ResponsiveContext` that exposes viewport breakpoints to any component in your app.
|
|
479
|
+
|
|
480
|
+
### Basic usage (viewport-only)
|
|
481
|
+
|
|
482
|
+
```tsx
|
|
483
|
+
import { useContext } from "react";
|
|
484
|
+
import { ResponsiveContext } from "reso-ui";
|
|
485
|
+
|
|
486
|
+
const MyComponent = () => {
|
|
487
|
+
const { isMobile, isTablet } = useContext(ResponsiveContext);
|
|
488
|
+
return isMobile ? <MobileLayout /> : <DesktopLayout />;
|
|
489
|
+
};
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### Breakpoints
|
|
493
|
+
|
|
494
|
+
| Flag | Range |
|
|
495
|
+
|------|-------|
|
|
496
|
+
| `isMobile` | `width < 640` |
|
|
497
|
+
| `isTablet` | `640 <= width < 768` |
|
|
498
|
+
| `isMdDesktop` | `768 <= width < 1024` |
|
|
499
|
+
| `isLgDesktop` | `1024 <= width < 1280` |
|
|
500
|
+
| `isXLgDesktop` | `width >= 1280` |
|
|
501
|
+
|
|
502
|
+
### Container-aware breakpoints (optional)
|
|
503
|
+
|
|
504
|
+
By default, breakpoints are computed from the viewport width. If your app has sidebars, drawers, or panels that reduce the main content area, you can register a container element so breakpoints reflect the **actual available space**.
|
|
505
|
+
|
|
506
|
+
When a container is registered, breakpoints are computed from `Math.min(viewportWidth, containerWidth)`. This means `isMobile` becomes `true` when **either** the viewport or the tracked container is narrow.
|
|
507
|
+
|
|
508
|
+
```tsx
|
|
509
|
+
import { useContext, useEffect, useRef } from "react";
|
|
510
|
+
import { Flex, ResponsiveContext } from "reso-ui";
|
|
511
|
+
|
|
512
|
+
const App = () => {
|
|
513
|
+
const mainRef = useRef<HTMLDivElement>(null);
|
|
514
|
+
const { setContainerRef } = useContext(ResponsiveContext);
|
|
515
|
+
|
|
516
|
+
useEffect(() => {
|
|
517
|
+
if (mainRef.current) setContainerRef(mainRef.current);
|
|
518
|
+
return () => setContainerRef(null);
|
|
519
|
+
}, []);
|
|
520
|
+
|
|
521
|
+
return (
|
|
522
|
+
<Flex ref={mainRef} direction="column">
|
|
523
|
+
{/* All child components get container-aware breakpoints */}
|
|
524
|
+
</Flex>
|
|
525
|
+
);
|
|
526
|
+
};
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
When no container is registered (the default), breakpoints work exactly as before — no changes needed in existing apps.
|
|
530
|
+
|
|
531
|
+
### Available context values
|
|
532
|
+
|
|
533
|
+
| Field | Type | Description |
|
|
534
|
+
|-------|------|-------------|
|
|
535
|
+
| `isMobile` | `boolean` | Effective width < 640 |
|
|
536
|
+
| `isTablet` | `boolean` | 640 <= effective width < 768 |
|
|
537
|
+
| `isMdDesktop` | `boolean` | 768 <= effective width < 1024 |
|
|
538
|
+
| `isLgDesktop` | `boolean` | 1024 <= effective width < 1280 |
|
|
539
|
+
| `isXLgDesktop` | `boolean` | Effective width >= 1280 |
|
|
540
|
+
| `windowWidth` | `number` | Actual viewport width |
|
|
541
|
+
| `windowHeight` | `number` | Actual viewport height |
|
|
542
|
+
| `containerWidth` | `number` | Tracked container width (0 if none registered) |
|
|
543
|
+
| `containerHeight` | `number` | Tracked container height (0 if none registered) |
|
|
544
|
+
| `setContainerRef` | `(el: HTMLElement \| null) => void` | Register/unregister a container element |
|
|
545
|
+
|
|
546
|
+
---
|
|
547
|
+
|
|
475
548
|
## Overriding the Color Palette
|
|
476
549
|
|
|
477
550
|
`ResoUiProvider` accepts optional `theme` and `mode` props for runtime theming with no build step required.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsiveContext.js","sources":["../../../src/library/context/ResponsiveContext.ts"],"sourcesContent":[null],"names":["createContext"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"ResponsiveContext.js","sources":["../../../src/library/context/ResponsiveContext.ts"],"sourcesContent":[null],"names":["createContext"],"mappings":";;;;AAeO,MAAM,iBAAiB,GAAGA,mBAAa,CAAqB;AACjE,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,WAAW,EAAE,KAAK;AAClB,IAAA,WAAW,EAAE,KAAK;AAClB,IAAA,YAAY,EAAE,KAAK;AACnB,IAAA,WAAW,EAAE,CAAC;AACd,IAAA,YAAY,EAAE,CAAC;AACf,IAAA,cAAc,EAAE,CAAC;AACjB,IAAA,eAAe,EAAE,CAAC;AAClB,IAAA,eAAe,EAAE,MAAK,EAAE,CAAC;AAC1B,CAAA;;;;"}
|
|
@@ -3,25 +3,43 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var useWindowSize = require('../hooks/useWindowSize.js');
|
|
5
5
|
var ResponsiveContext = require('../context/ResponsiveContext.js');
|
|
6
|
+
var responsive = require('../utils/responsive.js');
|
|
6
7
|
|
|
7
8
|
const ResponsiveProvider = ({ children }) => {
|
|
8
|
-
const [
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
9
|
+
const [windowWidth, windowHeight] = useWindowSize.useWindowSize();
|
|
10
|
+
const [containerEl, setContainerEl] = React.useState(null);
|
|
11
|
+
const [containerSize, setContainerSize] = React.useState({ width: 0, height: 0 });
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
if (!containerEl) {
|
|
14
|
+
setContainerSize({ width: 0, height: 0 });
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
setContainerSize({ width: containerEl.offsetWidth, height: containerEl.offsetHeight });
|
|
18
|
+
const observer = new ResizeObserver((entries) => {
|
|
19
|
+
if (entries[0]) {
|
|
20
|
+
setContainerSize({
|
|
21
|
+
width: entries[0].contentRect.width,
|
|
22
|
+
height: entries[0].contentRect.height,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
observer.observe(containerEl);
|
|
27
|
+
return () => observer.disconnect();
|
|
28
|
+
}, [containerEl]);
|
|
29
|
+
const effectiveWidth = containerEl
|
|
30
|
+
? Math.min(windowWidth, containerSize.width)
|
|
31
|
+
: windowWidth;
|
|
32
|
+
const band = responsive.computeBreakpointBand(effectiveWidth);
|
|
33
|
+
const breakpoints = React.useMemo(() => responsive.computeBreakpoints(effectiveWidth), [band]);
|
|
34
|
+
const value = React.useMemo(() => ({
|
|
35
|
+
...breakpoints,
|
|
36
|
+
windowWidth,
|
|
37
|
+
windowHeight,
|
|
38
|
+
containerWidth: containerSize.width,
|
|
39
|
+
containerHeight: containerSize.height,
|
|
40
|
+
setContainerRef: setContainerEl,
|
|
41
|
+
}), [breakpoints, windowWidth, windowHeight, containerSize.width, containerSize.height]);
|
|
42
|
+
return (React.createElement(ResponsiveContext.ResponsiveContext.Provider, { value: value }, children));
|
|
25
43
|
};
|
|
26
44
|
|
|
27
45
|
exports.ResponsiveProvider = ResponsiveProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsiveProvider.js","sources":["../../../src/library/providers/ResponsiveProvider.tsx"],"sourcesContent":[null],"names":["useWindowSize","useMemo","ResponsiveContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ResponsiveProvider.js","sources":["../../../src/library/providers/ResponsiveProvider.tsx"],"sourcesContent":[null],"names":["useWindowSize","useState","useEffect","computeBreakpointBand","useMemo","computeBreakpoints","ResponsiveContext"],"mappings":";;;;;;;MAKa,kBAAkB,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAI;IACjD,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,GAAGA,2BAAa,EAAE;IAEnD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAGC,cAAQ,CAAqB,IAAI,CAAC;AACxE,IAAA,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAGA,cAAQ,CAAoC,EAAE,KAAK,EAAE,CA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,CAAC,EACF,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CACpF;AAED,IAAA,QACE,KAAA,CAAA,aAAA,CAACE,mCAAiB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,KAAK,EAAA,EACrC,QAAQ,CACkB;AAEjC;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const BREAKPOINT_MOBILE = 640;
|
|
4
|
+
const BREAKPOINT_TABLET = 768;
|
|
5
|
+
const BREAKPOINT_MD_DESKTOP = 1024;
|
|
6
|
+
const BREAKPOINT_LG_DESKTOP = 1280;
|
|
7
|
+
const computeBreakpoints = (width) => ({
|
|
8
|
+
isMobile: width < BREAKPOINT_MOBILE,
|
|
9
|
+
isTablet: width >= BREAKPOINT_MOBILE && width < BREAKPOINT_TABLET,
|
|
10
|
+
isMdDesktop: width >= BREAKPOINT_TABLET && width < BREAKPOINT_MD_DESKTOP,
|
|
11
|
+
isLgDesktop: width >= BREAKPOINT_MD_DESKTOP && width < BREAKPOINT_LG_DESKTOP,
|
|
12
|
+
isXLgDesktop: width >= BREAKPOINT_LG_DESKTOP,
|
|
13
|
+
});
|
|
14
|
+
const computeBreakpointBand = (width) => {
|
|
15
|
+
if (width < BREAKPOINT_MOBILE)
|
|
16
|
+
return 0;
|
|
17
|
+
if (width < BREAKPOINT_TABLET)
|
|
18
|
+
return 1;
|
|
19
|
+
if (width < BREAKPOINT_MD_DESKTOP)
|
|
20
|
+
return 2;
|
|
21
|
+
if (width < BREAKPOINT_LG_DESKTOP)
|
|
22
|
+
return 3;
|
|
23
|
+
return 4;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.BREAKPOINT_LG_DESKTOP = BREAKPOINT_LG_DESKTOP;
|
|
27
|
+
exports.BREAKPOINT_MD_DESKTOP = BREAKPOINT_MD_DESKTOP;
|
|
28
|
+
exports.BREAKPOINT_MOBILE = BREAKPOINT_MOBILE;
|
|
29
|
+
exports.BREAKPOINT_TABLET = BREAKPOINT_TABLET;
|
|
30
|
+
exports.computeBreakpointBand = computeBreakpointBand;
|
|
31
|
+
exports.computeBreakpoints = computeBreakpoints;
|
|
32
|
+
//# sourceMappingURL=responsive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responsive.js","sources":["../../../src/library/utils/responsive.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAO,MAAM,iBAAiB,GAAG;AAC1B,MAAM,iBAAiB,GAAG;AAC1B,MAAM,qBAAqB,GAAG;AAC9B,MAAM,qBAAqB,GAAG;MAExB,kBAAkB,GAAG,CAAC,KAAa,MAAM;IACpD,QAAQ,EAAE,KAAK,GAAG,iBAAiB;AACnC,IAAA,QAAQ,EAAE,KAAK,IAAI,iBAAiB,IAAI,KAAK,GAAG,iBAAiB;AACjE,IAAA,WAAW,EAAE,KAAK,IAAI,iBAAiB,IAAI,KAAK,GAAG,qBAAqB;AACxE,IAAA,WAAW,EAAE,KAAK,IAAI,qBAAqB,IAAI,KAAK,GAAG,qBAAqB;IAC5E,YAAY,EAAE,KAAK,IAAI,qBAAqB;AAC7C,CAAA;AAEM,MAAM,qBAAqB,GAAG,CAAC,KAAa,KAAY;IAC7D,IAAI,KAAK,GAAG,iBAAiB;AAAE,QAAA,OAAO,CAAC;IACvC,IAAI,KAAK,GAAG,iBAAiB;AAAE,QAAA,OAAO,CAAC;IACvC,IAAI,KAAK,GAAG,qBAAqB;AAAE,QAAA,OAAO,CAAC;IAC3C,IAAI,KAAK,GAAG,qBAAqB;AAAE,QAAA,OAAO,CAAC;AAC3C,IAAA,OAAO,CAAC;AACV;;;;;;;;;"}
|
|
@@ -6,5 +6,8 @@ export interface IResponsiveContext {
|
|
|
6
6
|
isXLgDesktop: boolean;
|
|
7
7
|
windowWidth: number;
|
|
8
8
|
windowHeight: number;
|
|
9
|
+
containerWidth: number;
|
|
10
|
+
containerHeight: number;
|
|
11
|
+
setContainerRef: (el: HTMLElement | null) => void;
|
|
9
12
|
}
|
|
10
13
|
export declare const ResponsiveContext: import("react").Context<IResponsiveContext>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsiveContext.js","sources":["../../../src/library/context/ResponsiveContext.ts"],"sourcesContent":[null],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"ResponsiveContext.js","sources":["../../../src/library/context/ResponsiveContext.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAeO,MAAM,iBAAiB,GAAG,aAAa,CAAqB;AACjE,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,WAAW,EAAE,KAAK;AAClB,IAAA,WAAW,EAAE,KAAK;AAClB,IAAA,YAAY,EAAE,KAAK;AACnB,IAAA,WAAW,EAAE,CAAC;AACd,IAAA,YAAY,EAAE,CAAC;AACf,IAAA,cAAc,EAAE,CAAC;AACjB,IAAA,eAAe,EAAE,CAAC;AAClB,IAAA,eAAe,EAAE,MAAK,EAAE,CAAC;AAC1B,CAAA;;;;"}
|
|
@@ -1,25 +1,43 @@
|
|
|
1
|
-
import React__default, { useMemo } from 'react';
|
|
1
|
+
import React__default, { useState, useEffect, useMemo } from 'react';
|
|
2
2
|
import { useWindowSize } from '../hooks/useWindowSize.js';
|
|
3
3
|
import { ResponsiveContext } from '../context/ResponsiveContext.js';
|
|
4
|
+
import { computeBreakpoints, computeBreakpointBand } from '../utils/responsive.js';
|
|
4
5
|
|
|
5
6
|
const ResponsiveProvider = ({ children }) => {
|
|
6
|
-
const [
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
7
|
+
const [windowWidth, windowHeight] = useWindowSize();
|
|
8
|
+
const [containerEl, setContainerEl] = useState(null);
|
|
9
|
+
const [containerSize, setContainerSize] = useState({ width: 0, height: 0 });
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (!containerEl) {
|
|
12
|
+
setContainerSize({ width: 0, height: 0 });
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
setContainerSize({ width: containerEl.offsetWidth, height: containerEl.offsetHeight });
|
|
16
|
+
const observer = new ResizeObserver((entries) => {
|
|
17
|
+
if (entries[0]) {
|
|
18
|
+
setContainerSize({
|
|
19
|
+
width: entries[0].contentRect.width,
|
|
20
|
+
height: entries[0].contentRect.height,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
observer.observe(containerEl);
|
|
25
|
+
return () => observer.disconnect();
|
|
26
|
+
}, [containerEl]);
|
|
27
|
+
const effectiveWidth = containerEl
|
|
28
|
+
? Math.min(windowWidth, containerSize.width)
|
|
29
|
+
: windowWidth;
|
|
30
|
+
const band = computeBreakpointBand(effectiveWidth);
|
|
31
|
+
const breakpoints = useMemo(() => computeBreakpoints(effectiveWidth), [band]);
|
|
32
|
+
const value = useMemo(() => ({
|
|
33
|
+
...breakpoints,
|
|
34
|
+
windowWidth,
|
|
35
|
+
windowHeight,
|
|
36
|
+
containerWidth: containerSize.width,
|
|
37
|
+
containerHeight: containerSize.height,
|
|
38
|
+
setContainerRef: setContainerEl,
|
|
39
|
+
}), [breakpoints, windowWidth, windowHeight, containerSize.width, containerSize.height]);
|
|
40
|
+
return (React__default.createElement(ResponsiveContext.Provider, { value: value }, children));
|
|
23
41
|
};
|
|
24
42
|
|
|
25
43
|
export { ResponsiveProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponsiveProvider.js","sources":["../../../src/library/providers/ResponsiveProvider.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ResponsiveProvider.js","sources":["../../../src/library/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B,CAAC,cAAc,CAAC;AAElD,IAAA,MAAM,WAAW,GAAG,OAAO,CACzB,MAAM,kBAAkB,CAAC,cAAc,CAAC,EACxC,CAAC,IAAI,CAAC,CACP;AAED,IAAA,MAAM,KAAK,GAAG,OAAO,CACnB,OAAO;AACL,QAAA,GAAG,WAAW;QACd,WAAW;QACX,YAAY;QACZ,cAAc,EAAE,aAAa,CAAC,KAAK;QACnC,eAAe,EAAE,aAAa,CAAC,MAAM;AACrC,QAAA,eAAe,EAAE,cAAc;AAChC,KAAA,CAAC,EACF,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CACpF;AAED,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,iBAAiB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,KAAK,EAAA,EACrC,QAAQ,CACkB;AAEjC;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const BREAKPOINT_MOBILE = 640;
|
|
2
|
+
export declare const BREAKPOINT_TABLET = 768;
|
|
3
|
+
export declare const BREAKPOINT_MD_DESKTOP = 1024;
|
|
4
|
+
export declare const BREAKPOINT_LG_DESKTOP = 1280;
|
|
5
|
+
export declare const computeBreakpoints: (width: number) => {
|
|
6
|
+
isMobile: boolean;
|
|
7
|
+
isTablet: boolean;
|
|
8
|
+
isMdDesktop: boolean;
|
|
9
|
+
isLgDesktop: boolean;
|
|
10
|
+
isXLgDesktop: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const computeBreakpointBand: (width: number) => number;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const BREAKPOINT_MOBILE = 640;
|
|
2
|
+
const BREAKPOINT_TABLET = 768;
|
|
3
|
+
const BREAKPOINT_MD_DESKTOP = 1024;
|
|
4
|
+
const BREAKPOINT_LG_DESKTOP = 1280;
|
|
5
|
+
const computeBreakpoints = (width) => ({
|
|
6
|
+
isMobile: width < BREAKPOINT_MOBILE,
|
|
7
|
+
isTablet: width >= BREAKPOINT_MOBILE && width < BREAKPOINT_TABLET,
|
|
8
|
+
isMdDesktop: width >= BREAKPOINT_TABLET && width < BREAKPOINT_MD_DESKTOP,
|
|
9
|
+
isLgDesktop: width >= BREAKPOINT_MD_DESKTOP && width < BREAKPOINT_LG_DESKTOP,
|
|
10
|
+
isXLgDesktop: width >= BREAKPOINT_LG_DESKTOP,
|
|
11
|
+
});
|
|
12
|
+
const computeBreakpointBand = (width) => {
|
|
13
|
+
if (width < BREAKPOINT_MOBILE)
|
|
14
|
+
return 0;
|
|
15
|
+
if (width < BREAKPOINT_TABLET)
|
|
16
|
+
return 1;
|
|
17
|
+
if (width < BREAKPOINT_MD_DESKTOP)
|
|
18
|
+
return 2;
|
|
19
|
+
if (width < BREAKPOINT_LG_DESKTOP)
|
|
20
|
+
return 3;
|
|
21
|
+
return 4;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { BREAKPOINT_LG_DESKTOP, BREAKPOINT_MD_DESKTOP, BREAKPOINT_MOBILE, BREAKPOINT_TABLET, computeBreakpointBand, computeBreakpoints };
|
|
25
|
+
//# sourceMappingURL=responsive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responsive.js","sources":["../../../src/library/utils/responsive.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAO,MAAM,iBAAiB,GAAG;AAC1B,MAAM,iBAAiB,GAAG;AAC1B,MAAM,qBAAqB,GAAG;AAC9B,MAAM,qBAAqB,GAAG;MAExB,kBAAkB,GAAG,CAAC,KAAa,MAAM;IACpD,QAAQ,EAAE,KAAK,GAAG,iBAAiB;AACnC,IAAA,QAAQ,EAAE,KAAK,IAAI,iBAAiB,IAAI,KAAK,GAAG,iBAAiB;AACjE,IAAA,WAAW,EAAE,KAAK,IAAI,iBAAiB,IAAI,KAAK,GAAG,qBAAqB;AACxE,IAAA,WAAW,EAAE,KAAK,IAAI,qBAAqB,IAAI,KAAK,GAAG,qBAAqB;IAC5E,YAAY,EAAE,KAAK,IAAI,qBAAqB;AAC7C,CAAA;AAEM,MAAM,qBAAqB,GAAG,CAAC,KAAa,KAAY;IAC7D,IAAI,KAAK,GAAG,iBAAiB;AAAE,QAAA,OAAO,CAAC;IACvC,IAAI,KAAK,GAAG,iBAAiB;AAAE,QAAA,OAAO,CAAC;IACvC,IAAI,KAAK,GAAG,qBAAqB;AAAE,QAAA,OAAO,CAAC;IAC3C,IAAI,KAAK,GAAG,qBAAqB;AAAE,QAAA,OAAO,CAAC;AAC3C,IAAA,OAAO,CAAC;AACV;;;;"}
|
|
@@ -23,13 +23,13 @@ declare const _default: {
|
|
|
23
23
|
okButtonStyles?: React.CSSProperties;
|
|
24
24
|
rootClassName?: string;
|
|
25
25
|
rootStyles?: React.CSSProperties;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
pt?: 0 | 2 | 1 | 3 |
|
|
30
|
-
pb?: 0 | 2 | 1 | 3 |
|
|
31
|
-
pr?: 0 | 2 | 1 | 3 |
|
|
32
|
-
pl?: 0 | 2 | 1 | 3 |
|
|
26
|
+
pv?: 0 | 2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
27
|
+
ph?: 0 | 2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
28
|
+
pa?: 0 | 2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
29
|
+
pt?: 0 | 2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
30
|
+
pb?: 0 | 2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
31
|
+
pr?: 0 | 2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
32
|
+
pl?: 0 | 2 | 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
33
33
|
isOpen: boolean;
|
|
34
34
|
layer?: number;
|
|
35
35
|
}>) => React.JSX.Element)[];
|
|
@@ -6,5 +6,8 @@ export interface IResponsiveContext {
|
|
|
6
6
|
isXLgDesktop: boolean;
|
|
7
7
|
windowWidth: number;
|
|
8
8
|
windowHeight: number;
|
|
9
|
+
containerWidth: number;
|
|
10
|
+
containerHeight: number;
|
|
11
|
+
setContainerRef: (el: HTMLElement | null) => void;
|
|
9
12
|
}
|
|
10
13
|
export declare const ResponsiveContext: import("react").Context<IResponsiveContext>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const BREAKPOINT_MOBILE = 640;
|
|
2
|
+
export declare const BREAKPOINT_TABLET = 768;
|
|
3
|
+
export declare const BREAKPOINT_MD_DESKTOP = 1024;
|
|
4
|
+
export declare const BREAKPOINT_LG_DESKTOP = 1280;
|
|
5
|
+
export declare const computeBreakpoints: (width: number) => {
|
|
6
|
+
isMobile: boolean;
|
|
7
|
+
isTablet: boolean;
|
|
8
|
+
isMdDesktop: boolean;
|
|
9
|
+
isLgDesktop: boolean;
|
|
10
|
+
isXLgDesktop: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const computeBreakpointBand: (width: number) => number;
|