@unicom-cloud/ui 0.8.66 → 0.8.67

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 (357) hide show
  1. package/Affix.js +79 -79
  2. package/Alert.js +46 -46
  3. package/Anchor.js +1 -1
  4. package/AutoComplete.js +74 -74
  5. package/Avatar.js +36 -36
  6. package/BackTop.js +35 -35
  7. package/Badge.js +55 -55
  8. package/Breadcrumb.js +42 -42
  9. package/Button.js +24 -24
  10. package/Calendar.js +230 -230
  11. package/Card.js +18 -18
  12. package/Carousel.js +165 -165
  13. package/Cascader.js +1 -1
  14. package/Checkbox.js +1 -1
  15. package/Collapse.js +1 -1
  16. package/ColorPicker.js +26 -26
  17. package/Comment.js +18 -18
  18. package/ConfigProvider.js +2 -2
  19. package/Copy.js +28 -27
  20. package/DatePicker.js +872 -871
  21. package/Descriptions.js +34 -34
  22. package/Divider.js +19 -19
  23. package/Draggable.js +27 -26
  24. package/Drawer.js +1 -1
  25. package/Dropdown.js +110 -110
  26. package/Empty.js +3 -3
  27. package/Form.js +984 -945
  28. package/Grid.js +34 -34
  29. package/Icon.js +16 -16
  30. package/IconHover.js +2 -2
  31. package/Image.js +2 -2
  32. package/Input.js +7 -6
  33. package/InputNumber.js +6 -6
  34. package/InputTag.js +1 -1
  35. package/Layout.js +24 -24
  36. package/Link.js +30 -30
  37. package/List.js +95 -95
  38. package/Mentions.js +85 -84
  39. package/Menu.js +2 -2
  40. package/Message.js +7 -6
  41. package/Modal.js +1 -1
  42. package/Notice.js +14 -3
  43. package/Notification.js +9 -7
  44. package/OverflowEllipsis.js +64 -62
  45. package/PageHeader.js +73 -73
  46. package/Pagination.js +1 -1
  47. package/Picker.js +1 -1
  48. package/Popconfirm.js +60 -60
  49. package/Popover.js +31 -31
  50. package/Portal.js +23 -31
  51. package/Progress.js +22 -22
  52. package/Radio.js +2 -2
  53. package/Rate.js +24 -24
  54. package/ResizeBox.js +274 -271
  55. package/Result.js +3 -3
  56. package/Select.js +4 -4
  57. package/SelectView.js +257 -238
  58. package/Skeleton.js +46 -46
  59. package/Slider.js +286 -283
  60. package/Space.js +28 -28
  61. package/SpeechSynthesis.js +62 -55
  62. package/Spin.js +23 -23
  63. package/Statistic.js +80 -80
  64. package/Steps.js +67 -67
  65. package/Switch.js +47 -47
  66. package/Table.js +1445 -1380
  67. package/Tabs.js +5 -5
  68. package/Tag.js +45 -45
  69. package/TimePicker.js +154 -154
  70. package/Timeline.js +2 -2
  71. package/Tooltip.js +80 -79
  72. package/Transfer.js +103 -102
  73. package/Tree.js +3 -2
  74. package/TreeSelect.js +2 -2
  75. package/Trigger.js +699 -772
  76. package/Typography.js +756 -6
  77. package/Upload.js +2 -2
  78. package/VerificationCode.js +1 -1
  79. package/Version.js +1 -1
  80. package/VirtualList.js +1 -1
  81. package/Watermark.js +1 -1
  82. package/chunk/{BHgJ5Y3T.js → -UuKKT0Z.js} +29 -29
  83. package/chunk/{B8QV6E2b.js → AwZqeapI.js} +5 -5
  84. package/chunk/B5gK1Idp.js +19 -0
  85. package/chunk/B7FlazNB.js +24 -0
  86. package/chunk/{DTBtQQ2H.js → BBvWDeuZ.js} +67 -67
  87. package/chunk/BCftTxEy.js +626 -0
  88. package/chunk/{CZOP_ZHJ.js → BGny4zSb.js} +60 -60
  89. package/chunk/BHF15Dog.js +98 -0
  90. package/chunk/BJQ5UNa-.js +1585 -0
  91. package/chunk/BP9sYyk9.js +8 -0
  92. package/chunk/BUdtVdnv.js +38 -0
  93. package/chunk/BVQlOzTS.js +11 -0
  94. package/chunk/B__a_gb_.js +519 -0
  95. package/chunk/BbEYToV1.js +10 -0
  96. package/chunk/BbdDQAnm.js +15 -0
  97. package/chunk/BdUcgWdu.js +11 -0
  98. package/chunk/BfbXSG70.js +26 -0
  99. package/chunk/BndfNLK4.js +186 -0
  100. package/chunk/BoMCZV6K.js +1098 -0
  101. package/chunk/Br0B6y1T.js +18 -0
  102. package/chunk/BrOW642m.js +130 -0
  103. package/chunk/BxUs8_Cr.js +9 -0
  104. package/chunk/{CcV4wQB1.js → C42LIMP9.js} +244 -242
  105. package/chunk/C4YkFMzC.js +778 -0
  106. package/chunk/{Bh23P4l7.js → C9Wcraj7.js} +21 -21
  107. package/chunk/{4-gvEY5y.js → CANgSlh3.js} +10 -10
  108. package/chunk/CJ_o9tZM.js +5 -0
  109. package/chunk/{DNAigumg.js → CK5m7rLl.js} +36 -36
  110. package/chunk/{CANaGbGR.js → CKNyIitu.js} +57 -56
  111. package/chunk/CLiqJm_T.js +10 -0
  112. package/chunk/{BnSVm1YC.js → CNmmhbCn.js} +32 -32
  113. package/chunk/{BFipyA67.js → CP0odX99.js} +51 -51
  114. package/chunk/CPT-OZH2.js +14 -0
  115. package/chunk/CVSF8p0O.js +698 -0
  116. package/chunk/C_agcwLN.js +31 -0
  117. package/chunk/{jhQQCFMn.js → C_gJWGGh.js} +201 -201
  118. package/chunk/{Bc7t9jkb.js → CaasmWg_.js} +11 -11
  119. package/chunk/Ce1j9KTi.js +6 -0
  120. package/chunk/{D_-UD4vO.js → Cf5QNhkG.js} +18 -18
  121. package/chunk/CkNSv2U7.js +56 -0
  122. package/chunk/Cp2f70gB.js +9 -0
  123. package/chunk/CpegYjdC.js +16 -0
  124. package/chunk/CucI3KZr.js +20 -0
  125. package/chunk/CwoFBTYz.js +11 -0
  126. package/chunk/D2KPqPhV.js +17 -0
  127. package/chunk/D7NyvE5f.js +17 -0
  128. package/chunk/D8oTPQ2H.js +384 -0
  129. package/chunk/{CLBavO5c.js → DC1iHEiy.js} +87 -87
  130. package/chunk/{DnvO8A0Z.js → DFrfrmfK.js} +120 -119
  131. package/chunk/DGTIZ_0O.js +6 -0
  132. package/chunk/DJfpiZn_.js +25 -0
  133. package/chunk/DKr2_PYd.js +34 -0
  134. package/chunk/DNUz6zgo.js +11 -0
  135. package/chunk/DRtM649q.js +11 -0
  136. package/chunk/DS_mUWn6.js +41 -0
  137. package/chunk/DU6bs_19.js +10 -0
  138. package/chunk/DWdbwz22.js +10 -0
  139. package/chunk/DcveZuqd.js +6 -0
  140. package/chunk/DdVFknul.js +24 -0
  141. package/chunk/DgRfikwe.js +16 -0
  142. package/chunk/{znkyQ-HR.js → DkyR2EfG.js} +66 -66
  143. package/chunk/{DUeHQKtx.js → DleQ5HwG.js} +42 -42
  144. package/chunk/DnrZEnQ_.js +27 -0
  145. package/chunk/DsRSHWtX.js +1025 -0
  146. package/chunk/Dz5BdmXo.js +270 -0
  147. package/chunk/EANe01DF.js +1030 -0
  148. package/chunk/{CwhPMMWy.js → Ey4YJCkX.js} +7 -7
  149. package/chunk/GoNx5R4F.js +873 -0
  150. package/chunk/HDUQku8d.js +20 -0
  151. package/chunk/HrAP__Hi.js +25 -0
  152. package/chunk/JPPo5nY_.js +9 -0
  153. package/chunk/{Du-bw6qA.js → SLWP34OR.js} +90 -85
  154. package/chunk/VVKtwaGf.js +278 -0
  155. package/chunk/WPNpLxSI.js +16 -0
  156. package/chunk/{CPvvjMwZ.js → WpO_DsK4.js} +49 -48
  157. package/chunk/fdU3ang6.js +14 -0
  158. package/chunk/{DQAot004.js → fkclKOAL.js} +298 -292
  159. package/chunk/flvYlqx3.js +22 -0
  160. package/chunk/kTDayEpF.js +288 -0
  161. package/chunk/{CssIjN1g.js → pZoNQ75H.js} +31 -31
  162. package/chunk/qFf1w_Jq.js +8 -0
  163. package/chunk/{CHnFKgbk.js → w-kM1L5W.js} +155 -155
  164. package/hooks/index.js +53 -49
  165. package/hooks/useComputedState.js +2 -10
  166. package/hooks/useCreate.js +2 -7
  167. package/hooks/useForceUpdate.js +2 -7
  168. package/hooks/useId.js +2 -10
  169. package/hooks/useInView.js +2 -30
  170. package/hooks/useIntersectionObserver.js +2 -23
  171. package/hooks/useInterval.js +2 -17
  172. package/hooks/useIsFirstRender.js +2 -9
  173. package/hooks/useIsomorphicLayoutEffect.js +2 -5
  174. package/hooks/useKeyboardEvent.js +2 -16
  175. package/hooks/useMedia.js +2 -15
  176. package/hooks/useMergeProps.js +2 -18
  177. package/hooks/useMergeValue.js +2 -19
  178. package/hooks/useOnlineStatus.js +4 -0
  179. package/hooks/useOverflowHidden.js +2 -25
  180. package/hooks/useOverrideRef.js +2 -13
  181. package/hooks/usePersistCallback.js +2 -13
  182. package/hooks/usePrefersColorSchemeDark.js +4 -0
  183. package/hooks/usePrevious.js +2 -9
  184. package/hooks/useRefs.js +2 -9
  185. package/hooks/useResizeObserver.js +2 -15
  186. package/hooks/useStateCallback.js +2 -15
  187. package/hooks/useStateWithPromise.js +2 -24
  188. package/hooks/useUpdateEffect.js +2 -9
  189. package/hooks/useVerificationCode.js +73 -0
  190. package/hooks/useWatch.js +2 -10
  191. package/hooks/{use-watermark.js → useWatermark.js} +27 -26
  192. package/hooks/useWindowSize.js +2 -20
  193. package/index.js +571 -584
  194. package/locale/en-US.js +4 -2
  195. package/locale/interface.js +1 -4
  196. package/locale/ja-JP.js +3 -1
  197. package/locale/tr-TR.js +1 -1
  198. package/locale/zh-CN.js +3 -1
  199. package/locale/zh-HK.js +3 -1
  200. package/locale/zh-TW.js +3 -1
  201. package/package.json +1 -1
  202. package/style.css +1 -1
  203. package/types/anchor/util.d.ts +1 -1
  204. package/types/button/index.d.ts +2 -2
  205. package/types/color-picker/hooks/useColorPicker.d.ts +2 -2
  206. package/types/form/Control-old.d.ts +56 -0
  207. package/types/form/Control.d.ts +6 -54
  208. package/types/form/FormItem.d.ts +1 -1
  209. package/types/form/store.d.ts +0 -1
  210. package/types/hooks/index.d.ts +2 -0
  211. package/types/hooks/useComputedState.d.ts +1 -4
  212. package/types/hooks/useCreate.d.ts +1 -2
  213. package/types/hooks/useForceUpdate.d.ts +1 -2
  214. package/types/hooks/useId.d.ts +1 -2
  215. package/types/hooks/useInView.d.ts +1 -11
  216. package/types/hooks/useIntersectionObserver.d.ts +1 -7
  217. package/types/hooks/useInterval.d.ts +1 -2
  218. package/types/hooks/useIsFirstRender.d.ts +1 -2
  219. package/types/hooks/useIsomorphicLayoutEffect.d.ts +1 -3
  220. package/types/hooks/useKeyboardEvent.d.ts +1 -8
  221. package/types/hooks/useMedia.d.ts +1 -2
  222. package/types/hooks/useMergeProps.d.ts +1 -5
  223. package/types/hooks/useMergeValue.d.ts +1 -6
  224. package/types/hooks/useOnlineStatus.d.ts +1 -0
  225. package/types/hooks/useOverflowHidden.d.ts +1 -5
  226. package/types/hooks/useOverrideRef.d.ts +1 -6
  227. package/types/hooks/usePersistCallback.d.ts +1 -2
  228. package/types/hooks/usePrefersColorSchemeDark.d.ts +1 -0
  229. package/types/hooks/usePrevious.d.ts +1 -3
  230. package/types/hooks/useRefs.d.ts +1 -2
  231. package/types/hooks/useResizeObserver.d.ts +1 -6
  232. package/types/hooks/useStateCallback.d.ts +1 -5
  233. package/types/hooks/useStateWithPromise.d.ts +1 -2
  234. package/types/hooks/useUpdateEffect.d.ts +1 -3
  235. package/types/hooks/useWatch.d.ts +1 -3
  236. package/types/hooks/useWindowSize.d.ts +1 -5
  237. package/types/image/interface.d.ts +1 -0
  238. package/types/index.d.ts +157 -86
  239. package/types/input/Input.d.ts +1 -1
  240. package/types/input/Textarea.d.ts +2 -2
  241. package/types/locale/en-US.d.ts +2 -0
  242. package/types/locale/interface.d.ts +1 -2
  243. package/types/locale/ja-JP.d.ts +2 -0
  244. package/types/locale/zh-CN.d.ts +2 -0
  245. package/types/locale/zh-HK.d.ts +2 -0
  246. package/types/locale/zh-TW.d.ts +2 -0
  247. package/types/menu/context.d.ts +1 -1
  248. package/types/message/index.d.ts +14 -14
  249. package/types/message/interface.d.ts +2 -0
  250. package/types/modal/config.d.ts +0 -1
  251. package/types/modal/interface.d.ts +0 -1
  252. package/types/notice/index.d.ts +2 -27
  253. package/types/notification/index.d.ts +15 -16
  254. package/types/notification/interface.d.ts +2 -0
  255. package/types/notification/withNotification.d.ts +2 -0
  256. package/types/select/util.d.ts +1 -2
  257. package/types/select-view/interface.d.ts +2 -1
  258. package/types/speech-synthesis/index.d.ts +1 -1
  259. package/types/table/constant.d.ts +2 -0
  260. package/types/table/hook/useThResizable.d.ts +7 -0
  261. package/types/table/index.d.ts +10 -1
  262. package/types/table/style/index.d.ts +1 -0
  263. package/types/table/th-resizable/index.d.ts +2 -0
  264. package/types/table/thead/Column.d.ts +1 -2
  265. package/types/tree/Tree.d.ts +12 -67
  266. package/types/tree-select/Select.d.ts +2 -2
  267. package/types/trigger/index.d.ts +2 -120
  268. package/types/trigger/interface.d.ts +2 -1
  269. package/types/utils/CSSTransition.d.ts +2 -3
  270. package/types/utils/caseName.d.ts +1 -1
  271. package/types/utils/className.d.ts +1 -1
  272. package/types/utils/constant.d.ts +2 -2
  273. package/types/utils/copy.d.ts +1 -1
  274. package/types/utils/dayjs.d.ts +1 -21
  275. package/types/utils/dom.d.ts +1 -6
  276. package/types/utils/fileToURL.d.ts +1 -1
  277. package/types/utils/fillNBSP.d.ts +1 -1
  278. package/types/utils/getHighlightText.d.ts +1 -5
  279. package/types/utils/getHotkeyHandler.d.ts +1 -8
  280. package/types/utils/getStringLength.d.ts +1 -1
  281. package/types/utils/include.d.ts +1 -1
  282. package/types/utils/index.d.ts +3 -4
  283. package/types/utils/is.d.ts +1 -16
  284. package/types/utils/keyboardCode.d.ts +3 -0
  285. package/types/utils/lodash.d.ts +1 -17
  286. package/types/utils/mergeProps.d.ts +1 -1
  287. package/types/utils/mergedToString.d.ts +1 -1
  288. package/types/utils/omit.d.ts +1 -1
  289. package/types/utils/pad.d.ts +1 -2
  290. package/types/utils/pick.d.ts +2 -4
  291. package/types/utils/reactDOM.d.ts +1 -7
  292. package/types/utils/resizeObserverEffect.d.ts +2 -0
  293. package/types/utils/saveAs.d.ts +1 -1
  294. package/types/utils/screenfull.d.ts +2 -0
  295. package/types/utils/scrollIntoView.d.ts +1 -2
  296. package/types/utils/style.d.ts +1 -3
  297. package/types/utils/throttleByRaf.d.ts +1 -5
  298. package/types/utils/throttleByRaf2.d.ts +1 -0
  299. package/types/utils/warning.d.ts +1 -2
  300. package/types/version/index.d.ts +1 -1
  301. package/utils/CSSTransition.js +2 -6
  302. package/utils/className.js +2 -2
  303. package/utils/constant.js +8 -9
  304. package/utils/contextHolder.js +1 -1
  305. package/utils/copy.js +1 -1
  306. package/utils/dayjs.js +14 -173
  307. package/utils/dom.js +33 -29
  308. package/utils/fillNBSP.js +2 -4
  309. package/utils/getHighlightText.js +2 -38
  310. package/utils/getHotkeyHandler.js +2 -25
  311. package/utils/getStringLength.js +2 -7
  312. package/utils/include.js +2 -7
  313. package/utils/index.js +237 -240
  314. package/utils/is.js +116 -156
  315. package/utils/keyboardCode.js +27 -0
  316. package/utils/mergeProps.js +2 -9
  317. package/utils/mergedToString.js +2 -13
  318. package/utils/omit.js +2 -9
  319. package/utils/pad.js +12 -12
  320. package/utils/pick.js +4 -15
  321. package/utils/reactDOM.js +3 -54
  322. package/utils/resizeObserverEffect.js +4 -0
  323. package/utils/saveAs.js +1 -1
  324. package/utils/screenfull.js +4 -0
  325. package/utils/scrollIntoView.js +2 -21
  326. package/utils/style.js +12 -11
  327. package/utils/throttleByRaf.js +13 -12
  328. package/utils/throttleByRaf2.js +5 -0
  329. package/utils/warning.js +5 -4
  330. package/NotificationBase.js +0 -53
  331. package/chunk/-zpSUpGE.js +0 -1501
  332. package/chunk/BAWsPQBM.js +0 -11
  333. package/chunk/BIT0j3HT.js +0 -269
  334. package/chunk/BbLKnaNO.js +0 -871
  335. package/chunk/Bfhv56O2.js +0 -638
  336. package/chunk/C2lIz2F9.js +0 -60
  337. package/chunk/C6QWSzsM.js +0 -376
  338. package/chunk/CVkHTbic.js +0 -995
  339. package/chunk/CeGEvXby.js +0 -278
  340. package/chunk/D3NFxdmG.js +0 -518
  341. package/chunk/DApXtulb.js +0 -1102
  342. package/chunk/DPByB1ab.js +0 -698
  343. package/chunk/DV1Ab_cG.js +0 -284
  344. package/chunk/dBnNCOIU.js +0 -778
  345. package/chunk/it8qlDZ3.js +0 -1032
  346. package/chunk/l0sNRNKZ.js +0 -1
  347. package/chunk/te_43YrB.js +0 -776
  348. package/hooks/use-verification-code.js +0 -73
  349. package/types/notification-base/index.d.ts +0 -15
  350. package/types/notification-base/style/index.d.ts +0 -2
  351. package/types/trigger/Portal.d.ts +0 -7
  352. package/types/utils/keyCode.d.ts +0 -45
  353. package/types/utils/raf.d.ts +0 -3
  354. package/types/utils/throttleByRafV2.d.ts +0 -5
  355. package/utils/keyCode.js +0 -12
  356. package/utils/raf.js +0 -19
  357. package/utils/throttleByRafV2.js +0 -16
package/chunk/-zpSUpGE.js DELETED
@@ -1,1501 +0,0 @@
1
- var Ft = Object.defineProperty;
2
- var Tt = (r, e, t) => e in r ? Ft(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var g = (r, e, t) => Tt(r, typeof e != "symbol" ? e + "" : e, t);
4
- import G, { forwardRef as bt, useContext as nt, createContext as qt, useRef as st, useImperativeHandle as xt, Component as Ot, createRef as jt, useEffect as D, useState as Lt } from "react";
5
- import { jsx as d, jsxs as V } from "react/jsx-runtime";
6
- import _ from "@unicom-cloud/icons/context";
7
- import Dt from "lodash/isPlainObject";
8
- import { useMergeProps as Ct } from "../hooks/useMergeProps.js";
9
- import { _ as yt, P as vt } from "./CLBavO5c.js";
10
- import O from "lodash/isNumber";
11
- import F from "lodash/isUndefined";
12
- import Ut from "@unicom-cloud/icons/IconUiCheckCircleFill";
13
- import it from "@unicom-cloud/icons/IconUiClose";
14
- import Wt from "@unicom-cloud/icons/IconUiCloseCircleFill";
15
- import zt from "@unicom-cloud/icons/IconUiExclamationCircleFill";
16
- import Bt from "@unicom-cloud/icons/IconUiInfoCircleFill";
17
- import Vt from "@unicom-cloud/icons/IconUiLoading";
18
- import Gt from "@unicom-cloud/icons/IconUiEmpty";
19
- import { y as j } from "./BAWsPQBM.js";
20
- import Jt from "../locale/zh-CN.js";
21
- import wt from "../NotificationBase.js";
22
- import { render as $t } from "../utils/reactDOM.js";
23
- import Kt from "lodash/isString";
24
- import { createPortal as Qt } from "react-dom";
25
- import Xt from "../utils/omit.js";
26
- var Yt = Object.defineProperty, Zt = (r, e, t) => e in r ? Yt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, I = (r, e, t) => Zt(r, typeof e != "symbol" ? e + "" : e, t);
27
- function w(r, e) {
28
- _t(r) && (r = "100%");
29
- const t = te(r);
30
- return r = e === 360 ? r : Math.min(e, Math.max(0, parseFloat(r))), t && (r = parseInt(String(r * e), 10) / 100), Math.abs(r - e) < 1e-6 ? 1 : (e === 360 ? r = (r < 0 ? r % e + e : r % e) / parseFloat(String(e)) : r = r % e / parseFloat(String(e)), r);
31
- }
32
- function U(r) {
33
- return Math.min(1, Math.max(0, r));
34
- }
35
- function _t(r) {
36
- return typeof r == "string" && r.indexOf(".") !== -1 && parseFloat(r) === 1;
37
- }
38
- function te(r) {
39
- return typeof r == "string" && r.indexOf("%") !== -1;
40
- }
41
- function Mt(r) {
42
- return r = parseFloat(r), (isNaN(r) || r < 0 || r > 1) && (r = 1), r;
43
- }
44
- function W(r) {
45
- return Number(r) <= 1 ? `${Number(r) * 100}%` : r;
46
- }
47
- function P(r) {
48
- return r.length === 1 ? "0" + r : String(r);
49
- }
50
- function ee(r, e, t) {
51
- return {
52
- r: w(r, 255) * 255,
53
- g: w(e, 255) * 255,
54
- b: w(t, 255) * 255
55
- };
56
- }
57
- function ot(r, e, t) {
58
- r = w(r, 255), e = w(e, 255), t = w(t, 255);
59
- const n = Math.max(r, e, t), s = Math.min(r, e, t);
60
- let i = 0, o = 0;
61
- const a = (n + s) / 2;
62
- if (n === s)
63
- o = 0, i = 0;
64
- else {
65
- const f = n - s;
66
- switch (o = a > 0.5 ? f / (2 - n - s) : f / (n + s), n) {
67
- case r:
68
- i = (e - t) / f + (e < t ? 6 : 0);
69
- break;
70
- case e:
71
- i = (t - r) / f + 2;
72
- break;
73
- case t:
74
- i = (r - e) / f + 4;
75
- break;
76
- }
77
- i /= 6;
78
- }
79
- return { h: i, s: o, l: a };
80
- }
81
- function Q(r, e, t) {
82
- return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? r + (e - r) * (6 * t) : t < 1 / 2 ? e : t < 2 / 3 ? r + (e - r) * (2 / 3 - t) * 6 : r;
83
- }
84
- function re(r, e, t) {
85
- let n, s, i;
86
- if (r = w(r, 360), e = w(e, 100), t = w(t, 100), e === 0)
87
- s = t, i = t, n = t;
88
- else {
89
- const o = t < 0.5 ? t * (1 + e) : t + e - t * e, a = 2 * t - o;
90
- n = Q(a, o, r + 1 / 3), s = Q(a, o, r), i = Q(a, o, r - 1 / 3);
91
- }
92
- return { r: n * 255, g: s * 255, b: i * 255 };
93
- }
94
- function X(r, e, t) {
95
- r = w(r, 255), e = w(e, 255), t = w(t, 255);
96
- const n = Math.max(r, e, t), s = Math.min(r, e, t);
97
- let i = 0;
98
- const o = n, a = n - s, f = n === 0 ? 0 : a / n;
99
- if (n === s)
100
- i = 0;
101
- else {
102
- switch (n) {
103
- case r:
104
- i = (e - t) / a + (e < t ? 6 : 0);
105
- break;
106
- case e:
107
- i = (t - r) / a + 2;
108
- break;
109
- case t:
110
- i = (r - e) / a + 4;
111
- break;
112
- }
113
- i /= 6;
114
- }
115
- return { h: i, s: f, v: o };
116
- }
117
- function ne(r, e, t) {
118
- r = w(r, 360) * 6, e = w(e, 100), t = w(t, 100);
119
- const n = Math.floor(r), s = r - n, i = t * (1 - e), o = t * (1 - s * e), a = t * (1 - (1 - s) * e), f = n % 6, l = [t, o, i, i, a, t][f], c = [a, t, t, o, i, i][f], u = [i, i, a, t, t, o][f];
120
- return { r: l * 255, g: c * 255, b: u * 255 };
121
- }
122
- function at(r, e, t, n) {
123
- const s = [
124
- P(Math.round(r).toString(16)),
125
- P(Math.round(e).toString(16)),
126
- P(Math.round(t).toString(16))
127
- ];
128
- return n && s[0].startsWith(s[0].charAt(1)) && s[1].startsWith(s[1].charAt(1)) && s[2].startsWith(s[2].charAt(1)) ? s[0].charAt(0) + s[1].charAt(0) + s[2].charAt(0) : s.join("");
129
- }
130
- function se(r, e, t, n, s) {
131
- const i = [
132
- P(Math.round(r).toString(16)),
133
- P(Math.round(e).toString(16)),
134
- P(Math.round(t).toString(16)),
135
- P(kt(n))
136
- ];
137
- return s && i[0].startsWith(i[0].charAt(1)) && i[1].startsWith(i[1].charAt(1)) && i[2].startsWith(i[2].charAt(1)) && i[3].startsWith(i[3].charAt(1)) ? i[0].charAt(0) + i[1].charAt(0) + i[2].charAt(0) + i[3].charAt(0) : i.join("");
138
- }
139
- function Ge(r, e, t, n) {
140
- return [
141
- P(kt(n)),
142
- P(Math.round(r).toString(16)),
143
- P(Math.round(e).toString(16)),
144
- P(Math.round(t).toString(16))
145
- ].join("");
146
- }
147
- function ie(r, e, t, n) {
148
- const s = r / 100, i = e / 100, o = t / 100, a = n / 100, f = 255 * (1 - s) * (1 - a), l = 255 * (1 - i) * (1 - a), c = 255 * (1 - o) * (1 - a);
149
- return { r: f, g: l, b: c };
150
- }
151
- function ct(r, e, t) {
152
- let n = 1 - r / 255, s = 1 - e / 255, i = 1 - t / 255, o = Math.min(n, s, i);
153
- return o === 1 ? (n = 0, s = 0, i = 0) : (n = (n - o) / (1 - o) * 100, s = (s - o) / (1 - o) * 100, i = (i - o) / (1 - o) * 100), o *= 100, {
154
- c: Math.round(n),
155
- m: Math.round(s),
156
- y: Math.round(i),
157
- k: Math.round(o)
158
- };
159
- }
160
- function kt(r) {
161
- return Math.round(parseFloat(r) * 255).toString(16);
162
- }
163
- function lt(r) {
164
- return R(r) / 255;
165
- }
166
- function R(r) {
167
- return parseInt(r, 16);
168
- }
169
- function oe(r) {
170
- return {
171
- r: r >> 16,
172
- g: (r & 65280) >> 8,
173
- b: r & 255
174
- };
175
- }
176
- const tt = {
177
- aliceblue: "#f0f8ff",
178
- antiquewhite: "#faebd7",
179
- aqua: "#00ffff",
180
- aquamarine: "#7fffd4",
181
- azure: "#f0ffff",
182
- beige: "#f5f5dc",
183
- bisque: "#ffe4c4",
184
- black: "#000000",
185
- blanchedalmond: "#ffebcd",
186
- blue: "#0000ff",
187
- blueviolet: "#8a2be2",
188
- brown: "#a52a2a",
189
- burlywood: "#deb887",
190
- cadetblue: "#5f9ea0",
191
- chartreuse: "#7fff00",
192
- chocolate: "#d2691e",
193
- coral: "#ff7f50",
194
- cornflowerblue: "#6495ed",
195
- cornsilk: "#fff8dc",
196
- crimson: "#dc143c",
197
- cyan: "#00ffff",
198
- darkblue: "#00008b",
199
- darkcyan: "#008b8b",
200
- darkgoldenrod: "#b8860b",
201
- darkgray: "#a9a9a9",
202
- darkgreen: "#006400",
203
- darkgrey: "#a9a9a9",
204
- darkkhaki: "#bdb76b",
205
- darkmagenta: "#8b008b",
206
- darkolivegreen: "#556b2f",
207
- darkorange: "#ff8c00",
208
- darkorchid: "#9932cc",
209
- darkred: "#8b0000",
210
- darksalmon: "#e9967a",
211
- darkseagreen: "#8fbc8f",
212
- darkslateblue: "#483d8b",
213
- darkslategray: "#2f4f4f",
214
- darkslategrey: "#2f4f4f",
215
- darkturquoise: "#00ced1",
216
- darkviolet: "#9400d3",
217
- deeppink: "#ff1493",
218
- deepskyblue: "#00bfff",
219
- dimgray: "#696969",
220
- dimgrey: "#696969",
221
- dodgerblue: "#1e90ff",
222
- firebrick: "#b22222",
223
- floralwhite: "#fffaf0",
224
- forestgreen: "#228b22",
225
- fuchsia: "#ff00ff",
226
- gainsboro: "#dcdcdc",
227
- ghostwhite: "#f8f8ff",
228
- goldenrod: "#daa520",
229
- gold: "#ffd700",
230
- gray: "#808080",
231
- green: "#008000",
232
- greenyellow: "#adff2f",
233
- grey: "#808080",
234
- honeydew: "#f0fff0",
235
- hotpink: "#ff69b4",
236
- indianred: "#cd5c5c",
237
- indigo: "#4b0082",
238
- ivory: "#fffff0",
239
- khaki: "#f0e68c",
240
- lavenderblush: "#fff0f5",
241
- lavender: "#e6e6fa",
242
- lawngreen: "#7cfc00",
243
- lemonchiffon: "#fffacd",
244
- lightblue: "#add8e6",
245
- lightcoral: "#f08080",
246
- lightcyan: "#e0ffff",
247
- lightgoldenrodyellow: "#fafad2",
248
- lightgray: "#d3d3d3",
249
- lightgreen: "#90ee90",
250
- lightgrey: "#d3d3d3",
251
- lightpink: "#ffb6c1",
252
- lightsalmon: "#ffa07a",
253
- lightseagreen: "#20b2aa",
254
- lightskyblue: "#87cefa",
255
- lightslategray: "#778899",
256
- lightslategrey: "#778899",
257
- lightsteelblue: "#b0c4de",
258
- lightyellow: "#ffffe0",
259
- lime: "#00ff00",
260
- limegreen: "#32cd32",
261
- linen: "#faf0e6",
262
- magenta: "#ff00ff",
263
- maroon: "#800000",
264
- mediumaquamarine: "#66cdaa",
265
- mediumblue: "#0000cd",
266
- mediumorchid: "#ba55d3",
267
- mediumpurple: "#9370db",
268
- mediumseagreen: "#3cb371",
269
- mediumslateblue: "#7b68ee",
270
- mediumspringgreen: "#00fa9a",
271
- mediumturquoise: "#48d1cc",
272
- mediumvioletred: "#c71585",
273
- midnightblue: "#191970",
274
- mintcream: "#f5fffa",
275
- mistyrose: "#ffe4e1",
276
- moccasin: "#ffe4b5",
277
- navajowhite: "#ffdead",
278
- navy: "#000080",
279
- oldlace: "#fdf5e6",
280
- olive: "#808000",
281
- olivedrab: "#6b8e23",
282
- orange: "#ffa500",
283
- orangered: "#ff4500",
284
- orchid: "#da70d6",
285
- palegoldenrod: "#eee8aa",
286
- palegreen: "#98fb98",
287
- paleturquoise: "#afeeee",
288
- palevioletred: "#db7093",
289
- papayawhip: "#ffefd5",
290
- peachpuff: "#ffdab9",
291
- peru: "#cd853f",
292
- pink: "#ffc0cb",
293
- plum: "#dda0dd",
294
- powderblue: "#b0e0e6",
295
- purple: "#800080",
296
- rebeccapurple: "#663399",
297
- red: "#ff0000",
298
- rosybrown: "#bc8f8f",
299
- royalblue: "#4169e1",
300
- saddlebrown: "#8b4513",
301
- salmon: "#fa8072",
302
- sandybrown: "#f4a460",
303
- seagreen: "#2e8b57",
304
- seashell: "#fff5ee",
305
- sienna: "#a0522d",
306
- silver: "#c0c0c0",
307
- skyblue: "#87ceeb",
308
- slateblue: "#6a5acd",
309
- slategray: "#708090",
310
- slategrey: "#708090",
311
- snow: "#fffafa",
312
- springgreen: "#00ff7f",
313
- steelblue: "#4682b4",
314
- tan: "#d2b48c",
315
- teal: "#008080",
316
- thistle: "#d8bfd8",
317
- tomato: "#ff6347",
318
- turquoise: "#40e0d0",
319
- violet: "#ee82ee",
320
- wheat: "#f5deb3",
321
- white: "#ffffff",
322
- whitesmoke: "#f5f5f5",
323
- yellow: "#ffff00",
324
- yellowgreen: "#9acd32"
325
- };
326
- function ae(r) {
327
- let e = { r: 0, g: 0, b: 0 }, t = 1, n = null, s = null, i = null, o = !1, a = !1;
328
- return typeof r == "string" && (r = he(r)), typeof r == "object" && (k(r.r) && k(r.g) && k(r.b) ? (e = ee(r.r, r.g, r.b), o = !0, a = String(r.r).slice(-1) === "%" ? "prgb" : "rgb") : k(r.h) && k(r.s) && k(r.v) ? (n = W(r.s), s = W(r.v), e = ne(r.h, n, s), o = !0, a = "hsv") : k(r.h) && k(r.s) && k(r.l) ? (n = W(r.s), i = W(r.l), e = re(r.h, n, i), o = !0, a = "hsl") : k(r.c) && k(r.m) && k(r.y) && k(r.k) && (e = ie(r.c, r.m, r.y, r.k), o = !0, a = "cmyk"), Object.prototype.hasOwnProperty.call(r, "a") && (t = r.a)), t = Mt(t), {
329
- ok: o,
330
- format: r.format || a,
331
- r: Math.min(255, Math.max(e.r, 0)),
332
- g: Math.min(255, Math.max(e.g, 0)),
333
- b: Math.min(255, Math.max(e.b, 0)),
334
- a: t
335
- };
336
- }
337
- const ce = "[-\\+]?\\d+%?", le = "[-\\+]?\\d*\\.\\d+%?", H = "(?:" + le + ")|(?:" + ce + ")", Y = "[\\s|\\(]+(" + H + ")[,|\\s]+(" + H + ")[,|\\s]+(" + H + ")\\s*\\)?", z = (
338
- // eslint-disable-next-line prettier/prettier
339
- "[\\s|\\(]+(" + H + ")[,|\\s]+(" + H + ")[,|\\s]+(" + H + ")[,|\\s]+(" + H + ")\\s*\\)?"
340
- ), E = {
341
- CSS_UNIT: new RegExp(H),
342
- rgb: new RegExp("rgb" + Y),
343
- rgba: new RegExp("rgba" + z),
344
- hsl: new RegExp("hsl" + Y),
345
- hsla: new RegExp("hsla" + z),
346
- hsv: new RegExp("hsv" + Y),
347
- hsva: new RegExp("hsva" + z),
348
- cmyk: new RegExp("cmyk" + z),
349
- hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
350
- hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
351
- hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
352
- hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
353
- };
354
- function he(r) {
355
- if (r = r.trim().toLowerCase(), r.length === 0)
356
- return !1;
357
- let e = !1;
358
- if (tt[r])
359
- r = tt[r], e = !0;
360
- else if (r === "transparent")
361
- return { r: 0, g: 0, b: 0, a: 0, format: "name" };
362
- let t = E.rgb.exec(r);
363
- return t ? { r: t[1], g: t[2], b: t[3] } : (t = E.rgba.exec(r), t ? { r: t[1], g: t[2], b: t[3], a: t[4] } : (t = E.hsl.exec(r), t ? { h: t[1], s: t[2], l: t[3] } : (t = E.hsla.exec(r), t ? { h: t[1], s: t[2], l: t[3], a: t[4] } : (t = E.hsv.exec(r), t ? { h: t[1], s: t[2], v: t[3] } : (t = E.hsva.exec(r), t ? { h: t[1], s: t[2], v: t[3], a: t[4] } : (t = E.cmyk.exec(r), t ? {
364
- c: t[1],
365
- m: t[2],
366
- y: t[3],
367
- k: t[4]
368
- } : (t = E.hex8.exec(r), t ? {
369
- r: R(t[1]),
370
- g: R(t[2]),
371
- b: R(t[3]),
372
- a: lt(t[4]),
373
- format: e ? "name" : "hex8"
374
- } : (t = E.hex6.exec(r), t ? {
375
- r: R(t[1]),
376
- g: R(t[2]),
377
- b: R(t[3]),
378
- format: e ? "name" : "hex"
379
- } : (t = E.hex4.exec(r), t ? {
380
- r: R(t[1] + t[1]),
381
- g: R(t[2] + t[2]),
382
- b: R(t[3] + t[3]),
383
- a: lt(t[4] + t[4]),
384
- format: e ? "name" : "hex8"
385
- } : (t = E.hex3.exec(r), t ? {
386
- r: R(t[1] + t[1]),
387
- g: R(t[2] + t[2]),
388
- b: R(t[3] + t[3]),
389
- format: e ? "name" : "hex"
390
- } : !1))))))))));
391
- }
392
- function k(r) {
393
- return typeof r == "number" ? !Number.isNaN(r) : E.CSS_UNIT.test(r);
394
- }
395
- class C {
396
- constructor(e = "", t = {}) {
397
- if (I(this, "r"), I(this, "g"), I(this, "b"), I(this, "a"), I(this, "format"), I(this, "originalInput"), I(this, "isValid"), I(this, "gradientType"), I(this, "roundA"), e instanceof C)
398
- return e;
399
- typeof e == "number" && (e = oe(e)), this.originalInput = e;
400
- const n = ae(e);
401
- this.originalInput = e, this.r = n.r, this.g = n.g, this.b = n.b, this.a = n.a, this.roundA = Math.round(100 * this.a) / 100, this.format = t.format ?? n.format, this.gradientType = t.gradientType, this.r < 1 && (this.r = Math.round(this.r)), this.g < 1 && (this.g = Math.round(this.g)), this.b < 1 && (this.b = Math.round(this.b)), this.isValid = n.ok;
402
- }
403
- get ok() {
404
- return this.isValid;
405
- }
406
- isDark() {
407
- return this.getBrightness() < 128;
408
- }
409
- isLight() {
410
- return !this.isDark();
411
- }
412
- /**
413
- * Returns the perceived brightness of the color, from 0-255.
414
- */
415
- getBrightness() {
416
- const e = this.toRgb();
417
- return (e.r * 299 + e.g * 587 + e.b * 114) / 1e3;
418
- }
419
- /**
420
- * Returns the perceived luminance of a color, from 0-1.
421
- */
422
- getLuminance() {
423
- const e = this.toRgb();
424
- let t, n, s;
425
- const i = e.r / 255, o = e.g / 255, a = e.b / 255;
426
- return i <= 0.03928 ? t = i / 12.92 : t = Math.pow((i + 0.055) / 1.055, 2.4), o <= 0.03928 ? n = o / 12.92 : n = Math.pow((o + 0.055) / 1.055, 2.4), a <= 0.03928 ? s = a / 12.92 : s = Math.pow((a + 0.055) / 1.055, 2.4), 0.2126 * t + 0.7152 * n + 0.0722 * s;
427
- }
428
- /**
429
- * Returns the alpha value of a color, from 0-1.
430
- */
431
- getAlpha() {
432
- return this.a;
433
- }
434
- /**
435
- * Sets the alpha value on the current color.
436
- *
437
- * @param alpha - The new alpha value. The accepted range is 0-1.
438
- */
439
- setAlpha(e) {
440
- return this.a = Mt(e), this.roundA = Math.round(100 * this.a) / 100, this;
441
- }
442
- /**
443
- * Returns whether the color is monochrome.
444
- */
445
- isMonochrome() {
446
- const { s: e } = this.toHsl();
447
- return e === 0;
448
- }
449
- /**
450
- * Returns the object as a HSVA object.
451
- */
452
- toHsv() {
453
- const e = X(this.r, this.g, this.b);
454
- return { h: e.h * 360, s: e.s, v: e.v, a: this.a };
455
- }
456
- toHsv_() {
457
- const e = X(this.r, this.g, this.b);
458
- return { h: e.h, s: e.s, v: e.v, a: this.a };
459
- }
460
- /**
461
- * Returns the hsva values interpolated into a string with the following format:
462
- * "hsva(xxx, xxx, xxx, xx)".
463
- */
464
- toHsvString() {
465
- const e = X(this.r, this.g, this.b), t = Math.round(e.h * 360), n = Math.round(e.s * 100), s = Math.round(e.v * 100);
466
- return this.a === 1 ? `hsv(${t}, ${n}%, ${s}%)` : `hsva(${t}, ${n}%, ${s}%, ${this.roundA})`;
467
- }
468
- /**
469
- * Returns the object as a HSLA object.
470
- */
471
- toHsl() {
472
- const e = ot(this.r, this.g, this.b);
473
- return { h: e.h * 360, s: e.s, l: e.l, a: this.a };
474
- }
475
- /**
476
- * Returns the hsla values interpolated into a string with the following format:
477
- * "hsla(xxx, xxx, xxx, xx)".
478
- */
479
- toHslString() {
480
- const e = ot(this.r, this.g, this.b), t = Math.round(e.h * 360), n = Math.round(e.s * 100), s = Math.round(e.l * 100);
481
- return this.a === 1 ? `hsl(${t}, ${n}%, ${s}%)` : `hsla(${t}, ${n}%, ${s}%, ${this.roundA})`;
482
- }
483
- /**
484
- * Returns the hex value of the color.
485
- * @param allow3Char will shorten hex value to 3 char if possible
486
- */
487
- toHex(e = !1) {
488
- return at(this.r, this.g, this.b, e);
489
- }
490
- /**
491
- * Returns the hex value of the color -with a # prefixed.
492
- * @param allow3Char will shorten hex value to 3 char if possible
493
- */
494
- toHexString(e = !1) {
495
- return `#${this.toHex(e)}`;
496
- }
497
- /**
498
- * Returns the hex 8 value of the color.
499
- * @param allow4Char will shorten hex value to 4 char if possible
500
- */
501
- toHex8(e = !1) {
502
- return se(this.r, this.g, this.b, this.a, e);
503
- }
504
- /**
505
- * Returns the hex 8 value of the color -with a # prefixed.
506
- * @param allow4Char will shorten hex value to 4 char if possible
507
- */
508
- toHex8String(e = !1) {
509
- return `#${this.toHex8(e)}`;
510
- }
511
- /**
512
- * Returns the shorter hex value of the color depends on its alpha -with a # prefixed.
513
- * @param allowShortChar will shorten hex value to 3 or 4 char if possible
514
- */
515
- toHexShortString(e = !1) {
516
- return this.a === 1 ? this.toHexString(e) : this.toHex8String(e);
517
- }
518
- /**
519
- * Returns the object as a RGBA object.
520
- */
521
- toRgb() {
522
- return {
523
- r: Math.round(this.r),
524
- g: Math.round(this.g),
525
- b: Math.round(this.b),
526
- a: this.a
527
- };
528
- }
529
- toRgbArray() {
530
- const e = this.toRgb();
531
- return [e.r, e.g, e.b];
532
- }
533
- toRgbArrayString() {
534
- const e = this.toRgb();
535
- return `${e.r},${e.g},${e.b}`;
536
- }
537
- /**
538
- * Returns the RGBA values interpolated into a string with the following format:
539
- * "RGBA(xxx, xxx, xxx, xx)".
540
- */
541
- toRgbString() {
542
- const e = Math.round(this.r), t = Math.round(this.g), n = Math.round(this.b);
543
- return this.a === 1 ? `rgb(${e}, ${t}, ${n})` : `rgba(${e}, ${t}, ${n}, ${this.roundA})`;
544
- }
545
- /**
546
- * Returns the object as a RGBA object.
547
- */
548
- toPercentageRgb() {
549
- const e = (t) => `${Math.round(w(t, 255) * 100)}%`;
550
- return {
551
- r: e(this.r),
552
- g: e(this.g),
553
- b: e(this.b),
554
- a: this.a
555
- };
556
- }
557
- /**
558
- * Returns the RGBA relative values interpolated into a string
559
- */
560
- toPercentageRgbString() {
561
- const e = (t) => Math.round(w(t, 255) * 100);
562
- return this.a === 1 ? `rgb(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%)` : `rgba(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%, ${this.roundA})`;
563
- }
564
- toCmyk() {
565
- return {
566
- ...ct(this.r, this.g, this.b)
567
- };
568
- }
569
- toCmykString() {
570
- const { c: e, m: t, y: n, k: s } = ct(this.r, this.g, this.b);
571
- return `cmyk(${e}, ${t}, ${n}, ${s})`;
572
- }
573
- /**
574
- * The 'real' name of the color -if there is one.
575
- */
576
- toName() {
577
- if (this.a === 0)
578
- return "transparent";
579
- if (this.a < 1)
580
- return !1;
581
- const e = `#${at(this.r, this.g, this.b, !1)}`;
582
- for (const [t, n] of Object.entries(tt))
583
- if (e === n)
584
- return t;
585
- return !1;
586
- }
587
- toString(e) {
588
- const t = !!e;
589
- e = e ?? this.format;
590
- let n = !1;
591
- const s = this.a < 1 && this.a >= 0;
592
- return !t && s && (e.startsWith("hex") || e === "name") ? e === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (e === "rgb" && (n = this.toRgbString()), e === "prgb" && (n = this.toPercentageRgbString()), (e === "hex" || e === "hex6") && (n = this.toHexString()), e === "hex3" && (n = this.toHexString(!0)), e === "hex4" && (n = this.toHex8String(!0)), e === "hex8" && (n = this.toHex8String()), e === "name" && (n = this.toName()), e === "hsl" && (n = this.toHslString()), e === "hsv" && (n = this.toHsvString()), e === "cmyk" && (n = this.toCmykString()), n || this.toHexString());
593
- }
594
- toNumber() {
595
- return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
596
- }
597
- clone() {
598
- return new C(this.toString());
599
- }
600
- /**
601
- * Lighten the color a given amount. Providing 100 will always return white.
602
- * @param amount - valid between 1-100
603
- */
604
- lighten(e = 10) {
605
- const t = this.toHsl();
606
- return t.l += e / 100, t.l = U(t.l), new C(t);
607
- }
608
- /**
609
- * Brighten the color a given amount, from 0 to 100.
610
- * @param amount - valid between 1-100
611
- */
612
- brighten(e = 10) {
613
- const t = this.toRgb();
614
- return t.r = Math.max(
615
- 0,
616
- Math.min(255, t.r - Math.round(255 * -(e / 100)))
617
- ), t.g = Math.max(
618
- 0,
619
- Math.min(255, t.g - Math.round(255 * -(e / 100)))
620
- ), t.b = Math.max(
621
- 0,
622
- Math.min(255, t.b - Math.round(255 * -(e / 100)))
623
- ), new C(t);
624
- }
625
- /**
626
- * Darken the color a given amount, from 0 to 100.
627
- * Providing 100 will always return black.
628
- * @param amount - valid between 1-100
629
- */
630
- darken(e = 10) {
631
- const t = this.toHsl();
632
- return t.l -= e / 100, t.l = U(t.l), new C(t);
633
- }
634
- /**
635
- * Mix the color with pure white, from 0 to 100.
636
- * Providing 0 will do nothing, providing 100 will always return white.
637
- * @param amount - valid between 1-100
638
- */
639
- tint(e = 10) {
640
- return this.mix("white", e);
641
- }
642
- /**
643
- * Mix the color with pure black, from 0 to 100.
644
- * Providing 0 will do nothing, providing 100 will always return black.
645
- * @param amount - valid between 1-100
646
- */
647
- shade(e = 10) {
648
- return this.mix("black", e);
649
- }
650
- /**
651
- * Desaturate the color a given amount, from 0 to 100.
652
- * Providing 100 will is the same as calling greyscale
653
- * @param amount - valid between 1-100
654
- */
655
- desaturate(e = 10) {
656
- const t = this.toHsl();
657
- return t.s -= e / 100, t.s = U(t.s), new C(t);
658
- }
659
- /**
660
- * Saturate the color a given amount, from 0 to 100.
661
- * @param amount - valid between 1-100
662
- */
663
- saturate(e = 10) {
664
- const t = this.toHsl();
665
- return t.s += e / 100, t.s = U(t.s), new C(t);
666
- }
667
- /**
668
- * Completely desaturates a color into greyscale.
669
- * Same as calling `desaturate(100)`
670
- */
671
- greyscale() {
672
- return this.desaturate(100);
673
- }
674
- /**
675
- * Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
676
- * Values outside of this range will be wrapped into this range.
677
- */
678
- spin(e) {
679
- const t = this.toHsl(), n = (t.h + e) % 360;
680
- return t.h = n < 0 ? 360 + n : n, new C(t);
681
- }
682
- /**
683
- * Mix the current color a given amount with another color, from 0 to 100.
684
- * 0 means no mixing (return current color).
685
- */
686
- mix(e, t = 50) {
687
- const n = this.toRgb(), s = new C(e).toRgb(), i = t / 100, o = {
688
- r: (s.r - n.r) * i + n.r,
689
- g: (s.g - n.g) * i + n.g,
690
- b: (s.b - n.b) * i + n.b,
691
- a: (s.a - n.a) * i + n.a
692
- };
693
- return new C(o);
694
- }
695
- analogous(e = 6, t = 30) {
696
- const n = this.toHsl(), s = 360 / t, i = [this];
697
- for (n.h = (n.h - (s * e >> 1) + 720) % 360; --e; )
698
- n.h = (n.h + s) % 360, i.push(new C(n));
699
- return i;
700
- }
701
- /**
702
- * taken from https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js
703
- */
704
- complement() {
705
- const e = this.toHsl();
706
- return e.h = (e.h + 180) % 360, new C(e);
707
- }
708
- monochromatic(e = 6) {
709
- const t = this.toHsv(), { h: n } = t, { s } = t;
710
- let { v: i } = t;
711
- const o = [], a = 1 / e;
712
- for (; e--; )
713
- o.push(new C({ h: n, s, v: i })), i = (i + a) % 1;
714
- return o;
715
- }
716
- splitcomplement() {
717
- const e = this.toHsl(), { h: t } = e;
718
- return [
719
- this,
720
- new C({ h: (t + 72) % 360, s: e.s, l: e.l }),
721
- new C({ h: (t + 216) % 360, s: e.s, l: e.l })
722
- ];
723
- }
724
- /**
725
- * Compute how the color would appear on a background
726
- */
727
- onBackground(e) {
728
- const t = this.toRgb(), n = new C(e).toRgb(), s = t.a + n.a * (1 - t.a);
729
- return new C({
730
- r: (t.r * t.a + n.r * n.a * (1 - t.a)) / s,
731
- g: (t.g * t.a + n.g * n.a * (1 - t.a)) / s,
732
- b: (t.b * t.a + n.b * n.a * (1 - t.a)) / s,
733
- a: s
734
- });
735
- }
736
- /**
737
- * Alias for `polyad(3)`
738
- */
739
- triad() {
740
- return this.polyad(3);
741
- }
742
- /**
743
- * Alias for `polyad(4)`
744
- */
745
- tetrad() {
746
- return this.polyad(4);
747
- }
748
- /**
749
- * Get polyad colors, like (for 1, 2, 3, 4, 5, 6, 7, 8, etc...)
750
- * monad, dyad, triad, tetrad, pentad, hexad, heptad, octad, etc...
751
- */
752
- polyad(e) {
753
- const t = this.toHsl(), { h: n } = t, s = [this], i = 360 / e;
754
- for (let o = 1; o < e; o++)
755
- s.push(
756
- new C({ h: (n + o * i) % 360, s: t.s, l: t.l })
757
- );
758
- return s;
759
- }
760
- /**
761
- * compare color vs current color
762
- */
763
- equals(e) {
764
- const t = new C(e);
765
- return this.format === "cmyk" || t.format === "cmyk" ? this.toCmykString() === t.toCmykString() : this.toRgbString() === t.toRgbString();
766
- }
767
- }
768
- function fe(r, e) {
769
- const {
770
- getPrefixCls: t,
771
- locale: n,
772
- componentConfig: s
773
- } = nt(q), i = Ct(
774
- r,
775
- {},
776
- s == null ? void 0 : s.Empty
777
- ), { style: o, className: a, description: f, icon: l, imgSrc: c, ...u } = i, m = t("empty"), b = j(m, a), p = n.Empty.noData, h = typeof f == "string" ? f : "empty";
778
- return /* @__PURE__ */ d("div", { ref: e, className: b, style: o, ...u, children: /* @__PURE__ */ V("div", { className: `${m}-wrapper`, children: [
779
- /* @__PURE__ */ d("div", { className: `${m}-image`, children: c ? /* @__PURE__ */ d("img", { alt: h, src: c }) : l || /* @__PURE__ */ d(Gt, {}) }),
780
- /* @__PURE__ */ d("div", { className: `${m}-description`, children: f || p })
781
- ] }) });
782
- }
783
- const St = bt(fe);
784
- St.displayName = "Empty";
785
- const de = G.memo(St);
786
- function ue(r) {
787
- switch (r) {
788
- default:
789
- return /* @__PURE__ */ d(de, {});
790
- }
791
- }
792
- const Rt = {
793
- locale: Jt,
794
- prefixCls: "pqb",
795
- getPopupContainer: () => document.body,
796
- size: "default",
797
- renderEmpty: ue
798
- }, q = qt({
799
- getPrefixCls: (r, e) => `${e || "pqb"}-${r}`,
800
- ...Rt
801
- });
802
- function ge(r, e) {
803
- const {
804
- children: t,
805
- className: n,
806
- disabled: s,
807
- prefix: i,
808
- size: o = "default",
809
- ...a
810
- } = r, { getPrefixCls: f } = nt(q), l = f("icon-hover"), c = st();
811
- return xt(e, () => ({
812
- getRootDOMNode: () => c.current
813
- })), /* @__PURE__ */ d(
814
- "span",
815
- {
816
- ref: c,
817
- className: j(
818
- l,
819
- {
820
- [`${i}-icon-hover`]: i,
821
- [`${l}-size-${o}`]: o && o !== "default",
822
- [`${l}-disabled`]: s
823
- },
824
- n
825
- ),
826
- onClick: r.onClick,
827
- ...a,
828
- children: t
829
- }
830
- );
831
- }
832
- const ht = G.forwardRef(ge);
833
- class J extends Ot {
834
- constructor(t) {
835
- super(t);
836
- g(this, "context");
837
- g(this, "wrapper");
838
- g(this, "timer");
839
- g(this, "rootDOMRef");
840
- g(this, "getRootDOMNode", () => this.rootDOMRef.current);
841
- g(this, "startTimer", () => {
842
- const { duration: t, onClose: n, id: s } = this.props;
843
- t !== 0 && (this.timer = window.setTimeout(() => {
844
- n == null || n(s), this.removeTimer();
845
- }, t));
846
- });
847
- g(this, "removeTimer", () => {
848
- this.timer && (window.clearTimeout(this.timer), this.timer = null);
849
- });
850
- g(this, "onClose", () => {
851
- var t, n;
852
- (n = (t = this.props).onClose) == null || n.call(t, this.props.id);
853
- });
854
- g(this, "renderIcon", () => {
855
- const { showIcon: t, icon: n, type: s, prefixCls: i, iconPrefix: o } = this.props;
856
- let a;
857
- if (n)
858
- a = n;
859
- else if (t) {
860
- switch (s) {
861
- case "info":
862
- a = /* @__PURE__ */ d(Bt, {});
863
- break;
864
- case "success":
865
- a = /* @__PURE__ */ d(Ut, {});
866
- break;
867
- case "error":
868
- a = /* @__PURE__ */ d(Wt, {});
869
- break;
870
- case "warning":
871
- a = /* @__PURE__ */ d(zt, {});
872
- break;
873
- case "loading":
874
- a = /* @__PURE__ */ d(Vt, {});
875
- break;
876
- }
877
- a = /* @__PURE__ */ d(
878
- _.Provider,
879
- {
880
- value: o ? { prefixCls: o } : {},
881
- children: a
882
- }
883
- );
884
- }
885
- return /* @__PURE__ */ d("span", { className: `${i}-icon`, children: a });
886
- });
887
- g(this, "onMouseEnter", () => {
888
- this.removeTimer();
889
- });
890
- g(this, "onMouseLeave", () => {
891
- this.removeTimer(), this.startTimer();
892
- });
893
- this.rootDOMRef = jt();
894
- }
895
- componentDidMount() {
896
- this.startTimer();
897
- }
898
- componentDidUpdate(t) {
899
- (t.duration !== this.props.duration || this.props.update) && (this.removeTimer(), this.startTimer());
900
- }
901
- componentWillUnmount() {
902
- this.removeTimer();
903
- }
904
- render() {
905
- const {
906
- title: t,
907
- content: n,
908
- showIcon: s,
909
- className: i,
910
- style: o,
911
- type: a,
912
- btn: f,
913
- icon: l,
914
- prefixCls: c,
915
- closable: u,
916
- noticeType: m,
917
- iconPrefix: b,
918
- rtl: p,
919
- closeIcon: h,
920
- classPrefixCls: x
921
- } = this.props, y = j(
922
- c,
923
- `${c}-${a}`,
924
- {
925
- [`${c}-closable`]: u,
926
- [`${c}-rtl`]: p
927
- },
928
- i
929
- );
930
- let $ = "closable" in this.props ? u : !0, v = s;
931
- a === "normal" && !l && (v = !1);
932
- const L = { ...this.context };
933
- if (x && (L.prefixCls = x), m === "message")
934
- return $ = u, /* @__PURE__ */ d(K, { ...L, children: /* @__PURE__ */ d(
935
- "div",
936
- {
937
- style: { textAlign: "center" },
938
- onMouseEnter: this.onMouseEnter,
939
- onMouseLeave: this.onMouseLeave,
940
- ref: this.rootDOMRef,
941
- children: /* @__PURE__ */ V("div", { className: y, style: o, role: "alert", children: [
942
- v && this.renderIcon(),
943
- /* @__PURE__ */ d("span", { className: `${c}-content`, children: n }),
944
- $ && (h !== void 0 ? /* @__PURE__ */ d(
945
- "span",
946
- {
947
- onClick: this.onClose,
948
- className: `${c}-close-btn`,
949
- children: h
950
- }
951
- ) : /* @__PURE__ */ d(
952
- ht,
953
- {
954
- prefix: c,
955
- className: `${c}-close-btn`,
956
- onClick: this.onClose,
957
- children: /* @__PURE__ */ d(it, {})
958
- }
959
- ))
960
- ] })
961
- }
962
- ) });
963
- if (m === "notification")
964
- return /* @__PURE__ */ d(K, { ...L, children: /* @__PURE__ */ d(
965
- "div",
966
- {
967
- ref: this.rootDOMRef,
968
- onMouseEnter: this.onMouseEnter,
969
- onMouseLeave: this.onMouseLeave,
970
- children: /* @__PURE__ */ V("div", { className: y, style: o, role: "alert", children: [
971
- v && /* @__PURE__ */ d("div", { className: `${c}-left`, children: this.renderIcon() }),
972
- /* @__PURE__ */ V("div", { className: `${c}-right`, children: [
973
- t && /* @__PURE__ */ d("div", { className: `${c}-title`, children: t }),
974
- /* @__PURE__ */ d("div", { className: `${c}-content`, children: n }),
975
- f && /* @__PURE__ */ d("div", { className: `${c}-btn-wrapper`, children: f })
976
- ] }),
977
- $ && (h !== void 0 ? /* @__PURE__ */ d(
978
- "span",
979
- {
980
- onClick: this.onClose,
981
- className: `${c}-close-btn`,
982
- children: h
983
- }
984
- ) : /* @__PURE__ */ d(
985
- ht,
986
- {
987
- prefix: c,
988
- className: `${c}-close-btn`,
989
- onClick: this.onClose,
990
- children: /* @__PURE__ */ d(
991
- _.Provider,
992
- {
993
- value: b ? { prefixCls: b } : {},
994
- children: /* @__PURE__ */ d(it, {})
995
- }
996
- )
997
- }
998
- ))
999
- ] })
1000
- }
1001
- ) });
1002
- }
1003
- }
1004
- g(J, "defaultProps", {
1005
- type: "info",
1006
- showIcon: !0,
1007
- noticeType: "message",
1008
- duration: 3e3
1009
- }), g(J, "contextType", q);
1010
- function me(r = {}) {
1011
- const { maxCount: e, duration: t = 3e3, prefixCls: n } = r, s = st(), i = /* @__PURE__ */ d(Ht, { ref: s }), o = {};
1012
- let a;
1013
- function f(c) {
1014
- let u, m;
1015
- if (s.current) {
1016
- const v = s.current.getContextConfig();
1017
- m = v.rtl, u = v.prefixCls;
1018
- }
1019
- const b = n || u, p = {
1020
- position: "top",
1021
- duration: t,
1022
- ...c
1023
- }, { position: h, transitionClassNames: x } = p;
1024
- let y;
1025
- if (o[h]) {
1026
- const v = o[h].state.notices;
1027
- v.length >= e ? (y = v[0].id, v.shift(), o[h].add({ ...p, id: y })) : y = o[h].add(p);
1028
- } else
1029
- a = /* @__PURE__ */ d(
1030
- M,
1031
- {
1032
- transitionClassNames: x,
1033
- ref: (v) => {
1034
- o[h] = v, o[h] && (y = o[h].add(p));
1035
- },
1036
- prefixCls: b,
1037
- rtl: m
1038
- }
1039
- ), s.current.addInstance(a);
1040
- return () => {
1041
- o[h] && o[h].remove(y);
1042
- };
1043
- }
1044
- const l = {};
1045
- return ["info", "success", "warning", "error", "normal"].forEach((c) => {
1046
- l[c] = (u) => {
1047
- const m = Kt(u) ? { content: u } : u;
1048
- return f({
1049
- ...m,
1050
- type: c
1051
- });
1052
- };
1053
- }), [l, i];
1054
- }
1055
- const pe = [
1056
- "info",
1057
- "success",
1058
- "error",
1059
- "warning",
1060
- "loading",
1061
- "normal"
1062
- ];
1063
- let A = {}, Nt, ft, Et, et, dt, ut;
1064
- function At(r) {
1065
- const e = {
1066
- position: "top",
1067
- duration: Et,
1068
- ...r
1069
- }, { position: t, transitionClassNames: n, transitionTimeout: s } = e;
1070
- let i;
1071
- const { instance: o, pending: a } = A[t] || {};
1072
- if (o || a) {
1073
- const l = () => {
1074
- const { instance: c } = A[t] || {}, u = c.state.notices, m = u.find((p) => p.id === r.id), b = {
1075
- ...e,
1076
- update: m
1077
- };
1078
- u.length >= Nt ? m ? c.add({
1079
- ...b,
1080
- id: m.id
1081
- }) : (u.shift(), c.add(b)) : i = c.add(b);
1082
- };
1083
- o ? l() : a != null && a.then && a.then(() => {
1084
- l(), A[t].pending = null;
1085
- });
1086
- } else {
1087
- const l = document.createElement("div");
1088
- (et || document.body).appendChild(l), A[t] = {}, A[t].pending = new Promise((c) => {
1089
- $t(
1090
- /* @__PURE__ */ d(
1091
- M,
1092
- {
1093
- transitionClassNames: n,
1094
- transitionTimeout: s,
1095
- ref: (u) => {
1096
- A[t] || (A[t] = {}), A[t].instance = u, i = u.add(e), c(null);
1097
- }
1098
- }
1099
- ),
1100
- l
1101
- );
1102
- });
1103
- }
1104
- return () => {
1105
- var l, c;
1106
- (c = (l = A[t]) == null ? void 0 : l.instance) == null || c.remove(i);
1107
- };
1108
- }
1109
- class M extends wt {
1110
- constructor() {
1111
- super(...arguments);
1112
- g(this, "remove", (t) => {
1113
- const n = this.state.notices.find((s) => s.id === t);
1114
- n && this.update({
1115
- ...n,
1116
- style: { ...n.style, opacity: 0 }
1117
- }), setTimeout(() => {
1118
- super.remove(t);
1119
- }, 100);
1120
- });
1121
- }
1122
- render() {
1123
- const {
1124
- transitionClassNames: t,
1125
- transitionTimeout: n,
1126
- prefixCls: s,
1127
- rtl: i,
1128
- closable: o
1129
- } = this.props, { notices: a, position: f } = this.state, l = s || ft, c = F(i) ? dt : i, u = F(o) ? ut : o, m = l ? `${l}-message` : "pqb-message", b = {
1130
- enter: O(n == null ? void 0 : n.enter) ? n == null ? void 0 : n.enter : 100,
1131
- exit: O(n == null ? void 0 : n.exit) ? n == null ? void 0 : n.exit : 300
1132
- }, p = j(
1133
- `${m}-wrapper`,
1134
- `${m}-wrapper-${f}`
1135
- );
1136
- return /* @__PURE__ */ d("div", { className: p, children: /* @__PURE__ */ d(yt, { component: null, children: a.map((h) => /* @__PURE__ */ d(
1137
- vt,
1138
- {
1139
- timeout: b,
1140
- classNames: t || "fadeMessage",
1141
- onExit: (x) => {
1142
- x && (x.style.height = `${x.scrollHeight}px`);
1143
- },
1144
- onExiting: (x) => {
1145
- x && (x.style.height = 0);
1146
- },
1147
- onExited: (x) => {
1148
- var y;
1149
- x && (x.style.height = 0, (y = h.onClose) == null || y.call(h));
1150
- },
1151
- children: /* @__PURE__ */ d(
1152
- J,
1153
- {
1154
- ...h,
1155
- prefixCls: m,
1156
- classPrefixCls: l,
1157
- iconPrefix: l,
1158
- onClose: this.remove,
1159
- noticeType: "message",
1160
- rtl: c,
1161
- ...F(u) ? {} : { closable: u }
1162
- }
1163
- )
1164
- },
1165
- h.id
1166
- )) }) });
1167
- }
1168
- }
1169
- g(M, "useMessage"), g(M, "success"), g(M, "info"), g(M, "warning"), g(M, "error"), g(M, "loading"), g(M, "normal"), g(M, "config", (t = {}) => {
1170
- var n;
1171
- O(t.maxCount) && (Nt = t.maxCount), t.prefixCls && (ft = t.prefixCls), O(t.duration) && (Et = t.duration), typeof t.rtl == "boolean" && (dt = t.rtl), typeof t.closable == "boolean" && (ut = t.closable), ((n = t.getContainer) == null ? void 0 : n.call(t)) !== et && (et = t.getContainer(), Object.values(A).forEach(
1172
- ({ instance: s }) => s == null ? void 0 : s.clear()
1173
- ), A = {});
1174
- }), g(M, "clear", () => {
1175
- Object.values(A).forEach(({ instance: t }) => {
1176
- t == null || t.clear();
1177
- });
1178
- }), g(M, "addInstance", At);
1179
- pe.forEach((r) => {
1180
- M[r] = (e) => At({
1181
- ...typeof e == "string" ? { content: e } : e,
1182
- type: r
1183
- });
1184
- });
1185
- M.useMessage = me;
1186
- let Pt = {};
1187
- function be(r) {
1188
- Pt = {
1189
- ...r
1190
- };
1191
- }
1192
- function Je() {
1193
- return Pt;
1194
- }
1195
- let rt = {
1196
- simple: !0
1197
- };
1198
- const Ke = (r) => {
1199
- rt = {
1200
- ...rt,
1201
- ...r
1202
- };
1203
- }, Qe = () => rt, Xe = [], Ye = [];
1204
- function xe(r = {}) {
1205
- const {
1206
- maxCount: e,
1207
- duration: t = 3e3,
1208
- prefixCls: n,
1209
- getContainer: s
1210
- } = r, i = st(), o = /* @__PURE__ */ d(Ht, { ref: i }), a = {};
1211
- let f;
1212
- function l(u) {
1213
- let m, b;
1214
- if (i.current) {
1215
- const $ = i.current.getContextConfig();
1216
- b = $.rtl, m = $.prefixCls;
1217
- }
1218
- const p = n || m;
1219
- let h = u.position;
1220
- F(u.position) && (h = b ? "topLeft" : "topRight");
1221
- const x = {
1222
- duration: t,
1223
- ...u
1224
- };
1225
- let y;
1226
- if (a[h]) {
1227
- const $ = a[h].state.notices;
1228
- $.length >= e ? (y = $[0].id, $.shift(), a[h].add({ ...x, id: y })) : y = a[h].add(x);
1229
- } else
1230
- f = /* @__PURE__ */ d(
1231
- T,
1232
- {
1233
- ref: ($) => {
1234
- a[h] = $, a[h] && (y = a[h].add(x));
1235
- },
1236
- prefixCls: p,
1237
- rtl: b,
1238
- getContainer: s
1239
- }
1240
- ), i.current.addInstance(f);
1241
- return a[h];
1242
- }
1243
- const c = {};
1244
- return ["info", "success", "warning", "error", "normal"].forEach((u) => {
1245
- c[u] = (m) => l({
1246
- ...m,
1247
- type: u
1248
- });
1249
- }), [c, o];
1250
- }
1251
- const Ce = ["info", "success", "error", "warning", "normal"];
1252
- let S = {}, gt, mt, pt, Z, B;
1253
- const N = class N extends wt {
1254
- constructor() {
1255
- super(...arguments);
1256
- g(this, "remove", (t) => {
1257
- const n = this.state.notices.find((s) => s.id === t);
1258
- n && this.update({
1259
- ...n,
1260
- style: { ...n.style, opacity: 0 }
1261
- }), setTimeout(() => {
1262
- super.remove(t);
1263
- }, 200);
1264
- });
1265
- }
1266
- render() {
1267
- const { notices: t } = this.state, { prefixCls: n, rtl: s, getContainer: i } = this.props;
1268
- let o = this.state.position;
1269
- const a = F(s) ? B : s;
1270
- F(o) && (o = a ? "topLeft" : "topRight");
1271
- const f = n || mt, l = f ? `${f}-notification` : "pqb-notification";
1272
- let c;
1273
- o === "topLeft" || o === "bottomLeft" ? c = "slideNoticeLeft" : c = "slideNoticeRight";
1274
- const u = j(
1275
- `${l}-wrapper`,
1276
- `${l}-wrapper-${o}`,
1277
- { [`${l}-wrapper-rtl`]: B }
1278
- ), m = i == null ? void 0 : i(), b = /* @__PURE__ */ d("div", { className: u, children: /* @__PURE__ */ d(yt, { component: null, children: t.map((p) => /* @__PURE__ */ d(
1279
- vt,
1280
- {
1281
- timeout: {
1282
- enter: 400,
1283
- exit: 300
1284
- },
1285
- classNames: c,
1286
- onExit: (h) => {
1287
- h && (h.style.height = `${h.scrollHeight}px`);
1288
- },
1289
- onExiting: (h) => {
1290
- h && (h.style.height = 0);
1291
- },
1292
- onExited: (h) => {
1293
- var x;
1294
- h && (h.style.height = 0, (x = p.onClose) == null || x.call(p));
1295
- },
1296
- children: /* @__PURE__ */ d(
1297
- J,
1298
- {
1299
- ...p,
1300
- onClose: this.remove,
1301
- prefixCls: l,
1302
- iconPrefix: f,
1303
- classPrefixCls: f,
1304
- noticeType: "notification",
1305
- rtl: a
1306
- }
1307
- )
1308
- },
1309
- p.id
1310
- )) }) });
1311
- return m ? Qt(b, m) : b;
1312
- }
1313
- };
1314
- g(N, "useNotification"), g(N, "success"), g(N, "info"), g(N, "warning"), g(N, "error"), g(N, "normal"), g(N, "config", (t = {}) => {
1315
- var n;
1316
- O(t.maxCount) && (gt = t.maxCount), t.prefixCls && (mt = t.prefixCls), O(t.duration) && (pt = t.duration), typeof t.rtl == "boolean" && (B = t.rtl), t.getContainer && ((n = t.getContainer) == null ? void 0 : n.call(t)) !== Z && (Z = t.getContainer(), Object.values(S).forEach(
1317
- ({ instance: s }) => s == null ? void 0 : s.clear()
1318
- ), S = {});
1319
- }), g(N, "clear", () => {
1320
- Object.values(S).forEach(({ instance: t }) => {
1321
- t == null || t.clear();
1322
- });
1323
- }), g(N, "remove", (t) => {
1324
- Object.values(S).forEach(({ instance: n }) => {
1325
- n == null || n.remove(t);
1326
- });
1327
- }), g(N, "addInstance", (t) => {
1328
- let n = t.position;
1329
- F(t.position) && (n = B ? "topLeft" : "topRight");
1330
- const s = {
1331
- duration: pt,
1332
- ...t
1333
- }, { instance: i, pending: o } = S[n] || {};
1334
- if (i || o) {
1335
- const f = () => {
1336
- const { instance: l } = S[n] || {}, c = l.state.notices, u = c.find((b) => b.id === t.id), m = {
1337
- ...s,
1338
- update: u
1339
- };
1340
- return c.length >= gt ? u ? l.add({
1341
- ...m,
1342
- id: u.id
1343
- }) : (c.shift(), l.add(m)) : l.add({ ...m }), l;
1344
- };
1345
- return i ? f() : o != null && o.then && o.then(() => {
1346
- f(), S[n].pending = null;
1347
- }), i;
1348
- }
1349
- const a = document.createElement("div");
1350
- return (Z || document.body).appendChild(a), S[n] = {}, S[n].pending = new Promise((f) => {
1351
- $t(
1352
- /* @__PURE__ */ d(
1353
- N,
1354
- {
1355
- ref: (l) => (S[n] || (S[n] = {}), S[n].instance = l, l.add(s), f(null), l)
1356
- }
1357
- ),
1358
- a
1359
- );
1360
- }), S[n].instance;
1361
- });
1362
- let T = N;
1363
- Ce.forEach((r) => {
1364
- T[r] = (e) => T.addInstance({
1365
- ...e,
1366
- type: r
1367
- });
1368
- });
1369
- T.useNotification = xe;
1370
- const ye = {
1371
- primaryColor: {
1372
- default: "--pqbblue-6",
1373
- hover: "--pqbblue-5",
1374
- active: "--pqbblue-7"
1375
- },
1376
- successColor: {
1377
- default: "--green-6",
1378
- hover: "--green-5",
1379
- active: "--green-7"
1380
- },
1381
- infoColor: {
1382
- default: "--pqbblue-6",
1383
- hover: "--pqbblue-5",
1384
- active: "--pqbblue-7"
1385
- },
1386
- warningColor: {
1387
- default: "--orangered-6",
1388
- hover: "--orangered-5",
1389
- active: "--orangered-7"
1390
- },
1391
- dangerColor: {
1392
- default: "--red-6",
1393
- hover: "--red-5",
1394
- active: "--red-7"
1395
- }
1396
- }, ve = Rt, we = {};
1397
- function K(r) {
1398
- const e = Ct(
1399
- r,
1400
- ve,
1401
- we
1402
- ), {
1403
- theme: t,
1404
- themeMode: n,
1405
- prefixCls: s,
1406
- children: i,
1407
- locale: o,
1408
- rtl: a,
1409
- effectGlobalNotice: f = !0,
1410
- effectGlobalModal: l = !0
1411
- } = e, c = window.document.body;
1412
- D(() => {
1413
- t && Dt(t) && Object.entries(ye).forEach(([p, h], x, y) => {
1414
- const $ = t[p];
1415
- if (!$) return;
1416
- const v = new C($);
1417
- c.style.setProperty(h.default, v.lighten(0).toRgbArrayString()), t[`${p}Hover`] || c.style.setProperty(h.hover, v.lighten(10).toRgbArrayString()), t[`${p}Active`] || c.style.setProperty(h.active, v.lighten(-10).toRgbArrayString());
1418
- });
1419
- }, [t]), D(() => {
1420
- const p = ["pqb-theme"];
1421
- return n ? p.forEach((h) => {
1422
- c.setAttribute(h, n);
1423
- }) : p.forEach((h) => {
1424
- c.removeAttribute(h);
1425
- }), () => {
1426
- };
1427
- }, [n]), D(() => {
1428
- f && (M.config({ prefixCls: s, rtl: a }), T.config({ prefixCls: s, rtl: a }));
1429
- }, [s, a, f]);
1430
- function u(p, h) {
1431
- return `${h || s}-${p}`;
1432
- }
1433
- const m = {
1434
- ...Xt(e, ["children"]),
1435
- getPrefixCls: u
1436
- };
1437
- D(() => {
1438
- l && be({ locale: o, prefixCls: s, rtl: a });
1439
- }, [o, s, a, l]);
1440
- let b = i;
1441
- return s && s !== "pqb" && (b = /* @__PURE__ */ d(_.Provider, { value: { prefixCls: s }, children: i })), /* @__PURE__ */ d(q.Provider, { value: m, children: b });
1442
- }
1443
- K.ConfigContext = q;
1444
- K.displayName = "ConfigProvider";
1445
- const Ze = q.Consumer;
1446
- function It(r, e) {
1447
- const t = nt(q), [n, s] = Lt([]);
1448
- function i(f) {
1449
- s((l) => [...l, f]);
1450
- }
1451
- function o(f) {
1452
- s(
1453
- (l) => l.filter((c) => f !== c)
1454
- );
1455
- }
1456
- function a() {
1457
- return t;
1458
- }
1459
- return xt(e, () => ({
1460
- addInstance: i,
1461
- removeInstance: o,
1462
- getContextConfig: a
1463
- })), G.Children.map(
1464
- n,
1465
- (f, l) => G.cloneElement(f, { key: l })
1466
- );
1467
- }
1468
- It.displayName = "ContextHolderElement";
1469
- const Ht = bt(It);
1470
- export {
1471
- ot as $,
1472
- Ht as C,
1473
- de as E,
1474
- lt as F,
1475
- ne as G,
1476
- at as H,
1477
- ht as I,
1478
- Ge as J,
1479
- M,
1480
- kt as N,
1481
- ee as O,
1482
- se as T,
1483
- oe as U,
1484
- re as W,
1485
- K as a,
1486
- Ze as b,
1487
- ye as c,
1488
- q as d,
1489
- R as e,
1490
- C as f,
1491
- T as g,
1492
- xe as h,
1493
- Xe as i,
1494
- Je as j,
1495
- Qe as k,
1496
- Ye as l,
1497
- J as m,
1498
- Ke as s,
1499
- me as u,
1500
- X as y
1501
- };