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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@harlock_/scheduler

v1.0.5

Published

A flexible and customizable React timeline scheduler component with drag-and-drop, zoom, and i18n support

Readme

@harlock_/scheduler

A flexible and customizable React timeline scheduler component with drag-and-drop functionality, multi-level zoom, internationalization support, and advanced navigation controls.

Features

  • 🎯 Drag & Drop: Move and resize timeline items
  • 🔍 Multi-Level Zoom: From monthly view down to minute-level granularity
  • 🎮 Navigation Controls: Built-in UI controls, keyboard shortcuts, and drag-to-pan
  • 🌍 Internationalization: Built-in support for multiple languages (EN, FR, AR)
  • 🎨 Customizable: Extensive configuration options for styling, behavior, and visibility
  • 📊 Progress Tracking: Display completion percentages on items
  • 📅 Special Days: Highlight weekends and special dates (holidays, events)
  • 🔒 Authorization Controls: Enable/disable drag, resize, and other operations
  • Performance: Optimized for large datasets

Installation

npm install @harlock_/scheduler

Peer Dependencies

Make sure you have the following peer dependencies installed:

npm install react react-dom @mui/material @emotion/react @emotion/styled dnd-timeline date-fns i18next react-i18next

Quick Start

import React, { useState } from 'react';
import { TimelineContext } from 'dnd-timeline';
import { Timeline, TimelineControls, TIMELINE_CONFIG } from '@harlock_/scheduler';
import { startOfDay, endOfDay } from 'date-fns';

// Optional: Configure global settings
TIMELINE_CONFIG.language = 'en';
TIMELINE_CONFIG.controls = { visible: true, size: 'small' };

function App() {
  const [range, setRange] = useState({
    start: startOfDay(new Date()).getTime(),
    end: endOfDay(new Date()).getTime(),
  });

  const rows = [
    { id: 'row-1', title: 'Resource 1', description: 'Description' },
    { id: 'row-2', title: 'Resource 2', description: 'Description' }
  ];

  const items = [
    {
      id: 'item-1',
      rowId: 'row-1',
      span: { start: Date.now(), end: Date.now() + 3600000 },
      title: 'Task 1',
      color: '#3b82f6',
      completion: 50
    }
  ];

  // Navigation Handlers
  const handleZoom = (direction) => {
    setRange((prev) => {
      const duration = prev.end - prev.start;
      const center = prev.start + duration / 2;
      const newDuration = direction === 'in' ? duration * 0.8 : duration * 1.2;
      return {
        start: center - newDuration / 2,
        end: center + newDuration / 2,
      };
    });
  };

  const handlePan = (direction) => {
    setRange((prev) => {
      const duration = prev.end - prev.start;
      const shift = duration * 0.1;
      return {
        start: direction === 'left' ? prev.start - shift : prev.start + shift,
        end: direction === 'left' ? prev.end - shift : prev.end + shift,
      };
    });
  };

  return (
    <div style={{ height: '500px', position: 'relative' }}>
      <TimelineContext range={range} onRangeChanged={setRange}>
        <Timeline items={items} rows={rows} onRangeChange={setRange} />
        <TimelineControls 
          onZoomIn={() => handleZoom('in')}
          onZoomOut={() => handleZoom('out')}
          onPanLeft={() => handlePan('left')}
          onPanRight={() => handlePan('right')}
        />
      </TimelineContext>
    </div>
  );
}

Configuration

The component is highly configurable via the TIMELINE_CONFIG object. You can modify these settings globally.

import { TIMELINE_CONFIG } from '@harlock_/scheduler';

// 1. General Settings
TIMELINE_CONFIG.language = 'en'; // 'en', 'fr', 'ar'
TIMELINE_CONFIG.rowHeight = 60;
TIMELINE_CONFIG.showCompletion = true;
TIMELINE_CONFIG.showExceptions = true; // Show warning icon for items with exceptions

// 2. Navigation Controls
TIMELINE_CONFIG.controls = {
  visible: true, // Show/hide floating controls
  size: "medium" // "small", "medium", "large"
};

// 3. Authorization
TIMELINE_CONFIG.authorizations = {
  canMoveItems: true,
  canResizeItems: true
};

// 4. Weekend Highlighting
TIMELINE_CONFIG.weekends = {
  enabled: true,
  days: [6, 7], // Saturday, Sunday
  backgroundColor: "#eff6ff",
  showColumnBackgrounds: true
};

// 5. Special Days (Holidays, etc.)
TIMELINE_CONFIG.specialDays = {
  enabled: true,
  showColumnBackgrounds: true,
  dates: [
    { date: "2025-12-25", description: "Christmas", backgroundColor: "#fef3c7" },
    { date: "2025-01-01", description: "New Year", backgroundColor: "#fce7f3" }
  ]
};

// 6. Typography
TIMELINE_CONFIG.title.fontSize = 14;
TIMELINE_CONFIG.title.fontWeight = 600;

Navigation Features

UI Controls

The TimelineControls component provides floating buttons for:

  • Zoom In / Out
  • Pan Left / Right

Keyboard Shortcuts

  • Arrow Left / Right: Pan timeline
  • + / -: Zoom in / out

Drag-to-Pan

Click and drag anywhere on the empty background of the timeline to pan the view.

API Reference

Timeline Component

Props:

  • items (array): Array of item objects
  • rows (array): Array of row objects
  • onRangeChange (function): Callback when drag-to-pan updates the range

Item Object Structure

{
  id: string,
  rowId: string,
  span: { start: number, end: number },
  title?: string,
  subtitle?: string,
  description?: string,
  color?: string,
  completion?: number,
  exceptions?: array, // Triggers warning icon if showExceptions is true
  disabled?: boolean
}

License

MIT