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

svelte-day-picker

v0.3.0

Published

A solid calendar component for Svelte

Downloads

15

Readme

svelte-day-picker

A solid calendar component for Svelte and drop-in replacement for React Day Picker. Uses the Temporal API to handle dates, although it is also backwards-compatible with Date.

Installation

yarn add svelte-day-picker
# OR
npm install svelte-day-picker

Example Usage

<script>
  import DayPicker, { Mode } from 'svelte-day-picker';
  let selected;
  $: first = selected?.at(0);
  $: last = selected?.at(-1);
</script>
<span>From {first?.toLocaleString()} to {last?.toLocaleString()}</span>
<DayPicker numberOfMonths={2} mode={Mode.Range} bind:selected={selected} />

Try it!

API

<DayPicker />

DayPicker Props

  • locale

    • Type: string | Intl.Locale
    • Default: The user's current locale
    • Description: Selects default calendar options and corresponding translation strings, if available
  • calendar

    • Type: string | Temporal.CalendarProtocol
    • Default: Current locale's calendar — typically 'gregory'
    • Description: Either a Unicode Calendar Identifier of a calendar type, or a custom calendar according to the Temporal Calendar Protocol. Most of the world uses 'gregory' or 'iso8601' (which are almost the same), but other calendar identifiers include 'buddhist', 'chinese', 'hebrew', 'islamic'.
  • timeZone

    • Type: string
    • Default: Current locale's time zone
    • Description: Time zone to resolve today's date.
  • weekStart

    • Type: (enum) DayOfWeek
    • Default: Current locale's week start
    • Description: Which day (Monday, Tuesday, ...) is considered the first day of the week.
  • weekend

  • numberOfMonths

    • Type: number (positive integer)
    • Default: 1
    • Description: The number of consecutive months to show.
  • defaultMonth

    • Type: Date | Temporal.PlainYearMonthLike
    • Default: The current month.
    • Description: When first loaded, the calendar will show this month.
  • bind:month

    • Type: Date | Temporal.PlainYearMonthLike
    • Description: A bind: propery controling the current month.
  • disableNavigation

    • Type: boolean
    • Default: false
    • Description: Forbid the user from navigating to a different month.
  • density

    • Type: (enum) Density
    • Default: Density.Sparse
    • Description: Typographic density of the UI.
  • mode

    • Type: (enum) Mode
    • Default: Mode.Single
    • Description: Selection mode – whether to select a single day, multiple days or a range.
  • bind:selected

    • Type: Temporal.PlainDate[]
    • Default: []
    • Description: A bind: property containing all the selected dates.
  • bind:selectedRange

    • Type: { from: Temporal.PlainDate, to: Temporal.PlainDate } | undefined
    • Default: undefined
    • Description: A bind: property containing the selected range, if the mode is Mode.Range.
  • disabled

    • Type: Matcher[] | Matcher
    • Default: []
    • Description: Which days should be marked as disabled.
  • hidden

    • Type: Matcher[] | Matcher
    • Default: []
    • Description: Which days should be hidden.
  • today

    • Type: Date | Temporal.PlainDate
    • Default: new Date() (the current date)
    • Description: The day that should be highlighted as the current date.

DayPicker Slots

  • month-title

    • The element that renders above each month. By default it's the month's name (for example “January 2022”) and navigation buttons forward & backward.
    • Default implementation: <MonthTitle />
  • day-heading

    • The days of week that appear as column headers of the calendar.
    • Default implementation <DayHeading />
  • day

    • The individual days in the month.
    • Default implementation <Day />

Roadmap

  • [ ] Improve documentation
  • [ ] Implement SSR
  • [ ] Feature-parity with React Day Picker
  • [ ] Improve UX on touch devices
  • [ ] Keyboard navigation & ARIA