5.0.1 • Published 2 years ago

@paprika/calendar v5.0.1

Weekly downloads
2,417
License
MIT
Repository
github
Last release
2 years ago

Calendar

This package consists of two components (SingleDateCalendar and DateRangeCalendar) providing calendar views but with difference that SingleDateCalendar allows selecting only one exact date and DateRangeCalendar allows selection range of dates.

Installation

npm install --save @paprika/calendar

or

yarn add @paprika/calendar

Usage

Please use <L10n /> component to wrap calendar components or you application.

SingleDateCalendar

import SingleDateCalendar from "@paprika/calendar/lib/SingleDateCalendar";
// alternative (but has potential problems with tree-shaking):
// import { SingleDateCalendar } from "@paprika/calendar";

const [date, setDate] = React.useState(null);
const [possibleDate, setPossibleDate] = React.useState(null);

<SingleDateCalendar
  date={date}
  onSelect={setDate}
  possibleDate={possibleDate}
  resetPossibleDate={() => {
    setPossibleDate(null);
  }}
/>;

DateRangeCalendar

import DateRangeCalendar from "@paprika/calendar/lib/DateRangeCalendar";
// alternative (but has potential problems with tree-shaking):
// import { DateRangeCalendar } from "@paprika/calendar";
import { START_DATE } from "@paprika/calendar/lib/tokens";

const [currentInput, setCurrentInput] = React.useState(START_DATE);
const [{ startDate, endDate }, setDates] = React.useState({ startDate: null, endDate: null });
const [possibleDate, setPossibleDate] = React.useState(null);

<DateRangeCalendar
  startDate={startDate}
  endDate={endDate}
  onDatesChange={setDates}
  possibleDate={possibleDate}
  resetPossibleDate={() => {
    setPossibleDate(null);
  }}
  focusedInput={currentInput || START_DATE}
  onFocusChange={setCurrentInput}
/>;

Props

SingleDateCalendar

  • date (required)
  • onSelect (required)
  • possibleDate
  • resetPossibleDate

DateRangeCalendar

  • startDate (required)
  • endDate (required)
  • onDatesChange (required)
  • possibleDate
  • resetPossibleDate
  • focusedInput (required)
  • onFocusChange (required)
5.0.1

2 years ago

5.0.1-next.0

2 years ago

5.0.0

2 years ago

5.0.0-next.0

2 years ago

4.0.1

2 years ago

4.0.1-next.0

2 years ago

4.0.0

2 years ago

4.0.0-next.0

2 years ago

3.0.3

3 years ago

3.0.3-next.0

3 years ago

3.0.2-next.0

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0-next.0

3 years ago

3.0.0

3 years ago

3.0.1-next.0

3 years ago

2.0.7

3 years ago

2.0.8

3 years ago

2.0.7-next.1

3 years ago

2.0.7-next.0

3 years ago

2.0.8-next.0

3 years ago

2.0.6-next.2

3 years ago

2.0.6-next.1

3 years ago

2.0.6-next.0

3 years ago

2.0.6

3 years ago

2.0.5

4 years ago

2.0.5-next.0

4 years ago

2.0.5-next.1

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.4

4 years ago

2.0.4-next.0

4 years ago

2.0.2-next.0

4 years ago

2.0.3-next.2

4 years ago

2.0.3-next.1

4 years ago

2.0.3-next.0

4 years ago

2.0.3-next.3

4 years ago

2.0.0-next.1

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

2.0.1-next.0

4 years ago

2.0.0-next.0

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.21-next.0

4 years ago

1.0.22-next.0

4 years ago

1.0.20

4 years ago

1.0.20-next.0

4 years ago

1.0.19

4 years ago

1.0.19-next.0

4 years ago

1.0.18

4 years ago

1.0.18-next.0

4 years ago

1.0.17

4 years ago

1.0.17-next.0

4 years ago

1.0.16

4 years ago

1.0.16-next.0

4 years ago

1.0.15

4 years ago

1.0.15-next.0

4 years ago

1.0.14

4 years ago

1.0.14-next.0

4 years ago

1.0.13-next.0

4 years ago

1.0.12-next.0

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11-next.0

4 years ago

1.0.10-next.1

4 years ago

1.0.10-next.0

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.9-alpha.2

4 years ago

1.0.9-alpha.1

4 years ago

1.0.9-alpha.0

4 years ago

1.0.8

4 years ago

1.0.8-alpha.0

4 years ago

1.0.7

4 years ago

1.0.7-alpha.0

4 years ago

1.0.6-alpha.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.5-alpha.0

5 years ago

1.0.4

5 years ago

1.0.4-alpha.0

5 years ago

1.0.3

5 years ago

1.0.3-alpha.1

5 years ago

1.0.3-alpha.0

5 years ago

1.0.2

5 years ago

1.0.2-alpha.1

5 years ago

1.0.2-alpha.0

5 years ago

1.0.1

5 years ago

1.0.1-alpha.1

5 years ago

1.0.1-alpha.0

5 years ago

1.0.0

5 years ago

0.1.17

5 years ago

0.1.17-alpha.4

5 years ago

0.1.17-alpha.3

5 years ago

0.1.17-alpha.1

5 years ago

0.1.17-alpha.2

5 years ago

0.1.17-alpha.0

5 years ago

0.1.16

5 years ago

0.1.14

5 years ago

0.1.15

5 years ago

0.1.13

5 years ago

0.1.12

5 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago