From 07f8485f625c3cc1bb5a4021e49ec20d3b0f814c Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Sat, 17 Feb 2024 09:41:57 +0800 Subject: [PATCH] type(Color): fix type export issue. (#140) https://github.com/uiwjs/react-color/issues/104 --- packages/color/src/index.tsx | 43 +++++++++++++++++++++--------------- test/convert.test.tsx | 4 ++-- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/packages/color/src/index.tsx b/packages/color/src/index.tsx index f4cc659da..39857e9d4 100644 --- a/packages/color/src/index.tsx +++ b/packages/color/src/index.tsx @@ -1,20 +1,27 @@ export * from '@uiw/color-convert'; -export { default as Alpha } from '@uiw/react-color-alpha'; -export { default as Block } from '@uiw/react-color-block'; -export { default as Compact } from '@uiw/react-color-compact'; -export { default as Chrome } from '@uiw/react-color-chrome'; -export { default as Colorful } from '@uiw/react-color-colorful'; -export { default as Circle } from '@uiw/react-color-circle'; -export { default as EditableInput } from '@uiw/react-color-editable-input'; -export { default as EditableInputRGBA } from '@uiw/react-color-editable-input-rgba'; -export { default as EditableInputHSLA } from '@uiw/react-color-editable-input-hsla'; -export { default as Hue } from '@uiw/react-color-hue'; -export { default as Github } from '@uiw/react-color-github'; -export { default as Material } from '@uiw/react-color-material'; -export { default as Saturation } from '@uiw/react-color-saturation'; -export { default as ShadeSlider } from '@uiw/react-color-shade-slider'; -export { default as Slider } from '@uiw/react-color-slider'; -export { default as Sketch } from '@uiw/react-color-sketch'; -export { default as Swatch } from '@uiw/react-color-swatch'; -export { default as Wheel } from '@uiw/react-color-wheel'; +export { default as Alpha, type AlphaProps, type PointerProps, BACKGROUND_IMG, Pointer } from '@uiw/react-color-alpha'; +export { default as Block, type BlockProps } from '@uiw/react-color-block'; +export { default as Chrome, type ChromeInputType, type ChromeProps } from '@uiw/react-color-chrome'; +export { default as Circle, type CircleProps } from '@uiw/react-color-circle'; +export { default as Colorful, type ColorfulProps } from '@uiw/react-color-colorful'; +export { default as Compact, type CompactProps } from '@uiw/react-color-compact'; +export { default as EditableInput, type EditableInputProps } from '@uiw/react-color-editable-input'; +export { default as EditableInputRGBA, type EditableInputRGBAProps } from '@uiw/react-color-editable-input-rgba'; +export { default as EditableInputHSLA, type EditableInputHSLAProps } from '@uiw/react-color-editable-input-hsla'; +export { default as Github, type GithubProps, type GithubPlacement, type GithubRectRenderProps } from '@uiw/react-color-github'; +export { default as Hue, type HueProps } from '@uiw/react-color-hue'; +export { default as Material, type MaterialProps } from '@uiw/react-color-material'; +export { + default as colorNameToHex, + type ColorKeywords, + colorKeywords, + baseNamed, + colorKeywordsBase, +} from '@uiw/react-color-name'; +export { default as Saturation, type SaturationProps } from '@uiw/react-color-saturation'; +export { default as ShadeSlider, type ShadeSliderProps } from '@uiw/react-color-shade-slider'; +export { default as Sketch, type SketchProps } from '@uiw/react-color-sketch'; +export { default as Slider, type SliderProps } from '@uiw/react-color-slider'; +export { default as Swatch, type SwatchProps, type SwatchPresetColor, type SwatchRectRenderProps } from '@uiw/react-color-swatch'; +export { default as Wheel, type WheelProps } from '@uiw/react-color-wheel'; diff --git a/test/convert.test.tsx b/test/convert.test.tsx index 11899c514..ebdf727cd 100644 --- a/test/convert.test.tsx +++ b/test/convert.test.tsx @@ -1,7 +1,7 @@ import { color, getContrastingColor } from '../packages/color-convert/src'; // HEX import { hexToHsva, hexToRgba, hsvaToHex, hsvaToHexa } from '../packages/color-convert/src'; -import { equalHex } from '../packages/color-convert/src/utils'; +import { equalHex } from '../packages/color-convert/src'; // HSLA import { hsvaToHsla, hslaToHsva, HsvaColor, HslaColor } from '../packages/color-convert/src'; // HSL @@ -24,7 +24,7 @@ import { hsvaToHsvaString, hsvaToHslaString, hsvaStringToHsva } from '../package import { hsvaToHsv } from '../packages/color-convert/src'; // HSV string import { hsvaToHsvString, hsvStringToHsva } from '../packages/color-convert/src'; -import { equalColorString, equalColorObjects, validHex } from '../packages/color-convert/src/utils'; +import { equalColorString, equalColorObjects, validHex } from '../packages/color-convert/src'; it('Converts color => getContrastingColor', () => { expect(getContrastingColor('#d0021b')).toEqual('#ffffff');