3.0.11 • Published 8 months ago

@licuido-ui/ui_date-range-selector v3.0.11

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

DateRangeSelector

The DateRangeSelector component is a customizable modal dialog box that can be used to display information, messages, or custom content with optional title, body, and footer components.

Author

Npm Package Extension

  • react-datepicker

Link

Story Book Link DateRangeSelector

PlayGround

Try it have a fun codeBox

Installation

npm i "@licuido-ui/ui_date-range-selector"

Import component

import { DateRangeSelector } from '@licuido-ui/ui_date-range-selector';

Usage

      <DateRangeSelector
      selectedBackgroundColor='red'
      selectedColor='blue'
      startRangeBackgroundColor='red'
      endRangeBackgroundColor='red'
      rangeSelectedBackgroundColor='green'
      rangeSelectedColor='white'
      selectsRange={true as unknown as undefined}
      onSubmit={(e) => console.log(e)}
      secondButton
      firstButton
    />

Image

alt text

Single Select
You don't props Allow an selectRange its a boolean type if you use a false it cannot show of select range

alt text

Multi Select
You must allow a props of selectRange its shown a dummy data

alt text

Sample Code

    <DateRangeSelector
    selectedBackgroundColor
    selectedColor
    rangeSelectedBackgroundColor
    rangeSelectedColor
    startRangeBackgroundColor
    endRangeBackgroundColor
    selectsRange
    buttonRootStyle
    doneButtonStyle
    subRootStyle
    cancelButtonStyle
    cancelVariant = 'outlined'
    doneVariant = 'contained'
    firstButtonName = 'Cancel'
    secondButtonName = 'Done'
    firstButton
    secondButton
    maxDate
    minDate
    initialSelectedBgcolor
    initialMonthDropdownHover
    initialSelectedMonthDropdownBgcolor
    className = ''
    sx = {}
    />

DateRangeSelector Component

Props

PropTypeDescriptionDefault
selectedBackgroundColorstringBackground color for selected dates'#0c356a'
selectedColorstringText color for selected dates'#fff'
rangeSelectedBackgroundColorstringBackground color for dates within a range'#d7e3ff'
rangeSelectedColorstringText color for dates within a range'#1D192B'
selected is a default state using a new Date()Datehandle a date to set a default value in dateState this is an date formate eg:: Wed Mar 25 2015 05:30:00 GMT+0530 (India Standard Time) range'#1D192B'
startRangeBackgroundColorstringBackground color for the start of a date range'#0c356a'
endRangeBackgroundColorstringBackground color for the end of a date range'#0c356a'
buttonRootStyleobject (SxProps)Styles for the root container of buttons{ display: 'flex', gap: 1, justifyContent: 'end', pr: 2.5, pb: 1.5 }
yearReversebooleanfor showing year in ascending orderfalse
doneButtonStyleobject (SxProps)Styles for the "Done" buttonSee code below
cancelButtonStyleobject (SxProps)Styles for the "Cancel" buttonSee code below
subRootStyleobject (SxProps)Styles for the sub-root container{ width: '332px' }
cancelVariant'outlined' \| 'contained' \| 'text'Variant for the "Cancel" button'outlined'
doneVariant'outlined' \| 'contained' \| 'text'Variant for the "Done" button'contained'
firstButtonNamestringLabel for the "Cancel" button'Cancel'
secondButtonNamestringLabel for the "Done" button'Done'
firstButtonbooleanDisplay the "Cancel" buttontrue
secondButtonbooleanDisplay the "Done" buttontrue
maxDatestringhide a future date in Date range picker
minDatestringhide a previous date in Date range picker
initialSelectedBgcolorstringBackground color for the start of a date range'#0c356a'
initialMonthDropdownHoverstringBackground color for the dropDown of a Month date range'#D7E3FF'
initialSelectedMonthDropdownBgcolorstringBackground color for the dropDown of a Month range'#D7E3FF'
hidePastYearbooleanHide past yearfalse
hideFutureYearbooleanHide future yearfalse

Default Props

{
  selectedBackgroundColor: '#0c356a',
  selectedColor: '#fff',
  rangeSelectedBackgroundColor: '#d7e3ff',
  rangeSelectedColor: '#1D192B',
  startRangeBackgroundColor: '#0c356a',
  endRangeBackgroundColor: '#0c356a',
  buttonRootStyle: { display: 'flex', gap: 1, justifyContent: 'end', pr: 2.5, pb: 1.5 },
  doneButtonStyle: {
    boxShadow: 'none',
    p: '6px 16px',
    bgcolor: '#0C356A',
    fontSize: '14px',
    '&:hover': {
      boxShadow: 'none',
      bgcolor: '#0C356A',
      opacity: '1.1',
    },
  },
  cancelButtonStyle: {
    '&:hover': {
      boxShadow: 'none',
      color: '#0C356A',
      opacity: '1.1',
      borderColor: '#0C356A',
    },
    color: '#0C356A',
    p: '6px 12px',
    border: '1px solid',
    borderColor: '#0C356A',
    borderRadius: '8px',
    fontSize: '14px',
    boxShadow: 'none',
  },
  subRootStyle: {
    width: '332px',
  },
  firstButtonName: 'Cancel',
  secondButtonName: 'Done',
  yearReverse: {false}
}