@tendaui/react 1.1.1 → 1.1.2
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/es/_chunks/{dep-D7LanWes.js → dep-4LYjB3c6.js} +3 -18
- package/es/_chunks/dep-4LYjB3c6.js.map +1 -0
- package/es/_chunks/dep-5U9UjDaf.js +345 -0
- package/es/_chunks/dep-5U9UjDaf.js.map +1 -0
- package/es/_chunks/{dep-B7HmDtze.js → dep-B4_O1Vgv.js} +2 -2
- package/es/_chunks/{dep-B7HmDtze.js.map → dep-B4_O1Vgv.js.map} +1 -1
- package/es/_chunks/dep-BP0-apUT.js.map +1 -1
- package/es/_chunks/dep-BRbJGDI9.js +7 -0
- package/es/_chunks/dep-BRbJGDI9.js.map +1 -0
- package/es/_chunks/{dep-EcrDKDlu.js → dep-BYlJzn45.js} +10 -9
- package/es/_chunks/dep-BYlJzn45.js.map +1 -0
- package/es/_chunks/dep-BbeHB7S3.js +116 -0
- package/es/_chunks/dep-BbeHB7S3.js.map +1 -0
- package/es/_chunks/{dep-DB5wmwh1.js → dep-Bjfn7Zv_.js} +2 -2
- package/es/_chunks/{dep-DB5wmwh1.js.map → dep-Bjfn7Zv_.js.map} +1 -1
- package/es/_chunks/{dep-C36au4Ip.js → dep-BuIAffJt.js} +2 -2
- package/es/_chunks/{dep-C36au4Ip.js.map → dep-BuIAffJt.js.map} +1 -1
- package/es/_chunks/{dep-bWaVq_y3.js → dep-ByzdZjUR.js} +2 -2
- package/es/_chunks/dep-ByzdZjUR.js.map +1 -0
- package/es/_chunks/dep-CD_4-1Xb.js +103 -0
- package/es/_chunks/dep-CD_4-1Xb.js.map +1 -0
- package/es/_chunks/{dep-Dk2xX8lh.js → dep-CJCt0IS0.js} +5 -212
- package/es/_chunks/dep-CJCt0IS0.js.map +1 -0
- package/es/_chunks/dep-CMPsNAXF.js +52 -0
- package/es/_chunks/dep-CMPsNAXF.js.map +1 -0
- package/es/_chunks/dep-COy5g3FT.js +512 -0
- package/es/_chunks/dep-COy5g3FT.js.map +1 -0
- package/es/_chunks/{dep-CoIiHOgo.js → dep-CRURwzDj.js} +3 -3
- package/es/_chunks/{dep-CoIiHOgo.js.map → dep-CRURwzDj.js.map} +1 -1
- package/es/_chunks/dep-C_wPqvpm.js +36 -0
- package/es/_chunks/dep-C_wPqvpm.js.map +1 -0
- package/es/_chunks/dep-Ccktr_jk.js +33 -0
- package/es/_chunks/dep-Ccktr_jk.js.map +1 -0
- package/es/_chunks/dep-Chz4ZJCb.js +20 -0
- package/es/_chunks/dep-Chz4ZJCb.js.map +1 -0
- package/es/_chunks/dep-CkmtEv0Y.js +55 -0
- package/es/_chunks/dep-CkmtEv0Y.js.map +1 -0
- package/es/_chunks/dep-DJmE940f.js +764 -0
- package/es/_chunks/dep-DJmE940f.js.map +1 -0
- package/es/_chunks/{dep-DHWwZ2Nj.js → dep-DQ6kXoi8.js} +2 -2
- package/es/_chunks/{dep-DHWwZ2Nj.js.map → dep-DQ6kXoi8.js.map} +1 -1
- package/es/_chunks/{dep-0QH2Ee4R.js → dep-DRwijJcv.js} +5 -5
- package/es/_chunks/dep-DRwijJcv.js.map +1 -0
- package/es/_chunks/dep-DTlQ2dCA.js +46 -0
- package/es/_chunks/dep-DTlQ2dCA.js.map +1 -0
- package/es/_chunks/dep-DURB9x8g.js +170 -0
- package/es/_chunks/dep-DURB9x8g.js.map +1 -0
- package/es/_chunks/{dep-DZ_0EvBk.js → dep-DX65P8M9.js} +4 -45
- package/es/_chunks/dep-DX65P8M9.js.map +1 -0
- package/es/_chunks/{dep-BH5n5r1M.js → dep-DbVHGoUC.js} +2 -2
- package/es/_chunks/dep-DbVHGoUC.js.map +1 -0
- package/es/_chunks/dep-Dlppf0JU.js +214 -0
- package/es/_chunks/dep-Dlppf0JU.js.map +1 -0
- package/es/_chunks/dep-Dr5wkz0z.js +266 -0
- package/es/_chunks/dep-Dr5wkz0z.js.map +1 -0
- package/es/_chunks/dep-DwWrhxkd.js.map +1 -1
- package/es/_chunks/dep-Tshfumgl.js +31 -0
- package/es/_chunks/dep-Tshfumgl.js.map +1 -0
- package/es/_chunks/{dep-u1x3x6MJ.js → dep-gy8uvBaS.js} +2 -2
- package/es/_chunks/{dep-u1x3x6MJ.js.map → dep-gy8uvBaS.js.map} +1 -1
- package/es/_chunks/dep-oUgTcXgm.js +11 -0
- package/es/_chunks/dep-oUgTcXgm.js.map +1 -0
- package/es/_chunks/dep-zOZQ0R9g.js +1181 -0
- package/es/_chunks/dep-zOZQ0R9g.js.map +1 -0
- package/es/alert/Alert.d.ts +7 -0
- package/es/alert/Alert.js +4 -3
- package/es/alert/Alert.js.map +1 -1
- package/es/alert/defaultProps.d.ts +2 -0
- package/es/alert/index.d.ts +5 -0
- package/es/alert/index.js +4 -3
- package/es/alert/index.js.map +1 -1
- package/es/alert/style/css.d.ts +1 -0
- package/es/alert/style/index.d.ts +1 -0
- package/es/alert/type.d.ts +45 -0
- package/es/badge/Badge.d.ts +7 -0
- package/es/badge/Badge.js +3 -2
- package/es/badge/Badge.js.map +1 -1
- package/es/badge/defaultProps.d.ts +2 -0
- package/es/badge/index.d.ts +5 -0
- package/es/badge/index.js +3 -2
- package/es/badge/index.js.map +1 -1
- package/es/badge/style/css.d.ts +1 -0
- package/es/badge/style/index.d.ts +1 -0
- package/es/badge/type.d.ts +50 -0
- package/es/button/Button.d.ts +6 -0
- package/es/button/Button.js +7 -5
- package/es/button/Button.js.map +1 -1
- package/es/button/_example/base.js +171 -0
- package/es/button/_example/base.js.map +1 -0
- package/es/button/_example/icon.js +181 -0
- package/es/button/_example/icon.js.map +1 -0
- package/es/button/defaultProps.d.ts +2 -0
- package/es/button/index.d.ts +5 -0
- package/es/button/index.js +7 -5
- package/es/button/index.js.map +1 -1
- package/es/button/style/css.d.ts +1 -0
- package/es/button/style/index.d.ts +1 -0
- package/es/button/type.d.ts +81 -0
- package/es/checkbox/Checkbox.d.ts +10 -0
- package/es/checkbox/Checkbox.js +5 -4
- package/es/checkbox/Checkbox.js.map +1 -1
- package/es/checkbox/CheckboxGroup.d.ts +14 -0
- package/es/checkbox/CheckboxGroup.js +5 -4
- package/es/checkbox/CheckboxGroup.js.map +1 -1
- package/es/checkbox/defaultProps.d.ts +3 -0
- package/es/checkbox/index.d.ts +11 -0
- package/es/checkbox/index.js +5 -4
- package/es/checkbox/index.js.map +1 -1
- package/es/checkbox/style/css.d.ts +1 -0
- package/es/checkbox/style/index.d.ts +1 -0
- package/es/checkbox/type.d.ts +115 -0
- package/es/color-picker/ColorPickPanel.d.ts +4 -0
- package/es/color-picker/ColorPickPanel.js +44 -0
- package/es/color-picker/ColorPickPanel.js.map +1 -0
- package/es/color-picker/ColorPicker.d.ts +4 -0
- package/es/color-picker/ColorPicker.js +118 -0
- package/es/color-picker/ColorPicker.js.map +1 -0
- package/es/color-picker/components/panel/alpha.d.ts +4 -0
- package/es/color-picker/components/panel/alpha.js +44 -0
- package/es/color-picker/components/panel/alpha.js.map +1 -0
- package/es/color-picker/components/panel/format/index.d.ts +10 -0
- package/es/color-picker/components/panel/format/index.js +128 -0
- package/es/color-picker/components/panel/format/index.js.map +1 -0
- package/es/color-picker/components/panel/format/inputs.d.ts +4 -0
- package/es/color-picker/components/panel/format/inputs.js +147 -0
- package/es/color-picker/components/panel/format/inputs.js.map +1 -0
- package/es/color-picker/components/panel/header.d.ts +13 -0
- package/es/color-picker/components/panel/header.js +60 -0
- package/es/color-picker/components/panel/header.js.map +1 -0
- package/es/color-picker/components/panel/hue.d.ts +4 -0
- package/es/color-picker/components/panel/hue.js +33 -0
- package/es/color-picker/components/panel/hue.js.map +1 -0
- package/es/color-picker/components/panel/index.d.ts +4 -0
- package/es/color-picker/components/panel/index.js +32 -0
- package/es/color-picker/components/panel/index.js.map +1 -0
- package/es/color-picker/components/panel/saturation.d.ts +4 -0
- package/es/color-picker/components/panel/saturation.js +101 -0
- package/es/color-picker/components/panel/saturation.js.map +1 -0
- package/es/color-picker/components/panel/slider.d.ts +11 -0
- package/es/color-picker/components/panel/slider.js +121 -0
- package/es/color-picker/components/panel/slider.js.map +1 -0
- package/es/color-picker/components/panel/swatches.d.ts +11 -0
- package/es/color-picker/components/panel/swatches.js +100 -0
- package/es/color-picker/components/panel/swatches.js.map +1 -0
- package/es/color-picker/components/trigger.d.ts +9 -0
- package/es/color-picker/components/trigger.js +73 -0
- package/es/color-picker/components/trigger.js.map +1 -0
- package/es/color-picker/defaultProps.d.ts +2 -0
- package/es/color-picker/helpers.d.ts +5 -0
- package/es/color-picker/hooks/useClassNames.d.ts +2 -0
- package/es/color-picker/hooks/useStyles.d.ts +14 -0
- package/es/color-picker/index.d.ts +6 -0
- package/es/color-picker/index.js +62 -0
- package/es/color-picker/index.js.map +1 -0
- package/es/color-picker/style/index.css +597 -0
- package/es/color-picker/style/index.d.ts +1 -0
- package/es/color-picker/style/index.js +2 -0
- package/es/color-picker/style/index.js.map +1 -0
- package/es/color-picker/type.d.ts +135 -0
- package/es/color-picker/utils/color-picker/cmyk.d.ts +27 -0
- package/es/color-picker/utils/color-picker/color.d.ts +144 -0
- package/es/color-picker/utils/color-picker/constants.d.ts +30 -0
- package/es/color-picker/utils/color-picker/draggable.d.ts +23 -0
- package/es/color-picker/utils/color-picker/format.d.ts +64 -0
- package/es/color-picker/utils/color-picker/gradient.d.ts +22 -0
- package/es/color-picker/utils/color-picker/index.d.ts +7 -0
- package/es/color-picker/utils/color-picker/index.js +147 -0
- package/es/color-picker/utils/color-picker/index.js.map +1 -0
- package/es/color-picker/utils/color-picker/types.d.ts +28 -0
- package/es/common/Check.d.ts +22 -0
- package/es/common/Check.js +4 -3
- package/es/common/Check.js.map +1 -1
- package/es/common/FakeArrow.d.ts +9 -0
- package/es/common/FakeArrow.js +3 -2
- package/es/common/FakeArrow.js.map +1 -1
- package/es/common/PluginContainer.d.ts +9 -0
- package/es/common/PluginContainer.js +2 -1
- package/es/common/PluginContainer.js.map +1 -1
- package/es/common/Portal.d.ts +16 -0
- package/es/common/Portal.js +6 -3
- package/es/common/Portal.js.map +1 -1
- package/es/common/observe.d.ts +1 -0
- package/es/common.d.ts +81 -0
- package/es/config-provider/ConfigContext.d.ts +13 -0
- package/es/config-provider/ConfigContext.js +5 -16
- package/es/config-provider/ConfigContext.js.map +1 -1
- package/es/config-provider/ConfigProvider.d.ts +25 -0
- package/es/config-provider/ConfigProvider.js +2 -1
- package/es/config-provider/ConfigProvider.js.map +1 -1
- package/es/config-provider/index.d.ts +7 -0
- package/es/config-provider/index.js +2 -1
- package/es/config-provider/index.js.map +1 -1
- package/es/config-provider/type.d.ts +1029 -0
- package/es/dialog/Dialog.d.ts +8 -0
- package/es/dialog/Dialog.js +12 -149
- package/es/dialog/Dialog.js.map +1 -1
- package/es/dialog/DialogCard.d.ts +8 -0
- package/es/dialog/DialogCard.js +9 -7
- package/es/dialog/DialogCard.js.map +1 -1
- package/es/dialog/defaultProps.d.ts +6 -0
- package/es/dialog/hooks/useDialogDrag.d.ts +7 -0
- package/es/dialog/hooks/useDialogEsc.d.ts +3 -0
- package/es/dialog/hooks/useDialogPosition.d.ts +2 -0
- package/es/dialog/hooks/useLockStyle.d.ts +2 -0
- package/es/dialog/index.d.ts +8 -0
- package/es/dialog/index.js +12 -8
- package/es/dialog/index.js.map +1 -1
- package/es/dialog/plugin.d.ts +6 -0
- package/es/dialog/plugin.js +15 -10
- package/es/dialog/plugin.js.map +1 -1
- package/es/dialog/style/css.d.ts +1 -0
- package/es/dialog/style/index.d.ts +1 -0
- package/es/dialog/type.d.ts +227 -0
- package/es/dialog/utils.d.ts +1 -0
- package/es/drawer/Drawer.d.ts +11 -0
- package/es/drawer/Drawer.js +458 -0
- package/es/drawer/Drawer.js.map +1 -0
- package/es/drawer/defaultProps.d.ts +2 -0
- package/es/drawer/hooks/useDrag.d.ts +8 -0
- package/es/drawer/hooks/useLockStyle.d.ts +1 -0
- package/es/drawer/index.d.ts +4 -0
- package/es/drawer/index.js +39 -0
- package/es/drawer/index.js.map +1 -0
- package/es/drawer/style/css.d.ts +1 -0
- package/es/drawer/style/css.js +1 -0
- package/es/drawer/style/index.css +231 -0
- package/es/drawer/style/index.d.ts +1 -0
- package/es/drawer/style/index.js +2 -0
- package/es/drawer/style/index.js.map +1 -0
- package/es/drawer/type.d.ts +199 -0
- package/es/drawer/utils/index.d.ts +23 -0
- package/es/drawer/utils/index.js +46 -0
- package/es/drawer/utils/index.js.map +1 -0
- package/es/fireworks/Fireworks.d.ts +7 -0
- package/es/fireworks/Fireworks.js +139 -0
- package/es/fireworks/Fireworks.js.map +1 -0
- package/es/fireworks/index.d.ts +5 -0
- package/es/fireworks/index.js +16 -0
- package/es/fireworks/index.js.map +1 -0
- package/es/fireworks/style/css.d.ts +1 -0
- package/es/fireworks/style/css.js +2 -0
- package/es/fireworks/style/index.css +121 -0
- package/es/fireworks/style/index.d.ts +1 -0
- package/es/fireworks/style/index.js +2 -0
- package/es/fireworks/style/index.js.map +1 -0
- package/es/fireworks/type.d.ts +69 -0
- package/es/form/Form.d.ts +8 -0
- package/es/form/Form.js +14 -10
- package/es/form/Form.js.map +1 -1
- package/es/form/FormContext.d.ts +59 -0
- package/es/form/FormItem.d.ts +23 -0
- package/es/form/FormItem.js +14 -10
- package/es/form/FormItem.js.map +1 -1
- package/es/form/FormList.d.ts +4 -0
- package/es/form/FormList.js +2 -1
- package/es/form/FormList.js.map +1 -1
- package/es/form/const.d.ts +6 -0
- package/es/form/defaultProps.d.ts +3 -0
- package/es/form/easing.d.ts +2 -0
- package/es/form/formModel.d.ts +37 -0
- package/es/form/hooks/interface.d.ts +16 -0
- package/es/form/hooks/useForm.d.ts +3 -0
- package/es/form/hooks/useFormItemInitialData.d.ts +9 -0
- package/es/form/hooks/useFormItemStyle.d.ts +10 -0
- package/es/form/hooks/useFormItemStyle.js +4 -3
- package/es/form/hooks/useFormItemStyle.js.map +1 -1
- package/es/form/hooks/useInstance.d.ts +16 -0
- package/es/form/hooks/useInstance.js +5 -4
- package/es/form/hooks/useInstance.js.map +1 -1
- package/es/form/hooks/useWatch.d.ts +3 -0
- package/es/form/index.d.ts +7 -0
- package/es/form/index.js +14 -10
- package/es/form/index.js.map +1 -1
- package/es/form/scroll.d.ts +39 -0
- package/es/form/style/css.d.ts +1 -0
- package/es/form/style/index.d.ts +1 -0
- package/es/form/type.d.ts +486 -0
- package/es/form/utils/index.d.ts +5 -0
- package/es/global-config/default-config.d.ts +84 -0
- package/es/global-config/locale/ar_KW.d.ts +239 -0
- package/es/global-config/locale/en_US.d.ts +263 -0
- package/es/global-config/locale/it_IT.d.ts +263 -0
- package/es/global-config/locale/ja_JP.d.ts +263 -0
- package/es/global-config/locale/ko_KR.d.ts +263 -0
- package/es/global-config/locale/ru_RU.d.ts +263 -0
- package/es/global-config/locale/zh_CN.d.ts +263 -0
- package/es/global-config/locale/zh_TW.d.ts +263 -0
- package/es/global-config/mobile/default-config.d.ts +7 -0
- package/es/global-config/mobile/locale/ar_KW.d.ts +98 -0
- package/es/global-config/mobile/locale/en_US.d.ts +99 -0
- package/es/global-config/mobile/locale/it_IT.d.ts +99 -0
- package/es/global-config/mobile/locale/ja_JP.d.ts +99 -0
- package/es/global-config/mobile/locale/ko_KR.d.ts +99 -0
- package/es/global-config/mobile/locale/ru_RU.d.ts +99 -0
- package/es/global-config/mobile/locale/zh_CN.d.ts +99 -0
- package/es/global-config/mobile/locale/zh_TW.d.ts +99 -0
- package/es/global-config/t.d.ts +25 -0
- package/es/hooks/useAttach.d.ts +10 -0
- package/es/hooks/useCommonClassName.d.ts +54 -0
- package/es/hooks/useConfig.d.ts +2 -0
- package/es/hooks/useControlled.d.ts +9 -0
- package/es/hooks/useDeepEffect.d.ts +7 -0
- package/es/hooks/useDefaultProps.d.ts +1 -0
- package/es/hooks/useDomCallback.d.ts +1 -0
- package/es/hooks/useDomRefCallback.d.ts +1 -0
- package/es/hooks/useDragSorter.d.ts +28 -0
- package/es/hooks/useEventCallback.d.ts +9 -0
- package/es/hooks/useGlobalConfig.d.ts +1 -0
- package/es/hooks/useGlobalIcon.d.ts +5 -0
- package/es/hooks/useLastest.d.ts +2 -0
- package/es/hooks/useLayoutEffect.d.ts +3 -0
- package/es/hooks/useMouseEvent.d.ts +25 -0
- package/es/hooks/useMutationObserver.d.ts +4 -0
- package/es/hooks/usePopper.d.ts +19 -0
- package/es/hooks/useResizeObserve.d.ts +1 -0
- package/es/hooks/useRipple.d.ts +0 -0
- package/es/hooks/useSetState.d.ts +7 -0
- package/es/hooks/useVirtualScroll.d.ts +30 -0
- package/es/hooks/useWindowSize.d.ts +6 -0
- package/es/index.d.ts +25 -0
- package/es/index.js +68 -14
- package/es/index.js.map +1 -1
- package/es/input/Input.d.ts +16 -0
- package/es/input/Input.js +5 -5
- package/es/input/Input.js.map +1 -1
- package/es/input/InputGroup.d.ts +10 -0
- package/es/input/defaultProps.d.ts +17 -0
- package/es/input/index.d.ts +6 -0
- package/es/input/index.js +5 -3
- package/es/input/index.js.map +1 -1
- package/es/input/style/css.d.ts +1 -0
- package/es/input/style/index.d.ts +1 -0
- package/es/input/type.d.ts +237 -0
- package/es/input-number/InputNumber.d.ts +17 -0
- package/es/input-number/InputNumber.js +139 -0
- package/es/input-number/InputNumber.js.map +1 -0
- package/es/input-number/defaultProps.d.ts +2 -0
- package/es/input-number/index.d.ts +5 -0
- package/es/input-number/index.js +43 -0
- package/es/input-number/index.js.map +1 -0
- package/es/input-number/style/css.d.ts +1 -0
- package/es/input-number/style/css.js +1 -0
- package/es/input-number/style/index.css +331 -0
- package/es/input-number/style/index.d.ts +1 -0
- package/es/input-number/style/index.js +2 -0
- package/es/input-number/style/index.js.map +1 -0
- package/es/input-number/type.d.ts +156 -0
- package/es/input-number/useInputNumber.d.ts +51 -0
- package/es/input-number/useInputNumber.js +809 -0
- package/es/input-number/useInputNumber.js.map +1 -0
- package/es/ip-input/IPInput.d.ts +5 -0
- package/es/ip-input/IPInput.js +16 -0
- package/es/ip-input/IPInput.js.map +1 -0
- package/es/ip-input/defaultProps.d.ts +2 -0
- package/es/ip-input/index.d.ts +3 -0
- package/es/ip-input/index.js +16 -0
- package/es/ip-input/index.js.map +1 -0
- package/es/ip-input/style/index.css +323 -0
- package/es/ip-input/style/index.d.ts +1 -0
- package/es/ip-input/style/index.js +2 -0
- package/es/ip-input/style/index.js.map +1 -0
- package/es/ip-input/type.d.ts +113 -0
- package/es/ip-input/utils.d.ts +35 -0
- package/es/layout/Aside.d.ts +11 -0
- package/es/layout/Aside.js +41 -0
- package/es/layout/Aside.js.map +1 -0
- package/es/layout/Layout.d.ts +26 -0
- package/es/layout/Layout.js +106 -0
- package/es/layout/Layout.js.map +1 -0
- package/es/layout/defaultProps.d.ts +5 -0
- package/es/layout/index.d.ts +10 -0
- package/es/layout/index.js +19 -0
- package/es/layout/index.js.map +1 -0
- package/es/layout/style/index.css +56 -0
- package/es/layout/style/index.d.ts +1 -0
- package/es/layout/style/index.js +2 -0
- package/es/layout/style/index.js.map +1 -0
- package/es/layout/type.d.ts +38 -0
- package/es/list/List.d.ts +17 -0
- package/es/list/List.js +217 -0
- package/es/list/List.js.map +1 -0
- package/es/list/ListItem.d.ts +15 -0
- package/es/list/ListItem.js +31 -0
- package/es/list/ListItem.js.map +1 -0
- package/es/list/ListItemMeta.d.ts +10 -0
- package/es/list/ListItemMeta.js +45 -0
- package/es/list/ListItemMeta.js.map +1 -0
- package/es/list/defaultProps.d.ts +7 -0
- package/es/list/hooks/useListVirtualScroll.d.ts +24 -0
- package/es/list/index.d.ts +10 -0
- package/es/list/index.js +40 -0
- package/es/list/index.js.map +1 -0
- package/es/list/style/css.d.ts +1 -0
- package/es/list/style/css.js +1 -0
- package/es/list/style/index.css +172 -0
- package/es/list/style/index.d.ts +1 -0
- package/es/list/style/index.js +2 -0
- package/es/list/style/index.js.map +1 -0
- package/es/list/type.d.ts +92 -0
- package/es/loading/Gradient.d.ts +6 -0
- package/es/loading/Gradient.js +4 -3
- package/es/loading/Gradient.js.map +1 -1
- package/es/loading/Loading.d.ts +7 -0
- package/es/loading/Loading.js +7 -5
- package/es/loading/Loading.js.map +1 -1
- package/es/loading/circleAdapter.d.ts +1 -0
- package/es/loading/defaultProps.d.ts +2 -0
- package/es/loading/index.d.ts +5 -0
- package/es/loading/index.js +7 -5
- package/es/loading/index.js.map +1 -1
- package/es/loading/style/css.d.ts +1 -0
- package/es/loading/style/index.d.ts +1 -0
- package/es/loading/type.d.ts +68 -0
- package/es/loading/utils/setStyle.d.ts +7 -0
- package/es/locale/LocalReceiver.d.ts +6 -0
- package/es/locale/ar_KW.d.ts +3 -0
- package/es/locale/en_US.d.ts +3 -0
- package/es/locale/it_IT.d.ts +3 -0
- package/es/locale/ja_JP.d.ts +3 -0
- package/es/locale/ko_KR.d.ts +3 -0
- package/es/locale/ru_RU.d.ts +3 -0
- package/es/locale/zh_CN.d.ts +3 -0
- package/es/locale/zh_TW.d.ts +3 -0
- package/es/myform/index.d.ts +0 -0
- package/es/notification/Notify.d.ts +11 -0
- package/es/notification/NotifyContainer.d.ts +13 -0
- package/es/notification/NotifyContainer.js +3 -2
- package/es/notification/NotifyContainer.js.map +1 -1
- package/es/notification/NotifyContext.d.ts +23 -0
- package/es/notification/NotifyContext.js +3 -2
- package/es/notification/NotifyContext.js.map +1 -1
- package/es/notification/NotifyItem.d.ts +4 -0
- package/es/notification/NotifyItem.js +3 -2
- package/es/notification/NotifyItem.js.map +1 -1
- package/es/notification/index.d.ts +3 -0
- package/es/notification/index.js +3 -2
- package/es/notification/index.js.map +1 -1
- package/es/notification/style/css.d.ts +1 -0
- package/es/notification/style/index.d.ts +1 -0
- package/es/notification/type.d.ts +22 -0
- package/es/popup/Popup.d.ts +21 -0
- package/es/popup/Popup.js +36 -100
- package/es/popup/Popup.js.map +1 -1
- package/es/popup/defaultProps.d.ts +5 -0
- package/es/popup/hooks/useTrigger.d.ts +20 -0
- package/es/popup/index.d.ts +5 -0
- package/es/popup/index.js +8 -4
- package/es/popup/index.js.map +1 -1
- package/es/popup/style/css.d.ts +1 -0
- package/es/popup/style/index.d.ts +1 -0
- package/es/popup/type.d.ts +109 -0
- package/es/portal/Portal.d.ts +16 -0
- package/es/portal/Portal.js +2 -1
- package/es/portal/Portal.js.map +1 -1
- package/es/portal/index.d.ts +1 -0
- package/es/portal/index.js +2 -1
- package/es/portal/index.js.map +1 -1
- package/es/radio/Radio.d.ts +8 -0
- package/es/radio/Radio.js +22 -0
- package/es/radio/Radio.js.map +1 -0
- package/es/radio/RadioGroup.d.ts +14 -0
- package/es/radio/RadioGroup.js +22 -0
- package/es/radio/RadioGroup.js.map +1 -0
- package/es/radio/defaultProps.d.ts +3 -0
- package/es/radio/index.d.ts +10 -0
- package/es/radio/index.js +28 -0
- package/es/radio/index.js.map +1 -0
- package/es/radio/style/css.d.ts +0 -0
- package/es/radio/style/css.js +0 -0
- package/es/radio/style/index.css +333 -0
- package/es/radio/style/index.d.ts +1 -0
- package/es/radio/style/index.js +2 -0
- package/es/radio/style/index.js.map +1 -0
- package/es/radio/type.d.ts +117 -0
- package/es/radio/useKeyboard.d.ts +4 -0
- package/es/select/Option.d.ts +24 -0
- package/es/select/Option.js +3 -2
- package/es/select/Option.js.map +1 -1
- package/es/select/OptionGroup.d.ts +7 -0
- package/es/select/OptionGroup.js +4 -3
- package/es/select/OptionGroup.js.map +1 -1
- package/es/select/PopupContent.d.ts +24 -0
- package/es/select/PopupContent.js +6 -4
- package/es/select/PopupContent.js.map +1 -1
- package/es/select/Select.d.ts +13 -0
- package/es/select/Select.js +21 -12
- package/es/select/Select.js.map +1 -1
- package/es/select/defaultProps.d.ts +4 -0
- package/es/select/hooks/useOptions.d.ts +16 -0
- package/es/select/hooks/usePanelVirtualScroll.d.ts +24 -0
- package/es/select/index.d.ts +8 -0
- package/es/select/index.js +14 -8
- package/es/select/index.js.map +1 -1
- package/es/select/style/css.d.ts +1 -0
- package/es/select/style/index.d.ts +1 -0
- package/es/select/type.d.ts +344 -0
- package/es/select/utils/helper.d.ts +18 -0
- package/es/select-input/SelectInput.d.ts +11 -0
- package/es/select-input/SelectInput.js +10 -5
- package/es/select-input/SelectInput.js.map +1 -1
- package/es/select-input/defaultProps.d.ts +2 -0
- package/es/select-input/hook/useMultiple.d.ts +23 -0
- package/es/select-input/hook/useMultiple.js +7 -4
- package/es/select-input/hook/useMultiple.js.map +1 -1
- package/es/select-input/hook/useOverlayInnerStyle.d.ts +11 -0
- package/es/select-input/hook/useSingle.d.ts +16 -0
- package/es/select-input/hook/useSingle.js +5 -3
- package/es/select-input/hook/useSingle.js.map +1 -1
- package/es/select-input/index.d.ts +5 -0
- package/es/select-input/index.js +10 -5
- package/es/select-input/index.js.map +1 -1
- package/es/select-input/interface.d.ts +17 -0
- package/es/select-input/style/css.d.ts +1 -0
- package/es/select-input/style/index.d.ts +1 -0
- package/es/select-input/type.d.ts +243 -0
- package/es/slider/Slider.d.ts +7 -0
- package/es/slider/Slider.js +668 -0
- package/es/slider/Slider.js.map +1 -0
- package/es/slider/SliderHandleButton.d.ts +11 -0
- package/es/slider/SliderHandleButton.js +48 -0
- package/es/slider/SliderHandleButton.js.map +1 -0
- package/es/slider/defaultProps.d.ts +5 -0
- package/es/slider/index.d.ts +5 -0
- package/es/slider/index.js +46 -0
- package/es/slider/index.js.map +1 -0
- package/es/slider/style/css.d.ts +1 -0
- package/es/slider/style/css.js +1 -0
- package/es/slider/style/index.css +252 -0
- package/es/slider/style/index.d.ts +1 -0
- package/es/slider/style/index.js +2 -0
- package/es/slider/style/index.js.map +1 -0
- package/es/slider/type.d.ts +78 -0
- package/es/space/defaultProps.d.ts +0 -0
- package/es/space/index.d.ts +0 -0
- package/es/space/type.d.ts +0 -0
- package/es/style/index.css +24 -34
- package/es/style/index.d.ts +1 -0
- package/es/switch/Switch.d.ts +9 -0
- package/es/switch/Switch.js +9 -47
- package/es/switch/Switch.js.map +1 -1
- package/es/switch/defaultProps.d.ts +2 -0
- package/es/switch/index.d.ts +4 -0
- package/es/switch/index.js +8 -5
- package/es/switch/index.js.map +1 -1
- package/es/switch/style/css.d.ts +1 -0
- package/es/switch/style/index.d.ts +1 -0
- package/es/switch/type.d.ts +48 -0
- package/es/tab/TabBar.d.ts +9 -0
- package/es/tab/TabBar.js +109 -0
- package/es/tab/TabBar.js.map +1 -0
- package/es/tab/TabNav.d.ts +10 -0
- package/es/tab/TabNav.js +123 -0
- package/es/tab/TabNav.js.map +1 -0
- package/es/tab/TabNavItem.d.ts +15 -0
- package/es/tab/TabNavItem.js +65 -0
- package/es/tab/TabNavItem.js.map +1 -0
- package/es/tab/TabPanel.d.ts +9 -0
- package/es/tab/TabPanel.js +11 -0
- package/es/tab/TabPanel.js.map +1 -0
- package/es/tab/Tabs.d.ts +10 -0
- package/es/tab/Tabs.js +95 -0
- package/es/tab/Tabs.js.map +1 -0
- package/es/tab/defaultProps.d.ts +3 -0
- package/es/tab/index.d.ts +8 -0
- package/es/tab/index.js +31 -0
- package/es/tab/index.js.map +1 -0
- package/es/tab/style/index.css +159 -0
- package/es/tab/style/index.d.ts +1 -0
- package/es/tab/style/index.js +2 -0
- package/es/tab/style/index.js.map +1 -0
- package/es/tab/type.d.ts +130 -0
- package/es/tab/useTabClass.d.ts +8 -0
- package/es/table/Cell.d.ts +18 -0
- package/es/table/Cell.js +73 -0
- package/es/table/Cell.js.map +1 -0
- package/es/table/TBody.d.ts +28 -0
- package/es/table/TBody.js +70 -0
- package/es/table/TBody.js.map +1 -0
- package/es/table/THead.d.ts +10 -0
- package/es/table/THead.js +56 -0
- package/es/table/THead.js.map +1 -0
- package/es/table/TR.d.ts +28 -0
- package/es/table/TR.js +76 -0
- package/es/table/TR.js.map +1 -0
- package/es/table/Table.d.ts +6 -0
- package/es/table/Table.js +98 -0
- package/es/table/Table.js.map +1 -0
- package/es/table/defaultProps.d.ts +2 -0
- package/es/table/hooks/index.d.ts +4 -0
- package/es/table/hooks/index.js +98 -0
- package/es/table/hooks/index.js.map +1 -0
- package/es/table/hooks/useTableClassName.d.ts +26 -0
- package/es/table/hooks/useTableStyle.d.ts +11 -0
- package/es/table/index.d.ts +5 -0
- package/es/table/index.js +22 -0
- package/es/table/index.js.map +1 -0
- package/es/table/style/css.d.ts +1 -0
- package/es/table/style/css.js +1 -0
- package/es/table/style/index.css +139 -0
- package/es/table/style/index.d.ts +1 -0
- package/es/table/style/index.js +2 -0
- package/es/table/style/index.js.map +1 -0
- package/es/table/type.d.ts +195 -0
- package/es/tag/Tag.d.ts +14 -0
- package/es/tag/Tag.js +5 -1182
- package/es/tag/Tag.js.map +1 -1
- package/es/tag/defaultProps.d.ts +7 -0
- package/es/tag/index.d.ts +4 -0
- package/es/tag/index.js +5 -3
- package/es/tag/index.js.map +1 -1
- package/es/tag/style/css.d.ts +1 -0
- package/es/tag/style/index.d.ts +1 -0
- package/es/tag/type.d.ts +169 -0
- package/es/tag-input/TagInput.d.ts +9 -0
- package/es/tag-input/TagInput.js +7 -4
- package/es/tag-input/TagInput.js.map +1 -1
- package/es/tag-input/defaultProps.d.ts +2 -0
- package/es/tag-input/hooks/useHover.d.ts +17 -0
- package/es/tag-input/hooks/useTagList.d.ts +30 -0
- package/es/tag-input/hooks/useTagList.js +5 -3
- package/es/tag-input/hooks/useTagList.js.map +1 -1
- package/es/tag-input/hooks/useTagScroll.d.ts +25 -0
- package/es/tag-input/index.d.ts +5 -0
- package/es/tag-input/index.js +7 -4
- package/es/tag-input/index.js.map +1 -1
- package/es/tag-input/style/css.d.ts +1 -0
- package/es/tag-input/style/index.d.ts +1 -0
- package/es/tag-input/type.d.ts +235 -0
- package/es/tag-input/useTagList.d.ts +30 -0
- package/es/tag-input/useTagList.js +5 -3
- package/es/tag-input/useTagList.js.map +1 -1
- package/es/utils/composeRefs.d.ts +2 -0
- package/es/utils/dom.d.ts +7 -0
- package/es/utils/forwardRefWithStatics.d.ts +2 -0
- package/es/utils/getScrollbarWidth.d.ts +6 -0
- package/es/utils/helper.d.ts +46 -0
- package/es/utils/input-number/large-number.d.ts +85 -0
- package/es/utils/input-number/number.d.ts +81 -0
- package/es/utils/isFragment.d.ts +4 -0
- package/es/utils/listener.d.ts +4 -0
- package/es/utils/log/index.d.ts +2 -0
- package/es/utils/log/index.js +27 -0
- package/es/utils/log/index.js.map +1 -0
- package/es/utils/log/log.d.ts +3 -0
- package/es/utils/log/types.d.ts +8 -0
- package/es/utils/noop.d.ts +2 -0
- package/es/utils/number.d.ts +7 -0
- package/es/utils/parentTNode.d.ts +10 -0
- package/es/utils/parseTNode.d.ts +10 -0
- package/es/utils/react-render.d.ts +16 -0
- package/es/utils/ref.d.ts +1 -0
- package/es/utils/refs.d.ts +13 -0
- package/es/utils/scroll.d.ts +3 -0
- package/es/utils/style.d.ts +4 -0
- package/es/utils/transition.d.ts +20 -0
- package/package.json +60 -59
- package/LICENSE +0 -21
- package/es/_chunks/dep-0QH2Ee4R.js.map +0 -1
- package/es/_chunks/dep-BH5n5r1M.js.map +0 -1
- package/es/_chunks/dep-D7LanWes.js.map +0 -1
- package/es/_chunks/dep-DZ_0EvBk.js.map +0 -1
- package/es/_chunks/dep-Dk2xX8lh.js.map +0 -1
- package/es/_chunks/dep-EcrDKDlu.js.map +0 -1
- package/es/_chunks/dep-bWaVq_y3.js.map +0 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { _ as _defineProperty } from '../../../../_chunks/dep-Cwish4GD.js';
|
|
2
|
+
import React, { useRef, useEffect } from 'react';
|
|
3
|
+
import { throttle } from 'lodash-es';
|
|
4
|
+
import { getColorFormatMap, getColorFormatInputs } from '../../../utils/color-picker/index.js';
|
|
5
|
+
import { Input } from '../../../../input/index.js';
|
|
6
|
+
import { InputNumber } from '../../../../input-number/index.js';
|
|
7
|
+
import { C as Color } from '../../../../_chunks/dep-DJmE940f.js';
|
|
8
|
+
import '../../../../_chunks/dep-D-UKOauR.js';
|
|
9
|
+
import '../../../../_chunks/dep-Chz4ZJCb.js';
|
|
10
|
+
import '../../../../_chunks/dep-CgyDw_YI.js';
|
|
11
|
+
import '../../../../_chunks/dep-CzLhKWCf.js';
|
|
12
|
+
import '../../../../_chunks/dep-zOZQ0R9g.js';
|
|
13
|
+
import '../../../../input/Input.js';
|
|
14
|
+
import '../../../../_chunks/dep-DN7d1SzH.js';
|
|
15
|
+
import 'classnames';
|
|
16
|
+
import '@tendaui/icons';
|
|
17
|
+
import '../../../../_chunks/dep-BRbJGDI9.js';
|
|
18
|
+
import '../../../../_chunks/dep-DRwijJcv.js';
|
|
19
|
+
import '../../../../_chunks/dep-DwWrhxkd.js';
|
|
20
|
+
import '../../../../_chunks/dep-D6YxJv-F.js';
|
|
21
|
+
import '../../../../_chunks/dep-DGvfel3I.js';
|
|
22
|
+
import '../../../../_chunks/dep-gy8uvBaS.js';
|
|
23
|
+
import '../../../../_chunks/dep-5U9UjDaf.js';
|
|
24
|
+
import 'dayjs';
|
|
25
|
+
import '../../../../input/InputGroup.js';
|
|
26
|
+
import '../../../../input/style/css.js';
|
|
27
|
+
import '../../../../input-number/InputNumber.js';
|
|
28
|
+
import '../../../../button/index.js';
|
|
29
|
+
import '../../../../button/Button.js';
|
|
30
|
+
import '../../../../loading/index.js';
|
|
31
|
+
import '../../../../loading/Loading.js';
|
|
32
|
+
import '../../../../common/Portal.js';
|
|
33
|
+
import 'react-dom';
|
|
34
|
+
import '../../../../loading/Gradient.js';
|
|
35
|
+
import '../../../../_chunks/dep-DQ6kXoi8.js';
|
|
36
|
+
import '../../../../_chunks/dep-PPA-yoAy.js';
|
|
37
|
+
import '../../../../_chunks/dep-DbVHGoUC.js';
|
|
38
|
+
import '../../../../loading/style/css.js';
|
|
39
|
+
import '../../../../button/style/css.js';
|
|
40
|
+
import '../../../../input-number/useInputNumber.js';
|
|
41
|
+
import '../../../../utils/log/index.js';
|
|
42
|
+
import '../../../../_chunks/dep-DTlQ2dCA.js';
|
|
43
|
+
import '../../../../_chunks/dep-ByzdZjUR.js';
|
|
44
|
+
import '../../../../input-number/style/css.js';
|
|
45
|
+
|
|
46
|
+
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; }
|
|
47
|
+
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; }
|
|
48
|
+
var FormatInputs = function FormatInputs(props) {
|
|
49
|
+
var format = props.format,
|
|
50
|
+
enableAlpha = props.enableAlpha,
|
|
51
|
+
inputProps = props.inputProps,
|
|
52
|
+
disabled = props.disabled,
|
|
53
|
+
onInputChange = props.onInputChange,
|
|
54
|
+
color = props.color;
|
|
55
|
+
var modelValueRef = useRef({});
|
|
56
|
+
var lastModelValue = useRef({});
|
|
57
|
+
var inputKey = useRef(0);
|
|
58
|
+
var updateModelValue = function updateModelValue() {
|
|
59
|
+
var value = getColorFormatMap(color, "encode")[format];
|
|
60
|
+
if (!value || typeof value === "string") return;
|
|
61
|
+
var valueObj = value;
|
|
62
|
+
if (enableAlpha && "a" in valueObj) {
|
|
63
|
+
valueObj.a = Math.round(color.alpha * 100);
|
|
64
|
+
}
|
|
65
|
+
var changedFormatValue = {};
|
|
66
|
+
Object.keys(valueObj).forEach(function (key) {
|
|
67
|
+
if (valueObj[key] !== modelValueRef.current[key]) {
|
|
68
|
+
changedFormatValue[key] = valueObj[key];
|
|
69
|
+
}
|
|
70
|
+
lastModelValue.current[key] = valueObj[key];
|
|
71
|
+
});
|
|
72
|
+
if (Object.keys(changedFormatValue).length > 0) {
|
|
73
|
+
modelValueRef.current = valueObj;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var handleInputChange = function handleInputChange(key, v, max) {
|
|
77
|
+
inputKey.current = performance.now();
|
|
78
|
+
if (v.toString().trim() === "") {
|
|
79
|
+
var lastValue = lastModelValue.current[key];
|
|
80
|
+
color.update(lastValue);
|
|
81
|
+
onInputChange();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (!v || v === lastModelValue.current[key] || Number(v) < 0 || Number(v) > max) return;
|
|
85
|
+
lastModelValue.current[key] = v;
|
|
86
|
+
var newFormatValue = _objectSpread(_objectSpread({}, modelValueRef.current), {}, _defineProperty({}, key, v));
|
|
87
|
+
modelValueRef.current = newFormatValue;
|
|
88
|
+
if (key === "a") {
|
|
89
|
+
color.alpha = v / 100;
|
|
90
|
+
} else if (key === "hex" || key === "css") {
|
|
91
|
+
color.update(v);
|
|
92
|
+
} else {
|
|
93
|
+
color.update(Color.object2color(newFormatValue, format));
|
|
94
|
+
}
|
|
95
|
+
onInputChange();
|
|
96
|
+
};
|
|
97
|
+
updateModelValue();
|
|
98
|
+
useEffect(function () {
|
|
99
|
+
var throttleUpdate = throttle(updateModelValue, 100);
|
|
100
|
+
throttleUpdate();
|
|
101
|
+
return function () {
|
|
102
|
+
return throttleUpdate.cancel();
|
|
103
|
+
};
|
|
104
|
+
}, [color.saturation, color.hue, color.value, color.alpha, format]);
|
|
105
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
106
|
+
className: "input-group"
|
|
107
|
+
}, getColorFormatInputs(format, enableAlpha).map(function (config) {
|
|
108
|
+
var currentValue = modelValueRef.current[config.key];
|
|
109
|
+
var commonProps = _objectSpread(_objectSpread({}, inputProps), {}, {
|
|
110
|
+
disabled: disabled,
|
|
111
|
+
title: currentValue,
|
|
112
|
+
align: "center",
|
|
113
|
+
size: "small",
|
|
114
|
+
onBlur: function onBlur(v) {
|
|
115
|
+
return handleInputChange(config.key, v, config.max);
|
|
116
|
+
},
|
|
117
|
+
onEnter: function onEnter(v) {
|
|
118
|
+
return handleInputChange(config.key, v, config.max);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
122
|
+
className: "input-group__item",
|
|
123
|
+
key: config.key,
|
|
124
|
+
style: {
|
|
125
|
+
flex: config.flex || 1
|
|
126
|
+
}
|
|
127
|
+
}, config.type === "input" ? /* @__PURE__ */React.createElement(Input, _objectSpread(_objectSpread({}, commonProps), {}, {
|
|
128
|
+
defaultValue: currentValue,
|
|
129
|
+
key: "".concat(inputKey.current, "-").concat(currentValue),
|
|
130
|
+
maxlength: format === "HEX" ? 9 : void 0
|
|
131
|
+
})) : /* @__PURE__ */React.createElement(InputNumber, _objectSpread(_objectSpread({}, commonProps), {}, {
|
|
132
|
+
min: config.min,
|
|
133
|
+
max: config.max,
|
|
134
|
+
format: config.format,
|
|
135
|
+
step: 1,
|
|
136
|
+
value: currentValue,
|
|
137
|
+
onChange: function onChange(v) {
|
|
138
|
+
return handleInputChange(config.key, v !== null && v !== void 0 ? v : config.min, config.max);
|
|
139
|
+
},
|
|
140
|
+
theme: "normal"
|
|
141
|
+
})));
|
|
142
|
+
}));
|
|
143
|
+
};
|
|
144
|
+
var FormatInputs$1 = /*#__PURE__*/React.memo(FormatInputs);
|
|
145
|
+
|
|
146
|
+
export { FormatInputs$1 as default };
|
|
147
|
+
//# sourceMappingURL=inputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputs.js","sources":["../../../../../../components/color-picker/components/panel/format/inputs.tsx"],"sourcesContent":["import React, { useRef, useEffect } from \"react\";\nimport { throttle } from \"lodash-es\";\nimport { Color, getColorFormatInputs, getColorFormatMap } from \"../../../utils/color-picker\";\nimport type { TdColorFormatProps } from \".\";\nimport Input from \"../../../../input\";\nimport InputNumber from \"../../../../input-number\";\n\nconst FormatInputs = (props: TdColorFormatProps) => {\n const { format, enableAlpha, inputProps, disabled, onInputChange, color } = props;\n const modelValueRef = useRef<Record<string, number | string>>({});\n const lastModelValue = useRef<Record<string, number | string>>({});\n const inputKey = useRef<number>(0);\n\n const updateModelValue = () => {\n const value = getColorFormatMap(color, \"encode\")[format];\n if (!value || typeof value === \"string\") return;\n\n const valueObj = value as Record<string, number | string>;\n if (enableAlpha && \"a\" in valueObj) {\n valueObj.a = Math.round(color.alpha * 100);\n }\n\n const changedFormatValue: Record<string, number | string> = {};\n Object.keys(valueObj).forEach((key) => {\n if (valueObj[key] !== modelValueRef.current[key]) {\n changedFormatValue[key] = valueObj[key];\n }\n lastModelValue.current[key] = valueObj[key];\n });\n\n if (Object.keys(changedFormatValue).length > 0) {\n modelValueRef.current = valueObj;\n }\n };\n\n const handleInputChange = (key: string, v: number | string, max: number) => {\n inputKey.current = performance.now();\n\n if (v.toString().trim() === \"\") {\n const lastValue = lastModelValue.current[key];\n color.update(lastValue as string);\n onInputChange();\n return;\n }\n\n if (!v || v === lastModelValue.current[key] || Number(v) < 0 || Number(v) > max) return;\n lastModelValue.current[key] = v;\n\n const newFormatValue = {\n ...modelValueRef.current,\n [key]: v\n };\n modelValueRef.current = newFormatValue;\n if (key === \"a\") {\n color.alpha = (v as number) / 100;\n } else if (key === \"hex\" || key === \"css\") {\n color.update(v as string);\n } else {\n color.update(Color.object2color(newFormatValue, format));\n }\n onInputChange();\n };\n\n updateModelValue();\n useEffect(() => {\n const throttleUpdate = throttle(updateModelValue, 100);\n throttleUpdate();\n return () => throttleUpdate.cancel();\n }, [color.saturation, color.hue, color.value, color.alpha, format]);\n\n return (\n <div className=\"input-group\">\n {getColorFormatInputs(format, enableAlpha).map((config) => {\n const currentValue = modelValueRef.current[config.key];\n const commonProps = {\n ...inputProps,\n disabled,\n title: currentValue,\n align: \"center\" as const,\n size: \"small\" as const,\n onBlur: (v: string) => handleInputChange(config.key, v, config.max),\n onEnter: (v: string) => handleInputChange(config.key, v, config.max)\n };\n\n return (\n <div\n className=\"input-group__item\"\n key={config.key}\n style={{\n flex: config.flex || 1\n }}\n >\n {config.type === \"input\" ? (\n <Input\n {...commonProps}\n defaultValue={currentValue as string}\n key={`${inputKey.current}-${currentValue}`}\n maxlength={format === \"HEX\" ? 9 : undefined}\n />\n ) : (\n <InputNumber\n {...commonProps}\n min={config.min}\n max={config.max}\n format={config.format as (value: number) => string}\n step={1}\n value={currentValue as number}\n onChange={(v) => handleInputChange(config.key, v ?? (config.min as number), config.max)}\n theme=\"normal\"\n />\n )}\n </div>\n );\n })}\n </div>\n );\n};\n\nexport default React.memo(FormatInputs);\n"],"names":["FormatInputs","props","format","enableAlpha","inputProps","disabled","onInputChange","color","modelValueRef","useRef","lastModelValue","inputKey","updateModelValue","value","getColorFormatMap","valueObj","a","Math","round","alpha","changedFormatValue","Object","keys","forEach","key","current","length","handleInputChange","v","max","performance","now","toString","trim","lastValue","update","Number","newFormatValue","_objectSpread","_defineProperty","Color","object2color","useEffect","throttleUpdate","throttle","cancel","saturation","hue","React","createElement","className","getColorFormatInputs","map","config","currentValue","commonProps","title","align","size","onBlur","onEnter","style","flex","type","Input","defaultValue","concat","maxlength","InputNumber","min","step","onChange","theme","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAMA,YAAA,GAAe,SAAfA,YAAAA,CAAgBC,KAAA,EAA8B;AAClD,EAAA,IAAQC,MAAA,GAAoED,KAAA,CAApEC,MAAA;IAAQC,WAAA,GAA4DF,KAAA,CAA5DE,WAAA;IAAaC,aAA+CH,KAAA,CAA/CG;IAAYC,QAAA,GAAmCJ,KAAA,CAAnCI,QAAA;IAAUC,aAAA,GAAyBL,KAAA,CAAzBK,aAAA;IAAeC,QAAUN,KAAA,CAAVM;AAClE,EAAA,IAAMC,aAAA,GAAgBC,MAAA,CAAwC,EAAE,CAAA;AAChE,EAAA,IAAMC,cAAA,GAAiBD,MAAA,CAAwC,EAAE,CAAA;AACjE,EAAA,IAAME,QAAA,GAAWF,OAAe,CAAC,CAAA;AAEjC,EAAA,IAAMG,mBAAmB,SAAnBA,mBAAyB;IAC7B,IAAMC,KAAA,GAAQC,iBAAA,CAAkBP,KAAA,EAAO,QAAQ,EAAEL,MAAM,CAAA;AACvD,IAAA,IAAI,CAACW,K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AA,SAAA,EAAWjE,MAAA,KAAW,KAAA,GAAQ,CAAA,GAAI,KAAA;AAAA,KAAA,CACpC,CAAA,kBAEA8C,KAAA,CAAAC,aAAA,CAACmB,WAAA,EAAA9B,aAAA,CAAAA,aAAA,KACKiB,WAAA,CAAA,EAAA,EAAA,EAAA;MACJc,KAAKhB,MAAA,CAAOgB,GAAA;MACZxC,KAAKwB,MAAA,CAAOxB,GAAA;MACZ3B,QAAQmD,MAAA,CAAOnD,MAAA;AACfoE,MAAAA,IAAA,EAAM,CAAA;AACNzD,MAAAA,KAAA,EAAOyC,YAAA;AACPiB,MAAAA,QAAA,EAAU,SAAVA,QAAAA,CAAW3C,CAAA,EAAA;AAAA,QAAA,OAAMD,iBAAA,CAAkB0B,MAAA,CAAO7B,KAAKI,CAAA,KAAA,IAAA,IAAAA,CAAA,cAAAA,CAAA,GAAMyB,MAAA,CAAOgB,GAAA,EAAgBhB,MAAA,CAAOxB,GAAG,CAAA;AAAA,MAAA,CAAA;AACtF2C,MAAAA,KAAA,EAAM;AAAA,KAAA,CACR,CAEJ,CAAA;AAEJ,EAAA,CAAC,CACH,CAAA;AAEJ,CAAA;AAEA,qBAAA,aAAexB,KAAA,CAAMyB,KAAKzE,YAAY,CAAA;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { RadioValue } from "../../../radio";
|
|
3
|
+
import { TdColorModes, TdColorPickerProps } from "../../type";
|
|
4
|
+
export interface ColorPanelHeaderProps extends TdColorPickerProps {
|
|
5
|
+
mode?: TdColorModes;
|
|
6
|
+
colorModes?: Array<TdColorModes>;
|
|
7
|
+
onModeChange?: (value: RadioValue, context: {
|
|
8
|
+
e: React.ChangeEvent<HTMLInputElement>;
|
|
9
|
+
}) => void;
|
|
10
|
+
baseClassName?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: React.MemoExoticComponent<(props: ColorPanelHeaderProps) => React.JSX.Element>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '../../utils/color-picker/index.js';
|
|
3
|
+
import { Radio } from '../../../radio/index.js';
|
|
4
|
+
import { j as COLOR_MODES } from '../../../_chunks/dep-DJmE940f.js';
|
|
5
|
+
import '../../../_chunks/dep-Chz4ZJCb.js';
|
|
6
|
+
import '../../../_chunks/dep-Cwish4GD.js';
|
|
7
|
+
import '../../../_chunks/dep-D-UKOauR.js';
|
|
8
|
+
import '../../../_chunks/dep-CgyDw_YI.js';
|
|
9
|
+
import '../../../_chunks/dep-CzLhKWCf.js';
|
|
10
|
+
import '../../../_chunks/dep-zOZQ0R9g.js';
|
|
11
|
+
import 'lodash-es';
|
|
12
|
+
import '../../../_chunks/dep-Dr5wkz0z.js';
|
|
13
|
+
import '../../../_chunks/dep-BP0-apUT.js';
|
|
14
|
+
import 'hoist-non-react-statics';
|
|
15
|
+
import '../../../common/Check.js';
|
|
16
|
+
import '../../../_chunks/dep-DN7d1SzH.js';
|
|
17
|
+
import 'classnames';
|
|
18
|
+
import '../../../_chunks/dep-DQ6kXoi8.js';
|
|
19
|
+
import '../../../_chunks/dep-gy8uvBaS.js';
|
|
20
|
+
import '../../../_chunks/dep-5U9UjDaf.js';
|
|
21
|
+
import 'dayjs';
|
|
22
|
+
import '../../../_chunks/dep-DwWrhxkd.js';
|
|
23
|
+
import '../../../_chunks/dep-DTlQ2dCA.js';
|
|
24
|
+
import '../../../_chunks/dep-DGvfel3I.js';
|
|
25
|
+
import '../../../_chunks/dep-CkmtEv0Y.js';
|
|
26
|
+
import '../../../_chunks/dep-Ccktr_jk.js';
|
|
27
|
+
import '../../../_chunks/dep-DRwijJcv.js';
|
|
28
|
+
import '../../../radio/style/css.js';
|
|
29
|
+
|
|
30
|
+
var Header = function Header(props) {
|
|
31
|
+
var _props$baseClassName = props.baseClassName,
|
|
32
|
+
baseClassName = _props$baseClassName === void 0 ? "" : _props$baseClassName,
|
|
33
|
+
_props$mode = props.mode,
|
|
34
|
+
mode = _props$mode === void 0 ? "monochrome" : _props$mode,
|
|
35
|
+
colorModes = props.colorModes,
|
|
36
|
+
onModeChange = props.onModeChange;
|
|
37
|
+
var isSingleMode = (colorModes === null || colorModes === void 0 ? void 0 : colorModes.length) === 1;
|
|
38
|
+
if (isSingleMode) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
42
|
+
className: "".concat(baseClassName, "__head")
|
|
43
|
+
}, /* @__PURE__ */React.createElement("div", {
|
|
44
|
+
className: "".concat(baseClassName, "__mode")
|
|
45
|
+
}, /* @__PURE__ */React.createElement(Radio.Group, {
|
|
46
|
+
variant: "default-filled",
|
|
47
|
+
size: "small",
|
|
48
|
+
value: mode,
|
|
49
|
+
onChange: onModeChange
|
|
50
|
+
}, Object.keys(COLOR_MODES).map(function (key) {
|
|
51
|
+
return /* @__PURE__ */React.createElement(Radio.Button, {
|
|
52
|
+
key: key,
|
|
53
|
+
value: key
|
|
54
|
+
}, COLOR_MODES[key]);
|
|
55
|
+
}))));
|
|
56
|
+
};
|
|
57
|
+
var header = /*#__PURE__*/React.memo(Header);
|
|
58
|
+
|
|
59
|
+
export { header as default };
|
|
60
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.js","sources":["../../../../../components/color-picker/components/panel/header.tsx"],"sourcesContent":["import React from \"react\";\nimport { COLOR_MODES } from \"../../utils/color-picker\";\nimport Radio, { RadioValue } from \"../../../radio\";\nimport { TdColorModes, TdColorPickerProps } from \"../../type\";\n\nexport interface ColorPanelHeaderProps extends TdColorPickerProps {\n mode?: TdColorModes;\n colorModes?: Array<TdColorModes>;\n onModeChange?: (value: RadioValue, context: { e: React.ChangeEvent<HTMLInputElement> }) => void;\n baseClassName?: string;\n}\n\nconst Header = (props: ColorPanelHeaderProps) => {\n const { baseClassName = \"\", mode = \"monochrome\", colorModes, onModeChange } = props;\n\n const isSingleMode = colorModes?.length === 1;\n\n if (isSingleMode) {\n return null;\n }\n\n return (\n <div className={`${baseClassName}__head`}>\n <div className={`${baseClassName}__mode`}>\n <Radio.Group variant=\"default-filled\" size=\"small\" value={mode} onChange={onModeChange}>\n {Object.keys(COLOR_MODES).map((key) => (\n <Radio.Button key={key} value={key}>\n {COLOR_MODES[key as keyof typeof COLOR_MODES]}\n </Radio.Button>\n ))}\n </Radio.Group>\n </div>\n </div>\n );\n};\n\nexport default React.memo(Header);\n"],"names":["Header","props","_props$baseClassName","baseClassName","_props$mode","mode","colorModes","onModeChange","isSingleMode","length","React","createElement","className","concat","Radio","Group","variant","size","value","onChange","Object","keys","COLOR_MODES","map","key","Button","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAMA,MAAA,GAAS,SAATA,MAAAA,CAAUC,KAAA,EAAiC;AAC/C,EAAA,IAAAC,oBAAA,GAA8ED,KAAA,CAAtEE,aAAA;AAAAA,IAAAA,aAAA,GAAAD,oBAAA,KAAA,KAAA,CAAA,GAAgB,EAAA,GAAAA,oBAAA;IAAAE,WAAA,GAAsDH,KAAA,CAAlDI;AAAAA,IAAAA,gCAAO,YAAA,GAAAD,WAAA;IAAcE,UAAA,GAA6BL,KAAA,CAA7BK,UAAA;IAAYC,eAAiBN,KAAA,CAAjBM;EAE7D,IAAMC,YAAA,GAAe,CAAAF,uBAAAA,iCAAAA,WAAYG,MAAA,MAAW,CAAA;AAE5C,EAAA,IAAID,YAAA,EAAc;AAChB,IAAA,OAAO,IAAA;AACT,EAAA;AAEA,EAAA,sBACEE,KAAA,CAAAC,aAAA,CAAC;IAAIC,SAAA,EAAA,EAAA,CAAAC,MAAA,CAAcV,aAAa,EAAA,QAAA;AAAA,GAAA,iBAC9BO,KAAA,CAAAC,aAAA,CAAC;IAAIC,SAAA,EAAA,EAAA,CAAAC,MAAA,CAAcV,aAAa,EAAA,QAAA;GAAA,iBAC9BO,KAAA,CAAAC,aAAA,CAACG,MAAMC,KAAA,EAAN;AAAYC,IAAAA,SAAQ,gBAAA;AAAiBC,IAAAA,IAAA,EAAK;AAAQC,IAAAA,KAAA,EAAOb,IAAA;AAAMc,IAAAA,UAAUZ;GAAA,EACvEa,MAAA,CAAOC,KAAKC,WAAW,CAAA,CAAEC,IAAI,UAACC,GAAA,EAAA;IAAA,0CAC5BV,KAAA,CAAMW,MAAA,EAAN;AAAaD,MAAAA,GAAA,EAAAA,GAAA;AAAUN,MAAAA,KAAA,EAAOM;OAC5BF,WAAA,CAAYE,GAA+B,CAC9C,CACD;EAAA,CAAA,CACH,CACF,CACF,CAAA;AAEJ,CAAA;AAEA,aAAA,aAAed,KAAA,CAAMgB,KAAK1B,MAAM,CAAA;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ColorSlider from './slider.js';
|
|
3
|
+
import 'classnames';
|
|
4
|
+
import '../../utils/color-picker/index.js';
|
|
5
|
+
import '../../../_chunks/dep-DJmE940f.js';
|
|
6
|
+
import '../../../_chunks/dep-CzLhKWCf.js';
|
|
7
|
+
import '../../../_chunks/dep-Chz4ZJCb.js';
|
|
8
|
+
import '../../../_chunks/dep-Cwish4GD.js';
|
|
9
|
+
import '../../../_chunks/dep-D-UKOauR.js';
|
|
10
|
+
import '../../../_chunks/dep-zOZQ0R9g.js';
|
|
11
|
+
import 'lodash-es';
|
|
12
|
+
import '../../../_chunks/dep-CgyDw_YI.js';
|
|
13
|
+
import '../../../_chunks/dep-BbeHB7S3.js';
|
|
14
|
+
|
|
15
|
+
var HueSlider = function HueSlider(props) {
|
|
16
|
+
var color = props.color,
|
|
17
|
+
baseClassName = props.baseClassName,
|
|
18
|
+
disabled = props.disabled,
|
|
19
|
+
onChange = props.onChange;
|
|
20
|
+
return /* @__PURE__ */React.createElement(ColorSlider, {
|
|
21
|
+
disabled: disabled,
|
|
22
|
+
baseClassName: baseClassName,
|
|
23
|
+
className: "".concat(baseClassName, "__hue"),
|
|
24
|
+
color: color,
|
|
25
|
+
value: color.hue,
|
|
26
|
+
type: "hue",
|
|
27
|
+
onChange: onChange
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var HueSlider$1 = /*#__PURE__*/React.memo(HueSlider);
|
|
31
|
+
|
|
32
|
+
export { HueSlider$1 as default };
|
|
33
|
+
//# sourceMappingURL=hue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hue.js","sources":["../../../../../components/color-picker/components/panel/hue.tsx"],"sourcesContent":["import React from \"react\";\nimport type { TdColorBaseProps } from \"../../type\";\nimport ColorSlider from \"./slider\";\n\nconst HueSlider = (props: TdColorBaseProps) => {\n const { color, baseClassName, disabled, onChange } = props;\n return (\n <ColorSlider\n disabled={disabled}\n baseClassName={baseClassName}\n className={`${baseClassName}__hue`}\n color={color}\n value={color.hue}\n type=\"hue\"\n onChange={onChange}\n />\n );\n};\n\nexport default React.memo(HueSlider);\n"],"names":["HueSlider","props","color","baseClassName","disabled","onChange","React","createElement","ColorSlider","className","concat","value","hue","type","memo"],"mappings":";;;;;;;;;;;;;;AAIA,IAAMA,SAAA,GAAY,SAAZA,SAAAA,CAAaC,KAAA,EAA4B;AAC7C,EAAA,IAAQC,KAAA,GAA6CD,KAAA,CAA7CC,KAAA;IAAOC,aAAA,GAAsCF,KAAA,CAAtCE,aAAA;IAAeC,QAAA,GAAuBH,KAAA,CAAvBG,QAAA;IAAUC,WAAaJ,KAAA,CAAbI;AACxC,EAAA,sBACEC,KAAA,CAAAC,aAAA,CAACC,WAAA,EAAA;AACCJ,IAAAA,QAAA,EAAAA,QAAA;AACAD,IAAAA,aAAA,EAAAA,aAAA;AACAM,IAAAA,SAAA,EAAA,EAAA,CAAAC,MAAA,CAAcP,aAAa,EAAA,OAAA,CAAA;AAC3BD,IAAAA,KAAA,EAAAA,KAAA;IACAS,OAAOT,KAAA,CAAMU,GAAA;AACbC,IAAAA,IAAA,EAAK,KAAA;AACLR,IAAAA,QAAA,EAAAA;AAAA,GACF,CAAA;AAEJ,CAAA;AAEA,kBAAA,aAAeC,KAAA,CAAMQ,KAAKd,SAAS,CAAA;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import '../../../_chunks/dep-Cwish4GD.js';
|
|
2
|
+
import '../../../_chunks/dep-CgyDw_YI.js';
|
|
3
|
+
import '../../../_chunks/dep-CzLhKWCf.js';
|
|
4
|
+
import 'react';
|
|
5
|
+
import 'classnames';
|
|
6
|
+
import '../../utils/color-picker/index.js';
|
|
7
|
+
import '../../../_chunks/dep-DTlQ2dCA.js';
|
|
8
|
+
import '../../../_chunks/dep-DwWrhxkd.js';
|
|
9
|
+
import '../../../_chunks/dep-DGvfel3I.js';
|
|
10
|
+
import '../../../_chunks/dep-CD_4-1Xb.js';
|
|
11
|
+
export { C as default } from '../../../_chunks/dep-DURB9x8g.js';
|
|
12
|
+
import '../../../_chunks/dep-oUgTcXgm.js';
|
|
13
|
+
import './alpha.js';
|
|
14
|
+
import './hue.js';
|
|
15
|
+
import './saturation.js';
|
|
16
|
+
import './swatches.js';
|
|
17
|
+
import '../../../_chunks/dep-DJmE940f.js';
|
|
18
|
+
import '../../../_chunks/dep-D-UKOauR.js';
|
|
19
|
+
import '../../../_chunks/dep-Chz4ZJCb.js';
|
|
20
|
+
import '../../../_chunks/dep-zOZQ0R9g.js';
|
|
21
|
+
import 'lodash-es';
|
|
22
|
+
import '../../../_chunks/dep-gy8uvBaS.js';
|
|
23
|
+
import '../../../_chunks/dep-5U9UjDaf.js';
|
|
24
|
+
import 'dayjs';
|
|
25
|
+
import '../../../config-provider/index.js';
|
|
26
|
+
import '../../../config-provider/ConfigProvider.js';
|
|
27
|
+
import '../../../_chunks/dep-DN7d1SzH.js';
|
|
28
|
+
import './slider.js';
|
|
29
|
+
import '../../../_chunks/dep-BbeHB7S3.js';
|
|
30
|
+
import '@tendaui/icons';
|
|
31
|
+
import '../../../_chunks/dep-ByzdZjUR.js';
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React, { useRef, useCallback, useEffect } from 'react';
|
|
2
|
+
import '../../utils/color-picker/index.js';
|
|
3
|
+
import { u as useMouseEvent } from '../../../_chunks/dep-BbeHB7S3.js';
|
|
4
|
+
import { l as SATURATION_PANEL_DEFAULT_HEIGHT, S as SATURATION_PANEL_DEFAULT_WIDTH } from '../../../_chunks/dep-DJmE940f.js';
|
|
5
|
+
import '../../../_chunks/dep-Chz4ZJCb.js';
|
|
6
|
+
import '../../../_chunks/dep-Cwish4GD.js';
|
|
7
|
+
import '../../../_chunks/dep-D-UKOauR.js';
|
|
8
|
+
import '../../../_chunks/dep-CgyDw_YI.js';
|
|
9
|
+
import '../../../_chunks/dep-CzLhKWCf.js';
|
|
10
|
+
import '../../../_chunks/dep-zOZQ0R9g.js';
|
|
11
|
+
import 'lodash-es';
|
|
12
|
+
|
|
13
|
+
var Saturation = function Saturation(props) {
|
|
14
|
+
var color = props.color,
|
|
15
|
+
disabled = props.disabled,
|
|
16
|
+
onChange = props.onChange,
|
|
17
|
+
baseClassName = props.baseClassName;
|
|
18
|
+
var panelRef = useRef(null);
|
|
19
|
+
var panelRectRef = useRef({
|
|
20
|
+
width: SATURATION_PANEL_DEFAULT_WIDTH,
|
|
21
|
+
height: SATURATION_PANEL_DEFAULT_HEIGHT
|
|
22
|
+
});
|
|
23
|
+
var styles = function styles() {
|
|
24
|
+
var saturation = color.saturation,
|
|
25
|
+
value = color.value,
|
|
26
|
+
rgb = color.rgb;
|
|
27
|
+
var _panelRectRef$current = panelRectRef.current,
|
|
28
|
+
width = _panelRectRef$current.width,
|
|
29
|
+
height = _panelRectRef$current.height;
|
|
30
|
+
var top = Math.round((1 - value) * height);
|
|
31
|
+
var left = Math.round(saturation * width);
|
|
32
|
+
return {
|
|
33
|
+
color: rgb,
|
|
34
|
+
left: "".concat(left, "px"),
|
|
35
|
+
top: "".concat(top, "px")
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
var getSaturationAndValue = function getSaturationAndValue(coordinate) {
|
|
39
|
+
var _panelRectRef$current2 = panelRectRef.current,
|
|
40
|
+
width = _panelRectRef$current2.width,
|
|
41
|
+
height = _panelRectRef$current2.height;
|
|
42
|
+
var x = coordinate.x,
|
|
43
|
+
y = coordinate.y;
|
|
44
|
+
var saturation = Math.round(x / width * 100);
|
|
45
|
+
var value = Math.round((1 - y / height) * 100);
|
|
46
|
+
return {
|
|
47
|
+
saturation: saturation,
|
|
48
|
+
value: value
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
var handleDrag = useCallback(function (_ref) {
|
|
52
|
+
var x = _ref.x,
|
|
53
|
+
y = _ref.y;
|
|
54
|
+
if (disabled) return;
|
|
55
|
+
var _getSaturationAndValu = getSaturationAndValue({
|
|
56
|
+
x: x,
|
|
57
|
+
y: y
|
|
58
|
+
}),
|
|
59
|
+
saturation = _getSaturationAndValu.saturation,
|
|
60
|
+
value = _getSaturationAndValu.value;
|
|
61
|
+
onChange === null || onChange === void 0 || onChange({
|
|
62
|
+
saturation: saturation / 100,
|
|
63
|
+
value: value / 100
|
|
64
|
+
});
|
|
65
|
+
}, [disabled, onChange]);
|
|
66
|
+
useMouseEvent(panelRef, {
|
|
67
|
+
onDown: function onDown() {
|
|
68
|
+
var _panelRef$current, _panelRef$current2;
|
|
69
|
+
if (disabled) return;
|
|
70
|
+
panelRectRef.current.width = ((_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 ? void 0 : _panelRef$current.offsetWidth) || panelRectRef.current.width;
|
|
71
|
+
panelRectRef.current.height = ((_panelRef$current2 = panelRef.current) === null || _panelRef$current2 === void 0 ? void 0 : _panelRef$current2.offsetHeight) || panelRectRef.current.height;
|
|
72
|
+
},
|
|
73
|
+
onMove: function onMove(_, ctx) {
|
|
74
|
+
handleDrag(ctx.coordinate);
|
|
75
|
+
},
|
|
76
|
+
onUp: function onUp(_, ctx) {
|
|
77
|
+
handleDrag(ctx.coordinate);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
useEffect(function () {
|
|
81
|
+
var _panelRef$current3, _panelRef$current4;
|
|
82
|
+
panelRectRef.current.width = ((_panelRef$current3 = panelRef.current) === null || _panelRef$current3 === void 0 ? void 0 : _panelRef$current3.offsetWidth) || SATURATION_PANEL_DEFAULT_WIDTH;
|
|
83
|
+
panelRectRef.current.height = ((_panelRef$current4 = panelRef.current) === null || _panelRef$current4 === void 0 ? void 0 : _panelRef$current4.offsetHeight) || SATURATION_PANEL_DEFAULT_HEIGHT;
|
|
84
|
+
}, [handleDrag]);
|
|
85
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
86
|
+
ref: panelRef,
|
|
87
|
+
className: "".concat(baseClassName, "__saturation"),
|
|
88
|
+
style: {
|
|
89
|
+
background: "hsl(".concat(color.hue, ", 100%, 50%)")
|
|
90
|
+
}
|
|
91
|
+
}, /* @__PURE__ */React.createElement("span", {
|
|
92
|
+
className: "".concat(baseClassName, "__thumb"),
|
|
93
|
+
role: "slider",
|
|
94
|
+
tabIndex: 0,
|
|
95
|
+
style: styles()
|
|
96
|
+
}));
|
|
97
|
+
};
|
|
98
|
+
var SaturationPanel = /*#__PURE__*/React.memo(Saturation);
|
|
99
|
+
|
|
100
|
+
export { SaturationPanel as default };
|
|
101
|
+
//# sourceMappingURL=saturation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saturation.js","sources":["../../../../../components/color-picker/components/panel/saturation.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef } from \"react\";\nimport { SATURATION_PANEL_DEFAULT_HEIGHT, SATURATION_PANEL_DEFAULT_WIDTH } from \"../../utils/color-picker\";\nimport useMouseEvent, { type MouseCoordinate } from \"../../../hooks/useMouseEvent\";\nimport type { TdColorBaseProps } from \"../../type\";\n\nconst Saturation = (props: TdColorBaseProps) => {\n const { color, disabled, onChange, baseClassName } = props;\n const panelRef = useRef<HTMLDivElement>(null);\n const panelRectRef = useRef({\n width: SATURATION_PANEL_DEFAULT_WIDTH,\n height: SATURATION_PANEL_DEFAULT_HEIGHT\n });\n\n const styles = () => {\n const { saturation, value, rgb } = color;\n const { width, height } = panelRectRef.current;\n const top = Math.round((1 - value) * height);\n const left = Math.round(saturation * width);\n return {\n color: rgb,\n left: `${left}px`,\n top: `${top}px`\n };\n };\n\n const getSaturationAndValue = (coordinate: MouseCoordinate) => {\n const { width, height } = panelRectRef.current;\n const { x, y } = coordinate;\n const saturation = Math.round((x / width) * 100);\n const value = Math.round((1 - y / height) * 100);\n return {\n saturation,\n value\n };\n };\n\n const handleDrag = useCallback(\n ({ x, y }: MouseCoordinate) => {\n if (disabled) return;\n const { saturation, value } = getSaturationAndValue({ x, y });\n onChange?.({\n saturation: saturation / 100,\n value: value / 100\n });\n },\n [disabled, onChange]\n );\n\n useMouseEvent(panelRef, {\n onDown: () => {\n if (disabled) return;\n panelRectRef.current.width = panelRef.current?.offsetWidth || panelRectRef.current.width;\n panelRectRef.current.height = panelRef.current?.offsetHeight || panelRectRef.current.height;\n },\n onMove: (_, ctx) => {\n handleDrag(ctx.coordinate);\n },\n onUp: (_, ctx) => {\n handleDrag(ctx.coordinate);\n }\n });\n\n useEffect(() => {\n panelRectRef.current.width = panelRef.current?.offsetWidth || SATURATION_PANEL_DEFAULT_WIDTH;\n panelRectRef.current.height = panelRef.current?.offsetHeight || SATURATION_PANEL_DEFAULT_HEIGHT;\n }, [handleDrag]);\n\n return (\n <div\n ref={panelRef}\n className={`${baseClassName}__saturation`}\n style={{\n background: `hsl(${color.hue}, 100%, 50%)`\n }}\n >\n <span className={`${baseClassName}__thumb`} role=\"slider\" tabIndex={0} style={styles()} />\n </div>\n );\n};\n\nexport default React.memo(Saturation);\n"],"names":["Saturation","props","color","disabled","onChange","baseClassName","panelRef","useRef","panelRectRef","width","SATURATION_PANEL_DEFAULT_WIDTH","height","SATURATION_PANEL_DEFAULT_HEIGHT","styles","saturation","value","rgb","_panelRectRef$current","current","top","Math","round","left","concat","getSaturationAndValue","coordinate","_panelRectRef$current2","x","y","handleDrag","useCallback","_ref","_getSaturationAndValu","useMouseEvent","onDown","_panelRef$current","_panelRef$current2","offsetWidth","offsetHeight","onMove","_","ctx","onUp","useEffect","_panelRef$current3","_panelRef$current4","React","createElement","ref","className","style","background","hue","role","tabIndex","memo"],"mappings":";;;;;;;;;;;;AAKA,IAAMA,UAAA,GAAa,SAAbA,UAAAA,CAAcC,KAAA,EAA4B;AAC9C,EAAA,IAAQC,KAAA,GAA6CD,KAAA,CAA7CC,KAAA;IAAOC,QAAA,GAAsCF,KAAA,CAAtCE,QAAA;IAAUC,QAAA,GAA4BH,KAAA,CAA5BG,QAAA;IAAUC,gBAAkBJ,KAAA,CAAlBI;AACnC,EAAA,IAAMC,QAAA,GAAWC,OAAuB,IAAI,CAAA;EAC5C,IAAMC,eAAeD,MAAA,CAAO;AAC1BE,IAAAA,KAAA,EAAOC,8BAAA;AACPC,IAAAA,MAAA,EAAQC;AACV,GAAC,CAAA;AAED,EAAA,IAAMC,SAAS,SAATA,SAAe;AACnB,IAAA,IAAQC,UAAA,GAA2BZ,KAAA,CAA3BY,UAAA;MAAYC,KAAA,GAAeb,KAAA,CAAfa,KAAA;MAAOC,GAAA,GAAQd,KAAA,CAARc,GAAA;AAC3B,IAAA,IAAAC,qBAAA,GAA0BT,YAAA,CAAaU,OAAA;MAA/BT,KAAA,GAAAQ,qBAAA,CAAAR,KAAA;MAAOE,MAAA,GAAAM,qBAAA,CAAAN,MAAA;AACf,IAAA,IAAMQ,GAAA,GAAMC,IAAA,CAAKC,KAAA,CAAA,CAAO,CAAA,GAAIN,SAASJ,MAAM,CAAA;IAC3C,IAAMW,IAAA,GAAOF,IAAA,CAAKC,KAAA,CAAMP,UAAA,GAAaL,KAAK,CAAA;IAC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C9DF,IAAAA,YAAA,CAAaU,OAAA,CAAQP,MAAA,GAAS,CAAA,CAAAkC,kBAAA,GAAAvC,QAAA,CAASY,OAAA,cAAA2B,kBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAATA,kBAAA,CAAkBP,YAAA,KAAgB1B,+BAAA;AAClE,EAAA,CAAA,EAAG,CAACiB,UAAU,CAAC,CAAA;AAEf,EAAA,sBACEiB,KAAA,CAAAC,aAAA,CAAC,KAAA,EAAA;AACCC,IAAAA,GAAA,EAAK1C,QAAA;AACL2C,IAAAA,SAAA,EAAA,EAAA,CAAA1B,MAAA,CAAclB,aAAa,EAAA,cAAA,CAAA;AAC3B6C,IAAAA,KAAA,EAAO;AACLC,MAAAA,UAAA,EAAA,MAAA,CAAA5B,MAAA,CAAmBrB,KAAA,CAAMkD,GAAG,EAAA,cAAA;AAC9B;AAAA,GAAA,iBAEAN,KAAA,CAAAC,aAAA,CAAC,MAAA,EAAA;AAAKE,IAAAA,SAAA,EAAA,EAAA,CAAA1B,MAAA,CAAclB,aAAa,EAAA,SAAA,CAAA;AAAWgD,IAAAA,IAAA,EAAK,QAAA;AAASC,IAAAA,QAAA,EAAU,CAAA;IAAGJ,KAAA,EAAOrC,MAAA;AAAO,GAAG,CAC1F,CAAA;AAEJ,CAAA;AAEA,sBAAA,aAAeiC,KAAA,CAAMS,KAAKvD,UAAU,CAAA;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { CSSProperties } from "react";
|
|
2
|
+
import type { TdColorBaseProps } from "../../type";
|
|
3
|
+
export interface TdColorSliderProps extends TdColorBaseProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
value?: number;
|
|
6
|
+
maxValue?: number;
|
|
7
|
+
railStyle?: CSSProperties;
|
|
8
|
+
type: "hue" | "alpha";
|
|
9
|
+
}
|
|
10
|
+
declare const _default: React.MemoExoticComponent<(props: TdColorSliderProps) => React.JSX.Element>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import '../../utils/color-picker/index.js';
|
|
4
|
+
import { u as useMouseEvent } from '../../../_chunks/dep-BbeHB7S3.js';
|
|
5
|
+
import { _ as _slicedToArray } from '../../../_chunks/dep-CzLhKWCf.js';
|
|
6
|
+
import { m as SLIDER_DEFAULT_WIDTH } from '../../../_chunks/dep-DJmE940f.js';
|
|
7
|
+
import '../../../_chunks/dep-Chz4ZJCb.js';
|
|
8
|
+
import '../../../_chunks/dep-Cwish4GD.js';
|
|
9
|
+
import '../../../_chunks/dep-D-UKOauR.js';
|
|
10
|
+
import '../../../_chunks/dep-CgyDw_YI.js';
|
|
11
|
+
import '../../../_chunks/dep-zOZQ0R9g.js';
|
|
12
|
+
import 'lodash-es';
|
|
13
|
+
|
|
14
|
+
var useStyles = function useStyles(params, panelRectRef) {
|
|
15
|
+
var color = params.color,
|
|
16
|
+
value = params.value,
|
|
17
|
+
maxValue = params.maxValue,
|
|
18
|
+
type = params.type;
|
|
19
|
+
var _useState = useState({
|
|
20
|
+
left: "",
|
|
21
|
+
color: ""
|
|
22
|
+
}),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
styles = _useState2[0],
|
|
25
|
+
setStyles = _useState2[1];
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
var width = panelRectRef.current.width;
|
|
28
|
+
if (!width) return;
|
|
29
|
+
var left = Math.round(Number(value) / Number(maxValue) * 100);
|
|
30
|
+
var thumbColor = "";
|
|
31
|
+
if (type === "hue") {
|
|
32
|
+
thumbColor = "hsl(".concat(color.hue, ", 100%, 50%)");
|
|
33
|
+
} else if (type === "alpha") {
|
|
34
|
+
thumbColor = color.rgba;
|
|
35
|
+
}
|
|
36
|
+
setStyles({
|
|
37
|
+
left: "".concat(left, "%"),
|
|
38
|
+
color: thumbColor
|
|
39
|
+
});
|
|
40
|
+
}, [color.hue, color.rgba, maxValue, type, value]);
|
|
41
|
+
return {
|
|
42
|
+
styles: styles
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var ColorSlider = function ColorSlider(props) {
|
|
47
|
+
var color = props.color,
|
|
48
|
+
_props$className = props.className,
|
|
49
|
+
className = _props$className === void 0 ? "" : _props$className,
|
|
50
|
+
_props$value = props.value,
|
|
51
|
+
value = _props$value === void 0 ? 0 : _props$value,
|
|
52
|
+
_props$railStyle = props.railStyle,
|
|
53
|
+
railStyle = _props$railStyle === void 0 ? {} : _props$railStyle,
|
|
54
|
+
_props$maxValue = props.maxValue,
|
|
55
|
+
maxValue = _props$maxValue === void 0 ? 360 : _props$maxValue,
|
|
56
|
+
baseClassName = props.baseClassName,
|
|
57
|
+
disabled = props.disabled,
|
|
58
|
+
onChange = props.onChange,
|
|
59
|
+
type = props.type;
|
|
60
|
+
var panelRef = useRef(null);
|
|
61
|
+
var panelRectRef = useRef({
|
|
62
|
+
width: SLIDER_DEFAULT_WIDTH
|
|
63
|
+
});
|
|
64
|
+
var _useStyles = useStyles({
|
|
65
|
+
color: color,
|
|
66
|
+
value: value,
|
|
67
|
+
maxValue: maxValue,
|
|
68
|
+
type: type
|
|
69
|
+
}, panelRectRef),
|
|
70
|
+
styles = _useStyles.styles;
|
|
71
|
+
var handleDrag = function handleDrag(coordinate) {
|
|
72
|
+
if (disabled) return;
|
|
73
|
+
var width = panelRectRef.current.width;
|
|
74
|
+
var x = coordinate.x;
|
|
75
|
+
var nextValue = Math.round(x / width * Number(maxValue) * 100) / 100;
|
|
76
|
+
console.log(nextValue);
|
|
77
|
+
onChange === null || onChange === void 0 || onChange(nextValue);
|
|
78
|
+
};
|
|
79
|
+
useMouseEvent(panelRef, {
|
|
80
|
+
onDown: function onDown(_, ctx) {
|
|
81
|
+
var _panelRef$current;
|
|
82
|
+
if (disabled) return;
|
|
83
|
+
panelRectRef.current.width = ((_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 ? void 0 : _panelRef$current.offsetWidth) || panelRectRef.current.width;
|
|
84
|
+
handleDrag(ctx.coordinate);
|
|
85
|
+
},
|
|
86
|
+
onMove: function onMove(_, ctx) {
|
|
87
|
+
handleDrag(ctx.coordinate);
|
|
88
|
+
},
|
|
89
|
+
onUp: function onUp(_, ctx) {
|
|
90
|
+
handleDrag(ctx.coordinate);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
useEffect(function () {
|
|
94
|
+
var _panelRef$current2;
|
|
95
|
+
panelRectRef.current.width = ((_panelRef$current2 = panelRef.current) === null || _panelRef$current2 === void 0 ? void 0 : _panelRef$current2.offsetWidth) || SLIDER_DEFAULT_WIDTH;
|
|
96
|
+
}, []);
|
|
97
|
+
var paddingStyle = {
|
|
98
|
+
background: "linear-gradient(90deg, rgba(0,0,0,.0) 0%, rgba(0,0,0,.0) 93%, ".concat(props.color.rgb, " 93%, ").concat(props.color.rgb, " 100%)")
|
|
99
|
+
};
|
|
100
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
101
|
+
className: classNames("".concat(baseClassName, "__slider-wrapper"), "".concat(baseClassName, "__slider-wrapper--").concat(type, "-type"))
|
|
102
|
+
}, type === "alpha" && /* @__PURE__ */React.createElement("div", {
|
|
103
|
+
className: "".concat(baseClassName, "__slider-padding"),
|
|
104
|
+
style: paddingStyle
|
|
105
|
+
}), /* @__PURE__ */React.createElement("div", {
|
|
106
|
+
className: classNames("".concat(baseClassName, "__slider"), className),
|
|
107
|
+
ref: panelRef
|
|
108
|
+
}, /* @__PURE__ */React.createElement("div", {
|
|
109
|
+
className: "".concat(baseClassName, "__rail"),
|
|
110
|
+
style: railStyle
|
|
111
|
+
}), /* @__PURE__ */React.createElement("span", {
|
|
112
|
+
className: "".concat(baseClassName, "__thumb"),
|
|
113
|
+
role: "slider",
|
|
114
|
+
tabIndex: 0,
|
|
115
|
+
style: styles
|
|
116
|
+
})));
|
|
117
|
+
};
|
|
118
|
+
var ColorSlider$1 = /*#__PURE__*/React.memo(ColorSlider);
|
|
119
|
+
|
|
120
|
+
export { ColorSlider$1 as default };
|
|
121
|
+
//# sourceMappingURL=slider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider.js","sources":["../../../../../components/color-picker/hooks/useStyles.ts","../../../../../components/color-picker/components/panel/slider.tsx"],"sourcesContent":["import { CSSProperties, useEffect, useState, MutableRefObject } from \"react\";\nimport type { Color } from \"../utils/color-picker/color\";\n\nexport interface TdColorSliderStyleParams {\n color: Color;\n value: number;\n maxValue: number;\n type: \"hue\" | \"alpha\";\n}\n\nconst useStyles = (params: TdColorSliderStyleParams, panelRectRef: MutableRefObject<{ width: number }>) => {\n const { color, value, maxValue, type } = params;\n const [styles, setStyles] = useState<CSSProperties>({ left: \"\", color: \"\" });\n\n useEffect(() => {\n const { width } = panelRectRef.current;\n if (!width) return;\n\n const left = Math.round((Number(value) / Number(maxValue)) * 100);\n\n let thumbColor = \"\";\n if (type === \"hue\") {\n thumbColor = `hsl(${color.hue}, 100%, 50%)`;\n } else if (type === \"alpha\") {\n thumbColor = color.rgba;\n }\n\n setStyles({\n left: `${left}%`,\n color: thumbColor\n });\n }, [color.hue, color.rgba, maxValue, type, value]);\n\n return {\n styles\n };\n};\n\nexport default useStyles;\n","import React, { CSSProperties, useEffect, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport { SLIDER_DEFAULT_WIDTH } from \"../../utils/color-picker\";\nimport useMouseEvent, { type MouseCoordinate } from \"../../../hooks/useMouseEvent\";\nimport useStyles from \"../../hooks/useStyles\";\nimport type { TdColorBaseProps } from \"../../type\";\n\nexport interface TdColorSliderProps extends TdColorBaseProps {\n className?: string;\n value?: number;\n maxValue?: number;\n railStyle?: CSSProperties;\n type: \"hue\" | \"alpha\";\n}\n\nconst ColorSlider = (props: TdColorSliderProps) => {\n const {\n color,\n className = \"\",\n value = 0,\n railStyle = {},\n maxValue = 360,\n baseClassName,\n disabled,\n onChange,\n type\n } = props;\n const panelRef = useRef<HTMLDivElement>(null);\n const panelRectRef = useRef({\n width: SLIDER_DEFAULT_WIDTH\n });\n const { styles } = useStyles({ color, value, maxValue, type }, panelRectRef);\n\n const handleDrag = (coordinate: MouseCoordinate) => {\n if (disabled) return;\n const { width } = panelRectRef.current;\n const { x } = coordinate;\n const nextValue = Math.round((x / width) * Number(maxValue) * 100) / 100;\n console.log(nextValue);\n onChange?.(nextValue);\n };\n\n useMouseEvent(panelRef, {\n onDown: (_, ctx) => {\n if (disabled) return;\n panelRectRef.current.width = panelRef.current?.offsetWidth || panelRectRef.current.width;\n handleDrag(ctx.coordinate);\n },\n onMove: (_, ctx) => {\n handleDrag(ctx.coordinate);\n },\n onUp: (_, ctx) => {\n handleDrag(ctx.coordinate);\n }\n });\n\n useEffect(() => {\n panelRectRef.current.width = panelRef.current?.offsetWidth || SLIDER_DEFAULT_WIDTH;\n }, []);\n\n const paddingStyle = {\n background: `linear-gradient(90deg, rgba(0,0,0,.0) 0%, rgba(0,0,0,.0) 93%, ${props.color.rgb} 93%, ${props.color.rgb} 100%)`\n };\n\n return (\n <div className={classNames(`${baseClassName}__slider-wrapper`, `${baseClassName}__slider-wrapper--${type}-type`)}>\n {type === \"alpha\" && <div className={`${baseClassName}__slider-padding`} style={paddingStyle} />}\n <div className={classNames(`${baseClassName}__slider`, className)} ref={panelRef}>\n <div className={`${baseClassName}__rail`} style={railStyle} />\n <span className={`${baseClassName}__thumb`} role=\"slider\" tabIndex={0} style={styles} />\n </div>\n </div>\n );\n};\n\nexport default React.memo(ColorSlider);\n"],"names":["useStyles","params","panelRectRef","color","value","maxValue","type","_useState","useState","left","_useState2","_slicedToArray","styles","setStyles","useEffect","width","current","Math","round","Number","thumbColor","concat","hue","rgba","ColorSlider","props","_props$className","className","_props$value","_props$railStyle","railStyle","_props$maxValue","baseClassName","disabled","onChange","panelRef","useRef","SLIDER_DEFAULT_WIDTH","_useStyles","handleDrag","coordinate","x","nextValue","console","log","useMouseEvent","onDown","_","ctx","_panelRef$current","offsetWidth","onMove","onUp","_panelRef$current2","paddingStyle","background","rgb","React","createElement","classNames","style","ref","role","tabIndex","memo"],"mappings":";;;;;;;;;;;;;AAUA,IAAMA,SAAA,GAAY,SAAZA,SAAAA,CAAaC,MAAA,EAAkCC,YAAA,EAAsD;AACzG,EAAA,IAAQC,KAAA,GAAiCF,MAAA,CAAjCE,KAAA;IAAOC,KAAA,GAA0BH,MAAA,CAA1BG,KAAA;IAAOC,QAAA,GAAmBJ,MAAA,CAAnBI,QAAA;IAAUC,OAASL,MAAA,CAATK;EAChC,IAAAC,SAAA,GAA4BC,QAAA,CAAwB;AAAEC,MAAAA,IAAA,EAAM,EAAA;AAAIN,MAAAA,KAAA,EAAO;AAAG,KAAC,CAAA;IAAAO,UAAA,GAAAC,cAAA,CAAAJ,SAAA,EAAA,CAAA,CAAA;AAApEK,IAAAA,MAAA,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAQG,IAAAA,SAAS,GAAAH,UAAA,CAAA,CAAA,CAAA;AAExBI,EAAAA,SAAA,CAAU,YAAM;AACd,IAAA,IAAQC,KAAA,GAAUb,YAAA,CAAac,OAAA,CAAvBD,KAAA;IACR,IAAI,CAACA,KAAA,EAAO;AAEZ,IAAA,IAAMN,IAAA,GAAOQ,KAAKC,KAAA,CAAOC,MAAA,CAAOf,KAAK,CAAA,GAAIe,MAAA,CAAOd,QAAQ,CAAA,GAAK,GAAG,CAAA;IAEhE,IAAIe,UAAA,GAAa,EAAA;IACjB,IAAId,SAAS,KAAA,EAAO;AAClBc,MAAAA,UAAA,UAAAC,MAAA,CAAoBlB,MAAMmB,GAAG,EAAA,cAAA,CAAA;AAC/B,IAAA,CAAA,MAAA,IAAWhB,SAAS,OAAA,EAAS;MAC3Bc,UAAA,GAAajB,KAAA,CAAMoB,IAAA;AACrB,IAAA;AAEAV,IAAAA,SAAA,CAAU;AACRJ,MAAAA,IAAA,EAAA,EAAA,CAAAY,MAAA,CAASZ,IAAI,EAAA,GAAA,CAAA;AACbN,M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N,MAAA,CAAcW,aAAa,EAAA,QAAA,CAAA;AAAU4B,IAAAA,KAAA,EAAO9B;GAAW,CAAA,iBAC5D2B,KAAA,CAAAC,aAAA,CAAC,MAAA,EAAA;AAAK/B,IAAAA,SAAA,EAAA,EAAA,CAAAN,MAAA,CAAcW,aAAa,EAAA,SAAA,CAAA;AAAW8B,IAAAA,IAAA,EAAK,QAAA;AAASC,IAAAA,QAAA,EAAU,CAAA;AAAGH,IAAAA,KAAA,EAAOhD;GAAQ,CACxF,CACF,CAAA;AAEJ,CAAA;AAEA,oBAAA,aAAe6C,KAAA,CAAMO,KAAKxC,WAAW,CAAA;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TdColorBaseProps } from "../../type";
|
|
3
|
+
export interface TdColorSwatchesProps extends TdColorBaseProps {
|
|
4
|
+
colors?: string[];
|
|
5
|
+
title?: string;
|
|
6
|
+
editable?: boolean;
|
|
7
|
+
onSetColor?: (color: string) => void;
|
|
8
|
+
handleAddColor?: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: React.MemoExoticComponent<(props: TdColorSwatchesProps) => React.JSX.Element>;
|
|
11
|
+
export default _default;
|