@pnkx-lib/ui 1.9.178 → 1.9.180

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.
Files changed (207) hide show
  1. package/dist/style.css +1 -1
  2. package/es/chunks/AntdIcon-B_SLhOJa.js +1211 -0
  3. package/es/chunks/_commonjsHelpers-BFTU3MAI.js +7 -0
  4. package/es/chunks/bundle-mjs-BME7zF0Z.js +2956 -0
  5. package/es/chunks/common-CocKiHtC.js +3 -0
  6. package/es/chunks/defineProperty-D53odpB3.js +50 -0
  7. package/es/chunks/get-C880miVG.js +1726 -0
  8. package/es/chunks/index-mzHK7Za8.js +90 -0
  9. package/es/chunks/index.esm-DPdCEbIy.js +2276 -0
  10. package/es/chunks/jsx-runtime-DFKOoQSG.js +430 -0
  11. package/es/chunks/layout-B04d5Lfr.js +6094 -0
  12. package/es/constants/index.js +38 -0
  13. package/es/fields/CascaderField.js +59 -0
  14. package/es/fields/Checkbox.js +56 -0
  15. package/es/fields/DatePicker.js +13030 -0
  16. package/es/fields/DateRangePicker.js +58 -0
  17. package/es/fields/Input.js +1379 -0
  18. package/es/fields/PnkxField.js +19 -0
  19. package/es/fields/Radio.js +56 -0
  20. package/es/fields/Select.js +61 -0
  21. package/es/fields/SliderRanger.js +58 -0
  22. package/es/fields/SliderSingle.js +58 -0
  23. package/es/fields/Switch.js +58 -0
  24. package/es/fields/Textarea.js +66 -0
  25. package/es/fields/TinyMCE.js +1969 -0
  26. package/es/fields/Upload.js +113 -0
  27. package/es/fields/index.js +13 -2
  28. package/es/hooks/index.js +2 -1
  29. package/es/hooks/useMessage.js +15 -0
  30. package/es/{chunks/useMessage-CUPcOtIS.js → hooks/useToast.js} +2 -14
  31. package/es/index.js +74 -4
  32. package/es/ui/Alert.js +8 -0
  33. package/es/ui/Anchor.js +9 -0
  34. package/es/ui/Appfix.js +8 -0
  35. package/es/ui/AutoComplete.js +8 -0
  36. package/es/ui/Badge.js +15 -0
  37. package/es/ui/BottomPagination.js +57 -0
  38. package/es/ui/Breadcrumb.js +9 -0
  39. package/es/ui/BreadcrumbHeading.js +54 -0
  40. package/es/ui/Button.js +8 -0
  41. package/es/ui/Card.js +8 -0
  42. package/es/ui/Cascader.js +21 -0
  43. package/es/ui/CategoryStatus.js +50 -0
  44. package/es/ui/Col.js +9 -0
  45. package/es/ui/Collapse.js +8 -0
  46. package/es/ui/ColorPicker.js +8 -0
  47. package/es/ui/ConfigProvider.js +11 -0
  48. package/es/ui/ConfirmModal.js +119 -0
  49. package/es/ui/Container.js +12 -0
  50. package/es/ui/Divider.js +8 -0
  51. package/es/ui/Drawer.js +19 -0
  52. package/es/ui/Dropdown.js +9 -0
  53. package/es/ui/Empty.js +8 -0
  54. package/es/ui/ErrorBoundary.js +81 -0
  55. package/es/ui/ErrorMessage.js +14 -0
  56. package/es/ui/Flex.js +9 -0
  57. package/es/ui/Footer.js +13 -0
  58. package/es/ui/Heading.js +67 -0
  59. package/es/ui/Image.js +8 -0
  60. package/es/ui/Label.js +14 -0
  61. package/es/ui/Layout.js +25 -0
  62. package/es/ui/Menu.js +24 -0
  63. package/es/ui/Modal.js +8 -0
  64. package/es/{chunks/PageNotFound-D6b4M484.js → ui/PageNotFound.js} +7 -1865
  65. package/es/ui/Pagination.js +10 -0
  66. package/es/ui/Popconfirm.js +8 -0
  67. package/es/ui/Popover.js +9 -0
  68. package/es/ui/QRCode.js +8 -0
  69. package/es/ui/Rate.js +8 -0
  70. package/es/ui/Result.js +8 -0
  71. package/es/ui/Row.js +9 -0
  72. package/es/ui/SearchFilterForm.js +87 -0
  73. package/es/ui/Segmented.js +8 -0
  74. package/es/ui/Sidebar.js +342 -0
  75. package/es/ui/Skeleton.js +34 -0
  76. package/es/ui/Space.js +11 -0
  77. package/es/ui/Spin.js +8 -0
  78. package/es/ui/Splitter.js +11 -0
  79. package/es/ui/Statistic.js +8 -0
  80. package/es/ui/Steps.js +11 -0
  81. package/es/ui/Tabs.js +78 -0
  82. package/es/ui/Tag.js +12 -0
  83. package/es/ui/Timeline.js +8 -0
  84. package/es/ui/Tooltip.js +8 -0
  85. package/es/ui/Tour.js +8 -0
  86. package/es/ui/Tree.js +8 -0
  87. package/es/ui/Typography.js +11 -0
  88. package/es/ui/UploadImage.js +116 -0
  89. package/es/ui/Watermark.js +28 -0
  90. package/es/ui/index.js +5235 -2
  91. package/package.json +31 -1
  92. package/types/components/ui/BulkActions/BulkAction.d.ts +1 -1
  93. package/types/components/ui/BulkActions/index.d.ts +1 -1
  94. package/types/components/ui/Table/ActionRowTable/index.d.ts +1 -1
  95. package/types/components/ui/Table/HeadingTable/components/GroupHeadingButton.d.ts +1 -1
  96. package/types/components/ui/Table/index.d.ts +1 -1
  97. package/types/fields/CascaderField.d.ts +2 -0
  98. package/types/fields/Checkbox.d.ts +2 -0
  99. package/types/fields/DatePicker.d.ts +2 -0
  100. package/types/fields/DateRangePicker.d.ts +2 -0
  101. package/types/fields/Input.d.ts +2 -0
  102. package/types/fields/PnkxField.d.ts +2 -0
  103. package/types/fields/Radio.d.ts +2 -0
  104. package/types/fields/Select.d.ts +2 -0
  105. package/types/fields/SliderRanger.d.ts +2 -0
  106. package/types/fields/SliderSingle.d.ts +2 -0
  107. package/types/fields/Switch.d.ts +2 -0
  108. package/types/fields/Textarea.d.ts +2 -0
  109. package/types/fields/TinyMCE.d.ts +2 -0
  110. package/types/fields/Upload.d.ts +2 -0
  111. package/types/fields/index.d.ts +2 -0
  112. package/types/hooks/index.d.ts +2 -0
  113. package/types/hooks/useMessage.d.ts +2 -0
  114. package/types/hooks/useToast.d.ts +2 -0
  115. package/types/ui/Alert.d.ts +2 -0
  116. package/types/ui/Anchor.d.ts +2 -0
  117. package/types/ui/Appfix.d.ts +2 -0
  118. package/types/ui/AutoComplete.d.ts +2 -0
  119. package/types/ui/Badge.d.ts +2 -0
  120. package/types/ui/BottomPagination.d.ts +2 -0
  121. package/types/ui/Breadcrumb.d.ts +2 -0
  122. package/types/ui/BreadcrumbHeading.d.ts +2 -0
  123. package/types/ui/Button.d.ts +2 -0
  124. package/types/ui/Card.d.ts +2 -0
  125. package/types/ui/Cascader.d.ts +2 -0
  126. package/types/ui/CategoryStatus.d.ts +2 -0
  127. package/types/ui/Col.d.ts +2 -0
  128. package/types/ui/Collapse.d.ts +2 -0
  129. package/types/ui/ColorPicker.d.ts +2 -0
  130. package/types/ui/ConfigProvider.d.ts +2 -0
  131. package/types/ui/ConfirmModal.d.ts +2 -0
  132. package/types/ui/Container.d.ts +2 -0
  133. package/types/ui/Divider.d.ts +2 -0
  134. package/types/ui/Drawer.d.ts +2 -0
  135. package/types/ui/Dropdown.d.ts +2 -0
  136. package/types/ui/Empty.d.ts +2 -0
  137. package/types/ui/ErrorBoundary.d.ts +2 -0
  138. package/types/ui/ErrorMessage.d.ts +2 -0
  139. package/types/ui/Flex.d.ts +2 -0
  140. package/types/ui/Footer.d.ts +4 -0
  141. package/types/ui/Heading.d.ts +2 -0
  142. package/types/ui/Image.d.ts +2 -0
  143. package/types/ui/Label.d.ts +2 -0
  144. package/types/ui/Layout.d.ts +2 -0
  145. package/types/ui/Menu.d.ts +2 -0
  146. package/types/ui/Modal.d.ts +2 -0
  147. package/types/ui/PageNotFound.d.ts +2 -0
  148. package/types/ui/Pagination.d.ts +2 -0
  149. package/types/ui/Popconfirm.d.ts +2 -0
  150. package/types/ui/Popover.d.ts +2 -0
  151. package/types/ui/QRCode.d.ts +2 -0
  152. package/types/ui/Rate.d.ts +2 -0
  153. package/types/ui/Result.d.ts +2 -0
  154. package/types/ui/Row.d.ts +2 -0
  155. package/types/ui/SearchFilterForm.d.ts +2 -0
  156. package/types/ui/Segmented.d.ts +2 -0
  157. package/types/ui/Sidebar.d.ts +2 -0
  158. package/types/ui/Skeleton.d.ts +2 -0
  159. package/types/ui/Space.d.ts +2 -0
  160. package/types/ui/Spin.d.ts +2 -0
  161. package/types/ui/Splitter.d.ts +2 -0
  162. package/types/ui/Statistic.d.ts +2 -0
  163. package/types/ui/Steps.d.ts +2 -0
  164. package/types/ui/Tabs.d.ts +2 -0
  165. package/types/ui/Tag.d.ts +2 -0
  166. package/types/ui/Timeline.d.ts +2 -0
  167. package/types/ui/Tooltip.d.ts +2 -0
  168. package/types/ui/Tour.d.ts +2 -0
  169. package/types/ui/Tree.d.ts +2 -0
  170. package/types/ui/Typography.d.ts +2 -0
  171. package/types/ui/UploadImage.d.ts +2 -0
  172. package/types/ui/Watermark.d.ts +2 -0
  173. package/types/ui/index.d.ts +2 -0
  174. package/es/chunks/SliderRanger-BXe2Nxdo.js +0 -361
  175. package/es/chunks/UploadImage-x6lE6WbO.js +0 -61133
  176. package/types/App.d.ts +0 -6
  177. package/types/DemoInput/DemoInput.d.ts +0 -1
  178. package/types/DemoTable/FiltersCategoryDemo/components/RenderFilterFields.d.ts +0 -12
  179. package/types/DemoTable/FiltersCategoryDemo/components/TagsFilter.d.ts +0 -12
  180. package/types/DemoTable/FiltersCategoryDemo/index.d.ts +0 -8
  181. package/types/DemoTable/apiUser.d.ts +0 -30
  182. package/types/DemoTable/hooks/useConvertGroupButton.d.ts +0 -13
  183. package/types/DemoTable/index.d.ts +0 -2
  184. package/types/DemoTable/tabDemo.d.ts +0 -2
  185. package/types/assets/svg/404.d.ts +0 -2
  186. package/types/assets/svg/Flag.d.ts +0 -2
  187. package/types/assets/svg/Logout.d.ts +0 -2
  188. package/types/assets/svg/PageNotFoundIcon.d.ts +0 -3
  189. package/types/assets/svg/Search.d.ts +0 -2
  190. package/types/assets/svg/Setting.d.ts +0 -2
  191. package/types/component-test/category-city.d.ts +0 -2
  192. package/types/component-test/category-manager.d.ts +0 -2
  193. package/types/component-test/default-layout.d.ts +0 -6
  194. package/types/component-test/detail-user.d.ts +0 -2
  195. package/types/component-test/permistion-user.d.ts +0 -2
  196. package/types/component-test/user-list.d.ts +0 -2
  197. package/types/fields.d.ts +0 -2
  198. package/types/hooks.d.ts +0 -2
  199. package/types/interface/common.d.ts +0 -14
  200. package/types/interface/tab.d.ts +0 -5
  201. package/types/main.d.ts +0 -0
  202. package/types/stores/tabStore.d.ts +0 -6
  203. package/types/stories/Input.stories.d.ts +0 -6
  204. package/types/ui.d.ts +0 -2
  205. package/types/utils/router.d.ts +0 -35
  206. package/types/utils/timer.d.ts +0 -7
  207. package/types/vite-env.d.ts +0 -1
@@ -0,0 +1,1211 @@
1
+ import { _ as _unsupportedIterableToArray, a as _defineProperty, b as _typeof } from './defineProperty-D53odpB3.js';
2
+ import * as React from 'react';
3
+ import React__default, { createContext, useContext, useEffect } from 'react';
4
+ import { c as className } from './index-mzHK7Za8.js';
5
+
6
+ var IconContext = /*#__PURE__*/createContext({});
7
+
8
+ function _extends() {
9
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
10
+ for (var e = 1; e < arguments.length; e++) {
11
+ var t = arguments[e];
12
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
13
+ }
14
+ return n;
15
+ }, _extends.apply(null, arguments);
16
+ }
17
+
18
+ function _arrayWithHoles(r) {
19
+ if (Array.isArray(r)) return r;
20
+ }
21
+
22
+ function _iterableToArrayLimit(r, l) {
23
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
24
+ if (null != t) {
25
+ var e,
26
+ n,
27
+ i,
28
+ u,
29
+ a = [],
30
+ f = true,
31
+ o = false;
32
+ try {
33
+ if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
34
+ } catch (r) {
35
+ o = true, n = r;
36
+ } finally {
37
+ try {
38
+ if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
39
+ } finally {
40
+ if (o) throw n;
41
+ }
42
+ }
43
+ return a;
44
+ }
45
+ }
46
+
47
+ function _nonIterableRest() {
48
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
49
+ }
50
+
51
+ function _slicedToArray(r, e) {
52
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
53
+ }
54
+
55
+ function _objectWithoutPropertiesLoose(r, e) {
56
+ if (null == r) return {};
57
+ var t = {};
58
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
59
+ if (-1 !== e.indexOf(n)) continue;
60
+ t[n] = r[n];
61
+ }
62
+ return t;
63
+ }
64
+
65
+ function _objectWithoutProperties(e, t) {
66
+ if (null == e) return {};
67
+ var o,
68
+ r,
69
+ i = _objectWithoutPropertiesLoose(e, t);
70
+ if (Object.getOwnPropertySymbols) {
71
+ var n = Object.getOwnPropertySymbols(e);
72
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
73
+ }
74
+ return i;
75
+ }
76
+
77
+ const round = Math.round;
78
+
79
+ /**
80
+ * Support format, alpha unit will check the % mark:
81
+ * - rgba(102, 204, 255, .5) -> [102, 204, 255, 0.5]
82
+ * - rgb(102 204 255 / .5) -> [102, 204, 255, 0.5]
83
+ * - rgb(100%, 50%, 0% / 50%) -> [255, 128, 0, 0.5]
84
+ * - hsl(270, 60, 40, .5) -> [270, 60, 40, 0.5]
85
+ * - hsl(270deg 60% 40% / 50%) -> [270, 60, 40, 0.5]
86
+ *
87
+ * When `base` is provided, the percentage value will be divided by `base`.
88
+ */
89
+ function splitColorStr(str, parseNum) {
90
+ const match = str
91
+ // Remove str before `(`
92
+ .replace(/^[^(]*\((.*)/, '$1')
93
+ // Remove str after `)`
94
+ .replace(/\).*/, '').match(/\d*\.?\d+%?/g) || [];
95
+ const numList = match.map(item => parseFloat(item));
96
+ for (let i = 0; i < 3; i += 1) {
97
+ numList[i] = parseNum(numList[i] || 0, match[i] || '', i);
98
+ }
99
+
100
+ // For alpha. 50% should be 0.5
101
+ if (match[3]) {
102
+ numList[3] = match[3].includes('%') ? numList[3] / 100 : numList[3];
103
+ } else {
104
+ // By default, alpha is 1
105
+ numList[3] = 1;
106
+ }
107
+ return numList;
108
+ }
109
+ const parseHSVorHSL = (num, _, index) => index === 0 ? num : num / 100;
110
+
111
+ /** round and limit number to integer between 0-255 */
112
+ function limitRange(value, max) {
113
+ const mergedMax = max || 255;
114
+ if (value > mergedMax) {
115
+ return mergedMax;
116
+ }
117
+ if (value < 0) {
118
+ return 0;
119
+ }
120
+ return value;
121
+ }
122
+ class FastColor {
123
+ constructor(input) {
124
+ /**
125
+ * All FastColor objects are valid. So isValid is always true. This property is kept to be compatible with TinyColor.
126
+ */
127
+ _defineProperty(this, "isValid", true);
128
+ /**
129
+ * Red, R in RGB
130
+ */
131
+ _defineProperty(this, "r", 0);
132
+ /**
133
+ * Green, G in RGB
134
+ */
135
+ _defineProperty(this, "g", 0);
136
+ /**
137
+ * Blue, B in RGB
138
+ */
139
+ _defineProperty(this, "b", 0);
140
+ /**
141
+ * Alpha/Opacity, A in RGBA/HSLA
142
+ */
143
+ _defineProperty(this, "a", 1);
144
+ // HSV privates
145
+ _defineProperty(this, "_h", void 0);
146
+ _defineProperty(this, "_s", void 0);
147
+ _defineProperty(this, "_l", void 0);
148
+ _defineProperty(this, "_v", void 0);
149
+ // intermediate variables to calculate HSL/HSV
150
+ _defineProperty(this, "_max", void 0);
151
+ _defineProperty(this, "_min", void 0);
152
+ _defineProperty(this, "_brightness", void 0);
153
+ /**
154
+ * Always check 3 char in the object to determine the format.
155
+ * We not use function in check to save bundle size.
156
+ * e.g. 'rgb' -> { r: 0, g: 0, b: 0 }.
157
+ */
158
+ function matchFormat(str) {
159
+ return str[0] in input && str[1] in input && str[2] in input;
160
+ }
161
+ if (!input) ; else if (typeof input === 'string') {
162
+ const trimStr = input.trim();
163
+ function matchPrefix(prefix) {
164
+ return trimStr.startsWith(prefix);
165
+ }
166
+ if (/^#?[A-F\d]{3,8}$/i.test(trimStr)) {
167
+ this.fromHexString(trimStr);
168
+ } else if (matchPrefix('rgb')) {
169
+ this.fromRgbString(trimStr);
170
+ } else if (matchPrefix('hsl')) {
171
+ this.fromHslString(trimStr);
172
+ } else if (matchPrefix('hsv') || matchPrefix('hsb')) {
173
+ this.fromHsvString(trimStr);
174
+ }
175
+ } else if (input instanceof FastColor) {
176
+ this.r = input.r;
177
+ this.g = input.g;
178
+ this.b = input.b;
179
+ this.a = input.a;
180
+ this._h = input._h;
181
+ this._s = input._s;
182
+ this._l = input._l;
183
+ this._v = input._v;
184
+ } else if (matchFormat('rgb')) {
185
+ this.r = limitRange(input.r);
186
+ this.g = limitRange(input.g);
187
+ this.b = limitRange(input.b);
188
+ this.a = typeof input.a === 'number' ? limitRange(input.a, 1) : 1;
189
+ } else if (matchFormat('hsl')) {
190
+ this.fromHsl(input);
191
+ } else if (matchFormat('hsv')) {
192
+ this.fromHsv(input);
193
+ } else {
194
+ throw new Error('@ant-design/fast-color: unsupported input ' + JSON.stringify(input));
195
+ }
196
+ }
197
+
198
+ // ======================= Setter =======================
199
+
200
+ setR(value) {
201
+ return this._sc('r', value);
202
+ }
203
+ setG(value) {
204
+ return this._sc('g', value);
205
+ }
206
+ setB(value) {
207
+ return this._sc('b', value);
208
+ }
209
+ setA(value) {
210
+ return this._sc('a', value, 1);
211
+ }
212
+ setHue(value) {
213
+ const hsv = this.toHsv();
214
+ hsv.h = value;
215
+ return this._c(hsv);
216
+ }
217
+
218
+ // ======================= Getter =======================
219
+ /**
220
+ * Returns the perceived luminance of a color, from 0-1.
221
+ * @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
222
+ */
223
+ getLuminance() {
224
+ function adjustGamma(raw) {
225
+ const val = raw / 255;
226
+ return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
227
+ }
228
+ const R = adjustGamma(this.r);
229
+ const G = adjustGamma(this.g);
230
+ const B = adjustGamma(this.b);
231
+ return 0.2126 * R + 0.7152 * G + 0.0722 * B;
232
+ }
233
+ getHue() {
234
+ if (typeof this._h === 'undefined') {
235
+ const delta = this.getMax() - this.getMin();
236
+ if (delta === 0) {
237
+ this._h = 0;
238
+ } else {
239
+ this._h = round(60 * (this.r === this.getMax() ? (this.g - this.b) / delta + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / delta + 2 : (this.r - this.g) / delta + 4));
240
+ }
241
+ }
242
+ return this._h;
243
+ }
244
+ getSaturation() {
245
+ if (typeof this._s === 'undefined') {
246
+ const delta = this.getMax() - this.getMin();
247
+ if (delta === 0) {
248
+ this._s = 0;
249
+ } else {
250
+ this._s = delta / this.getMax();
251
+ }
252
+ }
253
+ return this._s;
254
+ }
255
+ getLightness() {
256
+ if (typeof this._l === 'undefined') {
257
+ this._l = (this.getMax() + this.getMin()) / 510;
258
+ }
259
+ return this._l;
260
+ }
261
+ getValue() {
262
+ if (typeof this._v === 'undefined') {
263
+ this._v = this.getMax() / 255;
264
+ }
265
+ return this._v;
266
+ }
267
+
268
+ /**
269
+ * Returns the perceived brightness of the color, from 0-255.
270
+ * Note: this is not the b of HSB
271
+ * @see http://www.w3.org/TR/AERT#color-contrast
272
+ */
273
+ getBrightness() {
274
+ if (typeof this._brightness === 'undefined') {
275
+ this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1000;
276
+ }
277
+ return this._brightness;
278
+ }
279
+
280
+ // ======================== Func ========================
281
+
282
+ darken(amount = 10) {
283
+ const h = this.getHue();
284
+ const s = this.getSaturation();
285
+ let l = this.getLightness() - amount / 100;
286
+ if (l < 0) {
287
+ l = 0;
288
+ }
289
+ return this._c({
290
+ h,
291
+ s,
292
+ l,
293
+ a: this.a
294
+ });
295
+ }
296
+ lighten(amount = 10) {
297
+ const h = this.getHue();
298
+ const s = this.getSaturation();
299
+ let l = this.getLightness() + amount / 100;
300
+ if (l > 1) {
301
+ l = 1;
302
+ }
303
+ return this._c({
304
+ h,
305
+ s,
306
+ l,
307
+ a: this.a
308
+ });
309
+ }
310
+
311
+ /**
312
+ * Mix the current color a given amount with another color, from 0 to 100.
313
+ * 0 means no mixing (return current color).
314
+ */
315
+ mix(input, amount = 50) {
316
+ const color = this._c(input);
317
+ const p = amount / 100;
318
+ const calc = key => (color[key] - this[key]) * p + this[key];
319
+ const rgba = {
320
+ r: round(calc('r')),
321
+ g: round(calc('g')),
322
+ b: round(calc('b')),
323
+ a: round(calc('a') * 100) / 100
324
+ };
325
+ return this._c(rgba);
326
+ }
327
+
328
+ /**
329
+ * Mix the color with pure white, from 0 to 100.
330
+ * Providing 0 will do nothing, providing 100 will always return white.
331
+ */
332
+ tint(amount = 10) {
333
+ return this.mix({
334
+ r: 255,
335
+ g: 255,
336
+ b: 255,
337
+ a: 1
338
+ }, amount);
339
+ }
340
+
341
+ /**
342
+ * Mix the color with pure black, from 0 to 100.
343
+ * Providing 0 will do nothing, providing 100 will always return black.
344
+ */
345
+ shade(amount = 10) {
346
+ return this.mix({
347
+ r: 0,
348
+ g: 0,
349
+ b: 0,
350
+ a: 1
351
+ }, amount);
352
+ }
353
+ onBackground(background) {
354
+ const bg = this._c(background);
355
+ const alpha = this.a + bg.a * (1 - this.a);
356
+ const calc = key => {
357
+ return round((this[key] * this.a + bg[key] * bg.a * (1 - this.a)) / alpha);
358
+ };
359
+ return this._c({
360
+ r: calc('r'),
361
+ g: calc('g'),
362
+ b: calc('b'),
363
+ a: alpha
364
+ });
365
+ }
366
+
367
+ // ======================= Status =======================
368
+ isDark() {
369
+ return this.getBrightness() < 128;
370
+ }
371
+ isLight() {
372
+ return this.getBrightness() >= 128;
373
+ }
374
+
375
+ // ======================== MISC ========================
376
+ equals(other) {
377
+ return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
378
+ }
379
+ clone() {
380
+ return this._c(this);
381
+ }
382
+
383
+ // ======================= Format =======================
384
+ toHexString() {
385
+ let hex = '#';
386
+ const rHex = (this.r || 0).toString(16);
387
+ hex += rHex.length === 2 ? rHex : '0' + rHex;
388
+ const gHex = (this.g || 0).toString(16);
389
+ hex += gHex.length === 2 ? gHex : '0' + gHex;
390
+ const bHex = (this.b || 0).toString(16);
391
+ hex += bHex.length === 2 ? bHex : '0' + bHex;
392
+ if (typeof this.a === 'number' && this.a >= 0 && this.a < 1) {
393
+ const aHex = round(this.a * 255).toString(16);
394
+ hex += aHex.length === 2 ? aHex : '0' + aHex;
395
+ }
396
+ return hex;
397
+ }
398
+
399
+ /** CSS support color pattern */
400
+ toHsl() {
401
+ return {
402
+ h: this.getHue(),
403
+ s: this.getSaturation(),
404
+ l: this.getLightness(),
405
+ a: this.a
406
+ };
407
+ }
408
+
409
+ /** CSS support color pattern */
410
+ toHslString() {
411
+ const h = this.getHue();
412
+ const s = round(this.getSaturation() * 100);
413
+ const l = round(this.getLightness() * 100);
414
+ return this.a !== 1 ? `hsla(${h},${s}%,${l}%,${this.a})` : `hsl(${h},${s}%,${l}%)`;
415
+ }
416
+
417
+ /** Same as toHsb */
418
+ toHsv() {
419
+ return {
420
+ h: this.getHue(),
421
+ s: this.getSaturation(),
422
+ v: this.getValue(),
423
+ a: this.a
424
+ };
425
+ }
426
+ toRgb() {
427
+ return {
428
+ r: this.r,
429
+ g: this.g,
430
+ b: this.b,
431
+ a: this.a
432
+ };
433
+ }
434
+ toRgbString() {
435
+ return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
436
+ }
437
+ toString() {
438
+ return this.toRgbString();
439
+ }
440
+
441
+ // ====================== Privates ======================
442
+ /** Return a new FastColor object with one channel changed */
443
+ _sc(rgb, value, max) {
444
+ const clone = this.clone();
445
+ clone[rgb] = limitRange(value, max);
446
+ return clone;
447
+ }
448
+ _c(input) {
449
+ return new this.constructor(input);
450
+ }
451
+ getMax() {
452
+ if (typeof this._max === 'undefined') {
453
+ this._max = Math.max(this.r, this.g, this.b);
454
+ }
455
+ return this._max;
456
+ }
457
+ getMin() {
458
+ if (typeof this._min === 'undefined') {
459
+ this._min = Math.min(this.r, this.g, this.b);
460
+ }
461
+ return this._min;
462
+ }
463
+ fromHexString(trimStr) {
464
+ const withoutPrefix = trimStr.replace('#', '');
465
+ function connectNum(index1, index2) {
466
+ return parseInt(withoutPrefix[index1] + withoutPrefix[index2 || index1], 16);
467
+ }
468
+ if (withoutPrefix.length < 6) {
469
+ // #rgb or #rgba
470
+ this.r = connectNum(0);
471
+ this.g = connectNum(1);
472
+ this.b = connectNum(2);
473
+ this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1;
474
+ } else {
475
+ // #rrggbb or #rrggbbaa
476
+ this.r = connectNum(0, 1);
477
+ this.g = connectNum(2, 3);
478
+ this.b = connectNum(4, 5);
479
+ this.a = withoutPrefix[6] ? connectNum(6, 7) / 255 : 1;
480
+ }
481
+ }
482
+ fromHsl({
483
+ h,
484
+ s,
485
+ l,
486
+ a
487
+ }) {
488
+ this._h = h % 360;
489
+ this._s = s;
490
+ this._l = l;
491
+ this.a = typeof a === 'number' ? a : 1;
492
+ if (s <= 0) {
493
+ const rgb = round(l * 255);
494
+ this.r = rgb;
495
+ this.g = rgb;
496
+ this.b = rgb;
497
+ }
498
+ let r = 0,
499
+ g = 0,
500
+ b = 0;
501
+ const huePrime = h / 60;
502
+ const chroma = (1 - Math.abs(2 * l - 1)) * s;
503
+ const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
504
+ if (huePrime >= 0 && huePrime < 1) {
505
+ r = chroma;
506
+ g = secondComponent;
507
+ } else if (huePrime >= 1 && huePrime < 2) {
508
+ r = secondComponent;
509
+ g = chroma;
510
+ } else if (huePrime >= 2 && huePrime < 3) {
511
+ g = chroma;
512
+ b = secondComponent;
513
+ } else if (huePrime >= 3 && huePrime < 4) {
514
+ g = secondComponent;
515
+ b = chroma;
516
+ } else if (huePrime >= 4 && huePrime < 5) {
517
+ r = secondComponent;
518
+ b = chroma;
519
+ } else if (huePrime >= 5 && huePrime < 6) {
520
+ r = chroma;
521
+ b = secondComponent;
522
+ }
523
+ const lightnessModification = l - chroma / 2;
524
+ this.r = round((r + lightnessModification) * 255);
525
+ this.g = round((g + lightnessModification) * 255);
526
+ this.b = round((b + lightnessModification) * 255);
527
+ }
528
+ fromHsv({
529
+ h,
530
+ s,
531
+ v,
532
+ a
533
+ }) {
534
+ this._h = h % 360;
535
+ this._s = s;
536
+ this._v = v;
537
+ this.a = typeof a === 'number' ? a : 1;
538
+ const vv = round(v * 255);
539
+ this.r = vv;
540
+ this.g = vv;
541
+ this.b = vv;
542
+ if (s <= 0) {
543
+ return;
544
+ }
545
+ const hh = h / 60;
546
+ const i = Math.floor(hh);
547
+ const ff = hh - i;
548
+ const p = round(v * (1.0 - s) * 255);
549
+ const q = round(v * (1.0 - s * ff) * 255);
550
+ const t = round(v * (1.0 - s * (1.0 - ff)) * 255);
551
+ switch (i) {
552
+ case 0:
553
+ this.g = t;
554
+ this.b = p;
555
+ break;
556
+ case 1:
557
+ this.r = q;
558
+ this.b = p;
559
+ break;
560
+ case 2:
561
+ this.r = p;
562
+ this.b = t;
563
+ break;
564
+ case 3:
565
+ this.r = p;
566
+ this.g = q;
567
+ break;
568
+ case 4:
569
+ this.r = t;
570
+ this.g = p;
571
+ break;
572
+ case 5:
573
+ default:
574
+ this.g = p;
575
+ this.b = q;
576
+ break;
577
+ }
578
+ }
579
+ fromHsvString(trimStr) {
580
+ const cells = splitColorStr(trimStr, parseHSVorHSL);
581
+ this.fromHsv({
582
+ h: cells[0],
583
+ s: cells[1],
584
+ v: cells[2],
585
+ a: cells[3]
586
+ });
587
+ }
588
+ fromHslString(trimStr) {
589
+ const cells = splitColorStr(trimStr, parseHSVorHSL);
590
+ this.fromHsl({
591
+ h: cells[0],
592
+ s: cells[1],
593
+ l: cells[2],
594
+ a: cells[3]
595
+ });
596
+ }
597
+ fromRgbString(trimStr) {
598
+ const cells = splitColorStr(trimStr, (num, txt) =>
599
+ // Convert percentage to number. e.g. 50% -> 128
600
+ txt.includes('%') ? round(num / 100 * 255) : num);
601
+ this.r = cells[0];
602
+ this.g = cells[1];
603
+ this.b = cells[2];
604
+ this.a = cells[3];
605
+ }
606
+ }
607
+
608
+ var hueStep = 2; // 色相阶梯
609
+ var saturationStep = 0.16; // 饱和度阶梯,浅色部分
610
+ var saturationStep2 = 0.05; // 饱和度阶梯,深色部分
611
+ var brightnessStep1 = 0.05; // 亮度阶梯,浅色部分
612
+ var brightnessStep2 = 0.15; // 亮度阶梯,深色部分
613
+ var lightColorCount = 5; // 浅色数量,主色上
614
+ var darkColorCount = 4; // 深色数量,主色下
615
+
616
+ // 暗色主题颜色映射关系表
617
+ var darkColorMap = [{
618
+ index: 7,
619
+ amount: 15
620
+ }, {
621
+ index: 6,
622
+ amount: 25
623
+ }, {
624
+ index: 5,
625
+ amount: 30
626
+ }, {
627
+ index: 5,
628
+ amount: 45
629
+ }, {
630
+ index: 5,
631
+ amount: 65
632
+ }, {
633
+ index: 5,
634
+ amount: 85
635
+ }, {
636
+ index: 4,
637
+ amount: 90
638
+ }, {
639
+ index: 3,
640
+ amount: 95
641
+ }, {
642
+ index: 2,
643
+ amount: 97
644
+ }, {
645
+ index: 1,
646
+ amount: 98
647
+ }];
648
+ function getHue(hsv, i, light) {
649
+ var hue;
650
+ // 根据色相不同,色相转向不同
651
+ if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
652
+ hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
653
+ } else {
654
+ hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
655
+ }
656
+ if (hue < 0) {
657
+ hue += 360;
658
+ } else if (hue >= 360) {
659
+ hue -= 360;
660
+ }
661
+ return hue;
662
+ }
663
+ function getSaturation(hsv, i, light) {
664
+ // grey color don't change saturation
665
+ if (hsv.h === 0 && hsv.s === 0) {
666
+ return hsv.s;
667
+ }
668
+ var saturation;
669
+ if (light) {
670
+ saturation = hsv.s - saturationStep * i;
671
+ } else if (i === darkColorCount) {
672
+ saturation = hsv.s + saturationStep;
673
+ } else {
674
+ saturation = hsv.s + saturationStep2 * i;
675
+ }
676
+ // 边界值修正
677
+ if (saturation > 1) {
678
+ saturation = 1;
679
+ }
680
+ // 第一格的 s 限制在 0.06-0.1 之间
681
+ if (light && i === lightColorCount && saturation > 0.1) {
682
+ saturation = 0.1;
683
+ }
684
+ if (saturation < 0.06) {
685
+ saturation = 0.06;
686
+ }
687
+ return Math.round(saturation * 100) / 100;
688
+ }
689
+ function getValue(hsv, i, light) {
690
+ var value;
691
+ if (light) {
692
+ value = hsv.v + brightnessStep1 * i;
693
+ } else {
694
+ value = hsv.v - brightnessStep2 * i;
695
+ }
696
+ // Clamp value between 0 and 1
697
+ value = Math.max(0, Math.min(1, value));
698
+ return Math.round(value * 100) / 100;
699
+ }
700
+ function generate$1(color) {
701
+ var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
702
+ var patterns = [];
703
+ var pColor = new FastColor(color);
704
+ var hsv = pColor.toHsv();
705
+ for (var i = lightColorCount; i > 0; i -= 1) {
706
+ var c = new FastColor({
707
+ h: getHue(hsv, i, true),
708
+ s: getSaturation(hsv, i, true),
709
+ v: getValue(hsv, i, true)
710
+ });
711
+ patterns.push(c);
712
+ }
713
+ patterns.push(pColor);
714
+ for (var _i = 1; _i <= darkColorCount; _i += 1) {
715
+ var _c = new FastColor({
716
+ h: getHue(hsv, _i),
717
+ s: getSaturation(hsv, _i),
718
+ v: getValue(hsv, _i)
719
+ });
720
+ patterns.push(_c);
721
+ }
722
+
723
+ // dark theme patterns
724
+ if (opts.theme === 'dark') {
725
+ return darkColorMap.map(function (_ref) {
726
+ var index = _ref.index,
727
+ amount = _ref.amount;
728
+ return new FastColor(opts.backgroundColor || '#141414').mix(patterns[index], amount).toHexString();
729
+ });
730
+ }
731
+ return patterns.map(function (c) {
732
+ return c.toHexString();
733
+ });
734
+ }
735
+
736
+ // Generated by script. Do NOT modify!
737
+
738
+ var blue = ["#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", "#4096ff", "#1677ff", "#0958d9", "#003eb3", "#002c8c", "#001d66"];
739
+ blue.primary = blue[5];
740
+
741
+ function ownKeys(e, r) {
742
+ var t = Object.keys(e);
743
+ if (Object.getOwnPropertySymbols) {
744
+ var o = Object.getOwnPropertySymbols(e);
745
+ r && (o = o.filter(function (r) {
746
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
747
+ })), t.push.apply(t, o);
748
+ }
749
+ return t;
750
+ }
751
+ function _objectSpread2(e) {
752
+ for (var r = 1; r < arguments.length; r++) {
753
+ var t = null != arguments[r] ? arguments[r] : {};
754
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
755
+ _defineProperty(e, r, t[r]);
756
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
757
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
758
+ });
759
+ }
760
+ return e;
761
+ }
762
+
763
+ function canUseDom() {
764
+ return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
765
+ }
766
+
767
+ function contains(root, n) {
768
+ if (!root) {
769
+ return false;
770
+ }
771
+
772
+ // Use native if support
773
+ if (root.contains) {
774
+ return root.contains(n);
775
+ }
776
+
777
+ // `document.contains` not support with IE11
778
+ var node = n;
779
+ while (node) {
780
+ if (node === root) {
781
+ return true;
782
+ }
783
+ node = node.parentNode;
784
+ }
785
+ return false;
786
+ }
787
+
788
+ var APPEND_ORDER = 'data-rc-order';
789
+ var APPEND_PRIORITY = 'data-rc-priority';
790
+ var MARK_KEY = "rc-util-key";
791
+ var containerCache = new Map();
792
+ function getMark() {
793
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
794
+ mark = _ref.mark;
795
+ if (mark) {
796
+ return mark.startsWith('data-') ? mark : "data-".concat(mark);
797
+ }
798
+ return MARK_KEY;
799
+ }
800
+ function getContainer(option) {
801
+ if (option.attachTo) {
802
+ return option.attachTo;
803
+ }
804
+ var head = document.querySelector('head');
805
+ return head || document.body;
806
+ }
807
+ function getOrder(prepend) {
808
+ if (prepend === 'queue') {
809
+ return 'prependQueue';
810
+ }
811
+ return prepend ? 'prepend' : 'append';
812
+ }
813
+
814
+ /**
815
+ * Find style which inject by rc-util
816
+ */
817
+ function findStyles(container) {
818
+ return Array.from((containerCache.get(container) || container).children).filter(function (node) {
819
+ return node.tagName === 'STYLE';
820
+ });
821
+ }
822
+ function injectCSS(css) {
823
+ var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
824
+ if (!canUseDom()) {
825
+ return null;
826
+ }
827
+ var csp = option.csp,
828
+ prepend = option.prepend,
829
+ _option$priority = option.priority,
830
+ priority = _option$priority === void 0 ? 0 : _option$priority;
831
+ var mergedOrder = getOrder(prepend);
832
+ var isPrependQueue = mergedOrder === 'prependQueue';
833
+ var styleNode = document.createElement('style');
834
+ styleNode.setAttribute(APPEND_ORDER, mergedOrder);
835
+ if (isPrependQueue && priority) {
836
+ styleNode.setAttribute(APPEND_PRIORITY, "".concat(priority));
837
+ }
838
+ if (csp !== null && csp !== void 0 && csp.nonce) {
839
+ styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;
840
+ }
841
+ styleNode.innerHTML = css;
842
+ var container = getContainer(option);
843
+ var firstChild = container.firstChild;
844
+ if (prepend) {
845
+ // If is queue `prepend`, it will prepend first style and then append rest style
846
+ if (isPrependQueue) {
847
+ var existStyle = (option.styles || findStyles(container)).filter(function (node) {
848
+ // Ignore style which not injected by rc-util with prepend
849
+ if (!['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER))) {
850
+ return false;
851
+ }
852
+
853
+ // Ignore style which priority less then new style
854
+ var nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0);
855
+ return priority >= nodePriority;
856
+ });
857
+ if (existStyle.length) {
858
+ container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
859
+ return styleNode;
860
+ }
861
+ }
862
+
863
+ // Use `insertBefore` as `prepend`
864
+ container.insertBefore(styleNode, firstChild);
865
+ } else {
866
+ container.appendChild(styleNode);
867
+ }
868
+ return styleNode;
869
+ }
870
+ function findExistNode(key) {
871
+ var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
872
+ var container = getContainer(option);
873
+ return (option.styles || findStyles(container)).find(function (node) {
874
+ return node.getAttribute(getMark(option)) === key;
875
+ });
876
+ }
877
+
878
+ /**
879
+ * qiankun will inject `appendChild` to insert into other
880
+ */
881
+ function syncRealContainer(container, option) {
882
+ var cachedRealContainer = containerCache.get(container);
883
+
884
+ // Find real container when not cached or cached container removed
885
+ if (!cachedRealContainer || !contains(document, cachedRealContainer)) {
886
+ var placeholderStyle = injectCSS('', option);
887
+ var parentNode = placeholderStyle.parentNode;
888
+ containerCache.set(container, parentNode);
889
+ container.removeChild(placeholderStyle);
890
+ }
891
+ }
892
+ function updateCSS(css, key) {
893
+ var originOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
894
+ var container = getContainer(originOption);
895
+ var styles = findStyles(container);
896
+ var option = _objectSpread2(_objectSpread2({}, originOption), {}, {
897
+ styles: styles
898
+ });
899
+
900
+ // Sync real parent
901
+ syncRealContainer(container, option);
902
+ var existNode = findExistNode(key, option);
903
+ if (existNode) {
904
+ var _option$csp, _option$csp2;
905
+ if ((_option$csp = option.csp) !== null && _option$csp !== void 0 && _option$csp.nonce && existNode.nonce !== ((_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce)) {
906
+ var _option$csp3;
907
+ existNode.nonce = (_option$csp3 = option.csp) === null || _option$csp3 === void 0 ? void 0 : _option$csp3.nonce;
908
+ }
909
+ if (existNode.innerHTML !== css) {
910
+ existNode.innerHTML = css;
911
+ }
912
+ return existNode;
913
+ }
914
+ var newNode = injectCSS(css, option);
915
+ newNode.setAttribute(getMark(option), key);
916
+ return newNode;
917
+ }
918
+
919
+ function getRoot(ele) {
920
+ var _ele$getRootNode;
921
+ return ele === null || ele === void 0 || (_ele$getRootNode = ele.getRootNode) === null || _ele$getRootNode === void 0 ? void 0 : _ele$getRootNode.call(ele);
922
+ }
923
+
924
+ /**
925
+ * Check if is in shadowRoot
926
+ */
927
+ function inShadow(ele) {
928
+ return getRoot(ele) instanceof ShadowRoot;
929
+ }
930
+
931
+ /**
932
+ * Return shadowRoot if possible
933
+ */
934
+ function getShadowRoot(ele) {
935
+ return inShadow(ele) ? getRoot(ele) : null;
936
+ }
937
+
938
+ /* eslint-disable no-console */
939
+ var warned = {};
940
+ var preWarningFns = [];
941
+
942
+ /**
943
+ * Pre warning enable you to parse content before console.error.
944
+ * Modify to null will prevent warning.
945
+ */
946
+ var preMessage = function preMessage(fn) {
947
+ preWarningFns.push(fn);
948
+ };
949
+
950
+ /**
951
+ * Warning if condition not match.
952
+ * @param valid Condition
953
+ * @param message Warning message
954
+ * @example
955
+ * ```js
956
+ * warning(false, 'some error'); // print some error
957
+ * warning(true, 'some error'); // print nothing
958
+ * warning(1 === 2, 'some error'); // print some error
959
+ * ```
960
+ */
961
+ function warning$1(valid, message) {
962
+ if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
963
+ var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {
964
+ return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'warning');
965
+ }, message);
966
+ if (finalMessage) {
967
+ console.error("Warning: ".concat(finalMessage));
968
+ }
969
+ }
970
+ }
971
+
972
+ /** @see Similar to {@link warning} */
973
+ function note(valid, message) {
974
+ if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
975
+ var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {
976
+ return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'note');
977
+ }, message);
978
+ if (finalMessage) {
979
+ console.warn("Note: ".concat(finalMessage));
980
+ }
981
+ }
982
+ }
983
+ function resetWarned() {
984
+ warned = {};
985
+ }
986
+ function call(method, valid, message) {
987
+ if (!valid && !warned[message]) {
988
+ method(false, message);
989
+ warned[message] = true;
990
+ }
991
+ }
992
+
993
+ /** @see Same as {@link warning}, but only warn once for the same message */
994
+ function warningOnce(valid, message) {
995
+ call(warning$1, valid, message);
996
+ }
997
+
998
+ /** @see Same as {@link warning}, but only warn once for the same message */
999
+ function noteOnce(valid, message) {
1000
+ call(note, valid, message);
1001
+ }
1002
+ warningOnce.preMessage = preMessage;
1003
+ warningOnce.resetWarned = resetWarned;
1004
+ warningOnce.noteOnce = noteOnce;
1005
+
1006
+ function camelCase(input) {
1007
+ return input.replace(/-(.)/g, function (match, g) {
1008
+ return g.toUpperCase();
1009
+ });
1010
+ }
1011
+ function warning(valid, message) {
1012
+ warningOnce(valid, "[@ant-design/icons] ".concat(message));
1013
+ }
1014
+ function isIconDefinition(target) {
1015
+ return _typeof(target) === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (_typeof(target.icon) === 'object' || typeof target.icon === 'function');
1016
+ }
1017
+ function normalizeAttrs() {
1018
+ var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1019
+ return Object.keys(attrs).reduce(function (acc, key) {
1020
+ var val = attrs[key];
1021
+ switch (key) {
1022
+ case 'class':
1023
+ acc.className = val;
1024
+ delete acc.class;
1025
+ break;
1026
+ default:
1027
+ delete acc[key];
1028
+ acc[camelCase(key)] = val;
1029
+ }
1030
+ return acc;
1031
+ }, {});
1032
+ }
1033
+ function generate(node, key, rootProps) {
1034
+ if (!rootProps) {
1035
+ return /*#__PURE__*/React__default.createElement(node.tag, _objectSpread2({
1036
+ key: key
1037
+ }, normalizeAttrs(node.attrs)), (node.children || []).map(function (child, index) {
1038
+ return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
1039
+ }));
1040
+ }
1041
+ return /*#__PURE__*/React__default.createElement(node.tag, _objectSpread2(_objectSpread2({
1042
+ key: key
1043
+ }, normalizeAttrs(node.attrs)), rootProps), (node.children || []).map(function (child, index) {
1044
+ return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
1045
+ }));
1046
+ }
1047
+ function getSecondaryColor(primaryColor) {
1048
+ // choose the second color
1049
+ return generate$1(primaryColor)[0];
1050
+ }
1051
+ function normalizeTwoToneColors(twoToneColor) {
1052
+ if (!twoToneColor) {
1053
+ return [];
1054
+ }
1055
+ return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
1056
+ }
1057
+ var iconStyles = "\n.anticon {\n display: inline-flex;\n align-items: center;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n";
1058
+ var useInsertStyles = function useInsertStyles(eleRef) {
1059
+ var _useContext = useContext(IconContext),
1060
+ csp = _useContext.csp,
1061
+ prefixCls = _useContext.prefixCls,
1062
+ layer = _useContext.layer;
1063
+ var mergedStyleStr = iconStyles;
1064
+ if (prefixCls) {
1065
+ mergedStyleStr = mergedStyleStr.replace(/anticon/g, prefixCls);
1066
+ }
1067
+ if (layer) {
1068
+ mergedStyleStr = "@layer ".concat(layer, " {\n").concat(mergedStyleStr, "\n}");
1069
+ }
1070
+ useEffect(function () {
1071
+ var ele = eleRef.current;
1072
+ var shadowRoot = getShadowRoot(ele);
1073
+ updateCSS(mergedStyleStr, '@ant-design-icons', {
1074
+ prepend: !layer,
1075
+ csp: csp,
1076
+ attachTo: shadowRoot
1077
+ });
1078
+ }, []);
1079
+ };
1080
+
1081
+ var _excluded$1 = ["icon", "className", "onClick", "style", "primaryColor", "secondaryColor"];
1082
+ var twoToneColorPalette = {
1083
+ primaryColor: '#333',
1084
+ secondaryColor: '#E6E6E6',
1085
+ calculated: false
1086
+ };
1087
+ function setTwoToneColors(_ref) {
1088
+ var primaryColor = _ref.primaryColor,
1089
+ secondaryColor = _ref.secondaryColor;
1090
+ twoToneColorPalette.primaryColor = primaryColor;
1091
+ twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
1092
+ twoToneColorPalette.calculated = !!secondaryColor;
1093
+ }
1094
+ function getTwoToneColors() {
1095
+ return _objectSpread2({}, twoToneColorPalette);
1096
+ }
1097
+ var IconBase = function IconBase(props) {
1098
+ var icon = props.icon,
1099
+ className = props.className,
1100
+ onClick = props.onClick,
1101
+ style = props.style,
1102
+ primaryColor = props.primaryColor,
1103
+ secondaryColor = props.secondaryColor,
1104
+ restProps = _objectWithoutProperties(props, _excluded$1);
1105
+ var svgRef = React.useRef();
1106
+ var colors = twoToneColorPalette;
1107
+ if (primaryColor) {
1108
+ colors = {
1109
+ primaryColor: primaryColor,
1110
+ secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
1111
+ };
1112
+ }
1113
+ useInsertStyles(svgRef);
1114
+ warning(isIconDefinition(icon), "icon should be icon definiton, but got ".concat(icon));
1115
+ if (!isIconDefinition(icon)) {
1116
+ return null;
1117
+ }
1118
+ var target = icon;
1119
+ if (target && typeof target.icon === 'function') {
1120
+ target = _objectSpread2(_objectSpread2({}, target), {}, {
1121
+ icon: target.icon(colors.primaryColor, colors.secondaryColor)
1122
+ });
1123
+ }
1124
+ return generate(target.icon, "svg-".concat(target.name), _objectSpread2(_objectSpread2({
1125
+ className: className,
1126
+ onClick: onClick,
1127
+ style: style,
1128
+ 'data-icon': target.name,
1129
+ width: '1em',
1130
+ height: '1em',
1131
+ fill: 'currentColor',
1132
+ 'aria-hidden': 'true'
1133
+ }, restProps), {}, {
1134
+ ref: svgRef
1135
+ }));
1136
+ };
1137
+ IconBase.displayName = 'IconReact';
1138
+ IconBase.getTwoToneColors = getTwoToneColors;
1139
+ IconBase.setTwoToneColors = setTwoToneColors;
1140
+
1141
+ function setTwoToneColor(twoToneColor) {
1142
+ var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
1143
+ _normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2),
1144
+ primaryColor = _normalizeTwoToneColo2[0],
1145
+ secondaryColor = _normalizeTwoToneColo2[1];
1146
+ return IconBase.setTwoToneColors({
1147
+ primaryColor: primaryColor,
1148
+ secondaryColor: secondaryColor
1149
+ });
1150
+ }
1151
+ function getTwoToneColor() {
1152
+ var colors = IconBase.getTwoToneColors();
1153
+ if (!colors.calculated) {
1154
+ return colors.primaryColor;
1155
+ }
1156
+ return [colors.primaryColor, colors.secondaryColor];
1157
+ }
1158
+
1159
+ var _excluded = ["className", "icon", "spin", "rotate", "tabIndex", "onClick", "twoToneColor"];
1160
+ // Initial setting
1161
+ // should move it to antd main repo?
1162
+ setTwoToneColor(blue.primary);
1163
+
1164
+ // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34757#issuecomment-488848720
1165
+
1166
+ var Icon = /*#__PURE__*/React.forwardRef(function (props, ref) {
1167
+ var className$1 = props.className,
1168
+ icon = props.icon,
1169
+ spin = props.spin,
1170
+ rotate = props.rotate,
1171
+ tabIndex = props.tabIndex,
1172
+ onClick = props.onClick,
1173
+ twoToneColor = props.twoToneColor,
1174
+ restProps = _objectWithoutProperties(props, _excluded);
1175
+ var _React$useContext = React.useContext(IconContext),
1176
+ _React$useContext$pre = _React$useContext.prefixCls,
1177
+ prefixCls = _React$useContext$pre === void 0 ? 'anticon' : _React$useContext$pre,
1178
+ rootClassName = _React$useContext.rootClassName;
1179
+ var classString = className(rootClassName, prefixCls, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-").concat(icon.name), !!icon.name), "".concat(prefixCls, "-spin"), !!spin || icon.name === 'loading'), className$1);
1180
+ var iconTabIndex = tabIndex;
1181
+ if (iconTabIndex === undefined && onClick) {
1182
+ iconTabIndex = -1;
1183
+ }
1184
+ var svgStyle = rotate ? {
1185
+ msTransform: "rotate(".concat(rotate, "deg)"),
1186
+ transform: "rotate(".concat(rotate, "deg)")
1187
+ } : undefined;
1188
+ var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
1189
+ _normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2),
1190
+ primaryColor = _normalizeTwoToneColo2[0],
1191
+ secondaryColor = _normalizeTwoToneColo2[1];
1192
+ return /*#__PURE__*/React.createElement("span", _extends({
1193
+ role: "img",
1194
+ "aria-label": icon.name
1195
+ }, restProps, {
1196
+ ref: ref,
1197
+ tabIndex: iconTabIndex,
1198
+ onClick: onClick,
1199
+ className: classString
1200
+ }), /*#__PURE__*/React.createElement(IconBase, {
1201
+ icon: icon,
1202
+ primaryColor: primaryColor,
1203
+ secondaryColor: secondaryColor,
1204
+ style: svgStyle
1205
+ }));
1206
+ });
1207
+ Icon.displayName = 'AntdIcon';
1208
+ Icon.getTwoToneColor = getTwoToneColor;
1209
+ Icon.setTwoToneColor = setTwoToneColor;
1210
+
1211
+ export { Icon as I, _extends as _, IconContext as a };