@artistry/react
Advanced tools
Comparing version 0.6.4 to 0.6.6
@@ -15,8 +15,7 @@ import * as React from 'react'; | ||
export interface ICarouselState { | ||
height: string; | ||
activeIndex: number; | ||
previousActiveIndex: number; | ||
running: boolean; | ||
animating: boolean; | ||
selected: boolean; | ||
height?: string; | ||
activeIndex?: number; | ||
previousActiveIndex?: number; | ||
animating?: boolean; | ||
selected?: boolean; | ||
} | ||
@@ -26,7 +25,6 @@ export default class Carousel extends React.Component<ICarouselProps, ICarouselState> { | ||
state: ICarouselState; | ||
running: boolean; | ||
runCount: number; | ||
transitionCount: number; | ||
transitionEnd: (event: React.TransitionEvent<HTMLElement>) => Promise<void>; | ||
startRun(): Promise<void>; | ||
stopRun(): Promise<void>; | ||
componentWillReceiveProps(nextProps?: ICarouselProps): Promise<void>; | ||
@@ -33,0 +31,0 @@ componentWillUnmount(): void; |
@@ -13,6 +13,6 @@ "use strict"; | ||
previousActiveIndex: this.props.activeIndex, | ||
running: false, | ||
animating: false, | ||
selected: true | ||
}; | ||
this.running = false; | ||
this.runCount = 0; | ||
@@ -25,4 +25,3 @@ this.transitionCount = 0; | ||
if (!this.transitionCount) { | ||
let running = this.state.running; | ||
if (!running) { | ||
if (!this.running) { | ||
this.setState({ | ||
@@ -38,20 +37,2 @@ animating: false, | ||
} | ||
async startRun() { | ||
await PromiseUtil_1.setState({ running: true }, this); | ||
} | ||
async stopRun() { | ||
if (this.state.running) { | ||
if (this.props.staticHeight) { | ||
await PromiseUtil_1.setState({ | ||
running: false, | ||
animating: false, | ||
height: undefined, | ||
previousActiveIndex: this.state.activeIndex | ||
}, this); | ||
} | ||
else { | ||
await PromiseUtil_1.setState({ running: false }, this); | ||
} | ||
} | ||
} | ||
async componentWillReceiveProps(nextProps) { | ||
@@ -82,7 +63,3 @@ let { activeIndex } = nextProps; | ||
let runCount = this.runCount; | ||
await PromiseUtil_1.setState({ runCount: runCount }, this); | ||
await this.startRun(); | ||
if (runCount !== this.runCount) { | ||
return; | ||
} | ||
this.running = true; | ||
let node; | ||
@@ -127,3 +104,12 @@ if (!this.props.staticHeight) { | ||
} | ||
await this.stopRun(); | ||
if (this.running) { | ||
if (this.props.staticHeight) { | ||
await PromiseUtil_1.setState({ | ||
animating: false, | ||
height: undefined, | ||
previousActiveIndex: this.state.activeIndex | ||
}, this); | ||
} | ||
this.running = false; | ||
} | ||
} | ||
@@ -130,0 +116,0 @@ } |
@@ -8,6 +8,6 @@ import * as React from 'react'; | ||
export interface ICloseableState { | ||
closed: boolean; | ||
running: boolean; | ||
animating: boolean; | ||
height: string; | ||
closed?: boolean; | ||
running?: boolean; | ||
animating?: boolean; | ||
height?: string; | ||
} | ||
@@ -14,0 +14,0 @@ export default class Closeable extends React.Component<ICloseableProps, ICloseableState> { |
@@ -5,3 +5,4 @@ import * as React from 'react'; | ||
className?: string; | ||
onUpload: (files: FileList) => any; | ||
onSelect: (files: FileList) => Promise<any>; | ||
value?: string; | ||
text?: string; | ||
@@ -19,3 +20,3 @@ } | ||
clickStop: (event: React.MouseEvent<HTMLInputElement, MouseEvent>) => void; | ||
upload: () => void; | ||
select: () => void; | ||
drop: (event: React.DragEvent<HTMLDivElement>) => void; | ||
@@ -22,0 +23,0 @@ dragEnter: (event: React.DragEvent<HTMLDivElement>) => void; |
@@ -16,3 +16,3 @@ "use strict"; | ||
}, async () => { | ||
await this.props.onUpload(files); | ||
await this.props.onSelect(files); | ||
this.setState({ | ||
@@ -29,3 +29,3 @@ uploading: false | ||
}; | ||
this.upload = () => { | ||
this.select = () => { | ||
let fileInput = this.fileInput.current; | ||
@@ -62,7 +62,7 @@ let files = fileInput.files; | ||
render() { | ||
let { id, className, text } = this.props; | ||
let { id, className, text, value } = this.props; | ||
let classNames = className ? [className] : []; | ||
classNames.push('file-upload'); | ||
return (React.createElement("div", { id: id, className: classNames.join(' '), onDragOver: this.dragEnter, onDragEnter: this.dragEnter, onDragLeave: this.dragLeave, onDragEnd: this.dragLeave, onDrop: this.drop, onClick: this.click, "data-dragging": this.state.dragging, "data-uploading": this.state.uploading }, | ||
React.createElement("input", { type: "file", onChange: this.upload, onClick: this.clickStop, multiple: true, ref: this.fileInput }), | ||
React.createElement("input", { type: "file", onChange: this.select, value: value, onClick: this.clickStop, multiple: true, ref: this.fileInput }), | ||
text || 'Click or Drag and Drop to upload')); | ||
@@ -69,0 +69,0 @@ } |
export { default as BodyScroll } from '../util/BodyScroll'; | ||
export { default as BaseEventTarget, CustomEventListener, CustomEventTarget, DOMEvent } from '../util/BaseEventTarget'; | ||
export { default as ClassNames } from '../util/ClassNames'; | ||
@@ -3,0 +4,0 @@ export { default as DepthStack } from '../util/DepthStack'; |
@@ -5,2 +5,4 @@ "use strict"; | ||
exports.BodyScroll = BodyScroll_1.default; | ||
var BaseEventTarget_1 = require("../util/BaseEventTarget"); | ||
exports.BaseEventTarget = BaseEventTarget_1.default; | ||
var ClassNames_1 = require("../util/ClassNames"); | ||
@@ -7,0 +9,0 @@ exports.ClassNames = ClassNames_1.default; |
import * as React from 'react'; | ||
export declare function wait(time: number): Promise<unknown>; | ||
export declare function waitAnimation(time?: number): Promise<unknown>; | ||
export declare function setState<T>(state: T, thisArg: React.Component): Promise<void>; | ||
export declare function setState<T>(state: T, thisArg: React.Component<any, T>): Promise<void>; |
{ | ||
"name": "@artistry/react", | ||
"version": "0.6.4", | ||
"version": "0.6.6", | ||
"description": "A powerful component library for React", | ||
@@ -28,3 +28,3 @@ "repository": "https://www.github.com/sjohnsonaz/artistry-react.git", | ||
"peerDependencies": { | ||
"artistry": "^0.9.3", | ||
"artistry": "^0.9.7", | ||
"react": "16.11.0", | ||
@@ -40,3 +40,3 @@ "react-dom": "16.11.0" | ||
"@types/react-dom": "16.9.2", | ||
"artistry": "^0.9.3", | ||
"artistry": "^0.9.7", | ||
"autoprefixer": "9.7.4", | ||
@@ -43,0 +43,0 @@ "chai": "4.2.0", |
251342
6232