dev #1
							
								
								
									
										10
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								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"
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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())
 | 
			
		||||
| 
						 | 
				
			
			@ -225,3 +225,5 @@ export default ({ value, onSelect, localization, onClose, mainColor = '#000000',
 | 
			
		|||
		</div>
 | 
			
		||||
	)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default SingleDatePicker
 | 
			
		||||
| 
						 | 
				
			
			@ -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"]
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -9,6 +9,9 @@
 | 
			
		|||
    "baseUrl": ".",
 | 
			
		||||
    "paths": {
 | 
			
		||||
      "@/*": ["src/*"]
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
    },
 | 
			
		||||
    "declaration": true,
 | 
			
		||||
    "outDir": "./dist"
 | 
			
		||||
  },
 | 
			
		||||
  "include": ["src/**/*", "tsconfig.app.json", "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"]
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,8 @@ export default defineConfig(({mode}) => ({
 | 
			
		|||
    },
 | 
			
		||||
  },
 | 
			
		||||
  plugins: [react(), dts({
 | 
			
		||||
    insertTypesEntry: true
 | 
			
		||||
    insertTypesEntry: true,
 | 
			
		||||
    logLevel: "info"
 | 
			
		||||
  })],
 | 
			
		||||
  resolve: {
 | 
			
		||||
    alias: {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user