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

solid-simple-datepicker

v1.1.1

Published

Customizable, accessible and simple datepicker component

Downloads

221

Readme

solid-simple-datepicker

version npm

A nice, customizable and simple datepicker component for every day!

  • 💥 0 dependencies
  • ⚒️ fully customizable with CSS
  • 📚 supports custom translations

image

Installation

npm i solid-simple-datepicker

yarn add solid-simple-datepicker

pnpm add solid-simple-datepicker

Usage

import { SimpleDatepicker } from "solid-simple-datepicker";
import "solid-simple-datepicker/styles.css";

...
const [date, setDate] = createSignal<Date>();

return <SimpleDatepicker selectedDate={date()} onChange={setDate} />;

Props

export interface DatePickerProps {
  selectedDate?: Date;
  /**
   * Start year to show in year list
   * @default 1960
   */
  startYear?: number;
  /**
   * End year to show in year list
   * @default 2060
   */
  endYear?: number;
  /**
   * Days to disable
   * @type Number from 1 to 31
   */
  disabledDays?: number[];

  /**
   * Months to disable
   * @type Number from 0 to 11
   */
  disabledMonths?: number[];
  /**
   * Years to disable
   */
  disabledYears?: number[];
  /**
   * I18N object
   */
  locale?: Locale;
  /**
   * The order in which datepicker sections should be displayed
   * @type "d-m-y" | "d-y-m" | "m-d-y" | "m-y-d" | "y-m-d" | "y-d-m"
   * @default "m-d-y"
   */
  order?: SectionOrder;
  /**
   * Extra class applied to the container element
   */
  class?: string;
  /**
   * Extra styles applied to the container element
   */
  style?: JSX.StyleHTMLAttributes<HTMLElement>;
  /**
   * Tag for the container element
   * @default "div"
   */
  tag?: string;
  /**
   * Is footer visible
   * @default true
   */
  footer?: boolean;
  /**
   * The number from 0 (Sun) to 6 (Sat)
   * @default 0 (Sunday)
   */
  startWeekDay?: number;
  /**
   * The callback is called when the date is valid
   * It won't be called when the date is unfilled (e.g. month is not selected)
   * or the date is invalid (e.g. Feb 31 2000)
   */
  onChange?: (date: Date) => void;
  /**
   * The callback is called when "Done" button of default footer component is clicked
   */
  onFooterDone?: VoidFunction;
  /**
   * Custom footer component to show
   */
  FooterComponent?: ParentComponent;
}

Customization

You can easily customize the view of the Datepicker with CSS custom variables! Just pass extra class to the component with redefined CSS variables.

You can set the following variables (check styles.css):

--sd-scrollbar-size: 6px;
--sd-scrollbar-border-radius: 8px;

--sd-button-border-radius: 4px;
--sd-button-height: 2rem;
--sd-button-width: 4rem;
--sd-button-inline-padding: 0.5rem;
--sd-button-focus-outline: 1px solid var(--sd-primary-color);

--sd-scrollbar-color: #888;

--sd-background-color: white;
--sd-text-color: #172454;

--sd-primary-color: #1e4cd7;
--sd-primary-hover-color: #1f3eae;
--sd-primary-focus-color: #94c4fc;

--sd-text-primary-color: white;
--sd-text-disabled-color: #aaa;
--sd-button-disabled-color: #e3e3e3;
--sd-list-caption-color: #999;

--sd-footer-border-color: #eee;

--sd-transition-time: 50ms;
--sd-transition-timing-function: ease-in-out;

--sd-section-gap: 1rem;
--sd-list-caption-gap: 0.25rem;
--sd-list-caption-font-size: 0.8rem;
--sd-padding: 0.5rem;

--sd-box-shadow: 0px 0.6px 1.8px rgba(0, 0, 0, 0.035), 0px 5px 14px rgba(0, 0, 0, 0.07);
--sd-border-radius: 8px;

--sd-footer-border-top: 1px solid var(--sd-footer-border-color);