@rango-dev/ui 0.15.1-next.10 → 0.15.1-next.11
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/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/widget/ui/src/components/Modal/Modal.d.ts.map +1 -1
- package/dist/widget/ui/src/hooks/index.d.ts +0 -1
- package/dist/widget/ui/src/hooks/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Modal/Modal.tsx +1 -9
- package/src/hooks/index.ts +0 -1
- package/dist/widget/ui/src/hooks/usePaddingRight.d.ts +0 -8
- package/dist/widget/ui/src/hooks/usePaddingRight.d.ts.map +0 -1
- package/src/hooks/usePaddingRight.ts +0 -41
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAsC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAsC,MAAM,OAAO,CAAC;AAqB3D,wBAAgB,KAAK,CAAC,KAAK,EAAE,iBAAiB,CAAC,SAAS,CAAC,qBAoGxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -4,9 +4,7 @@ import type { PropsWithChildren } from 'react';
|
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
6
6
|
|
|
7
|
-
import { usePaddingRight } from '../../hooks';
|
|
8
7
|
import { CloseIcon } from '../../icons';
|
|
9
|
-
import { theme } from '../../theme';
|
|
10
8
|
import { BottomLogo } from '../BottomLogo';
|
|
11
9
|
import { Divider } from '../Divider';
|
|
12
10
|
import { IconButton } from '../IconButton/IconButton';
|
|
@@ -23,7 +21,6 @@ import {
|
|
|
23
21
|
|
|
24
22
|
const CLOSED_DELAY = 600;
|
|
25
23
|
const OPEN_DELAY = 10;
|
|
26
|
-
const DEFAULT_CONTENT_PADDING = 20;
|
|
27
24
|
|
|
28
25
|
export function Modal(props: PropsWithChildren<PropTypes>) {
|
|
29
26
|
const {
|
|
@@ -44,11 +41,6 @@ export function Modal(props: PropsWithChildren<PropTypes>) {
|
|
|
44
41
|
const [active, setActive] = useState(false);
|
|
45
42
|
const [isMount, setIsMount] = useState(false);
|
|
46
43
|
const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
47
|
-
const contentRef = useRef<HTMLDivElement | null>(null);
|
|
48
|
-
usePaddingRight({
|
|
49
|
-
elementRef: contentRef,
|
|
50
|
-
paddingRight: theme.sizes[DEFAULT_CONTENT_PADDING],
|
|
51
|
-
});
|
|
52
44
|
|
|
53
45
|
const handleBackDropClick = (event: React.MouseEvent<HTMLDivElement>) => {
|
|
54
46
|
if (event.target === event.currentTarget && dismissible) {
|
|
@@ -112,7 +104,7 @@ export function Modal(props: PropsWithChildren<PropTypes>) {
|
|
|
112
104
|
</Flex>
|
|
113
105
|
</ModalHeader>
|
|
114
106
|
)}
|
|
115
|
-
<Content
|
|
107
|
+
<Content>{children}</Content>
|
|
116
108
|
{(hasLogo || footer) && (
|
|
117
109
|
<Footer>
|
|
118
110
|
<div className="footer__content">{footer}</div>
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { MutableRefObject } from 'react';
|
|
2
|
-
type Params = {
|
|
3
|
-
elementRef: MutableRefObject<HTMLElement | null>;
|
|
4
|
-
paddingRight: string;
|
|
5
|
-
};
|
|
6
|
-
export declare function usePaddingRight(params: Params): void;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=usePaddingRight.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePaddingRight.d.ts","sourceRoot":"","sources":["../../../../../src/hooks/usePaddingRight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAI9C,KAAK,MAAM,GAAG;IACZ,UAAU,EAAE,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACjD,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAMF,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,QA2B7C"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { MutableRefObject } from 'react';
|
|
2
|
-
|
|
3
|
-
import { useLayoutEffect } from 'react';
|
|
4
|
-
|
|
5
|
-
type Params = {
|
|
6
|
-
elementRef: MutableRefObject<HTMLElement | null>;
|
|
7
|
-
paddingRight: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
/*
|
|
11
|
-
* This hook employs ResizeObserver to prevent layout shift when the content of the layout overflows.
|
|
12
|
-
* By implementing this solution, we ensure that there is a constant padding on the right side of the content, regardless of whether or not a scrollbar is present.
|
|
13
|
-
*/
|
|
14
|
-
export function usePaddingRight(params: Params) {
|
|
15
|
-
const { elementRef, paddingRight } = params;
|
|
16
|
-
useLayoutEffect(() => {
|
|
17
|
-
let resizeObserver: ResizeObserver | null = null;
|
|
18
|
-
if (elementRef.current) {
|
|
19
|
-
resizeObserver = new ResizeObserver(() => {
|
|
20
|
-
if (elementRef.current) {
|
|
21
|
-
const scrollable =
|
|
22
|
-
elementRef.current.scrollHeight > elementRef.current.clientHeight;
|
|
23
|
-
if (scrollable) {
|
|
24
|
-
elementRef.current.style.paddingRight = `${
|
|
25
|
-
parseInt(paddingRight) -
|
|
26
|
-
(elementRef.current.offsetWidth - elementRef.current.clientWidth)
|
|
27
|
-
}px`;
|
|
28
|
-
} else {
|
|
29
|
-
elementRef.current.style.paddingRight = paddingRight;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
resizeObserver.observe(elementRef.current);
|
|
34
|
-
}
|
|
35
|
-
return () => {
|
|
36
|
-
if (elementRef.current) {
|
|
37
|
-
resizeObserver?.unobserve(elementRef.current);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}, [elementRef.current]);
|
|
41
|
-
}
|