@fremtind/jkl-text-input-react
Advanced tools
Comparing version 0.8.1 to 0.8.2
@@ -107,12 +107,16 @@ import React, { useState } from 'react'; | ||
label = _ref.label, | ||
_ref$className = _ref.className, | ||
className = _ref$className === void 0 ? "" : _ref$className, | ||
className = _ref.className, | ||
placeholder = _ref.placeholder, | ||
value = _ref.value, | ||
rest = _objectWithoutProperties(_ref, ["type", "inline", "readOnly", "helpLabel", "errorLabel", "id", "label", "className", "placeholder", "value"]); | ||
variant = _ref.variant, | ||
rest = _objectWithoutProperties(_ref, ["type", "inline", "readOnly", "helpLabel", "errorLabel", "id", "label", "className", "placeholder", "value", "variant"]); | ||
var componentClassName = "jkl-text-field".concat(inline ? " jkl-text-field--inline" : "").concat(className ? " ".concat(className) : ""); | ||
var labelClassName = "jkl-label".concat(variant ? " jkl-label--".concat(variant) : ""); | ||
return React.createElement("label", { | ||
"data-testid": "jkl-text-field", | ||
className: "jkl-text-field".concat(inline ? " jkl-text-field--inline" : "", " ").concat(className) | ||
}, React.createElement("input", _extends({ | ||
className: componentClassName | ||
}, React.createElement("span", { | ||
className: labelClassName | ||
}, label), React.createElement("input", _extends({ | ||
type: type, | ||
@@ -122,10 +126,6 @@ "aria-invalid": !!errorLabel, | ||
id: id, | ||
placeholder: " ", | ||
placeholder: placeholder, | ||
readOnly: readOnly, | ||
value: value | ||
}, rest)), !value && placeholder && React.createElement("span", { | ||
className: "jkl-text-field__placeholder" | ||
}, placeholder), React.createElement("span", { | ||
className: "jkl-text-field__label" | ||
}, label), React.createElement(SupportLabel, { | ||
}, rest)), React.createElement(SupportLabel, { | ||
helpLabel: helpLabel, | ||
@@ -138,5 +138,5 @@ errorLabel: errorLabel | ||
var id = _ref.id, | ||
variant = _ref.variant, | ||
label = _ref.label, | ||
_ref$className = _ref.className, | ||
className = _ref$className === void 0 ? "" : _ref$className, | ||
className = _ref.className, | ||
helpLabel = _ref.helpLabel, | ||
@@ -146,3 +146,5 @@ errorLabel = _ref.errorLabel, | ||
rows = _ref$rows === void 0 ? 7 : _ref$rows, | ||
restProps = _objectWithoutProperties(_ref, ["id", "label", "className", "helpLabel", "errorLabel", "rows"]); | ||
_ref$placeholder = _ref.placeholder, | ||
placeholder = _ref$placeholder === void 0 ? " " : _ref$placeholder, | ||
restProps = _objectWithoutProperties(_ref, ["id", "variant", "label", "className", "helpLabel", "errorLabel", "rows", "placeholder"]); | ||
@@ -155,2 +157,4 @@ var _useState = useState(false), | ||
var height = isFocused || restProps.value ? "".concat(rows * 2 + 0.5, "rem") : undefined; | ||
var componentClassName = "jkl-text-field jkl-text-area".concat(className ? " ".concat(className) : ""); | ||
var labelClassName = "jkl-label".concat(variant ? " jkl-label--".concat(variant) : ""); | ||
@@ -168,4 +172,6 @@ function onBlur(event) { | ||
"data-testid": "jkl-text-field", | ||
className: "jkl-text-field jkl-text-area ".concat(className) | ||
}, React.createElement("textarea", _extends({ | ||
className: componentClassName | ||
}, React.createElement("span", { | ||
className: labelClassName | ||
}, label), React.createElement("textarea", _extends({ | ||
onFocus: onFocus, | ||
@@ -179,6 +185,4 @@ onBlur: onBlur, | ||
id: id, | ||
placeholder: " " | ||
}, restProps)), React.createElement("span", { | ||
className: "jkl-text-field__label" | ||
}, label), React.createElement(SupportLabel, { | ||
placeholder: placeholder | ||
}, restProps)), React.createElement(SupportLabel, { | ||
helpLabel: helpLabel, | ||
@@ -185,0 +189,0 @@ errorLabel: errorLabel |
@@ -1,1 +0,1 @@ | ||
import e,{useState as t}from"react";import{SupportLabel as l}from"@fremtind/jkl-typography-react";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}function a(e,t){if(null==e)return{};var l,r,a=function(e,t){if(null==e)return{};var l,r,a={},n=Object.keys(e);for(r=0;r<n.length;r++)l=n[r],t.indexOf(l)>=0||(a[l]=e[l]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)l=n[r],t.indexOf(l)>=0||Object.prototype.propertyIsEnumerable.call(e,l)&&(a[l]=e[l])}return a}function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var l=[],r=!0,a=!1,n=void 0;try{for(var i,o=e[Symbol.iterator]();!(r=(i=o.next()).done)&&(l.push(i.value),!t||l.length!==t);r=!0);}catch(e){a=!0,n=e}finally{try{r||null==o.return||o.return()}finally{if(a)throw n}}return l}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var i=function(t){var n=t.type,i=void 0===n?"text":n,o=t.inline,c=void 0!==o&&o,u=t.readOnly,d=void 0!==u&&u,s=t.helpLabel,f=t.errorLabel,p=t.id,b=t.label,m=t.className,v=void 0===m?"":m,y=t.placeholder,h=t.value,j=a(t,["type","inline","readOnly","helpLabel","errorLabel","id","label","className","placeholder","value"]);return e.createElement("label",{"data-testid":"jkl-text-field",className:"jkl-text-field".concat(c?" jkl-text-field--inline":""," ").concat(v)},e.createElement("input",r({type:i,"aria-invalid":!!f,className:"jkl-text-field__input",id:p,placeholder:" ",readOnly:d,value:h},j)),!h&&y&&e.createElement("span",{className:"jkl-text-field__placeholder"},y),e.createElement("span",{className:"jkl-text-field__label"},b),e.createElement(l,{helpLabel:s,errorLabel:f}))},o=function(i){var o=i.id,c=i.label,u=i.className,d=void 0===u?"":u,s=i.helpLabel,f=i.errorLabel,p=i.rows,b=void 0===p?7:p,m=a(i,["id","label","className","helpLabel","errorLabel","rows"]),v=n(t(!1),2),y=v[0],h=v[1],j=y||m.value?"".concat(2*b+.5,"rem"):void 0;return e.createElement("label",{"data-testid":"jkl-text-field",className:"jkl-text-field jkl-text-area ".concat(d)},e.createElement("textarea",r({onFocus:function(){return h(!0)},onBlur:function(e){h(!1),m.onBlur&&m.onBlur(e)},style:{height:j},"aria-invalid":!!f,className:"jkl-text-field__input",id:o,placeholder:" "},m)),e.createElement("span",{className:"jkl-text-field__label"},c),e.createElement(l,{helpLabel:s,errorLabel:f}))};export{o as TextArea,i as TextField}; | ||
import e,{useState as t}from"react";import{SupportLabel as l}from"@fremtind/jkl-typography-react";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}function a(e,t){if(null==e)return{};var l,r,a=function(e,t){if(null==e)return{};var l,r,a={},n=Object.keys(e);for(r=0;r<n.length;r++)l=n[r],t.indexOf(l)>=0||(a[l]=e[l]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)l=n[r],t.indexOf(l)>=0||Object.prototype.propertyIsEnumerable.call(e,l)&&(a[l]=e[l])}return a}function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var l=[],r=!0,a=!1,n=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done)&&(l.push(o.value),!t||l.length!==t);r=!0);}catch(e){a=!0,n=e}finally{try{r||null==i.return||i.return()}finally{if(a)throw n}}return l}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var o=function(t){var n=t.type,o=void 0===n?"text":n,i=t.inline,c=void 0!==i&&i,u=t.readOnly,d=void 0!==u&&u,s=t.helpLabel,p=t.errorLabel,f=t.id,b=t.label,v=t.className,m=t.placeholder,y=t.value,h=t.variant,j=a(t,["type","inline","readOnly","helpLabel","errorLabel","id","label","className","placeholder","value","variant"]),k="jkl-text-field".concat(c?" jkl-text-field--inline":"").concat(v?" ".concat(v):""),x="jkl-label".concat(h?" jkl-label--".concat(h):"");return e.createElement("label",{"data-testid":"jkl-text-field",className:k},e.createElement("span",{className:x},b),e.createElement("input",r({type:o,"aria-invalid":!!p,className:"jkl-text-field__input",id:f,placeholder:m,readOnly:d,value:y},j)),e.createElement(l,{helpLabel:s,errorLabel:p}))},i=function(o){var i=o.id,c=o.variant,u=o.label,d=o.className,s=o.helpLabel,p=o.errorLabel,f=o.rows,b=void 0===f?7:f,v=o.placeholder,m=void 0===v?" ":v,y=a(o,["id","variant","label","className","helpLabel","errorLabel","rows","placeholder"]),h=n(t(!1),2),j=h[0],k=h[1],x=j||y.value?"".concat(2*b+.5,"rem"):void 0,O="jkl-text-field jkl-text-area".concat(d?" ".concat(d):""),L="jkl-label".concat(c?" jkl-label--".concat(c):"");return e.createElement("label",{"data-testid":"jkl-text-field",className:O},e.createElement("span",{className:L},u),e.createElement("textarea",r({onFocus:function(){return k(!0)},onBlur:function(e){k(!1),y.onBlur&&y.onBlur(e)},style:{height:x},"aria-invalid":!!p,className:"jkl-text-field__input",id:i,placeholder:m},y)),e.createElement(l,{helpLabel:s,errorLabel:p}))};export{i as TextArea,o as TextField}; |
@@ -114,12 +114,16 @@ 'use strict'; | ||
label = _ref.label, | ||
_ref$className = _ref.className, | ||
className = _ref$className === void 0 ? "" : _ref$className, | ||
className = _ref.className, | ||
placeholder = _ref.placeholder, | ||
value = _ref.value, | ||
rest = _objectWithoutProperties(_ref, ["type", "inline", "readOnly", "helpLabel", "errorLabel", "id", "label", "className", "placeholder", "value"]); | ||
variant = _ref.variant, | ||
rest = _objectWithoutProperties(_ref, ["type", "inline", "readOnly", "helpLabel", "errorLabel", "id", "label", "className", "placeholder", "value", "variant"]); | ||
var componentClassName = "jkl-text-field".concat(inline ? " jkl-text-field--inline" : "").concat(className ? " ".concat(className) : ""); | ||
var labelClassName = "jkl-label".concat(variant ? " jkl-label--".concat(variant) : ""); | ||
return React__default.createElement("label", { | ||
"data-testid": "jkl-text-field", | ||
className: "jkl-text-field".concat(inline ? " jkl-text-field--inline" : "", " ").concat(className) | ||
}, React__default.createElement("input", _extends({ | ||
className: componentClassName | ||
}, React__default.createElement("span", { | ||
className: labelClassName | ||
}, label), React__default.createElement("input", _extends({ | ||
type: type, | ||
@@ -129,10 +133,6 @@ "aria-invalid": !!errorLabel, | ||
id: id, | ||
placeholder: " ", | ||
placeholder: placeholder, | ||
readOnly: readOnly, | ||
value: value | ||
}, rest)), !value && placeholder && React__default.createElement("span", { | ||
className: "jkl-text-field__placeholder" | ||
}, placeholder), React__default.createElement("span", { | ||
className: "jkl-text-field__label" | ||
}, label), React__default.createElement(jklTypographyReact.SupportLabel, { | ||
}, rest)), React__default.createElement(jklTypographyReact.SupportLabel, { | ||
helpLabel: helpLabel, | ||
@@ -145,5 +145,5 @@ errorLabel: errorLabel | ||
var id = _ref.id, | ||
variant = _ref.variant, | ||
label = _ref.label, | ||
_ref$className = _ref.className, | ||
className = _ref$className === void 0 ? "" : _ref$className, | ||
className = _ref.className, | ||
helpLabel = _ref.helpLabel, | ||
@@ -153,3 +153,5 @@ errorLabel = _ref.errorLabel, | ||
rows = _ref$rows === void 0 ? 7 : _ref$rows, | ||
restProps = _objectWithoutProperties(_ref, ["id", "label", "className", "helpLabel", "errorLabel", "rows"]); | ||
_ref$placeholder = _ref.placeholder, | ||
placeholder = _ref$placeholder === void 0 ? " " : _ref$placeholder, | ||
restProps = _objectWithoutProperties(_ref, ["id", "variant", "label", "className", "helpLabel", "errorLabel", "rows", "placeholder"]); | ||
@@ -162,2 +164,4 @@ var _useState = React.useState(false), | ||
var height = isFocused || restProps.value ? "".concat(rows * 2 + 0.5, "rem") : undefined; | ||
var componentClassName = "jkl-text-field jkl-text-area".concat(className ? " ".concat(className) : ""); | ||
var labelClassName = "jkl-label".concat(variant ? " jkl-label--".concat(variant) : ""); | ||
@@ -175,4 +179,6 @@ function onBlur(event) { | ||
"data-testid": "jkl-text-field", | ||
className: "jkl-text-field jkl-text-area ".concat(className) | ||
}, React__default.createElement("textarea", _extends({ | ||
className: componentClassName | ||
}, React__default.createElement("span", { | ||
className: labelClassName | ||
}, label), React__default.createElement("textarea", _extends({ | ||
onFocus: onFocus, | ||
@@ -186,6 +192,4 @@ onBlur: onBlur, | ||
id: id, | ||
placeholder: " " | ||
}, restProps)), React__default.createElement("span", { | ||
className: "jkl-text-field__label" | ||
}, label), React__default.createElement(jklTypographyReact.SupportLabel, { | ||
placeholder: placeholder | ||
}, restProps)), React__default.createElement(jklTypographyReact.SupportLabel, { | ||
helpLabel: helpLabel, | ||
@@ -192,0 +196,0 @@ errorLabel: errorLabel |
@@ -107,12 +107,16 @@ import React, { useState } from 'react'; | ||
label = _ref.label, | ||
_ref$className = _ref.className, | ||
className = _ref$className === void 0 ? "" : _ref$className, | ||
className = _ref.className, | ||
placeholder = _ref.placeholder, | ||
value = _ref.value, | ||
rest = _objectWithoutProperties(_ref, ["type", "inline", "readOnly", "helpLabel", "errorLabel", "id", "label", "className", "placeholder", "value"]); | ||
variant = _ref.variant, | ||
rest = _objectWithoutProperties(_ref, ["type", "inline", "readOnly", "helpLabel", "errorLabel", "id", "label", "className", "placeholder", "value", "variant"]); | ||
var componentClassName = "jkl-text-field".concat(inline ? " jkl-text-field--inline" : "").concat(className ? " ".concat(className) : ""); | ||
var labelClassName = "jkl-label".concat(variant ? " jkl-label--".concat(variant) : ""); | ||
return React.createElement("label", { | ||
"data-testid": "jkl-text-field", | ||
className: "jkl-text-field".concat(inline ? " jkl-text-field--inline" : "", " ").concat(className) | ||
}, React.createElement("input", _extends({ | ||
className: componentClassName | ||
}, React.createElement("span", { | ||
className: labelClassName | ||
}, label), React.createElement("input", _extends({ | ||
type: type, | ||
@@ -122,10 +126,6 @@ "aria-invalid": !!errorLabel, | ||
id: id, | ||
placeholder: " ", | ||
placeholder: placeholder, | ||
readOnly: readOnly, | ||
value: value | ||
}, rest)), !value && placeholder && React.createElement("span", { | ||
className: "jkl-text-field__placeholder" | ||
}, placeholder), React.createElement("span", { | ||
className: "jkl-text-field__label" | ||
}, label), React.createElement(SupportLabel, { | ||
}, rest)), React.createElement(SupportLabel, { | ||
helpLabel: helpLabel, | ||
@@ -138,5 +138,5 @@ errorLabel: errorLabel | ||
var id = _ref.id, | ||
variant = _ref.variant, | ||
label = _ref.label, | ||
_ref$className = _ref.className, | ||
className = _ref$className === void 0 ? "" : _ref$className, | ||
className = _ref.className, | ||
helpLabel = _ref.helpLabel, | ||
@@ -146,3 +146,5 @@ errorLabel = _ref.errorLabel, | ||
rows = _ref$rows === void 0 ? 7 : _ref$rows, | ||
restProps = _objectWithoutProperties(_ref, ["id", "label", "className", "helpLabel", "errorLabel", "rows"]); | ||
_ref$placeholder = _ref.placeholder, | ||
placeholder = _ref$placeholder === void 0 ? " " : _ref$placeholder, | ||
restProps = _objectWithoutProperties(_ref, ["id", "variant", "label", "className", "helpLabel", "errorLabel", "rows", "placeholder"]); | ||
@@ -155,2 +157,4 @@ var _useState = useState(false), | ||
var height = isFocused || restProps.value ? "".concat(rows * 2 + 0.5, "rem") : undefined; | ||
var componentClassName = "jkl-text-field jkl-text-area".concat(className ? " ".concat(className) : ""); | ||
var labelClassName = "jkl-label".concat(variant ? " jkl-label--".concat(variant) : ""); | ||
@@ -168,4 +172,6 @@ function onBlur(event) { | ||
"data-testid": "jkl-text-field", | ||
className: "jkl-text-field jkl-text-area ".concat(className) | ||
}, React.createElement("textarea", _extends({ | ||
className: componentClassName | ||
}, React.createElement("span", { | ||
className: labelClassName | ||
}, label), React.createElement("textarea", _extends({ | ||
onFocus: onFocus, | ||
@@ -179,6 +185,4 @@ onBlur: onBlur, | ||
id: id, | ||
placeholder: " " | ||
}, restProps)), React.createElement("span", { | ||
className: "jkl-text-field__label" | ||
}, label), React.createElement(SupportLabel, { | ||
placeholder: placeholder | ||
}, restProps)), React.createElement(SupportLabel, { | ||
helpLabel: helpLabel, | ||
@@ -185,0 +189,0 @@ errorLabel: errorLabel |
@@ -1,1 +0,1 @@ | ||
import e,{useState as t}from"react";import{SupportLabel as l}from"@fremtind/jkl-typography-react";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}function a(e,t){if(null==e)return{};var l,r,a=function(e,t){if(null==e)return{};var l,r,a={},n=Object.keys(e);for(r=0;r<n.length;r++)l=n[r],t.indexOf(l)>=0||(a[l]=e[l]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)l=n[r],t.indexOf(l)>=0||Object.prototype.propertyIsEnumerable.call(e,l)&&(a[l]=e[l])}return a}function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var l=[],r=!0,a=!1,n=void 0;try{for(var i,o=e[Symbol.iterator]();!(r=(i=o.next()).done)&&(l.push(i.value),!t||l.length!==t);r=!0);}catch(e){a=!0,n=e}finally{try{r||null==o.return||o.return()}finally{if(a)throw n}}return l}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var i=function(t){var n=t.type,i=void 0===n?"text":n,o=t.inline,c=void 0!==o&&o,u=t.readOnly,d=void 0!==u&&u,s=t.helpLabel,f=t.errorLabel,p=t.id,b=t.label,m=t.className,v=void 0===m?"":m,y=t.placeholder,h=t.value,j=a(t,["type","inline","readOnly","helpLabel","errorLabel","id","label","className","placeholder","value"]);return e.createElement("label",{"data-testid":"jkl-text-field",className:"jkl-text-field".concat(c?" jkl-text-field--inline":""," ").concat(v)},e.createElement("input",r({type:i,"aria-invalid":!!f,className:"jkl-text-field__input",id:p,placeholder:" ",readOnly:d,value:h},j)),!h&&y&&e.createElement("span",{className:"jkl-text-field__placeholder"},y),e.createElement("span",{className:"jkl-text-field__label"},b),e.createElement(l,{helpLabel:s,errorLabel:f}))},o=function(i){var o=i.id,c=i.label,u=i.className,d=void 0===u?"":u,s=i.helpLabel,f=i.errorLabel,p=i.rows,b=void 0===p?7:p,m=a(i,["id","label","className","helpLabel","errorLabel","rows"]),v=n(t(!1),2),y=v[0],h=v[1],j=y||m.value?"".concat(2*b+.5,"rem"):void 0;return e.createElement("label",{"data-testid":"jkl-text-field",className:"jkl-text-field jkl-text-area ".concat(d)},e.createElement("textarea",r({onFocus:function(){return h(!0)},onBlur:function(e){h(!1),m.onBlur&&m.onBlur(e)},style:{height:j},"aria-invalid":!!f,className:"jkl-text-field__input",id:o,placeholder:" "},m)),e.createElement("span",{className:"jkl-text-field__label"},c),e.createElement(l,{helpLabel:s,errorLabel:f}))};export{o as TextArea,i as TextField}; | ||
import e,{useState as t}from"react";import{SupportLabel as l}from"@fremtind/jkl-typography-react";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r])}return e}).apply(this,arguments)}function a(e,t){if(null==e)return{};var l,r,a=function(e,t){if(null==e)return{};var l,r,a={},n=Object.keys(e);for(r=0;r<n.length;r++)l=n[r],t.indexOf(l)>=0||(a[l]=e[l]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)l=n[r],t.indexOf(l)>=0||Object.prototype.propertyIsEnumerable.call(e,l)&&(a[l]=e[l])}return a}function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var l=[],r=!0,a=!1,n=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done)&&(l.push(o.value),!t||l.length!==t);r=!0);}catch(e){a=!0,n=e}finally{try{r||null==i.return||i.return()}finally{if(a)throw n}}return l}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var o=function(t){var n=t.type,o=void 0===n?"text":n,i=t.inline,c=void 0!==i&&i,u=t.readOnly,d=void 0!==u&&u,s=t.helpLabel,p=t.errorLabel,f=t.id,b=t.label,v=t.className,m=t.placeholder,y=t.value,h=t.variant,j=a(t,["type","inline","readOnly","helpLabel","errorLabel","id","label","className","placeholder","value","variant"]),k="jkl-text-field".concat(c?" jkl-text-field--inline":"").concat(v?" ".concat(v):""),x="jkl-label".concat(h?" jkl-label--".concat(h):"");return e.createElement("label",{"data-testid":"jkl-text-field",className:k},e.createElement("span",{className:x},b),e.createElement("input",r({type:o,"aria-invalid":!!p,className:"jkl-text-field__input",id:f,placeholder:m,readOnly:d,value:y},j)),e.createElement(l,{helpLabel:s,errorLabel:p}))},i=function(o){var i=o.id,c=o.variant,u=o.label,d=o.className,s=o.helpLabel,p=o.errorLabel,f=o.rows,b=void 0===f?7:f,v=o.placeholder,m=void 0===v?" ":v,y=a(o,["id","variant","label","className","helpLabel","errorLabel","rows","placeholder"]),h=n(t(!1),2),j=h[0],k=h[1],x=j||y.value?"".concat(2*b+.5,"rem"):void 0,O="jkl-text-field jkl-text-area".concat(d?" ".concat(d):""),L="jkl-label".concat(c?" jkl-label--".concat(c):"");return e.createElement("label",{"data-testid":"jkl-text-field",className:O},e.createElement("span",{className:L},u),e.createElement("textarea",r({onFocus:function(){return k(!0)},onBlur:function(e){k(!1),y.onBlur&&y.onBlur(e)},style:{height:x},"aria-invalid":!!p,className:"jkl-text-field__input",id:i,placeholder:m},y)),e.createElement(l,{helpLabel:s,errorLabel:p}))};export{i as TextArea,o as TextField}; |
import { ChangeEvent, FocusEvent } from "react"; | ||
import { labelVariant } from "@fremtind/jkl-core"; | ||
interface Props { | ||
@@ -13,4 +14,6 @@ label: string; | ||
rows?: number; | ||
placeholder?: string; | ||
variant?: labelVariant; | ||
} | ||
export declare const TextArea: ({ id, label, className, helpLabel, errorLabel, rows, ...restProps }: Props) => JSX.Element; | ||
export declare const TextArea: ({ id, variant, label, className, helpLabel, errorLabel, rows, placeholder, ...restProps }: Props) => JSX.Element; | ||
export {}; |
import { ChangeEvent, FocusEvent } from "react"; | ||
import { labelVariant } from "@fremtind/jkl-core"; | ||
interface Props { | ||
@@ -18,4 +19,5 @@ label: string; | ||
placeholder?: string; | ||
variant?: labelVariant; | ||
} | ||
export declare const TextField: ({ type, inline, readOnly, helpLabel, errorLabel, id, label, className, placeholder, value, ...rest }: Props) => JSX.Element; | ||
export declare const TextField: ({ type, inline, readOnly, helpLabel, errorLabel, id, label, className, placeholder, value, variant, ...rest }: Props) => JSX.Element; | ||
export {}; |
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.8.2](https://github.com/fremtind/jokul/compare/@fremtind/jkl-text-input-react@0.8.1...@fremtind/jkl-text-input-react@0.8.2) (2019-09-26) | ||
**Note:** Version bump only for package @fremtind/jkl-text-input-react | ||
## [0.8.1](https://github.com/fremtind/jokul/compare/@fremtind/jkl-text-input-react@0.8.0...@fremtind/jkl-text-input-react@0.8.1) (2019-09-23) | ||
@@ -8,0 +16,0 @@ |
{ | ||
"name": "@fremtind/jkl-text-input-react", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"publishConfig": { | ||
@@ -40,4 +40,4 @@ "access": "public" | ||
"dependencies": { | ||
"@fremtind/jkl-text-input": "^0.9.1", | ||
"@fremtind/jkl-typography-react": "^0.8.1" | ||
"@fremtind/jkl-text-input": "^0.9.2", | ||
"@fremtind/jkl-typography-react": "^0.8.2" | ||
}, | ||
@@ -63,3 +63,3 @@ "devDependencies": { | ||
], | ||
"gitHead": "6a8aa6e9fb9ffa1a1ce0498d2b616735ccb010ec" | ||
"gitHead": "06b4c2cf95b8fbb586c6b10ba57b241fa1d4e320" | ||
} |
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
32291
541