1 | "use client";
|
2 | "use strict";
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | Object.defineProperty(exports, "default", {
|
7 | enumerable: true,
|
8 | get: function() {
|
9 | return _default;
|
10 | }
|
11 | });
|
12 | var _react = _interop_require_wildcard(require("react"));
|
13 | var _classnames = _interop_require_default(require("classnames"));
|
14 | var _colors = require("@ant-design/colors");
|
15 | var _Context = _interop_require_default(require("./Context"));
|
16 | var _IconBase = _interop_require_default(require("./IconBase"));
|
17 | var _twoTonePrimaryColor = require("./twoTonePrimaryColor");
|
18 | var _utils = require("../utils");
|
19 | function _array_like_to_array(arr, len) {
|
20 | if (len == null || len > arr.length) len = arr.length;
|
21 | for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
22 | return arr2;
|
23 | }
|
24 | function _array_with_holes(arr) {
|
25 | if (Array.isArray(arr)) return arr;
|
26 | }
|
27 | function _define_property(obj, key, value) {
|
28 | if (key in obj) {
|
29 | Object.defineProperty(obj, key, {
|
30 | value: value,
|
31 | enumerable: true,
|
32 | configurable: true,
|
33 | writable: true
|
34 | });
|
35 | } else {
|
36 | obj[key] = value;
|
37 | }
|
38 | return obj;
|
39 | }
|
40 | function _interop_require_default(obj) {
|
41 | return obj && obj.__esModule ? obj : {
|
42 | default: obj
|
43 | };
|
44 | }
|
45 | function _getRequireWildcardCache(nodeInterop) {
|
46 | if (typeof WeakMap !== "function") return null;
|
47 | var cacheBabelInterop = new WeakMap();
|
48 | var cacheNodeInterop = new WeakMap();
|
49 | return (_getRequireWildcardCache = function(nodeInterop) {
|
50 | return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
51 | })(nodeInterop);
|
52 | }
|
53 | function _interop_require_wildcard(obj, nodeInterop) {
|
54 | if (!nodeInterop && obj && obj.__esModule) {
|
55 | return obj;
|
56 | }
|
57 | if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
58 | return {
|
59 | default: obj
|
60 | };
|
61 | }
|
62 | var cache = _getRequireWildcardCache(nodeInterop);
|
63 | if (cache && cache.has(obj)) {
|
64 | return cache.get(obj);
|
65 | }
|
66 | var newObj = {};
|
67 | var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
68 | for(var key in obj){
|
69 | if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
70 | var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
71 | if (desc && (desc.get || desc.set)) {
|
72 | Object.defineProperty(newObj, key, desc);
|
73 | } else {
|
74 | newObj[key] = obj[key];
|
75 | }
|
76 | }
|
77 | }
|
78 | newObj.default = obj;
|
79 | if (cache) {
|
80 | cache.set(obj, newObj);
|
81 | }
|
82 | return newObj;
|
83 | }
|
84 | function _iterable_to_array_limit(arr, i) {
|
85 | var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
86 | if (_i == null) return;
|
87 | var _arr = [];
|
88 | var _n = true;
|
89 | var _d = false;
|
90 | var _s, _e;
|
91 | try {
|
92 | for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
93 | _arr.push(_s.value);
|
94 | if (i && _arr.length === i) break;
|
95 | }
|
96 | } catch (err) {
|
97 | _d = true;
|
98 | _e = err;
|
99 | } finally{
|
100 | try {
|
101 | if (!_n && _i["return"] != null) _i["return"]();
|
102 | } finally{
|
103 | if (_d) throw _e;
|
104 | }
|
105 | }
|
106 | return _arr;
|
107 | }
|
108 | function _non_iterable_rest() {
|
109 | throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
110 | }
|
111 | function _object_spread(target) {
|
112 | for(var i = 1; i < arguments.length; i++){
|
113 | var source = arguments[i] != null ? arguments[i] : {};
|
114 | var ownKeys = Object.keys(source);
|
115 | if (typeof Object.getOwnPropertySymbols === "function") {
|
116 | ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
117 | return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
118 | }));
|
119 | }
|
120 | ownKeys.forEach(function(key) {
|
121 | _define_property(target, key, source[key]);
|
122 | });
|
123 | }
|
124 | return target;
|
125 | }
|
126 | function ownKeys(object, enumerableOnly) {
|
127 | var keys = Object.keys(object);
|
128 | if (Object.getOwnPropertySymbols) {
|
129 | var symbols = Object.getOwnPropertySymbols(object);
|
130 | if (enumerableOnly) {
|
131 | symbols = symbols.filter(function(sym) {
|
132 | return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
133 | });
|
134 | }
|
135 | keys.push.apply(keys, symbols);
|
136 | }
|
137 | return keys;
|
138 | }
|
139 | function _object_spread_props(target, source) {
|
140 | source = source != null ? source : {};
|
141 | if (Object.getOwnPropertyDescriptors) {
|
142 | Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
143 | } else {
|
144 | ownKeys(Object(source)).forEach(function(key) {
|
145 | Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
146 | });
|
147 | }
|
148 | return target;
|
149 | }
|
150 | function _object_without_properties(source, excluded) {
|
151 | if (source == null) return {};
|
152 | var target = _object_without_properties_loose(source, excluded);
|
153 | var key, i;
|
154 | if (Object.getOwnPropertySymbols) {
|
155 | var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
156 | for(i = 0; i < sourceSymbolKeys.length; i++){
|
157 | key = sourceSymbolKeys[i];
|
158 | if (excluded.indexOf(key) >= 0) continue;
|
159 | if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
160 | target[key] = source[key];
|
161 | }
|
162 | }
|
163 | return target;
|
164 | }
|
165 | function _object_without_properties_loose(source, excluded) {
|
166 | if (source == null) return {};
|
167 | var target = {};
|
168 | var sourceKeys = Object.keys(source);
|
169 | var key, i;
|
170 | for(i = 0; i < sourceKeys.length; i++){
|
171 | key = sourceKeys[i];
|
172 | if (excluded.indexOf(key) >= 0) continue;
|
173 | target[key] = source[key];
|
174 | }
|
175 | return target;
|
176 | }
|
177 | function _sliced_to_array(arr, i) {
|
178 | return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
179 | }
|
180 | function _unsupported_iterable_to_array(o, minLen) {
|
181 | if (!o) return;
|
182 | if (typeof o === "string") return _array_like_to_array(o, minLen);
|
183 | var n = Object.prototype.toString.call(o).slice(8, -1);
|
184 | if (n === "Object" && o.constructor) n = o.constructor.name;
|
185 | if (n === "Map" || n === "Set") return Array.from(n);
|
186 | if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
187 | }
|
188 |
|
189 |
|
190 | (0, _twoTonePrimaryColor.setTwoToneColor)(_colors.blue.primary);
|
191 | var Icon = _react.forwardRef(function(props, ref) {
|
192 | var
|
193 | className = props.className,
|
194 | icon = props.icon, spin = props.spin, rotate = props.rotate, tabIndex = props.tabIndex, onClick = props.onClick,
|
195 | twoToneColor = props.twoToneColor, restProps = _object_without_properties(props, [
|
196 | "className",
|
197 | "icon",
|
198 | "spin",
|
199 | "rotate",
|
200 | "tabIndex",
|
201 | "onClick",
|
202 | "twoToneColor"
|
203 | ]);
|
204 | var _React_useContext = _react.useContext(_Context.default), _React_useContext_prefixCls = _React_useContext.prefixCls, prefixCls = _React_useContext_prefixCls === void 0 ? "anticon" : _React_useContext_prefixCls, rootClassName = _React_useContext.rootClassName;
|
205 | var _obj;
|
206 | var classString = (0, _classnames.default)(rootClassName, prefixCls, (_obj = {}, _define_property(_obj, "".concat(prefixCls, "-").concat(icon.name), !!icon.name), _define_property(_obj, "".concat(prefixCls, "-spin"), !!spin || icon.name === "loading"), _obj), className);
|
207 | var iconTabIndex = tabIndex;
|
208 | if (iconTabIndex === undefined && onClick) {
|
209 | iconTabIndex = -1;
|
210 | }
|
211 | var svgStyle = rotate ? {
|
212 | msTransform: "rotate(".concat(rotate, "deg)"),
|
213 | transform: "rotate(".concat(rotate, "deg)")
|
214 | } : undefined;
|
215 | var _normalizeTwoToneColors = _sliced_to_array((0, _utils.normalizeTwoToneColors)(twoToneColor), 2), primaryColor = _normalizeTwoToneColors[0], secondaryColor = _normalizeTwoToneColors[1];
|
216 | return _react.createElement("span", _object_spread_props(_object_spread({
|
217 | role: "img",
|
218 | "aria-label": icon.name
|
219 | }, restProps), {
|
220 | ref: ref,
|
221 | tabIndex: iconTabIndex,
|
222 | onClick: onClick,
|
223 | className: classString
|
224 | }), _react.createElement(_IconBase.default, {
|
225 | icon: icon,
|
226 | primaryColor: primaryColor,
|
227 | secondaryColor: secondaryColor,
|
228 | style: svgStyle
|
229 | }));
|
230 | });
|
231 | Icon.displayName = "AntdIcon";
|
232 | Icon.getTwoToneColor = _twoTonePrimaryColor.getTwoToneColor;
|
233 | Icon.setTwoToneColor = _twoTonePrimaryColor.setTwoToneColor;
|
234 | var _default = Icon;
|