You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-flickity-component

Package Overview
Dependencies
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-flickity-component - npm Package Compare versions

Comparing version

to
4.0.1

91

dist/react-flickity-component.es.js

@@ -1,7 +0,90 @@

import "react";
import "react-dom";
import { F as p } from "./index-48195875.mjs";
import o, { Component as y } from "react";
import { createPortal as h } from "react-dom";
import a from "imagesloaded";
import s from "prop-types";
const u = !!(typeof window < "u" && window.document && window.document.createElement);
class r extends y {
constructor(e) {
super(e), this.state = {
flickityReady: !1,
flickityCreated: !1,
cellCount: 0
}, this.carousel = null, this.flkty = null;
}
static getDerivedStateFromProps(e, t) {
const i = o.Children.count(e.children);
return i !== t.cellCount ? { flickityReady: !1, cellCount: i } : null;
}
componentDidUpdate(e, t) {
const {
children: i,
options: { draggable: l, initialIndex: n },
reloadOnUpdate: c,
disableImagesLoaded: d
} = this.props, { flickityReady: f } = this.state;
if (c || !t.flickityReady && f) {
if (!this.flkty)
return;
const p = this.flkty.isActive;
this.flkty.deactivate(), this.flkty.selectedIndex = n || 0, this.flkty.options.draggable = l === void 0 ? i ? i.length > 1 : !1 : l, p && this.flkty.activate(), !d && this.carousel && a(this.carousel, () => {
this.flkty.reloadCells();
});
} else
this.flkty.reloadCells();
}
async componentDidMount() {
if (!u)
return null;
const e = (await import("flickity")).default, { flickityRef: t, options: i } = this.props;
this.flkty = new e(this.carousel, i), t && t(this.flkty), this.props.static ? this.setReady() : this.setState({ flickityCreated: !0 });
}
setReady() {
if (this.state.flickityReady)
return;
const e = () => this.setState({ flickityReady: !0 });
this.props.disableImagesLoaded ? e() : a(this.carousel, e);
}
renderPortal() {
if (!this.carousel)
return null;
const e = this.carousel.querySelector(".flickity-slider");
if (e) {
const t = h(this.props.children, e);
return setTimeout(() => this.setReady(), 0), t;
}
}
render() {
return o.createElement(
this.props.elementType,
{
className: this.props.className,
ref: (e) => {
this.carousel = e;
}
},
this.props.static ? this.props.children : this.renderPortal()
);
}
}
r.propTypes = {
children: s.array,
className: s.string,
disableImagesLoaded: s.bool,
elementType: s.string,
flickityRef: s.func,
options: s.object,
reloadOnUpdate: s.bool,
static: s.bool
};
r.defaultProps = {
className: "",
disableImagesLoaded: !1,
elementType: "div",
options: {},
reloadOnUpdate: !1,
static: !1
};
export {
p as default
r as default
};
//# sourceMappingURL=react-flickity-component.es.js.map

2

package.json
{
"name": "react-flickity-component",
"version": "4.0.0",
"version": "4.0.1",
"description": "react flickity component",

@@ -5,0 +5,0 @@ "files": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet