From 7f507a11aeb29640465f6fdd3c2969a6b63de33b Mon Sep 17 00:00:00 2001 From: endigo Date: Thu, 7 Dec 2017 02:03:03 +0800 Subject: [PATCH 1/5] add react-alice-carousel --- types/react-alice-carousel/index.d.ts | 129 ++++++++++++++++++ .../react-alice-carousel-tests.tsx | 61 +++++++++ types/react-alice-carousel/tsconfig.json | 24 ++++ types/react-alice-carousel/tslint.json | 1 + 4 files changed, 215 insertions(+) create mode 100644 types/react-alice-carousel/index.d.ts create mode 100644 types/react-alice-carousel/react-alice-carousel-tests.tsx create mode 100644 types/react-alice-carousel/tsconfig.json create mode 100644 types/react-alice-carousel/tslint.json diff --git a/types/react-alice-carousel/index.d.ts b/types/react-alice-carousel/index.d.ts new file mode 100644 index 0000000000..6f5034d28c --- /dev/null +++ b/types/react-alice-carousel/index.d.ts @@ -0,0 +1,129 @@ +// Type definitions for react-alert 2.4 +// Project: https://github.com/maxmarinich/react-alice-carousel +// Definitions by: endigo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +declare module 'react-big-calendar' { + import * as React from "react"; + + export interface EventObject { + item: number; + index: number; + } + + export interface ResponsiveSettings { + breakpoint: { + items: number; + }; + } + + export interface Props { + /** + * Fired when the event object is changing / returns event object + */ + onSlideChange?: (e: EventObject) => void; + /** + * Fired when the event object was changed / returns event object + */ + onSlideChanged?: (e: EventObject) => void; + /** + * Disable keys controls (left, right, space) + * + * Default: false. + */ + keysControlDisabled?: boolean; + /** + * Disable play/pause button + * + * Default: false. + */ + playButtonEnabled?: boolean; + /** + * Disable buttons control + * + * Default: false. + */ + buttonsDisabled?: boolean; + /** + * Disable dots navigation + * + * Default: false. + */ + dotsDisabled?: boolean; + /** + * Disable swipe handlers + * + * Default: false. + */ + swipeDisabled?: boolean; + /** + * Number of items in the slide. + * + * Default: {}. + */ + responsive?: ResponsiveSettings, + /** + * Duration of slides transition (milliseconds) + * + * Default: 250. + */ + duration?: number; + /** + * The starting index of the carousel + * + * Default: 0. + */ + startIndex?: number; + /** + * Sets the carousel at the specified position + * + * Default: 0. + */ + slideToIndex?: number; + /** + * Set auto play mode + * + * Default: false. + */ + autoPlay?: boolean; + /** + * Disable infinite mode + * + * Default: true. + */ + infinite?: boolean; + /** + * The offset of the alert from the page border, can be any number. + * + * Default: 14. + */ + mouseDragEnabled?: boolean; + /** + * Enable fadeout animation. Fired when 1 item is in the slide + * + * Default: false. + */ + fadeOutAnimation?: boolean; + /** + * Interval of auto play animation (milliseconds). If specified, a larger value will be taken from comparing this property and the duration one + * + * Default: 250. + */ + autoPlayInterval?: number; + /** + * To run auto play in the left direction specify rtl value + * + * Default: 'ltr'. + */ + autoPlayDirection?: string; + /** + * If this property is identified as true auto play animation will be stopped after clicking user on any gallery button + * + * Default: false. + */ + autoPlayActionDisabled?: boolean; + } + + export default class Carousel extends React.Component {} +} \ No newline at end of file diff --git a/types/react-alice-carousel/react-alice-carousel-tests.tsx b/types/react-alice-carousel/react-alice-carousel-tests.tsx new file mode 100644 index 0000000000..15e3e507ac --- /dev/null +++ b/types/react-alice-carousel/react-alice-carousel-tests.tsx @@ -0,0 +1,61 @@ +import * as React from 'react'; +import * as AliceCarousel from 'react-alice-carousel'; + +class SimpleAliceCarousel extends React.Component { + render() { + return ( +
+ +
+ ); + } +} + +class Gallery extends React.Component { + onSlideChange(e: AliceCarousel.EventObject) { + console.log('Item`s position during a change: ', e.item); + console.log('Slide`s position during a change: ', e.slide); + } + + onSlideChanged(e: AliceCarousel.EventObject) { + console.log('Item`s position after changes: ', e.item); + console.log('Slide`s position after changes: ', e.slide); + } + + render() { + const responsive = { + 0: { + items: 1 + }, + 600: { + items: 2 + }, + 1024: { + items: 3 + } + }; + + return ( + +

1

+

2

+

3

+

4

+

5

+
+ ); + } +} diff --git a/types/react-alice-carousel/tsconfig.json b/types/react-alice-carousel/tsconfig.json new file mode 100644 index 0000000000..4245303823 --- /dev/null +++ b/types/react-alice-carousel/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-alice-carousel-tests.tsx" + ] +} diff --git a/types/react-alice-carousel/tslint.json b/types/react-alice-carousel/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-alice-carousel/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From bc16dbd1aafab9576e4b92faa8ee60a1dada3dcc Mon Sep 17 00:00:00 2001 From: endigo Date: Thu, 7 Dec 2017 02:07:34 +0800 Subject: [PATCH 2/5] FIX: tests --- types/react-alice-carousel/index.d.ts | 14 ++++++-------- .../react-alice-carousel-tests.tsx | 12 ++++++------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/types/react-alice-carousel/index.d.ts b/types/react-alice-carousel/index.d.ts index 6f5034d28c..bef670f004 100644 --- a/types/react-alice-carousel/index.d.ts +++ b/types/react-alice-carousel/index.d.ts @@ -4,19 +4,15 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -declare module 'react-big-calendar' { +declare module 'react-alice-carousel' { import * as React from "react"; export interface EventObject { item: number; - index: number; + slide: number; } - export interface ResponsiveSettings { - breakpoint: { - items: number; - }; - } + export interface ResponsiveSettings {} export interface Props { /** @@ -125,5 +121,7 @@ declare module 'react-big-calendar' { autoPlayActionDisabled?: boolean; } - export default class Carousel extends React.Component {} + class Carousel extends React.PureComponent {} + + export default Carousel; } \ No newline at end of file diff --git a/types/react-alice-carousel/react-alice-carousel-tests.tsx b/types/react-alice-carousel/react-alice-carousel-tests.tsx index 15e3e507ac..89cb335203 100644 --- a/types/react-alice-carousel/react-alice-carousel-tests.tsx +++ b/types/react-alice-carousel/react-alice-carousel-tests.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; -import * as AliceCarousel from 'react-alice-carousel'; +import AliceCarousel, { Props, EventObject, ResponsiveSettings } from 'react-alice-carousel'; -class SimpleAliceCarousel extends React.Component { +class SimpleAliceCarousel extends React.Component { render() { return (
@@ -11,19 +11,19 @@ class SimpleAliceCarousel extends React.Component { } } -class Gallery extends React.Component { - onSlideChange(e: AliceCarousel.EventObject) { +class Gallery extends React.Component { + onSlideChange(e: EventObject) { console.log('Item`s position during a change: ', e.item); console.log('Slide`s position during a change: ', e.slide); } - onSlideChanged(e: AliceCarousel.EventObject) { + onSlideChanged(e: EventObject) { console.log('Item`s position after changes: ', e.item); console.log('Slide`s position after changes: ', e.slide); } render() { - const responsive = { + const responsive: ResponsiveSettings = { 0: { items: 1 }, From 1372375b68aa0a30ff4d151830866730f6e5180d Mon Sep 17 00:00:00 2001 From: endigo Date: Thu, 7 Dec 2017 02:22:14 +0800 Subject: [PATCH 3/5] lint --- types/react-alice-carousel/index.d.ts | 230 +++++++++--------- .../react-alice-carousel-tests.tsx | 12 +- 2 files changed, 118 insertions(+), 124 deletions(-) diff --git a/types/react-alice-carousel/index.d.ts b/types/react-alice-carousel/index.d.ts index bef670f004..77349a5ae0 100644 --- a/types/react-alice-carousel/index.d.ts +++ b/types/react-alice-carousel/index.d.ts @@ -4,124 +4,118 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -declare module 'react-alice-carousel' { - import * as React from "react"; +import * as React from "react"; - export interface EventObject { - item: number; - slide: number; - } +export interface EventObject { + item: number; + slide: number; +} - export interface ResponsiveSettings {} +export interface Props { + /** + * Fired when the event object is changing / returns event object + */ + onSlideChange?: (e: EventObject) => void; + /** + * Fired when the event object was changed / returns event object + */ + onSlideChanged?: (e: EventObject) => void; + /** + * Disable keys controls (left, right, space) + * + * Default: false. + */ + keysControlDisabled?: boolean; + /** + * Disable play/pause button + * + * Default: false. + */ + playButtonEnabled?: boolean; + /** + * Disable buttons control + * + * Default: false. + */ + buttonsDisabled?: boolean; + /** + * Disable dots navigation + * + * Default: false. + */ + dotsDisabled?: boolean; + /** + * Disable swipe handlers + * + * Default: false. + */ + swipeDisabled?: boolean; + /** + * Number of items in the slide. + * + * Default: {}. + */ + responsive?: {}; + /** + * Duration of slides transition (milliseconds) + * + * Default: 250. + */ + duration?: number; + /** + * The starting index of the carousel + * + * Default: 0. + */ + startIndex?: number; + /** + * Sets the carousel at the specified position + * + * Default: 0. + */ + slideToIndex?: number; + /** + * Set auto play mode + * + * Default: false. + */ + autoPlay?: boolean; + /** + * Disable infinite mode + * + * Default: true. + */ + infinite?: boolean; + /** + * The offset of the alert from the page border, can be any number. + * + * Default: 14. + */ + mouseDragEnabled?: boolean; + /** + * Enable fadeout animation. Fired when 1 item is in the slide + * + * Default: false. + */ + fadeOutAnimation?: boolean; + /** + * Interval of auto play animation (milliseconds). If specified, a larger value will be taken from comparing this property and the duration one + * + * Default: 250. + */ + autoPlayInterval?: number; + /** + * To run auto play in the left direction specify rtl value + * + * Default: 'ltr'. + */ + autoPlayDirection?: string; + /** + * If this property is identified as true auto play animation will be stopped after clicking user on any gallery button + * + * Default: false. + */ + autoPlayActionDisabled?: boolean; +} - export interface Props { - /** - * Fired when the event object is changing / returns event object - */ - onSlideChange?: (e: EventObject) => void; - /** - * Fired when the event object was changed / returns event object - */ - onSlideChanged?: (e: EventObject) => void; - /** - * Disable keys controls (left, right, space) - * - * Default: false. - */ - keysControlDisabled?: boolean; - /** - * Disable play/pause button - * - * Default: false. - */ - playButtonEnabled?: boolean; - /** - * Disable buttons control - * - * Default: false. - */ - buttonsDisabled?: boolean; - /** - * Disable dots navigation - * - * Default: false. - */ - dotsDisabled?: boolean; - /** - * Disable swipe handlers - * - * Default: false. - */ - swipeDisabled?: boolean; - /** - * Number of items in the slide. - * - * Default: {}. - */ - responsive?: ResponsiveSettings, - /** - * Duration of slides transition (milliseconds) - * - * Default: 250. - */ - duration?: number; - /** - * The starting index of the carousel - * - * Default: 0. - */ - startIndex?: number; - /** - * Sets the carousel at the specified position - * - * Default: 0. - */ - slideToIndex?: number; - /** - * Set auto play mode - * - * Default: false. - */ - autoPlay?: boolean; - /** - * Disable infinite mode - * - * Default: true. - */ - infinite?: boolean; - /** - * The offset of the alert from the page border, can be any number. - * - * Default: 14. - */ - mouseDragEnabled?: boolean; - /** - * Enable fadeout animation. Fired when 1 item is in the slide - * - * Default: false. - */ - fadeOutAnimation?: boolean; - /** - * Interval of auto play animation (milliseconds). If specified, a larger value will be taken from comparing this property and the duration one - * - * Default: 250. - */ - autoPlayInterval?: number; - /** - * To run auto play in the left direction specify rtl value - * - * Default: 'ltr'. - */ - autoPlayDirection?: string; - /** - * If this property is identified as true auto play animation will be stopped after clicking user on any gallery button - * - * Default: false. - */ - autoPlayActionDisabled?: boolean; - } - - class Carousel extends React.PureComponent {} - - export default Carousel; -} \ No newline at end of file +export default class Carousel extends React.PureComponent {} diff --git a/types/react-alice-carousel/react-alice-carousel-tests.tsx b/types/react-alice-carousel/react-alice-carousel-tests.tsx index 89cb335203..9a123a5748 100644 --- a/types/react-alice-carousel/react-alice-carousel-tests.tsx +++ b/types/react-alice-carousel/react-alice-carousel-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import AliceCarousel, { Props, EventObject, ResponsiveSettings } from 'react-alice-carousel'; +import AliceCarousel, { Props, EventObject } from 'react-alice-carousel'; class SimpleAliceCarousel extends React.Component { render() { @@ -13,17 +13,17 @@ class SimpleAliceCarousel extends React.Component { class Gallery extends React.Component { onSlideChange(e: EventObject) { - console.log('Item`s position during a change: ', e.item); - console.log('Slide`s position during a change: ', e.slide); + // console.log('Item`s position during a change: ', e.item); + // console.log('Slide`s position during a change: ', e.slide); } onSlideChanged(e: EventObject) { - console.log('Item`s position after changes: ', e.item); - console.log('Slide`s position after changes: ', e.slide); + // console.log('Item`s position after changes: ', e.item); + // console.log('Slide`s position after changes: ', e.slide); } render() { - const responsive: ResponsiveSettings = { + const responsive = { 0: { items: 1 }, From 07c774bba15204aa16d8c72aeac0b3bf7f949c7c Mon Sep 17 00:00:00 2001 From: endigo Date: Wed, 13 Dec 2017 18:23:19 +0800 Subject: [PATCH 4/5] FIX: type definitions for react-alice-carousel --- types/react-alice-carousel/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-alice-carousel/index.d.ts b/types/react-alice-carousel/index.d.ts index 77349a5ae0..d4a1ef981f 100644 --- a/types/react-alice-carousel/index.d.ts +++ b/types/react-alice-carousel/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-alert 2.4 +// Type definitions for react-alice-carousel 1.7.1 // Project: https://github.com/maxmarinich/react-alice-carousel // Definitions by: endigo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From eb219595ed06a99a0500ee4f0e947761fe20fef7 Mon Sep 17 00:00:00 2001 From: endigo Date: Thu, 14 Dec 2017 00:33:42 +0800 Subject: [PATCH 5/5] FIX: MAJOR.MINOR --- types/react-alice-carousel/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-alice-carousel/index.d.ts b/types/react-alice-carousel/index.d.ts index d4a1ef981f..47d4fd95de 100644 --- a/types/react-alice-carousel/index.d.ts +++ b/types/react-alice-carousel/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-alice-carousel 1.7.1 +// Type definitions for react-alice-carousel 1.7 // Project: https://github.com/maxmarinich/react-alice-carousel // Definitions by: endigo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped