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

kabob-cal

v1.0.4-alpha.0

Published

An event calendar component for React that supports multiple views, person management, and event colors.

Downloads

616

Readme

Kabob Calendar

A modern, flexible, and customizable calendar component library for React applications. Built with TypeScript and featuring multiple view modes, person management, and event handling capabilities.

Kabob Calendar Preview

Features

  • 📅 Multiple calendar views (Day, Week, Month, Year)
  • 👥 Built-in person/resource management with filtering
  • 🎨 Customizable event colors and styling
  • 🎯 Event click handling and appointment creation
  • 🔄 Intuitive navigation controls
  • 📱 Responsive design with modern UI components
  • 💅 Built with Tailwind CSS and Shadcn UI.

Installation

npm install kabob-cal
# or
yarn add kabob-cal
# or
pnpm add kabob-cal

Requirements

  • React ^18.2.0
  • React DOM ^18.2.0
  • Tailwind CSS (for styling)

Usage Example

Here's a complete example showing how to create a medical appointment calendar with multiple doctors:

import React, { useState, useEffect } from 'react';
import {
  Calendar,
  CalendarCurrentDate,
  CalendarDayView,
  CalendarEvent,
  CalendarMonthView,
  CalendarNextTrigger,
  CalendarPersonSelector,
  CalendarPrevTrigger,
  CalendarTodayTrigger,
  CalendarViewTrigger,
  CalendarWeekView,
  CalendarYearView,
  Person
} from 'kabob-cal';
import 'kabob-cal/dist/globals.css';

const App = () => {
  // Define people (e.g., doctors)
  const people: Person[] = [
    {
      id: 'doctor1',
      name: 'Dr. Smith',
      color: 'blue'
    },
    {
      id: 'doctor2',
      name: 'Dr. Johnson',
      color: 'pink'
    }
  ];

  // Define calendar events/appointments
  const events: CalendarEvent[] = [
    {
      id: '1',
      title: 'Annual Checkup',
      start: new Date(2024, 0, 15, 10, 0),
      end: new Date(2024, 0, 15, 11, 0),
      personId: 'doctor1'
    },
    {
      id: '2',
      title: 'Dental Cleaning',
      start: new Date(2024, 0, 15, 14, 30),
      end: new Date(2024, 0, 15, 15, 30),
      personId: 'doctor2'
    }
  ];

  const handleEventClick = (event: CalendarEvent) => {
    console.log('Appointment clicked:', event);
  };

  const handleAddAppointment = (date: Date) => {
    console.log('Add appointment clicked for date:', date);
  };

  return (
    <div className="h-screen w-full p-4 bg-white">
      <Calendar
        defaultDate={new Date()}
        events={events}
        people={people}
        defaultSelectedPersonIds={['doctor1', 'doctor2']}
        onAddAppointment={handleAddAppointment}
      >
        <div className="flex h-full flex-col space-y-4">
          {/* Person selector and view controls */}
          <div className="flex flex-wrap items-center justify-between gap-4">
            <div className="flex flex-wrap justify-center items-center gap-2 w-full sm:w-auto">
              <CalendarPersonSelector className="w-full sm:w-auto" />
              <div className="flex flex-wrap justify-center items-center gap-1">
                <CalendarViewTrigger view="day">Day</CalendarViewTrigger>
                <CalendarViewTrigger view="week">Week</CalendarViewTrigger>
                <CalendarViewTrigger view="month">Month</CalendarViewTrigger>
                <CalendarViewTrigger view="year">Year</CalendarViewTrigger>
              </div>
            </div>
          </div>

          {/* Calendar views */}
          <CalendarDayView />
          <CalendarWeekView />
          <CalendarMonthView />
          <CalendarYearView />
        </div>
      </Calendar>
    </div>
  );
};

export default App;

Component API

Calendar Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | events | CalendarEvent[] | Required | Array of calendar events | | people | Person[] | Required | Array of people/resources | | defaultDate | Date | new Date() | Initial calendar date | | defaultSelectedPersonIds | string[] | [] | Initially selected person IDs | | onAddAppointment | (date: Date) => void | - | Callback when adding appointments | | onEventClick | (event: CalendarEvent) => void | - | Callback when clicking events |

Types

interface Person {
  id: string;
  name: string;
  color: string;
}

interface CalendarEvent {
  id: string;
  title: string;
  start: Date;
  end: Date;
  personId: string;
}

License

MIT