Gathering detailed insights and metrics for chakra-dp-custom
Gathering detailed insights and metrics for chakra-dp-custom
Gathering detailed insights and metrics for chakra-dp-custom
Gathering detailed insights and metrics for chakra-dp-custom
npm install chakra-dp-custom
Typescript
Module System
Min. Node Version
Node Version
NPM Version
69.4
Supply Chain
99
Quality
74.9
Maintenance
100
Vulnerability
100
License
TypeScript (98.32%)
HTML (0.9%)
JavaScript (0.78%)
Total Downloads
377
Last Day
1
Last Week
1
Last Month
16
Last Year
86
MIT License
123 Commits
1 Branches
1 Contributors
Updated on Aug 23, 2023
Minified
Minified + Gzipped
Latest Version
1.0.1
Package Id
chakra-dp-custom@1.0.1
Unpacked Size
203.69 kB
Size
44.51 kB
File Count
28
NPM Version
9.2.0
Node Version
18.12.0
Published on
Aug 23, 2023
Cumulative downloads
Total Downloads
Every individual component is using Chakra UI. So it should respect all Chakra UI Configs without problem.
The componenent itself has to use some date
library
Highly recommend just copy/paste the source code from /src
to customize however you want.
Npm
npm i date-fns dayzed
npm i chakra-dayzed-datepicker
Yarn:
yarn add date-fns dayzed
yarn add chakra-dayzed-datepicker
1 2 import { SingleDatepicker } from "chakra-dayzed-datepicker"; 3 4 const [date, setDate] = useState(new Date()); 5 6 <SingleDatepicker 7 name="date-input" 8 date={date} 9 onDateChange={setDate} 10 /> 11
Note that this list will have one value during the selection process. Your system won't work if you try to control this directly as [startDate, endDate]
because we'll try to set selectedDates
to [intermediateSelection]
and the length of the resulting selectedDates
is meaningful to the datepicker.
1 2 import { RangeDatepicker } from "chakra-dayzed-datepicker"; 3 4 const [selectedDates, setSelectedDates] = useState<Date[]>([new Date(), new Date()]); 5 6 <RangeDatepicker 7 selectedDates={selectedDates} 8 onDateChange={setSelectedDates} 9 />
dateNavBtnProps
extends from ButtonProps
of Chakra-UI
This allows you to override the default behavior however your want as long as supported by Chakra-UI.
1dayOfMonthBtnProps = { 2 defaultBtnProps, 3 isInRangeBtnProp, 4 selectedBtnProps, 5 todayBtnProps 6}
dayOfMonthBtnProps
allows you to customzie date btn style based on the state.
Style precedence: default
< isInRange
< seleted
< today
.
popoverCompProps
might be useful when you want to setup some simple styles like text color globally
1popoverCompProps = { 2 popoverContentProps, 3 popoverBodyProps 4}
To sum them up:
1 propsConfigs={{ 2 dateNavBtnProps: {}, 3 dayOfMonthBtnProps: { 4 defaultBtnProps: {}, 5 isInRangeBtnProps: {}, 6 selectedBtnProps: {}, 7 todayBtnProps: {} 8 }, 9 inputProps: {}, 10 popoverCompProps: { 11 popoverContentProps: {}, 12 popoverBodyProps: {} 13 }, 14 weekdayLabelProps: {}, 15 dateHeadingProps: {} 16 }}
Example:
1 propsConfigs={{ 2 dateNavBtnProps: { 3 colorScheme: "blue", 4 variant: "outline" 5 }, 6 dayOfMonthBtnProps: { 7 defaultBtnProps: { 8 borderColor: "red.300", 9 _hover: { 10 background: 'blue.400', 11 } 12 }, 13 isInRangeBtnProps: { 14 color: "yellow", 15 }, 16 selectedBtnProps: { 17 background: "blue.200", 18 color: "green", 19 }, 20 todayBtnProps: { 21 background: "teal.400", 22 } 23 }, 24 inputProps: { 25 size: "sm" 26 }, 27 popoverCompProps: { 28 popoverContentProps: { 29 background: "gray.700", 30 color: "white", 31 }, 32 }, 33 weekdayLabelProps: { 34 fontWeight: 'normal' 35 }, 36 dateHeadingProps: { 37 fontWeight: 'semibold' 38 } 39 }}
Non Chakra-related configurations :
configs={{
dateFormat: 'yyyy-MM-dd',
dayNames: 'abcdefg'.split(''), // length of 7
monthNames: 'ABCDEFGHIJKL'.split(''), // length of 12
firstDayOfWeek: 2, // default is 0, the dayNames[0], which is Sunday if you don't specify your own dayNames,
}}
Name | single/range | Type | Default value | Description |
---|---|---|---|---|
name | both | string | undefined | name attribute for <input /> element |
usePortal | both | boolean | undefined | to prevent parent styles from clipping or hiding content |
defaultIsOpen | both | boolean | false | open the date panel at the beginning |
closeOnSelect | both | boolean | true | close the date panel upon the complete selection |
minDate | both | Date | undefined | minimum date |
maxDate | both | Date | undefined | maximum date |
disabledDates | single | Set | undefined | for single datepicker only, uses startOfDay as comparison, e.g., disabledDates={new Set([startOfDay(new Date()).getTime()} |
For version < npm@0.1.6
:
dayOfMonthBtnProps
extends from ButtonProps
and has only selectedBg
support,
1 dayOfMonthBtnProps: { 2 borderColor: "red.300", 3 selectedBg: "blue.200", 4 _hover: { 5 bg: 'blue.400', 6 } 7 },
No vulnerabilities found.
No security vulnerabilities found.
Last Day
0%
1
Compared to previous day
Last Week
-83.3%
1
Compared to previous week
Last Month
100%
16
Compared to previous month
Last Year
-70.4%
86
Compared to previous year