npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

task-datepicker-lib

v0.1.5

Published

## Installation

Downloads

334

Readme

task-datepicker-lib

Installation

Prerequisites

Ensure you have the following dependencies installed in your project:

  • React 18.0.0 or higher
  • React DOM 18.0.0 or higher
  • Styled Components 6.0.0 or higher

Installation Command

To install the task-datepicker-lib package, run the following command:

yarn add task-datepicker-lib

Peer Dependencies

Ensure that you have the following peer dependencies in your project:

{
  "react": "^18.0.0",
  "react-dom": "^18.0.0",
  "styled-components": "^6.0.0"
}

Usage

Basic Calendar

To use the basic calendar component, import the CalendarWrapper from the library and include it in your component:

import React from 'react';
import { Calendar } from 'task-datepicker-lib';

export const defaultConfig = {
  enableHolidays: false,
  enableTasks: false,
  enableViewToggle: false,
  enableWeekends: false,
};

export const defaultRange = {
  maxDate: {DateTime object},
  minDate: {DateTime object},
};

export const MyCalendarComponent = () => (
  <Calendar
    config={defaultConfig}
    {...defaultRange}
    isOpen={false}
    isWeekStartOnMonday={false}
    label="Date"
    showWeekends={true}
  />
);

or

import React from 'react';
import { Calendar } from 'task-datepicker-lib';

export const defaultConfig = {
  enableHolidays: false,
  enableTasks: false,
  enableViewToggle: false,
  enableWeekends: false,
};

export const defaultRange = {
  maxDate: {DateTime object},
  minDate: {DateTime object},
};

export const defaultCustomHolidays = {
  customHolidays: [
    {
      endDate: '2024-08-22',
      id: '12345',
      name: 'Random Holiday',
      startDate: '2024-08-22',
    },
    {
      endDate: '2024-08-22',
      id: '1234',
      name: 'Random Holiday 2',
      startDate: '2024-08-22',
    },
  ],
};

export  const CustomHolidayExample = () => (
  <Calendar
    config={{
      ...defaultConfig,
      enableHolidays: true,
    }}
    {...defaultRange}
    {...defaultCustomHolidays}
    isOpen={true}
    isWeekStartOnMonday={false}
    label="Date"
    showWeekends={true}
    supportedViews={[View.Month, View.Year, View.Week]}
  />
);

Range Calendar

For selecting a range of dates, use the RangeCalendar component:

import React from 'react';
import { RangeCalendar } from 'task-datepicker-lib';

export const MyRangeCalendarComponent = () => (
  <RangeCalendar
    isOpen={true}
    minDate={DateTime.local(2024, 1, 1)}
    maxDate={DateTime.local(2024, 12, 31)}
    isWeekStartOnMonday={false}
    label="RangeDate"
    showWeekends={true}
  />
);

Component Overview

Props

  • config: An object to configure the calendar's behavior.
  • enableHolidays: Boolean to enable/disable holidays.
  • enableTasks: Boolean to enable/disable tasks.
  • enableViewToggle: Boolean to enable/disable view toggle functionality.
  • enableWeekends: Boolean to include/exclude weekends.
  • isOpen: Boolean to control whether the calendar is open or closed.
  • isWeekStartOnMonday: Boolean to control if the week starts on Monday.
  • label: A string for the calendar's label.
  • showWeekends: Boolean to show or hide weekends.
  • supportedViews: Array of views that are supported (e.g., View.Month, View.Year, View.Week).

Config

Pass the following config to turn on or off the features of the calendar:

const config = {
  enableHolidays: true,
  enableTasks: true,
  enableViewToggle: true,
  enableWeekends: false,
};

Types

The package exports the following types:

  • Holiday: Type representing a holiday.
  • Task: Type representing a task.
  • View: Enum representing different calendar views (Month, Year, Week).
  • Colors: Type representing color configurations.
  • Theme: Type representing theme configurations.

For contributors

Getting Started

After cloning the repo, consult package.json for the requirements with regard to nodejs and yarn versions. Install dependencies with:

yarn
yarn prepare

Create a .env file:

touch .env.local

Add environment variables to this file. An example of the required environment variables can be found in the .env.draft file

Run the development build with:

yarn dev

Run storybook development:

yarn storybook

Open http://localhost:6006 with your browser to see the result.

For the full list of available scripts (yarn lint, yarn test, yarn build, etc.), please consult scripts section of package.json or scripts section of the documentation for additional decription.

Scripts

Run the scripts using:

yarn <script_name>

At the moment, the following scripts can be run within the project:

  • build - create an optimised production build of the lib;
  • dev - create an optimised production build and launch the lib in watch mode;
  • storybook - starts Storybook in development mode on port 6006;
  • build-storybook - builds Storybook for production;
  • clean - delete the build folder and all its files using rm;
  • clean:npm - delete the node_modules folder and all its files with rm;
  • lint - check for all the existing eslint errors and warnings in the files;
  • lint:fix - fix all eslint errors and warnings available for fixing;
  • prettier - check for all code style issues in files;
  • prettier:fix - fix all the code style issues in files;
  • prepare - to setup husky hooks;
  • chromatic - to run new build and publish storybook to chromatic;
  • test - run tests and watch files for changes to rerun tests related to changed files;
  • test:all - run tests and watch files for changes to rerun all tests when something changes;
  • test:ci - running tests in a ci environment;
  • test:coverage - delete the coverage folder and open a new coverage report after the tests have been executed;

Note: The following commands use the .gitignore file instead of their own ignore file: lint, lint:fix, prettier, prettier:fix.