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