diff --git a/package.json b/package.json
index 8c118ef..a23c092 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "1byte-react-design",
- "version": "1.6.3-1",
+ "version": "1.6.3-2",
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
@@ -10,10 +10,12 @@
"license": "MIT",
"scripts": {
"build": "webpack --config webpack.config.js",
- "test": "yalc publish --push --no-scripts --files ."
+ "test": "yalc publish --push --no-scripts --files .",
+ "tsc": "tsc -p tsconfig.json"
},
"dependencies": {
"@ant-design/cssinjs": "^1.24.0",
+ "@ant-design/cssinjs-utils": "^1.1.3",
"@ant-design/icons": "^6.0.1",
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/modifiers": "^9.0.0",
@@ -26,6 +28,9 @@
"dayjs": "^1.11.13",
"polished": "^4.3.1",
"rc-field-form": "^2.7.0",
+ "rc-image": "^7.12.0",
+ "rc-input-number": "^9.5.0",
+ "rc-slider": "^11.1.8",
"rc-table": "^7.53.0",
"rc-tree": "^5.13.1",
"react": "^18.3.1",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index dfe780d..93cc050 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -11,6 +11,9 @@ importers:
'@ant-design/cssinjs':
specifier: ^1.24.0
version: 1.24.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
+ '@ant-design/cssinjs-utils':
+ specifier: ^1.1.3
+ version: 1.1.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
'@ant-design/icons':
specifier: ^6.0.1
version: 6.0.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@@ -32,6 +35,9 @@ importers:
'@emotion/styled':
specifier: ^11.13.0
version: 11.14.1(@emotion/react@11.14.0(@types/react@18.3.24)(react@18.3.1))(@types/react@18.3.24)(react@18.3.1)
+ Slider:
+ specifier: link:rc-slider/lib/Slider
+ version: link:rc-slider/lib/Slider
antd:
specifier: ^5.21.2
version: 5.27.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
@@ -47,6 +53,15 @@ importers:
rc-field-form:
specifier: ^2.7.0
version: 2.7.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
+ rc-image:
+ specifier: ^7.12.0
+ version: 7.12.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
+ rc-input-number:
+ specifier: ^9.5.0
+ version: 9.5.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
+ rc-slider:
+ specifier: ^11.1.8
+ version: 11.1.8(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
rc-table:
specifier: ^7.53.0
version: 7.53.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
diff --git a/src/molecules/ColorPicker/ColorPicker.tsx b/src/molecules/ColorPicker/ColorPicker.tsx
index 60c28eb..2f1b056 100644
--- a/src/molecules/ColorPicker/ColorPicker.tsx
+++ b/src/molecules/ColorPicker/ColorPicker.tsx
@@ -1,6 +1,9 @@
import { ColorPickerStyles } from './styles';
-import { RdColorPickerComponent } from './types';
+import { RdColorPickerCompoundedComponent, RdColorPickerInternalComponent } from './types';
-export const ColorPicker: RdColorPickerComponent = props => {
+export const ColorPickerInternal: RdColorPickerInternalComponent = props => {
return ;
};
+
+export const ColorPicker = ColorPickerInternal as RdColorPickerCompoundedComponent;
+
diff --git a/src/molecules/ColorPicker/styles.tsx b/src/molecules/ColorPicker/styles.tsx
index 9c18be2..98f5ad4 100644
--- a/src/molecules/ColorPicker/styles.tsx
+++ b/src/molecules/ColorPicker/styles.tsx
@@ -1,9 +1,9 @@
-import styled from '@emotion/styled';
+import styled, { StyledComponent } from '@emotion/styled';
import { ColorPicker } from 'antd';
import { getExcludeForwardProps } from '../../utils';
import { RdColorPickerProps } from './types';
-export const ColorPickerStyles = styled(ColorPicker, {
+export const ColorPickerStyles: StyledComponent = styled(ColorPicker, {
shouldForwardProp: prop =>
getExcludeForwardProps(
['readonly'] as (keyof RdColorPickerProps)[],
diff --git a/src/molecules/ColorPicker/types.ts b/src/molecules/ColorPicker/types.ts
index a346d43..19dc668 100644
--- a/src/molecules/ColorPicker/types.ts
+++ b/src/molecules/ColorPicker/types.ts
@@ -1,8 +1,9 @@
-import { ColorPicker, GetProps } from 'antd';
+import { ColorPickerProps } from 'antd';
import { ComponentToken as ColorPickerComponentTokenAntd } from 'antd/es/color-picker/style';
+import { ColorPickerInternal } from './ColorPicker';
//#region Define Ant Design types
-type ColorPickerPropsAntd = GetProps;
+type ColorPickerPropsAntd = ColorPickerProps;
//#endregion
//#region Define extended component tokens
@@ -29,5 +30,7 @@ export type RdColorPickerComponentToken = ColorPickerComponentTokenAntd &
//#endregion
//#region Define component types
-export type RdColorPickerComponent = React.FC;
+export type RdColorPickerInternalComponent = React.FC;
+
+export type RdColorPickerCompoundedComponent = typeof ColorPickerInternal & {};
//#endregion
diff --git a/src/molecules/DatePicker/styles.tsx b/src/molecules/DatePicker/styles.tsx
index 4b5c684..0d7b743 100644
--- a/src/molecules/DatePicker/styles.tsx
+++ b/src/molecules/DatePicker/styles.tsx
@@ -1,10 +1,26 @@
-import styled from '@emotion/styled';
+import styled, { StyledComponent } from '@emotion/styled';
import { DatePicker } from 'antd';
+import {
+ RdDatePickerProps,
+ RdMonthPickerProps,
+ RdQuarterPickerProps,
+ RdRangePickerProps,
+ RdTimePickerProps,
+ RdWeekPickerProps,
+ RdYearPickerProps,
+} from './types';
-export const DatePickerStyles = styled(DatePicker)``;
-export const WeekPickerStyles = styled(DatePicker.WeekPicker)``;
-export const MonthPickerStyles = styled(DatePicker.MonthPicker)``;
-export const YearPickerStyles = styled(DatePicker.YearPicker)``;
-export const RangePickerStyles = styled(DatePicker.RangePicker)``;
-export const TimePickerStyles = styled(DatePicker.TimePicker)``;
-export const QuarterPickerStyles = styled(DatePicker.QuarterPicker)``;
+export const DatePickerStyles: StyledComponent = styled(DatePicker)``;
+
+export const WeekPickerStyles: StyledComponent = styled(DatePicker.WeekPicker)``;
+export const MonthPickerStyles: StyledComponent = styled(
+ DatePicker.MonthPicker
+)``;
+export const YearPickerStyles: StyledComponent = styled(DatePicker.YearPicker)``;
+export const RangePickerStyles: StyledComponent = styled(
+ DatePicker.RangePicker
+)``;
+export const TimePickerStyles: StyledComponent = styled(DatePicker.TimePicker)``;
+export const QuarterPickerStyles: StyledComponent = styled(
+ DatePicker.QuarterPicker
+)``;
diff --git a/src/molecules/Image/Image.tsx b/src/molecules/Image/Image.tsx
index 7ea3b6c..a6dca06 100644
--- a/src/molecules/Image/Image.tsx
+++ b/src/molecules/Image/Image.tsx
@@ -1,8 +1,9 @@
import { Skeleton } from '../Skeleton';
-import { ImageStyles } from './styles';
-import { RdImageComponent } from './types';
+import { PreviewGroup } from './PreviewGroup';
+import { ImageStyled } from './styles';
+import { RdImageCompositionComponent, RdImageInternalComponent } from './types';
-export const Image: RdImageComponent = props => {
+const ImageInternal: RdImageInternalComponent = props => {
const { loading = false, ...antdProps } = props;
return (
@@ -10,7 +11,7 @@ export const Image: RdImageComponent = props => {
{/**
* Note:
* Previously, when `loading = true`, the component only rendered the `Skeleton.Node`
- * and skipped rendering the `ImageStyles` completely.
+ * and skipped rendering the `ImageStyled` completely.
*
* However, in that case, the `img` element was never created, so the browser wouldn't start downloading the image,
* and we couldn't catch the `onLoad` event.
@@ -31,7 +32,11 @@ export const Image: RdImageComponent = props => {
}}
/>
)}
-
+
>
);
};
+
+export const Image = ImageInternal as RdImageCompositionComponent;
+
+Image.PreviewGroup = PreviewGroup;
\ No newline at end of file
diff --git a/src/molecules/Image/PreviewGroup.tsx b/src/molecules/Image/PreviewGroup.tsx
new file mode 100644
index 0000000..c64d0d2
--- /dev/null
+++ b/src/molecules/Image/PreviewGroup.tsx
@@ -0,0 +1,8 @@
+import { PreviewGroupStyled } from './styles';
+import { RdPreviewGroupComponent } from './types';
+
+export const PreviewGroup: RdPreviewGroupComponent = props => {
+ const { ...antdProps } = props;
+
+ return ;
+};
diff --git a/src/molecules/Image/styles.tsx b/src/molecules/Image/styles.tsx
index 97bd51d..d65c25c 100644
--- a/src/molecules/Image/styles.tsx
+++ b/src/molecules/Image/styles.tsx
@@ -3,7 +3,13 @@ import { Image } from 'antd';
import { getExcludeForwardProps } from '../../utils';
import { RdImageProps } from './types';
-export const ImageStyles = styled(Image, {
+// Note: Using `Image as any` to bypass TypeScript error TS(4023):
+// "Exported variable 'ImageStyled' has or is using name 'PreviewType' from external module ... but cannot be named."
+// Reason: The `antd` library (v5.27.3) does not export the `PreviewType` from `rc-image`,
+// causing TypeScript to fail resolving this type when generating declaration files (.d.ts).
+// This is a temporary workaround to ensure successful builds, but it sacrifices type safety for `Image`.
+// In the future, consider requesting `antd` to export `PreviewType` or re-export `PreviewType` in the project's module.
+export const ImageStyled = styled(Image as any, {
shouldForwardProp: prop =>
getExcludeForwardProps([] as (keyof RdImageProps)[], prop),
})`
@@ -16,3 +22,5 @@ export const ImageStyles = styled(Image, {
);
}}
`;
+
+export const PreviewGroupStyled = styled(Image.PreviewGroup)``;
diff --git a/src/molecules/Image/types.ts b/src/molecules/Image/types.ts
index 448ceae..21913a1 100644
--- a/src/molecules/Image/types.ts
+++ b/src/molecules/Image/types.ts
@@ -1,8 +1,11 @@
import { Image, GetProps } from 'antd';
+import { CompositionImage, ImageProps } from 'antd/es/image';
import { ComponentToken as ImageComponentTokenAntd } from 'antd/es/image/style';
+import type { GroupConsumerProps } from 'rc-image/lib/PreviewGroup';
//#region Define Ant Design types
-type ImagePropsAntd = GetProps;
+type ImagePropsAntd = ImageProps;
+type PreviewGroupPropsAntd = GroupConsumerProps;
//#endregion
//#region Define extended component tokens
@@ -15,13 +18,18 @@ type ImagePropsExtend = {
loading?: boolean;
loadingType?: ImagePropsAntd['loading'];
};
+
+type PreviewGroupPropsExtend = {};
//#endregion
//#region Export types
export type RdImageProps = Omit & ImagePropsExtend;
+export type RdPreviewGroupProps = PreviewGroupPropsAntd & PreviewGroupPropsExtend;
export type RdImageComponentToken = ImageComponentTokenAntd & ImageComponentTokenExtend;
//#endregion
//#region Define component types
-export type RdImageComponent = React.FC;
+export type RdImageInternalComponent = React.FC;
+export type RdPreviewGroupComponent = React.FC;
+export type RdImageCompositionComponent = CompositionImage;
//#endregion
diff --git a/src/molecules/InputNumber/InputNumber.tsx b/src/molecules/InputNumber/InputNumber.tsx
index a61bdbf..f6fb7ef 100644
--- a/src/molecules/InputNumber/InputNumber.tsx
+++ b/src/molecules/InputNumber/InputNumber.tsx
@@ -1,6 +1,14 @@
-import { InputNumberStyled } from './styles';
-import { RdInputNumberComponent, RdInputNumberProps } from './types';
+import { ValueType } from 'rc-input-number';
+import { useMemo } from 'react';
+import { InputNumberStyledFunc } from './styles';
+import { RdInputNumberProps } from './types';
+
+export const InputNumber = (
+ props: RdInputNumberProps
+) => {
+ const InputNumberStyled = useMemo(() => {
+ return InputNumberStyledFunc();
+ }, [InputNumberStyledFunc]);
-export const InputNumber: RdInputNumberComponent = (props: RdInputNumberProps) => {
return ;
};
diff --git a/src/molecules/InputNumber/styles.tsx b/src/molecules/InputNumber/styles.tsx
index 74fa5a5..c3a2df1 100644
--- a/src/molecules/InputNumber/styles.tsx
+++ b/src/molecules/InputNumber/styles.tsx
@@ -1,4 +1,6 @@
import styled from '@emotion/styled';
import { InputNumber } from 'antd';
+import type { ValueType } from 'rc-input-number';
-export const InputNumberStyled = styled(InputNumber)``;
+export const InputNumberStyledFunc = () =>
+ styled(InputNumber)``;
diff --git a/src/molecules/InputNumber/types.tsx b/src/molecules/InputNumber/types.tsx
index 9210e18..a3f570e 100644
--- a/src/molecules/InputNumber/types.tsx
+++ b/src/molecules/InputNumber/types.tsx
@@ -1,8 +1,10 @@
-import { GetProps, InputNumber } from 'antd';
+import { InputNumberProps } from 'antd';
import { ComponentToken as InputNumberComponentTokenAntd } from 'antd/es/input-number/style';
+import type { ValueType } from 'rc-input-number';
+import React from 'react';
//#region Define Ant Design types
-type InputNumberPropsAntd = GetProps;
+type InputNumberPropsAntd = InputNumberProps;
//#endregion
//#region Define extended component tokens
@@ -14,12 +16,20 @@ type InputNumberPropsExtend = {};
//#endregion
//#region Export types
-export type RdInputNumberProps = InputNumberPropsAntd & InputNumberPropsExtend;
+export type RdInputNumberProps = InputNumberPropsAntd &
+ InputNumberPropsExtend;
export type RdInputNumberComponentToken = InputNumberComponentTokenAntd &
InputNumberComponentTokenExtend;
//#endregion
//#region Define component types
-export type RdInputNumberComponent = React.FC;
+export type RdInputNumberInternalComponent = (
+ props: React.PropsWithChildren> & React.RefAttributes
+) => React.ReactElement;
+
+export type RdInputNumberComponent = RdInputNumberInternalComponent & {
+ displayName?: string;
+ _InternalPanelDoNotUseOrYouWillBeFired: React.FC;
+};
//#endregion
diff --git a/src/molecules/Slider/types.ts b/src/molecules/Slider/types.ts
index 32a6bf4..2fd69c1 100644
--- a/src/molecules/Slider/types.ts
+++ b/src/molecules/Slider/types.ts
@@ -1,8 +1,13 @@
-import { Slider, GetProps } from 'antd';
+import { GetProps, Slider, SliderSingleProps } from 'antd';
+import { SliderRangeProps } from 'antd/es/slider';
import { ComponentToken as SliderComponentTokenAntd } from 'antd/es/slider/style';
+import type { SliderRef } from 'rc-slider/lib/Slider';
//#region Define Ant Design types
type SliderPropsAntd = GetProps;
+type SliderSinglePropsAntd = SliderSingleProps;
+type SliderRangePropsAntd = SliderRangeProps;
+type SliderRefAntd = SliderRef;
//#endregion
//#region Define extended component tokens
@@ -19,5 +24,7 @@ export type RdSliderComponentToken = SliderComponentTokenAntd & SliderComponentT
//#endregion
//#region Define component types
-export type RdSliderComponent = React.ForwardRefExoticComponent;
+export type RdSliderComponent = React.ForwardRefExoticComponent<
+ (SliderSinglePropsAntd | SliderRangePropsAntd) & React.RefAttributes
+>;
//#endregion
diff --git a/tsconfig.json b/tsconfig.json
index 8e2d810..ac12179 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"target": "es5",
+ "lib": ["es2016", "dom"],
"module": "commonjs",
"jsx": "react-jsx",
"strict": true,
@@ -8,7 +9,7 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"declaration": true,
- "outDir": "./dist",
+ "outDir": "./dist"
// "baseUrl": ".",
// "paths": {