Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@fremtind/jkl-react-hooks

Package Overview
Dependencies
Maintainers
3
Versions
209
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fremtind/jkl-react-hooks - npm Package Compare versions

Comparing version 9.0.4 to 9.1.0

1

build/cjs/index.js

@@ -0,1 +1,2 @@

"use strict";
var __defProp = Object.defineProperty;

@@ -2,0 +3,0 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;

@@ -0,1 +1,2 @@

"use strict";
var __defProp = Object.defineProperty;

@@ -2,0 +3,0 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;

11

build/cjs/useAnimatedHeight.js

@@ -0,1 +1,2 @@

"use strict";
var __defProp = Object.defineProperty;

@@ -48,3 +49,3 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;

}
(_a = options == null ? void 0 : options.onTransitionEnd) == null ? void 0 : _a.call(options, isOpen);
(_a = options == null ? void 0 : options.onTransitionEnd) == null ? void 0 : _a.call(options, isOpen, elementRef);
}

@@ -66,9 +67,9 @@ }

}
(_a = options == null ? void 0 : options.onTransitionStart) == null ? void 0 : _a.call(options, isOpen);
(_a = options == null ? void 0 : options.onTransitionStart) == null ? void 0 : _a.call(options, isOpen, elementRef);
if (prefersReducedMotion) {
element.removeAttribute("style");
if (isOpen) {
(_b = options == null ? void 0 : options.onFirstVisible) == null ? void 0 : _b.call(options);
(_b = options == null ? void 0 : options.onFirstVisible) == null ? void 0 : _b.call(options, isOpen, elementRef);
}
(_c = options == null ? void 0 : options.onTransitionEnd) == null ? void 0 : _c.call(options, isOpen);
(_c = options == null ? void 0 : options.onTransitionEnd) == null ? void 0 : _c.call(options, isOpen, elementRef);
return;

@@ -80,3 +81,3 @@ }

if (isOpen) {
(_d = options == null ? void 0 : options.onFirstVisible) == null ? void 0 : _d.call(options);
(_d = options == null ? void 0 : options.onFirstVisible) == null ? void 0 : _d.call(options, isOpen, elementRef);
element.style.height = "0";

@@ -83,0 +84,0 @@ element.style.height = `${element.scrollHeight}px`;

@@ -0,22 +1,6 @@

"use strict";
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __export = (target, all) => {

@@ -59,13 +43,16 @@ for (var name in all)

case "COLOR_SCHEME_CHANGED" /* PrefersColorScheme */:
return __spreadProps(__spreadValues({}, state), {
return {
...state,
prefersColorScheme: action.value
});
};
case "REDUCED_MOTION_CHANGED" /* PrefersReducedMotion */:
return __spreadProps(__spreadValues({}, state), {
return {
...state,
prefersReducedMotion: action.value
});
};
case "FORCED_COLORS_CHANGED" /* ForcedColors */:
return __spreadProps(__spreadValues({}, state), {
return {
...state,
forcedColors: action.value
});
};
default:

@@ -109,4 +96,4 @@ return state;

}, [hasMounted]);
return __spreadValues({}, state);
return { ...state };
};
//# sourceMappingURL=useBrowserPreferences.js.map

@@ -0,1 +1,2 @@

"use strict";
var __defProp = Object.defineProperty;

@@ -2,0 +3,0 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;

@@ -0,1 +1,2 @@

"use strict";
var __defProp = Object.defineProperty;

@@ -2,0 +3,0 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;

@@ -0,1 +1,2 @@

"use strict";
var __defProp = Object.defineProperty;

@@ -2,0 +3,0 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;

@@ -0,1 +1,2 @@

"use strict";
var __create = Object.create;

@@ -2,0 +3,0 @@ var __defProp = Object.defineProperty;

@@ -0,1 +1,2 @@

"use strict";
var __defProp = Object.defineProperty;

@@ -2,0 +3,0 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;

@@ -0,1 +1,2 @@

"use strict";
var __defProp = Object.defineProperty;

@@ -2,0 +3,0 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;

@@ -0,1 +1,2 @@

"use strict";
var __defProp = Object.defineProperty;

@@ -2,0 +3,0 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;

@@ -0,1 +1,2 @@

"use strict";
var __defProp = Object.defineProperty;

@@ -2,0 +3,0 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;

@@ -0,1 +1,2 @@

"use strict";
var __defProp = Object.defineProperty;

@@ -2,0 +3,0 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;

@@ -0,19 +1,6 @@

"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __export = (target, all) => {

@@ -60,5 +47,11 @@ for (var name in all)

case "ORIENTATION_CHANGED" /* orientation */:
return __spreadValues(__spreadValues({}, state), setOrientation(action.property));
return {
...state,
...setOrientation(action.property)
};
case "DEVICE_SIZE_CHANGED" /* deviceSize */:
return __spreadValues(__spreadValues({}, state), setDeviceSize(action.property));
return {
...state,
...setDeviceSize(action.property)
};
default:

@@ -65,0 +58,0 @@ return state;

@@ -0,19 +1,6 @@

"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __export = (target, all) => {

@@ -93,4 +80,4 @@ for (var name in all)

}, [createListener, hasMounted]);
return __spreadValues({}, device);
return { ...device };
};
//# sourceMappingURL=useScreen.js.map

@@ -0,1 +1,2 @@

"use strict";
var __defProp = Object.defineProperty;

@@ -2,0 +3,0 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;

@@ -26,3 +26,3 @@ import { easings, timings } from "@fremtind/jkl-core";

}
(_a = options == null ? void 0 : options.onTransitionEnd) == null ? void 0 : _a.call(options, isOpen);
(_a = options == null ? void 0 : options.onTransitionEnd) == null ? void 0 : _a.call(options, isOpen, elementRef);
}

@@ -44,9 +44,9 @@ }

}
(_a = options == null ? void 0 : options.onTransitionStart) == null ? void 0 : _a.call(options, isOpen);
(_a = options == null ? void 0 : options.onTransitionStart) == null ? void 0 : _a.call(options, isOpen, elementRef);
if (prefersReducedMotion) {
element.removeAttribute("style");
if (isOpen) {
(_b = options == null ? void 0 : options.onFirstVisible) == null ? void 0 : _b.call(options);
(_b = options == null ? void 0 : options.onFirstVisible) == null ? void 0 : _b.call(options, isOpen, elementRef);
}
(_c = options == null ? void 0 : options.onTransitionEnd) == null ? void 0 : _c.call(options, isOpen);
(_c = options == null ? void 0 : options.onTransitionEnd) == null ? void 0 : _c.call(options, isOpen, elementRef);
return;

@@ -58,3 +58,3 @@ }

if (isOpen) {
(_d = options == null ? void 0 : options.onFirstVisible) == null ? void 0 : _d.call(options);
(_d = options == null ? void 0 : options.onFirstVisible) == null ? void 0 : _d.call(options, isOpen, elementRef);
element.style.height = "0";

@@ -61,0 +61,0 @@ element.style.height = `${element.scrollHeight}px`;

@@ -1,20 +0,1 @@

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
import { useEffect, useReducer, useState } from "react";

@@ -39,13 +20,16 @@ import { addMediaQueryListener, getInitialMediaQueryMatch, removeMediaQueryListener } from "../mediaQueryUtils";

case "COLOR_SCHEME_CHANGED" /* PrefersColorScheme */:
return __spreadProps(__spreadValues({}, state), {
return {
...state,
prefersColorScheme: action.value
});
};
case "REDUCED_MOTION_CHANGED" /* PrefersReducedMotion */:
return __spreadProps(__spreadValues({}, state), {
return {
...state,
prefersReducedMotion: action.value
});
};
case "FORCED_COLORS_CHANGED" /* ForcedColors */:
return __spreadProps(__spreadValues({}, state), {
return {
...state,
forcedColors: action.value
});
};
default:

@@ -89,3 +73,3 @@ return state;

}, [hasMounted]);
return __spreadValues({}, state);
return { ...state };
};

@@ -92,0 +76,0 @@ export {

@@ -1,17 +0,1 @@

var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var ActionType = /* @__PURE__ */ ((ActionType2) => {

@@ -39,5 +23,11 @@ ActionType2["orientation"] = "ORIENTATION_CHANGED";

case "ORIENTATION_CHANGED" /* orientation */:
return __spreadValues(__spreadValues({}, state), setOrientation(action.property));
return {
...state,
...setOrientation(action.property)
};
case "DEVICE_SIZE_CHANGED" /* deviceSize */:
return __spreadValues(__spreadValues({}, state), setDeviceSize(action.property));
return {
...state,
...setDeviceSize(action.property)
};
default:

@@ -44,0 +34,0 @@ return state;

@@ -1,17 +0,1 @@

var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
import { breakpoints } from "@fremtind/jkl-core";

@@ -73,3 +57,3 @@ import { useCallback, useEffect, useReducer, useState } from "react";

}, [createListener, hasMounted]);
return __spreadValues({}, device);
return { ...device };
};

@@ -76,0 +60,0 @@ export {

import type { Easing, Timing } from "@fremtind/jkl-core";
import { RefObject } from "react";
export interface UseAnimatedHeightOptions {
export interface UseAnimatedHeightOptions<T extends HTMLElement = HTMLElement> {
/**

@@ -14,3 +14,3 @@ * Overstyr standard easingfunksjon

timing?: Timing;
onTransitionStart?: (isOpening: boolean) => void;
onTransitionStart?: (isOpening: boolean, ref: RefObject<T>) => void;
/**

@@ -21,6 +21,8 @@ * Kalles rett etter at elementet har fått display: block; i stedet for hidden;

* forstand at det _ikke_ er display: hidden;
*
* `isOpen` er alltid `true`. Det sendes som første parameter for å ha lik funksjonssignatur som `onTransitionEnd`.
*/
onFirstVisible?: () => void;
onTransitionEnd?: (isOpen: boolean) => void;
onFirstVisible?: (isOpen: boolean, ref: RefObject<T>) => void;
onTransitionEnd?: (isOpen: boolean, ref: RefObject<T>) => void;
}
export declare function useAnimatedHeight<T extends HTMLElement>(isOpen: boolean, options?: UseAnimatedHeightOptions): [RefObject<T>, () => void];
export declare function useAnimatedHeight<T extends HTMLElement>(isOpen: boolean, options?: UseAnimatedHeightOptions<T>): [RefObject<T>, () => void];
{
"name": "@fremtind/jkl-react-hooks",
"version": "9.0.4",
"version": "9.1.0",
"publishConfig": {

@@ -42,3 +42,3 @@ "access": "public"

"dependencies": {
"@fremtind/jkl-core": "^10.0.3",
"@fremtind/jkl-core": "^10.0.4",
"nanoid": "^3.3.2"

@@ -59,3 +59,3 @@ },

},
"gitHead": "41c541ee1ca9b890f50d931d7541d69e1ccd61ac"
"gitHead": "c93fc3afd8a4debb77e2a8e4a0f6fd5c92a5bc7b"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc