Socket
Socket
Sign inDemoInstall

@paprika/calendar

Package Overview
Dependencies
196
Maintainers
4
Versions
116
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @paprika/calendar

Calendar component


Version published
Weekly downloads
2.2K
increased by5.42%
Maintainers
4
Install size
15.7 MB
Created
Weekly downloads
 

Readme

Source

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)

FAQs

Last updated on 06 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc