@fremtind/jkl-react-hooks
Advanced tools
Comparing version 11.0.2 to 11.1.0
@@ -28,2 +28,3 @@ "use strict"; | ||
var import_usePreviousValue = require("./usePreviousValue/usePreviousValue"); | ||
const defaultDisplay = "block"; | ||
const defaultEasing = "standard"; | ||
@@ -35,2 +36,3 @@ const defaultTiming = "productive"; | ||
const timing = (options == null ? void 0 : options.timing) || defaultTiming; | ||
const display = (options == null ? void 0 : options.display) || defaultDisplay; | ||
const transition = `${import_jkl_core.timings[timing]} height ${import_jkl_core.easings[easing]}`; | ||
@@ -78,3 +80,3 @@ const { prefersReducedMotion } = (0, import_useBrowserPreferences.useBrowserPreferences)(); | ||
element.style.transition = transition; | ||
element.style.display = "block"; | ||
element.style.display = display; | ||
element.style.overflow = "hidden"; | ||
@@ -97,3 +99,3 @@ if (isOpen) { | ||
} | ||
}, [isOpen, options, wasOpen, transition, prefersReducedMotion]); | ||
}, [isOpen, options, wasOpen, transition, prefersReducedMotion, display]); | ||
(0, import_react.useEffect)(() => { | ||
@@ -100,0 +102,0 @@ runAnimation(); |
@@ -5,2 +5,3 @@ import { easings, timings } from "@fremtind/jkl-core"; | ||
import { usePreviousValue } from "./usePreviousValue/usePreviousValue"; | ||
const defaultDisplay = "block"; | ||
const defaultEasing = "standard"; | ||
@@ -12,2 +13,3 @@ const defaultTiming = "productive"; | ||
const timing = (options == null ? void 0 : options.timing) || defaultTiming; | ||
const display = (options == null ? void 0 : options.display) || defaultDisplay; | ||
const transition = `${timings[timing]} height ${easings[easing]}`; | ||
@@ -55,3 +57,3 @@ const { prefersReducedMotion } = useBrowserPreferences(); | ||
element.style.transition = transition; | ||
element.style.display = "block"; | ||
element.style.display = display; | ||
element.style.overflow = "hidden"; | ||
@@ -74,3 +76,3 @@ if (isOpen) { | ||
} | ||
}, [isOpen, options, wasOpen, transition, prefersReducedMotion]); | ||
}, [isOpen, options, wasOpen, transition, prefersReducedMotion, display]); | ||
useEffect(() => { | ||
@@ -77,0 +79,0 @@ runAnimation(); |
import type { Easing, Timing } from "@fremtind/jkl-core"; | ||
import { RefObject } from "react"; | ||
export interface UseAnimatedHeightOptions<T extends HTMLElement = HTMLElement> { | ||
display?: "block" | "grid" | "flex"; | ||
/** | ||
@@ -5,0 +6,0 @@ * Overstyr standard easingfunksjon |
{ | ||
"name": "@fremtind/jkl-react-hooks", | ||
"version": "11.0.2", | ||
"version": "11.1.0", | ||
"publishConfig": { | ||
@@ -57,3 +57,3 @@ "access": "public" | ||
}, | ||
"gitHead": "3def7a7685c9da4e0dfddf181b1e021ab1eb87da" | ||
"gitHead": "e374435aa84c77d27fef476ecf649d973963c2a3" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
156006
1751