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

semantic-ui-calendar-react-dehyp

v0.5.1

Published

date/time picker built from semantic-ui elements

Downloads

4

Readme

semantic-ui-calendar-react

Datepicker react component based on semantic-ui-react components

My intention was to create something that looks like this https://github.com/mdehoog/Semantic-UI-Calendar.

Here you can find a live example https://arfedulov.ru/examples/semantic-ui-calendar-react.

installation

npm i semantic-ui-calendar-react

Also you need to add css in your html: <link rel="stylesheet" type="text/css" href="node_modules/semantic-ui-calendar-react/dist/css/calendar.min.css">

usage

Let's create a form that needs date-related input fields.

Import input components:

import {
  DateInput,
  TimeInput,
  DateTimeInput,
  DatesRangeInput
} from 'semantic-ui-calendar-react';

Then build a form:

class DateTimeForm extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      date: '',
      time: '',
      dateTime: '',
      datesRange: ''
    };
  }

  handleChange = (event, {name, value}) => {
    if (this.state.hasOwnProperty(name)) {
      this.setState({ [name]: value });
    }
  }

  render() {
    return (
      <Form>
        <DateInput
          name="date"
          placeholder="Date"
          value={this.state.date}
          iconPosition="left"
          onChange={this.handleChange} />
        <TimeInput
          name="time"
          placeholder="Time"
          value={this.state.time}
          iconPosition="left"
          onChange={this.handleChange} />
        <DateTimeInput
          name="dateTime"
          placeholder="Date Time"
          value={this.state.dateTime}
          iconPosition="left"
          onChange={this.handleChange} />
        <DatesRangeInput
          name="datesRange"
          placeholder="From - To"
          value={this.state.datesRange}
          iconPosition="left"
          onChange={this.handleChange} />
      </Form>
    );
  }
}

Also you can build a form with inline pickers as inputs. Just set inline prop on input element and it will be displayed as inline picker:

class DateTimeFormInline extends React.Component {
 handleChange = (event, {name, value}) => {
    if (this.state.hasOwnProperty(name)) {
      this.setState({ [name]: value });
    }
  }

  render() {
    return (
      <Form>
        <DateInput
          inline
          name="date"
          value={this.state.date}
          onChange={this.handleDateChange} />
      </Form>
    );
  }
}

Locales support

Since semantic-ui-calendar-react uses moment.js it has complete locales support. To change locale you need to set moment's locale in a scope that contains semantic-ui-calendar-react components:


moment.locale('ru')

// code that uses ``semantic-ui-calendar-react`` components

Supported elements

DateInput

| Prop | Description | | -----| ------------| | all that can be used with SUIR Input | | | dateFormat| {string} Date formatting string. You can use here anything that can be passed to moment().format. Default: DD-MM-YYYY| | popupPosition| {string} One of ['top left', 'top right', 'bottom left', 'bottom right', 'right center', 'left center', 'top center', 'bottom center']. Default: top left| | inline | {bool} If true inline picker displayed. Default: false | | startMode | {string} Display mode to start. One of ['year', 'month', 'day']. Default: day |

TimeInput

| Prop | Description | | -----| ------------| | all that can be used with SUIR Input | | | popupPosition| {string} One of ['top left', 'top right', 'bottom left', 'bottom right', 'right center', 'left center', 'top center', 'bottom center']. Default: top left| | inline | {bool} If true inline picker displayed. Default: false |

DateTimeInput

| Prop | Description | | -----| ------------| | all that can be used with SUIR Input | | | dateFormat| {string} Date formatting string. You can use here anything that can be passed to moment().format. Default: DD-MM-YYYY| | divider | {string} Date and time divider. Default: | | popupPosition| {string} One of ['top left', 'top right', 'bottom left', 'bottom right', 'right center', 'left center', 'top center', 'bottom center']. Default: top left| | inline | {bool} If true inline picker displayed. Default: false | | startMode | {string} Display mode to start. One of ['year', 'month', 'day']. Default: day |

DatesRangeInput

| Prop | Description | | -----| ------------| | all that can be used with SUIR Input | | | dateFormat| {string} Date formatting string. You can use here anything that can be passed to moment().format. Default: DD.MM.YY| | popupPosition| {string} One of ['top left', 'top right', 'bottom left', 'bottom right', 'right center', 'left center', 'top center', 'bottom center']. Default: top left| | inline | {bool} If true inline picker displayed. Default: false |

YearInput

| Prop | Description | | -----| ------------| | all that can be used with SUIR Input | | | popupPosition| {string} One of ['top left', 'top right', 'bottom left', 'bottom right', 'right center', 'left center', 'top center', 'bottom center']. Default: top left| | inline | {bool} If true inline picker displayed. Default: false |

MonthInput

| Prop | Description | | -----| ------------| | all that can be used with SUIR Input | | | popupPosition| {string} One of ['top left', 'top right', 'bottom left', 'bottom right', 'right center', 'left center', 'top center', 'bottom center']. Default: top left| | inline | {bool} If true inline picker displayed. Default: false |