@chaoswise/ui 3.0.23 → 3.1.0
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/lib/Antd5/_util/ActionButton.js +4 -2
- package/lib/Antd5/_util/ContextIsolator.js +27 -0
- package/lib/Antd5/_util/easings.js +2 -2
- package/lib/Antd5/_util/getScroll.js +9 -8
- package/lib/Antd5/_util/hooks/useClosable.js +3 -2
- package/lib/Antd5/_util/hooks/useUniqueMemo.js +123 -0
- package/lib/Antd5/_util/hooks/useZIndex.js +31 -15
- package/lib/Antd5/_util/motion.js +3 -2
- package/lib/Antd5/_util/placements.js +2 -2
- package/lib/Antd5/_util/scrollTo.js +1 -1
- package/lib/Antd5/_util/statusUtils.js +1 -1
- package/lib/Antd5/_util/toList.js +5 -0
- package/lib/Antd5/_util/warning.js +0 -1
- package/lib/Antd5/_util/wave/WaveEffect.js +2 -2
- package/lib/Antd5/_util/wave/interface.js +2 -1
- package/lib/Antd5/_util/wave/useWave.js +1 -1
- package/lib/Antd5/_util/wave/util.js +1 -9
- package/lib/Antd5/alert/Alert.js +1 -2
- package/lib/Antd5/alert/ErrorBoundary.js +1 -1
- package/lib/Antd5/alert/design/behavior-pattern.js +3 -3
- package/lib/Antd5/alert/style/index.js +6 -4
- package/lib/Antd5/anchor/Anchor.js +8 -7
- package/lib/Antd5/anchor/AnchorLink.js +4 -4
- package/lib/Antd5/app/index.js +2 -1
- package/lib/Antd5/app/style/index.js +5 -4
- package/lib/Antd5/auto-complete/index.js +1 -1
- package/lib/Antd5/avatar/group.js +35 -17
- package/lib/Antd5/avatar/style/index.js +18 -13
- package/lib/Antd5/back-top/index.js +3 -2
- package/lib/Antd5/badge/ScrollNumber.js +1 -1
- package/lib/Antd5/badge/SingleNumber.js +17 -16
- package/lib/Antd5/badge/style/index.js +6 -7
- package/lib/Antd5/badge/style/ribbon.js +3 -3
- package/lib/Antd5/breadcrumb/design/behavior-pattern.js +4 -4
- package/lib/Antd5/breadcrumb/style/index.js +2 -2
- package/lib/Antd5/button/LoadingIcon.js +5 -10
- package/lib/Antd5/button/button-group.js +0 -1
- package/lib/Antd5/button/button.js +70 -41
- package/lib/Antd5/button/buttonHelpers.js +7 -5
- package/lib/Antd5/button/style/{compactCmp.js → compact.js} +20 -27
- package/lib/Antd5/button/style/group.js +9 -7
- package/lib/Antd5/button/style/index.js +150 -110
- package/lib/Antd5/button/style/token.js +8 -1
- package/lib/Antd5/calendar/generateCalendar.js +25 -28
- package/lib/Antd5/calendar/style/index.js +4 -4
- package/lib/Antd5/card/Card.js +3 -3
- package/lib/Antd5/card/style/index.js +6 -9
- package/lib/Antd5/carousel/index.js +3 -3
- package/lib/Antd5/carousel/style/index.js +1 -1
- package/lib/Antd5/cascader/Panel.js +7 -2
- package/lib/Antd5/cascader/hooks/useBase.js +3 -2
- package/lib/Antd5/cascader/hooks/useColumnIcons.js +6 -3
- package/lib/Antd5/cascader/index.js +1 -1
- package/lib/Antd5/cascader/style/columns.js +6 -4
- package/lib/Antd5/checkbox/Checkbox.js +11 -5
- package/lib/Antd5/checkbox/style/index.js +6 -3
- package/lib/Antd5/collapse/Collapse.js +2 -1
- package/lib/Antd5/collapse/style/index.js +20 -13
- package/lib/Antd5/color-picker/ColorPicker.js +120 -78
- package/lib/Antd5/color-picker/ColorPickerPanel.js +44 -26
- package/lib/Antd5/color-picker/color.js +82 -10
- package/lib/Antd5/color-picker/components/ColorAlphaInput.js +2 -2
- package/lib/Antd5/color-picker/components/ColorClear.js +2 -2
- package/lib/Antd5/color-picker/components/ColorHexInput.js +5 -4
- package/lib/Antd5/color-picker/components/ColorInput.js +4 -3
- package/lib/Antd5/color-picker/components/ColorPresets.js +1 -1
- package/lib/Antd5/color-picker/components/ColorSlider.js +139 -0
- package/lib/Antd5/color-picker/components/ColorTrigger.js +52 -26
- package/lib/Antd5/color-picker/components/PanelPicker/GradientColorBar.js +130 -0
- package/lib/Antd5/color-picker/components/PanelPicker/index.js +194 -0
- package/lib/Antd5/color-picker/context.js +1 -5
- package/lib/Antd5/color-picker/hooks/useModeColor.js +87 -0
- package/lib/Antd5/color-picker/style/color-block.js +3 -2
- package/lib/Antd5/color-picker/style/index.js +33 -15
- package/lib/Antd5/color-picker/style/input.js +1 -1
- package/lib/Antd5/color-picker/style/picker.js +6 -33
- package/lib/Antd5/color-picker/style/slider.js +87 -0
- package/lib/Antd5/color-picker/util.js +53 -7
- package/lib/Antd5/config-provider/context.js +3 -1
- package/lib/Antd5/config-provider/cssVariables.js +0 -1
- package/lib/Antd5/config-provider/defaultRenderEmpty.js +8 -1
- package/lib/Antd5/config-provider/index.js +13 -5
- package/lib/Antd5/config-provider/style/index.js +0 -1
- package/lib/Antd5/date-picker/PickerButton.js +3 -2
- package/lib/Antd5/date-picker/design/behavior-pattern.js +15 -15
- package/lib/Antd5/date-picker/generatePicker/constant.js +15 -0
- package/lib/Antd5/date-picker/generatePicker/generateRangePicker.js +16 -11
- package/lib/Antd5/date-picker/generatePicker/generateSinglePicker.js +19 -15
- package/lib/Antd5/date-picker/generatePicker/index.js +2 -2
- package/lib/Antd5/date-picker/generatePicker/interface.js +1 -1
- package/lib/Antd5/date-picker/index.js +2 -17
- package/lib/Antd5/date-picker/locale/ar_EG.js +9 -1
- package/lib/Antd5/date-picker/locale/az_AZ.js +9 -1
- package/lib/Antd5/date-picker/locale/el_GR.js +9 -1
- package/lib/Antd5/date-picker/locale/ja_JP.js +11 -1
- package/lib/Antd5/date-picker/locale/kn_IN.js +9 -1
- package/lib/Antd5/date-picker/locale/pl_PL.js +9 -1
- package/lib/Antd5/date-picker/locale/uk_UA.js +10 -1
- package/lib/Antd5/date-picker/style/index.js +13 -10
- package/lib/Antd5/date-picker/style/panel.js +36 -32
- package/lib/Antd5/date-picker/style/token.js +1 -1
- package/lib/Antd5/date-picker/util.js +0 -48
- package/lib/Antd5/descriptions/hooks/useItems.js +5 -0
- package/lib/Antd5/descriptions/hooks/useRow.js +42 -34
- package/lib/Antd5/descriptions/style/index.js +20 -8
- package/lib/Antd5/divider/index.js +4 -3
- package/lib/Antd5/divider/style/index.js +19 -4
- package/lib/Antd5/drawer/DrawerPanel.js +11 -20
- package/lib/Antd5/drawer/index.js +39 -42
- package/lib/Antd5/drawer/style/index.js +10 -11
- package/lib/Antd5/dropdown/dropdown.js +5 -7
- package/lib/Antd5/dropdown/style/index.js +27 -11
- package/lib/Antd5/empty/empty.js +9 -3
- package/lib/Antd5/empty/simple.js +9 -3
- package/lib/Antd5/empty/style/index.js +1 -1
- package/lib/Antd5/float-button/BackTop.js +3 -2
- package/lib/Antd5/float-button/FloatButton.js +16 -5
- package/lib/Antd5/float-button/FloatButtonGroup.js +76 -52
- package/lib/Antd5/float-button/style/index.js +117 -76
- package/lib/Antd5/float-button/style/keyframes.js +118 -0
- package/lib/Antd5/form/ErrorList.js +14 -2
- package/lib/Antd5/form/Form.js +11 -3
- package/lib/Antd5/form/FormItem/ItemHolder.js +8 -4
- package/lib/Antd5/form/FormItem/index.js +6 -4
- package/lib/Antd5/form/FormItemInput.js +68 -28
- package/lib/Antd5/form/FormItemLabel.js +3 -3
- package/lib/Antd5/form/hooks/useForm.js +8 -1
- package/lib/Antd5/form/hooks/useVariants.js +10 -4
- package/lib/Antd5/form/style/explain.js +9 -8
- package/lib/Antd5/form/style/index.js +30 -18
- package/lib/Antd5/grid/row.js +2 -2
- package/lib/Antd5/image/index.js +3 -1
- package/lib/Antd5/image/style/index.js +17 -20
- package/lib/Antd5/index.js +2 -1
- package/lib/Antd5/input/Input.js +18 -38
- package/lib/Antd5/input/OTP/OTPInput.js +10 -5
- package/lib/Antd5/input/OTP/index.js +12 -4
- package/lib/Antd5/input/Password.js +6 -2
- package/lib/Antd5/input/Search.js +2 -4
- package/lib/Antd5/input/TextArea.js +1 -1
- package/lib/Antd5/input/style/index.js +72 -63
- package/lib/Antd5/input/style/otp.js +1 -1
- package/lib/Antd5/input/style/variants.js +38 -23
- package/lib/Antd5/input/utils.js +0 -1
- package/lib/Antd5/input-number/index.js +19 -22
- package/lib/Antd5/input-number/style/index.js +26 -16
- package/lib/Antd5/layout/Sider.js +15 -8
- package/lib/Antd5/layout/style/index.js +6 -96
- package/lib/Antd5/layout/style/sider.js +115 -0
- package/lib/Antd5/list/Item.js +18 -5
- package/lib/Antd5/list/index.js +15 -10
- package/lib/Antd5/list/style/index.js +40 -41
- package/lib/Antd5/locale/ar_EG.js +14 -1
- package/lib/Antd5/locale/az_AZ.js +78 -28
- package/lib/Antd5/locale/bn_BD.js +0 -1
- package/lib/Antd5/locale/by_BY.js +0 -1
- package/lib/Antd5/locale/ca_ES.js +0 -1
- package/lib/Antd5/locale/cs_CZ.js +0 -1
- package/lib/Antd5/locale/de_DE.js +0 -1
- package/lib/Antd5/locale/el_GR.js +104 -3
- package/lib/Antd5/locale/en_GB.js +0 -1
- package/lib/Antd5/locale/en_US.js +4 -2
- package/lib/Antd5/locale/es_ES.js +10 -6
- package/lib/Antd5/locale/et_EE.js +0 -1
- package/lib/Antd5/locale/eu_ES.js +4 -2
- package/lib/Antd5/locale/fa_IR.js +0 -1
- package/lib/Antd5/locale/fr_BE.js +5 -1
- package/lib/Antd5/locale/fr_CA.js +0 -1
- package/lib/Antd5/locale/fr_FR.js +5 -6
- package/lib/Antd5/locale/ga_IE.js +0 -1
- package/lib/Antd5/locale/gl_ES.js +0 -1
- package/lib/Antd5/locale/he_IL.js +0 -1
- package/lib/Antd5/locale/hi_IN.js +0 -1
- package/lib/Antd5/locale/hr_HR.js +0 -1
- package/lib/Antd5/locale/id_ID.js +4 -2
- package/lib/Antd5/locale/index.js +1 -1
- package/lib/Antd5/locale/it_IT.js +0 -1
- package/lib/Antd5/locale/ja_JP.js +4 -2
- package/lib/Antd5/locale/ka_GE.js +0 -1
- package/lib/Antd5/locale/kk_KZ.js +0 -1
- package/lib/Antd5/locale/km_KH.js +0 -1
- package/lib/Antd5/locale/kn_IN.js +82 -4
- package/lib/Antd5/locale/ko_KR.js +4 -2
- package/lib/Antd5/locale/lt_LT.js +4 -2
- package/lib/Antd5/locale/ml_IN.js +0 -1
- package/lib/Antd5/locale/mn_MN.js +86 -2
- package/lib/Antd5/locale/ms_MY.js +101 -18
- package/lib/Antd5/locale/my_MM.js +0 -1
- package/lib/Antd5/locale/nb_NO.js +0 -1
- package/lib/Antd5/locale/ne_NP.js +104 -2
- package/lib/Antd5/locale/nl_BE.js +5 -1
- package/lib/Antd5/locale/nl_NL.js +5 -1
- package/lib/Antd5/locale/pl_PL.js +0 -1
- package/lib/Antd5/locale/pt_BR.js +0 -1
- package/lib/Antd5/locale/pt_PT.js +55 -38
- package/lib/Antd5/locale/ro_RO.js +0 -1
- package/lib/Antd5/locale/ru_RU.js +9 -2
- package/lib/Antd5/locale/si_LK.js +0 -1
- package/lib/Antd5/locale/sk_SK.js +0 -1
- package/lib/Antd5/locale/sr_RS.js +0 -1
- package/lib/Antd5/locale/sv_SE.js +0 -1
- package/lib/Antd5/locale/th_TH.js +11 -3
- package/lib/Antd5/locale/tk_TK.js +0 -1
- package/lib/Antd5/locale/tr_TR.js +2 -1
- package/lib/Antd5/locale/uk_UA.js +1 -1
- package/lib/Antd5/locale/ur_PK.js +0 -1
- package/lib/Antd5/locale/uz_UZ.js +6 -7
- package/lib/Antd5/locale/zh_CN.js +4 -2
- package/lib/Antd5/locale/zh_HK.js +0 -1
- package/lib/Antd5/locale/zh_TW.js +0 -1
- package/lib/Antd5/mentions/index.js +4 -4
- package/lib/Antd5/menu/MenuItem.js +6 -5
- package/lib/Antd5/menu/OverrideContext.js +4 -3
- package/lib/Antd5/menu/SubMenu.js +2 -2
- package/lib/Antd5/menu/menu.js +2 -2
- package/lib/Antd5/menu/style/index.js +58 -40
- package/lib/Antd5/menu/style/theme.js +24 -20
- package/lib/Antd5/menu/style/vertical.js +10 -7
- package/lib/Antd5/message/PurePanel.js +22 -40
- package/lib/Antd5/message/style/index.js +8 -47
- package/lib/Antd5/message/useMessage.js +3 -15
- package/lib/Antd5/modal/Modal.js +50 -38
- package/lib/Antd5/modal/PurePanel.js +0 -1
- package/lib/Antd5/modal/confirm.js +4 -5
- package/lib/Antd5/modal/style/confirm.js +1 -2
- package/lib/Antd5/modal/style/index.js +13 -3
- package/lib/Antd5/modal/useModal/HookModal.js +4 -3
- package/lib/Antd5/modal/useModal/index.js +0 -1
- package/lib/Antd5/notification/index.js +6 -3
- package/lib/Antd5/notification/style/index.js +35 -3
- package/lib/Antd5/notification/useNotification.js +6 -1
- package/lib/Antd5/pagination/Pagination.js +10 -5
- package/lib/Antd5/pagination/design/behavior-pattern.js +3 -3
- package/lib/Antd5/pagination/style/bordered.js +1 -1
- package/lib/Antd5/pagination/style/index.js +27 -18
- package/lib/Antd5/popconfirm/PurePanel.js +7 -7
- package/lib/Antd5/popover/PurePanel.js +16 -6
- package/lib/Antd5/popover/index.js +7 -19
- package/lib/Antd5/popover/style/index.js +3 -1
- package/lib/Antd5/progress/Line.js +27 -19
- package/lib/Antd5/progress/design/behavior-pattern.js +3 -3
- package/lib/Antd5/progress/progress.js +37 -11
- package/lib/Antd5/progress/style/index.js +46 -11
- package/lib/Antd5/progress/utils.js +20 -18
- package/lib/Antd5/qr-code/QrcodeStatus.js +42 -0
- package/lib/Antd5/qr-code/index.js +31 -31
- package/lib/Antd5/rate/index.js +8 -2
- package/lib/Antd5/result/noFound.js +3 -1
- package/lib/Antd5/result/serverError.js +3 -1
- package/lib/Antd5/result/unauthorized.js +5 -3
- package/lib/Antd5/segmented/index.js +5 -3
- package/lib/Antd5/segmented/style/index.js +11 -3
- package/lib/Antd5/select/index.js +4 -2
- package/lib/Antd5/select/style/dropdown.js +1 -1
- package/lib/Antd5/select/style/index.js +21 -8
- package/lib/Antd5/select/style/multiple.js +18 -9
- package/lib/Antd5/select/style/single.js +8 -10
- package/lib/Antd5/select/style/token.js +9 -2
- package/lib/Antd5/select/style/variants.js +20 -11
- package/lib/Antd5/skeleton/Image.js +6 -4
- package/lib/Antd5/skeleton/Node.js +1 -3
- package/lib/Antd5/skeleton/Paragraph.js +1 -1
- package/lib/Antd5/skeleton/Title.js +9 -6
- package/lib/Antd5/skeleton/style/index.js +13 -13
- package/lib/Antd5/slider/Context.js +4 -0
- package/lib/Antd5/slider/SliderTooltip.js +9 -5
- package/lib/Antd5/slider/index.js +32 -31
- package/lib/Antd5/slider/style/index.js +60 -44
- package/lib/Antd5/space/Compact.js +1 -1
- package/lib/Antd5/space/index.js +3 -3
- package/lib/Antd5/spin/Indicator/Looper.js +29 -0
- package/lib/Antd5/spin/Indicator/Progress.js +78 -0
- package/lib/Antd5/spin/Indicator/index.js +21 -0
- package/lib/Antd5/spin/index.js +27 -45
- package/lib/Antd5/spin/style/index.js +54 -17
- package/lib/Antd5/spin/usePercent.js +40 -0
- package/lib/Antd5/splitter/Panel.js +36 -0
- package/lib/Antd5/splitter/SplitBar.js +124 -0
- package/lib/Antd5/splitter/Splitter.js +194 -0
- package/lib/Antd5/{_util/transButton.js → splitter/hooks/useItems.js} +28 -54
- package/lib/Antd5/splitter/hooks/useResizable.js +43 -0
- package/lib/Antd5/splitter/hooks/useResize.js +138 -0
- package/lib/Antd5/splitter/hooks/useSizes.js +109 -0
- package/lib/Antd5/splitter/index.js +5 -0
- package/lib/Antd5/splitter/interface.js +1 -0
- package/lib/Antd5/splitter/style/index.js +219 -0
- package/lib/Antd5/statistic/style/index.js +1 -1
- package/lib/Antd5/steps/style/custom-icon.js +1 -1
- package/lib/Antd5/steps/style/index.js +11 -8
- package/lib/Antd5/steps/style/inline.js +5 -4
- package/lib/Antd5/steps/style/progress-dot.js +2 -2
- package/lib/Antd5/steps/style/small.js +3 -3
- package/lib/Antd5/steps/style/vertical.js +2 -2
- package/lib/Antd5/style/index.js +37 -13
- package/lib/Antd5/style/motion/slide.js +6 -5
- package/lib/Antd5/style/placementArrow.js +15 -6
- package/lib/Antd5/switch/style/index.js +1 -1
- package/lib/Antd5/table/Column.js +2 -3
- package/lib/Antd5/table/ColumnGroup.js +2 -3
- package/lib/Antd5/table/ExpandIcon.js +6 -6
- package/lib/Antd5/table/InternalTable.js +6 -6
- package/lib/Antd5/table/RcTable/VirtualTable.js +3 -2
- package/lib/Antd5/table/RcTable/index.js +3 -2
- package/lib/Antd5/table/hooks/useFilter/FilterDropdown.js +82 -61
- package/lib/Antd5/table/hooks/useFilter/FilterSearch.js +7 -7
- package/lib/Antd5/table/hooks/useFilter/index.js +28 -26
- package/lib/Antd5/table/hooks/useLazyKVMap.js +5 -5
- package/lib/Antd5/table/hooks/useSelection.js +21 -11
- package/lib/Antd5/table/hooks/useSorter.js +66 -42
- package/lib/Antd5/table/hooks/useTitleColumns.js +9 -7
- package/lib/Antd5/table/interface.js +1 -1
- package/lib/Antd5/table/style/bordered.js +5 -3
- package/lib/Antd5/table/style/expand.js +44 -38
- package/lib/Antd5/table/style/filter.js +1 -1
- package/lib/Antd5/table/style/index.js +26 -21
- package/lib/Antd5/table/style/selection.js +3 -1
- package/lib/Antd5/table/style/sorter.js +3 -1
- package/lib/Antd5/table/style/virtual.js +2 -2
- package/lib/Antd5/table/util.js +9 -8
- package/lib/Antd5/tabs/style/index.js +2 -2
- package/lib/Antd5/tag/style/index.js +2 -2
- package/lib/Antd5/theme/index.js +12 -5
- package/lib/Antd5/theme/interface/cssinjs-utils.js +1 -0
- package/lib/Antd5/theme/internal.js +10 -5
- package/lib/Antd5/theme/themes/dark/colors.js +3 -0
- package/lib/Antd5/theme/themes/dark/index.js +1 -0
- package/lib/Antd5/theme/themes/default/colors.js +3 -0
- package/lib/Antd5/theme/themes/default/index.js +6 -2
- package/lib/Antd5/theme/themes/seed.js +5 -2
- package/lib/Antd5/theme/themes/shared/genColorMapToken.js +2 -0
- package/lib/Antd5/theme/themes/shared/genFontSizes.js +1 -1
- package/lib/Antd5/theme/useToken.js +2 -1
- package/lib/Antd5/theme/util/alias.js +1 -1
- package/lib/Antd5/theme/util/genStyleUtils.js +61 -0
- package/lib/Antd5/time-picker/index.js +15 -2
- package/lib/Antd5/time-picker/locale/az_AZ.js +2 -1
- package/lib/Antd5/time-picker/locale/it_IT.js +2 -1
- package/lib/Antd5/time-picker/locale/uk_UA.js +2 -1
- package/lib/Antd5/timeline/TimelineItemList.js +0 -1
- package/lib/Antd5/timeline/style/index.js +1 -1
- package/lib/Antd5/tooltip/index.js +3 -2
- package/lib/Antd5/tooltip/style/index.js +3 -1
- package/lib/Antd5/tooltip/util.js +0 -1
- package/lib/Antd5/tour/panelRender.js +7 -13
- package/lib/Antd5/tour/style/index.js +6 -13
- package/lib/Antd5/transfer/ListItem.js +3 -3
- package/lib/Antd5/transfer/hooks/useData.js +1 -1
- package/lib/Antd5/transfer/hooks/useSelection.js +26 -21
- package/lib/Antd5/transfer/style/index.js +12 -22
- package/lib/Antd5/tree/Tree.js +2 -0
- package/lib/Antd5/tree/style/directory.js +39 -0
- package/lib/Antd5/tree/style/index.js +115 -166
- package/lib/Antd5/tree/utils/dropIndicator.js +3 -2
- package/lib/Antd5/tree/utils/iconUtil.js +5 -1
- package/lib/Antd5/tree-select/index.js +47 -43
- package/lib/Antd5/typography/Base/CopyBtn.js +17 -17
- package/lib/Antd5/typography/Base/Ellipsis.js +48 -40
- package/lib/Antd5/typography/Base/index.js +20 -60
- package/lib/Antd5/typography/Base/util.js +31 -1
- package/lib/Antd5/typography/Editable.js +11 -10
- package/lib/Antd5/typography/Title.js +1 -6
- package/lib/Antd5/typography/Typography.js +2 -6
- package/lib/Antd5/typography/hooks/useCopyClick.js +3 -2
- package/lib/Antd5/typography/hooks/usePrevious.js +1 -1
- package/lib/Antd5/{message/assets/Close.js → typography/hooks/useTooltipProps.js} +24 -16
- package/lib/Antd5/typography/style/mixins.js +3 -9
- package/lib/Antd5/upload/Upload.js +55 -83
- package/lib/Antd5/upload/UploadList/ListItem.js +15 -9
- package/lib/Antd5/upload/UploadList/index.js +33 -47
- package/lib/Antd5/upload/style/dragger.js +5 -26
- package/lib/Antd5/upload/style/list.js +2 -7
- package/lib/Antd5/version/version.js +1 -1
- package/lib/Antd5/watermark/context.js +1 -1
- package/lib/Antd5/watermark/index.js +35 -18
- package/lib/Antd5/watermark/useClips.js +2 -1
- package/lib/Antd5/watermark/useRafDebounce.js +1 -1
- package/lib/Antd5/watermark/utils.js +1 -1
- package/lib/CWSelect/index.js +39 -1
- package/lib/CWSelect/index.style.js +39 -0
- package/lib/CWTree/index.js +3 -9
- package/lib/CWTree/index.style.js +2 -0
- package/lib/ConfigProvider/ConfigProvider.js +9 -10
- package/lib/ConfigProvider/customTheme.js +6 -0
- package/lib/ConfigProvider/theme/common.js +140 -0
- package/lib/ConfigProvider/theme/dark.js +2 -0
- package/lib/ConfigProvider/theme/default.js +115 -0
- package/lib/ConfigProvider/theme/utils.js +49 -0
- package/lib/QuickTransfer/index.js +45 -59
- package/lib/Splitter/index.js +2 -0
- package/package.json +37 -35
- package/lib/Antd5/color-picker/components/PanelPicker.js +0 -53
- package/lib/Antd5/color-picker/hooks/useColorState.js +0 -53
- package/lib/Antd5/layout/style/light.js +0 -24
- package/lib/Antd5/style/operationUnit.js +0 -18
- package/lib/Antd5/theme/util/calc/CSSCalculator.js +0 -119
- package/lib/Antd5/theme/util/calc/NumCalculator.js +0 -81
- package/lib/Antd5/theme/util/calc/calculator.js +0 -10
- package/lib/Antd5/theme/util/calc/index.js +0 -9
- package/lib/Antd5/theme/util/genComponentStyleHook.js +0 -243
- package/lib/Antd5/theme/util/maxmin.js +0 -27
- package/lib/Antd5/theme/util/statistic.js +0 -74
- package/lib/Antd5/typography/hooks/useUpdatedEffect.js +0 -13
- package/lib/Antd5/version/token-meta.json +0 -1
- package/lib/Antd5/version/token.json +0 -1
- package/lib/ConfigProvider/customTheme.json +0 -163
|
@@ -1,51 +1,69 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["prefixCls", "presets", "panelRender", "color", "onChange", "onClear"];
|
|
3
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
9
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
10
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
2
|
import React from 'react';
|
|
12
3
|
import Divider from '../divider';
|
|
13
4
|
import PanelPicker from './components/PanelPicker';
|
|
14
5
|
import PanelPresets from './components/PanelPresets';
|
|
15
|
-
import {
|
|
6
|
+
import { PanelPickerContext, PanelPresetsContext } from './context';
|
|
16
7
|
var ColorPickerPanel = function ColorPickerPanel(props) {
|
|
17
8
|
var prefixCls = props.prefixCls,
|
|
18
9
|
presets = props.presets,
|
|
19
10
|
panelRender = props.panelRender,
|
|
20
|
-
|
|
11
|
+
value = props.value,
|
|
21
12
|
onChange = props.onChange,
|
|
22
13
|
onClear = props.onClear,
|
|
23
|
-
|
|
14
|
+
allowClear = props.allowClear,
|
|
15
|
+
disabledAlpha = props.disabledAlpha,
|
|
16
|
+
mode = props.mode,
|
|
17
|
+
onModeChange = props.onModeChange,
|
|
18
|
+
modeOptions = props.modeOptions,
|
|
19
|
+
onChangeComplete = props.onChangeComplete,
|
|
20
|
+
activeIndex = props.activeIndex,
|
|
21
|
+
onActive = props.onActive,
|
|
22
|
+
format = props.format,
|
|
23
|
+
onFormatChange = props.onFormatChange,
|
|
24
|
+
gradientDragging = props.gradientDragging,
|
|
25
|
+
onGradientDragging = props.onGradientDragging,
|
|
26
|
+
disabledFormat = props.disabledFormat;
|
|
24
27
|
var colorPickerPanelPrefixCls = "".concat(prefixCls, "-inner");
|
|
25
|
-
//
|
|
26
|
-
var
|
|
27
|
-
prefixCls: prefixCls,
|
|
28
|
-
value: color,
|
|
29
|
-
onChange: onChange,
|
|
30
|
-
onClear: onClear
|
|
31
|
-
}, injectProps);
|
|
32
|
-
var panelPresetsProps = React.useMemo(function () {
|
|
28
|
+
// ===================== Context ======================
|
|
29
|
+
var panelContext = React.useMemo(function () {
|
|
33
30
|
return {
|
|
34
31
|
prefixCls: prefixCls,
|
|
35
|
-
value:
|
|
32
|
+
value: value,
|
|
33
|
+
onChange: onChange,
|
|
34
|
+
onClear: onClear,
|
|
35
|
+
allowClear: allowClear,
|
|
36
|
+
disabledAlpha: disabledAlpha,
|
|
37
|
+
mode: mode,
|
|
38
|
+
onModeChange: onModeChange,
|
|
39
|
+
modeOptions: modeOptions,
|
|
40
|
+
onChangeComplete: onChangeComplete,
|
|
41
|
+
activeIndex: activeIndex,
|
|
42
|
+
onActive: onActive,
|
|
43
|
+
format: format,
|
|
44
|
+
onFormatChange: onFormatChange,
|
|
45
|
+
gradientDragging: gradientDragging,
|
|
46
|
+
onGradientDragging: onGradientDragging,
|
|
47
|
+
disabledFormat: disabledFormat
|
|
48
|
+
};
|
|
49
|
+
}, [prefixCls, value, onChange, onClear, allowClear, disabledAlpha, mode, onModeChange, modeOptions, onChangeComplete, activeIndex, onActive, format, onFormatChange, gradientDragging, onGradientDragging, disabledFormat]);
|
|
50
|
+
var presetContext = React.useMemo(function () {
|
|
51
|
+
return {
|
|
52
|
+
prefixCls: prefixCls,
|
|
53
|
+
value: value,
|
|
36
54
|
presets: presets,
|
|
37
55
|
onChange: onChange
|
|
38
56
|
};
|
|
39
|
-
}, [prefixCls,
|
|
57
|
+
}, [prefixCls, value, presets, onChange]);
|
|
40
58
|
// ====================== Render ======================
|
|
41
59
|
var innerPanel = _jsxs("div", {
|
|
42
60
|
className: "".concat(colorPickerPanelPrefixCls, "-content"),
|
|
43
61
|
children: [_jsx(PanelPicker, {}), Array.isArray(presets) && _jsx(Divider, {}), _jsx(PanelPresets, {})]
|
|
44
62
|
});
|
|
45
|
-
return _jsx(
|
|
46
|
-
value:
|
|
47
|
-
children: _jsx(
|
|
48
|
-
value:
|
|
63
|
+
return _jsx(PanelPickerContext.Provider, {
|
|
64
|
+
value: panelContext,
|
|
65
|
+
children: _jsx(PanelPresetsContext.Provider, {
|
|
66
|
+
value: presetContext,
|
|
49
67
|
children: _jsx("div", {
|
|
50
68
|
className: colorPickerPanelPrefixCls,
|
|
51
69
|
children: typeof panelRender === 'function' ? panelRender(innerPanel, {
|
|
@@ -6,14 +6,14 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import { Color as RcColor } from '@rc-component/color-picker';
|
|
8
8
|
export var toHexFormat = function toHexFormat(value, alpha) {
|
|
9
|
-
return (value === null || value === void 0 ? void 0 : value.replace(/[^\w/]/
|
|
9
|
+
return (value === null || value === void 0 ? void 0 : value.replace(/[^\w/]/g, '').slice(0, alpha ? 8 : 6)) || '';
|
|
10
10
|
};
|
|
11
11
|
export var getHex = function getHex(value, alpha) {
|
|
12
12
|
return value ? toHexFormat(value, alpha) : '';
|
|
13
13
|
};
|
|
14
|
-
export var
|
|
15
|
-
function
|
|
16
|
-
_classCallCheck(this,
|
|
14
|
+
export var AggregationColor = /*#__PURE__*/function () {
|
|
15
|
+
function AggregationColor(color) {
|
|
16
|
+
_classCallCheck(this, AggregationColor);
|
|
17
17
|
/** Original Color object */
|
|
18
18
|
Object.defineProperty(this, "metaColor", {
|
|
19
19
|
enumerable: true,
|
|
@@ -21,19 +21,51 @@ export var ColorFactory = /*#__PURE__*/function () {
|
|
|
21
21
|
writable: true,
|
|
22
22
|
value: void 0
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(this, "colors", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: void 0
|
|
29
|
+
});
|
|
24
30
|
Object.defineProperty(this, "cleared", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
configurable: true,
|
|
27
33
|
writable: true,
|
|
28
34
|
value: false
|
|
29
35
|
});
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
|
|
36
|
+
// Clone from another AggregationColor
|
|
37
|
+
if (color instanceof AggregationColor) {
|
|
38
|
+
var _color$colors;
|
|
39
|
+
this.metaColor = color.metaColor.clone();
|
|
40
|
+
this.colors = (_color$colors = color.colors) === null || _color$colors === void 0 ? void 0 : _color$colors.map(function (info) {
|
|
41
|
+
return {
|
|
42
|
+
color: new AggregationColor(info.color),
|
|
43
|
+
percent: info.percent
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
this.cleared = color.cleared;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
var isArray = Array.isArray(color);
|
|
50
|
+
if (isArray && color.length) {
|
|
51
|
+
this.colors = color.map(function (_ref) {
|
|
52
|
+
var c = _ref.color,
|
|
53
|
+
percent = _ref.percent;
|
|
54
|
+
return {
|
|
55
|
+
color: new AggregationColor(c),
|
|
56
|
+
percent: percent
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
this.metaColor = new RcColor(this.colors[0].color.metaColor);
|
|
60
|
+
} else {
|
|
61
|
+
this.metaColor = new RcColor(isArray ? '' : color);
|
|
62
|
+
}
|
|
63
|
+
if (!color || isArray && !this.colors) {
|
|
64
|
+
this.metaColor = this.metaColor.setA(0);
|
|
33
65
|
this.cleared = true;
|
|
34
66
|
}
|
|
35
67
|
}
|
|
36
|
-
return _createClass(
|
|
68
|
+
return _createClass(AggregationColor, [{
|
|
37
69
|
key: "toHsb",
|
|
38
70
|
value: function toHsb() {
|
|
39
71
|
return this.metaColor.toHsb();
|
|
@@ -46,12 +78,12 @@ export var ColorFactory = /*#__PURE__*/function () {
|
|
|
46
78
|
}, {
|
|
47
79
|
key: "toHex",
|
|
48
80
|
value: function toHex() {
|
|
49
|
-
return getHex(this.toHexString(), this.metaColor.
|
|
81
|
+
return getHex(this.toHexString(), this.metaColor.a < 1);
|
|
50
82
|
}
|
|
51
83
|
}, {
|
|
52
84
|
key: "toHexString",
|
|
53
85
|
value: function toHexString() {
|
|
54
|
-
return this.metaColor.
|
|
86
|
+
return this.metaColor.toHexString();
|
|
55
87
|
}
|
|
56
88
|
}, {
|
|
57
89
|
key: "toRgb",
|
|
@@ -63,5 +95,45 @@ export var ColorFactory = /*#__PURE__*/function () {
|
|
|
63
95
|
value: function toRgbString() {
|
|
64
96
|
return this.metaColor.toRgbString();
|
|
65
97
|
}
|
|
98
|
+
}, {
|
|
99
|
+
key: "isGradient",
|
|
100
|
+
value: function isGradient() {
|
|
101
|
+
return !!this.colors && !this.cleared;
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "getColors",
|
|
105
|
+
value: function getColors() {
|
|
106
|
+
return this.colors || [{
|
|
107
|
+
color: this,
|
|
108
|
+
percent: 0
|
|
109
|
+
}];
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
112
|
+
key: "toCssString",
|
|
113
|
+
value: function toCssString() {
|
|
114
|
+
var colors = this.colors;
|
|
115
|
+
// CSS line-gradient
|
|
116
|
+
if (colors) {
|
|
117
|
+
var colorsStr = colors.map(function (c) {
|
|
118
|
+
return "".concat(c.color.toRgbString(), " ").concat(c.percent, "%");
|
|
119
|
+
}).join(', ');
|
|
120
|
+
return "linear-gradient(90deg, ".concat(colorsStr, ")");
|
|
121
|
+
}
|
|
122
|
+
return this.metaColor.toRgbString();
|
|
123
|
+
}
|
|
124
|
+
}, {
|
|
125
|
+
key: "equals",
|
|
126
|
+
value: function equals(color) {
|
|
127
|
+
if (!color || this.isGradient() !== color.isGradient()) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
if (!this.isGradient()) {
|
|
131
|
+
return this.toHexString() === color.toHexString();
|
|
132
|
+
}
|
|
133
|
+
return this.colors.length === color.colors.length && this.colors.every(function (c, i) {
|
|
134
|
+
var target = color.colors[i];
|
|
135
|
+
return c.percent === target.percent && c.color.equals(target.color);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
66
138
|
}]);
|
|
67
139
|
}();
|
|
@@ -6,7 +6,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
6
6
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import React, { useEffect, useState } from 'react';
|
|
9
|
-
import { generateColor,
|
|
9
|
+
import { generateColor, getColorAlpha } from '../util';
|
|
10
10
|
import ColorSteppers from './ColorSteppers';
|
|
11
11
|
var ColorAlphaInput = function ColorAlphaInput(_ref) {
|
|
12
12
|
var prefixCls = _ref.prefixCls,
|
|
@@ -33,7 +33,7 @@ var ColorAlphaInput = function ColorAlphaInput(_ref) {
|
|
|
33
33
|
onChange === null || onChange === void 0 || onChange(genColor);
|
|
34
34
|
};
|
|
35
35
|
return _jsx(ColorSteppers, {
|
|
36
|
-
value:
|
|
36
|
+
value: getColorAlpha(alphaValue),
|
|
37
37
|
prefixCls: prefixCls,
|
|
38
38
|
formatter: function formatter(step) {
|
|
39
39
|
return "".concat(step, "%");
|
|
@@ -6,12 +6,12 @@ var ColorClear = function ColorClear(_ref) {
|
|
|
6
6
|
value = _ref.value,
|
|
7
7
|
onChange = _ref.onChange;
|
|
8
8
|
var handleClick = function handleClick() {
|
|
9
|
-
if (value && !value.cleared) {
|
|
9
|
+
if (onChange && value && !value.cleared) {
|
|
10
10
|
var hsba = value.toHsb();
|
|
11
11
|
hsba.a = 0;
|
|
12
12
|
var genColor = generateColor(hsba);
|
|
13
13
|
genColor.cleared = true;
|
|
14
|
-
onChange
|
|
14
|
+
onChange(genColor);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
return _jsx("div", {
|
|
@@ -18,15 +18,16 @@ var ColorHexInput = function ColorHexInput(_ref) {
|
|
|
18
18
|
value = _ref.value,
|
|
19
19
|
onChange = _ref.onChange;
|
|
20
20
|
var colorHexInputPrefixCls = "".concat(prefixCls, "-hex-input");
|
|
21
|
-
var _useState = useState(
|
|
21
|
+
var _useState = useState(function () {
|
|
22
|
+
return value ? toHexFormat(value.toHexString()) : undefined;
|
|
23
|
+
}),
|
|
22
24
|
_useState2 = _slicedToArray(_useState, 2),
|
|
23
25
|
hexValue = _useState2[0],
|
|
24
26
|
setHexValue = _useState2[1];
|
|
25
27
|
// Update step value
|
|
26
28
|
useEffect(function () {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
setHexValue(toHexFormat(hex));
|
|
29
|
+
if (value) {
|
|
30
|
+
setHexValue(toHexFormat(value.toHexString()));
|
|
30
31
|
}
|
|
31
32
|
}, [value]);
|
|
32
33
|
var handleHexChange = function handleHexChange(e) {
|
|
@@ -31,7 +31,8 @@ var ColorInput = function ColorInput(props) {
|
|
|
31
31
|
value = props.value,
|
|
32
32
|
disabledAlpha = props.disabledAlpha,
|
|
33
33
|
onFormatChange = props.onFormatChange,
|
|
34
|
-
onChange = props.onChange
|
|
34
|
+
onChange = props.onChange,
|
|
35
|
+
disabledFormat = props.disabledFormat;
|
|
35
36
|
var _useMergedState = useMergedState(ColorFormat.hex, {
|
|
36
37
|
value: format,
|
|
37
38
|
onChange: onFormatChange
|
|
@@ -54,14 +55,14 @@ var ColorInput = function ColorInput(props) {
|
|
|
54
55
|
return _jsx(ColorHsbInput, _objectSpread({}, inputProps));
|
|
55
56
|
case ColorFormat.rgb:
|
|
56
57
|
return _jsx(ColorRgbInput, _objectSpread({}, inputProps));
|
|
57
|
-
case ColorFormat.hex:
|
|
58
|
+
// case ColorFormat.hex:
|
|
58
59
|
default:
|
|
59
60
|
return _jsx(ColorHexInput, _objectSpread({}, inputProps));
|
|
60
61
|
}
|
|
61
62
|
}, [colorFormat, prefixCls, value, onChange]);
|
|
62
63
|
return _jsxs("div", {
|
|
63
64
|
className: "".concat(colorInputPrefixCls, "-container"),
|
|
64
|
-
children: [_jsx(Select, {
|
|
65
|
+
children: [!disabledFormat && _jsx(Select, {
|
|
65
66
|
value: colorFormat,
|
|
66
67
|
variant: "borderless",
|
|
67
68
|
getPopupContainer: function getPopupContainer(current) {
|
|
@@ -23,7 +23,7 @@ var genPresetColor = function genPresetColor(list) {
|
|
|
23
23
|
return value;
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
-
var isBright = function isBright(value, bgColorToken) {
|
|
26
|
+
export var isBright = function isBright(value, bgColorToken) {
|
|
27
27
|
var _value$toRgb = value.toRgb(),
|
|
28
28
|
r = _value$toRgb.r,
|
|
29
29
|
g = _value$toRgb.g,
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["prefixCls", "colors", "type", "color", "range", "className", "activeIndex", "onActive", "onDragStart", "onDragChange", "onKeyDelete"];
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
import { UnstableContext } from 'rc-slider';
|
|
14
|
+
import useEvent from 'rc-util/lib/hooks/useEvent';
|
|
15
|
+
import Slider from '../../slider';
|
|
16
|
+
import SliderInternalContext from '../../slider/Context';
|
|
17
|
+
import { getGradientPercentColor } from '../util';
|
|
18
|
+
export var GradientColorSlider = function GradientColorSlider(props) {
|
|
19
|
+
var prefixCls = props.prefixCls,
|
|
20
|
+
colors = props.colors,
|
|
21
|
+
type = props.type,
|
|
22
|
+
color = props.color,
|
|
23
|
+
_props$range = props.range,
|
|
24
|
+
range = _props$range === void 0 ? false : _props$range,
|
|
25
|
+
className = props.className,
|
|
26
|
+
activeIndex = props.activeIndex,
|
|
27
|
+
onActive = props.onActive,
|
|
28
|
+
onDragStart = props.onDragStart,
|
|
29
|
+
onDragChange = props.onDragChange,
|
|
30
|
+
onKeyDelete = props.onKeyDelete,
|
|
31
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
32
|
+
var sliderProps = _objectSpread(_objectSpread({}, restProps), {}, {
|
|
33
|
+
track: false
|
|
34
|
+
});
|
|
35
|
+
// ========================== Background ==========================
|
|
36
|
+
var linearCss = React.useMemo(function () {
|
|
37
|
+
var colorsStr = colors.map(function (c) {
|
|
38
|
+
return "".concat(c.color, " ").concat(c.percent, "%");
|
|
39
|
+
}).join(', ');
|
|
40
|
+
return "linear-gradient(90deg, ".concat(colorsStr, ")");
|
|
41
|
+
}, [colors]);
|
|
42
|
+
var pointColor = React.useMemo(function () {
|
|
43
|
+
if (!color || !type) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
if (type === 'alpha') {
|
|
47
|
+
return color.toRgbString();
|
|
48
|
+
}
|
|
49
|
+
return "hsl(".concat(color.toHsb().h, ", 100%, 50%)");
|
|
50
|
+
}, [color, type]);
|
|
51
|
+
// ======================= Context: Slider ========================
|
|
52
|
+
var onInternalDragStart = useEvent(onDragStart);
|
|
53
|
+
var onInternalDragChange = useEvent(onDragChange);
|
|
54
|
+
var unstableContext = React.useMemo(function () {
|
|
55
|
+
return {
|
|
56
|
+
onDragStart: onInternalDragStart,
|
|
57
|
+
onDragChange: onInternalDragChange
|
|
58
|
+
};
|
|
59
|
+
}, []);
|
|
60
|
+
// ======================= Context: Render ========================
|
|
61
|
+
var handleRender = useEvent(function (ori, info) {
|
|
62
|
+
var _ori$props = ori.props,
|
|
63
|
+
_onFocus = _ori$props.onFocus,
|
|
64
|
+
style = _ori$props.style,
|
|
65
|
+
handleCls = _ori$props.className,
|
|
66
|
+
_onKeyDown = _ori$props.onKeyDown;
|
|
67
|
+
// Point Color
|
|
68
|
+
var mergedStyle = _objectSpread({}, style);
|
|
69
|
+
if (type === 'gradient') {
|
|
70
|
+
mergedStyle.background = getGradientPercentColor(colors, info.value);
|
|
71
|
+
}
|
|
72
|
+
return /*#__PURE__*/React.cloneElement(ori, {
|
|
73
|
+
onFocus: function onFocus(e) {
|
|
74
|
+
onActive === null || onActive === void 0 || onActive(info.index);
|
|
75
|
+
_onFocus === null || _onFocus === void 0 || _onFocus(e);
|
|
76
|
+
},
|
|
77
|
+
style: mergedStyle,
|
|
78
|
+
className: classNames(handleCls, _defineProperty({}, "".concat(prefixCls, "-slider-handle-active"), activeIndex === info.index)),
|
|
79
|
+
onKeyDown: function onKeyDown(e) {
|
|
80
|
+
if ((e.key === 'Delete' || e.key === 'Backspace') && onKeyDelete) {
|
|
81
|
+
onKeyDelete(info.index);
|
|
82
|
+
}
|
|
83
|
+
_onKeyDown === null || _onKeyDown === void 0 || _onKeyDown(e);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
var sliderContext = React.useMemo(function () {
|
|
88
|
+
return {
|
|
89
|
+
direction: 'ltr',
|
|
90
|
+
handleRender: handleRender
|
|
91
|
+
};
|
|
92
|
+
}, []);
|
|
93
|
+
// ============================ Render ============================
|
|
94
|
+
return _jsx(SliderInternalContext.Provider, {
|
|
95
|
+
value: sliderContext,
|
|
96
|
+
children: _jsx(UnstableContext.Provider, {
|
|
97
|
+
value: unstableContext,
|
|
98
|
+
children: _jsx(Slider, _objectSpread(_objectSpread({}, sliderProps), {}, {
|
|
99
|
+
className: classNames(className, "".concat(prefixCls, "-slider")),
|
|
100
|
+
tooltip: {
|
|
101
|
+
open: false
|
|
102
|
+
},
|
|
103
|
+
range: {
|
|
104
|
+
editable: range,
|
|
105
|
+
minCount: 2
|
|
106
|
+
},
|
|
107
|
+
styles: {
|
|
108
|
+
rail: {
|
|
109
|
+
background: linearCss
|
|
110
|
+
},
|
|
111
|
+
handle: pointColor ? {
|
|
112
|
+
background: pointColor
|
|
113
|
+
} : {}
|
|
114
|
+
},
|
|
115
|
+
classNames: {
|
|
116
|
+
rail: "".concat(prefixCls, "-slider-rail"),
|
|
117
|
+
handle: "".concat(prefixCls, "-slider-handle")
|
|
118
|
+
}
|
|
119
|
+
}))
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
var SingleColorSlider = function SingleColorSlider(props) {
|
|
124
|
+
var value = props.value,
|
|
125
|
+
onChange = props.onChange,
|
|
126
|
+
onChangeComplete = props.onChangeComplete;
|
|
127
|
+
var singleOnChange = function singleOnChange(v) {
|
|
128
|
+
return onChange(v[0]);
|
|
129
|
+
};
|
|
130
|
+
var singleOnChangeComplete = function singleOnChangeComplete(v) {
|
|
131
|
+
return onChangeComplete(v[0]);
|
|
132
|
+
};
|
|
133
|
+
return _jsx(GradientColorSlider, _objectSpread(_objectSpread({}, props), {}, {
|
|
134
|
+
value: [value],
|
|
135
|
+
onChange: singleOnChange,
|
|
136
|
+
onChangeComplete: singleOnChangeComplete
|
|
137
|
+
}));
|
|
138
|
+
};
|
|
139
|
+
export default SingleColorSlider;
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["color", "prefixCls", "open", "disabled", "format", "className", "showText"];
|
|
2
|
+
var _excluded = ["color", "prefixCls", "open", "disabled", "format", "className", "showText", "activeIndex"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
8
14
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
9
15
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
10
|
-
import {
|
|
16
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
11
17
|
import React, { forwardRef, useMemo } from 'react';
|
|
12
18
|
import { ColorBlock } from '@rc-component/color-picker';
|
|
13
19
|
import classNames from 'classnames';
|
|
14
|
-
import
|
|
20
|
+
import pickAttrs from 'rc-util/lib/pickAttrs';
|
|
21
|
+
import { useLocale } from '../../locale';
|
|
22
|
+
import { getColorAlpha } from '../util';
|
|
15
23
|
import ColorClear from './ColorClear';
|
|
16
24
|
var ColorTrigger = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
17
25
|
var color = props.color,
|
|
@@ -21,44 +29,62 @@ var ColorTrigger = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
21
29
|
format = props.format,
|
|
22
30
|
className = props.className,
|
|
23
31
|
showText = props.showText,
|
|
32
|
+
activeIndex = props.activeIndex,
|
|
24
33
|
rest = _objectWithoutProperties(props, _excluded);
|
|
25
34
|
var colorTriggerPrefixCls = "".concat(prefixCls, "-trigger");
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
var colorTextPrefixCls = "".concat(colorTriggerPrefixCls, "-text");
|
|
36
|
+
var colorTextCellPrefixCls = "".concat(colorTextPrefixCls, "-cell");
|
|
37
|
+
var _useLocale = useLocale('ColorPicker'),
|
|
38
|
+
_useLocale2 = _slicedToArray(_useLocale, 1),
|
|
39
|
+
locale = _useLocale2[0];
|
|
40
|
+
// ============================== Text ==============================
|
|
41
|
+
var desc = React.useMemo(function () {
|
|
42
|
+
if (!showText) {
|
|
43
|
+
return '';
|
|
44
|
+
}
|
|
45
|
+
if (typeof showText === 'function') {
|
|
46
|
+
return showText(color);
|
|
47
|
+
}
|
|
48
|
+
if (color.cleared) {
|
|
49
|
+
return locale.transparent;
|
|
50
|
+
}
|
|
51
|
+
if (color.isGradient()) {
|
|
52
|
+
return color.getColors().map(function (c, index) {
|
|
53
|
+
var inactive = activeIndex !== -1 && activeIndex !== index;
|
|
54
|
+
return _jsxs("span", {
|
|
55
|
+
className: classNames(colorTextCellPrefixCls, inactive && "".concat(colorTextCellPrefixCls, "-inactive")),
|
|
56
|
+
children: [c.color.toRgbString(), " ", c.percent, "%"]
|
|
57
|
+
}, index);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
35
60
|
var hexString = color.toHexString().toUpperCase();
|
|
36
|
-
var alpha =
|
|
61
|
+
var alpha = getColorAlpha(color);
|
|
37
62
|
switch (format) {
|
|
38
63
|
case 'rgb':
|
|
39
64
|
return color.toRgbString();
|
|
40
65
|
case 'hsb':
|
|
41
66
|
return color.toHsbString();
|
|
42
|
-
case 'hex':
|
|
67
|
+
// case 'hex':
|
|
43
68
|
default:
|
|
44
69
|
return alpha < 100 ? "".concat(hexString.slice(0, 7), ",").concat(alpha, "%") : hexString;
|
|
45
70
|
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
71
|
+
}, [color, format, showText, activeIndex]);
|
|
72
|
+
// ============================= Render =============================
|
|
73
|
+
var containerNode = useMemo(function () {
|
|
74
|
+
return color.cleared ? _jsx(ColorClear, {
|
|
75
|
+
prefixCls: prefixCls
|
|
76
|
+
}) : _jsx(ColorBlock, {
|
|
77
|
+
prefixCls: prefixCls,
|
|
78
|
+
color: color.toCssString()
|
|
79
|
+
});
|
|
80
|
+
}, [color, prefixCls]);
|
|
55
81
|
return _jsxs("div", _objectSpread(_objectSpread({
|
|
56
82
|
ref: ref,
|
|
57
83
|
className: classNames(colorTriggerPrefixCls, className, _defineProperty(_defineProperty({}, "".concat(colorTriggerPrefixCls, "-active"), open), "".concat(colorTriggerPrefixCls, "-disabled"), disabled))
|
|
58
|
-
}, rest), {}, {
|
|
84
|
+
}, pickAttrs(rest)), {}, {
|
|
59
85
|
children: [containerNode, showText && _jsx("div", {
|
|
60
|
-
className:
|
|
61
|
-
children:
|
|
86
|
+
className: colorTextPrefixCls,
|
|
87
|
+
children: desc
|
|
62
88
|
})]
|
|
63
89
|
}));
|
|
64
90
|
});
|