import { ArgsTable, Canvas, Meta, Story } from "@storybook/addon-docs";
import DateRangeCalendar from '..'


# DateRangeCalendar

## Importing the component in your project.

```js
import {DateRangeCalendar} from 'pcm-shared-components';
```

### Usage
Check out the index.stories.jsx file DateRangeCalendarComp to see a full simple example of how it whould be used in.

#### Minimum REQUIRED setup NEEDED to get the DateRangeCalendar working:
```js
import React, {useState} from 'react'
import {DateRangeCalendar } from 'pcm-shared-components';

function App() {

  //States
  const [state, setState] = useState({ startDate: null, endDate: null, focusedInput: 'startDate' })

  //Functions
  const handleDatesChange = (data) => {
    setState(data)
  }
  const handleOnFocusChange = (data) =>{
    setState((previousState)=>{return{...previousState,focusedInput:data}});
  }

  return (
    <DateRangeCalendar
      onDatesChange={handleDatesChange}
      onFocusChange={handleOnFocusChange}
      startDate={state.startDate} // Date or null
      endDate={state.endDate} // Date or null
      focusedInput={state.focusedInput} // START_DATE, END_DATE or null
      i18next={i18next}
    />
  )
}
```
### See a Codesandbox example with styling
https://codesandbox.io/s/react-date-picker-rangeinput-jw726?from-embed=&file=/src/index.js:2503-2537 

### Styling Props
The following are the theme props taken form the codesandbox from above so I have a local copy of the possible props.
```js
 <ThemeProvider
      theme={{
        breakpoints: ["32em", "48em", "64em"],
        reactDatepicker: {
          daySize: [36, 36],
          fontFamily: "system-ui, -apple-system",
          colors: {
            primaryColor: "#4B35D2",
            accessibility: "#4B35D2",
            selectedDay: "#EEEDFD",
            selectedDayHover: "#faf9fd",
            normalDayHover: "#faf9fd"
          },

          dayLabelFontSize: 10,
          dayLabelColor: "#8F8B9B",

          selectDateLabelFontSize: 10,
          selectDateLabelColor: "#D0CED5",
          selectDateDateFontSize: 14,
          selectDateDateColor: "#34323A",
          selectDateBorderColor: "#4B35D2",

          navButtonBorder: "none",

          monthLabelFontSize: 16,
          monthLabelFontWeight: 600,

          dayBackground: "#ffffff",
          dayBorderColor: "transparent",
          dayColor: "#34323A",
          dayFontSize: 15,
          daySelectedBorderColor: "transparent",
          daySelectedColor: "#34323A",
          daySelectedHoverColor: "#000000",
          dayHoverColor: "#000000",
          dayHoverBackground: "#EEEDFD",
          //dayHoverRangeColor: "#000000", // attention
          dayHoverRangeBackground: "#EEEDFD",
          dayAccessibilityBorderColor: "none",

          inputLabelDisplay: "flex",
          inputLabelBorder: "none",
          inputLabelMargin: 0,
          inputPadding: 0,
          inputBorder: "none",
          inputFontSize: 14,
          inputColor: "#34323A",
          inputActiveBoxShadow: "none",
          inputBackground: "none",

          datepickerZIndex: 1,
          datepickerBoxShadow: "0px 5px 15px #28128733",
          datepickerBorderRadius: 5,
          datepickerPadding: 25,
          datepickerPosition: "absolute",
          datepickerMonthsGridGap: 10,

          dateRangeBorder: "none",
          dateRangeArrowIconColor: "#34323A",
          dateRangeStartDateInputPadding: 0,
          dateRangeEndDateInputPadding: 0,
          dateRangeDatepickerWrapperLeft: 30,
          dateRangeDatepickerWrapperTop: 80
        }
      }}
    >
```


<ArgsTable of={DateRangeCalendar} />