@elvia/elvis-chip
Advanced tools
Comparing version 2.2.8 to 2.2.9
@@ -5,2 +5,12 @@ { | ||
{ | ||
"date": "29.11.22", | ||
"version": "2.2.9", | ||
"changelog": [ | ||
{ | ||
"type": "patch", | ||
"changes": ["The component config has been moved into each component."] | ||
} | ||
] | ||
}, | ||
{ | ||
"date": "23.11.22", | ||
@@ -7,0 +17,0 @@ "version": "2.2.8", |
import { ComponentConfig } from '@elvia/elvis-toolbox'; | ||
declare const config: ComponentConfig; | ||
export default config; | ||
export declare const config: ComponentConfig; |
@@ -5,5 +5,4 @@ /* | ||
*/ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var config={componentName:"Chip",deprecatedProps:{// Rule 1.3: Better naming for booleans | ||
disabled:{version:"2.0.0",newProp:"isDisabled",isDirectReplacement:!0},// Rule 1.3: Better naming for booleans | ||
selected:{version:"2.0.0",newProp:"isSelected",isDirectReplacement:!0},valueOnChange:{version:"2.0.0",newProp:"isSelectedOnChange",isCallbackFunction:!0}}},_default=config;exports.default=_default; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.config=void 0;var config={name:"Chip",attributes:[{name:"ariaLabel",type:"string"},{name:"color",type:"string"},{name:"isDisabled",type:"boolean"},{name:"type",type:"string"},{name:"isLoading",type:"boolean"},{name:"isSelected",type:"boolean"},{name:"value",type:"string"},{name:"className",type:"string"},{name:"inlineStyle",type:"object"},// Deprecated attributes | ||
{name:"disabled",type:"boolean",deprecatedDetails:{version:"2.0.0",newProp:"isDisabled",isDirectReplacement:!0}},{name:"selected",type:"boolean",deprecatedDetails:{version:"2.0.0",newProp:"isSelected",isDirectReplacement:!0}},{name:"valueOnChange",type:"event",deprecatedDetails:{version:"2.0.0",newProp:"isSelectedOnChange",isCallbackFunction:!0}}]};exports.config=config; | ||
//# sourceMappingURL=config.js.map |
@@ -5,4 +5,4 @@ /* | ||
*/ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Chip=void 0;var _react=_interopRequireDefault(require("react")),_styledComponents=require("./styledComponents"),_react2=require("@elvia/elvis-icon/react"),_interactions=require("@react-aria/interactions"),_elvisColors=require("@elvia/elvis-colors"),_elvisToolbox=require("@elvia/elvis-toolbox"),_config=_interopRequireDefault(require("./config")),_excluded=["ariaLabel","color","isDisabled","isSelected","isLoading","type","value","onDelete","isSelectedOnChange","className","inlineStyle","webcomponent"];function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _extends(){return _extends=Object.assign?Object.assign.bind():function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _iterableToArrayLimit(a,b){var c=null==a?null:"undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){var d,e,f=[],g=!0,h=!1;try{for(c=c.call(a);!(g=(d=c.next()).done)&&(f.push(d.value),!(b&&f.length===b));g=!0);}catch(a){h=!0,e=a}finally{try{g||null==c["return"]||c["return"]()}finally{if(h)throw e}}return f}}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}var Chip=function(a){var b=a.ariaLabel,c=a.color,d=void 0===c?"green":c,e=a.isDisabled,f=void 0!==e&&e,g=a.isSelected,h=a.isLoading,i=void 0!==h&&h,j=a.type,k=void 0===j?"removable":j,l=a.value,m=a.onDelete,n=a.isSelectedOnChange,o=a.className,p=a.inlineStyle,q=a.webcomponent,r=_objectWithoutProperties(a,_excluded);(0,_elvisToolbox.warnDeprecatedProps)(_config.default,arguments[0]);var s=(0,_elvisToolbox.useWebComponentState)(void 0!==g&&g,"isSelected",q,n),t=_slicedToArray(s,2),u=t[0],v=t[1],w=function(a){q?q&&q.triggerEvent("onDelete",a):m&&m(a)},x=(0,_interactions.useHover)({}),y=x.hoverProps,z=x.isHovered;return/*#__PURE__*/_react.default.createElement(_styledComponents.ChipComponent,_extends({},y,{// Handles hover / onMouseEnter / onMouseLeave logic | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.Chip=void 0;var _react=_interopRequireDefault(require("react")),_styledComponents=require("./styledComponents"),_react2=require("@elvia/elvis-icon/react"),_interactions=require("@react-aria/interactions"),_elvisColors=require("@elvia/elvis-colors"),_elvisToolbox=require("@elvia/elvis-toolbox"),_config=require("./config"),_excluded=["ariaLabel","color","isDisabled","isSelected","isLoading","type","value","onDelete","isSelectedOnChange","className","inlineStyle","webcomponent"];function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _extends(){return _extends=Object.assign?Object.assign.bind():function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _iterableToArrayLimit(a,b){var c=null==a?null:"undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){var d,e,f=[],g=!0,h=!1;try{for(c=c.call(a);!(g=(d=c.next()).done)&&(f.push(d.value),!(b&&f.length===b));g=!0);}catch(a){h=!0,e=a}finally{try{g||null==c["return"]||c["return"]()}finally{if(h)throw e}}return f}}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}var Chip=function(a){var b=a.ariaLabel,c=a.color,d=void 0===c?"green":c,e=a.isDisabled,f=void 0!==e&&e,g=a.isSelected,h=a.isLoading,i=void 0!==h&&h,j=a.type,k=void 0===j?"removable":j,l=a.value,m=a.onDelete,n=a.isSelectedOnChange,o=a.className,p=a.inlineStyle,q=a.webcomponent,r=_objectWithoutProperties(a,_excluded);(0,_elvisToolbox.warnDeprecatedProps)(_config.config,arguments[0]);var s=(0,_elvisToolbox.useWebComponentState)(void 0!==g&&g,"isSelected",q,n),t=_slicedToArray(s,2),u=t[0],v=t[1],w=function(a){q?q&&q.triggerEvent("onDelete",a):m&&m(a)},x=(0,_interactions.useHover)({}),y=x.hoverProps,z=x.isHovered;return/*#__PURE__*/_react.default.createElement(_styledComponents.ChipComponent,_extends({},y,{// Handles hover / onMouseEnter / onMouseLeave logic | ||
role:"removable"===k?void 0:"checkbox","aria-checked":"removable"===k?void 0:u,"aria-label":b,color:d,onClick:function onClick(){return"removable"===k?w(l):v(!u)},isDisabled:f,chipType:k,isSelected:u,isHovering:z,className:null!==o&&void 0!==o?o:"",isLoading:i,style:p,"data-testid":"chip-button"},r),"choice"===k&&/*#__PURE__*/_react.default.createElement(_react2.Icon,{name:"check",customSize:"12px",inlineStyle:{opacity:function decideChoiceCheckmarkIconOpacity(){return f?"0.3":z||u?"1":"0.05"}()}}),"legend"===k&&/*#__PURE__*/_react.default.createElement(_styledComponents.ChipDot,{color:d,showDot:z||u,isDisabled:f,isHidden:i}),i&&/*#__PURE__*/_react.default.createElement(_styledComponents.ChipLoading,{color:d},/*#__PURE__*/_react.default.createElement("span",null),/*#__PURE__*/_react.default.createElement("span",null),/*#__PURE__*/_react.default.createElement("span",null)),/*#__PURE__*/_react.default.createElement(_styledComponents.ChipTitle,{isDisabled:f,isHidden:i,"data-testid":"chip-label"},l),"removable"===k&&/*#__PURE__*/_react.default.createElement(_react2.Icon,{name:"close",size:"xxs",color:f?(0,_elvisColors.getColor)("disabled"):void 0}))};exports.Chip=Chip;var _default=Chip;exports.default=_default; | ||
//# sourceMappingURL=elvia-chip.js.map |
@@ -9,7 +9,7 @@ /* | ||
static get observedAttributes() { | ||
return ["arialabel", "color", "isdisabled", "type", "isloading", "isselected", "value", "classname", "inlinestyle"]; | ||
return ["arialabel", "color", "isdisabled", "type", "isloading", "isselected", "value", "classname", "inlinestyle", "disabled", "selected"]; | ||
} | ||
static getComponentData() { | ||
return { | ||
"reactName": "Chip", | ||
"name": "Chip", | ||
"attributes": [{ | ||
@@ -42,2 +42,26 @@ "name": "ariaLabel", | ||
"type": "object" | ||
}, { | ||
"name": "disabled", | ||
"type": "boolean", | ||
"deprecatedDetails": { | ||
"version": "2.0.0", | ||
"newProp": "isDisabled", | ||
"isDirectReplacement": true | ||
} | ||
}, { | ||
"name": "selected", | ||
"type": "boolean", | ||
"deprecatedDetails": { | ||
"version": "2.0.0", | ||
"newProp": "isSelected", | ||
"isDirectReplacement": true | ||
} | ||
}, { | ||
"name": "valueOnChange", | ||
"type": "event", | ||
"deprecatedDetails": { | ||
"version": "2.0.0", | ||
"newProp": "isSelectedOnChange", | ||
"isCallbackFunction": true | ||
} | ||
}] | ||
@@ -166,2 +190,18 @@ }; | ||
} | ||
set disabled(newValue) { | ||
super.setProps({ | ||
'disabled': newValue | ||
}); | ||
} | ||
get disabled() { | ||
return super.getProps()['disabled']; | ||
} | ||
set selected(newValue) { | ||
super.setProps({ | ||
'selected': newValue | ||
}); | ||
} | ||
get selected() { | ||
return super.getProps()['selected']; | ||
} | ||
constructor() { | ||
@@ -168,0 +208,0 @@ super(ElviaComponent, ReactComponent['Chip']); |
{ | ||
"name": "@elvia/elvis-chip", | ||
"version": "2.2.8", | ||
"version": "2.2.9", | ||
"description": "", | ||
@@ -18,5 +18,5 @@ "license": "MIT", | ||
"@elvia/elvis-colors": "^1.4.2", | ||
"@elvia/elvis-component-wrapper": "^3.0.3", | ||
"@elvia/elvis-icon": "^1.3.5", | ||
"@elvia/elvis-toolbox": "^6.0.1", | ||
"@elvia/elvis-component-wrapper": "^4.0.0", | ||
"@elvia/elvis-icon": "^1.3.7", | ||
"@elvia/elvis-toolbox": "^7.0.0", | ||
"@react-aria/interactions": "^3.8.4", | ||
@@ -23,0 +23,0 @@ "styled-components": "^5.3.3" |
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
44845
19
715
- Removed@elvia/elvis-component-wrapper@3.1.0(transitive)
- Removed@elvia/elvis-toolbox@6.0.1(transitive)
Updated@elvia/elvis-icon@^1.3.7
Updated@elvia/elvis-toolbox@^7.0.0