Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-flatpickr

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-flatpickr - npm Package Compare versions

Comparing version 3.10.7 to 3.10.8

39

build/index.js

@@ -22,2 +22,14 @@ "use strict";

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

@@ -131,10 +143,5 @@

hooks.forEach(function (hook) {
if (_this2.props.hasOwnProperty(hook)) {
options[hook] = _this2.props[hook];
} // Add prev ones too so we can compare against them later
mergeHooks(options, _this2.props, hook); // Add prev ones too so we can compare against them later
if (prevProps.hasOwnProperty(hook)) {
prevOptions[hook] = prevProps[hook];
}
mergeHooks(prevOptions, prevProps, hook);
});

@@ -229,3 +236,21 @@ var optionsKeys = Object.getOwnPropertyNames(options);

function mergeHooks(options, props, hook) {
if (props.hasOwnProperty(hook)) {
var _options$hook;
if (options[hook] && !Array.isArray(options[hook])) {
options[hook] = [options[hook]];
} else if (!options[hook]) {
options[hook] = [];
}
var propHook = Array.isArray(props[hook]) ? props[hook] : [props[hook]];
(_options$hook = options[hook]).push.apply(_options$hook, _toConsumableArray(propHook));
}
return options;
}
var _default = DateTimePicker;
exports["default"] = _default;

26

lib/index.js

@@ -61,9 +61,6 @@ import React, { Component } from 'react'

hooks.forEach(hook => {
if (this.props.hasOwnProperty(hook)) {
options[hook] = this.props[hook]
}
mergeHooks(options, this.props, hook)
// Add prev ones too so we can compare against them later
if (prevProps.hasOwnProperty(hook)) {
prevOptions[hook] = prevProps[hook]
}
mergeHooks(prevOptions, prevProps, hook)
})

@@ -165,2 +162,19 @@

function mergeHooks(options, props, hook) {
if (props.hasOwnProperty(hook)) {
if (options[hook] && !Array.isArray(options[hook])) {
options[hook] = [options[hook]]
} else if (!options[hook]) {
options[hook] = []
}
const propHook = Array.isArray(props[hook])
? props[hook]
: [props[hook]]
options[hook].push(...propHook)
}
return options
}
export default DateTimePicker
{
"name": "react-flatpickr",
"version": "3.10.7",
"version": "3.10.8",
"description": "flatpickr for React",

@@ -22,3 +22,3 @@ "main": "build/index.js",

"files": [
"build/",
"build/index.js",
"lib/"

@@ -25,0 +25,0 @@ ],

@@ -64,3 +64,3 @@ [![NPM version][npm-img]][npm-url]

value={date}
onChange={date => {
onChange={([date]) => {
this.setState({ date });

@@ -153,5 +153,5 @@ }}

## Advanced props
## Advanced
### render
### render prop

@@ -185,2 +185,34 @@ > `function` | optional

### flatpickr instance
You can directly manipulate the [`flatpickr` instance](https://flatpickr.js.org/instance-methods-properties-elements/) using the `flatpickr` property on the component.
_Example_:
```js
import React, { useRef } from "react";
import Flatpickr from "react-flatpickr";
import "flatpickr/dist/flatpickr.css";
export default function App() {
const fp = useRef(null);
return (
<div>
<Flatpickr ref={fp} />
<button
type="button"
onClick={() => {
if (!fp?.current?.flatpickr) return;
fp.current.flatpickr.clear();
}}
>
Clear
</button>
</div>
);
}
```
## Themes

@@ -187,0 +219,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc