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

react-semantic-ui-datepickers

v2.17.2

Published

Datepickers built with Semantic UI for React and Dayzed

Downloads

32,962

Readme

📆 react-semantic-ui-datepickers

Datepickers built with Semantic UI for React and Dayzed

version MIT License All Contributors

Overview

Semantic UI for React doesn't have a datepicker and the best solutions don't fit with its design. This library tries to solve this problem providing a component that can act as a basic or range datepicker.

It supports most props of Form.Input and Dayzed components. Check the supported props section for more information.

Table of Contents

Installation

npm install --save react-semantic-ui-datepickers
yarn add react-semantic-ui-datepickers

This package also depends on react and semantic-ui-react. Please make sure you have them installed as well.

Usage

import React, { useState } from 'react';
import SemanticDatepicker from 'react-semantic-ui-datepickers';
import 'react-semantic-ui-datepickers/dist/react-semantic-ui-datepickers.css';

const AppWithBasic = () => {
  const [currentDate, setNewDate] = useState(null);
  const onChange = (event, data) => setNewDate(data.value);

  return <SemanticDatepicker onChange={onChange} />;
};

const AppWithRangeAndInPortuguese = () => {
  const [currentRange, setNewRange] = useState([]);
  const onChange = (event, data) => setNewRange(data.value);

  return <SemanticDatepicker locale="pt-BR" onChange={onChange} type="range" />;
};

More examples here.

Supported Props

Own Props

| property | type | required | default | description | | -------------------- | ------------------------------------------------------------- | -------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | allowOnlyNumbers | boolean | no | true | Allows the user enter only numbers | | autoComplete | string | no | -- | Specifies if the input should have autocomplete enabled | | clearIcon | SemanticICONS | React.ReactElement | no | 'close' | An icon from semantic-ui-react or a custom component. The custom component will get two props: data-testid and onClick. | | clearOnSameDateClick | boolean | no | true | Controls whether the datepicker's state resets if the same date is selected in succession. | | clearable | boolean | no | true | Allows the user to clear the value | | datePickerOnly | boolean | no | false | Allows the date to be selected only via the date picker and disables the text input | | filterDate | function | no | (date) => true | Function that receives each date and returns a boolean to indicate whether it is enabled or not | | format | string | no | 'YYYY-MM-DD' | Specifies how to format the date using the date-fns' format | | formatOptions | options | no | -- | Specifies the options to format the date using the date-fns' format | | icon | SemanticICONS | React.ReactElement | no | 'calendar' | An icon from semantic-ui-react or a custom component. The custom component will get two props: data-testid and onClick. | | inline | boolean | no | false | Uses an inline variant, without the input and the features related to it, e.g. clearable datepicker | | keepOpenOnClear | boolean | no | false | Keeps the datepicker open (or opens it if it's closed) when the clear icon is clicked | | keepOpenOnSelect | boolean | no | false | Keeps the datepicker open when a date is selected | | locale | string | no | 'en-US' | Filename of the locale to be used. PS: Feel free to submit PR's with more locales! | | onBlur | function | no | (event) => {} | Callback fired when the input loses focus | | onFocus | function | no | (event) => {} | Callback fired when the input gets focused focus | | onChange | function | no | (event, data) => {} | Callback fired when the value changes | | pointing | string | no | 'left' | Location to render the component around input. Available options: 'left', 'right', 'top left', 'top right' | | showToday | boolean | no | true | Hides the "Today" button if false | | type | string | no | basic | Type of input to render. Available options: 'basic' and 'range' | | value | Date|Date[] | no | -- | The value of the datepicker |

Form.Input Props

  • autoComplete
  • className
  • disabled
  • error
  • iconPosition
  • id
  • inverted
  • label
  • loading
  • name
  • placeholder
  • size
  • transparent
  • readOnly

Dayzed Props

  • date
  • maxDate
  • minDate
  • firstDayOfWeek
  • showOutsideDays
  • selected

Customization

In order to customize the elements, you can override the styles of the classes below:

  • clndr-cell
  • clndr-cell-today
  • clndr-cell-inrange
  • clndr-cell-disabled
  • clndr-cell-selected
  • clndr-cell-other-month

If you think this way of customizing is not a good idea, feel free to open an issue suggesting something else. This was the simplest solution I thought.

Roadmap

  • Add more tests (including e2e)

Feel free to open issues and/or create PRs to improve other aspects of the library!

Contributors

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

LICENSE

MIT