@infonomic/uikit 6.1.0 → 6.2.1
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/components/inputs/input.module.css +7 -0
- package/dist/components/inputs/input_module.css +4 -0
- package/dist/components/inputs/text-area.module.css +15 -9
- package/dist/components/inputs/text-area_module.css +4 -0
- package/dist/styles/components-vanilla.css +1 -1
- package/dist/widgets/drawer/drawer-container.d.ts.map +1 -1
- package/dist/widgets/drawer/drawer-container.js +0 -1
- package/dist/widgets/drawer/drawer.d.ts +2 -1
- package/dist/widgets/drawer/drawer.d.ts.map +1 -1
- package/dist/widgets/drawer/drawer.js +34 -49
- package/dist/widgets/drawer/drawer.module.css +66 -54
- package/dist/widgets/drawer/drawer.module.js +3 -5
- package/dist/widgets/drawer/drawer_module.css +47 -81
- package/dist/widgets/modal/modal.d.ts +1 -1
- package/dist/widgets/modal/modal.d.ts.map +1 -1
- package/dist/widgets/modal/modal.js +23 -36
- package/dist/widgets/modal/modal.module.css +50 -9
- package/dist/widgets/modal/modal.module.js +1 -0
- package/dist/widgets/modal/modal_module.css +40 -8
- package/package.json +1 -1
- package/src/components/inputs/input.module.css +7 -0
- package/src/components/inputs/text-area.module.css +15 -9
- package/src/styles/local-fonts.css +5 -1
- package/src/widgets/drawer/drawer-container.tsx +0 -1
- package/src/widgets/drawer/drawer.module.css +66 -54
- package/src/widgets/drawer/drawer.stories.tsx +51 -5
- package/src/widgets/drawer/drawer.tsx +36 -50
- package/src/widgets/modal/modal.module.css +50 -9
- package/src/widgets/modal/modal.tsx +27 -45
- package/dist/components/overlay/index.d.ts +0 -2
- package/dist/components/overlay/index.d.ts.map +0 -1
- package/dist/components/overlay/index.js +0 -1
- package/dist/components/overlay/overlay.d.ts +0 -9
- package/dist/components/overlay/overlay.d.ts.map +0 -1
- package/dist/components/overlay/overlay.js +0 -51
- package/dist/components/overlay/overlay.module.css +0 -56
- package/dist/components/overlay/overlay.module.js +0 -13
- package/dist/components/overlay/overlay_module.css +0 -46
- package/dist/hooks/use-focus-trap/index.d.ts +0 -2
- package/dist/hooks/use-focus-trap/index.d.ts.map +0 -1
- package/dist/hooks/use-focus-trap/scope-tab.d.ts +0 -11
- package/dist/hooks/use-focus-trap/scope-tab.d.ts.map +0 -1
- package/dist/hooks/use-focus-trap/tabbable.d.ts +0 -14
- package/dist/hooks/use-focus-trap/tabbable.d.ts.map +0 -1
- package/dist/hooks/use-focus-trap/use-focus-trap.d.ts +0 -11
- package/dist/hooks/use-focus-trap/use-focus-trap.d.ts.map +0 -1
- package/dist/utils/getPortalRoot.d.ts +0 -2
- package/dist/utils/getPortalRoot.d.ts.map +0 -1
- package/dist/widgets/drawer/drawer-wrapper.d.ts +0 -9
- package/dist/widgets/drawer/drawer-wrapper.d.ts.map +0 -1
- package/dist/widgets/drawer/drawer-wrapper.js +0 -37
- package/dist/widgets/drawer/motionDomAnimation.d.ts +0 -3
- package/dist/widgets/drawer/motionDomAnimation.d.ts.map +0 -1
- package/dist/widgets/drawer/motionDomMax.d.ts +0 -3
- package/dist/widgets/drawer/motionDomMax.d.ts.map +0 -1
- package/dist/widgets/modal/modal-wrapper.d.ts +0 -8
- package/dist/widgets/modal/modal-wrapper.d.ts.map +0 -1
- package/dist/widgets/modal/modal-wrapper.js +0 -37
- package/dist/widgets/modal/motionDomAnimation.d.ts +0 -3
- package/dist/widgets/modal/motionDomAnimation.d.ts.map +0 -1
- package/dist/widgets/modal/motionDomMax.d.ts +0 -3
- package/dist/widgets/modal/motionDomMax.d.ts.map +0 -1
- package/src/components/overlay/index.stories.tsx +0 -26
- package/src/components/overlay/index.ts +0 -2
- package/src/components/overlay/overlay.module.css +0 -56
- package/src/components/overlay/overlay.tsx +0 -70
- package/src/widgets/drawer/drawer-wrapper.tsx +0 -53
- package/src/widgets/modal/modal-wrapper.tsx +0 -51
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
@layer infonomic-base,
|
|
2
|
-
infonomic-utilities,
|
|
3
|
-
infonomic-theme,
|
|
4
|
-
infonomic-typography,
|
|
5
|
-
infonomic-components;
|
|
6
|
-
|
|
7
|
-
@layer infonomic-components {
|
|
8
|
-
.overlay,
|
|
9
|
-
:global(.infonomic-overlay) {
|
|
10
|
-
position: fixed;
|
|
11
|
-
top: 0;
|
|
12
|
-
left: 0;
|
|
13
|
-
width: 100%;
|
|
14
|
-
height: 100%;
|
|
15
|
-
background-color: rgba(245, 245, 245, 0.35);
|
|
16
|
-
z-index: 20;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
:global(.dark),
|
|
20
|
-
:global([data-theme="dark"]) {
|
|
21
|
-
.overlay,
|
|
22
|
-
:global(.infonomic-overlay) {
|
|
23
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.animate-fade-in,
|
|
28
|
-
:global(.infonomic-animate-fade-in) {
|
|
29
|
-
animation: fade-in 0.3s ease-in-out;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.animate-fade-out,
|
|
33
|
-
:global(.infonomic-animate-fade-out) {
|
|
34
|
-
animation: fade-out 0.3s ease-in-out;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@keyframes fade-in {
|
|
38
|
-
from {
|
|
39
|
-
opacity: 0;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
to {
|
|
43
|
-
opacity: 1;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@keyframes fade-out {
|
|
48
|
-
from {
|
|
49
|
-
opacity: 1;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
to {
|
|
53
|
-
opacity: 0;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import "./overlay_module.css";
|
|
2
|
-
const overlay_module = {
|
|
3
|
-
overlay: "overlay-hax8h5",
|
|
4
|
-
"animate-fade-in": "animate-fade-in-oC0Zd7",
|
|
5
|
-
animateFadeIn: "animate-fade-in-oC0Zd7",
|
|
6
|
-
"fade-in": "fade-in-ODU8WG",
|
|
7
|
-
fadeIn: "fade-in-ODU8WG",
|
|
8
|
-
"animate-fade-out": "animate-fade-out-kWVP8l",
|
|
9
|
-
animateFadeOut: "animate-fade-out-kWVP8l",
|
|
10
|
-
"fade-out": "fade-out-i2NoTL",
|
|
11
|
-
fadeOut: "fade-out-i2NoTL"
|
|
12
|
-
};
|
|
13
|
-
export default overlay_module;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
@layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-typography;
|
|
2
|
-
|
|
3
|
-
@layer infonomic-components {
|
|
4
|
-
:is(.overlay-hax8h5, .infonomic-overlay) {
|
|
5
|
-
z-index: 20;
|
|
6
|
-
background-color: #f5f5f559;
|
|
7
|
-
width: 100%;
|
|
8
|
-
height: 100%;
|
|
9
|
-
position: fixed;
|
|
10
|
-
top: 0;
|
|
11
|
-
left: 0;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
:is(:is(.dark, [data-theme="dark"]) .overlay-hax8h5, :is(.dark, [data-theme="dark"]) .infonomic-overlay) {
|
|
15
|
-
background-color: #00000080;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
:is(.animate-fade-in-oC0Zd7, .infonomic-animate-fade-in) {
|
|
19
|
-
animation: .3s ease-in-out fade-in-ODU8WG;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
:is(.animate-fade-out-kWVP8l, .infonomic-animate-fade-out) {
|
|
23
|
-
animation: .3s ease-in-out fade-out-i2NoTL;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@keyframes fade-in-ODU8WG {
|
|
27
|
-
from {
|
|
28
|
-
opacity: 0;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
to {
|
|
32
|
-
opacity: 1;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@keyframes fade-out-i2NoTL {
|
|
37
|
-
from {
|
|
38
|
-
opacity: 1;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
to {
|
|
42
|
-
opacity: 0;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-focus-trap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Scope tab key navigation within a container.
|
|
3
|
-
*
|
|
4
|
-
* Based on use-focus-trap from Mantine (https://github.com/mantinedev/mantine)
|
|
5
|
-
* Original work licensed under the MIT License.
|
|
6
|
-
* Copyright (c) 2021 Vitaly Rtishchev
|
|
7
|
-
*
|
|
8
|
-
* Adapted for use as an internal ESM/TypeScript module.
|
|
9
|
-
*/
|
|
10
|
-
export declare function scopeTab(node: HTMLElement, event: KeyboardEvent): void;
|
|
11
|
-
//# sourceMappingURL=scope-tab.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scope-tab.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-focus-trap/scope-tab.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,QAmC/D"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Focus-trap tabbable element utilities.
|
|
3
|
-
*
|
|
4
|
-
* Based on use-focus-trap from Mantine (https://github.com/mantinedev/mantine)
|
|
5
|
-
* Original work licensed under the MIT License.
|
|
6
|
-
* Copyright (c) 2021 Vitaly Rtishchev
|
|
7
|
-
*
|
|
8
|
-
* Adapted for use as an internal ESM/TypeScript module.
|
|
9
|
-
*/
|
|
10
|
-
export declare const FOCUS_SELECTOR = "a, input, select, textarea, button, object, [tabindex]";
|
|
11
|
-
export declare function focusable(element: HTMLElement): boolean | "";
|
|
12
|
-
export declare function tabbable(element: HTMLElement): boolean | "";
|
|
13
|
-
export declare function findTabbableDescendants(element: HTMLElement): HTMLElement[];
|
|
14
|
-
//# sourceMappingURL=tabbable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tabbable.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-focus-trap/tabbable.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,eAAO,MAAM,cAAc,2DAA2D,CAAA;AAwCtF,wBAAgB,SAAS,CAAC,OAAO,EAAE,WAAW,gBAS7C;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,gBAI5C;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,EAAE,CAE3E"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Focus trap hook — traps keyboard focus within a container element.
|
|
3
|
-
*
|
|
4
|
-
* Based on use-focus-trap from Mantine (https://github.com/mantinedev/mantine)
|
|
5
|
-
* Original work licensed under the MIT License.
|
|
6
|
-
* Copyright (c) 2021 Vitaly Rtishchev
|
|
7
|
-
*
|
|
8
|
-
* Adapted for use as an internal ESM/TypeScript module.
|
|
9
|
-
*/
|
|
10
|
-
export declare function useFocusTrap(active?: boolean): React.RefCallback<HTMLElement | null>;
|
|
11
|
-
//# sourceMappingURL=use-focus-trap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-focus-trap.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-focus-trap/use-focus-trap.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,wBAAgB,YAAY,CAAC,MAAM,UAAO,GAAG,KAAK,CAAC,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC,CAmEjF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPortalRoot.d.ts","sourceRoot":"","sources":["../../src/utils/getPortalRoot.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,IAAI,KAAK,GAAG,WAAW,CAEnD"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { HTMLMotionProps } from 'motion/react';
|
|
3
|
-
export interface DrawerWrapperProps extends HTMLMotionProps<'div'> {
|
|
4
|
-
className?: string;
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
onEscapeKey?: (e: any) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare function DrawerWrapper({ className, children, onEscapeKey, ...rest }: DrawerWrapperProps): React.JSX.Element;
|
|
9
|
-
//# sourceMappingURL=drawer-wrapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-wrapper.d.ts","sourceRoot":"","sources":["../../../src/widgets/drawer/drawer-wrapper.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAMnD,MAAM,WAAW,kBAAmB,SAAQ,eAAe,CAAC,KAAK,CAAC;IAChE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;CAC/B;AAED,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,QAAQ,EACR,WAAW,EACX,GAAG,IAAI,EACR,EAAE,kBAAkB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA4BxC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect } from "react";
|
|
4
|
-
import classnames from "classnames";
|
|
5
|
-
import { m } from "motion/react";
|
|
6
|
-
import { useFocusTrap } from "../../hooks/use-focus-trap/index.js";
|
|
7
|
-
import drawer_module from "./drawer.module.js";
|
|
8
|
-
function DrawerWrapper({ className, children, onEscapeKey, ...rest }) {
|
|
9
|
-
const focusTrapRef = useFocusTrap();
|
|
10
|
-
useEffect(()=>{
|
|
11
|
-
const handleKeyDown = (event)=>{
|
|
12
|
-
if ('Escape' === event.key && onEscapeKey) onEscapeKey(event);
|
|
13
|
-
};
|
|
14
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
15
|
-
return ()=>{
|
|
16
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
17
|
-
};
|
|
18
|
-
}, [
|
|
19
|
-
onEscapeKey
|
|
20
|
-
]);
|
|
21
|
-
return /*#__PURE__*/ jsx(m.div, {
|
|
22
|
-
ref: focusTrapRef,
|
|
23
|
-
...rest,
|
|
24
|
-
className: classnames('infonomic-drawer-wrapper', drawer_module["drawer-wrapper"], className),
|
|
25
|
-
initial: {
|
|
26
|
-
opacity: 0
|
|
27
|
-
},
|
|
28
|
-
animate: {
|
|
29
|
-
opacity: 1
|
|
30
|
-
},
|
|
31
|
-
exit: {
|
|
32
|
-
opacity: 0
|
|
33
|
-
},
|
|
34
|
-
children: children
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
export { DrawerWrapper };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"motionDomAnimation.d.ts","sourceRoot":"","sources":["../../../src/widgets/drawer/motionDomAnimation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,eAAe,YAAY,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"motionDomMax.d.ts","sourceRoot":"","sources":["../../../src/widgets/drawer/motionDomMax.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,eAAe,MAAM,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { HTMLMotionProps } from 'motion/react';
|
|
3
|
-
export interface ModalWrapperProps extends HTMLMotionProps<'div'> {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
onEscapeKey?: (e: any) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare function ModalWrapper({ children, onEscapeKey, ...rest }: ModalWrapperProps): React.JSX.Element;
|
|
8
|
-
//# sourceMappingURL=modal-wrapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modal-wrapper.d.ts","sourceRoot":"","sources":["../../../src/widgets/modal/modal-wrapper.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAMnD,MAAM,WAAW,iBAAkB,SAAQ,eAAe,CAAC,KAAK,CAAC;IAC/D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;CAC/B;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,WAAW,EACX,GAAG,IAAI,EACR,EAAE,iBAAiB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA4BvC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect } from "react";
|
|
4
|
-
import classnames from "classnames";
|
|
5
|
-
import { m } from "motion/react";
|
|
6
|
-
import { useFocusTrap } from "../../hooks/use-focus-trap/index.js";
|
|
7
|
-
import modal_module from "./modal.module.js";
|
|
8
|
-
function ModalWrapper({ children, onEscapeKey, ...rest }) {
|
|
9
|
-
const focusTrapRef = useFocusTrap();
|
|
10
|
-
useEffect(()=>{
|
|
11
|
-
const handleKeyDown = (event)=>{
|
|
12
|
-
if ('Escape' === event.key && onEscapeKey) onEscapeKey(event);
|
|
13
|
-
};
|
|
14
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
15
|
-
return ()=>{
|
|
16
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
17
|
-
};
|
|
18
|
-
}, [
|
|
19
|
-
onEscapeKey
|
|
20
|
-
]);
|
|
21
|
-
return /*#__PURE__*/ jsx(m.div, {
|
|
22
|
-
ref: focusTrapRef,
|
|
23
|
-
...rest,
|
|
24
|
-
className: classnames('infonomic-modal-wrapper', modal_module["modal-wrapper"]),
|
|
25
|
-
initial: {
|
|
26
|
-
opacity: 0
|
|
27
|
-
},
|
|
28
|
-
animate: {
|
|
29
|
-
opacity: 1
|
|
30
|
-
},
|
|
31
|
-
exit: {
|
|
32
|
-
opacity: 0
|
|
33
|
-
},
|
|
34
|
-
children: children
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
export { ModalWrapper };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"motionDomAnimation.d.ts","sourceRoot":"","sources":["../../../src/widgets/modal/motionDomAnimation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,eAAe,YAAY,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"motionDomMax.d.ts","sourceRoot":"","sources":["../../../src/widgets/modal/motionDomMax.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,eAAe,MAAM,CAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
-
|
|
3
|
-
import { Overlay } from './overlay.js'
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Overlay> = {
|
|
6
|
-
/* 👇 The title prop is optional.
|
|
7
|
-
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
8
|
-
* to learn how to generate automatic titles
|
|
9
|
-
*/
|
|
10
|
-
title: 'Components/Overlay',
|
|
11
|
-
component: Overlay,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default meta
|
|
15
|
-
|
|
16
|
-
type Story = StoryObj<typeof Overlay>
|
|
17
|
-
|
|
18
|
-
export const Default: Story = {
|
|
19
|
-
render: () => <Overlay />,
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const Interactive: Story = {
|
|
23
|
-
args: {
|
|
24
|
-
isUnmounting: false,
|
|
25
|
-
},
|
|
26
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
@layer infonomic-base,
|
|
2
|
-
infonomic-utilities,
|
|
3
|
-
infonomic-theme,
|
|
4
|
-
infonomic-typography,
|
|
5
|
-
infonomic-components;
|
|
6
|
-
|
|
7
|
-
@layer infonomic-components {
|
|
8
|
-
.overlay,
|
|
9
|
-
:global(.infonomic-overlay) {
|
|
10
|
-
position: fixed;
|
|
11
|
-
top: 0;
|
|
12
|
-
left: 0;
|
|
13
|
-
width: 100%;
|
|
14
|
-
height: 100%;
|
|
15
|
-
background-color: rgba(245, 245, 245, 0.35);
|
|
16
|
-
z-index: 20;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
:global(.dark),
|
|
20
|
-
:global([data-theme="dark"]) {
|
|
21
|
-
.overlay,
|
|
22
|
-
:global(.infonomic-overlay) {
|
|
23
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.animate-fade-in,
|
|
28
|
-
:global(.infonomic-animate-fade-in) {
|
|
29
|
-
animation: fade-in 0.3s ease-in-out;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.animate-fade-out,
|
|
33
|
-
:global(.infonomic-animate-fade-out) {
|
|
34
|
-
animation: fade-out 0.3s ease-in-out;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@keyframes fade-in {
|
|
38
|
-
from {
|
|
39
|
-
opacity: 0;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
to {
|
|
43
|
-
opacity: 1;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@keyframes fade-out {
|
|
48
|
-
from {
|
|
49
|
-
opacity: 1;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
to {
|
|
53
|
-
opacity: 0;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import type React from 'react'
|
|
4
|
-
import { useEffect } from 'react'
|
|
5
|
-
|
|
6
|
-
import cx from 'classnames'
|
|
7
|
-
|
|
8
|
-
import styles from './overlay.module.css'
|
|
9
|
-
|
|
10
|
-
type OverlayIntrinsicProps = React.JSX.IntrinsicElements['div']
|
|
11
|
-
export interface OverlayProps extends OverlayIntrinsicProps {
|
|
12
|
-
isUnmounting?: boolean
|
|
13
|
-
className?: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const BodyLock = (): null => {
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
// a one off mediaMedia here is fine - no need to listen to events
|
|
19
|
-
const mediaMatch = window.matchMedia('(min-width: 768px)')
|
|
20
|
-
let appBar: HTMLElement | null
|
|
21
|
-
const classList = document.body.classList
|
|
22
|
-
appBar = document.getElementById('app-bar')
|
|
23
|
-
classList.add('overlay-shown')
|
|
24
|
-
if (appBar != null) appBar.classList.add('app-bar-overlay-shown')
|
|
25
|
-
if (mediaMatch.matches) {
|
|
26
|
-
classList.add('overlay-shown--desktop')
|
|
27
|
-
if (appBar != null) {
|
|
28
|
-
appBar.classList.add('app-bar-overlay-shown--desktop')
|
|
29
|
-
}
|
|
30
|
-
} else {
|
|
31
|
-
classList.add('overlay-shown--mobile')
|
|
32
|
-
if (appBar != null) {
|
|
33
|
-
appBar.classList.add('app-bar-overlay-shown--mobile')
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return () => {
|
|
37
|
-
classList.remove('overlay-shown')
|
|
38
|
-
if (appBar != null) appBar.classList.remove('app-bar-overlay-shown')
|
|
39
|
-
if (mediaMatch.matches) {
|
|
40
|
-
classList.remove('overlay-shown--desktop')
|
|
41
|
-
if (appBar != null)
|
|
42
|
-
appBar.classList.remove('app-bar-overlay-shown', 'app-bar-overlay-shown--desktop')
|
|
43
|
-
} else {
|
|
44
|
-
classList.remove('overlay-shown--mobile')
|
|
45
|
-
if (appBar != null) appBar.classList.remove('app-bar-overlay-shown--mobile')
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}, [])
|
|
49
|
-
|
|
50
|
-
return null
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function Overlay(props: OverlayProps): React.JSX.Element {
|
|
54
|
-
const { isUnmounting, className, ...rest } = props
|
|
55
|
-
const classes = cx(
|
|
56
|
-
styles.overlay,
|
|
57
|
-
// 'fixed top-0 left-0 w-full h-full backdrop-blur dark:bg-canvas-700/50 bg-canvas-500/50 z-20'
|
|
58
|
-
'animate-fade-in',
|
|
59
|
-
{
|
|
60
|
-
'animate-fade-out': isUnmounting,
|
|
61
|
-
}
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<>
|
|
66
|
-
<BodyLock />
|
|
67
|
-
<div role="presentation" className={cx(classes, className)} {...rest} />
|
|
68
|
-
</>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
/* eslint-disable @typescript-eslint/consistent-type-imports */
|
|
4
|
-
import type React from 'react'
|
|
5
|
-
import { useEffect } from 'react'
|
|
6
|
-
|
|
7
|
-
import cx from 'classnames'
|
|
8
|
-
import type { HTMLMotionProps } from 'motion/react'
|
|
9
|
-
import { m } from 'motion/react'
|
|
10
|
-
|
|
11
|
-
import { useFocusTrap } from '../../hooks/use-focus-trap/index.js'
|
|
12
|
-
import styles from './drawer.module.css'
|
|
13
|
-
|
|
14
|
-
export interface DrawerWrapperProps extends HTMLMotionProps<'div'> {
|
|
15
|
-
className?: string
|
|
16
|
-
children: React.ReactNode
|
|
17
|
-
onEscapeKey?: (e: any) => void
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function DrawerWrapper({
|
|
21
|
-
className,
|
|
22
|
-
children,
|
|
23
|
-
onEscapeKey,
|
|
24
|
-
...rest
|
|
25
|
-
}: DrawerWrapperProps): React.JSX.Element {
|
|
26
|
-
const focusTrapRef = useFocusTrap()
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
30
|
-
if (event.key === 'Escape' && onEscapeKey) {
|
|
31
|
-
onEscapeKey(event)
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
document.addEventListener('keydown', handleKeyDown)
|
|
36
|
-
return () => {
|
|
37
|
-
document.removeEventListener('keydown', handleKeyDown)
|
|
38
|
-
}
|
|
39
|
-
}, [onEscapeKey])
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<m.div
|
|
43
|
-
ref={focusTrapRef}
|
|
44
|
-
{...rest}
|
|
45
|
-
className={cx('infonomic-drawer-wrapper', styles['drawer-wrapper'], className)}
|
|
46
|
-
initial={{ opacity: 0 }}
|
|
47
|
-
animate={{ opacity: 1 }}
|
|
48
|
-
exit={{ opacity: 0 }}
|
|
49
|
-
>
|
|
50
|
-
{children}
|
|
51
|
-
</m.div>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
/* eslint-disable @typescript-eslint/consistent-type-imports */
|
|
4
|
-
import type React from 'react'
|
|
5
|
-
import { useEffect } from 'react'
|
|
6
|
-
|
|
7
|
-
import cx from 'classnames'
|
|
8
|
-
import type { HTMLMotionProps } from 'motion/react'
|
|
9
|
-
import { m } from 'motion/react'
|
|
10
|
-
|
|
11
|
-
import { useFocusTrap } from '../../hooks/use-focus-trap/index.js'
|
|
12
|
-
import styles from './modal.module.css'
|
|
13
|
-
|
|
14
|
-
export interface ModalWrapperProps extends HTMLMotionProps<'div'> {
|
|
15
|
-
children: React.ReactNode
|
|
16
|
-
onEscapeKey?: (e: any) => void
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function ModalWrapper({
|
|
20
|
-
children,
|
|
21
|
-
onEscapeKey,
|
|
22
|
-
...rest
|
|
23
|
-
}: ModalWrapperProps): React.JSX.Element {
|
|
24
|
-
const focusTrapRef = useFocusTrap()
|
|
25
|
-
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
28
|
-
if (event.key === 'Escape' && onEscapeKey) {
|
|
29
|
-
onEscapeKey(event)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
document.addEventListener('keydown', handleKeyDown)
|
|
34
|
-
return () => {
|
|
35
|
-
document.removeEventListener('keydown', handleKeyDown)
|
|
36
|
-
}
|
|
37
|
-
}, [onEscapeKey])
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<m.div
|
|
41
|
-
ref={focusTrapRef}
|
|
42
|
-
{...rest}
|
|
43
|
-
className={cx('infonomic-modal-wrapper', styles['modal-wrapper'])}
|
|
44
|
-
initial={{ opacity: 0 }}
|
|
45
|
-
animate={{ opacity: 1 }}
|
|
46
|
-
exit={{ opacity: 0 }}
|
|
47
|
-
>
|
|
48
|
-
{children}
|
|
49
|
-
</m.div>
|
|
50
|
-
)
|
|
51
|
-
}
|