Gathering detailed insights and metrics for @datepicker-react/styled
Gathering detailed insights and metrics for @datepicker-react/styled
Gathering detailed insights and metrics for @datepicker-react/styled
Gathering detailed insights and metrics for @datepicker-react/styled
npm install @datepicker-react/styled
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
331 Stars
326 Commits
54 Forks
9 Watching
27 Branches
15 Contributors
Updated on 05 Aug 2024
JavaScript (65.88%)
TypeScript (34.1%)
HTML (0.02%)
Cumulative downloads
Total Downloads
Last day
3.5%
645
Compared to previous day
Last week
-3.2%
3,220
Compared to previous week
Last month
3.5%
13,300
Compared to previous month
Last year
-8.5%
205,190
Compared to previous year
2
2
An easily internationalizable, accessible, mobile-friendly datepicker library for the web, build with styled-components.
over and I will transfer it to you.
Simple. Use React hooks (@datepicker-react/hooks).
For examples of the datepicker in action, go to https://datepicker-react.netlify.com/.
OR
To run that demo on your own computer:
yarn install && yarn bootstrap
yarn storybook
1yarn add @datepicker-react/styled styled-components
1import {DateRangeInput, DateSingleInput, Datepicker} from '@datepicker-react/styled'
The DateRangeInput
is a fully controlled component that allows users to select a date range. You
can control the selected dates using the startDate
, endDate
, and onDatesChange
props as shown
below. Similarly, you can control which input is focused as well as calendar visibility (the
calendar is only visible if focusedInput
is defined) with the focusedInput
and onFocusChange
props as shown below.
Here is the minimum REQUIRED setup you need to get the DateRangeInput
working:
IE11 is not supported
1import React, {useReducer} from 'react' 2import {DateRangeInput} from '@datepicker-react/styled' 3 4const initialState = { 5 startDate: null, 6 endDate: null, 7 focusedInput: null, 8} 9 10function reducer(state, action) { 11 switch (action.type) { 12 case 'focusChange': 13 return {...state, focusedInput: action.payload} 14 case 'dateChange': 15 return action.payload 16 default: 17 throw new Error() 18 } 19} 20 21function App() { 22 const [state, dispatch] = useReducer(reducer, initialState) 23 24 return ( 25 <DateRangeInput 26 onDatesChange={data => dispatch({type: 'dateChange', payload: data})} 27 onFocusChange={focusedInput => dispatch({type: 'focusChange', payload: focusedInput})} 28 startDate={state.startDate} // Date or null 29 endDate={state.endDate} // Date or null 30 focusedInput={state.focusedInput} // START_DATE, END_DATE or null 31 /> 32 ) 33}
The following is a list of other OPTIONAL props you may provide to the DateRangeInput
to
customize appearance and behavior to your heart's desire.
1displayFormat?: string | FormatFunction // Default: 'MM/DD/YYYY' 2phrases?: DateRangeInputPhrases 3showStartDateCalendarIcon?: boolean // Default: true 4showEndDateCalendarIcon?: boolean // Default: true 5onClose?(): void 6vertical?: boolean // Default: false 7showResetDates?: boolean // Default: true 8showSelectedDates?: boolean // Default: true 9showClose?: boolean // Default: true 10rtl?: boolean // Default: false 11placement?: 'top' | 'bottom' // Default: bottom 12unavailableDates?: Date[] // Default: [] 13minBookingDate?: Date 14maxBookingDate?: Date 15numberOfMonths?: number // Default: 2 16minBookingDays?: number // Default: 1 17exactMinBookingDays?: boolean // Default: false 18firstDayOfWeek?: FirstDayOfWeek // Default: 1 19initialVisibleMonth?: Date 20isDateBlocked?(date: Date): boolean 21dayLabelFormat?(date: Date): string 22weekdayLabelFormat?(date: Date): string 23monthLabelFormat?(date: Date): string 24onDayRender?(date: Date): React.ReactNode 25startDateInputId?: string 26endDateInputId?: string
The Datepicker
is a fully controlled component that allows users to select a date range. You can
control the selected dates using the startDate
, endDate
, and onDatesChange
props as shown
below. Similarly, you can control which input is focused with the focusedInput
prop.
Here is the minimum REQUIRED setup you need to get the Datepicker
working:
IE11 is not supported
1import React, {useState} from 'react' 2import {Datepicker, START_DATE} from '@datepicker-react/styled' 3 4function App() { 5 const [state, setState] = useState({ 6 startDate: null, 7 endDate: null, 8 focusedInput: START_DATE, 9 }) 10 11 function handleDatesChange(data: OnDatesChangeProps) { 12 if (!data.focusedInput) { 13 setState({...data, focusedInput: START_DATE}) 14 } else { 15 setState(data) 16 } 17 } 18 19 return ( 20 <Datepicker 21 onDatesChange={handleDatesChange} 22 startDate={state.startDate} // Date or null 23 endDate={state.endDate} // Date or null 24 focusedInput={state.focusedInput} // START_DATE, END_DATE or null 25 /> 26 ) 27}
The following is a list of other OPTIONAL props you may provide to the Datepicker
to customize
appearance and behavior to your heart's desire.
1phrases?: DatepickerPhrases 2displayFormat?: string | FormatFunction // Default: 'MM/DD/YYYY' 3onClose?(): void 4showResetDates?: boolean // Default: true 5showSelectedDates?: boolean // Default: true 6showClose?: boolean // Default: true 7vertical?: boolean // Default: false 8rtl?: boolean // Default: false 9unavailableDates?: Date[] // Default: [] 10minBookingDate?: Date 11maxBookingDate?: Date 12numberOfMonths?: number // Default: 2 13minBookingDays?: number // Default: 1 14exactMinBookingDays?: boolean // Default: false 15firstDayOfWeek?: FirstDayOfWeek // Default: 0 16initialVisibleMonth?: Date 17isDateBlocked?(date: Date): boolean 18dayLabelFormat?(date: Date): string 19weekdayLabelFormat?(date: Date): string 20monthLabelFormat?(date: Date): string 21onDayRender?(date: Date): React.ReactNode
The DateSingleInput
is a fully controlled component that allows users to select a date. You can
control the selected date using the date
and onDateChange
props as shown below. Similarly, you
can control calendar visibility (the calendar is only visible if showDatepicker
is true
) with
the showDatepicker
and onFocusChange
props as shown below.
Here is the minimum REQUIRED setup you need to get the DateSingleInput
working:
IE11 is not supported
1import React, {useReducer} from 'react' 2import {DateSingleInput} from '@datepicker-react/styled' 3 4const initialState = { 5 date: null, 6 showDatepicker: false, 7} 8 9function reducer(state, action) { 10 switch (action.type) { 11 case 'focusChange': 12 return {...state, showDatepicker: action.payload} 13 case 'dateChange': 14 return action.payload 15 default: 16 throw new Error() 17 } 18} 19 20function App() { 21 const [state, dispatch] = useReducer(reducer, initialState) 22 23 return ( 24 <DateSingleInput 25 onDateChange={data => dispatch({type: 'dateChange', payload: data})} 26 onFocusChange={focusedInput => dispatch({type: 'focusChange', payload: focusedInput})} 27 date={state.date} // Date or null 28 showDatepicker={state.showDatepicker} // Boolean 29 /> 30 ) 31}
The following is a list of other OPTIONAL props you may provide to the DateSingleInput
to
customize appearance and behavior to your heart's desire.
1minBookingDate?: Date 2maxBookingDate?: Date 3numberOfMonths?: number 4firstDayOfWeek?: FirstDayOfWeek 5displayFormat?: string | FormatFunction 6phrases?: DateSingleInputPhrases 7showCalendarIcon?: boolean 8vertical?: boolean 9showResetDate?: boolean 10showClose?: boolean 11rtl?: boolean 12placement?: 'top' | 'bottom' 13initialVisibleMonth?: Date 14unavailableDates?: Date[] // Default: [] 15isDateBlocked?(date: Date): boolean 16onClose?(): void 17dayLabelFormat?(date: Date): string 18weekdayLabelFormat?(date: Date): string 19monthLabelFormat?(date: Date): string 20onDayRender?(date: Date): React.ReactNode 21inputId?: string
@datepicker-react/styled
supports theming with Styled components ThemeProvider
and
Styled System
theme-based style.
1<ThemeProvider 2 theme={{ 3 breakpoints: ['32em', '48em', '64em'], 4 reactDatepicker: { 5 daySize: [36, 40], 6 fontFamily: 'system-ui, -apple-system', 7 colors: { 8 accessibility: '#D80249', 9 selectedDay: '#f7518b', 10 selectedDayHover: '#F75D95', 11 primaryColor: '#d8366f', 12 }, 13 }, 14 }} 15> 16 ... 17</ThemeProvider>
Licensed under the MIT License, Copyright © 2019-present Miha Sedej.
See LICENSE for more information.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 4/11 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
131 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More