@zohodesk/icons 1.3.9 → 1.3.11
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 +9 -1
- package/assets/fonts/zd-rGeneral.svg +1 -0
- package/assets/fonts/zd-rGeneral.woff +0 -0
- package/assets/fonts/zd-rGeneral.woff2 +0 -0
- package/assets/react/zd-font-rGeneral.module.css +6 -3
- package/cbt.config.js +1 -1
- package/es/Context/__tests__/__snapshots__/IconContext.spec.js.snap +11 -11
- package/es/Icon/FontFactory.js +2 -1
- package/es/Icon/FontIcon.js +3 -3
- package/es/Icon/SvgIcon.js +1 -1
- package/es/Icon/__tests__/Icon.spec.js +15 -0
- package/es/Icon/__tests__/__snapshots__/FontIcon.spec.js.snap +21 -21
- package/es/Icon/__tests__/__snapshots__/Icon.spec.js.snap +37876 -0
- package/es/Icon/__tests__/__snapshots__/SvgIcon.spec.js.snap +12 -12
- package/es/Icon/iconCssModules.js +197 -0
- package/es/Icon/index.js +1 -197
- package/lib/Context/__tests__/__snapshots__/IconContext.spec.js.snap +11 -11
- package/lib/Icon/FontFactory.js +1 -1
- package/lib/Icon/FontIcon.js +3 -3
- package/lib/Icon/SvgIcon.js +1 -1
- package/lib/Icon/__tests__/Icon.spec.js +38 -0
- package/lib/Icon/__tests__/__snapshots__/FontIcon.spec.js.snap +21 -21
- package/lib/Icon/__tests__/__snapshots__/Icon.spec.js.snap +37876 -0
- package/lib/Icon/__tests__/__snapshots__/SvgIcon.spec.js.snap +12 -12
- package/lib/Icon/iconCssModules.js +205 -0
- package/lib/Icon/index.js +4 -198
- package/package.json +2 -2
package/lib/Icon/SvgIcon.js
CHANGED
|
@@ -37,7 +37,7 @@ function SvgIcon(_ref) {
|
|
|
37
37
|
var fontStyle = size ? {
|
|
38
38
|
'--zd-iconfont-size': 'var(--zd_font_size' + size + ')'
|
|
39
39
|
} : _constants.DUMMY_OBJECT;
|
|
40
|
-
var className = "".concat(_IconModule["default"].svgIcon, " ").concat(
|
|
40
|
+
var className = "".concat(_IconModule["default"].svgIcon, " ").concat(onClick ? _IconModule["default"].cursor : '', " ").concat(iconClass ? iconClass : '');
|
|
41
41
|
return /*#__PURE__*/_react["default"].createElement("svg", _extends({
|
|
42
42
|
className: className,
|
|
43
43
|
onClick: onClick,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
|
|
5
|
+
var _react2 = require("@testing-library/react");
|
|
6
|
+
|
|
7
|
+
var _index = _interopRequireDefault(require("../index"));
|
|
8
|
+
|
|
9
|
+
var _FontFactory = require("../FontFactory");
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
+
|
|
13
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
14
|
+
|
|
15
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
+
|
|
17
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
+
|
|
19
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
20
|
+
|
|
21
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
22
|
+
|
|
23
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
24
|
+
|
|
25
|
+
var iconNames = _toConsumableArray(new Set(Object.values(_FontFactory.FontFactory).flatMap(function (group) {
|
|
26
|
+
return Object.keys(group);
|
|
27
|
+
}))).sort();
|
|
28
|
+
|
|
29
|
+
describe('Icon - FontFactory names', function () {
|
|
30
|
+
test.each(iconNames)('renders "%s"', function (name) {
|
|
31
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_index["default"], {
|
|
32
|
+
name: name
|
|
33
|
+
})),
|
|
34
|
+
asFragment = _render.asFragment;
|
|
35
|
+
|
|
36
|
+
expect(asFragment()).toMatchSnapshot();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -4,7 +4,7 @@ exports[`FontIcon - checking "isBold" is false 1`] = `
|
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<i
|
|
6
6
|
aria-hidden="true"
|
|
7
|
-
class="zd_font_icons basic
|
|
7
|
+
class="zd_font_icons basic"
|
|
8
8
|
data-id="fontIcon"
|
|
9
9
|
data-selector-id="fontIcon"
|
|
10
10
|
data-test-id="fontIcon"
|
|
@@ -16,7 +16,7 @@ exports[`FontIcon - checking "isBold" is true 1`] = `
|
|
|
16
16
|
<DocumentFragment>
|
|
17
17
|
<i
|
|
18
18
|
aria-hidden="true"
|
|
19
|
-
class="zd_font_icons basic
|
|
19
|
+
class="zd_font_icons basic fbold"
|
|
20
20
|
data-id="fontIcon"
|
|
21
21
|
data-selector-id="fontIcon"
|
|
22
22
|
data-test-id="fontIcon"
|
|
@@ -28,7 +28,7 @@ exports[`FontIcon - rendering "IconName" 1`] = `
|
|
|
28
28
|
<DocumentFragment>
|
|
29
29
|
<i
|
|
30
30
|
aria-hidden="true"
|
|
31
|
-
class="zd_font_icons basic
|
|
31
|
+
class="zd_font_icons basic"
|
|
32
32
|
data-id="fontIcon"
|
|
33
33
|
data-selector-id="fontIcon"
|
|
34
34
|
data-test-id="fontIcon"
|
|
@@ -40,19 +40,19 @@ exports[`FontIcon - rendering "Name" with "iconContent" and without path 1`] =
|
|
|
40
40
|
<DocumentFragment>
|
|
41
41
|
<i
|
|
42
42
|
aria-hidden="true"
|
|
43
|
-
class="zd_font_icons basic
|
|
43
|
+
class="zd_font_icons basic"
|
|
44
44
|
data-id="fontIcon"
|
|
45
45
|
data-selector-id="fontIcon"
|
|
46
46
|
data-test-id="fontIcon"
|
|
47
47
|
>
|
|
48
48
|
<span
|
|
49
|
-
class="icon1
|
|
49
|
+
class="icon1"
|
|
50
50
|
/>
|
|
51
51
|
<span
|
|
52
|
-
class="icon2
|
|
52
|
+
class="icon2"
|
|
53
53
|
/>
|
|
54
54
|
<span
|
|
55
|
-
class="icon3
|
|
55
|
+
class="icon3"
|
|
56
56
|
/>
|
|
57
57
|
</i>
|
|
58
58
|
</DocumentFragment>
|
|
@@ -62,7 +62,7 @@ exports[`FontIcon - rendering "ariaHidden" is false 1`] = `
|
|
|
62
62
|
<DocumentFragment>
|
|
63
63
|
<i
|
|
64
64
|
aria-hidden="false"
|
|
65
|
-
class="zd_font_icons basic
|
|
65
|
+
class="zd_font_icons basic"
|
|
66
66
|
data-id="fontIcon"
|
|
67
67
|
data-selector-id="fontIcon"
|
|
68
68
|
data-test-id="fontIcon"
|
|
@@ -74,7 +74,7 @@ exports[`FontIcon - rendering "custumIcon" with path 1`] = `
|
|
|
74
74
|
<DocumentFragment>
|
|
75
75
|
<i
|
|
76
76
|
aria-hidden="true"
|
|
77
|
-
class="zd_font_icons basic
|
|
77
|
+
class="zd_font_icons red basic"
|
|
78
78
|
data-id="fontIcon"
|
|
79
79
|
data-selector-id="fontIcon"
|
|
80
80
|
data-test-id="fontIcon"
|
|
@@ -93,7 +93,7 @@ exports[`FontIcon - rendering "iconClass" with path 1`] = `
|
|
|
93
93
|
<DocumentFragment>
|
|
94
94
|
<i
|
|
95
95
|
aria-hidden="true"
|
|
96
|
-
class="zd_font_icons basic
|
|
96
|
+
class="zd_font_icons basic iconStyleCss"
|
|
97
97
|
data-id="fontIcon"
|
|
98
98
|
data-selector-id="fontIcon"
|
|
99
99
|
data-test-id="fontIcon"
|
|
@@ -115,7 +115,7 @@ exports[`FontIcon - rendering custom attributes with tagAttributes prop 1`] = `
|
|
|
115
115
|
<DocumentFragment>
|
|
116
116
|
<i
|
|
117
117
|
aria-hidden="true"
|
|
118
|
-
class="zd_font_icons basic
|
|
118
|
+
class="zd_font_icons basic"
|
|
119
119
|
data-custom-attr="true"
|
|
120
120
|
data-id="fontIcon"
|
|
121
121
|
data-selector-id="fontIcon"
|
|
@@ -128,7 +128,7 @@ exports[`FontIcon - rendering custom icon name 1`] = `
|
|
|
128
128
|
<DocumentFragment>
|
|
129
129
|
<i
|
|
130
130
|
aria-hidden="true"
|
|
131
|
-
class="zd_font_icons basic
|
|
131
|
+
class="zd_font_icons red basic"
|
|
132
132
|
data-id="fontIcon"
|
|
133
133
|
data-selector-id="fontIcon"
|
|
134
134
|
data-test-id="fontIcon"
|
|
@@ -140,7 +140,7 @@ exports[`FontIcon - rendering the "default" props 1`] = `
|
|
|
140
140
|
<DocumentFragment>
|
|
141
141
|
<i
|
|
142
142
|
aria-hidden="true"
|
|
143
|
-
class="zd_font_icons basic
|
|
143
|
+
class="zd_font_icons basic"
|
|
144
144
|
data-id="fontIcon"
|
|
145
145
|
data-selector-id="fontIcon"
|
|
146
146
|
data-test-id="fontIcon"
|
|
@@ -152,7 +152,7 @@ exports[`FontIcon - rendering the "fontSize" 1`] = `
|
|
|
152
152
|
<DocumentFragment>
|
|
153
153
|
<i
|
|
154
154
|
aria-hidden="true"
|
|
155
|
-
class="zd_font_icons basic
|
|
155
|
+
class="zd_font_icons basic"
|
|
156
156
|
data-id="fontIcon"
|
|
157
157
|
data-selector-id="fontIcon"
|
|
158
158
|
data-test-id="fontIcon"
|
|
@@ -165,7 +165,7 @@ exports[`FontIcon - rendering the "iconClass" 1`] = `
|
|
|
165
165
|
<DocumentFragment>
|
|
166
166
|
<i
|
|
167
167
|
aria-hidden="true"
|
|
168
|
-
class="zd_font_icons basic
|
|
168
|
+
class="zd_font_icons basic iconStyleCss"
|
|
169
169
|
data-id="fontIcon"
|
|
170
170
|
data-selector-id="fontIcon"
|
|
171
171
|
data-test-id="fontIcon"
|
|
@@ -177,7 +177,7 @@ exports[`FontIcon - rendering the "pathname" 1`] = `
|
|
|
177
177
|
<DocumentFragment>
|
|
178
178
|
<i
|
|
179
179
|
aria-hidden="true"
|
|
180
|
-
class="zd_font_icons basic zd67f91bb627
|
|
180
|
+
class="zd_font_icons basic zd67f91bb627"
|
|
181
181
|
data-id="fontIcon"
|
|
182
182
|
data-selector-id="fontIcon"
|
|
183
183
|
data-test-id="fontIcon"
|
|
@@ -189,7 +189,7 @@ exports[`FontIcon - rendering the "title" 1`] = `
|
|
|
189
189
|
<DocumentFragment>
|
|
190
190
|
<i
|
|
191
191
|
aria-hidden="true"
|
|
192
|
-
class="zd_font_icons basic
|
|
192
|
+
class="zd_font_icons basic"
|
|
193
193
|
data-id="fontIcon"
|
|
194
194
|
data-selector-id="fontIcon"
|
|
195
195
|
data-test-id="fontIcon"
|
|
@@ -202,7 +202,7 @@ exports[`FontIcon - rendering the "titlePostion" to - bottom 1`] = `
|
|
|
202
202
|
<DocumentFragment>
|
|
203
203
|
<i
|
|
204
204
|
aria-hidden="true"
|
|
205
|
-
class="zd_font_icons basic
|
|
205
|
+
class="zd_font_icons basic"
|
|
206
206
|
data-id="fontIcon"
|
|
207
207
|
data-selector-id="fontIcon"
|
|
208
208
|
data-test-id="fontIcon"
|
|
@@ -215,7 +215,7 @@ exports[`FontIcon - rendering the "titlePostion" to - left 1`] = `
|
|
|
215
215
|
<DocumentFragment>
|
|
216
216
|
<i
|
|
217
217
|
aria-hidden="true"
|
|
218
|
-
class="zd_font_icons basic
|
|
218
|
+
class="zd_font_icons basic"
|
|
219
219
|
data-id="fontIcon"
|
|
220
220
|
data-selector-id="fontIcon"
|
|
221
221
|
data-test-id="fontIcon"
|
|
@@ -228,7 +228,7 @@ exports[`FontIcon - rendering the "titlePostion" to - right 1`] = `
|
|
|
228
228
|
<DocumentFragment>
|
|
229
229
|
<i
|
|
230
230
|
aria-hidden="true"
|
|
231
|
-
class="zd_font_icons basic
|
|
231
|
+
class="zd_font_icons basic"
|
|
232
232
|
data-id="fontIcon"
|
|
233
233
|
data-selector-id="fontIcon"
|
|
234
234
|
data-test-id="fontIcon"
|
|
@@ -241,7 +241,7 @@ exports[`FontIcon - rendering the "titlePostion" to - top 1`] = `
|
|
|
241
241
|
<DocumentFragment>
|
|
242
242
|
<i
|
|
243
243
|
aria-hidden="true"
|
|
244
|
-
class="zd_font_icons basic
|
|
244
|
+
class="zd_font_icons basic"
|
|
245
245
|
data-id="fontIcon"
|
|
246
246
|
data-selector-id="fontIcon"
|
|
247
247
|
data-test-id="fontIcon"
|