@ant-design/icons 5.0.0 → 5.0.1

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/dist/index.umd.js CHANGED
@@ -28,8 +28,49 @@
28
28
  throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
29
29
  }
30
30
 
31
+ var _typeof_1 = createCommonjsModule(function (module) {
32
+ function _typeof(obj) {
33
+ "@babel/helpers - typeof";
34
+
35
+ return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
36
+ return typeof obj;
37
+ } : function (obj) {
38
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
39
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
40
+ }
41
+ module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
42
+ });
43
+
44
+ var _typeof = /*@__PURE__*/getDefaultExportFromCjs(_typeof_1);
45
+
46
+ var toPrimitive = createCommonjsModule(function (module) {
47
+ var _typeof = _typeof_1["default"];
48
+ function _toPrimitive(input, hint) {
49
+ if (_typeof(input) !== "object" || input === null) return input;
50
+ var prim = input[Symbol.toPrimitive];
51
+ if (prim !== undefined) {
52
+ var res = prim.call(input, hint || "default");
53
+ if (_typeof(res) !== "object") return res;
54
+ throw new TypeError("@@toPrimitive must return a primitive value.");
55
+ }
56
+ return (hint === "string" ? String : Number)(input);
57
+ }
58
+ module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
59
+ });
60
+
61
+ var toPropertyKey = createCommonjsModule(function (module) {
62
+ var _typeof = _typeof_1["default"];
63
+
64
+ function _toPropertyKey(arg) {
65
+ var key = toPrimitive(arg, "string");
66
+ return _typeof(key) === "symbol" ? key : String(key);
67
+ }
68
+ module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
69
+ });
70
+
31
71
  var defineProperty = createCommonjsModule(function (module) {
32
72
  function _defineProperty(obj, key, value) {
73
+ key = toPropertyKey(key);
33
74
  if (key in obj) {
34
75
  Object.defineProperty(obj, key, {
35
76
  value: value,
@@ -92,28 +133,31 @@
92
133
 
93
134
  var iterableToArrayLimit = createCommonjsModule(function (module) {
94
135
  function _iterableToArrayLimit(arr, i) {
95
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
96
- if (_i == null) return;
97
- var _arr = [];
98
- var _n = true;
99
- var _d = false;
100
- var _s, _e;
101
- try {
102
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
103
- _arr.push(_s.value);
104
- if (i && _arr.length === i) break;
105
- }
106
- } catch (err) {
107
- _d = true;
108
- _e = err;
109
- } finally {
136
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
137
+ if (null != _i) {
138
+ var _s,
139
+ _e,
140
+ _x,
141
+ _r,
142
+ _arr = [],
143
+ _n = !0,
144
+ _d = !1;
110
145
  try {
111
- if (!_n && _i["return"] != null) _i["return"]();
146
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
147
+ if (Object(_i) !== _i) return;
148
+ _n = !1;
149
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
150
+ } catch (err) {
151
+ _d = !0, _e = err;
112
152
  } finally {
113
- if (_d) throw _e;
153
+ try {
154
+ if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
155
+ } finally {
156
+ if (_d) throw _e;
157
+ }
114
158
  }
159
+ return _arr;
115
160
  }
116
- return _arr;
117
161
  }
118
162
  module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
119
163
  });
@@ -121,9 +165,7 @@
121
165
  var arrayLikeToArray = createCommonjsModule(function (module) {
122
166
  function _arrayLikeToArray(arr, len) {
123
167
  if (len == null || len > arr.length) len = arr.length;
124
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
125
- arr2[i] = arr[i];
126
- }
168
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
127
169
  return arr2;
128
170
  }
129
171
  module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
@@ -194,7 +236,7 @@
194
236
 
195
237
  var _objectWithoutProperties = /*@__PURE__*/getDefaultExportFromCjs(objectWithoutProperties);
196
238
 
197
- var classnames = createCommonjsModule(function (module) {
239
+ var _classnames_2_3_2_classnames = createCommonjsModule(function (module) {
198
240
  /*!
199
241
  Copyright (c) 2018 Jed Watson.
200
242
  Licensed under the MIT License (MIT), see
@@ -250,21 +292,6 @@
250
292
  }());
251
293
  });
252
294
 
253
- var _typeof_1 = createCommonjsModule(function (module) {
254
- function _typeof(obj) {
255
- "@babel/helpers - typeof";
256
-
257
- return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
258
- return typeof obj;
259
- } : function (obj) {
260
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
261
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
262
- }
263
- module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
264
- });
265
-
266
- var _typeof = /*@__PURE__*/getDefaultExportFromCjs(_typeof_1);
267
-
268
295
  /**
269
296
  * Take input from [0, n] and return it as [0, 1]
270
297
  * @hidden
@@ -643,6 +670,7 @@
643
670
  yellowgreen: '#9acd32',
644
671
  };
645
672
 
673
+ /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
646
674
  /**
647
675
  * Given a string or object, convert that input to RGB
648
676
  *
@@ -1055,46 +1083,37 @@
1055
1083
  exports.resetWarned = resetWarned;
1056
1084
  exports.warning = warning;
1057
1085
  exports.warningOnce = warningOnce;
1058
-
1059
1086
  /* eslint-disable no-console */
1060
1087
  var warned = {};
1061
-
1062
1088
  function warning(valid, message) {
1063
1089
  // Support uglify
1064
1090
  if ( !valid && console !== undefined) {
1065
1091
  console.error("Warning: ".concat(message));
1066
1092
  }
1067
1093
  }
1068
-
1069
1094
  function note(valid, message) {
1070
1095
  // Support uglify
1071
1096
  if ( !valid && console !== undefined) {
1072
1097
  console.warn("Note: ".concat(message));
1073
1098
  }
1074
1099
  }
1075
-
1076
1100
  function resetWarned() {
1077
1101
  warned = {};
1078
1102
  }
1079
-
1080
1103
  function call(method, valid, message) {
1081
1104
  if (!valid && !warned[message]) {
1082
1105
  method(false, message);
1083
1106
  warned[message] = true;
1084
1107
  }
1085
1108
  }
1086
-
1087
1109
  function warningOnce(valid, message) {
1088
1110
  call(warning, valid, message);
1089
1111
  }
1090
-
1091
1112
  function noteOnce(valid, message) {
1092
1113
  call(note, valid, message);
1093
1114
  }
1094
-
1095
1115
  var _default = warningOnce;
1096
1116
  /* eslint-enable */
1097
-
1098
1117
  exports.default = _default;
1099
1118
  });
1100
1119
 
@@ -1115,7 +1134,6 @@
1115
1134
  value: true
1116
1135
  });
1117
1136
  exports.default = canUseDom;
1118
-
1119
1137
  function canUseDom() {
1120
1138
  return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
1121
1139
  }
@@ -1127,28 +1145,22 @@
1127
1145
  value: true
1128
1146
  });
1129
1147
  exports.default = contains;
1130
-
1131
1148
  function contains(root, n) {
1132
1149
  if (!root) {
1133
1150
  return false;
1134
- } // Use native if support
1135
-
1136
-
1151
+ }
1152
+ // Use native if support
1137
1153
  if (root.contains) {
1138
1154
  return root.contains(n);
1139
- } // `document.contains` not support with IE11
1140
-
1141
-
1155
+ }
1156
+ // `document.contains` not support with IE11
1142
1157
  var node = n;
1143
-
1144
1158
  while (node) {
1145
1159
  if (node === root) {
1146
1160
  return true;
1147
1161
  }
1148
-
1149
1162
  node = node.parentNode;
1150
1163
  }
1151
-
1152
1164
  return false;
1153
1165
  }
1154
1166
  });
@@ -1156,102 +1168,80 @@
1156
1168
  var dynamicCSS = createCommonjsModule(function (module, exports) {
1157
1169
 
1158
1170
  var _interopRequireDefault = interopRequireDefault.default;
1159
-
1160
1171
  Object.defineProperty(exports, "__esModule", {
1161
1172
  value: true
1162
1173
  });
1174
+ exports.clearContainerCache = clearContainerCache;
1163
1175
  exports.injectCSS = injectCSS;
1164
1176
  exports.removeCSS = removeCSS;
1165
1177
  exports.updateCSS = updateCSS;
1166
-
1167
1178
  var _canUseDom = _interopRequireDefault(canUseDom_1);
1168
-
1169
1179
  var _contains = _interopRequireDefault(contains_1);
1170
-
1171
1180
  var APPEND_ORDER = 'data-rc-order';
1172
1181
  var MARK_KEY = "rc-util-key";
1173
1182
  var containerCache = new Map();
1174
-
1175
1183
  function getMark() {
1176
1184
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1177
- mark = _ref.mark;
1178
-
1185
+ mark = _ref.mark;
1179
1186
  if (mark) {
1180
1187
  return mark.startsWith('data-') ? mark : "data-".concat(mark);
1181
1188
  }
1182
-
1183
1189
  return MARK_KEY;
1184
1190
  }
1185
-
1186
1191
  function getContainer(option) {
1187
1192
  if (option.attachTo) {
1188
1193
  return option.attachTo;
1189
1194
  }
1190
-
1191
1195
  var head = document.querySelector('head');
1192
1196
  return head || document.body;
1193
1197
  }
1194
-
1195
1198
  function getOrder(prepend) {
1196
1199
  if (prepend === 'queue') {
1197
1200
  return 'prependQueue';
1198
1201
  }
1199
-
1200
1202
  return prepend ? 'prepend' : 'append';
1201
1203
  }
1202
1204
  /**
1203
1205
  * Find style which inject by rc-util
1204
1206
  */
1205
-
1206
-
1207
1207
  function findStyles(container) {
1208
1208
  return Array.from((containerCache.get(container) || container).children).filter(function (node) {
1209
1209
  return node.tagName === 'STYLE';
1210
1210
  });
1211
1211
  }
1212
-
1213
1212
  function injectCSS(css) {
1214
1213
  var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1215
-
1216
1214
  if (!(0, _canUseDom.default)()) {
1217
1215
  return null;
1218
1216
  }
1219
-
1220
1217
  var csp = option.csp,
1221
- prepend = option.prepend;
1218
+ prepend = option.prepend;
1222
1219
  var styleNode = document.createElement('style');
1223
1220
  styleNode.setAttribute(APPEND_ORDER, getOrder(prepend));
1224
-
1225
1221
  if (csp === null || csp === void 0 ? void 0 : csp.nonce) {
1226
1222
  styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;
1227
1223
  }
1228
-
1229
1224
  styleNode.innerHTML = css;
1230
1225
  var container = getContainer(option);
1231
1226
  var firstChild = container.firstChild;
1232
-
1233
1227
  if (prepend) {
1234
1228
  // If is queue `prepend`, it will prepend first style and then append rest style
1235
1229
  if (prepend === 'queue') {
1236
1230
  var existStyle = findStyles(container).filter(function (node) {
1237
1231
  return ['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER));
1238
1232
  });
1239
-
1240
1233
  if (existStyle.length) {
1241
1234
  container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
1242
1235
  return styleNode;
1243
1236
  }
1244
- } // Use `insertBefore` as `prepend`
1245
-
1246
-
1237
+ }
1238
+ // Use `insertBefore` as `prepend`
1247
1239
  container.insertBefore(styleNode, firstChild);
1248
1240
  } else {
1249
1241
  container.appendChild(styleNode);
1250
1242
  }
1251
-
1252
1243
  return styleNode;
1253
1244
  }
1254
-
1255
1245
  function findExistNode(key) {
1256
1246
  var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1257
1247
  var container = getContainer(option);
@@ -1259,53 +1249,50 @@
1259
1249
  return node.getAttribute(getMark(option)) === key;
1260
1250
  });
1261
1251
  }
1262
-
1263
1252
  function removeCSS(key) {
1264
- var _existNode$parentNode;
1265
-
1266
1253
  var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1267
1254
  var existNode = findExistNode(key, option);
1268
- existNode === null || existNode === void 0 ? void 0 : (_existNode$parentNode = existNode.parentNode) === null || _existNode$parentNode === void 0 ? void 0 : _existNode$parentNode.removeChild(existNode);
1255
+ if (existNode) {
1256
+ var container = getContainer(option);
1257
+ container.removeChild(existNode);
1258
+ }
1269
1259
  }
1270
1260
  /**
1271
1261
  * qiankun will inject `appendChild` to insert into other
1272
1262
  */
1273
-
1274
-
1275
1263
  function syncRealContainer(container, option) {
1276
- var cachedRealContainer = containerCache.get(container); // Find real container when not cached or cached container removed
1277
-
1264
+ var cachedRealContainer = containerCache.get(container);
1265
+ // Find real container when not cached or cached container removed
1278
1266
  if (!cachedRealContainer || !(0, _contains.default)(document, cachedRealContainer)) {
1279
1267
  var placeholderStyle = injectCSS('', option);
1280
1268
  var parentNode = placeholderStyle.parentNode;
1281
1269
  containerCache.set(container, parentNode);
1282
- parentNode.removeChild(placeholderStyle);
1270
+ container.removeChild(placeholderStyle);
1283
1271
  }
1284
1272
  }
1285
-
1273
+ /**
1274
+ * manually clear container cache to avoid global cache in unit testes
1275
+ */
1276
+ function clearContainerCache() {
1277
+ containerCache.clear();
1278
+ }
1286
1279
  function updateCSS(css, key) {
1287
1280
  var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1288
- var container = getContainer(option); // Sync real parent
1289
-
1281
+ var container = getContainer(option);
1282
+ // Sync real parent
1290
1283
  syncRealContainer(container, option);
1291
1284
  var existNode = findExistNode(key, option);
1292
-
1293
1285
  if (existNode) {
1294
1286
  var _option$csp, _option$csp2;
1295
-
1296
1287
  if (((_option$csp = option.csp) === null || _option$csp === void 0 ? void 0 : _option$csp.nonce) && existNode.nonce !== ((_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce)) {
1297
1288
  var _option$csp3;
1298
-
1299
1289
  existNode.nonce = (_option$csp3 = option.csp) === null || _option$csp3 === void 0 ? void 0 : _option$csp3.nonce;
1300
1290
  }
1301
-
1302
1291
  if (existNode.innerHTML !== css) {
1303
1292
  existNode.innerHTML = css;
1304
1293
  }
1305
-
1306
1294
  return existNode;
1307
1295
  }
1308
-
1309
1296
  var newNode = injectCSS(css, option);
1310
1297
  newNode.setAttribute(getMark(option), key);
1311
1298
  return newNode;
@@ -1370,9 +1357,14 @@
1370
1357
  var useInsertStyles = function useInsertStyles() {
1371
1358
  var styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : iconStyles;
1372
1359
  var _useContext = React.useContext(IconContext),
1373
- csp = _useContext.csp;
1360
+ csp = _useContext.csp,
1361
+ prefixCls = _useContext.prefixCls;
1362
+ var mergedStyleStr = styleStr;
1363
+ if (prefixCls) {
1364
+ mergedStyleStr = mergedStyleStr.replace(/anticon/g, prefixCls);
1365
+ }
1374
1366
  React.useEffect(function () {
1375
- dynamicCSS.updateCSS(styleStr, '@ant-design-icons', {
1367
+ dynamicCSS.updateCSS(mergedStyleStr, '@ant-design-icons', {
1376
1368
  prepend: true,
1377
1369
  csp: csp
1378
1370
  });
@@ -1472,7 +1464,7 @@
1472
1464
  _React$useContext$pre = _React$useContext.prefixCls,
1473
1465
  prefixCls = _React$useContext$pre === void 0 ? 'anticon' : _React$useContext$pre,
1474
1466
  rootClassName = _React$useContext.rootClassName;
1475
- var classString = classnames(rootClassName, prefixCls, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-").concat(icon.name), !!icon.name), _defineProperty(_classNames, "".concat(prefixCls, "-spin"), !!spin || icon.name === 'loading'), _classNames), className);
1467
+ var classString = _classnames_2_3_2_classnames(rootClassName, prefixCls, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-").concat(icon.name), !!icon.name), _defineProperty(_classNames, "".concat(prefixCls, "-spin"), !!spin || icon.name === 'loading'), _classNames), className);
1476
1468
  var iconTabIndex = tabIndex;
1477
1469
  if (iconTabIndex === undefined && onClick) {
1478
1470
  iconTabIndex = -1;
@@ -15714,8 +15706,8 @@
15714
15706
  _React$useContext$pre = _React$useContext.prefixCls,
15715
15707
  prefixCls = _React$useContext$pre === void 0 ? 'anticon' : _React$useContext$pre,
15716
15708
  rootClassName = _React$useContext.rootClassName;
15717
- var classString = classnames(rootClassName, prefixCls, className);
15718
- var svgClassString = classnames(_defineProperty({}, "".concat(prefixCls, "-spin"), !!spin));
15709
+ var classString = _classnames_2_3_2_classnames(rootClassName, prefixCls, className);
15710
+ var svgClassString = _classnames_2_3_2_classnames(_defineProperty({}, "".concat(prefixCls, "-spin"), !!spin));
15719
15711
  var svgStyle = rotate ? {
15720
15712
  msTransform: "rotate(".concat(rotate, "deg)"),
15721
15713
  transform: "rotate(".concat(rotate, "deg)")