diff --git a/package.json b/package.json index 6f9cda4..c6432d5 100644 --- a/package.json +++ b/package.json @@ -22,13 +22,13 @@ "eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-react-refresh": "^0.4.18", "globals": "^15.14.0", + "react": "^19.0.0", + "react-dom": "^19.0.0", "sass-embedded": "^1.85.0", "typescript": "~5.7.2", "typescript-eslint": "^8.22.0", "vite": "^6.1.0", - "vite-plugin-dts": "^4.5.0", - "react": "^19.0.0", - "react-dom": "^19.0.0" + "vite-plugin-dts": "^4.5.0" }, "exports": { "import": "./dist/datenel.es.js", @@ -38,5 +38,7 @@ "main": "dist/index.cjs.js", "module": "dist/datenel.es.js", "types": "dist/index.d.ts", - "files": ["dist"] + "files": [ + "dist" + ] } diff --git a/src/components/SingleDatePicker.tsx b/src/components/SingleDatePicker.tsx index 8c83d8c..d4096ae 100644 --- a/src/components/SingleDatePicker.tsx +++ b/src/components/SingleDatePicker.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react' import { getCalendarDates, getL10Weekday, generateUniqueId, applyColor } from '../utils' -interface Props { +export interface SingleDatePickerProps { /** * Control the selected * date programmatically, including situations like provide a default value or control the selected @@ -78,9 +78,9 @@ interface Props { * * @component * - * @param {Props} props + * @param {SingleDatePickerProps} props */ -export default ({ value, onSelect, localization, onClose, mainColor = '#000000', accentColor = '#000000', reversedColor = '#ffffff', hoverColor = '#00000017', borderColor = '#e0e0e0' }: Props) => { +const SingleDatePicker: React.FC = ({ value, onSelect, localization, onClose, mainColor = '#000000', accentColor = '#000000', reversedColor = '#ffffff', hoverColor = '#00000017', borderColor = '#e0e0e0' }: SingleDatePickerProps) => { const [currentMonth, setCurrentMonth] = useState(new Date().getMonth()) const [currentYear, setCurrentYear] = useState(new Date().getFullYear()) const [selectedDate, setSelectedDate] = useState(new Date()) @@ -224,4 +224,6 @@ export default ({ value, onSelect, localization, onClose, mainColor = '#000000', { !!onClose && } ) -} \ No newline at end of file +} + +export default SingleDatePicker \ No newline at end of file diff --git a/tsconfig.app.json b/tsconfig.app.json index 358ca9b..1da4adf 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -10,9 +10,10 @@ /* Bundler mode */ "moduleResolution": "bundler", "allowImportingTsExtensions": true, + "emitDeclarationOnly": true, + "declaration": true, "isolatedModules": true, "moduleDetection": "force", - "noEmit": true, "jsx": "react-jsx", /* Linting */ @@ -20,7 +21,10 @@ "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true + "noUncheckedSideEffectImports": true, + + "composite": true, + "outDir": "./dist" // 指定输出目录 }, - "include": ["src"] -} + "include": ["src", "tsconfig.app.json", "tsconfig.node.json"] +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index dfc4658..2456ef6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,6 +9,9 @@ "baseUrl": ".", "paths": { "@/*": ["src/*"] - } - } -} + }, + "declaration": true, + "outDir": "./dist" + }, + "include": ["src/**/*", "tsconfig.app.json", "tsconfig.node.json"] +} \ No newline at end of file diff --git a/tsconfig.node.json b/tsconfig.node.json index db0becc..0ee34bb 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -9,16 +9,19 @@ /* Bundler mode */ "moduleResolution": "bundler", "allowImportingTsExtensions": true, + "emitDeclarationOnly": true, + "declaration": true, "isolatedModules": true, "moduleDetection": "force", - "noEmit": true, /* Linting */ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true + "noUncheckedSideEffectImports": true, + + "composite": true }, "include": ["vite.config.ts"] } diff --git a/vite.config.ts b/vite.config.ts index c487547..36217fc 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -20,7 +20,8 @@ export default defineConfig(({mode}) => ({ }, }, plugins: [react(), dts({ - insertTypesEntry: true + insertTypesEntry: true, + logLevel: "info" })], resolve: { alias: {