@fremtind/jkl-core
Advanced tools
Comparing version 4.3.1 to 4.4.0
@@ -55,2 +55,196 @@ import React from 'react'; | ||
export { ScreenReaderOnly, breakpoints, getValuePair, initTabListener }; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
return target; | ||
} | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _objectWithoutPropertiesLoose(source, excluded); | ||
var key, i; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
key = sourceSymbolKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | ||
target[key] = source[key]; | ||
} | ||
} | ||
return target; | ||
} | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
var classnames = createCommonjsModule(function (module) { | ||
/*! | ||
Copyright (c) 2017 Jed Watson. | ||
Licensed under the MIT License (MIT), see | ||
http://jedwatson.github.io/classnames | ||
*/ | ||
/* global define */ | ||
(function () { | ||
var hasOwn = {}.hasOwnProperty; | ||
function classNames () { | ||
var classes = []; | ||
for (var i = 0; i < arguments.length; i++) { | ||
var arg = arguments[i]; | ||
if (!arg) continue; | ||
var argType = typeof arg; | ||
if (argType === 'string' || argType === 'number') { | ||
classes.push(arg); | ||
} else if (Array.isArray(arg) && arg.length) { | ||
var inner = classNames.apply(null, arg); | ||
if (inner) { | ||
classes.push(inner); | ||
} | ||
} else if (argType === 'object') { | ||
for (var key in arg) { | ||
if (hasOwn.call(arg, key) && arg[key]) { | ||
classes.push(key); | ||
} | ||
} | ||
} | ||
} | ||
return classes.join(' '); | ||
} | ||
if ( module.exports) { | ||
classNames.default = classNames; | ||
module.exports = classNames; | ||
} else { | ||
window.classNames = classNames; | ||
} | ||
}()); | ||
}); | ||
var classnames_1 = classnames.named; | ||
var Label = function Label(_ref) { | ||
var _classNames; | ||
var _ref$variant = _ref.variant, | ||
variant = _ref$variant === void 0 ? "medium" : _ref$variant, | ||
forceCompact = _ref.forceCompact, | ||
srOnly = _ref.srOnly, | ||
children = _ref.children, | ||
standAlone = _ref.standAlone, | ||
htmlFor = _ref.htmlFor; | ||
var className = classnames("jkl-label", (_classNames = {}, _defineProperty(_classNames, "jkl-label--".concat(variant), variant), _defineProperty(_classNames, "jkl-label--compact", forceCompact), _defineProperty(_classNames, "jkl-label--sr-only", srOnly), _classNames)); | ||
var C = standAlone ? "label" : "span"; | ||
if (!standAlone && htmlFor) { | ||
htmlFor = undefined; | ||
if (process.env.NODE_ENV !== "production") { | ||
console.warn("WARNING: The standard Label component renders as a <span> element, which does not take a htmlFor prop. If you want the Label to belong to a specific input, use the standAlone prop, which renders as a <label> element instead. In most cases the Label component should not be used directly, as it is part of all our input components."); | ||
} | ||
} | ||
return /*#__PURE__*/React.createElement(C, { | ||
className: className, | ||
htmlFor: htmlFor | ||
}, children); | ||
}; | ||
var Link = function Link(_ref) { | ||
var _ref$negative = _ref.negative, | ||
negative = _ref$negative === void 0 ? false : _ref$negative, | ||
_ref$external = _ref.external, | ||
external = _ref$external === void 0 ? false : _ref$external, | ||
_ref$className = _ref.className, | ||
className = _ref$className === void 0 ? "" : _ref$className, | ||
children = _ref.children, | ||
rest = _objectWithoutProperties(_ref, ["negative", "external", "className", "children"]); | ||
return /*#__PURE__*/React.createElement("a", _extends({ | ||
className: classnames("jkl-link", className, { | ||
"jkl-link--negative": negative, | ||
"jkl-link--external": external | ||
}) | ||
}, rest), children); | ||
}; | ||
var SupportLabel = function SupportLabel(_ref) { | ||
var id = _ref.id, | ||
helpLabel = _ref.helpLabel, | ||
errorLabel = _ref.errorLabel, | ||
forceCompact = _ref.forceCompact, | ||
className = _ref.className, | ||
srOnly = _ref.srOnly, | ||
inverted = _ref.inverted; | ||
var componentClassName = classnames("jkl-form-support-label", className, { | ||
"jkl-form-support-label--compact": forceCompact, | ||
"jkl-form-support-label--error": errorLabel, | ||
"jkl-form-support-label--help": !errorLabel, | ||
"jkl-form-support-label--sr-only": srOnly, | ||
"jkl-form-support-label--inverted": inverted | ||
}); | ||
if (errorLabel || helpLabel) { | ||
return /*#__PURE__*/React.createElement("span", { | ||
id: id, | ||
className: componentClassName | ||
}, errorLabel || helpLabel); | ||
} | ||
return null; | ||
}; | ||
export { Label, Link, ScreenReaderOnly, SupportLabel, breakpoints, getValuePair, initTabListener }; |
@@ -1,1 +0,7 @@ | ||
import e from"react";var t=!1;function n(){if(!t){t=!0;var e=document.querySelector("html");e&&e.setAttribute("data-mousenavigation","true"),document.removeEventListener("mousedown",n),document.addEventListener("keydown",o)}}function o(e){if("Tab"===e.key&&t){t=!1;var r=document.querySelector("html");r&&r.removeAttribute("data-mousenavigation"),document.removeEventListener("keydown",o),document.addEventListener("mousedown",n)}}function r(){"undefined"!=typeof document&&document.addEventListener("mousedown",n)}function u(e){return"string"==typeof e?{value:e,label:e}:e}var a={small:768,medium:992,large:1200,xl:1600},d=function(t){var n=t.children,o=t.showOnFocus;return(e.createElement("span",{className:"jkl-sr-only ".concat(o?"jkl-sr-only--focusable":"")},n))};export{d as ScreenReaderOnly,a as breakpoints,u as getValuePair,r as initTabListener}; | ||
import e from"react";var n=!1;function t(){if(!n){n=!0;var e=document.querySelector("html");e&&e.setAttribute("data-mousenavigation","true"),document.removeEventListener("mousedown",t),document.addEventListener("keydown",r)}}function r(e){if("Tab"===e.key&&n){n=!1;var o=document.querySelector("html");o&&o.removeAttribute("data-mousenavigation"),document.removeEventListener("keydown",r),document.addEventListener("mousedown",t)}}function o(){"undefined"!=typeof document&&document.addEventListener("mousedown",t)}function a(e){return"string"==typeof e?{value:e,label:e}:e}var l={small:768,medium:992,large:1200,xl:1600},s=function(n){var t=n.children,r=n.showOnFocus;return(e.createElement("span",{className:"jkl-sr-only ".concat(r?"jkl-sr-only--focusable":"")},t))};function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function c(){return(c=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function u(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=function(e,n){return e(n={exports:{}},n.exports),n.exports}((function(e){ | ||
/*! | ||
Copyright (c) 2017 Jed Watson. | ||
Licensed under the MIT License (MIT), see | ||
http://jedwatson.github.io/classnames | ||
*/ | ||
!function(){var n={}.hasOwnProperty;function t(){for(var e=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var a=typeof o;if("string"===a||"number"===a)e.push(o);else if(Array.isArray(o)&&o.length){var l=t.apply(null,o);l&&e.push(l)}else if("object"===a)for(var s in o)n.call(o,s)&&o[s]&&e.push(s)}}return e.join(" ")}e.exports?(t.default=t,e.exports=t):window.classNames=t}()})),m=(p.named,function(n){var t,r=n.variant,o=void 0===r?"medium":r,a=n.forceCompact,l=n.srOnly,s=n.children,c=n.standAlone,u=n.htmlFor,m=p("jkl-label",(i(t={},"jkl-label--".concat(o),o),i(t,"jkl-label--compact",a),i(t,"jkl-label--sr-only",l),t)),d=c?"label":"span";return!c&&u&&(u=void 0,"production"!==process.env.NODE_ENV&&console.warn("WARNING: The standard Label component renders as a <span> element, which does not take a htmlFor prop. If you want the Label to belong to a specific input, use the standAlone prop, which renders as a <label> element instead. In most cases the Label component should not be used directly, as it is part of all our input components.")),e.createElement(d,{className:m,htmlFor:u},s)}),d=function(n){var t=n.negative,r=void 0!==t&&t,o=n.external,a=void 0!==o&&o,l=n.className,s=void 0===l?"":l,i=n.children,m=u(n,["negative","external","className","children"]);return(e.createElement("a",c({className:p("jkl-link",s,{"jkl-link--negative":r,"jkl-link--external":a})},m),i))},f=function(n){var t=n.id,r=n.helpLabel,o=n.errorLabel,a=n.forceCompact,l=n.className,s=n.srOnly,i=n.inverted,c=p("jkl-form-support-label",l,{"jkl-form-support-label--compact":a,"jkl-form-support-label--error":o,"jkl-form-support-label--help":!o,"jkl-form-support-label--sr-only":s,"jkl-form-support-label--inverted":i});return o||r?e.createElement("span",{id:t,className:c},o||r):null};export{m as Label,d as Link,s as ScreenReaderOnly,f as SupportLabel,l as breakpoints,a as getValuePair,o as initTabListener}; |
@@ -61,5 +61,202 @@ 'use strict'; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
return target; | ||
} | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _objectWithoutPropertiesLoose(source, excluded); | ||
var key, i; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
key = sourceSymbolKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | ||
target[key] = source[key]; | ||
} | ||
} | ||
return target; | ||
} | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
var classnames = createCommonjsModule(function (module) { | ||
/*! | ||
Copyright (c) 2017 Jed Watson. | ||
Licensed under the MIT License (MIT), see | ||
http://jedwatson.github.io/classnames | ||
*/ | ||
/* global define */ | ||
(function () { | ||
var hasOwn = {}.hasOwnProperty; | ||
function classNames () { | ||
var classes = []; | ||
for (var i = 0; i < arguments.length; i++) { | ||
var arg = arguments[i]; | ||
if (!arg) continue; | ||
var argType = typeof arg; | ||
if (argType === 'string' || argType === 'number') { | ||
classes.push(arg); | ||
} else if (Array.isArray(arg) && arg.length) { | ||
var inner = classNames.apply(null, arg); | ||
if (inner) { | ||
classes.push(inner); | ||
} | ||
} else if (argType === 'object') { | ||
for (var key in arg) { | ||
if (hasOwn.call(arg, key) && arg[key]) { | ||
classes.push(key); | ||
} | ||
} | ||
} | ||
} | ||
return classes.join(' '); | ||
} | ||
if ( module.exports) { | ||
classNames.default = classNames; | ||
module.exports = classNames; | ||
} else { | ||
window.classNames = classNames; | ||
} | ||
}()); | ||
}); | ||
var classnames_1 = classnames.named; | ||
var Label = function Label(_ref) { | ||
var _classNames; | ||
var _ref$variant = _ref.variant, | ||
variant = _ref$variant === void 0 ? "medium" : _ref$variant, | ||
forceCompact = _ref.forceCompact, | ||
srOnly = _ref.srOnly, | ||
children = _ref.children, | ||
standAlone = _ref.standAlone, | ||
htmlFor = _ref.htmlFor; | ||
var className = classnames("jkl-label", (_classNames = {}, _defineProperty(_classNames, "jkl-label--".concat(variant), variant), _defineProperty(_classNames, "jkl-label--compact", forceCompact), _defineProperty(_classNames, "jkl-label--sr-only", srOnly), _classNames)); | ||
var C = standAlone ? "label" : "span"; | ||
if (!standAlone && htmlFor) { | ||
htmlFor = undefined; | ||
if (process.env.NODE_ENV !== "production") { | ||
console.warn("WARNING: The standard Label component renders as a <span> element, which does not take a htmlFor prop. If you want the Label to belong to a specific input, use the standAlone prop, which renders as a <label> element instead. In most cases the Label component should not be used directly, as it is part of all our input components."); | ||
} | ||
} | ||
return /*#__PURE__*/React.createElement(C, { | ||
className: className, | ||
htmlFor: htmlFor | ||
}, children); | ||
}; | ||
var Link = function Link(_ref) { | ||
var _ref$negative = _ref.negative, | ||
negative = _ref$negative === void 0 ? false : _ref$negative, | ||
_ref$external = _ref.external, | ||
external = _ref$external === void 0 ? false : _ref$external, | ||
_ref$className = _ref.className, | ||
className = _ref$className === void 0 ? "" : _ref$className, | ||
children = _ref.children, | ||
rest = _objectWithoutProperties(_ref, ["negative", "external", "className", "children"]); | ||
return /*#__PURE__*/React.createElement("a", _extends({ | ||
className: classnames("jkl-link", className, { | ||
"jkl-link--negative": negative, | ||
"jkl-link--external": external | ||
}) | ||
}, rest), children); | ||
}; | ||
var SupportLabel = function SupportLabel(_ref) { | ||
var id = _ref.id, | ||
helpLabel = _ref.helpLabel, | ||
errorLabel = _ref.errorLabel, | ||
forceCompact = _ref.forceCompact, | ||
className = _ref.className, | ||
srOnly = _ref.srOnly, | ||
inverted = _ref.inverted; | ||
var componentClassName = classnames("jkl-form-support-label", className, { | ||
"jkl-form-support-label--compact": forceCompact, | ||
"jkl-form-support-label--error": errorLabel, | ||
"jkl-form-support-label--help": !errorLabel, | ||
"jkl-form-support-label--sr-only": srOnly, | ||
"jkl-form-support-label--inverted": inverted | ||
}); | ||
if (errorLabel || helpLabel) { | ||
return /*#__PURE__*/React.createElement("span", { | ||
id: id, | ||
className: componentClassName | ||
}, errorLabel || helpLabel); | ||
} | ||
return null; | ||
}; | ||
exports.Label = Label; | ||
exports.Link = Link; | ||
exports.ScreenReaderOnly = ScreenReaderOnly; | ||
exports.SupportLabel = SupportLabel; | ||
exports.breakpoints = breakpoints; | ||
exports.getValuePair = getValuePair; | ||
exports.initTabListener = initTabListener; |
export { ScreenReaderOnly } from "./ScreenReaderOnly"; | ||
export { Label } from "./Label"; | ||
export { Link } from "./Link"; | ||
export { SupportLabel } from "./SupportLabel"; |
@@ -55,2 +55,196 @@ import React from 'react'; | ||
export { ScreenReaderOnly, breakpoints, getValuePair, initTabListener }; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
return target; | ||
} | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _objectWithoutPropertiesLoose(source, excluded); | ||
var key, i; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
key = sourceSymbolKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | ||
target[key] = source[key]; | ||
} | ||
} | ||
return target; | ||
} | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
var classnames = createCommonjsModule(function (module) { | ||
/*! | ||
Copyright (c) 2017 Jed Watson. | ||
Licensed under the MIT License (MIT), see | ||
http://jedwatson.github.io/classnames | ||
*/ | ||
/* global define */ | ||
(function () { | ||
var hasOwn = {}.hasOwnProperty; | ||
function classNames () { | ||
var classes = []; | ||
for (var i = 0; i < arguments.length; i++) { | ||
var arg = arguments[i]; | ||
if (!arg) continue; | ||
var argType = typeof arg; | ||
if (argType === 'string' || argType === 'number') { | ||
classes.push(arg); | ||
} else if (Array.isArray(arg) && arg.length) { | ||
var inner = classNames.apply(null, arg); | ||
if (inner) { | ||
classes.push(inner); | ||
} | ||
} else if (argType === 'object') { | ||
for (var key in arg) { | ||
if (hasOwn.call(arg, key) && arg[key]) { | ||
classes.push(key); | ||
} | ||
} | ||
} | ||
} | ||
return classes.join(' '); | ||
} | ||
if ( module.exports) { | ||
classNames.default = classNames; | ||
module.exports = classNames; | ||
} else { | ||
window.classNames = classNames; | ||
} | ||
}()); | ||
}); | ||
var classnames_1 = classnames.named; | ||
var Label = function Label(_ref) { | ||
var _classNames; | ||
var _ref$variant = _ref.variant, | ||
variant = _ref$variant === void 0 ? "medium" : _ref$variant, | ||
forceCompact = _ref.forceCompact, | ||
srOnly = _ref.srOnly, | ||
children = _ref.children, | ||
standAlone = _ref.standAlone, | ||
htmlFor = _ref.htmlFor; | ||
var className = classnames("jkl-label", (_classNames = {}, _defineProperty(_classNames, "jkl-label--".concat(variant), variant), _defineProperty(_classNames, "jkl-label--compact", forceCompact), _defineProperty(_classNames, "jkl-label--sr-only", srOnly), _classNames)); | ||
var C = standAlone ? "label" : "span"; | ||
if (!standAlone && htmlFor) { | ||
htmlFor = undefined; | ||
if (process.env.NODE_ENV !== "production") { | ||
console.warn("WARNING: The standard Label component renders as a <span> element, which does not take a htmlFor prop. If you want the Label to belong to a specific input, use the standAlone prop, which renders as a <label> element instead. In most cases the Label component should not be used directly, as it is part of all our input components."); | ||
} | ||
} | ||
return /*#__PURE__*/React.createElement(C, { | ||
className: className, | ||
htmlFor: htmlFor | ||
}, children); | ||
}; | ||
var Link = function Link(_ref) { | ||
var _ref$negative = _ref.negative, | ||
negative = _ref$negative === void 0 ? false : _ref$negative, | ||
_ref$external = _ref.external, | ||
external = _ref$external === void 0 ? false : _ref$external, | ||
_ref$className = _ref.className, | ||
className = _ref$className === void 0 ? "" : _ref$className, | ||
children = _ref.children, | ||
rest = _objectWithoutProperties(_ref, ["negative", "external", "className", "children"]); | ||
return /*#__PURE__*/React.createElement("a", _extends({ | ||
className: classnames("jkl-link", className, { | ||
"jkl-link--negative": negative, | ||
"jkl-link--external": external | ||
}) | ||
}, rest), children); | ||
}; | ||
var SupportLabel = function SupportLabel(_ref) { | ||
var id = _ref.id, | ||
helpLabel = _ref.helpLabel, | ||
errorLabel = _ref.errorLabel, | ||
forceCompact = _ref.forceCompact, | ||
className = _ref.className, | ||
srOnly = _ref.srOnly, | ||
inverted = _ref.inverted; | ||
var componentClassName = classnames("jkl-form-support-label", className, { | ||
"jkl-form-support-label--compact": forceCompact, | ||
"jkl-form-support-label--error": errorLabel, | ||
"jkl-form-support-label--help": !errorLabel, | ||
"jkl-form-support-label--sr-only": srOnly, | ||
"jkl-form-support-label--inverted": inverted | ||
}); | ||
if (errorLabel || helpLabel) { | ||
return /*#__PURE__*/React.createElement("span", { | ||
id: id, | ||
className: componentClassName | ||
}, errorLabel || helpLabel); | ||
} | ||
return null; | ||
}; | ||
export { Label, Link, ScreenReaderOnly, SupportLabel, breakpoints, getValuePair, initTabListener }; |
@@ -1,1 +0,7 @@ | ||
import e from"react";var t=!1;function n(){if(!t){t=!0;var e=document.querySelector("html");e&&e.setAttribute("data-mousenavigation","true"),document.removeEventListener("mousedown",n),document.addEventListener("keydown",o)}}function o(e){if("Tab"===e.key&&t){t=!1;var r=document.querySelector("html");r&&r.removeAttribute("data-mousenavigation"),document.removeEventListener("keydown",o),document.addEventListener("mousedown",n)}}function r(){"undefined"!=typeof document&&document.addEventListener("mousedown",n)}function u(e){return"string"==typeof e?{value:e,label:e}:e}var a={small:768,medium:992,large:1200,xl:1600},d=function(t){var n=t.children,o=t.showOnFocus;return(e.createElement("span",{className:"jkl-sr-only ".concat(o?"jkl-sr-only--focusable":"")},n))};export{d as ScreenReaderOnly,a as breakpoints,u as getValuePair,r as initTabListener}; | ||
import e from"react";var n=!1;function t(){if(!n){n=!0;var e=document.querySelector("html");e&&e.setAttribute("data-mousenavigation","true"),document.removeEventListener("mousedown",t),document.addEventListener("keydown",r)}}function r(e){if("Tab"===e.key&&n){n=!1;var o=document.querySelector("html");o&&o.removeAttribute("data-mousenavigation"),document.removeEventListener("keydown",r),document.addEventListener("mousedown",t)}}function o(){"undefined"!=typeof document&&document.addEventListener("mousedown",t)}function a(e){return"string"==typeof e?{value:e,label:e}:e}var l={small:768,medium:992,large:1200,xl:1600},s=function(n){var t=n.children,r=n.showOnFocus;return(e.createElement("span",{className:"jkl-sr-only ".concat(r?"jkl-sr-only--focusable":"")},t))};function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function c(){return(c=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function u(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=function(e,n){return e(n={exports:{}},n.exports),n.exports}((function(e){ | ||
/*! | ||
Copyright (c) 2017 Jed Watson. | ||
Licensed under the MIT License (MIT), see | ||
http://jedwatson.github.io/classnames | ||
*/ | ||
!function(){var n={}.hasOwnProperty;function t(){for(var e=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var a=typeof o;if("string"===a||"number"===a)e.push(o);else if(Array.isArray(o)&&o.length){var l=t.apply(null,o);l&&e.push(l)}else if("object"===a)for(var s in o)n.call(o,s)&&o[s]&&e.push(s)}}return e.join(" ")}e.exports?(t.default=t,e.exports=t):window.classNames=t}()})),m=(p.named,function(n){var t,r=n.variant,o=void 0===r?"medium":r,a=n.forceCompact,l=n.srOnly,s=n.children,c=n.standAlone,u=n.htmlFor,m=p("jkl-label",(i(t={},"jkl-label--".concat(o),o),i(t,"jkl-label--compact",a),i(t,"jkl-label--sr-only",l),t)),d=c?"label":"span";return!c&&u&&(u=void 0,"production"!==process.env.NODE_ENV&&console.warn("WARNING: The standard Label component renders as a <span> element, which does not take a htmlFor prop. If you want the Label to belong to a specific input, use the standAlone prop, which renders as a <label> element instead. In most cases the Label component should not be used directly, as it is part of all our input components.")),e.createElement(d,{className:m,htmlFor:u},s)}),d=function(n){var t=n.negative,r=void 0!==t&&t,o=n.external,a=void 0!==o&&o,l=n.className,s=void 0===l?"":l,i=n.children,m=u(n,["negative","external","className","children"]);return(e.createElement("a",c({className:p("jkl-link",s,{"jkl-link--negative":r,"jkl-link--external":a})},m),i))},f=function(n){var t=n.id,r=n.helpLabel,o=n.errorLabel,a=n.forceCompact,l=n.className,s=n.srOnly,i=n.inverted,c=p("jkl-form-support-label",l,{"jkl-form-support-label--compact":a,"jkl-form-support-label--error":o,"jkl-form-support-label--help":!o,"jkl-form-support-label--sr-only":s,"jkl-form-support-label--inverted":i});return o||r?e.createElement("span",{id:t,className:c},o||r):null};export{m as Label,d as Link,s as ScreenReaderOnly,f as SupportLabel,l as breakpoints,a as getValuePair,o as initTabListener}; |
export { initTabListener, getValuePair, breakpoints } from "./utils"; | ||
export { ScreenReaderOnly } from "./components"; | ||
export { Label, Link, ScreenReaderOnly, SupportLabel } from "./components"; | ||
export declare type LabelVariant = "small" | "medium" | "large"; | ||
@@ -4,0 +4,0 @@ export declare type ValuePair = { |
@@ -6,2 +6,18 @@ # Change Log | ||
# [4.4.0](https://github.com/fremtind/jokul/compare/@fremtind/jkl-core@4.3.1...@fremtind/jkl-core@4.4.0) (2020-05-13) | ||
### Bug Fixes | ||
* import labels and links from core ([f2bba87](https://github.com/fremtind/jokul/commit/f2bba87aab70e887e44b11b4f390324ab3fa5a2b)) | ||
### Features | ||
* **core:** add typographic components ([1bd28a5](https://github.com/fremtind/jokul/commit/1bd28a54ecadd6626666dec0362d9ec8e38d5a90)) | ||
## [4.3.1](https://github.com/fremtind/jokul/compare/@fremtind/jkl-core@4.3.0...@fremtind/jkl-core@4.3.1) (2020-05-11) | ||
@@ -8,0 +24,0 @@ |
{ | ||
"name": "@fremtind/jkl-core", | ||
"version": "4.3.1", | ||
"version": "4.4.0", | ||
"publishConfig": { | ||
@@ -51,3 +51,3 @@ "access": "public" | ||
}, | ||
"gitHead": "99afd5d12492894f0e5aec837e037ea9dcf5ad1d" | ||
"gitHead": "a4b7b2585cb93980529a77a4f90afa786cb3677f" | ||
} |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
139717
61
2403
5