@unicom-cloud/ui 0.8.44 → 0.8.46
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 +54 -51
- package/Alert.js +46 -43
- package/Anchor.js +5 -4
- package/AutoComplete.js +60 -55
- package/Avatar.js +10 -155
- package/BackTop.js +41 -38
- package/Badge.js +63 -93
- package/Breadcrumb.js +63 -118
- package/Button.js +105 -109
- package/Calendar.js +139 -536
- package/Card.js +65 -101
- package/Carousel.js +169 -270
- package/Cascader.js +9 -8
- package/Checkbox.js +4 -3
- package/Collapse.js +4 -3
- package/ColorPicker.js +95 -546
- package/Comment.js +14 -12
- package/ConfigProvider.js +6 -5
- package/Copy.js +33 -31
- package/DatePicker.js +35 -1993
- package/Descriptions.js +30 -28
- package/Divider.js +8 -6
- package/Draggable.js +28 -85
- package/Drawer.js +5 -4
- package/Dropdown.js +107 -167
- package/Empty.js +28 -8
- package/Form.js +30 -1418
- package/Grid.js +13 -250
- package/Icon.js +19 -45
- package/IconHover.js +39 -6
- package/Image.js +3 -3
- package/Input.js +4 -4
- package/InputNumber.js +213 -17
- package/InputTag.js +5 -4
- package/Layout.js +35 -48
- package/Link.js +16 -14
- package/List.js +191 -228
- package/Loading.js +18 -17
- package/Mentions.js +99 -115
- package/Menu.js +8 -7
- package/Message.js +147 -10
- package/Modal.js +5 -4
- package/Notice.js +196 -13
- package/Notification.js +136 -11
- package/NotificationBase.js +5 -4
- package/OverflowEllipsis.js +48 -71
- package/PageHeader.js +52 -52
- package/Pagination.js +12 -11
- package/Picker.js +6 -4
- package/Popconfirm.js +47 -44
- package/Popover.js +25 -23
- package/Portal.js +12 -32
- package/Progress.js +65 -328
- package/Radio.js +6 -5
- package/Rate.js +48 -45
- package/ResizeBox.js +127 -505
- package/Result.js +60 -1417
- package/Select.js +9 -8
- package/SelectView.js +49 -328
- package/Skeleton.js +41 -78
- package/Slider.js +228 -702
- package/Space.js +53 -57
- package/Spin.js +57 -72
- package/Statistic.js +84 -153
- package/Steps.js +64 -123
- package/SuspenseFallbackTest.js +4 -3
- package/Switch.js +41 -38
- package/Table.js +20 -1999
- package/Tabs.js +9 -8
- package/Tag.js +24 -21
- package/TimePicker.js +19 -272
- package/Timeline.js +4 -3
- package/Tooltip.js +79 -72
- package/Transfer.js +138 -402
- package/Tree.js +5 -4
- package/TreeSelect.js +8 -7
- package/Trigger.js +407 -571
- package/Typography.js +11 -722
- package/Upload.js +9 -8
- package/VerificationCode.js +6 -5
- package/Version.js +1 -1
- package/VirtualList.js +4 -3
- package/Watermark.js +3 -2
- package/anchor/Anchor.js +193 -0
- package/anchor/Link.js +54 -0
- package/anchor/context.js +14 -0
- package/anchor/util.js +41 -0
- package/avatar/Avatar.js +85 -0
- package/avatar/Group.js +84 -0
- package/avatar/context.js +5 -0
- package/badge/Count.js +35 -0
- package/breadcrumb/Item.js +67 -0
- package/button/Group.js +15 -0
- package/calendar/Month.js +142 -0
- package/calendar/WeekList.js +24 -0
- package/calendar/Year.js +75 -0
- package/calendar/header/Panel.js +57 -0
- package/calendar/header/index.js +118 -0
- package/calendar/hook/useCellClassName.js +41 -0
- package/card/Grid.js +27 -0
- package/card/Meta.js +32 -0
- package/carousel/Arrow.js +57 -0
- package/carousel/Indicator.js +68 -0
- package/cascader/Cascader.js +300 -0
- package/cascader/base/node.js +142 -0
- package/cascader/base/store.js +93 -0
- package/cascader/hook/useRefCurrent.js +12 -0
- package/cascader/panel/List.js +275 -0
- package/cascader/panel/Option.js +35 -0
- package/cascader/panel/Search.js +171 -0
- package/cascader/util.js +66 -0
- package/checkbox/Checkbox.js +111 -0
- package/checkbox/Group.js +97 -0
- package/checkbox/useCheckbox.js +45 -0
- package/collapse/Collapse.js +90 -0
- package/collapse/Item.js +165 -0
- package/color-picker/ControlBar.js +64 -0
- package/color-picker/InputAlpha.js +24 -0
- package/color-picker/InputHex.js +59 -0
- package/color-picker/InputRgb.js +66 -0
- package/color-picker/Palette.js +36 -0
- package/color-picker/Panel.js +165 -0
- package/color-picker/colors.js +37 -0
- package/color-picker/hooks/useColorPicker.js +63 -0
- package/color-picker/hooks/useControlBlock.js +40 -0
- package/config-provider/ConfigProvider.js +94 -0
- package/config-provider/context.js +24 -0
- package/date-picker/Picker.js +399 -0
- package/date-picker/PickerRange.js +568 -0
- package/date-picker/context.js +5 -0
- package/date-picker/hook/useCellClassName.js +58 -0
- package/date-picker/panel/Body.js +78 -0
- package/date-picker/panel/Footer.js +71 -0
- package/date-picker/panel/Header.js +74 -0
- package/date-picker/panel/Shortcut.js +45 -0
- package/date-picker/panel/WeekList.js +19 -0
- package/date-picker/panel/date/index.js +194 -0
- package/date-picker/panel/month/index.js +113 -0
- package/date-picker/panel/quarter/index.js +93 -0
- package/date-picker/panel/range/index.js +251 -0
- package/date-picker/panel/week/index.js +35 -0
- package/date-picker/panel/year/index.js +74 -0
- package/date-picker/util.js +69 -0
- package/draggable/Item.js +66 -0
- package/drawer/Drawer.js +226 -0
- package/dropdown/Button.js +91 -0
- package/form/Control.js +264 -0
- package/form/Form.js +156 -0
- package/form/FormItem.js +241 -0
- package/form/FormLabel.js +54 -0
- package/form/FormList.js +96 -0
- package/form/FormProvider.js +48 -0
- package/form/IconSymbol.js +20 -0
- package/form/context.js +43 -0
- package/form/hook/useContext.js +32 -0
- package/form/hook/useState.js +31 -0
- package/form/hook/useWatch.js +36 -0
- package/form/interface.js +11 -0
- package/form/promisify.js +23 -0
- package/form/store.js +354 -0
- package/form/useForm.js +53 -0
- package/form/util.js +72 -0
- package/grid/Col.js +87 -0
- package/grid/Row.js +88 -0
- package/grid/context.js +9 -0
- package/grid/grid-item.js +77 -0
- package/grid/grid.js +104 -0
- package/grid/hook/useResponsiveState.js +38 -0
- package/grid/util.js +51 -0
- package/{chunk/I4RV9SKZ.js → hooks/factory/createHTMLMediaHook.js} +35 -43
- package/hooks/index.js +246 -4
- package/{chunk/BdYAMaw9.js → hooks/misc/hookState.js} +1 -1
- package/hooks/misc/parseTimeRanges.js +12 -0
- package/{chunk/TXCrI0jN.js → hooks/misc/util.js} +6 -6
- package/hooks/use-watermark/utils.js +8 -0
- package/hooks/use-watermark.js +71 -76
- package/hooks/useAudio.js +3 -3
- package/hooks/useBeforeUnload.js +2 -2
- package/hooks/useClickAway.js +10 -10
- package/hooks/useCounter.js +1 -1
- package/hooks/useCreation.js +2 -4
- package/hooks/useDrop.js +12 -12
- package/hooks/useDropArea.js +5 -5
- package/hooks/useEvent.js +6 -6
- package/hooks/useEventListener.js +2 -4
- package/hooks/useFavicon.js +1 -2
- package/hooks/useFullscreen.js +11 -13
- package/hooks/useGetSet.js +5 -5
- package/hooks/useHash.js +6 -6
- package/hooks/useHover.js +6 -6
- package/hooks/useHoverDirty.js +7 -7
- package/hooks/useIdle.js +17 -17
- package/hooks/useIsomorphicLayoutEffect2.js +3 -3
- package/hooks/useKey.js +5 -5
- package/hooks/useList.js +1 -1
- package/hooks/useLocalStorage.js +2 -3
- package/hooks/useLocation.js +1 -1
- package/hooks/useLockBodyScroll.js +13 -14
- package/hooks/useLongPress.js +7 -7
- package/hooks/useMeasure.js +3 -3
- package/hooks/useMedia.js +4 -4
- package/hooks/useMediaDevices.js +10 -10
- package/hooks/useMotion.js +11 -11
- package/hooks/useMouse.js +9 -9
- package/hooks/useMouseWheel.js +7 -7
- package/hooks/useNetworkState.js +7 -7
- package/hooks/useOrientation.js +10 -11
- package/hooks/useOverrideRef.js +14 -0
- package/hooks/usePageLeave.js +4 -4
- package/hooks/usePermission.js +9 -9
- package/hooks/usePersistCallback.js +15 -0
- package/hooks/useScroll.js +6 -6
- package/hooks/useScrolling.js +7 -7
- package/hooks/useSearchParam.js +5 -5
- package/hooks/useSessionStorage.js +9 -9
- package/hooks/useSize.js +1 -1
- package/hooks/useSlider.js +6 -6
- package/hooks/useStartTyping.js +4 -4
- package/hooks/useStateList.js +4 -5
- package/hooks/useStateWithHistory.js +1 -1
- package/hooks/useTimeout.js +1 -2
- package/hooks/useVibrate.js +5 -5
- package/hooks/useVideo.js +3 -3
- package/hooks/useWindowScroll.js +13 -13
- package/hooks/useWindowSize.js +6 -6
- package/icon/addFromIconFontCn.js +33 -0
- package/image/Image.js +189 -0
- package/image/ImageFooter.js +45 -0
- package/image/ImagePreview.js +473 -0
- package/image/ImagePreviewArrow.js +40 -0
- package/image/ImagePreviewGroup.js +125 -0
- package/image/ImagePreviewToolbar.js +98 -0
- package/image/TriggerForToolbar.js +10 -0
- package/image/previewGroupContext.js +17 -0
- package/image/util/getFixTranslate.js +7 -0
- package/image/util/getScale.js +72 -0
- package/image/util/hook/useImageStatus.js +16 -0
- package/image/util/hook/useShowFooter.js +7 -0
- package/index.js +440 -398
- package/input/Group.js +20 -0
- package/input/Input.js +185 -0
- package/input/InputElement.js +233 -0
- package/input/Number.js +4 -0
- package/input/Password.js +72 -0
- package/input/Search.js +80 -0
- package/input/Tag.js +7 -0
- package/input/Textarea.js +168 -0
- package/input/autoSizeTextAreaHeight.js +65 -0
- package/input/useComposition.js +39 -0
- package/input-number/decimal.js +154 -0
- package/input-number/useSelectionRange.js +26 -0
- package/input-number/util.js +57 -0
- package/input-tag/InputTag.js +381 -0
- package/layout/Content.js +15 -0
- package/layout/Footer.js +15 -0
- package/layout/Header.js +15 -0
- package/{chunk/B9asjXwm.js → layout/Sider.js} +23 -22
- package/list/Item.js +46 -0
- package/list/Meta.js +21 -0
- package/loading/style/index.module.less.js +4 -0
- package/mentions/util.js +26 -0
- package/menu/Indent.js +17 -0
- package/menu/Item.js +125 -0
- package/menu/ItemGroup.js +39 -0
- package/menu/Menu.js +181 -0
- package/menu/OverflowWrap.js +85 -0
- package/menu/context.js +5 -0
- package/menu/sub-menu/Inline.js +111 -0
- package/menu/sub-menu/Pop.js +126 -0
- package/menu/sub-menu/index.js +17 -0
- package/menu/util.js +80 -0
- package/message/useMessage.js +53 -0
- package/modal/Confirm.js +98 -0
- package/modal/Modal.js +419 -0
- package/modal/config.js +25 -0
- package/modal/use-modal/Hook.js +55 -0
- package/modal/use-modal/index.js +68 -0
- package/notification/useNotification.js +55 -0
- package/overflow-ellipsis/OverflowItem.js +34 -0
- package/package.json +1 -1
- package/pagination/PageItem.js +121 -0
- package/pagination/PageJumper.js +64 -0
- package/pagination/PageOption.js +55 -0
- package/pagination/Pagination.js +245 -0
- package/picker/Input.js +124 -0
- package/picker/InputRange.js +155 -0
- package/portal/Portal.js +25 -0
- package/progress/CircleProgress.js +117 -0
- package/progress/LineProgess.js +103 -0
- package/progress/StepProgress.js +74 -0
- package/radio/Group.js +91 -0
- package/radio/Radio.js +90 -0
- package/resize-box/ResizeTrigger.js +78 -0
- package/resize-box/Split.js +132 -0
- package/resize-box/SplitGroup.js +204 -0
- package/result/403.js +695 -0
- package/result/404.js +513 -0
- package/result/500.js +166 -0
- package/select/OptGroup.js +20 -0
- package/select/Option.js +97 -0
- package/select/Select.js +544 -0
- package/select/util.js +140 -0
- package/select-view/Core.js +309 -0
- package/skeleton/Image.js +24 -0
- package/skeleton/Text.js +27 -0
- package/slider/Button.js +159 -0
- package/slider/Dot.js +43 -0
- package/slider/Input.js +75 -0
- package/slider/Mark.js +28 -0
- package/slider/Tick.js +44 -0
- package/slider/hook/useInterval.js +73 -0
- package/slider/hook/useLegalValue.js +70 -0
- package/slider/util.js +63 -0
- package/space/toArray.js +11 -0
- package/spin/DotLoading.js +26 -0
- package/statistic/Countdown.js +57 -0
- package/statistic/util.js +33 -0
- package/steps/Step.js +68 -0
- package/style.css +1 -1
- package/table/ColGroup.js +59 -0
- package/table/Table.js +634 -0
- package/table/constant.js +5 -0
- package/table/hook/useColumns.js +141 -0
- package/table/hook/useComponent.js +64 -0
- package/table/hook/useExpand.js +36 -0
- package/table/hook/useRowSelection.js +92 -0
- package/table/hook/useSorter.js +54 -0
- package/table/hook/useStickyClassNames.js +30 -0
- package/table/hook/useStickyOffsets.js +30 -0
- package/table/summary/Cell.js +10 -0
- package/table/summary/Row.js +26 -0
- package/table/summary/context.js +5 -0
- package/table/summary/index.js +10 -0
- package/table/tbody/Td.js +168 -0
- package/table/tbody/Tr.js +168 -0
- package/table/tbody/index.js +156 -0
- package/table/tfoot/index.js +16 -0
- package/table/thead/Column.js +250 -0
- package/table/thead/index.js +131 -0
- package/table/util.js +121 -0
- package/tabs/Tab.js +170 -0
- package/tabs/TabContent.js +54 -0
- package/tabs/TabPane.js +26 -0
- package/tabs/hook/useDomSize.js +17 -0
- package/tabs/hook/useHeaderScroll.js +64 -0
- package/tabs/tab-header/DropdownIcon.js +71 -0
- package/tabs/tab-header/TabInk.js +65 -0
- package/tabs/tab-header/TabNavIcon.js +65 -0
- package/tabs/tab-header/TabTitle.js +78 -0
- package/tabs/tab-header/index.js +335 -0
- package/tabs/util.js +22 -0
- package/time-picker/Picker.js +221 -0
- package/time-picker/RangePicker.js +56 -0
- package/time-picker/TimeColumn.js +65 -0
- package/time-picker/TimePicker.js +242 -0
- package/time-picker/context.js +5 -0
- package/time-picker/util.js +43 -0
- package/timeline/Item.js +94 -0
- package/timeline/Timeline.js +80 -0
- package/transfer/Item.js +107 -0
- package/transfer/List.js +192 -0
- package/tree/Animation.js +104 -0
- package/tree/Context.js +5 -0
- package/tree/Node.js +215 -0
- package/tree/NodeList.js +84 -0
- package/tree/Tree.js +549 -0
- package/tree/util.js +76 -0
- package/tree-select/List.js +127 -0
- package/tree-select/Select.js +260 -0
- package/tree-select/hook/useKeyCache.js +56 -0
- package/tree-select/hook/useStateValue.js +98 -0
- package/tree-select/hook/useTreeData.js +13 -0
- package/tree-select/interface.js +13 -0
- package/tree-select/util.js +9 -0
- package/trigger/Portal.js +14 -0
- package/trigger/getPopupStyle.js +190 -0
- package/types/badge/Count.d.ts +2 -1
- package/types/badge/index.d.ts +2 -2
- package/types/button/index.d.ts +2 -2
- package/types/carousel/index.d.ts +1 -1
- package/types/color-picker/colors.d.ts +1 -1
- package/types/color-picker/style/index.d.ts +1 -1
- package/types/drawer/Drawer.d.ts +1 -1
- package/types/dropdown/interface.d.ts +1 -0
- package/types/hooks/index.d.ts +122 -0
- package/types/hooks/use-verification-code/interface.d.ts +1 -1
- package/types/hooks/useAsync.d.ts +1 -1
- package/types/hooks/useDropArea.d.ts +1 -0
- package/types/hooks/useOverrideRef.d.ts +5 -0
- package/types/hooks/usePersistCallback.d.ts +1 -0
- package/types/hooks/useUpsert.d.ts +1 -1
- package/types/icon-hover/index.d.ts +5 -3
- package/types/index.d.ts +2 -120
- package/types/input-tag/InputTag.d.ts +1 -1
- package/types/link/interface.d.ts +1 -1
- package/types/list/index.d.ts +1 -1
- package/types/modal/interface.d.ts +1 -0
- package/types/notice/index.d.ts +3 -0
- package/types/notification/index.d.ts +1 -1
- package/types/page-header/index.d.ts +1 -1
- package/types/select/Select.d.ts +1 -1
- package/types/select-view/Core.d.ts +3 -2
- package/types/select-view/index.d.ts +1 -0
- package/types/statistic/index.d.ts +1 -1
- package/types/switch/index.d.ts +1 -1
- package/types/switch/interface.d.ts +1 -1
- package/types/table/interface.d.ts +2 -1
- package/types/tooltip/index.d.ts +1 -1
- package/types/trigger/index.d.ts +12 -8
- package/types/trigger/interface.d.ts +1 -0
- package/types/typography/Base.d.ts +8 -7
- package/types/typography/EditContent.d.ts +3 -2
- package/types/typography/Paragraph.d.ts +2 -5
- package/types/typography/Text.d.ts +1 -5
- package/types/typography/Title.d.ts +2 -5
- package/types/upload/TriggerNode.d.ts +5 -3
- package/types/upload/list/PictureItem.d.ts +3 -3
- package/types/upload/list/TextItem.d.ts +3 -3
- package/types/utils/CSSTransition.d.ts +2 -0
- package/types/utils/constant.d.ts +1 -1
- package/types/utils/is.d.ts +4 -0
- package/types/utils/reactDOM.d.ts +3 -1
- package/types/utils/warning.d.ts +1 -1
- package/types/version/index.d.ts +1 -1
- package/typography/Base.js +184 -0
- package/typography/EditContent.js +49 -0
- package/typography/Ellipsis.js +293 -0
- package/typography/Operations.js +78 -0
- package/typography/Paragraph.js +26 -0
- package/typography/Text.js +11 -0
- package/typography/Title.js +12 -0
- package/typography/Typography.js +15 -0
- package/typography/useCssEllipsis.js +37 -0
- package/typography/useEllipsis.js +150 -0
- package/upload/TriggerNode.js +118 -0
- package/upload/Upload.js +205 -0
- package/upload/Uploader.js +205 -0
- package/upload/interface.js +9 -0
- package/upload/list/PictureItem.js +91 -0
- package/upload/list/TextItem.js +99 -0
- package/upload/list/UploadProgress.js +97 -0
- package/upload/list/index.js +120 -0
- package/upload/request.js +51 -0
- package/upload/util.js +61 -0
- package/utils/CSSTransition.js +27 -0
- package/utils/contextHolder.js +29 -4
- package/utils/getHighlightText.js +1 -2
- package/utils/is.js +81 -68
- package/utils/reactDOM.js +33 -22
- package/utils/style.js +1 -2
- package/utils/warning.js +7 -3
- package/verification-code/VerificationCode.js +83 -0
- package/virtual-list/Filler.js +31 -0
- package/virtual-list/VirtualList.js +378 -0
- package/virtual-list/util/algorithm.js +32 -0
- package/virtual-list/util/item.js +99 -0
- package/{chunk/BCEX3Acw.js → watermark/Watermark.js} +13 -11
- package/chunk/B1P8u7kB.js +0 -798
- package/chunk/B2ufZjjd.js +0 -1000
- package/chunk/B7QOJqps.js +0 -162
- package/chunk/BBz3S3zo.js +0 -966
- package/chunk/BGzBxiWE.js +0 -517
- package/chunk/BNRfcEHj.js +0 -984
- package/chunk/BSs6uXmc.js +0 -946
- package/chunk/BTjUAV8T.js +0 -277
- package/chunk/BYQeEcKe.js +0 -375
- package/chunk/Ba4UXIST.js +0 -605
- package/chunk/BfaXVcik.js +0 -271
- package/chunk/Bs11tCU6.js +0 -240
- package/chunk/C7FC7dzS.js +0 -516
- package/chunk/CLzbve11.js +0 -694
- package/chunk/CN4zXU4b.js +0 -877
- package/chunk/CYTPZUHD.js +0 -769
- package/chunk/CcCo_dK0.js +0 -335
- package/chunk/CoCXcpQd.js +0 -261
- package/chunk/D4yH4UKK.js +0 -80
- package/chunk/DiSLYN2-.js +0 -167
- package/chunk/Dr0iXIXO.js +0 -736
- package/chunk/G3-2uJao.js +0 -229
- package/chunk/RnTpOC5-.js +0 -1
- package/chunk/Z-mtdHUQ.js +0 -226
- package/chunk/ZISxNnaR.js +0 -165
- package/chunk/aPJXnDSb.js +0 -450
- package/chunk/i605JRmI.js +0 -232
- package/chunk/l0sNRNKZ.js +0 -1
- package/types/form/FormItemTip.d.ts +0 -8
- /package/{chunk/C6Kfwj0f.js → loading/style/index.less.js} +0 -0
- /package/{chunk/DP2rzg_V.js → suspense-fallback-test/style/index.less.js} +0 -0
- /package/{chunk/K6Dvbx-E.js → virtual-list/style/index.less.js} +0 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import p from "lodash/isArray";
|
|
3
|
+
import n from "lodash/isPlainObject";
|
|
4
|
+
import { createContext as O, useState as y, useContext as P, useCallback as A } from "react";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import "../config-provider/ConfigProvider.js";
|
|
7
|
+
import R from "../hooks/useMergeValue.js";
|
|
8
|
+
import j from "@unicom-cloud/utils/class-name";
|
|
9
|
+
import { pickTriggerPropsFromRest as w } from "../utils/constant.js";
|
|
10
|
+
import S from "./Checkbox.js";
|
|
11
|
+
import { ConfigContext as z } from "../config-provider/context.js";
|
|
12
|
+
const F = {
|
|
13
|
+
isCheckboxGroup: !1,
|
|
14
|
+
checkboxGroupValue: [],
|
|
15
|
+
onGroupChange: () => {
|
|
16
|
+
},
|
|
17
|
+
registerValue: () => {
|
|
18
|
+
},
|
|
19
|
+
unRegisterValue: () => {
|
|
20
|
+
}
|
|
21
|
+
}, M = O(F);
|
|
22
|
+
function T(r) {
|
|
23
|
+
const [o, C] = R([], {
|
|
24
|
+
defaultValue: "defaultValue" in r ? r.defaultValue || [] : void 0,
|
|
25
|
+
value: "value" in r ? r.value || [] : void 0
|
|
26
|
+
}), [s, c] = y([]), { getPrefixCls: x, rtl: g } = P(z), {
|
|
27
|
+
disabled: m,
|
|
28
|
+
options: f,
|
|
29
|
+
style: b,
|
|
30
|
+
className: V,
|
|
31
|
+
error: k,
|
|
32
|
+
children: v,
|
|
33
|
+
direction: d = "horizontal"
|
|
34
|
+
} = r, u = x("checkbox"), G = j(
|
|
35
|
+
`${u}-group`,
|
|
36
|
+
{
|
|
37
|
+
[`${u}-group-is-error`]: k,
|
|
38
|
+
[`${u}-group-direction-${d}`]: d,
|
|
39
|
+
[`${u}-group-rtl`]: g
|
|
40
|
+
},
|
|
41
|
+
V
|
|
42
|
+
), N = A(
|
|
43
|
+
(e, l, a) => {
|
|
44
|
+
var h;
|
|
45
|
+
const t = o.slice();
|
|
46
|
+
l ? t.push(e) : t.splice(o.indexOf(e), 1), C(t), (h = r.onChange) == null || h.call(
|
|
47
|
+
r,
|
|
48
|
+
t.filter(($) => s.indexOf($) > -1),
|
|
49
|
+
a
|
|
50
|
+
);
|
|
51
|
+
},
|
|
52
|
+
[o, r.onChange, s]
|
|
53
|
+
);
|
|
54
|
+
return /* @__PURE__ */ i(
|
|
55
|
+
"span",
|
|
56
|
+
{
|
|
57
|
+
className: G,
|
|
58
|
+
style: b,
|
|
59
|
+
...w(r),
|
|
60
|
+
children: /* @__PURE__ */ i(
|
|
61
|
+
M.Provider,
|
|
62
|
+
{
|
|
63
|
+
value: {
|
|
64
|
+
isCheckboxGroup: !0,
|
|
65
|
+
checkboxGroupValue: o,
|
|
66
|
+
onGroupChange: N,
|
|
67
|
+
disabled: m,
|
|
68
|
+
registerValue: (e) => {
|
|
69
|
+
c((l) => Array.from(/* @__PURE__ */ new Set([...l, e])));
|
|
70
|
+
},
|
|
71
|
+
unRegisterValue: (e) => {
|
|
72
|
+
c((l) => l.filter((a) => a !== e));
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
children: p(f) ? f.map((e) => {
|
|
76
|
+
const l = n(e) ? e.label : e, a = n(e) ? e.value : e, t = n(e) ? e.icon : void 0;
|
|
77
|
+
return /* @__PURE__ */ i(
|
|
78
|
+
S,
|
|
79
|
+
{
|
|
80
|
+
disabled: m || n(e) && e.disabled,
|
|
81
|
+
value: a,
|
|
82
|
+
icon: t,
|
|
83
|
+
children: l
|
|
84
|
+
},
|
|
85
|
+
a
|
|
86
|
+
);
|
|
87
|
+
}) : v
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
T.displayName = "CheckboxGroup";
|
|
94
|
+
export {
|
|
95
|
+
M as CheckboxGroupContext,
|
|
96
|
+
T as default
|
|
97
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import u from "lodash/isArray";
|
|
2
|
+
import { useState as y, useMemo as m } from "react";
|
|
3
|
+
const k = (c, g) => {
|
|
4
|
+
const [t, s] = y([...g || []]), { isSelected: n, setValueSelected: p } = m(() => ({
|
|
5
|
+
isSelected: (l) => t.indexOf(l) > -1,
|
|
6
|
+
setValueSelected: (l, r) => {
|
|
7
|
+
const o = u(l) ? l : [l];
|
|
8
|
+
let e;
|
|
9
|
+
r ? e = [...t, ...o] : e = t.filter((d) => o.indexOf(d) === -1), s(Array.from(new Set(e)));
|
|
10
|
+
}
|
|
11
|
+
}), [t]), { selectAll: x, unSelectAll: P, toggle: V, isAllSelected: h, isPartialSelected: w } = m(() => {
|
|
12
|
+
const S = () => {
|
|
13
|
+
s(c);
|
|
14
|
+
}, f = () => {
|
|
15
|
+
s([]);
|
|
16
|
+
}, l = (e = c) => {
|
|
17
|
+
const d = u(e) ? e : [e], i = [...t];
|
|
18
|
+
d.forEach((A) => {
|
|
19
|
+
const a = i.indexOf(A);
|
|
20
|
+
a > -1 ? i.splice(a, 1) : i.push(A);
|
|
21
|
+
}), s(i);
|
|
22
|
+
}, r = () => c.every((e) => n(e));
|
|
23
|
+
return {
|
|
24
|
+
selectAll: S,
|
|
25
|
+
unSelectAll: f,
|
|
26
|
+
toggle: l,
|
|
27
|
+
isAllSelected: r,
|
|
28
|
+
isPartialSelected: () => c.some((e) => n(e)) && !r()
|
|
29
|
+
};
|
|
30
|
+
}, [t, c, n]);
|
|
31
|
+
return {
|
|
32
|
+
selected: t,
|
|
33
|
+
setSelected: s,
|
|
34
|
+
setValueSelected: p,
|
|
35
|
+
selectAll: x,
|
|
36
|
+
unSelectAll: P,
|
|
37
|
+
toggle: V,
|
|
38
|
+
isSelected: n,
|
|
39
|
+
isAllSelected: h,
|
|
40
|
+
isPartialSelected: w
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
k as default
|
|
45
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import z from "@unicom-cloud/icons/IconUiCaretLeft";
|
|
3
|
+
import u from "@unicom-cloud/icons/IconUiCaretRight";
|
|
4
|
+
import F from "lodash/isFunction";
|
|
5
|
+
import M, { createContext as O, useContext as T } from "react";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import "../config-provider/ConfigProvider.js";
|
|
8
|
+
import U from "../hooks/useMergeProps.js";
|
|
9
|
+
import V from "../hooks/useMergeValue.js";
|
|
10
|
+
import j from "@unicom-cloud/utils/class-name";
|
|
11
|
+
import H from "../utils/omit.js";
|
|
12
|
+
import L from "./Item.js";
|
|
13
|
+
import { ConfigContext as q } from "../config-provider/context.js";
|
|
14
|
+
const f = (s, a) => {
|
|
15
|
+
const i = [].concat(s);
|
|
16
|
+
return a ? i.slice(0, 1) : i;
|
|
17
|
+
}, B = {
|
|
18
|
+
bordered: !0,
|
|
19
|
+
lazyload: !0,
|
|
20
|
+
expandIconPosition: "left"
|
|
21
|
+
}, D = O({
|
|
22
|
+
expandIconPosition: "left",
|
|
23
|
+
expandIcon: /* @__PURE__ */ r(u, {}),
|
|
24
|
+
activeKeys: [],
|
|
25
|
+
onToggle: () => {
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
function E(s, a) {
|
|
29
|
+
const { getPrefixCls: i, componentConfig: c, rtl: C } = T(q), e = U(
|
|
30
|
+
s,
|
|
31
|
+
B,
|
|
32
|
+
c == null ? void 0 : c.Collapse
|
|
33
|
+
), [o, v] = V([], {
|
|
34
|
+
defaultValue: "defaultActiveKey" in e ? f(e.defaultActiveKey, e.accordion) : void 0,
|
|
35
|
+
value: "activeKey" in e ? f(e.activeKey, e.accordion) : void 0
|
|
36
|
+
}), {
|
|
37
|
+
children: g,
|
|
38
|
+
className: y,
|
|
39
|
+
style: I,
|
|
40
|
+
bordered: K,
|
|
41
|
+
lazyload: P,
|
|
42
|
+
expandIcon: h,
|
|
43
|
+
expandIconPosition: d,
|
|
44
|
+
destroyOnHide: A,
|
|
45
|
+
accordion: R,
|
|
46
|
+
triggerRegion: N,
|
|
47
|
+
onChange: p,
|
|
48
|
+
...b
|
|
49
|
+
} = e, l = i("collapse"), $ = (n, w) => {
|
|
50
|
+
let t = [...o || []];
|
|
51
|
+
const m = o == null ? void 0 : o.indexOf(n);
|
|
52
|
+
m > -1 ? t.splice(m, 1) : R ? t = [n] : t.push(n), "activeKey" in e || v(t), F(p) && p(n, t, w);
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ r(
|
|
55
|
+
D.Provider,
|
|
56
|
+
{
|
|
57
|
+
value: {
|
|
58
|
+
activeKeys: o,
|
|
59
|
+
triggerRegion: N,
|
|
60
|
+
lazyload: P,
|
|
61
|
+
destroyOnHide: A,
|
|
62
|
+
expandIconPosition: d,
|
|
63
|
+
onToggle: $,
|
|
64
|
+
expandIcon: "expandIcon" in e ? h : d === "right" ? /* @__PURE__ */ r(z, {}) : /* @__PURE__ */ r(u, {})
|
|
65
|
+
},
|
|
66
|
+
children: /* @__PURE__ */ r(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
ref: a,
|
|
70
|
+
...H(b, ["activeKey", "defaultActiveKey"]),
|
|
71
|
+
className: j(
|
|
72
|
+
l,
|
|
73
|
+
`${l}-${K ? "border" : "borderless"}`,
|
|
74
|
+
{ [`${l}-rtl`]: C },
|
|
75
|
+
y
|
|
76
|
+
),
|
|
77
|
+
style: I,
|
|
78
|
+
children: g
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
const G = M.forwardRef(E), x = G;
|
|
85
|
+
x.displayName = "Collapse";
|
|
86
|
+
x.Item = L;
|
|
87
|
+
export {
|
|
88
|
+
D as CollapseContext,
|
|
89
|
+
x as default
|
|
90
|
+
};
|
package/collapse/Item.js
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { jsxs as y, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { Transition as T } from "@unicom-cloud/react-transition-group";
|
|
3
|
+
import w, { useContext as $, useRef as L } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import "../config-provider/ConfigProvider.js";
|
|
6
|
+
import j from "../hooks/useKeyboardEvent.js";
|
|
7
|
+
import K from "../IconHover.js";
|
|
8
|
+
import c from "@unicom-cloud/utils/class-name";
|
|
9
|
+
import { off as z, on as S } from "../utils/dom.js";
|
|
10
|
+
import { CollapseContext as q } from "./Collapse.js";
|
|
11
|
+
import { ConfigContext as A } from "../config-provider/context.js";
|
|
12
|
+
function B(d, v) {
|
|
13
|
+
var u;
|
|
14
|
+
const { getPrefixCls: E } = $(A), t = $(q), C = j(), {
|
|
15
|
+
children: I,
|
|
16
|
+
name: l,
|
|
17
|
+
header: N,
|
|
18
|
+
className: b,
|
|
19
|
+
style: H,
|
|
20
|
+
contentStyle: R,
|
|
21
|
+
extra: f,
|
|
22
|
+
disabled: i,
|
|
23
|
+
destroyOnHide: p,
|
|
24
|
+
expandIcon: O,
|
|
25
|
+
showExpandIcon: k = !0,
|
|
26
|
+
...P
|
|
27
|
+
} = d, o = L(null), n = E("collapse-item"), s = ((u = t.activeKeys) == null ? void 0 : u.indexOf(l)) > -1, h = k ? "expandIcon" in d ? O : t.expandIcon : null, m = (e, a) => {
|
|
28
|
+
var x;
|
|
29
|
+
if (i) return;
|
|
30
|
+
const { triggerRegion: g } = t;
|
|
31
|
+
(a === (g === "icon" ? 0 : g === "header" ? 1 : 2) || // When triggerRegion is set to header, clicking icon should trigger onChange as well
|
|
32
|
+
g === "header" && [0, 1].includes(a)) && ((x = t.onToggle) == null || x.call(t, l, e));
|
|
33
|
+
};
|
|
34
|
+
return /* @__PURE__ */ y(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
ref: v,
|
|
38
|
+
...P,
|
|
39
|
+
className: c(
|
|
40
|
+
n,
|
|
41
|
+
{
|
|
42
|
+
[`${n}-active`]: s,
|
|
43
|
+
[`${n}-no-icon`]: !h,
|
|
44
|
+
[`${n}-disabled`]: i
|
|
45
|
+
},
|
|
46
|
+
b
|
|
47
|
+
),
|
|
48
|
+
style: H,
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ y(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
role: "button",
|
|
54
|
+
"aria-disabled": i,
|
|
55
|
+
"aria-expanded": s,
|
|
56
|
+
"data-active-region": t.triggerRegion,
|
|
57
|
+
tabIndex: i ? -1 : 0,
|
|
58
|
+
className: c(
|
|
59
|
+
`${n}-header`,
|
|
60
|
+
`${n}-header-${t.expandIconPosition}`,
|
|
61
|
+
{
|
|
62
|
+
[`${n}-header-disabled`]: i
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
onClick: (e) => m(e, 2),
|
|
66
|
+
...C({
|
|
67
|
+
onPressEnter: (e) => {
|
|
68
|
+
!i && t.onToggle(l, e);
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
children: [
|
|
72
|
+
h && /* @__PURE__ */ r(
|
|
73
|
+
K,
|
|
74
|
+
{
|
|
75
|
+
prefix: n,
|
|
76
|
+
disabled: i,
|
|
77
|
+
className: c({
|
|
78
|
+
[`${n}-icon-hover-right`]: t.expandIconPosition === "right",
|
|
79
|
+
[`${n}-header-icon-right`]: t.expandIconPosition === "right"
|
|
80
|
+
}),
|
|
81
|
+
onClick: (e) => m(e, 0),
|
|
82
|
+
children: /* @__PURE__ */ r(
|
|
83
|
+
"span",
|
|
84
|
+
{
|
|
85
|
+
className: c(`${n}-header-icon`, {
|
|
86
|
+
[`${n}-header-icon-down`]: s
|
|
87
|
+
}),
|
|
88
|
+
children: h
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
/* @__PURE__ */ r(
|
|
94
|
+
"div",
|
|
95
|
+
{
|
|
96
|
+
className: `${n}-header-title`,
|
|
97
|
+
onClick: (e) => m(e, 1),
|
|
98
|
+
children: N
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
f && /* @__PURE__ */ r(
|
|
102
|
+
"div",
|
|
103
|
+
{
|
|
104
|
+
className: `${n}-header-extra`,
|
|
105
|
+
onClick: (e) => {
|
|
106
|
+
e.stopPropagation();
|
|
107
|
+
},
|
|
108
|
+
children: f
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
/* @__PURE__ */ r(
|
|
115
|
+
T,
|
|
116
|
+
{
|
|
117
|
+
nodeRef: o,
|
|
118
|
+
in: s,
|
|
119
|
+
addEndListener: (e, a) => {
|
|
120
|
+
z(e, "transitionend", a), S(e, "transitionend", a);
|
|
121
|
+
},
|
|
122
|
+
mountOnEnter: "destroyOnHide" in d ? p : t.destroyOnHide || t.lazyload,
|
|
123
|
+
unmountOnExit: "destroyOnHide" in d ? p : t.destroyOnHide,
|
|
124
|
+
onEnter: (e) => {
|
|
125
|
+
o.current.style.height = 0, o.current.style.display = "block";
|
|
126
|
+
},
|
|
127
|
+
onEntering: (e) => {
|
|
128
|
+
o.current.style.height = `${o.current.scrollHeight}px`;
|
|
129
|
+
},
|
|
130
|
+
onEntered: (e) => {
|
|
131
|
+
o.current.style.height = "auto";
|
|
132
|
+
},
|
|
133
|
+
onExit: (e) => {
|
|
134
|
+
o.current.style.display = "block", o.current.style.height = `${o.current.offsetHeight}px`, o.current.offsetHeight;
|
|
135
|
+
},
|
|
136
|
+
onExiting: (e) => {
|
|
137
|
+
o.current.style.height = 0;
|
|
138
|
+
},
|
|
139
|
+
onExited: (e) => {
|
|
140
|
+
o.current.style.display = "none", o.current.style.height = "auto";
|
|
141
|
+
},
|
|
142
|
+
children: /* @__PURE__ */ r(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
ref: o,
|
|
146
|
+
role: "region",
|
|
147
|
+
className: c(`${n}-content`, {
|
|
148
|
+
[`${n}-content-expanded`]: s
|
|
149
|
+
}),
|
|
150
|
+
children: /* @__PURE__ */ r("div", { style: R, className: `${n}-content-box`, children: I })
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
const D = w.forwardRef(
|
|
160
|
+
B
|
|
161
|
+
);
|
|
162
|
+
D.displayName = "CollapseItem";
|
|
163
|
+
export {
|
|
164
|
+
D as default
|
|
165
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as $ } from "react";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import "../config-provider/ConfigProvider.js";
|
|
5
|
+
import s from "@unicom-cloud/utils/class-name";
|
|
6
|
+
import { useControlBlock as u } from "./hooks/useControlBlock.js";
|
|
7
|
+
import { ConfigContext as C } from "../config-provider/context.js";
|
|
8
|
+
const j = ({
|
|
9
|
+
x: e,
|
|
10
|
+
type: i = "hue",
|
|
11
|
+
color: n,
|
|
12
|
+
onChange: m,
|
|
13
|
+
style: t
|
|
14
|
+
}) => {
|
|
15
|
+
const { getPrefixCls: d } = $(C), r = d("color-picker"), { r: f, g: b, b: h } = n.rgb, { blockRef: a, handlerRef: g, onMouseDown: l } = u({
|
|
16
|
+
value: [e, 0],
|
|
17
|
+
onChange: (p) => m(p[0])
|
|
18
|
+
}), c = () => /* @__PURE__ */ o(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
ref: g,
|
|
22
|
+
style: {
|
|
23
|
+
left: `${e * 100}%`
|
|
24
|
+
},
|
|
25
|
+
className: `${r}-handler`,
|
|
26
|
+
children: /* @__PURE__ */ o(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
className: `${r}-handler-center`,
|
|
30
|
+
style: { backgroundColor: n.string }
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
return i === "alpha" ? /* @__PURE__ */ o("div", { className: `${r}-control-bar-bg`, children: /* @__PURE__ */ o(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
ref: a,
|
|
39
|
+
className: s(
|
|
40
|
+
`${r}-control-bar`,
|
|
41
|
+
`${r}-control-bar-alpha`,
|
|
42
|
+
`${r}-control-bar-alpha`
|
|
43
|
+
),
|
|
44
|
+
style: {
|
|
45
|
+
background: `linear-gradient(to right, rgba(0, 0, 0, 0), rgb(${f}, ${b}, ${h}))`,
|
|
46
|
+
...t
|
|
47
|
+
},
|
|
48
|
+
onMouseDown: l,
|
|
49
|
+
children: c()
|
|
50
|
+
}
|
|
51
|
+
) }) : /* @__PURE__ */ o(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
ref: a,
|
|
55
|
+
style: t,
|
|
56
|
+
className: s(`${r}-control-bar`, `${r}-control-bar-hue`),
|
|
57
|
+
onMouseDown: l,
|
|
58
|
+
children: c()
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
j as ControlBar
|
|
64
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as e } from "react";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import "../config-provider/ConfigProvider.js";
|
|
5
|
+
import p from "../InputNumber.js";
|
|
6
|
+
import { ConfigContext as s } from "../config-provider/context.js";
|
|
7
|
+
const c = ({ value: o, onChange: t }) => {
|
|
8
|
+
const { getPrefixCls: r } = e(s), n = r("color-picker");
|
|
9
|
+
return /* @__PURE__ */ m(
|
|
10
|
+
p,
|
|
11
|
+
{
|
|
12
|
+
className: `${n}-input-alpha`,
|
|
13
|
+
size: "mini",
|
|
14
|
+
min: 0,
|
|
15
|
+
max: 100,
|
|
16
|
+
value: Math.round(o * 100),
|
|
17
|
+
suffix: "%",
|
|
18
|
+
onChange: (i) => t(i / 100)
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
c as InputAlpha
|
|
24
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsxs as v, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import c from "@unicom-cloud/utils/tinycolor";
|
|
3
|
+
import { useContext as I, useState as j, useEffect as D } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import "../config-provider/ConfigProvider.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
/* empty css */
|
|
8
|
+
import f from "../input/Input.js";
|
|
9
|
+
import { InputAlpha as H } from "./InputAlpha.js";
|
|
10
|
+
import { ConfigContext as P } from "../config-provider/context.js";
|
|
11
|
+
const y = ({
|
|
12
|
+
color: o,
|
|
13
|
+
alpha: u,
|
|
14
|
+
onHsvChange: x,
|
|
15
|
+
onAlphaChange: h,
|
|
16
|
+
disabledAlpha: l
|
|
17
|
+
}) => {
|
|
18
|
+
const { getPrefixCls: g } = I(P), r = g("color-picker"), [n, s] = j(o.hex);
|
|
19
|
+
D(() => {
|
|
20
|
+
o.hex !== n && s(o.hex);
|
|
21
|
+
}, [o]);
|
|
22
|
+
const i = (e) => {
|
|
23
|
+
var a;
|
|
24
|
+
const t = ((a = e.match(/[a-fA-F0-9]*/g)) == null ? void 0 : a.join("")) ?? "";
|
|
25
|
+
t !== n && s(t.toUpperCase());
|
|
26
|
+
}, p = () => {
|
|
27
|
+
let e = new c(n);
|
|
28
|
+
e.ok || (e = new c({
|
|
29
|
+
r: 255,
|
|
30
|
+
g: 0,
|
|
31
|
+
b: 0
|
|
32
|
+
}));
|
|
33
|
+
const t = e.toHsv_();
|
|
34
|
+
x(t);
|
|
35
|
+
}, C = (e) => {
|
|
36
|
+
let t = e.clipboardData.getData("Text");
|
|
37
|
+
t.startsWith("#") && (t = t.slice(1)), i(t), e.preventDefault();
|
|
38
|
+
};
|
|
39
|
+
return /* @__PURE__ */ v(f.Group, { className: `${r}-input-group`, compact: !0, children: [
|
|
40
|
+
/* @__PURE__ */ m(
|
|
41
|
+
f,
|
|
42
|
+
{
|
|
43
|
+
className: `${r}-input-hex`,
|
|
44
|
+
prefix: "#",
|
|
45
|
+
size: "mini",
|
|
46
|
+
maxLength: 6,
|
|
47
|
+
value: n,
|
|
48
|
+
onChange: i,
|
|
49
|
+
onBlur: p,
|
|
50
|
+
onPressEnter: p,
|
|
51
|
+
onPaste: C
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
!l && /* @__PURE__ */ m(H, { value: u, onChange: h })
|
|
55
|
+
] });
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
y as InputHex
|
|
59
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsxs as h, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import f from "@unicom-cloud/utils/tinycolor";
|
|
3
|
+
import { useContext as x } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import "../config-provider/ConfigProvider.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
/* empty css */
|
|
8
|
+
import b from "../input/Input.js";
|
|
9
|
+
import m from "../InputNumber.js";
|
|
10
|
+
import { InputAlpha as I } from "./InputAlpha.js";
|
|
11
|
+
import { ConfigContext as d } from "../config-provider/context.js";
|
|
12
|
+
const R = ({
|
|
13
|
+
color: p,
|
|
14
|
+
alpha: s,
|
|
15
|
+
onHsvChange: u,
|
|
16
|
+
onAlphaChange: C,
|
|
17
|
+
disabledAlpha: a
|
|
18
|
+
}) => {
|
|
19
|
+
const { getPrefixCls: g } = x(d), c = g("color-picker"), n = (o) => {
|
|
20
|
+
const l = new f({
|
|
21
|
+
r: o.r,
|
|
22
|
+
g: o.g,
|
|
23
|
+
b: o.b
|
|
24
|
+
}).toHsv_();
|
|
25
|
+
u(l);
|
|
26
|
+
}, { r: t, g: i, b: e } = p.rgb;
|
|
27
|
+
return /* @__PURE__ */ h(b.Group, { className: `${c}-input-group`, compact: !0, children: [
|
|
28
|
+
/* @__PURE__ */ r(
|
|
29
|
+
m,
|
|
30
|
+
{
|
|
31
|
+
size: "mini",
|
|
32
|
+
min: 0,
|
|
33
|
+
max: 255,
|
|
34
|
+
hideControl: !0,
|
|
35
|
+
value: t,
|
|
36
|
+
onChange: (o) => n({ r: o, g: i, b: e })
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ r(
|
|
40
|
+
m,
|
|
41
|
+
{
|
|
42
|
+
size: "mini",
|
|
43
|
+
min: 0,
|
|
44
|
+
max: 255,
|
|
45
|
+
hideControl: !0,
|
|
46
|
+
value: i,
|
|
47
|
+
onChange: (o) => n({ r: t, g: o, b: e })
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ r(
|
|
51
|
+
m,
|
|
52
|
+
{
|
|
53
|
+
size: "mini",
|
|
54
|
+
min: 0,
|
|
55
|
+
max: 255,
|
|
56
|
+
hideControl: !0,
|
|
57
|
+
value: e,
|
|
58
|
+
onChange: (o) => n({ r: t, g: i, b: o })
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
!a && /* @__PURE__ */ r(I, { value: s, onChange: C })
|
|
62
|
+
] });
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
R as InputRgb
|
|
66
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import u from "@unicom-cloud/utils/tinycolor";
|
|
3
|
+
import { useContext as d, useMemo as h } from "react";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import "../config-provider/ConfigProvider.js";
|
|
6
|
+
import { useControlBlock as g } from "./hooks/useControlBlock.js";
|
|
7
|
+
import { ConfigContext as x } from "../config-provider/context.js";
|
|
8
|
+
const M = ({ color: l, onChange: c }) => {
|
|
9
|
+
const { getPrefixCls: i } = d(x), e = i("color-picker"), { h: r, s: t, v: n } = l.hsv, { blockRef: m, handlerRef: f, onMouseDown: p } = g({
|
|
10
|
+
value: [t, 1 - n],
|
|
11
|
+
onChange: (o) => c(o[0], 1 - o[1])
|
|
12
|
+
}), a = h(() => new u({ h: r * 360, s: 100, v: 100 }).toRgbString(), [r]), C = () => /* @__PURE__ */ s(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
ref: f,
|
|
16
|
+
className: `${e}-handler`,
|
|
17
|
+
style: {
|
|
18
|
+
top: `${(1 - n) * 100}%`,
|
|
19
|
+
left: `${t * 100}%`
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
return /* @__PURE__ */ s(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
ref: m,
|
|
27
|
+
className: `${e}-palette`,
|
|
28
|
+
style: { backgroundColor: a },
|
|
29
|
+
onMouseDown: p,
|
|
30
|
+
children: C()
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
M as Palette
|
|
36
|
+
};
|