@zohodesk/icons 1.3.15 → 1.4.0
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/CHANGELOG.md +5 -0
- package/README.md +21 -3
- package/assets/react/zd-font-rAI.module.css +1 -5
- package/assets/react/zd-font-rAccessibility.module.css +1 -5
- package/assets/react/zd-font-rAnalyticsColor.module.css +1 -5
- package/assets/react/zd-font-rAutomation.module.css +1 -5
- package/assets/react/zd-font-rCallBar.module.css +1 -5
- package/assets/react/zd-font-rChannels.module.css +1 -5
- package/assets/react/zd-font-rCustomize.module.css +1 -5
- package/assets/react/zd-font-rDeveloperSpace.module.css +1 -5
- package/assets/react/zd-font-rExportFiles.module.css +1 -5
- package/assets/react/zd-font-rGeneral.module.css +1 -5
- package/assets/react/zd-font-rIM.module.css +1 -5
- package/assets/react/zd-font-rIntegrations.module.css +1 -5
- package/assets/react/zd-font-rLhs.module.css +1 -5
- package/assets/react/zd-font-rMarketplace.module.css +1 -5
- package/assets/react/zd-font-rReports.module.css +1 -5
- package/assets/react/zd-font-rSetup.module.css +1 -5
- package/assets/react/zd-font-rTickets.module.css +1 -5
- package/assets/react/zd-font-rTopband.module.css +1 -5
- package/assets/react/zd-font-rTwotone.module.css +1 -5
- package/assets/react/zd-font-rUpdates.module.css +1 -5
- package/assets/react/zd-font-react-addforms.module.css +1 -5
- package/assets/react/zd-font-react-automate.module.css +1 -5
- package/assets/react/zd-font-react-channels.module.css +1 -5
- package/assets/react/zd-font-react-common.module.css +1 -5
- package/assets/react/zd-font-react-community.module.css +1 -5
- package/assets/react/zd-font-react-customers.module.css +1 -5
- package/assets/react/zd-font-react-customize.module.css +1 -5
- package/assets/react/zd-font-react-gamescope.module.css +1 -5
- package/assets/react/zd-font-react-gcFonts.module.css +1 -5
- package/assets/react/zd-font-react-gettingstarted.module.css +1 -5
- package/assets/react/zd-font-react-kb.module.css +1 -5
- package/assets/react/zd-font-react-organization.module.css +1 -5
- package/assets/react/zd-font-react-others.module.css +1 -5
- package/assets/react/zd-font-react-reports.module.css +1 -5
- package/assets/react/zd-font-react-setup.module.css +1 -5
- package/assets/react/zd-font-react-social.module.css +1 -5
- package/assets/react/zd-font-react-ticket-channels.module.css +1 -5
- package/assets/react/zd-font-react-tickets.module.css +1 -5
- package/assets/react/zd-font-react-topband.module.css +1 -5
- package/es/Context/__tests__/__snapshots__/IconContext.spec.js.snap +2 -2
- package/es/Icon/FontIcon.js +25 -11
- package/es/Icon/Icon.module.css +0 -10
- package/es/Icon/SvgIcon.js +1 -1
- package/es/Icon/__tests__/__snapshots__/FontIcon.spec.js.snap +18 -18
- package/es/Icon/__tests__/__snapshots__/Icon.spec.js.snap +2493 -2349
- package/es/Icon/css/cssJSLogic.js +1 -0
- package/es/Icon/css/fontIcon.cva.js +48 -0
- package/lib/Context/__tests__/__snapshots__/IconContext.spec.js.snap +2 -2
- package/lib/Icon/FontIcon.js +24 -13
- package/lib/Icon/Icon.module.css +0 -10
- package/lib/Icon/SvgIcon.js +1 -1
- package/lib/Icon/__tests__/__snapshots__/FontIcon.spec.js.snap +18 -18
- package/lib/Icon/__tests__/__snapshots__/Icon.spec.js.snap +2493 -2349
- package/lib/Icon/css/cssJSLogic.js +13 -0
- package/lib/Icon/css/fontIcon.cva.js +61 -0
- package/package.json +4 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { fontIcon_cva } from "./fontIcon.cva";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { cva } from '@dot-system/css-utility';
|
|
2
|
+
import { allCustomIcons } from "../CustomIcons";
|
|
3
|
+
import style from "../Icon.module.css";
|
|
4
|
+
const DUMMY_OBJECT = Object.freeze({});
|
|
5
|
+
export const fontIconVariants = cva([style.basic, 'd-inline-block', 'd-align-middle'], {
|
|
6
|
+
variants: {
|
|
7
|
+
isRtl: {
|
|
8
|
+
true: style.rtl
|
|
9
|
+
},
|
|
10
|
+
isBold: {
|
|
11
|
+
true: 'd-font-bold'
|
|
12
|
+
},
|
|
13
|
+
clickable: {
|
|
14
|
+
true: 'd-cursor-pointer'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* FontIcon root classname based on props.
|
|
20
|
+
* Order: zd_font_icons → customColor → ff → pathName → basic/utils/rtl/bold/cursor → iconClass
|
|
21
|
+
* @param {{ props: object }} args
|
|
22
|
+
* @returns {{ fontIconClass: string, customColorKey: string|null }}
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export function fontIcon_cva({
|
|
26
|
+
props
|
|
27
|
+
}) {
|
|
28
|
+
const {
|
|
29
|
+
isBold,
|
|
30
|
+
onClick,
|
|
31
|
+
isRtl,
|
|
32
|
+
iconName,
|
|
33
|
+
pathName,
|
|
34
|
+
iconContent = DUMMY_OBJECT,
|
|
35
|
+
iconClass
|
|
36
|
+
} = props;
|
|
37
|
+
const customColorKey = allCustomIcons[iconName] || null;
|
|
38
|
+
const customColorClass = customColorKey ? style[customColorKey] : '';
|
|
39
|
+
return {
|
|
40
|
+
fontIconClass: `zd_font_icons ${customColorClass} ${iconContent.ff} ${pathName} ${fontIconVariants({
|
|
41
|
+
isRtl,
|
|
42
|
+
isBold,
|
|
43
|
+
clickable: !!onClick,
|
|
44
|
+
className: iconClass
|
|
45
|
+
})}`,
|
|
46
|
+
customColorKey
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -4,7 +4,7 @@ exports[`IconProvider / IconContext - default context - renders font icon (no p
|
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<i
|
|
6
6
|
aria-hidden="true"
|
|
7
|
-
class="zd_font_icons
|
|
7
|
+
class="zd_font_icons ff icon-close2 basic d-inline-block d-align-middle"
|
|
8
8
|
data-id="fontIcon"
|
|
9
9
|
data-selector-id="fontIcon"
|
|
10
10
|
data-test-id="fontIcon"
|
|
@@ -43,7 +43,7 @@ exports[`IconProvider / IconContext - type "fontIcon" - renders font icon 1`] =
|
|
|
43
43
|
<DocumentFragment>
|
|
44
44
|
<i
|
|
45
45
|
aria-hidden="true"
|
|
46
|
-
class="zd_font_icons
|
|
46
|
+
class="zd_font_icons ff icon-close2 basic d-inline-block d-align-middle"
|
|
47
47
|
data-id="fontIcon"
|
|
48
48
|
data-selector-id="fontIcon"
|
|
49
49
|
data-test-id="fontIcon"
|
package/lib/Icon/FontIcon.js
CHANGED
|
@@ -5,17 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
|
|
8
|
+
var _cssUtility = require("@dot-system/css-utility");
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireDefault(require("react"));
|
|
9
11
|
|
|
10
12
|
var _defaultProps = require("./props/defaultProps");
|
|
11
13
|
|
|
12
14
|
var _propTypes = require("./props/propTypes");
|
|
13
15
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var _cssUtility = require("@dot-system/css-utility");
|
|
17
|
-
|
|
18
|
-
var _IconModule = _interopRequireDefault(require("./Icon.module.css"));
|
|
16
|
+
var _cssJSLogic = require("./css/cssJSLogic");
|
|
19
17
|
|
|
20
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
19
|
|
|
@@ -76,21 +74,34 @@ var FontIcon = /*#__PURE__*/function (_React$Component) {
|
|
|
76
74
|
ariaHidden = _a11y$ariaHidden === void 0 ? true : _a11y$ariaHidden;
|
|
77
75
|
var fontStyle = size ? {
|
|
78
76
|
'--zd-iconfont-size': 'var(--zd_font_size' + size + ')'
|
|
79
|
-
} : {};
|
|
80
|
-
var isCustom = _CustomIcons.allCustomIcons[iconName] || null;
|
|
81
|
-
isCustom = isCustom ? _IconModule["default"][isCustom] : ''; // let isTwoTone = TwoToneIcons[iconName] || null;
|
|
77
|
+
} : {}; // let isTwoTone = TwoToneIcons[iconName] || null;
|
|
82
78
|
// isTwoTone = isTwoTone ? style[isTwoTone] : '';
|
|
83
79
|
|
|
84
|
-
var
|
|
80
|
+
var isRtl = false;
|
|
85
81
|
var childArray;
|
|
86
82
|
|
|
87
83
|
if (_typeof(name) === 'object') {
|
|
88
84
|
childArray = [];
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
isRtl = name[2] ? name[2] : false;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var _fontIcon_cva = (0, _cssJSLogic.fontIcon_cva)({
|
|
89
|
+
props: {
|
|
90
|
+
isBold: isBold,
|
|
91
|
+
onClick: onClick,
|
|
92
|
+
isRtl: isRtl,
|
|
93
|
+
iconName: iconName,
|
|
94
|
+
pathName: pathName,
|
|
95
|
+
iconContent: iconContent,
|
|
96
|
+
iconClass: iconClass
|
|
97
|
+
}
|
|
98
|
+
}),
|
|
99
|
+
fontIconClass = _fontIcon_cva.fontIconClass,
|
|
100
|
+
customColorKey = _fontIcon_cva.customColorKey;
|
|
91
101
|
|
|
102
|
+
if (_typeof(name) === 'object') {
|
|
92
103
|
for (var i = 1; i < name[1] + 1; i++) {
|
|
93
|
-
var pathClass = "".concat(iconContent["path".concat(i)], " ").concat(iconClass ||
|
|
104
|
+
var pathClass = "".concat(iconContent["path".concat(i)], " ").concat(iconClass || customColorKey ? "path".concat(i) : '');
|
|
94
105
|
childArray.push( /*#__PURE__*/_react["default"].createElement("span", {
|
|
95
106
|
className: (0, _cssUtility.cn)(pathClass),
|
|
96
107
|
key: i
|
|
@@ -99,7 +110,7 @@ var FontIcon = /*#__PURE__*/function (_React$Component) {
|
|
|
99
110
|
}
|
|
100
111
|
|
|
101
112
|
return /*#__PURE__*/_react["default"].createElement("i", _extends({
|
|
102
|
-
className: (0, _cssUtility.cn)(
|
|
113
|
+
className: (0, _cssUtility.cn)(fontIconClass),
|
|
103
114
|
"data-title": title,
|
|
104
115
|
onClick: onClick,
|
|
105
116
|
"data-id": dataId,
|
package/lib/Icon/Icon.module.css
CHANGED
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
line-height: 1;
|
|
10
10
|
-webkit-font-smoothing: antialiased;
|
|
11
11
|
-moz-osx-font-smoothing: grayscale;
|
|
12
|
-
display: inline-block;
|
|
13
|
-
vertical-align: middle;
|
|
14
12
|
font-size: var(--zd-iconfont-size, inherit);
|
|
15
13
|
}
|
|
16
14
|
.basic,.basic > span{
|
|
@@ -24,14 +22,6 @@
|
|
|
24
22
|
font-size: var(--zd-iconfont-size, inherit);
|
|
25
23
|
}
|
|
26
24
|
|
|
27
|
-
.fbold {
|
|
28
|
-
font-weight: bold;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.cursor {
|
|
32
|
-
cursor: pointer;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
25
|
.red :global .path2::before,
|
|
36
26
|
.red2 :global .path3::before {
|
|
37
27
|
color: #de3535 !important;
|
package/lib/Icon/SvgIcon.js
CHANGED
|
@@ -39,7 +39,7 @@ function SvgIcon(_ref) {
|
|
|
39
39
|
var fontStyle = size ? {
|
|
40
40
|
'--zd-iconfont-size': 'var(--zd_font_size' + size + ')'
|
|
41
41
|
} : _constants.DUMMY_OBJECT;
|
|
42
|
-
var className = "".concat(_IconModule["default"].svgIcon, " ").concat(onClick ?
|
|
42
|
+
var className = "".concat(_IconModule["default"].svgIcon, " ").concat(onClick ? 'd-cursor-pointer' : '', " ").concat(iconClass ? iconClass : '');
|
|
43
43
|
return /*#__PURE__*/_react["default"].createElement("svg", _extends({
|
|
44
44
|
className: (0, _cssUtility.cn)(className),
|
|
45
45
|
onClick: onClick,
|
|
@@ -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 d-inline-block d-align-middle"
|
|
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 d-inline-block d-align-middle d-font-bold"
|
|
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 d-inline-block d-align-middle"
|
|
32
32
|
data-id="fontIcon"
|
|
33
33
|
data-selector-id="fontIcon"
|
|
34
34
|
data-test-id="fontIcon"
|
|
@@ -40,7 +40,7 @@ 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 d-inline-block d-align-middle"
|
|
44
44
|
data-id="fontIcon"
|
|
45
45
|
data-selector-id="fontIcon"
|
|
46
46
|
data-test-id="fontIcon"
|
|
@@ -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 d-inline-block d-align-middle"
|
|
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 red basic"
|
|
77
|
+
class="zd_font_icons red basic d-inline-block d-align-middle"
|
|
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 iconStyleCss"
|
|
96
|
+
class="zd_font_icons basic d-inline-block d-align-middle 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 d-inline-block d-align-middle"
|
|
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 red basic"
|
|
131
|
+
class="zd_font_icons red basic d-inline-block d-align-middle"
|
|
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 d-inline-block d-align-middle"
|
|
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 d-inline-block d-align-middle"
|
|
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 iconStyleCss"
|
|
168
|
+
class="zd_font_icons basic d-inline-block d-align-middle 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
|
|
180
|
+
class="zd_font_icons zd67f91bb627 basic d-inline-block d-align-middle"
|
|
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 d-inline-block d-align-middle"
|
|
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 d-inline-block d-align-middle"
|
|
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 d-inline-block d-align-middle"
|
|
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 d-inline-block d-align-middle"
|
|
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 d-inline-block d-align-middle"
|
|
245
245
|
data-id="fontIcon"
|
|
246
246
|
data-selector-id="fontIcon"
|
|
247
247
|
data-test-id="fontIcon"
|