dev #1
							
								
								
									
										10
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								package.json
									
									
									
									
									
								
							| 
						 | 
					@ -22,13 +22,13 @@
 | 
				
			||||||
    "eslint-plugin-react-hooks": "^5.0.0",
 | 
					    "eslint-plugin-react-hooks": "^5.0.0",
 | 
				
			||||||
    "eslint-plugin-react-refresh": "^0.4.18",
 | 
					    "eslint-plugin-react-refresh": "^0.4.18",
 | 
				
			||||||
    "globals": "^15.14.0",
 | 
					    "globals": "^15.14.0",
 | 
				
			||||||
 | 
					    "react": "^19.0.0",
 | 
				
			||||||
 | 
					    "react-dom": "^19.0.0",
 | 
				
			||||||
    "sass-embedded": "^1.85.0",
 | 
					    "sass-embedded": "^1.85.0",
 | 
				
			||||||
    "typescript": "~5.7.2",
 | 
					    "typescript": "~5.7.2",
 | 
				
			||||||
    "typescript-eslint": "^8.22.0",
 | 
					    "typescript-eslint": "^8.22.0",
 | 
				
			||||||
    "vite": "^6.1.0",
 | 
					    "vite": "^6.1.0",
 | 
				
			||||||
    "vite-plugin-dts": "^4.5.0",
 | 
					    "vite-plugin-dts": "^4.5.0"
 | 
				
			||||||
    "react": "^19.0.0",
 | 
					 | 
				
			||||||
    "react-dom": "^19.0.0"
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "exports": {
 | 
					  "exports": {
 | 
				
			||||||
    "import": "./dist/datenel.es.js",
 | 
					    "import": "./dist/datenel.es.js",
 | 
				
			||||||
| 
						 | 
					@ -38,5 +38,7 @@
 | 
				
			||||||
  "main": "dist/index.cjs.js",
 | 
					  "main": "dist/index.cjs.js",
 | 
				
			||||||
  "module": "dist/datenel.es.js",
 | 
					  "module": "dist/datenel.es.js",
 | 
				
			||||||
  "types": "dist/index.d.ts",
 | 
					  "types": "dist/index.d.ts",
 | 
				
			||||||
  "files": ["dist"]
 | 
					  "files": [
 | 
				
			||||||
 | 
					    "dist"
 | 
				
			||||||
 | 
					  ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
import { useEffect, useState } from 'react'
 | 
					import { useEffect, useState } from 'react'
 | 
				
			||||||
import { getCalendarDates, getL10Weekday, generateUniqueId, applyColor } from '../utils'
 | 
					import { getCalendarDates, getL10Weekday, generateUniqueId, applyColor } from '../utils'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface Props {
 | 
					export interface SingleDatePickerProps {
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 	* Control the selected
 | 
						 	* Control the selected
 | 
				
			||||||
		* date programmatically, including situations like provide a default value or control the selected 
 | 
							* date programmatically, including situations like provide a default value or control the selected 
 | 
				
			||||||
| 
						 | 
					@ -78,9 +78,9 @@ interface Props {
 | 
				
			||||||
 * 
 | 
					 * 
 | 
				
			||||||
 * @component
 | 
					 * @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 [currentMonth, setCurrentMonth] = useState(new Date().getMonth())
 | 
				
			||||||
	const [currentYear, setCurrentYear] = useState(new Date().getFullYear())
 | 
						const [currentYear, setCurrentYear] = useState(new Date().getFullYear())
 | 
				
			||||||
	const [selectedDate, setSelectedDate] = useState(new Date())
 | 
						const [selectedDate, setSelectedDate] = useState(new Date())
 | 
				
			||||||
| 
						 | 
					@ -224,4 +224,6 @@ export default ({ value, onSelect, localization, onClose, mainColor = '#000000',
 | 
				
			||||||
			{ !!onClose && <button className='sr-only' onClick={onClose}>Close the panel</button> }
 | 
								{ !!onClose && <button className='sr-only' onClick={onClose}>Close the panel</button> }
 | 
				
			||||||
		</div>
 | 
							</div>
 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default SingleDatePicker
 | 
				
			||||||
| 
						 | 
					@ -10,9 +10,10 @@
 | 
				
			||||||
    /* Bundler mode */
 | 
					    /* Bundler mode */
 | 
				
			||||||
    "moduleResolution": "bundler",
 | 
					    "moduleResolution": "bundler",
 | 
				
			||||||
    "allowImportingTsExtensions": true,
 | 
					    "allowImportingTsExtensions": true,
 | 
				
			||||||
 | 
					    "emitDeclarationOnly": true,
 | 
				
			||||||
 | 
					    "declaration": true,
 | 
				
			||||||
    "isolatedModules": true,
 | 
					    "isolatedModules": true,
 | 
				
			||||||
    "moduleDetection": "force",
 | 
					    "moduleDetection": "force",
 | 
				
			||||||
    "noEmit": true,
 | 
					 | 
				
			||||||
    "jsx": "react-jsx",
 | 
					    "jsx": "react-jsx",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Linting */
 | 
					    /* Linting */
 | 
				
			||||||
| 
						 | 
					@ -20,7 +21,10 @@
 | 
				
			||||||
    "noUnusedLocals": true,
 | 
					    "noUnusedLocals": true,
 | 
				
			||||||
    "noUnusedParameters": true,
 | 
					    "noUnusedParameters": true,
 | 
				
			||||||
    "noFallthroughCasesInSwitch": 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": ".",
 | 
					    "baseUrl": ".",
 | 
				
			||||||
    "paths": {
 | 
					    "paths": {
 | 
				
			||||||
      "@/*": ["src/*"]
 | 
					      "@/*": ["src/*"]
 | 
				
			||||||
    }
 | 
					    },
 | 
				
			||||||
  }
 | 
					    "declaration": true,
 | 
				
			||||||
}
 | 
					    "outDir": "./dist"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "include": ["src/**/*", "tsconfig.app.json", "tsconfig.node.json"]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -9,16 +9,19 @@
 | 
				
			||||||
    /* Bundler mode */
 | 
					    /* Bundler mode */
 | 
				
			||||||
    "moduleResolution": "bundler",
 | 
					    "moduleResolution": "bundler",
 | 
				
			||||||
    "allowImportingTsExtensions": true,
 | 
					    "allowImportingTsExtensions": true,
 | 
				
			||||||
 | 
					    "emitDeclarationOnly": true,
 | 
				
			||||||
 | 
					    "declaration": true,
 | 
				
			||||||
    "isolatedModules": true,
 | 
					    "isolatedModules": true,
 | 
				
			||||||
    "moduleDetection": "force",
 | 
					    "moduleDetection": "force",
 | 
				
			||||||
    "noEmit": true,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Linting */
 | 
					    /* Linting */
 | 
				
			||||||
    "strict": true,
 | 
					    "strict": true,
 | 
				
			||||||
    "noUnusedLocals": true,
 | 
					    "noUnusedLocals": true,
 | 
				
			||||||
    "noUnusedParameters": true,
 | 
					    "noUnusedParameters": true,
 | 
				
			||||||
    "noFallthroughCasesInSwitch": true,
 | 
					    "noFallthroughCasesInSwitch": true,
 | 
				
			||||||
    "noUncheckedSideEffectImports": true
 | 
					    "noUncheckedSideEffectImports": true,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    "composite": true
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "include": ["vite.config.ts"]
 | 
					  "include": ["vite.config.ts"]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,8 @@ export default defineConfig(({mode}) => ({
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  plugins: [react(), dts({
 | 
					  plugins: [react(), dts({
 | 
				
			||||||
    insertTypesEntry: true
 | 
					    insertTypesEntry: true,
 | 
				
			||||||
 | 
					    logLevel: "info"
 | 
				
			||||||
  })],
 | 
					  })],
 | 
				
			||||||
  resolve: {
 | 
					  resolve: {
 | 
				
			||||||
    alias: {
 | 
					    alias: {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user