@zohodesk/icons 1.0.0 → 1.0.2

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/lib/Icon/index.js CHANGED
@@ -7,11 +7,9 @@ exports["default"] = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
- var _asyncComponent = _interopRequireDefault(require("./asyncComponent"));
11
-
12
10
  var _FontFactory = require("./FontFactory");
13
11
 
14
- var _FontIcon = _interopRequireDefault(require("./FontIcon"));
12
+ var _FontIcon = _interopRequireDefault(require("../v1/FontIcon"));
15
13
 
16
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
15
 
@@ -145,31 +143,29 @@ function getReactTwotone() {
145
143
  return require('../../assets_final/react/zd-font-rTwotone.module.css');
146
144
  }
147
145
 
148
- function IconRender(iconName, iconContent) {
149
- return function (props) {
150
- var name = props.name,
151
- onClick = props.onClick,
152
- isBold = props.isBold,
153
- iconClass = props.iconClass,
154
- title = props.title,
155
- dataId = props.dataId,
156
- size = props.size,
157
- titlePosition = props.titlePosition;
158
- var pathName = _typeof(_FontFactory.FontFactory[iconName][name]) === 'object' ? _FontFactory.FontFactory[iconName][name][0] : _FontFactory.FontFactory[iconName][name];
159
- return /*#__PURE__*/_react["default"].createElement(_FontIcon["default"], {
160
- iconClass: iconClass,
161
- iconContent: iconContent,
162
- isBold: isBold,
163
- name: _FontFactory.FontFactory[iconName][name],
164
- onClick: onClick,
165
- pathName: iconContent[pathName],
166
- title: title,
167
- dataId: dataId,
168
- size: size,
169
- iconName: name,
170
- titlePosition: titlePosition
171
- });
172
- };
146
+ function IconRender(iconName, iconContent, props) {
147
+ var name = props.name,
148
+ onClick = props.onClick,
149
+ isBold = props.isBold,
150
+ iconClass = props.iconClass,
151
+ title = props.title,
152
+ dataId = props.dataId,
153
+ size = props.size,
154
+ titlePosition = props.titlePosition;
155
+ var pathName = _typeof(_FontFactory.FontFactory[iconName][name]) === 'object' ? _FontFactory.FontFactory[iconName][name][0] : _FontFactory.FontFactory[iconName][name];
156
+ return /*#__PURE__*/_react["default"].createElement(_FontIcon["default"], {
157
+ iconClass: iconClass,
158
+ iconContent: iconContent,
159
+ isBold: isBold,
160
+ name: _FontFactory.FontFactory[iconName][name],
161
+ onClick: onClick,
162
+ pathName: iconContent[pathName],
163
+ title: title,
164
+ dataId: dataId,
165
+ size: size,
166
+ iconName: name,
167
+ titlePosition: titlePosition
168
+ });
173
169
  }
174
170
 
175
171
  function getIcon(props) {
@@ -208,43 +204,38 @@ function getIcon(props) {
208
204
  ReactGCFontIcon: getReactGC,
209
205
  ReactTwotoneIcon: getReactTwotone
210
206
  };
211
- return new Promise(function (res) {
212
- if (_typeof(require.ensure) !== "function") {
213
- require.ensure = function (d, c) {
214
- return c(require);
215
- };
207
+ var iconNames = Object.keys(_FontFactory.FontFactory);
208
+
209
+ for (var _i = 0, _iconNames = iconNames; _i < _iconNames.length; _i++) {
210
+ var name = _iconNames[_i];
211
+
212
+ if (_FontFactory.FontFactory[name][props.name] !== undefined) {
213
+ iconName = name;
214
+ break;
216
215
  }
216
+ }
217
217
 
218
- require.ensure([], function () {
219
- Object.keys(_FontFactory.FontFactory).map(function (name) {
220
- if (typeof _FontFactory.FontFactory[name][props.name] !== 'undefined') {
221
- iconName = name;
222
- }
223
- });
218
+ if (iconName) {
219
+ var iconContent = filesMap[iconName]();
224
220
 
225
- if (iconName) {
226
- var iconContent = filesMap[iconName]();
221
+ var _Icon = IconRender(iconName, iconContent, props);
227
222
 
228
- var _Icon = IconRender(iconName, iconContent);
223
+ return {
224
+ IconComponent: _Icon
225
+ };
226
+ }
229
227
 
230
- var response = {
231
- Icon: _Icon
232
- };
233
- res(response);
234
- }
235
- }, 'FontFactory');
236
- });
228
+ return {
229
+ IconComponent: null
230
+ };
237
231
  }
238
232
 
239
- var Icon = (0, _asyncComponent["default"])(function (props) {
240
- return getIcon(props).then(function (res) {
241
- return res.Icon;
242
- });
243
- });
244
- var _default = Icon; // if (__DOCS__) {
245
- // Icon.docs = {
246
- // componentGroup: 'Icon'
247
- // };
248
- // }
233
+ function Icon(props) {
234
+ var _getIcon = getIcon(props),
235
+ IconComponent = _getIcon.IconComponent;
236
+
237
+ return IconComponent;
238
+ }
249
239
 
240
+ var _default = Icon;
250
241
  exports["default"] = _default;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = FontIcon;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _defaultProps = require("../Icon/props/defaultProps");
11
+
12
+ var _propTypes = require("../Icon/props/propTypes");
13
+
14
+ var _CustomIcons = require("../Icon/CustomIcons");
15
+
16
+ var _IconModule = _interopRequireDefault(require("../Icon/Icon.module.css"));
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+
20
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
21
+
22
+ function FontIcon(props) {
23
+ var name = props.name,
24
+ onClick = props.onClick,
25
+ isBold = props.isBold,
26
+ pathName = props.pathName,
27
+ iconContent = props.iconContent,
28
+ iconClass = props.iconClass,
29
+ title = props.title,
30
+ dataId = props.dataId,
31
+ dataSelectorId = props.dataSelectorId,
32
+ size = props.size,
33
+ iconName = props.iconName,
34
+ titlePosition = props.titlePosition,
35
+ a11y = props.a11y;
36
+ var _a11y$ariaHidden = a11y.ariaHidden,
37
+ ariaHidden = _a11y$ariaHidden === void 0 ? true : _a11y$ariaHidden;
38
+ var fontStyle = size ? {
39
+ '--zd-iconfont-size': 'var(--zd_font_size' + size + ')'
40
+ } : {};
41
+ var isCustom = _CustomIcons.allCustomIcons[iconName] || null;
42
+ isCustom = isCustom ? _IconModule["default"][isCustom] : ''; // let isTwoTone = TwoToneIcons[iconName] || null;
43
+ // isTwoTone = isTwoTone ? style[isTwoTone] : '';
44
+
45
+ var fontClass = "".concat(_IconModule["default"].basic, " ").concat(pathName, " ").concat(isBold ? _IconModule["default"].fbold : '', " ").concat(iconClass ? iconClass : '', " ").concat(onClick ? _IconModule["default"].cursor : '');
46
+ var childArray;
47
+
48
+ if (_typeof(name) === 'object') {
49
+ childArray = [];
50
+ var isRtl = name[2] ? name[2] : false;
51
+ fontClass = isRtl ? "".concat(fontClass, " ").concat(_IconModule["default"].rtl) : fontClass;
52
+
53
+ for (var i = 1; i < name[1] + 1; i++) {
54
+ var pathClass = "".concat(iconContent["path".concat(i)], " ").concat(iconClass || isCustom ? "path".concat(i) : '');
55
+ childArray.push( /*#__PURE__*/_react["default"].createElement("span", {
56
+ className: pathClass,
57
+ key: i
58
+ }));
59
+ }
60
+ }
61
+
62
+ return /*#__PURE__*/_react["default"].createElement("i", {
63
+ className: 'zd_font_icons'.concat(" ", fontClass, " ").concat(isCustom),
64
+ "data-title": title,
65
+ onClick: onClick,
66
+ "data-id": dataId,
67
+ "data-test-id": dataId,
68
+ "data-title-position": titlePosition,
69
+ style: fontStyle,
70
+ "aria-hidden": ariaHidden,
71
+ "data-selector-id": dataSelectorId
72
+ }, childArray ? childArray : null);
73
+ }
74
+
75
+ FontIcon.propTypes = _propTypes.IconProps;
76
+ FontIcon.defaultProps = _defaultProps.IconDefaultProps;
77
+
78
+ if (false) {
79
+ FontIcon.docs = {
80
+ componentGroup: 'Icon',
81
+ folderName: 'Style Guide'
82
+ };
83
+ }
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = asyncComponent;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
+
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+
16
+ 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 target; }; return _extends.apply(this, arguments); }
17
+
18
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
19
+
20
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
21
+
22
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
23
+
24
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
25
+
26
+ 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."); }
27
+
28
+ 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); }
29
+
30
+ 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; }
31
+
32
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
33
+
34
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
35
+
36
+ function asyncComponent(getComponentProps) {
37
+ return function AsyncComponent(props) {
38
+ var _useState = (0, _react.useState)(null),
39
+ _useState2 = _slicedToArray(_useState, 2),
40
+ Component = _useState2[0],
41
+ setComponent = _useState2[1];
42
+
43
+ var mount = (0, _react.useRef)(true);
44
+ var eleRef = (0, _react.useRef)(null);
45
+
46
+ var loadComponent = /*#__PURE__*/function () {
47
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
48
+ var component;
49
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
50
+ while (1) {
51
+ switch (_context.prev = _context.next) {
52
+ case 0:
53
+ _context.prev = 0;
54
+ _context.next = 3;
55
+ return getComponentProps(props);
56
+
57
+ case 3:
58
+ component = _context.sent;
59
+
60
+ if (mount.current) {
61
+ setComponent(function () {
62
+ return component;
63
+ });
64
+ }
65
+
66
+ _context.next = 10;
67
+ break;
68
+
69
+ case 7:
70
+ _context.prev = 7;
71
+ _context.t0 = _context["catch"](0);
72
+ console.log('errorme', _context.t0);
73
+
74
+ case 10:
75
+ case "end":
76
+ return _context.stop();
77
+ }
78
+ }
79
+ }, _callee, null, [[0, 7]]);
80
+ }));
81
+
82
+ return function loadComponent() {
83
+ return _ref.apply(this, arguments);
84
+ };
85
+ }();
86
+
87
+ (0, _react.useEffect)(function () {
88
+ mount.current = true;
89
+ loadComponent();
90
+ return function () {
91
+ mount.current = false;
92
+ };
93
+ }, [props.name]);
94
+
95
+ var getRef = function getRef(ele) {
96
+ eleRef.current = ele;
97
+ };
98
+
99
+ if (Component) {
100
+ return /*#__PURE__*/_react["default"].createElement(Component, _extends({}, props, {
101
+ ref: getRef
102
+ }));
103
+ }
104
+
105
+ return null;
106
+ };
107
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/icons",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "DOT - Icons",
5
5
  "main": "es/index.js",
6
6
  "module": "es/index.js",
@@ -20,80 +20,30 @@
20
20
  "scripts": {
21
21
  "clean": "react-cli clean lib es coverage assets",
22
22
  "build": "react-cli build:component:cmjs ",
23
- "build:dev": "npm run build:es --module:mode=dev -- -w",
23
+ "build:watch": "npm run build:es --module:mode=dev -- -w",
24
24
  "build:es": "react-cli build:library:es",
25
- "prepare": "node prePublish.js && npm run init && npm run build && npm run build:es && npm run valueReplacer",
25
+ "prepare": "npm run init && npm run build && npm run build:es && npm run valueReplacer",
26
26
  "init": "npm run clean && cd ../assets && npm run iconsassets",
27
27
  "lint": "react-cli lint",
28
28
  "docs": "react-cli docs",
29
+ "prepublishOnly": "node prePublish.js && npm run test",
29
30
  "postpublish": "node postPublish.js",
30
31
  "download": "react-cli clean ./node_modules ./package-lock.json && npm install",
31
32
  "valueReplacer": "react-cli valuereplacer ./src ./lib && react-cli valuereplacer ./src ./es && rm -rf ./assets_final && react-cli valuereplacer ./assets ./assets_final true",
32
33
  "expublish": "npm publish --tag experimental-version",
33
- "common_package_build": "cd ../common && npm run build && cd ../components"
34
+ "common_package_build": "cd ../common && npm run build && cd ../components",
35
+ "test": "react-cli test",
36
+ "snap-update": "npm run test -- -u"
34
37
  },
35
38
  "dependencies": {},
36
39
  "devDependencies": {
37
- "@zohodesk/variables": "1.0.0-beta.31"
40
+ "@zohodesk/variables": "1.0.0",
41
+ "@testing-library/jest-dom": "^5.11.9",
42
+ "@testing-library/react": "^11.2.5",
43
+ "@testing-library/react-hooks": "^7.0.2",
44
+ "@testing-library/user-event": "^13.0.10"
38
45
  },
39
46
  "peerDependencies": {
40
- "@zohodesk/variables": "1.0.0-beta.31"
41
- },
42
- "react-cli": {
43
- "css": {
44
- "valueReplacer": [
45
- {
46
- "props": [
47
- "font",
48
- "font-family"
49
- ],
50
- "values": {
51
- "zdfonts-rCallBar": "zdf-rCallBar_1",
52
- "zdfonts-rChannels": "zdf-rChannels_1",
53
- "zdfonts-rCustomize": "zdf-rCustomize_4",
54
- "zdfonts-react-addforms": "zdf-react-addforms_1",
55
- "zdfonts-react-automate": "zdf-react-automate_1",
56
- "zdfonts-react-channels": "zdf-react-channels_1",
57
- "zdfonts-react-common": "zdf-react-common_3",
58
- "zdfonts-react-community": "zdf-react-community_1",
59
- "zdfonts-react-customers": "zdf-react-customers_1",
60
- "zdfonts-react-customize": "zdf-react-customize_2",
61
- "zdfonts-react-gamescope": "zdf-react-gamescope_1",
62
- "zdfonts-react-gcFonts": "zdf-react-gcFonts_9",
63
- "zdfonts-react-gettingstarted": "zdf-react-gettingstarted_1",
64
- "zdfonts-react-integrations": "zdf-react-integrations_1",
65
- "zdfonts-react-kb": "zdf-react-kb_1",
66
- "zdfonts-react-logo": "zdf-react-logo_1",
67
- "zdfonts-react-organization": "zdf-react-organization_1",
68
- "zdfonts-react-others": "zdf-react-others_1",
69
- "zdfonts-react-reports": "zdf-react-reports_2",
70
- "zdfonts-react-setup": "zdf-react-setup_1",
71
- "zdfonts-react-social": "zdf-react-social_1",
72
- "zdfonts-ticket-channels": "zdf-ticket-channels_1",
73
- "zdfonts-react-tickets": "zdf-react-tickets_1",
74
- "zdfonts-react-topband": "zdf-react-topband_1",
75
- "zdfonts-rExportFiles": "zdf-rExportFiles_1",
76
- "zdfonts-rGeneral": "zdf-rGeneral_9",
77
- "zdfonts-rIntegrations": "zdf-rIntegrations_3",
78
- "zdfonts-rLhs": "zdf-rLhs_1",
79
- "zdfonts-rMarketplace": "zdf-rMarketplace_5",
80
- "zdfonts-rReports": "zdf-rReports_1",
81
- "zdfonts-rSetup": "zdf-rSetup_2",
82
- "zdfonts-rTickets": "zdf-rTickets_2",
83
- "zdfonts-rTopband": "zdf-rTopband_3",
84
- "zdfonts-rTwotone": "zdf-rTwotone_10"
85
- }
86
- }
87
- ]
88
- },
89
- "docs": {
90
- "cssUniqueness": "false",
91
- "disableES5Transpile": true
92
- },
93
- "app": {
94
- "removePropTypes": {
95
- "removeImport": true
96
- }
97
- }
47
+ "@zohodesk/variables": "1.0.0"
98
48
  }
99
- }
49
+ }
@@ -0,0 +1,48 @@
1
+ exports.config= {
2
+ "css": {
3
+ "valueReplacer": [
4
+ {
5
+ "props": [
6
+ "font",
7
+ "font-family"
8
+ ],
9
+ "values": {
10
+ "zdfonts-rCallBar": "zdf-rCallBar_1",
11
+ "zdfonts-rChannels": "zdf-rChannels_1",
12
+ "zdfonts-rCustomize": "zdf-rCustomize_4",
13
+ "zdfonts-react-addforms": "zdf-react-addforms_1",
14
+ "zdfonts-react-automate": "zdf-react-automate_1",
15
+ "zdfonts-react-channels": "zdf-react-channels_1",
16
+ "zdfonts-react-common": "zdf-react-common_3",
17
+ "zdfonts-react-community": "zdf-react-community_1",
18
+ "zdfonts-react-customers": "zdf-react-customers_1",
19
+ "zdfonts-react-customize": "zdf-react-customize_2",
20
+ "zdfonts-react-gamescope": "zdf-react-gamescope_1",
21
+ "zdfonts-react-gcFonts": "zdf-react-gcFonts_9",
22
+ "zdfonts-react-gettingstarted": "zdf-react-gettingstarted_1",
23
+ "zdfonts-react-integrations": "zdf-react-integrations_1",
24
+ "zdfonts-react-kb": "zdf-react-kb_1",
25
+ "zdfonts-react-logo": "zdf-react-logo_1",
26
+ "zdfonts-react-organization": "zdf-react-organization_1",
27
+ "zdfonts-react-others": "zdf-react-others_1",
28
+ "zdfonts-react-reports": "zdf-react-reports_2",
29
+ "zdfonts-react-setup": "zdf-react-setup_1",
30
+ "zdfonts-react-social": "zdf-react-social_1",
31
+ "zdfonts-ticket-channels": "zdf-ticket-channels_1",
32
+ "zdfonts-react-tickets": "zdf-react-tickets_1",
33
+ "zdfonts-react-topband": "zdf-react-topband_1",
34
+ "zdfonts-rExportFiles": "zdf-rExportFiles_1",
35
+ "zdfonts-rGeneral": "zdf-rGeneral_9",
36
+ "zdfonts-rIntegrations": "zdf-rIntegrations_3",
37
+ "zdfonts-rLhs": "zdf-rLhs_1",
38
+ "zdfonts-rMarketplace": "zdf-rMarketplace_5",
39
+ "zdfonts-rReports": "zdf-rReports_1",
40
+ "zdfonts-rSetup": "zdf-rSetup_2",
41
+ "zdfonts-rTickets": "zdf-rTickets_2",
42
+ "zdfonts-rTopband": "zdf-rTopband_3",
43
+ "zdfonts-rTwotone": "zdf-rTwotone_10"
44
+ }
45
+ }
46
+ ]
47
+ }
48
+ }
package/result.json ADDED
@@ -0,0 +1 @@
1
+ {"jobDetails":{"isRunByLocal":true,"hostName":"bharathi-zt93","platForm":"Darwin","branchName":"bk"},"tests":{"unitCase":{"isExecuted":"Yes","numberOfSuccess":17,"numberOfFails":0,"numberOfCases":17,"numberOfSuites":1,"endTime":1692271525837,"startTime":1692271523490,"coverageDetail":{"codeCoveragePercentage":93.59,"fileCoveragePercentage":0},"fileDetails":[{"fileName":"/Users/bharathi-zt93/git/library/jsapps/dot/icons/src/Icon/__tests__/FontIcon.spec.js","CaseList":{"passedCaseList":["rendering the \"default\" props","checking \"isBold\" is true","checking \"isBold\" is false","rendering the \"iconClass\"","rendering the \"fontSize\"","rendering the \"title\"","rendering the \"pathname\"","rendering \"Name\" with \"iconContent\" and without path","rendering \"iconClass\" with path ","rendering \"custumIcon\" with path","rendering \"ariaHidden\" is false","rendering \"IconName\"","rendering custom icon name","rendering the \"titlePostion\" to - top","rendering the \"titlePostion\" to - bottom","rendering the \"titlePostion\" to - left","rendering the \"titlePostion\" to - right"],"failedCaseList":[]}},{"fileName":"/Users/bharathi-zt93/git/library/jsapps/dot/icons/src/Icon/__tests__/FontIcon.spec.js","CaseList":{"passedCaseList":["rendering the \"default\" props","checking \"isBold\" is true","checking \"isBold\" is false","rendering the \"iconClass\"","rendering the \"fontSize\"","rendering the \"title\"","rendering the \"pathname\"","rendering \"Name\" with \"iconContent\" and without path","rendering \"iconClass\" with path ","rendering \"custumIcon\" with path","rendering \"ariaHidden\" is false","rendering \"IconName\"","rendering custom icon name","rendering the \"titlePostion\" to - top","rendering the \"titlePostion\" to - bottom","rendering the \"titlePostion\" to - left","rendering the \"titlePostion\" to - right"],"failedCaseList":[]}},{"fileName":"/Users/bharathi-zt93/git/library/jsapps/dot/icons/src/Icon/__tests__/FontIcon.spec.js","CaseList":{"passedCaseList":["rendering the \"default\" props","checking \"isBold\" is true","checking \"isBold\" is false","rendering the \"iconClass\"","rendering the \"fontSize\"","rendering the \"title\"","rendering the \"pathname\"","rendering \"Name\" with \"iconContent\" and without path","rendering \"iconClass\" with path ","rendering \"custumIcon\" with path","rendering \"ariaHidden\" is false","rendering \"IconName\"","rendering custom icon name","rendering the \"titlePostion\" to - top","rendering the \"titlePostion\" to - bottom","rendering the \"titlePostion\" to - left","rendering the \"titlePostion\" to - right"],"failedCaseList":[]}},{"fileName":"/Users/bharathi-zt93/git/library/jsapps/dot/icons/src/Icon/__tests__/FontIcon.spec.js","CaseList":{"passedCaseList":["rendering the \"default\" props","checking \"isBold\" is true","checking \"isBold\" is false","rendering the \"iconClass\"","rendering the \"fontSize\"","rendering the \"title\"","rendering the \"pathname\"","rendering \"Name\" with \"iconContent\" and without path","rendering \"iconClass\" with path ","rendering \"custumIcon\" with path","rendering \"ariaHidden\" is false","rendering \"IconName\"","rendering custom icon name","rendering the \"titlePostion\" to - top","rendering the \"titlePostion\" to - bottom","rendering the \"titlePostion\" to - left","rendering the \"titlePostion\" to - right"],"failedCaseList":[]}},{"fileName":"/Users/bharathi-zt93/git/library/jsapps/dot/icons/src/Icon/__tests__/FontIcon.spec.js","CaseList":{"passedCaseList":["rendering the \"default\" props","checking \"isBold\" is true","checking \"isBold\" is false","rendering the \"iconClass\"","rendering the \"fontSize\"","rendering the \"title\"","rendering the \"pathname\"","rendering \"Name\" with \"iconContent\" and without path","rendering \"iconClass\" with path ","rendering \"custumIcon\" with path","rendering \"ariaHidden\" is false","rendering \"IconName\"","rendering custom icon name","rendering the \"titlePostion\" to - top","rendering the \"titlePostion\" to - bottom","rendering the \"titlePostion\" to - left","rendering the \"titlePostion\" to - right"],"failedCaseList":[]}},{"fileName":"/Users/bharathi-zt93/git/library/jsapps/dot/icons/src/Icon/__tests__/FontIcon.spec.js","CaseList":{"passedCaseList":["rendering the \"default\" props","checking \"isBold\" is true","checking \"isBold\" is false","rendering the \"iconClass\"","rendering the \"fontSize\"","rendering the \"title\"","rendering the \"pathname\"","rendering \"Name\" with \"iconContent\" and without path","rendering \"iconClass\" with path ","rendering \"custumIcon\" with path","rendering \"ariaHidden\" is false","rendering \"IconName\"","rendering custom icon name","rendering the \"titlePostion\" to - top","rendering the \"titlePostion\" to - bottom","rendering the \"titlePostion\" to - left","rendering the \"titlePostion\" to - right"],"failedCaseList":[]}},{"fileName":"/Users/bharathi-zt93/git/library/jsapps/dot/icons/src/Icon/__tests__/FontIcon.spec.js","CaseList":{"passedCaseList":["rendering the \"default\" props","checking \"isBold\" is true","checking \"isBold\" is false","rendering the \"iconClass\"","rendering the \"fontSize\"","rendering the \"title\"","rendering the \"pathname\"","rendering \"Name\" with \"iconContent\" and without path","rendering \"iconClass\" with path ","rendering \"custumIcon\" with path","rendering \"ariaHidden\" is false","rendering \"IconName\"","rendering custom icon name","rendering the \"titlePostion\" to - top","rendering the \"titlePostion\" to - bottom","rendering the \"titlePostion\" to - left","rendering the \"titlePostion\" to - right"],"failedCaseList":[]}},{"fileName":"/Users/bharathi-zt93/git/library/jsapps/dot/icons/src/Icon/__tests__/FontIcon.spec.js","CaseList":{"passedCaseList":["rendering the \"default\" props","checking \"isBold\" is true","checking \"isBold\" is false","rendering the \"iconClass\"","rendering the \"fontSize\"","rendering the \"title\"","rendering the \"pathname\"","rendering \"Name\" with \"iconContent\" and without path","rendering \"iconClass\" with path ","rendering \"custumIcon\" with path","rendering \"ariaHidden\" is false","rendering \"IconName\"","rendering custom icon name","rendering the \"titlePostion\" to - top","rendering the \"titlePostion\" to - bottom","rendering the \"titlePostion\" to - left","rendering the \"titlePostion\" to - right"],"failedCaseList":[]}}]}}}
@@ -0,0 +1,37 @@
1
+ <html>
2
+ <head>
3
+ <style>
4
+ .red{
5
+ font-weight:bold;
6
+ color:red;
7
+ }
8
+ .green{
9
+ font-weight:bold;
10
+ color:green;
11
+ }
12
+ table
13
+ {
14
+ font-family: arial, sans-serif;
15
+ border-collapse: collapse;
16
+ }
17
+
18
+ td, th
19
+ {
20
+ border: 1px solid #dddddd;
21
+ padding: 8px;
22
+ }
23
+ </style>
24
+ </head>
25
+ <body>
26
+ <table>
27
+ <tr>
28
+ <th>Title</th>
29
+ <th>FullName</th>
30
+ <th>Test Case Path</th>
31
+ </tr>
32
+
33
+ </table>
34
+ <br/>COVERAGE <span class="green">93.59%</span> <br/> less than 60% consider failure
35
+ </body>
36
+ </html>
37
+