Skip to content

Commit 618416a

Browse files
committed
feat: Uniformly use "interface" as the type definition
1 parent f571f77 commit 618416a

File tree

13 files changed

+63
-42
lines changed

13 files changed

+63
-42
lines changed

packages/ui-variants/package.json

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
11
{
22
"name": "@soybean-react-ui/variants",
3-
"version": "0.0.2-beta.5",
3+
"type": "module",
4+
"version": "0.0.1",
5+
"private": false,
46
"publishConfig": {
57
"registry": "https://registry.npmjs.org/"
68
},
79
"sideEffects": false,
810
"exports": {
911
".": {
10-
"types": "./src/index.ts",
11-
"import": "./src/index.ts"
12+
"types": "./dist/index.d.ts",
13+
"import": "./dist/index.js",
14+
"require": "./dist/index.js"
1215
}
1316
},
14-
"main": "./dist/index.mjs",
15-
"module": "./dist/index.mjs",
17+
"main": "./dist/index.js",
18+
"module": "./dist/index.js",
1619
"types": "./dist/index.d.ts",
17-
"typings": "./dist/index.d.ts",
18-
"files": ["./dist"],
20+
"files": ["dist"],
1921
"scripts": {
20-
"build": "vite build"
22+
"build": "tsdown",
23+
"dev": "tsdown --watch ./src/index.ts"
2124
},
2225
"dependencies": {
2326
"clsx": "2.1.1",
2427
"tailwind-merge": "3.3.0",
2528
"tailwind-variants": "1.0.0"
29+
},
30+
"devDependencies": {
31+
"fast-glob": "^3.3.3",
32+
"tsdown": "^0.12.9",
33+
"typescript": "5.8.2"
2634
}
2735
}

packages/ui-variants/src/shared/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ import { twMerge } from 'tailwind-merge';
55
export function cn(...inputs: ClassValue[]) {
66
return twMerge(clsx(inputs));
77
}
8+
9+
export { clsx };

packages/ui/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "soybean-react-ui",
33
"type": "module",
44
"version": "0.0.1",
5-
"private": true,
5+
"private": false,
66
"exports": {
77
".": {
88
"types": "./dist/index.d.ts",
@@ -25,8 +25,12 @@
2525
"types": "./dist/index.d.ts",
2626
"files": ["dist"],
2727
"scripts": {
28-
"build": "tsdown",
29-
"dev": "tsdown --watch ./src/index.ts"
28+
"build": "pnpm build:variants && pnpm build:ui ",
29+
"build:ui": "tsdown",
30+
"build:variants": "pnpm --filter @soybean-react-ui/variants build",
31+
"dev": "pnpm dev:variants & pnpm dev:ui",
32+
"dev:ui": "tsdown --watch ./src/index.ts",
33+
"dev:variants": "pnpm --filter @soybean-react-ui/variants dev"
3034
},
3135
"dependencies": {
3236
"@radix-ui/react-accordion": "^1.2.11",

packages/ui/src/components/accordion/source/AccordionContent.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { Content } from '@radix-ui/react-accordion';
22
import { accordionVariants, cn } from '@soybean-react-ui/variants';
3+
import type { ComponentRef } from 'react';
34
import { forwardRef } from 'react';
45

56
import type { AccordionContentProps } from '../types';
67

7-
const AccordionContent = forwardRef<React.ElementRef<typeof Content>, AccordionContentProps>((props, ref) => {
8+
const AccordionContent = forwardRef<ComponentRef<typeof Content>, AccordionContentProps>((props, ref) => {
89
const { className, size, ...rest } = props;
910

1011
const { content } = accordionVariants({ size });

packages/ui/src/components/accordion/types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ import type {
77
AccordionSingleProps,
88
AccordionTriggerProps as _AccordionTriggerProps
99
} from '@radix-ui/react-accordion';
10-
import type { AccordionSlots, ClassValue, ThemeSize } from '@soybean-react-ui/variants';
10+
import type { AccordionSlots } from '@soybean-react-ui/variants';
1111

12-
import type { BaseNodeProps, PropsSlot } from '../../types/other';
12+
import type { BaseNodeProps, ClassValue, PropsSlot, ThemeSize } from '../../types/other';
1313

1414
/** The ui of the accordion. */
1515
export type AccordionUi = Partial<Record<AccordionSlots, ClassValue>>;
1616

1717
export type AccordionRootProps = BaseNodeProps<AccordionSingleProps> | BaseNodeProps<AccordionMultipleProps>;
1818

19-
export type AccordionHeaderProps = BaseNodeProps<_AccordionHeaderProps>;
19+
export interface AccordionHeaderProps extends BaseNodeProps<_AccordionHeaderProps> {}
2020

21-
export type AccordionContentProps = BaseNodeProps<_AccordionContentProps>;
21+
export interface AccordionContentProps extends BaseNodeProps<_AccordionContentProps> {}
2222

23-
export type AccordionItemProps = BaseNodeProps<_AccordionItemProps>;
23+
export interface AccordionItemProps extends BaseNodeProps<_AccordionItemProps> {}
2424

2525
export interface AccordionTriggerProps extends BaseNodeProps<_AccordionTriggerProps>, PropsSlot {
2626
/** The ui of the accordion trigger. */

packages/ui/src/components/alert-dialog/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ export type AlertDialogUi = Partial<Record<DialogSlots, ClassValue>> & {
1616

1717
export type AlertType = Extract<ThemeColor, 'destructive' | 'info' | 'success' | 'warning'>;
1818

19-
export type AlertDialogContentProps = BaseNodeProps<_AlertDialogContentProps>;
19+
export interface AlertDialogContentProps extends BaseNodeProps<_AlertDialogContentProps> {}
2020

21-
export type AlertDialogDescriptionProps = BaseNodeProps<_AlertDialogDescriptionProps>;
21+
export interface AlertDialogDescriptionProps extends BaseNodeProps<_AlertDialogDescriptionProps> {}
2222

2323
export type AlertDialogFooterProps = BaseComponentProps<'div'>;
2424

2525
export type AlertDialogHeaderProps = BaseComponentProps<'div'>;
2626

27-
export type AlertDialogOverlayProps = BaseNodeProps<_AlertDialogOverlayProps>;
27+
export interface AlertDialogOverlayProps extends BaseNodeProps<_AlertDialogOverlayProps> {}
2828

29-
export type AlertDialogTitleProps = BaseNodeProps<_AlertDialogTitleProps>;
29+
export interface AlertDialogTitleProps extends BaseNodeProps<_AlertDialogTitleProps> {}
3030

3131
export type AlertDialogProps = BaseNodeProps<_AlertDialogProps> &
3232
AlertDialogContentProps &

packages/ui/src/components/aspect-ratio/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import type { AspectRatioProps as _AspectRatioProps } from '@radix-ui/react-aspe
22

33
import type { BaseNodeProps } from '../../types/other';
44

5-
export type AspectRatioProps = BaseNodeProps<_AspectRatioProps>;
5+
export interface AspectRatioProps extends BaseNodeProps<_AspectRatioProps> {}

packages/ui/src/components/avatar/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import type { BaseNodeProps, ClassValue } from '../../types/other';
99

1010
export type AvatarUi = Partial<Record<AvatarSlots, ClassValue>>;
1111

12-
export type AvatarRootProps = BaseNodeProps<_AvatarRootProps>;
12+
export interface AvatarRootProps extends BaseNodeProps<_AvatarRootProps> {}
1313

14-
export type AvatarFallbackProps = BaseNodeProps<_AvatarFallbackProps>;
14+
export interface AvatarFallbackProps extends BaseNodeProps<_AvatarFallbackProps> {}
1515

16-
export type AvatarImageProps = BaseNodeProps<_AvatarImageProps>;
16+
export interface AvatarImageProps extends BaseNodeProps<_AvatarImageProps> {}
1717

1818
export interface AvatarProps extends AvatarImageProps, Pick<AvatarFallbackProps, 'delayMs'> {
1919
classNames?: AvatarUi;

packages/ui/src/components/checkbox/types.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import type { BaseComponentProps, BaseNodeProps, ClassValue, ThemeColor } from '
88

99
export type CheckboxUi = Partial<Record<CheckboxSlots, ClassValue>>;
1010

11-
export type CheckboxControlProps = BaseNodeProps<_CheckboxRootProps> & {
11+
export interface CheckboxControlProps extends BaseNodeProps<_CheckboxRootProps> {
1212
color?: ThemeColor;
13-
};
13+
}
1414

15-
export type CheckboxIndicatorProps = BaseNodeProps<_CheckboxIndicatorProps>;
15+
export interface CheckboxIndicatorProps extends BaseNodeProps<_CheckboxIndicatorProps> {}
1616

17-
export type CheckboxRootProps = BaseComponentProps<'div'>;
17+
export interface CheckboxRootProps extends BaseComponentProps<'div'> {}
1818

19-
export type CheckboxProps = CheckboxControlProps & {
19+
export interface CheckboxProps extends CheckboxControlProps {
2020
classNames?: CheckboxUi;
2121
forceMountIndicator?: true;
22-
};
22+
}

packages/ui/src/components/label/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import type { LabelProps as _LabelProps } from '@radix-ui/react-label';
22

33
import type { BaseNodeProps } from '../../types';
44

5-
export type LabelProps = BaseNodeProps<_LabelProps>;
5+
export interface LabelProps extends BaseNodeProps<_LabelProps> {}

0 commit comments

Comments
 (0)