@heliosgraphics/ui 2.0.0-alpha.96 → 2.0.0-alpha.97
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.
|
@@ -30,23 +30,23 @@ export const Dialog: FC<DialogProps> = ({
|
|
|
30
30
|
useEffect(() => {
|
|
31
31
|
dialogRef?.current?.scrollTo?.(0, 0)
|
|
32
32
|
|
|
33
|
-
if (isOpen)
|
|
34
|
-
triggerRef.current = document.activeElement
|
|
35
|
-
document.documentElement.style.overflow = "hidden"
|
|
33
|
+
if (!isOpen) return
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
triggerRef.current = document.activeElement
|
|
36
|
+
document.documentElement.style.overflow = "hidden"
|
|
37
|
+
|
|
38
|
+
if (!dialogRef.current?.open) {
|
|
39
|
+
dialogRef?.current?.showModal?.()
|
|
40
|
+
}
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
return (): void => {
|
|
43
|
+
document.documentElement.style.overflow = ""
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
triggerRef.current = null
|
|
45
|
+
const trigger = triggerRef.current
|
|
46
|
+
if (trigger && trigger instanceof HTMLElement) {
|
|
47
|
+
trigger.focus()
|
|
49
48
|
}
|
|
49
|
+
triggerRef.current = null
|
|
50
50
|
}
|
|
51
51
|
}, [isOpen])
|
|
52
52
|
|
package/components/Flex/Flex.tsx
CHANGED
|
@@ -7,7 +7,7 @@ export const Flex: FC<FlexProps> = (props) => {
|
|
|
7
7
|
const flexClasses: string = getFlexUtility(restProps)
|
|
8
8
|
const safeProps = getSafeFlexProps(restProps)
|
|
9
9
|
|
|
10
|
-
const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
|
|
10
|
+
const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {
|
|
11
11
|
if (restProps.onClick && (event.key === "Enter" || event.key === " ")) {
|
|
12
12
|
event.preventDefault()
|
|
13
13
|
restProps.onClick(event as unknown as React.MouseEvent<HTMLDivElement>)
|
|
@@ -20,8 +20,8 @@ export const useResizeObserver = (): readonly [(element: HTMLDivElement | null)
|
|
|
20
20
|
if (element) {
|
|
21
21
|
resizeObserverRef.current = new ResizeObserver((entries) => {
|
|
22
22
|
if (entries[0]) {
|
|
23
|
-
const
|
|
24
|
-
setWidth(
|
|
23
|
+
const entryWidth = entries[0].contentRect.width
|
|
24
|
+
setWidth(entryWidth)
|
|
25
25
|
}
|
|
26
26
|
})
|
|
27
27
|
|