@ant-design/icons 4.8.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
  *
@@ -868,9 +896,10 @@
868
896
  }, {
869
897
  index: 1,
870
898
  opacity: 0.98
871
- }]; // Wrapper function ported from TinyColor.prototype.toHsv
872
- // Keep it here because of `hsv.h * 360`
899
+ }];
873
900
 
901
+ // Wrapper function ported from TinyColor.prototype.toHsv
902
+ // Keep it here because of `hsv.h * 360`
874
903
  function toHsv(_ref) {
875
904
  var r = _ref.r,
876
905
  g = _ref.g,
@@ -1023,7 +1052,7 @@
1023
1052
  lime: '#A0D911',
1024
1053
  green: '#52C41A',
1025
1054
  cyan: '#13C2C2',
1026
- blue: '#1890FF',
1055
+ blue: '#1677FF',
1027
1056
  geekblue: '#2F54EB',
1028
1057
  purple: '#722ED1',
1029
1058
  magenta: '#EB2F96',
@@ -1054,46 +1083,37 @@
1054
1083
  exports.resetWarned = resetWarned;
1055
1084
  exports.warning = warning;
1056
1085
  exports.warningOnce = warningOnce;
1057
-
1058
1086
  /* eslint-disable no-console */
1059
1087
  var warned = {};
1060
-
1061
1088
  function warning(valid, message) {
1062
1089
  // Support uglify
1063
1090
  if ( !valid && console !== undefined) {
1064
1091
  console.error("Warning: ".concat(message));
1065
1092
  }
1066
1093
  }
1067
-
1068
1094
  function note(valid, message) {
1069
1095
  // Support uglify
1070
1096
  if ( !valid && console !== undefined) {
1071
1097
  console.warn("Note: ".concat(message));
1072
1098
  }
1073
1099
  }
1074
-
1075
1100
  function resetWarned() {
1076
1101
  warned = {};
1077
1102
  }
1078
-
1079
1103
  function call(method, valid, message) {
1080
1104
  if (!valid && !warned[message]) {
1081
1105
  method(false, message);
1082
1106
  warned[message] = true;
1083
1107
  }
1084
1108
  }
1085
-
1086
1109
  function warningOnce(valid, message) {
1087
1110
  call(warning, valid, message);
1088
1111
  }
1089
-
1090
1112
  function noteOnce(valid, message) {
1091
1113
  call(note, valid, message);
1092
1114
  }
1093
-
1094
1115
  var _default = warningOnce;
1095
1116
  /* eslint-enable */
1096
-
1097
1117
  exports.default = _default;
1098
1118
  });
1099
1119
 
@@ -1114,7 +1134,6 @@
1114
1134
  value: true
1115
1135
  });
1116
1136
  exports.default = canUseDom;
1117
-
1118
1137
  function canUseDom() {
1119
1138
  return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
1120
1139
  }
@@ -1126,28 +1145,22 @@
1126
1145
  value: true
1127
1146
  });
1128
1147
  exports.default = contains;
1129
-
1130
1148
  function contains(root, n) {
1131
1149
  if (!root) {
1132
1150
  return false;
1133
- } // Use native if support
1134
-
1135
-
1151
+ }
1152
+ // Use native if support
1136
1153
  if (root.contains) {
1137
1154
  return root.contains(n);
1138
- } // `document.contains` not support with IE11
1139
-
1140
-
1155
+ }
1156
+ // `document.contains` not support with IE11
1141
1157
  var node = n;
1142
-
1143
1158
  while (node) {
1144
1159
  if (node === root) {
1145
1160
  return true;
1146
1161
  }
1147
-
1148
1162
  node = node.parentNode;
1149
1163
  }
1150
-
1151
1164
  return false;
1152
1165
  }
1153
1166
  });
@@ -1155,102 +1168,80 @@
1155
1168
  var dynamicCSS = createCommonjsModule(function (module, exports) {
1156
1169
 
1157
1170
  var _interopRequireDefault = interopRequireDefault.default;
1158
-
1159
1171
  Object.defineProperty(exports, "__esModule", {
1160
1172
  value: true
1161
1173
  });
1174
+ exports.clearContainerCache = clearContainerCache;
1162
1175
  exports.injectCSS = injectCSS;
1163
1176
  exports.removeCSS = removeCSS;
1164
1177
  exports.updateCSS = updateCSS;
1165
-
1166
1178
  var _canUseDom = _interopRequireDefault(canUseDom_1);
1167
-
1168
1179
  var _contains = _interopRequireDefault(contains_1);
1169
-
1170
1180
  var APPEND_ORDER = 'data-rc-order';
1171
1181
  var MARK_KEY = "rc-util-key";
1172
1182
  var containerCache = new Map();
1173
-
1174
1183
  function getMark() {
1175
1184
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1176
- mark = _ref.mark;
1177
-
1185
+ mark = _ref.mark;
1178
1186
  if (mark) {
1179
1187
  return mark.startsWith('data-') ? mark : "data-".concat(mark);
1180
1188
  }
1181
-
1182
1189
  return MARK_KEY;
1183
1190
  }
1184
-
1185
1191
  function getContainer(option) {
1186
1192
  if (option.attachTo) {
1187
1193
  return option.attachTo;
1188
1194
  }
1189
-
1190
1195
  var head = document.querySelector('head');
1191
1196
  return head || document.body;
1192
1197
  }
1193
-
1194
1198
  function getOrder(prepend) {
1195
1199
  if (prepend === 'queue') {
1196
1200
  return 'prependQueue';
1197
1201
  }
1198
-
1199
1202
  return prepend ? 'prepend' : 'append';
1200
1203
  }
1201
1204
  /**
1202
1205
  * Find style which inject by rc-util
1203
1206
  */
1204
-
1205
-
1206
1207
  function findStyles(container) {
1207
1208
  return Array.from((containerCache.get(container) || container).children).filter(function (node) {
1208
1209
  return node.tagName === 'STYLE';
1209
1210
  });
1210
1211
  }
1211
-
1212
1212
  function injectCSS(css) {
1213
1213
  var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1214
-
1215
1214
  if (!(0, _canUseDom.default)()) {
1216
1215
  return null;
1217
1216
  }
1218
-
1219
1217
  var csp = option.csp,
1220
- prepend = option.prepend;
1218
+ prepend = option.prepend;
1221
1219
  var styleNode = document.createElement('style');
1222
1220
  styleNode.setAttribute(APPEND_ORDER, getOrder(prepend));
1223
-
1224
1221
  if (csp === null || csp === void 0 ? void 0 : csp.nonce) {
1225
1222
  styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;
1226
1223
  }
1227
-
1228
1224
  styleNode.innerHTML = css;
1229
1225
  var container = getContainer(option);
1230
1226
  var firstChild = container.firstChild;
1231
-
1232
1227
  if (prepend) {
1233
1228
  // If is queue `prepend`, it will prepend first style and then append rest style
1234
1229
  if (prepend === 'queue') {
1235
1230
  var existStyle = findStyles(container).filter(function (node) {
1236
1231
  return ['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER));
1237
1232
  });
1238
-
1239
1233
  if (existStyle.length) {
1240
1234
  container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
1241
1235
  return styleNode;
1242
1236
  }
1243
- } // Use `insertBefore` as `prepend`
1244
-
1245
-
1237
+ }
1238
+ // Use `insertBefore` as `prepend`
1246
1239
  container.insertBefore(styleNode, firstChild);
1247
1240
  } else {
1248
1241
  container.appendChild(styleNode);
1249
1242
  }
1250
-
1251
1243
  return styleNode;
1252
1244
  }
1253
-
1254
1245
  function findExistNode(key) {
1255
1246
  var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1256
1247
  var container = getContainer(option);
@@ -1258,53 +1249,50 @@
1258
1249
  return node.getAttribute(getMark(option)) === key;
1259
1250
  });
1260
1251
  }
1261
-
1262
1252
  function removeCSS(key) {
1263
- var _existNode$parentNode;
1264
-
1265
1253
  var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1266
1254
  var existNode = findExistNode(key, option);
1267
- 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
+ }
1268
1259
  }
1269
1260
  /**
1270
1261
  * qiankun will inject `appendChild` to insert into other
1271
1262
  */
1272
-
1273
-
1274
1263
  function syncRealContainer(container, option) {
1275
- var cachedRealContainer = containerCache.get(container); // Find real container when not cached or cached container removed
1276
-
1264
+ var cachedRealContainer = containerCache.get(container);
1265
+ // Find real container when not cached or cached container removed
1277
1266
  if (!cachedRealContainer || !(0, _contains.default)(document, cachedRealContainer)) {
1278
1267
  var placeholderStyle = injectCSS('', option);
1279
1268
  var parentNode = placeholderStyle.parentNode;
1280
1269
  containerCache.set(container, parentNode);
1281
- parentNode.removeChild(placeholderStyle);
1270
+ container.removeChild(placeholderStyle);
1282
1271
  }
1283
1272
  }
1284
-
1273
+ /**
1274
+ * manually clear container cache to avoid global cache in unit testes
1275
+ */
1276
+ function clearContainerCache() {
1277
+ containerCache.clear();
1278
+ }
1285
1279
  function updateCSS(css, key) {
1286
1280
  var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1287
- var container = getContainer(option); // Sync real parent
1288
-
1281
+ var container = getContainer(option);
1282
+ // Sync real parent
1289
1283
  syncRealContainer(container, option);
1290
1284
  var existNode = findExistNode(key, option);
1291
-
1292
1285
  if (existNode) {
1293
1286
  var _option$csp, _option$csp2;
1294
-
1295
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)) {
1296
1288
  var _option$csp3;
1297
-
1298
1289
  existNode.nonce = (_option$csp3 = option.csp) === null || _option$csp3 === void 0 ? void 0 : _option$csp3.nonce;
1299
1290
  }
1300
-
1301
1291
  if (existNode.innerHTML !== css) {
1302
1292
  existNode.innerHTML = css;
1303
1293
  }
1304
-
1305
1294
  return existNode;
1306
1295
  }
1307
-
1308
1296
  var newNode = injectCSS(css, option);
1309
1297
  newNode.setAttribute(getMark(option), key);
1310
1298
  return newNode;
@@ -1369,9 +1357,14 @@
1369
1357
  var useInsertStyles = function useInsertStyles() {
1370
1358
  var styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : iconStyles;
1371
1359
  var _useContext = React.useContext(IconContext),
1372
- 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
+ }
1373
1366
  React.useEffect(function () {
1374
- dynamicCSS.updateCSS(styleStr, '@ant-design-icons', {
1367
+ dynamicCSS.updateCSS(mergedStyleStr, '@ant-design-icons', {
1375
1368
  prepend: true,
1376
1369
  csp: csp
1377
1370
  });
@@ -1471,7 +1464,7 @@
1471
1464
  _React$useContext$pre = _React$useContext.prefixCls,
1472
1465
  prefixCls = _React$useContext$pre === void 0 ? 'anticon' : _React$useContext$pre,
1473
1466
  rootClassName = _React$useContext.rootClassName;
1474
- 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);
1475
1468
  var iconTabIndex = tabIndex;
1476
1469
  if (iconTabIndex === undefined && onClick) {
1477
1470
  iconTabIndex = -1;
@@ -15713,8 +15706,8 @@
15713
15706
  _React$useContext$pre = _React$useContext.prefixCls,
15714
15707
  prefixCls = _React$useContext$pre === void 0 ? 'anticon' : _React$useContext$pre,
15715
15708
  rootClassName = _React$useContext.rootClassName;
15716
- var classString = classnames(rootClassName, prefixCls, className);
15717
- 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));
15718
15711
  var svgStyle = rotate ? {
15719
15712
  msTransform: "rotate(".concat(rotate, "deg)"),
15720
15713
  transform: "rotate(".concat(rotate, "deg)")