@fremtind/jkl-core
Advanced tools
Comparing version 14.8.1 to 14.8.2
@@ -37,3 +37,9 @@ "use strict"; | ||
const Link = import_react.default.forwardRef(function Link2(props, ref) { | ||
const { external = false, className = "", children, as = "a", ...rest } = props; | ||
const { | ||
external = false, | ||
className = "", | ||
children, | ||
as = "a", | ||
...rest | ||
} = props; | ||
const Component = as; | ||
@@ -40,0 +46,0 @@ return /* @__PURE__ */ import_react.default.createElement( |
@@ -37,3 +37,10 @@ "use strict"; | ||
const NavLink = import_react.default.forwardRef(function NavLink2(props, ref) { | ||
const { active = false, back = false, className, children, as = "a", ...rest } = props; | ||
const { | ||
active = false, | ||
back = false, | ||
className, | ||
children, | ||
as = "a", | ||
...rest | ||
} = props; | ||
const Component = as; | ||
@@ -40,0 +47,0 @@ return /* @__PURE__ */ import_react.default.createElement( |
@@ -36,4 +36,15 @@ "use strict"; | ||
var import_react = __toESM(require("react")); | ||
const ScreenReaderOnly = ({ children, showOnFocus, ...rest }) => /* @__PURE__ */ import_react.default.createElement("span", { ...rest, className: "jkl-sr-only".concat(showOnFocus ? " jkl-sr-only--focusable" : "") }, children); | ||
const ScreenReaderOnly = ({ | ||
children, | ||
showOnFocus, | ||
...rest | ||
}) => /* @__PURE__ */ import_react.default.createElement( | ||
"span", | ||
{ | ||
...rest, | ||
className: "jkl-sr-only".concat(showOnFocus ? " jkl-sr-only--focusable" : "") | ||
}, | ||
children | ||
); | ||
var ScreenReaderOnly_default = ScreenReaderOnly; | ||
//# sourceMappingURL=ScreenReaderOnly.js.map |
@@ -36,14 +36,18 @@ "use strict"; | ||
var import_utils = require("../utils"); | ||
const SlotComponent = import_react.default.forwardRef(function SlotComponent2({ children, ...slotProps }, forwardedRef) { | ||
if (import_react.default.isValidElement(children)) { | ||
return import_react.default.cloneElement(children, { | ||
...(0, import_utils.mergeProps)(slotProps, children.props), | ||
ref: (0, import_utils.mergeRefs)(forwardedRef, children.ref) | ||
}); | ||
const SlotComponent = import_react.default.forwardRef( | ||
function SlotComponent2({ children, ...slotProps }, forwardedRef) { | ||
if (import_react.default.isValidElement(children)) { | ||
return import_react.default.cloneElement(children, { | ||
...(0, import_utils.mergeProps)(slotProps, children.props), | ||
ref: (0, import_utils.mergeRefs)(forwardedRef, children.ref) | ||
}); | ||
} | ||
if (import_react.default.Children.count(children) > 1) { | ||
throw new Error( | ||
"Du kan kun bruke ett enkelt React-element som children i en komponent med asChild" | ||
); | ||
} | ||
return null; | ||
} | ||
if (import_react.default.Children.count(children) > 1) { | ||
throw new Error("Du kan kun bruke ett enkelt React-element som children i en komponent med asChild"); | ||
} | ||
return null; | ||
}); | ||
); | ||
//# sourceMappingURL=SlotComponent.js.map |
@@ -28,3 +28,6 @@ "use strict"; | ||
const computedStyles = getComputedStyle(element); | ||
const theme = parseInt(computedStyles.getPropertyValue("--jkl-background-color").replace("#", ""), 16) < 16777215 / 2 ? "dark" : "light"; | ||
const theme = parseInt( | ||
computedStyles.getPropertyValue("--jkl-background-color").replace("#", ""), | ||
16 | ||
) < 16777215 / 2 ? "dark" : "light"; | ||
const density = computedStyles.getPropertyValue("--jkl-density") === '"compact"' ? "compact" : "comfortable"; | ||
@@ -31,0 +34,0 @@ return { theme, density }; |
@@ -33,5 +33,7 @@ "use strict"; | ||
function removeAllListeners() { | ||
Object.keys(listeners).forEach((listenerType) => { | ||
document.removeEventListener(listenerType, listeners[listenerType]); | ||
}); | ||
Object.keys(listeners).forEach( | ||
(listenerType) => { | ||
document.removeEventListener(listenerType, listeners[listenerType]); | ||
} | ||
); | ||
} | ||
@@ -38,0 +40,0 @@ function addListener(listenerType) { |
import cn from "classnames"; | ||
import React from "react"; | ||
const Link = React.forwardRef(function Link2(props, ref) { | ||
const { external = false, className = "", children, as = "a", ...rest } = props; | ||
const { | ||
external = false, | ||
className = "", | ||
children, | ||
as = "a", | ||
...rest | ||
} = props; | ||
const Component = as; | ||
@@ -6,0 +12,0 @@ return /* @__PURE__ */ React.createElement( |
import cn from "classnames"; | ||
import React from "react"; | ||
const NavLink = React.forwardRef(function NavLink2(props, ref) { | ||
const { active = false, back = false, className, children, as = "a", ...rest } = props; | ||
const { | ||
active = false, | ||
back = false, | ||
className, | ||
children, | ||
as = "a", | ||
...rest | ||
} = props; | ||
const Component = as; | ||
@@ -6,0 +13,0 @@ return /* @__PURE__ */ React.createElement( |
import React from "react"; | ||
const ScreenReaderOnly = ({ children, showOnFocus, ...rest }) => /* @__PURE__ */ React.createElement("span", { ...rest, className: "jkl-sr-only".concat(showOnFocus ? " jkl-sr-only--focusable" : "") }, children); | ||
const ScreenReaderOnly = ({ | ||
children, | ||
showOnFocus, | ||
...rest | ||
}) => /* @__PURE__ */ React.createElement( | ||
"span", | ||
{ | ||
...rest, | ||
className: "jkl-sr-only".concat(showOnFocus ? " jkl-sr-only--focusable" : "") | ||
}, | ||
children | ||
); | ||
var ScreenReaderOnly_default = ScreenReaderOnly; | ||
@@ -4,0 +15,0 @@ export { |
import React from "react"; | ||
import { mergeRefs, mergeProps } from "../utils"; | ||
const SlotComponent = React.forwardRef(function SlotComponent2({ children, ...slotProps }, forwardedRef) { | ||
if (React.isValidElement(children)) { | ||
return React.cloneElement(children, { | ||
...mergeProps(slotProps, children.props), | ||
ref: mergeRefs(forwardedRef, children.ref) | ||
}); | ||
const SlotComponent = React.forwardRef( | ||
function SlotComponent2({ children, ...slotProps }, forwardedRef) { | ||
if (React.isValidElement(children)) { | ||
return React.cloneElement(children, { | ||
...mergeProps(slotProps, children.props), | ||
ref: mergeRefs(forwardedRef, children.ref) | ||
}); | ||
} | ||
if (React.Children.count(children) > 1) { | ||
throw new Error( | ||
"Du kan kun bruke ett enkelt React-element som children i en komponent med asChild" | ||
); | ||
} | ||
return null; | ||
} | ||
if (React.Children.count(children) > 1) { | ||
throw new Error("Du kan kun bruke ett enkelt React-element som children i en komponent med asChild"); | ||
} | ||
return null; | ||
}); | ||
); | ||
export { | ||
@@ -16,0 +20,0 @@ SlotComponent |
@@ -5,3 +5,6 @@ const getThemeAndDensity = (element) => { | ||
const computedStyles = getComputedStyle(element); | ||
const theme = parseInt(computedStyles.getPropertyValue("--jkl-background-color").replace("#", ""), 16) < 16777215 / 2 ? "dark" : "light"; | ||
const theme = parseInt( | ||
computedStyles.getPropertyValue("--jkl-background-color").replace("#", ""), | ||
16 | ||
) < 16777215 / 2 ? "dark" : "light"; | ||
const density = computedStyles.getPropertyValue("--jkl-density") === '"compact"' ? "compact" : "comfortable"; | ||
@@ -8,0 +11,0 @@ return { theme, density }; |
@@ -10,5 +10,7 @@ let mousenavigation = false; | ||
function removeAllListeners() { | ||
Object.keys(listeners).forEach((listenerType) => { | ||
document.removeEventListener(listenerType, listeners[listenerType]); | ||
}); | ||
Object.keys(listeners).forEach( | ||
(listenerType) => { | ||
document.removeEventListener(listenerType, listeners[listenerType]); | ||
} | ||
); | ||
} | ||
@@ -15,0 +17,0 @@ function addListener(listenerType) { |
export type { Easing, Timing } from "./utils"; | ||
export { initTabListener, getValuePair, breakpoints, timings, easings, mergeRefs, mergeProps, getThemeAndDensity, } from "./utils"; | ||
export type { Density, PossibleRef } from "./utils"; | ||
export type { LinkProps, NavLinkProps, ScreenReaderOnlyProps } from "./components"; | ||
export type { LinkProps, NavLinkProps, ScreenReaderOnlyProps, } from "./components"; | ||
export { Link, NavLink, ScreenReaderOnly, SlotComponent } from "./components"; | ||
export type { ColorScheme, DataTestAutoId, ValuePair, WithChildren, WithOptionalChildren } from "./types"; | ||
export type { ColorScheme, DataTestAutoId, ValuePair, WithChildren, WithOptionalChildren, } from "./types"; | ||
export { default as tokens } from "./tokens"; | ||
export type { PolymorphicProps, PolymorphicPropsWithRef, PolymorphicRef } from "./polymorphism"; | ||
export type { PolymorphicProps, PolymorphicPropsWithRef, PolymorphicRef, } from "./polymorphism"; | ||
export type { AsChildProps } from "./as-child"; |
{ | ||
"name": "@fremtind/jkl-core", | ||
"version": "14.8.1", | ||
"version": "14.8.2", | ||
"publishConfig": { | ||
@@ -62,3 +62,3 @@ "access": "public" | ||
}, | ||
"gitHead": "9c4193c00f51b351ca7c65f951c78adf682c2c15" | ||
"gitHead": "82508b6f72780226367f81cd8a6a2f5417484c9a" | ||
} |
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
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
367185
5893