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

mantine-resource-timeline

v7.0.2

Published

A resource timeline component built with Mantine

Downloads

205

Readme

mantine-resource-timeline

NPM Downloads

A simple but customizable resource scheduler/timeline component built with mantine.

Compatibility

This library uses subgrids, which is a rather new browser feature.

Peer dependencies

  • @mantine/hooks for @mantine/core
  • @mantine/core for styling
  • dayjs for handling of dates
  • @tanstack/react-virtual for virtualization of bigger timelines
  • valtio for more granular render control
  • @use-gesture/react for panning and zoom gestures when holding CTRL

Minimal usage

import { type Dayjs } from "dayjs";
import { useSchedulerController, Scheduler } from "mantine-resource-timeline";

interface MyDataType {
  id: string | number;
  resourceId: string | number | number[] | string[];
  startDate: Date;
  endDate: Date;
}

interface MyResourceType {
  id: string | number;
  name: string;
}

const data: MyDataType[] = [
  {
    id: "appointment-1",
    title: "Bob & Alice Meet",
    resourceId: [1, 2],
    startDate: Dayjs,
    endDate: Dayjs,
  },
];

const resources: MyResourceType[] = [
  {
    id: 1,
    name: "Bob",
  },
  {
    id: 2,
    name: "Alice",
  },
];

function MyTimeline() {
  const controller = useSchedulerController<MyDataType, MyResourceType>({});

  return (
    <Scheduler
      controller={controller}
      data={data}
      resources={resources}
      width="100%"
      height="95vh"
      dataResourceIdAccessor="resourceId"
      endDateAccessor="endDate"
      startDateAccessor="startDate"
      dataIdAccessor="id"
      resourceIdAccessor="id"
      tz="Europe/Berlin"
    />
  );
}

For how to activate other features of this library and adapting the timeline component to your needs take a look at the Advanced Example.

The controller object allows us to control multiple components state, such as the time to be displayed, from the outside. It's a valtio proxy object which allows us to pass it around in our app without having to fear unnecessary re-renders. Take a look at valtio's documentation to find out how a valtio proxy object is handled correctly.

Future development

I have mostly achieved what I initially wanted to achieve with this component library. This means I most likely won't re-iterate on it because I have lost mostly lost my interest in this project. I'm still eager to answer questions via issues or review Pull Requests to this project though. Feel free to contribute anything you'd like as long as it's within the scope of this project. Especially if it includes documentation/tests.

Contributing

To develop code for this project you need pnpm. If you don't use pnpm already, you can follow their installation guide to install it. I personally recommend installation via corepack.

After that you can install dependencies via:

pnpm install

Next you should be able to start the storybook server via:

pnpm storybook

Then you can open the storybook via http://127.0.0.1:6006.

Before committing and pushing you should format and lint the project via the following commands:

pnpm format
pnpm lint