@entur/chip
Advanced tools
Comparing version 0.7.26 to 0.7.27-RC.0
@@ -13,26 +13,18 @@ 'use strict'; | ||
function _extends() { | ||
_extends = Object.assign ? Object.assign.bind() : 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 _extends = Object.assign ? Object.assign.bind() : function (n) { | ||
for (var e = 1; e < arguments.length; e++) { | ||
var t = arguments[e]; | ||
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
return n; | ||
}, _extends.apply(null, 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]; | ||
function _objectWithoutPropertiesLoose(r, e) { | ||
if (null == r) return {}; | ||
var t = {}; | ||
for (var n in r) if ({}.hasOwnProperty.call(r, n)) { | ||
if (e.includes(n)) continue; | ||
t[n] = r[n]; | ||
} | ||
return target; | ||
return t; | ||
} | ||
@@ -64,3 +56,3 @@ | ||
var _child$type; | ||
return child == null ? void 0 : (_child$type = child.type) == null ? void 0 : _child$type.toString().toLowerCase().includes('icon'); | ||
return child == null || (_child$type = child.type) == null ? void 0 : _child$type.toString().toLowerCase().includes('icon'); | ||
}; | ||
@@ -108,3 +100,3 @@ var hasLeadingIcon = childrenArray.length > 1 && isIcon(childrenArray.at(0)); | ||
var _child$type; | ||
return child == null ? void 0 : (_child$type = child.type) == null ? void 0 : _child$type.toString().toLowerCase().includes('icon'); | ||
return child == null || (_child$type = child.type) == null ? void 0 : _child$type.toString().toLowerCase().includes('icon'); | ||
}; | ||
@@ -111,0 +103,0 @@ var hasLeadingIcon = childrenArray.length > 1 && isIcon(childrenArray.at(0)); |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),i=require("react"),a=require("classnames"),t=require("@entur/loader"),n=require("@entur/icons"),r=require("@entur/form");function l(){return l=Object.assign?Object.assign.bind():function(e){for(var i=1;i<arguments.length;i++){var a=arguments[i];for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(e[t]=a[t])}return e},l.apply(this,arguments)}function s(e,i){if(null==e)return{};var a,t,n={},r=Object.keys(e);for(t=0;t<r.length;t++)i.indexOf(a=r[t])>=0||(n[a]=e[a]);return n}var c=i.createContext(null),o=c.Provider,d=["className","children","value","disabled","style","size"],u=i.forwardRef((function(e,t){var n=e.className,r=e.children,o=e.value,u=e.disabled,h=void 0!==u&&u,p=e.style,m=e.size,v=void 0===m?"medium":m,f=s(e,d),b=i.Children.toArray(r),g=function(e){var i;return null==e||null==(i=e.type)?void 0:i.toString().toLowerCase().includes("icon")},C=b.length>1&&g(b.at(0)),y=b.length>1&&g(b.at(-1)),N=a(n,"eds-chip","eds-chip--size-"+v,{"eds-chip--disabled":h,"eds-chip--leading-icon":C,"eds-chip--trailing-icon":y}),E=function(){var e=i.useContext(c);if(!e)throw new Error("You need to wrap your ChoiceChips in a ChoiceChipGroup-component");return e}();return i.createElement("label",{className:"eds-choice-chip",style:p},i.createElement("input",l({className:"eds-choice-chip__input",type:"radio",name:E.name,ref:t,value:o,disabled:h,checked:E.value===o,onChange:E.onChange,"aria-disabled":h},f)),i.createElement("div",{className:N},r))})),h=["children","className","loading","size"],p=i.forwardRef((function(e,n){var r=e.children,c=e.className,o=e.loading,d=void 0!==o&&o,u=e.size,p=void 0===u?"medium":u,m=s(e,h),v=i.Children.toArray(r),f=function(e){var i;return null==e||null==(i=e.type)?void 0:i.toString().toLowerCase().includes("icon")},b=v.length>1&&f(v.at(0)),g=v.length>1&&f(v.at(-1)),C=v.filter((function(e){return"string"==typeof e})).join(" "),y=a(c,"eds-chip","eds-action-chip","eds-chip--size-"+p,{"eds-chip--leading-icon":b,"eds-chip--trailing-icon":g,"eds-action-chip--disabled":m.disabled}),N=i.createElement("button",l({className:y,ref:n,"aria-busy":d,"aria-label":m["aria-label"]?m["aria-label"]:d?C:void 0,type:"button"},m),d?i.createElement(t.LoadingDots,{className:"eds-action-chip__loading-dots"}):r);return m.disabled?i.createElement("div",{className:"eds-action-chip--disabled__wrapper"},N):i.createElement(i.Fragment,null,N)})),m=["children","className","onClose","closeButtonAriaLabel","size"],v=i.forwardRef((function(e,t){var r=e.children,c=e.className,o=e.onClose,d=e.closeButtonAriaLabel,u=e.size,h=void 0===u?"medium":u,p=s(e,m),v=null!=d?d:"Fjern "+(null==r?void 0:r.toString());return i.createElement("div",l({className:a("eds-chip","eds-tag-chip","eds-chip--size-"+h,c)},p),r,i.createElement("button",{className:"eds-tag-chip__close-button",type:"button",onClick:o,"aria-label":v,ref:t},i.createElement(n.CloseSmallIcon,{"aria-hidden":!0})))})),f=["className","children","value","disabled","name","style","size"],b=i.forwardRef((function(e,t){var n=e.className,r=e.children,c=e.value,o=e.disabled,d=void 0!==o&&o,u=e.name,h=e.style,p=e.size,m=void 0===p?"medium":p,v=s(e,f),b=a(n,"eds-filter-chip");return i.createElement("label",{className:b,style:h},i.createElement("input",l({className:"eds-filter-chip__input",type:"checkbox",name:u,ref:t,value:c,disabled:d},v)),i.createElement("div",{className:"eds-chip "+(m?"eds-chip--size-"+m:"")},i.createElement("span",{className:"eds-filter-chip__icon"},i.createElement(g,null)),r))})),g=function(){return i.createElement("svg",{className:"eds-filter-chip-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{className:"eds-filter-chip-icon__path",d:"M1.71283 7.10801L5.6464 11.1377C5.84098 11.3371 6.16095 11.339 6.35786 11.1419L14.2916 3.20325",stroke:"#181C56",strokeWidth:"2"}))},C=["name","value","children","onChange","label"];e.warnAboutMissingStyles("chip","form"),exports.ActionChip=p,exports.ChoiceChip=u,exports.ChoiceChipGroup=function(e){var a=e.name,t=e.value,n=e.children,c=e.onChange,d=e.label,u=s(e,C),h=i.useMemo((function(){return{name:a,value:t,onChange:c}}),[a,t,c]);return i.createElement(o,{value:h},i.createElement(r.Fieldset,l({className:"eds-choice-chips-group",label:d},u),n))},exports.FilterChip=b,exports.TagChip=v; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@entur/utils"),i=require("react"),a=require("classnames"),n=require("@entur/loader"),t=require("@entur/icons"),r=require("@entur/form");function l(){return l=Object.assign?Object.assign.bind():function(e){for(var i=1;i<arguments.length;i++){var a=arguments[i];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},l.apply(null,arguments)}function s(e,i){if(null==e)return{};var a={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(i.includes(n))continue;a[n]=e[n]}return a}var c=i.createContext(null),o=c.Provider,d=["className","children","value","disabled","style","size"],u=i.forwardRef((function(e,n){var t=e.className,r=e.children,o=e.value,u=e.disabled,h=void 0!==u&&u,p=e.style,m=e.size,v=void 0===m?"medium":m,f=s(e,d),b=i.Children.toArray(r),g=function(e){var i;return null==e||null==(i=e.type)?void 0:i.toString().toLowerCase().includes("icon")},C=b.length>1&&g(b.at(0)),N=b.length>1&&g(b.at(-1)),y=a(t,"eds-chip","eds-chip--size-"+v,{"eds-chip--disabled":h,"eds-chip--leading-icon":C,"eds-chip--trailing-icon":N}),E=function(){var e=i.useContext(c);if(!e)throw new Error("You need to wrap your ChoiceChips in a ChoiceChipGroup-component");return e}();return i.createElement("label",{className:"eds-choice-chip",style:p},i.createElement("input",l({className:"eds-choice-chip__input",type:"radio",name:E.name,ref:n,value:o,disabled:h,checked:E.value===o,onChange:E.onChange,"aria-disabled":h},f)),i.createElement("div",{className:y},r))})),h=["children","className","loading","size"],p=i.forwardRef((function(e,t){var r=e.children,c=e.className,o=e.loading,d=void 0!==o&&o,u=e.size,p=void 0===u?"medium":u,m=s(e,h),v=i.Children.toArray(r),f=function(e){var i;return null==e||null==(i=e.type)?void 0:i.toString().toLowerCase().includes("icon")},b=v.length>1&&f(v.at(0)),g=v.length>1&&f(v.at(-1)),C=v.filter((function(e){return"string"==typeof e})).join(" "),N=a(c,"eds-chip","eds-action-chip","eds-chip--size-"+p,{"eds-chip--leading-icon":b,"eds-chip--trailing-icon":g,"eds-action-chip--disabled":m.disabled}),y=i.createElement("button",l({className:N,ref:t,"aria-busy":d,"aria-label":m["aria-label"]?m["aria-label"]:d?C:void 0,type:"button"},m),d?i.createElement(n.LoadingDots,{className:"eds-action-chip__loading-dots"}):r);return m.disabled?i.createElement("div",{className:"eds-action-chip--disabled__wrapper"},y):i.createElement(i.Fragment,null,y)})),m=["children","className","onClose","closeButtonAriaLabel","size"],v=i.forwardRef((function(e,n){var r=e.children,c=e.className,o=e.onClose,d=e.closeButtonAriaLabel,u=e.size,h=void 0===u?"medium":u,p=s(e,m),v=null!=d?d:"Fjern "+(null==r?void 0:r.toString());return i.createElement("div",l({className:a("eds-chip","eds-tag-chip","eds-chip--size-"+h,c)},p),r,i.createElement("button",{className:"eds-tag-chip__close-button",type:"button",onClick:o,"aria-label":v,ref:n},i.createElement(t.CloseSmallIcon,{"aria-hidden":!0})))})),f=["className","children","value","disabled","name","style","size"],b=i.forwardRef((function(e,n){var t=e.className,r=e.children,c=e.value,o=e.disabled,d=void 0!==o&&o,u=e.name,h=e.style,p=e.size,m=void 0===p?"medium":p,v=s(e,f),b=a(t,"eds-filter-chip");return i.createElement("label",{className:b,style:h},i.createElement("input",l({className:"eds-filter-chip__input",type:"checkbox",name:u,ref:n,value:c,disabled:d},v)),i.createElement("div",{className:"eds-chip "+(m?"eds-chip--size-"+m:"")},i.createElement("span",{className:"eds-filter-chip__icon"},i.createElement(g,null)),r))})),g=function(){return i.createElement("svg",{className:"eds-filter-chip-icon",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.createElement("path",{className:"eds-filter-chip-icon__path",d:"M1.71283 7.10801L5.6464 11.1377C5.84098 11.3371 6.16095 11.339 6.35786 11.1419L14.2916 3.20325",stroke:"#181C56",strokeWidth:"2"}))},C=["name","value","children","onChange","label"];e.warnAboutMissingStyles("chip","form"),exports.ActionChip=p,exports.ChoiceChip=u,exports.ChoiceChipGroup=function(e){var a=e.name,n=e.value,t=e.children,c=e.onChange,d=e.label,u=s(e,C),h=i.useMemo((function(){return{name:a,value:n,onChange:c}}),[a,n,c]);return i.createElement(o,{value:h},i.createElement(r.Fieldset,l({className:"eds-choice-chips-group",label:d},u),t))},exports.FilterChip=b,exports.TagChip=v; | ||
//# sourceMappingURL=chip.cjs.production.min.js.map |
@@ -9,26 +9,18 @@ import { warnAboutMissingStyles } from '@entur/utils'; | ||
function _extends() { | ||
_extends = Object.assign ? Object.assign.bind() : 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 _extends = Object.assign ? Object.assign.bind() : function (n) { | ||
for (var e = 1; e < arguments.length; e++) { | ||
var t = arguments[e]; | ||
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
return n; | ||
}, _extends.apply(null, 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]; | ||
function _objectWithoutPropertiesLoose(r, e) { | ||
if (null == r) return {}; | ||
var t = {}; | ||
for (var n in r) if ({}.hasOwnProperty.call(r, n)) { | ||
if (e.includes(n)) continue; | ||
t[n] = r[n]; | ||
} | ||
return target; | ||
return t; | ||
} | ||
@@ -60,3 +52,3 @@ | ||
var _child$type; | ||
return child == null ? void 0 : (_child$type = child.type) == null ? void 0 : _child$type.toString().toLowerCase().includes('icon'); | ||
return child == null || (_child$type = child.type) == null ? void 0 : _child$type.toString().toLowerCase().includes('icon'); | ||
}; | ||
@@ -104,3 +96,3 @@ var hasLeadingIcon = childrenArray.length > 1 && isIcon(childrenArray.at(0)); | ||
var _child$type; | ||
return child == null ? void 0 : (_child$type = child.type) == null ? void 0 : _child$type.toString().toLowerCase().includes('icon'); | ||
return child == null || (_child$type = child.type) == null ? void 0 : _child$type.toString().toLowerCase().includes('icon'); | ||
}; | ||
@@ -107,0 +99,0 @@ var hasLeadingIcon = childrenArray.length > 1 && isIcon(childrenArray.at(0)); |
@@ -18,3 +18,3 @@ import React from 'react'; | ||
/** Ekstra klassenavn */ | ||
className?: string | undefined; | ||
className?: string; | ||
/** Label til FilterChip */ | ||
@@ -27,3 +27,3 @@ children?: React.ReactNode; | ||
*/ | ||
size?: "small" | "medium" | undefined; | ||
size?: "small" | "medium"; | ||
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "size"> & React.RefAttributes<HTMLInputElement>>; |
{ | ||
"name": "@entur/chip", | ||
"version": "0.7.26", | ||
"version": "0.7.27-RC.0", | ||
"license": "EUPL-1.2", | ||
@@ -30,10 +30,13 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@entur/form": "^8.1.8", | ||
"@entur/icons": "^7.5.0", | ||
"@entur/loader": "^0.5.14", | ||
"@entur/tokens": "^3.17.3", | ||
"@entur/utils": "^0.12.1", | ||
"@entur/form": "^8.1.9-RC.0", | ||
"@entur/icons": "^7.5.1-RC.0", | ||
"@entur/loader": "^0.5.15-RC.0", | ||
"@entur/tokens": "^3.17.4-RC.0", | ||
"@entur/utils": "^0.12.2-RC.0", | ||
"classnames": "^2.3.1" | ||
}, | ||
"gitHead": "5c9836f2bcab799e31cc52b6fe72c6e198947a71" | ||
"devDependencies": { | ||
"dts-cli": "2.0.5" | ||
}, | ||
"gitHead": "d7913682a41ade219cbd4dfc6e45060152c7fa0a" | ||
} |
@@ -5,3 +5,3 @@ # chip | ||
> 💡 Looking for the [documentation](https://design.entur.no/komponenter/skjemaelementer/chips)? | ||
> 💡 Looking for the [documentation](https://design.entur.no/komponenter/skjemaelementer/chip)? | ||
@@ -18,2 +18,2 @@ ## Installation | ||
Please refer to the [documentation](https://design.entur.no/komponenter/skjemaelementer/chips) for usage information. | ||
Please refer to the [documentation](https://design.entur.no/komponenter/skjemaelementer/chip) for usage information. |
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
120513
1
1260
Updated@entur/form@^8.1.9-RC.0
Updated@entur/icons@^7.5.1-RC.0
Updated@entur/loader@^0.5.15-RC.0
Updated@entur/tokens@^3.17.4-RC.0
Updated@entur/utils@^0.12.2-RC.0