@commercetools-uikit/icon-button 12.2.0 → 12.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -14
- package/dist/commercetools-uikit-icon-button.cjs.dev.js +52 -57
- package/dist/commercetools-uikit-icon-button.cjs.prod.js +40 -40
- package/dist/commercetools-uikit-icon-button.esm.js +41 -45
- package/dist/declarations/src/icon-button.d.ts +20 -20
- package/dist/declarations/src/icon-button.styles.d.ts +8 -8
- package/dist/declarations/src/index.d.ts +2 -2
- package/dist/declarations/src/version.d.ts +2 -2
- package/package.json +18 -15
|
@@ -12,12 +12,12 @@ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/ob
|
|
|
12
12
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
13
13
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
14
|
require('prop-types');
|
|
15
|
-
var
|
|
15
|
+
var react$1 = require('react');
|
|
16
16
|
var react = require('@emotion/react');
|
|
17
|
-
require('lodash/isNil');
|
|
18
17
|
var designSystem = require('@commercetools-uikit/design-system');
|
|
19
18
|
var utils = require('@commercetools-uikit/utils');
|
|
20
19
|
var AccessibleButton = require('@commercetools-uikit/accessible-button');
|
|
20
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
21
21
|
|
|
22
22
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
23
23
|
|
|
@@ -29,7 +29,6 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
|
|
|
29
29
|
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
30
30
|
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
31
31
|
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
32
|
-
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
33
32
|
var AccessibleButton__default = /*#__PURE__*/_interopDefault(AccessibleButton);
|
|
34
33
|
|
|
35
34
|
var buttonSizes = {
|
|
@@ -59,14 +58,14 @@ var getIconThemeColor = function getIconThemeColor(props) {
|
|
|
59
58
|
|
|
60
59
|
var getStateStyles = function getStateStyles(isDisabled, isActive, theme) {
|
|
61
60
|
if (isDisabled) {
|
|
62
|
-
var disabledStyle = /*#__PURE__*/react.css("background-color:", designSystem.customProperties.colorAccent98, ";border-color:", designSystem.customProperties.colorNeutral, ";color:", designSystem.customProperties.colorNeutral60, ";box-shadow:none;" + ("" ));
|
|
61
|
+
var disabledStyle = /*#__PURE__*/react.css("background-color:", designSystem.customProperties.colorAccent98, ";border-color:", designSystem.customProperties.colorNeutral, ";color:", designSystem.customProperties.colorNeutral60, ";box-shadow:none;" + ("" ), "" );
|
|
63
62
|
|
|
64
63
|
switch (theme) {
|
|
65
64
|
case 'info':
|
|
66
|
-
return [disabledStyle, /*#__PURE__*/react.css("&:hover{border-color:", designSystem.customProperties.colorInfo85, ";background-color:", designSystem.customProperties.colorInfo85, ";}" + ("" ))];
|
|
65
|
+
return [disabledStyle, /*#__PURE__*/react.css("&:hover{border-color:", designSystem.customProperties.colorInfo85, ";background-color:", designSystem.customProperties.colorInfo85, ";}" + ("" ), "" )];
|
|
67
66
|
|
|
68
67
|
case 'primary':
|
|
69
|
-
return [disabledStyle, /*#__PURE__*/react.css("&:hover{border-color:", designSystem.customProperties.colorPrimary85, ";background-color:", designSystem.customProperties.colorPrimary85, ";}" + ("" ))];
|
|
68
|
+
return [disabledStyle, /*#__PURE__*/react.css("&:hover{border-color:", designSystem.customProperties.colorPrimary85, ";background-color:", designSystem.customProperties.colorPrimary85, ";}" + ("" ), "" )];
|
|
70
69
|
|
|
71
70
|
default:
|
|
72
71
|
return disabledStyle;
|
|
@@ -74,7 +73,7 @@ var getStateStyles = function getStateStyles(isDisabled, isActive, theme) {
|
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
if (isActive) {
|
|
77
|
-
var activeStyle = /*#__PURE__*/react.css("box-shadow:", designSystem.customProperties.shadow9, ";background-color:", designSystem.customProperties.colorSurface, ";border-color:", designSystem.customProperties.colorSurface, ";&:hover{box-shadow:", designSystem.customProperties.shadow9, ";background-color:", designSystem.customProperties.colorNeutral95, ";border-color:", designSystem.customProperties.colorNeutral95, ";}" + ("" ));
|
|
76
|
+
var activeStyle = /*#__PURE__*/react.css("box-shadow:", designSystem.customProperties.shadow9, ";background-color:", designSystem.customProperties.colorSurface, ";border-color:", designSystem.customProperties.colorSurface, ";&:hover{box-shadow:", designSystem.customProperties.shadow9, ";background-color:", designSystem.customProperties.colorNeutral95, ";border-color:", designSystem.customProperties.colorNeutral95, ";}" + ("" ), "" );
|
|
78
77
|
|
|
79
78
|
switch (theme) {
|
|
80
79
|
case 'info':
|
|
@@ -82,19 +81,19 @@ var getStateStyles = function getStateStyles(isDisabled, isActive, theme) {
|
|
|
82
81
|
/*#__PURE__*/
|
|
83
82
|
// When the button is active and somehow is disabled it should have
|
|
84
83
|
// a different color to indicate that it's active but can't receive any actions
|
|
85
|
-
react.css("background-color:", designSystem.customProperties.colorInfo85, ";border-color:", designSystem.customProperties.colorInfo85, ";color:", designSystem.customProperties.colorSurface, ";box-shadow:", designSystem.customProperties.shadow9, ";" + ("" )), /*#__PURE__*/react.css("background-color:", designSystem.customProperties.colorInfo, ";border-color:", designSystem.customProperties.colorInfo, ";color:", designSystem.customProperties.colorSurface, ";&:hover{background-color:", designSystem.customProperties.colorInfo85, ";border-color:", designSystem.customProperties.colorInfo85, ";}" + ("" ))];
|
|
84
|
+
react.css("background-color:", designSystem.customProperties.colorInfo85, ";border-color:", designSystem.customProperties.colorInfo85, ";color:", designSystem.customProperties.colorSurface, ";box-shadow:", designSystem.customProperties.shadow9, ";" + ("" ), "" ), /*#__PURE__*/react.css("background-color:", designSystem.customProperties.colorInfo, ";border-color:", designSystem.customProperties.colorInfo, ";color:", designSystem.customProperties.colorSurface, ";&:hover{background-color:", designSystem.customProperties.colorInfo85, ";border-color:", designSystem.customProperties.colorInfo85, ";}" + ("" ), "" )];
|
|
86
85
|
|
|
87
86
|
case 'primary':
|
|
88
87
|
return [activeStyle, // When the button is active and somehow is disabled it should have
|
|
89
88
|
// a different color to indicate that it's active but can't receive any actions
|
|
90
|
-
isDisabled && /*#__PURE__*/react.css("background-color:", designSystem.customProperties.colorPrimary85, ";border-color:", designSystem.customProperties.colorPrimary85, ";color:", designSystem.customProperties.colorSurface, ";box-shadow:", designSystem.customProperties.shadow9, ";" + ("" )), /*#__PURE__*/react.css("background-color:", designSystem.customProperties.colorPrimary, ";color:", designSystem.customProperties.colorSurface, ";&:hover{background-color:", designSystem.customProperties.colorPrimary85, ";border-color:", designSystem.customProperties.colorPrimary85, ";}" + ("" ))];
|
|
89
|
+
isDisabled && /*#__PURE__*/react.css("background-color:", designSystem.customProperties.colorPrimary85, ";border-color:", designSystem.customProperties.colorPrimary85, ";color:", designSystem.customProperties.colorSurface, ";box-shadow:", designSystem.customProperties.shadow9, ";" + ("" ), "" ), /*#__PURE__*/react.css("background-color:", designSystem.customProperties.colorPrimary, ";color:", designSystem.customProperties.colorSurface, ";&:hover{background-color:", designSystem.customProperties.colorPrimary85, ";border-color:", designSystem.customProperties.colorPrimary85, ";}" + ("" ), "" )];
|
|
91
90
|
|
|
92
91
|
default:
|
|
93
92
|
return activeStyle;
|
|
94
93
|
}
|
|
95
94
|
}
|
|
96
95
|
|
|
97
|
-
return /*#__PURE__*/react.css("&:hover{box-shadow:", designSystem.customProperties.shadow8, ";}&:active{box-shadow:", designSystem.customProperties.shadow9, ";background-color:", designSystem.customProperties.colorSurface, ";border-color:", designSystem.customProperties.colorSurface, ";}" + ("" ));
|
|
96
|
+
return /*#__PURE__*/react.css("&:hover{box-shadow:", designSystem.customProperties.shadow8, ";}&:active{box-shadow:", designSystem.customProperties.shadow9, ";background-color:", designSystem.customProperties.colorSurface, ";border-color:", designSystem.customProperties.colorSurface, ";}" + ("" ), "" );
|
|
98
97
|
};
|
|
99
98
|
|
|
100
99
|
var _ref = {
|
|
@@ -110,65 +109,65 @@ var getShapeStyles = function getShapeStyles(shape, size) {
|
|
|
110
109
|
case 'square':
|
|
111
110
|
switch (size) {
|
|
112
111
|
case 'small':
|
|
113
|
-
return /*#__PURE__*/react.css("border-radius:", designSystem.customProperties.borderRadius2, ";" + ("" ));
|
|
112
|
+
return /*#__PURE__*/react.css("border-radius:", designSystem.customProperties.borderRadius2, ";" + ("" ), "" );
|
|
114
113
|
|
|
115
114
|
case 'medium':
|
|
116
|
-
return /*#__PURE__*/react.css("border-radius:", designSystem.customProperties.borderRadius4, ";" + ("" ));
|
|
115
|
+
return /*#__PURE__*/react.css("border-radius:", designSystem.customProperties.borderRadius4, ";" + ("" ), "" );
|
|
117
116
|
|
|
118
117
|
case 'big':
|
|
119
|
-
return /*#__PURE__*/react.css("border-radius:", designSystem.customProperties.borderRadius6, ";" + ("" ));
|
|
118
|
+
return /*#__PURE__*/react.css("border-radius:", designSystem.customProperties.borderRadius6, ";" + ("" ), "" );
|
|
120
119
|
|
|
121
120
|
default:
|
|
122
|
-
return /*#__PURE__*/react.css("" );
|
|
121
|
+
return /*#__PURE__*/react.css("" , "" );
|
|
123
122
|
}
|
|
124
123
|
|
|
125
124
|
default:
|
|
126
|
-
return /*#__PURE__*/react.css("" );
|
|
125
|
+
return /*#__PURE__*/react.css("" , "" );
|
|
127
126
|
}
|
|
128
127
|
};
|
|
129
128
|
|
|
130
129
|
var getSizeStyles = function getSizeStyles(size) {
|
|
131
130
|
switch (size) {
|
|
132
131
|
case 'small':
|
|
133
|
-
return /*#__PURE__*/react.css("height:", buttonSizes.small, ";width:", buttonSizes.small, ";" + ("" ));
|
|
132
|
+
return /*#__PURE__*/react.css("height:", buttonSizes.small, ";width:", buttonSizes.small, ";" + ("" ), "" );
|
|
134
133
|
|
|
135
134
|
case 'medium':
|
|
136
|
-
return /*#__PURE__*/react.css("height:", buttonSizes.medium, ";width:", buttonSizes.medium, ";" + ("" ));
|
|
135
|
+
return /*#__PURE__*/react.css("height:", buttonSizes.medium, ";width:", buttonSizes.medium, ";" + ("" ), "" );
|
|
137
136
|
|
|
138
137
|
case 'big':
|
|
139
|
-
return /*#__PURE__*/react.css("height:", buttonSizes.big, ";width:", buttonSizes.big, ";" + ("" ));
|
|
138
|
+
return /*#__PURE__*/react.css("height:", buttonSizes.big, ";width:", buttonSizes.big, ";" + ("" ), "" );
|
|
140
139
|
|
|
141
140
|
default:
|
|
142
|
-
return /*#__PURE__*/react.css("" );
|
|
141
|
+
return /*#__PURE__*/react.css("" , "" );
|
|
143
142
|
}
|
|
144
143
|
};
|
|
145
144
|
|
|
146
145
|
var getThemeStyles = function getThemeStyles(theme) {
|
|
147
|
-
if (!theme) return /*#__PURE__*/react.css("" );
|
|
148
|
-
if (theme === 'default') return /*#__PURE__*/react.css("" );
|
|
146
|
+
if (!theme) return /*#__PURE__*/react.css("" , "" );
|
|
147
|
+
if (theme === 'default') return /*#__PURE__*/react.css("" , "" );
|
|
149
148
|
|
|
150
149
|
switch (theme) {
|
|
151
150
|
case 'primary':
|
|
152
|
-
return /*#__PURE__*/react.css("&:hover{background-color:", designSystem.customProperties.colorPrimary, ";border-color:", designSystem.customProperties.colorPrimary, ";color:", designSystem.customProperties.colorSurface, ";}" + ("" ));
|
|
151
|
+
return /*#__PURE__*/react.css("&:hover{background-color:", designSystem.customProperties.colorPrimary, ";border-color:", designSystem.customProperties.colorPrimary, ";color:", designSystem.customProperties.colorSurface, ";}" + ("" ), "" );
|
|
153
152
|
|
|
154
153
|
case 'info':
|
|
155
|
-
return /*#__PURE__*/react.css("&:hover{background-color:", designSystem.customProperties.colorInfo, ";border-color:", designSystem.customProperties.colorInfo, ";color:", designSystem.customProperties.colorSurface, ";}" + ("" ));
|
|
154
|
+
return /*#__PURE__*/react.css("&:hover{background-color:", designSystem.customProperties.colorInfo, ";border-color:", designSystem.customProperties.colorInfo, ";color:", designSystem.customProperties.colorSurface, ";}" + ("" ), "" );
|
|
156
155
|
|
|
157
156
|
default:
|
|
158
157
|
{
|
|
159
|
-
return /*#__PURE__*/react.css("" );
|
|
158
|
+
return /*#__PURE__*/react.css("" , "" );
|
|
160
159
|
}
|
|
161
160
|
}
|
|
162
161
|
};
|
|
163
162
|
|
|
164
163
|
var getHoverStyles = function getHoverStyles(isDisabled, theme) {
|
|
165
|
-
if (theme === 'default' || isDisabled) return /*#__PURE__*/react.css("" );
|
|
166
|
-
return /*#__PURE__*/react.css("&:hover{*{fill:", designSystem.customProperties.colorSurface, ";}}" + ("" ));
|
|
164
|
+
if (theme === 'default' || isDisabled) return /*#__PURE__*/react.css("" , "" );
|
|
165
|
+
return /*#__PURE__*/react.css("&:hover{*{fill:", designSystem.customProperties.colorSurface, ";}}" + ("" ), "" );
|
|
167
166
|
};
|
|
168
167
|
|
|
169
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
168
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
170
169
|
|
|
171
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default[
|
|
170
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
172
171
|
var defaultProps = {
|
|
173
172
|
type: 'button',
|
|
174
173
|
theme: 'default',
|
|
@@ -178,35 +177,36 @@ var defaultProps = {
|
|
|
178
177
|
};
|
|
179
178
|
|
|
180
179
|
var IconButton = function IconButton(props) {
|
|
181
|
-
if (props.isToggleButton) ; // the type defaults to `button`, so we don't need to handle undefined
|
|
182
180
|
|
|
183
|
-
var
|
|
181
|
+
var buttonAttributes = _objectSpread({
|
|
184
182
|
'data-track-component': 'IconButton'
|
|
185
183
|
}, utils.filterInvalidAttributes(props));
|
|
186
184
|
|
|
187
185
|
var isActive = Boolean(props.isToggleButton && props.isToggled);
|
|
188
|
-
return
|
|
186
|
+
return jsxRuntime.jsx(AccessibleButton__default["default"], {
|
|
189
187
|
as: props.as,
|
|
190
|
-
buttonAttributes:
|
|
188
|
+
buttonAttributes: buttonAttributes,
|
|
191
189
|
type: props.type,
|
|
192
190
|
label: props.label,
|
|
193
191
|
onClick: props.onClick,
|
|
194
192
|
isToggleButton: props.isToggleButton,
|
|
195
193
|
isToggled: props.isToggled,
|
|
196
194
|
isDisabled: props.isDisabled,
|
|
197
|
-
css: [/*#__PURE__*/react.css("width:100%;height:100%;display:flex;align-items:center;justify-content:center;border:1px solid ", designSystem.customProperties.colorSurface, ";background-color:", designSystem.customProperties.colorSurface, ";box-shadow:", designSystem.customProperties.shadow7, ";color:", designSystem.customProperties.colorSolid, ";transition:background-color ", designSystem.customProperties.transitionLinear80Ms, ",box-shadow 150ms ease-in-out;" + ("" )), getStateStyles(props.isDisabled, isActive, props.theme), getShapeStyles(props.shape, props.size), getSizeStyles(props.size), getThemeStyles(props.theme), getHoverStyles(props.isDisabled, props.theme), "" ]
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
195
|
+
css: [/*#__PURE__*/react.css("width:100%;height:100%;display:flex;align-items:center;justify-content:center;border:1px solid ", designSystem.customProperties.colorSurface, ";background-color:", designSystem.customProperties.colorSurface, ";box-shadow:", designSystem.customProperties.shadow7, ";color:", designSystem.customProperties.colorSolid, ";transition:background-color ", designSystem.customProperties.transitionLinear80Ms, ",box-shadow 150ms ease-in-out;" + ("" ), "" ), getStateStyles(props.isDisabled, isActive, props.theme), getShapeStyles(props.shape, props.size), getSizeStyles(props.size), getThemeStyles(props.theme), getHoverStyles(props.isDisabled, props.theme), "" , "" ],
|
|
196
|
+
children: props.icon && /*#__PURE__*/react$1.cloneElement(props.icon, {
|
|
197
|
+
size: props.size,
|
|
198
|
+
color: getIconThemeColor(props)
|
|
199
|
+
})
|
|
200
|
+
});
|
|
202
201
|
};
|
|
203
202
|
|
|
204
203
|
IconButton.propTypes = {};
|
|
205
204
|
IconButton.defaultProps = defaultProps;
|
|
206
205
|
IconButton.displayName = 'IconButton';
|
|
206
|
+
var IconButton$1 = IconButton;
|
|
207
207
|
|
|
208
|
-
// NOTE: This string will be replaced
|
|
209
|
-
var version =
|
|
208
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
209
|
+
var version = "12.2.5";
|
|
210
210
|
|
|
211
|
-
exports
|
|
211
|
+
exports["default"] = IconButton$1;
|
|
212
212
|
exports.version = version;
|